How to use from the
Use from the
Diffusers library
pip install -U diffusers transformers accelerate
import torch
from diffusers import DiffusionPipeline

# switch to "mps" for apple devices
pipe = DiffusionPipeline.from_pretrained("kimi000/Flux3-Klein-4Step-Raw2Q-2000", dtype=torch.bfloat16, device_map="cuda")

prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"
image = pipe(prompt).images[0]

FLUX3 Klein Four-Step β€” Relative1 Raw2Q, step 2000

Standalone Diffusers-format, merged EMA export of the relative1/raw2q experiment at exactly 2000 optimizer updates. This is a separate experiment from kimi000/Flux3-Klein-4Step-2000; weights and scheduler settings differ.

The generator has one relative interval head. Training used raw2q paired regression, LoRAv2 attention/MLP/output adapters (rank/alpha 256; conditioning and text/time input projections excluded), AdamW betas (0, 0.999), and a separate 64-head fake model. Only the generator EMA is needed and included for inference; all 458 EMA adapter tensors are merged into the BF16 transformer. No FAR checkout, PEFT adapter loading, or original base weights are needed.

The repository includes safetensors transformer shards, text encoder, native FP32 VAE, tokenizer, custom Diffusers pipeline/components, scheduler configuration, demo.py, pinned requirements, licenses and provenance in export_metadata.json.

Install and run

Use Python 3.10+ and a CUDA GPU. Install the CUDA-enabled PyTorch build appropriate for your machine first. The versions in requirements.txt are the tested environment.

python -m pip install -r requirements.txt
python demo.py --prompt 'A ceramic mug with the words "GOOD MORNING" printed on it.' --output mug.png
# Reduce GPU memory usage by offloading components to CPU:
python demo.py --cpu-offload --prompt 'A vintage pastel illustration of a tropical beach.' --output beach.png
# Run entirely from a downloaded folder:
python demo.py --model /path/to/Flux3-Klein-4Step-Raw2Q-2000 --cpu-offload

The demo defaults to this HF repository and downloads required files automatically. It accepts --revision <HF commit> to pin model and pipeline code to the same revision. Download this repository's demo.py and requirements.txt together, or clone the repository before running the commands.

If Hub transfers stall in your environment, retry with HF_HUB_DISABLE_XET=1 set in your shell.

Python API

import torch
from diffusers import DiffusionPipeline

repo = "kimi000/Flux3-Klein-4Step-Raw2Q-2000"
pipe = DiffusionPipeline.from_pretrained(
    repo, custom_pipeline=repo, trust_remote_code=True,
    torch_dtype=torch.bfloat16,
)
pipe.enable_model_cpu_offload()  # alternatively: pipe.to("cuda")
image = pipe(
    prompt='A vintage pastel illustration of a tropical beach.',
    num_inference_steps=4, guidance_scale=1.0,
    height=1024, width=1024,
    generator=torch.Generator(device="cpu").manual_seed(0),
).images[0]
image.save("result.png")

Settings and limitations

  • Use four steps and guidance_scale=1.0. The official base is already guidance distilled. External CFG/negative prompts are not supported by this pipeline.
  • Keep this repository's custom scheduler. Shift is 6.93 and final_step_size_scale is 0.3. Its raw grid is 1 - j / 3.3 for j=0..3, followed by zero; do not substitute the earlier global128 export's 0.5 scale or a standard FLUX scheduler.
  • Load with both custom_pipeline=repo and trust_remote_code=True. Inspect the included Python files before enabling remote code. This native FLUX3 architecture is not the standard FLUX.1 Diffusers transformer.
  • The transformer/text encoder use BF16; the custom VAE must remain FP32, including BatchNorm buffers. Do not apply pipe.to(dtype=torch.bfloat16) to the whole pipeline. The loader preserves FP32 VAE decoding.
  • Use a CPU torch.Generator for native seed reproducibility. Integration uses FP32 and native token-major noise rounded to BF16. Outputs can differ across hardware/library versions.
  • Training resolution was 1024Γ—1024. Height/width must be multiples of 16 and at least 64; other sizes and step counts were not the training target.
  • Inputs are raw English prompts, with the native chat template and Qwen text features. There is no prompt upsampler. The mixture was 50% MJHQ, 25% sampled English TextAtlas, 25% English reward prompts, using prompt-only/data-free distillation.
  • Text rendering is imperfect: fixed validation samples show omitted words and malformed long passages. Successful runtime validation is not an OCR-quality guarantee. This is an experimental checkpoint.
  • LoRA merging into BF16 introduces normal BF16 rounding relative to an unmerged adapter execution. The exported pipeline's latent integration is checked against an independently composed training-style sampler.

Validated examples

Generated from the exported package itself, using the included validation script and demo. Tested on one H100 80GB GPU. The validation report confirms exactly four transformer calls, zero latent difference against the training-style sampler, and successful CPU offload.

Mug example

Demo beach

License and provenance

Base model revision: 337337621b8526e120f2275d250242f4a6bedd75. Native code revision: bfc8889a4497f846416f253a3972a1941ac698b9. Training implementation: 8b56ab89fde1fa033134841f120ef6e51dcc9e01.

The base-model terms in LICENSE.md and NOTICE.md apply to the weights. Native code license is in LICENSE-CODE. See the full license text for permitted uses and restrictions. The source checkpoint SHA256, merged-weight metadata and validation results accompany this export.

Downloads last month
3
Safetensors
Model size
6B params
Tensor type
BF16
Β·
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for kimi000/Flux3-Klein-4Step-Raw2Q-2000

Finetuned
(16)
this model