From 28ba2dc638056184e04fe2b90db736e317c82eb3 Mon Sep 17 00:00:00 2001 From: kijai <40791699+kijai@users.noreply.github.com> Date: Sun, 23 Feb 2025 14:25:36 +0200 Subject: [PATCH] Better error for incompatible VAE --- .gitignore | 3 ++- nodes.py | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 7c5fc03..49a4514 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,5 @@ logs/ *.DS_Store .idea tools/ -.vscode/ \ No newline at end of file +.vscode/ +convert_* \ No newline at end of file diff --git a/nodes.py b/nodes.py index 049076f..24eb0fa 100644 --- a/nodes.py +++ b/nodes.py @@ -559,6 +559,11 @@ class HyVideoVAELoader: vae_config = json.load(f) model_path = folder_paths.get_full_path("vae", model_name) vae_sd = load_torch_file(model_path, safe_load=True) + + if not "decoder.conv_norm_out.weight" in vae_sd: + raise ValueError(""" +Incompatible VAE model selected, the HunyuanVideoWrapper's VAE nodes require using the original VAE model: 'https://huggingface.co/Kijai/HunyuanVideo_comfy/blob/main/hunyuan_video_vae_bf16.safetensors' +Alternatively you can also use the ComfyUI native VAELoader and the usual VAE nodes with the wrapper.""") vae = AutoencoderKLCausal3D.from_config(vae_config) vae.load_state_dict(vae_sd)