loras: load Z-Image via ZImagePipeline (fix 4-bit text-encoder quant-state crash)
QLoRA training crashed in the Qwen3 TEXT ENCODER: the unsloth build quantizes it
too, and loading components piecemeal (AutoModel/AutoencoderKL by subfolder) left
bitsandbytes' 4-bit quant-state unreconstructed -> "FP4 quantization state not
initialized" / AssertionError in Linear4bit.forward.
- Load all components via ZImagePipeline.from_pretrained (the proven inference
loader, which loads each 4-bit component correctly), then LoRA-train only the
transformer. VAE/text-encoder are encoded once then freed (4-bit modules can't
.to('cpu'), so drop refs + free).
- Disable gradient checkpointing for the 4-bit path: the recompute can desync bnb's
quant-state. At 512/batch-1 the 4-bit base + activations fit without it.
Co-Authored-By:
Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RdMufYvtTbtGDWsiZVoXce
Showing
Please
register
or
sign in
to comment