Qwen Image 2.1 HDR VAE
NOTE: This works as part of the "diffusers import QwenImage21Pipeline" currently support comfy-ui is questionable.
Fine-tuned Qwen Image 2.1 autoencoder for RGBA / HDR-oriented reconstruction.
The goal is stronger dynamic range, color volume, and detail energy for HDR-style workflows—not perfect fidelity to the source frame.
+34% color volume
+50% edge density
+16% gradient energy
2× sharpness
+20% saturation
QWEN HDR VAE maintains extremely high SSIM score of 0.944 vs 0.958 (Base 2.1 VAE). PSNR drops by 6db which is expected when the goal is enhancement.
## License
See LICENSE (Qwen Research terms).
Description
FAQ
Comments (23)
It might be a mistake on my part, but it's not working in ComfyUI.
Error(s) in loading state_dict for AutoencodingEngine: size mismatch for encoder.conv_in.weight: copying a param with shape torch.Size([96, 4, 3, 3]) from checkpoint, the shape in current model is torch.Size([128, 3, 3, 3]). size mismatch for encoder.conv_in.bias: copying a param with shape torch.Size([96]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for encoder.conv_out.weight: copying a param with shape torch.Size([128, 768, 3, 3]) from checkpoint, the shape in current model is torch.Size([128, 1024, 3, 3]). size mismatch for decoder.conv_in.weight: copying a param with shape torch.Size([1152, 64, 3, 3]) from checkpoint, the shape in current model is torch.Size([1024, 64, 3, 3]). size mismatch for decoder.conv_in.bias: copying a param with shape torch.Size([1152]) from checkpoint, the shape in current model is torch.Size([1024]). size mismatch for decoder.conv_out.weight: copying a param with shape torch.Size([4, 144, 3, 3]) from checkpoint, the shape in current model is torch.Size([3, 128, 3, 3]). size mismatch for decoder.conv_out.bias: copying a param with shape torch.Size([4]) from checkpoint, the shape in current model is torch.Size([3]).
Same error for me too.
Same error.
你这是wan2.1用的
You might need the vae utils node pack, I'm not at the computer right now so can't test or tell you the exact node pack name, but it allows for more complex vaes to be used in comfyui.
@n67113610 The same error occurs even when using the corresponding VAE node.
It requires AutoencoderKLQwenImage21 which has not even been merged into diffusers main, or its currently in the process of being merged in.
It's also very likely comfy changed the format again without documentation
@Felldude it's pipeline issue, I've made a comfy compatible out of it, i can send you a link if you want to upload it here
@3XD did they do this shit again without documenting it - https://github.com/kohya-ss/sd-scripts/blob/main/library/qwen_image_autoencoder_kl_2d.py
@Felldude listed the internal and looked at line 639 comfy/sd.py the vae has diffusers names so it lands in the 64-channel branch meant for the hunyuan vae and dies on a shape mismatch,,, anyway here it is in case you wanna upload it here https://limewire.com/d/Zr7Pb#GvuMMT3qY6
It appears as if comfy is just dumbing down the model to wan vae - I am so sick of comfys shit dumbing down models
@Felldude im new to all this, but can we just get an LLM to fix/override? either in comfy core or in a custom node?
@eicosa No comfy is changing the shape of the model in some cases removing blocks or full functions of the model - You could have a comfy node that just uses diffusers format but then you would likely not be able to cpu offload most models
@Felldude nothing magical about that vae, the converted one is 99% identical with the diffusers one,
if you run per tensor test you'll get median 0.18 %, max 1.9 %
per-channel best-fit gain r 1.091, g 1.047, b 1.067, alpha 1.009 (untouched)
so 99.8 % identical but the decode is slightly punchier rgb tone (a few percent contrast/gain, alpha unchanged)
@3XD If its just renaming/reordering should not be as bad, I don't feel like going through comfy sd.py to reverse it so anyone that wants to link to a script to do it
@eicosa looks like it would work
does this eliminate the halftone effect of the default Vae?
I don't think the VAE is the cause of any pattern your seeing in the image, in of itself. I am not 100% sure what your referring to though
@Felldude its something that was in the other qwen vae's, for those someone created a different vae that dealt with it to a degree. you can see it if you zoom in to most pictures. Anyway thanks for letting me know.
Does this work now, or should I use your other vae for Anima Krea Qwen?
Comfy still uses WAN vae by default for 2.1