Skip to content

feat: add LLaDA-Image support - #1968

Open
fszontagh wants to merge 3 commits into
leejet:masterfrom
fszontagh:feat/llada-image
Open

fszontagh wants to merge 3 commits into
leejet:masterfrom
fszontagh:feat/llada-image

Conversation

@fszontagh

@fszontagh fszontagh commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds text-to-image and instruction-guided editing for LLaDA-Image (Apache-2.0): a 6B Lumina2/Z-Image-style NextDiT conditioned by a LLaDA2-MoE diffusion-LLM text encoder, reusing the Flux.2 VAE.

Most of it reuses what is already here. The DiT instantiates ZImage::JointTransformerBlock and FinalLayer with identical hyperparameters, and the text encoder is a new LLMArch::LLADA2_MOE on the existing MoE path. New are the QueryFormer, the text projection, and SigVQ for editing, plus the llada_image reference-image preset and sigma schedule. Editing runs the clean reference and the noisy target in one sequence; adaLN is linear in the timestep embedding, so feeding a per-token embedding selects the right modulation without new modulation machinery.

The LLaDA2 vocabulary is not embedded, so --tokenizer with the model's tokenizer.json is required, per the embedded-data allowlist in CONTRIBUTING.md.

One change outside the model: tensor_should_be_converted now skips *_pad_token. LLaDA-Image stores those around 7.7e24, which overflows both f16 storage and q8_0's f16 block scale, so every converted GGUF rendered blank white without it.

Docs in docs/llada_image.md; rows added to README.md and docs/edit.md.

Related Issue / Discussion

Closes #1937

Additional Information

Verified on an RTX 3060 12GB, CUDA. Both checkpoints work: LLaDA-Image-Turbo does text-to-image and editing at 512x512 and 1024x1024, and the 50-step base model at --steps 50 --cfg-scale 5 does both at 1024x1024. At 512x512 the base model's editing returns the reference almost unchanged, which the docs note.

--max-vram 6, --max-vram 4 and --max-vram 3 all produce byte-identical output to unconstrained execution.

Not implemented: generation_mode="vq", where the text encoder block-diffusion-decodes VQ tokens before diffusion. Text-to-image and editing do not use that path.

Checklist

Comment thread src/tokenizers/vocab/llada2_merges.hpp Outdated
@fszontagh
fszontagh force-pushed the feat/llada-image branch 2 times, most recently from c1e7233 to f642157 Compare September 13, 2026 17:19
@fszontagh
fszontagh marked this pull request as draft September 13, 2026 18:05
@fszontagh
fszontagh force-pushed the feat/llada-image branch 2 times, most recently from 146b53f to 7a19970 Compare September 14, 2026 16:28
@fszontagh

Copy link
Copy Markdown
Contributor Author

Both done: vocab and merges are on a single line now, and the helper scripts are removed.

Since the merge script is gone, I converted the weights for both checkpoints and uploaded them, so the docs link ready-made files instead of asking people to build their own. Links are in docs/llada_image.md.

@fszontagh
fszontagh marked this pull request as ready for review September 14, 2026 18:41
@fszontagh

Copy link
Copy Markdown
Contributor Author

Rebased on master and dropped the embedded vocab, following #1974. LLaDA2 now needs --tokenizer with the model's tokenizer.json, and fails with a clear message if it's missing. Also fixed the encode() call for the new signature.

Output is pixel-identical to the old embedded-vocab build.

Updated the PR description too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] LLaDA-Image 6B

2 participants