ai-toolkit/extensions_built_in/diffusion_models
科林 KELIN 489b194231
Fix CPU/CUDA device mismatch in Klein edit control image encoding (#742)
When training Klein models with a `control_path` (edit/kontext-style
paired datasets), `encode_image_refs()` returns tensors that reside on
the VAE's device (CPU, since the VAE weights are loaded via
`load_file(..., device="cpu")` and are never explicitly moved to the
training device).  Concatenating those CPU tensors with the training
latents (`packed_latents`) that live on CUDA raises:

    RuntimeError: Expected all tensors to be on the same device

Fix: move `img_cond_seq` and `img_cond_seq_ids` to the same device
(and dtype) as `img_input` / `img_input_ids` before concatenation.

Co-authored-by: HuangYuChuh <HuangYuChuh@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-25 11:45:38 -06:00
..
chroma Fix issue with chroma when not quantizing 2025-10-19 12:13:05 -06:00
f_light Added initial support for f-lite model 2025-05-01 11:15:18 -06:00
flux2 Fix CPU/CUDA device mismatch in Klein edit control image encoding (#742) 2026-03-25 11:45:38 -06:00
flux_kontext fix: Guidance incorrect shape 2025-07-18 12:49:18 +02:00
hidream Added initial support for Hidream E1 training 2025-07-27 15:12:56 -06:00
ltx2 Fix issue with ltx2 custom te repo path 2026-03-25 09:50:18 -06:00
omnigen2 Allow control image for omnigen training and sampling 2025-07-09 13:54:55 -06:00
qwen_image Fix Qwen attention mask crash with diffusers >=0.37 (#748) 2026-03-23 14:43:08 -06:00
wan22 Added initial support for layer offloading wit Wan 2.2 14B models. 2025-10-20 14:54:30 -06:00
z_image Fix issue that prevented ramtorch layer offloading with z_image 2025-12-02 16:14:34 -07:00
zeta_chroma Add support for training lodestones/Zeta-Chroma 2026-03-01 12:52:29 -07:00
__init__.py Add support for training LTX 2.3 (#745) 2026-03-22 17:56:59 -06:00