• Stefy Lanza (nextime / spora )'s avatar
    loras: train Z-Image LoRA via 4-bit QLoRA (fast, uses the cached turbo build) · 26bdb59e
    Stefy Lanza (nextime / spora ) authored
    Training on the full bf16 Tongyi-MAI/Z-Image-Turbo was extremely slow — a ~10-min
    download plus a heavy bf16 model that doesn't fit cleanly on 24 GB. Switch _train_dit
    to QLoRA: load the transformer in 4-bit (frozen, ~4 GB, no CPU offload) and train the
    LoRA on top. This trains directly on the already-cached 4-bit (e.g. unsloth) build —
    no redirect to the full model, no download.
    
    - Load transformer with diffusers BitsAndBytesConfig (nf4); an already-4-bit
      checkpoint (embedded quant config, e.g. unsloth) is loaded as-is via fallback.
    - Enable gradient checkpointing and force the input-embedding (all_x_embedder)
      output to require grad so QLoRA grads reach the attention LoRA layers; hooks
      removed at job end.
    - Drop the quantized-base -> full-model redirect added earlier.
    
    LoRA still applies to the quantized model at inference (identical architecture).
    Co-Authored-By: 's avatarClaude Opus 4.8 <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_01RdMufYvtTbtGDWsiZVoXce
    26bdb59e
Name
Last commit
Last update
codai Loading commit data...
docs Loading commit data...
packaging Loading commit data...
samples Loading commit data...
tests Loading commit data...
tools Loading commit data...
.dockerignore Loading commit data...
.gitignore Loading commit data...
AI.PROMPT Loading commit data...
CODERAI_API_DOCUMENTATION.md Loading commit data...
CoderAI.gif Loading commit data...
DISTRIBUTION.md Loading commit data...
LICENSE.md Loading commit data...
MULTIMODAL_CAPABILITIES.md Loading commit data...
MULTIMODAL_UI_EXAMPLES.md Loading commit data...
README.md Loading commit data...
build-oci.sh Loading commit data...
build.ps1 Loading commit data...
build.sh Loading commit data...
coderai Loading commit data...
coderai-broker-implementation-reference.md Loading commit data...
coderai-integration.md Loading commit data...
commands Loading commit data...
osxbuild.sh Loading commit data...
package-oci.sh Loading commit data...
package-tarball.sh Loading commit data...
requirements-nvidia.txt Loading commit data...
requirements-vulkan.txt Loading commit data...
requirements.txt Loading commit data...
run-oci.sh Loading commit data...
smoke-test-oci.sh Loading commit data...
todo.md Loading commit data...
video_editor.config.json Loading commit data...