--- license: other license_name: flux-non-commercial-license-v2.1 license_link: https://huggingface.co/black-forest-labs/FLUX.2-klein-base-9B/blob/main/LICENSE.md language: - en base_model: - microsoft/SciForma-Base tags: - text-to-image - image-to-image - scientific-diagrams - methodology-figures - flux - diffusers pipeline_tag: text-to-image --- # SciForma-9B **SciForma-9B** is the final M-DPO aligned checkpoint of [SciForma: Structure-Faithful Generation of Scientific Diagrams](https://github.com/microsoft/SciForma), fine-tuned from [SciForma-Base](https://huggingface.co/microsoft/SciForma-Base) via Multi-Dimensional Conjunctive DPO (M-DPO). | Model | Overall ↑ | Comp. ↑ | Arrow ↑ | Text ↑ | |-------|-----------|---------|---------|--------| | **SciForma-9B** | **69.51** | **74.49** | **66.46** | **67.00** | | GPT-Image-1.5 | 68.96 | 75.50 | 62.50 | 68.20 | | SciForma-Base | 67.59 | 73.52 | 64.64 | 63.84 | | FLUX.2-klein-base-9B (no fine-tuning) | 33.87 | 42.80 | 25.20 | 23.60 | Scores on SciFormaBench-2K (GPT-5.4 judge, split_dims=True). ## Usage This repository contains only the fine-tuned **transformer** weights. The text encoder, tokenizer, VAE, and scheduler are inherited from the base model. ```python import torch from diffusers import Flux2KleinPipeline, Flux2Transformer2DModel # Load fine-tuned transformer transformer = Flux2Transformer2DModel.from_pretrained( "microsoft/SciForma-9B", subfolder="transformer", torch_dtype=torch.bfloat16, ) # Load full pipeline with base model components pipe = Flux2KleinPipeline.from_pretrained( "black-forest-labs/FLUX.2-klein-base-9B", transformer=transformer, torch_dtype=torch.bfloat16, ) pipe.enable_model_cpu_offload() # Generate prompt = "The figure illustrates a transformer architecture with encoder and decoder..." image = pipe( prompt, height=576, width=1008, num_inference_steps=28, guidance_scale=4.0, ).images[0] image.save("output.png") ``` ## Training Details - **Base model**: SciForma-Base (Stage 2 SFT) - **M-DPO**: Multi-Dimensional Conjunctive DPO with 1v2+global-worst triples (~16.5K groups), targeting Component and Text axes simultaneously - **Hardware**: 4× B200, batch=1/GPU, GA=3 → eff_batch=12, 10K steps - **Training data**: [microsoft/SciFormaData-700K](https://huggingface.co/datasets/microsoft/SciFormaData-700K) ## License Released under the [FLUX Non-Commercial License v2.1](https://huggingface.co/black-forest-labs/FLUX.2-klein-base-9B/blob/main/LICENSE.md). Non-commercial research use only. > This FLUX Model is licensed by Black Forest Labs Inc. under the FLUX Non-Commercial License. Copyright Black Forest Labs Inc. This model has been modified by Microsoft Research Asia.