Instructions to use alibaba-pai/Qwen-Image-2.1-Fun-Controlnet-Union with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- VideoX Fun
How to use alibaba-pai/Qwen-Image-2.1-Fun-Controlnet-Union with VideoX Fun:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
support comfyui please
please provide support comfyui please , Thankyou somuch 🙏🙏
I got it working. Maybe hacky but I am able to pass skeletons to it and get awesome poses now.
- The VRAM Problem & FP8 Quantization
The Problem: The official model (Qwen-Image-2.1-Fun-Controlnet-Union.safetensors by Alibaba-PAI) is 7.03 GB in BF16. When paired with the 7B DiT model (qwen-image-2.1-Q4_K_M.gguf ~4.5 GB) and the 8B Vision-Language text encoder (qwen3vl_8b_nvfp4 ~5.5 GB), memory peaked past 17 GB during the initial forward pass, triggering instant torch.OutOfMemoryError on a 16 GB card.
The Fix: Quantized the entire ControlNet to FP8 (torch.float8_e4m3fn), slicing its footprint exactly in half down to 3.52 GB. This left enough GPU headroom for the DiT attention activations, VAE decode, and conditioning caches. - ComfyUI Core Architectural Mismatches
When we first loaded the ControlNet on Qwen 2.1 in ComfyUI, ComfyUI crashed because the underlying architecture didn’t have ControlNet hooks for Qwen 2.1:
GGUF Model Patcher Wrapper: ComfyUI’s ControlNetLoader failed because GGUF models are wrapped in a GGUFModelPatcher. We patched comfy/controlnet.py to unwrap .diffusion_model directly so the patcher could bind weights into the DiT blocks.
Missing Image Conditioning Interface: comfy/ldm/qwen_image21/model.py lacked the process_img method and patch_size = 2 attribute expected by the ControlNet forward pass. We bridged these attributes into QwenImage21Transformer2DModel.
Positional Embedding & Dimension Collisions: The Alibaba Union ControlNet was attempting a double projection on the 4096-dimensional token space and passed 2D img_ids where Qwen 2.1’s 3D RoPE expected (T, H, W). We patched comfy/ldm/qwen_image/controlnet.py to align the rope dimensions.
3. Fixing the Dark Collapse & Severe Blurriness
Once the graph executed, the initial outputs either collapsed into dark, corrupted latents or exhibited heavy ghosting and soft-focus blurriness. Three factors caused this:
The Sampler / Scheduler Curve:
Why it failed: With progressive flow distillation (Qwen-Image-2.1-Fun-Acc-4Step), using a linear euler + simple scheduler truncated the denoising trajectory prematurely, failing to resolve fine details (skin texture, eyes, edges).
The Fix: Switched to the beta scheduler (scheduler: "beta"). Beta concentrates step intervals at higher signal-to-noise ratios (SNR), which matches the flow-matching noise schedule and resolves micro-details cleanly.
ControlNet Overdrive (The "Guidance Window"):
Why it failed: Running ControlNet at strength: 0.8 from step 0 to 100% (start: 0.0, end: 1.0) forced external vector injection across all steps. In accelerated flow matching, this derails the solver and causes latent collapse.
The Fix: Set strength: 0.40, start_percent: 0.0, and end_percent: 0.50. ControlNet guides the macroscopic structural pose in the first half of the trajectory, then steps away completely so the model's native attention can freely denoise pristine facial features, hair, and textures.
Step Budget:
Stepping from 4 → 8 → 16 steps with euler + beta gave the flow vector field the resolution it needed to converge to photorealistic DSLR sharpness, crisp individual fingers, and accurate background depth-of-field.