Add FLUX.2-dev support with Mistral text encoder - #45
Closed
marcelcotta wants to merge 1 commit into
Closed
Conversation
FLUX.2-dev is a 32B parameter model by Black Forest Labs that uses a different architecture from the existing Klein variants: - Text encoder: Mistral-Small-3.2-24B (layers 10/20/30, 15360-dim output + pooled embedding), instead of Qwen3 - Guidance: embedded directly in the transformer via a guidance embedder (guidance-distilled), no Classifier-Free Guidance needed - Defaults: 30 steps, guidance scale 3.5 New files: - iris_mistral.c/h: Mistral-Small-3.2-24B encoder implementation - iris_mistral_tokenizer.c: Mistral BPE tokenizer (SentencePiece-style) Transformer changes: - Guidance and text pooled embedders (time_text_embed naming convention) - Tensor name fallback for dev vs klein weight files - Chunked attention for large sequences (keeps score matrix small) - Multiref RoPE caching across denoising steps - BF16/F16 warmup dispatch for M1/M2 vs M3+ hardware Other changes: - Auto-detection via guidance_embeds config field - Batch generation mode (-N flag) and --step-dir for file-based previews - SDPA forward declaration for macOS 14 compatibility - README documentation for model architecture, download, and usage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
guidance_embeds: true)New files
iris_mistral.c/h— Mistral-Small-3.2-24B encoder implementationiris_mistral_tokenizer.c— Mistral BPE tokenizer (SentencePiece-style)Transformer changes
time_text_embed.*weight naming)Other changes
-Nflag) and--step-dirfor file-based step previewsTest plan
make mps/make blas./iris -d flux-2-dev -p "a cat" -o /tmp/test.png./iris -d flux-klein-4b -p "a cat" -N 3 -o /tmp/batch.png