ComfyUI/comfy
bigjimmy 7ecc3a3935 fix: Z-Image LoRA and model loading for HuggingFace format weights
Three fixes for Z-Image Turbo support:

1. model_detection.py: Add Z-Image to convert_diffusers_mmdit() so HF-format
   safetensors (using to_q/to_k/to_v + all_x_embedder.2-1 key names) are
   detected and converted.

2. sd.py: Apply the Z-Image key conversion when loading a ZImage model whose
   weights are in HF format (all_x_embedder.2-1 present), mapping separate
   to_q/to_k/to_v weights into the combined qkv format ComfyUI expects.

3. lora.py: Fix sliced LoRA patches being silently discarded. In
   calculate_weight(), when a LoRA targets a slice of a combined weight
   (e.g. to_q/to_k/to_v -> qkv), the computed output was never written back
   to the weight tensor. Fix by calling narrow().copy_() before restoring
   old_weight. This affected any LoRA using sliced key mappings.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-01 22:21:01 +08:00
..
audio_encoders Reduce RAM usage, fix VRAM OOMs, and fix Windows shared memory spilling with adaptive model loading (#11845) 2026-02-01 01:01:11 -05:00
cldm
comfy_types feat: add gradient-slider display mode for FLOAT inputs (#12536) 2026-02-20 22:52:32 -08:00
extra_samplers
image_encoders
k_diffusion ace15: Use dynamic_vram friendly trange (#12409) 2026-02-11 14:53:42 -05:00
ldm feat: Support SCAIL WanVideo model (#12614) 2026-02-28 16:49:12 -05:00
sd1_tokenizer
t2i_adapter
taesd Support LTX2 tiny vae (taeltx_2) (#11929) 2026-01-21 23:03:51 -05:00
text_encoders fix(ace15): handle missing lm_metadata in memory estimation during checkpoint export #12669 (#12686) 2026-02-28 01:18:40 -05:00
weight_adapter MPDynamic: force load flux img_in weight (Fixes flux1 canny+depth lora crash) (#12446) 2026-02-15 20:30:09 -05:00
cli_args.py cli_args: Default comfy to DynamicVram mode (#12658) 2026-02-28 16:52:30 -05:00
clip_config_bigg.json
clip_model.py Support the siglip 2 naflex model as a clip vision model. (#11831) 2026-01-12 17:05:54 -05:00
clip_vision_config_g.json
clip_vision_config_h.json
clip_vision_config_vitl_336_llava.json
clip_vision_config_vitl_336.json
clip_vision_config_vitl.json
clip_vision_siglip2_base_naflex.json Support the siglip 2 naflex model as a clip vision model. (#11831) 2026-01-12 17:05:54 -05:00
clip_vision_siglip_384.json
clip_vision_siglip_512.json
clip_vision.py Reduce RAM usage, fix VRAM OOMs, and fix Windows shared memory spilling with adaptive model loading (#11845) 2026-02-01 01:01:11 -05:00
conds.py Cleanups to the last PR. (#12646) 2026-02-26 01:30:31 -05:00
context_windows.py Add handling for vace_context in context windows (#11386) 2025-12-30 14:40:42 -08:00
controlnet.py Add working Qwen 2512 ControlNet (Fun ControlNet) support (#12359) 2026-02-13 22:23:52 -05:00
diffusers_convert.py
diffusers_load.py
float.py Optimize nvfp4 lora applying. (#11866) 2026-01-14 00:49:38 -05:00
gligen.py
hooks.py New Year ruff cleanup. (#11595) 2026-01-01 22:06:14 -05:00
latent_formats.py Basic support for the ace step 1.5 model. (#12237) 2026-02-03 00:06:18 -05:00
lora_convert.py Use torch RMSNorm for flux models and refactor hunyuan video code. (#12432) 2026-02-13 15:35:13 -05:00
lora.py fix: Z-Image LoRA and model loading for HuggingFace format weights 2026-03-01 22:21:01 +08:00
memory_management.py comfy-aimdo 0.2 - Improved pytorch allocator integration (#12557) 2026-02-21 10:52:57 -08:00
model_base.py feat: Support SCAIL WanVideo model (#12614) 2026-02-28 16:49:12 -05:00
model_detection.py fix: Z-Image LoRA and model loading for HuggingFace format weights 2026-03-01 22:21:01 +08:00
model_management.py Disable dynamic vram on wsl. (#12706) 2026-02-28 22:23:28 -05:00
model_patcher.py Disable dynamic_vram when weight hooks applied (#12653) 2026-02-28 16:50:18 -05:00
model_sampling.py initial FlowRVS support (#12637) 2026-02-25 23:38:46 -05:00
nested_tensor.py
ops.py ops: implement lora requanting for non QuantizedTensor fp8 (#12668) 2026-02-27 19:05:51 -05:00
options.py
patcher_extension.py
pinned_memory.py fix pinning with model defined dtype (#12208) 2026-02-01 08:42:32 -08:00
pixel_space_convert.py
quant_ops.py Optimize nvfp4 lora applying. (#11866) 2026-01-14 00:49:38 -05:00
rmsnorm.py Remove code to support RMSNorm on old pytorch. (#12499) 2026-02-16 20:09:24 -05:00
sample.py Make regular empty latent node work properly on flux 2 variants. (#12050) 2026-01-23 19:50:48 -05:00
sampler_helpers.py Disable dynamic_vram when weight hooks applied (#12653) 2026-02-28 16:50:18 -05:00
samplers.py Disable dynamic_vram when weight hooks applied (#12653) 2026-02-28 16:50:18 -05:00
sd1_clip_config.json
sd1_clip.py Force min length 1 when tokenizing for text generation. (#12538) 2026-02-19 22:57:44 -05:00
sd.py fix: Z-Image LoRA and model loading for HuggingFace format weights 2026-03-01 22:21:01 +08:00
sdxl_clip.py
supported_models_base.py
supported_models.py feat: Support SCAIL WanVideo model (#12614) 2026-02-28 16:49:12 -05:00
utils.py Fix Aimdo fallback on probe to not use zero-copy sft (#12634) 2026-02-25 16:49:48 -05:00
windows.py Reduce RAM usage, fix VRAM OOMs, and fix Windows shared memory spilling with adaptive model loading (#11845) 2026-02-01 01:01:11 -05:00