Views
No views yet
FluxTransformer2DModel weights only; load them on top of the original Freepik/flux.1-lite-8B base pipeline.Highlights
- 🔁 RL post-training (DanceGRPO) for preference alignment
- 🏆 PickScore as the reward model to boost aesthetics and prompt faithfulness
- ⚡ Drop-in replacement for the base model’s transformer in Diffusers
1import torch
2from PIL import Image
3from diffusers.pipelines.flux.pipeline_flux import FluxPipeline
4from diffusers.models.transformers.transformer_flux import FluxTransformer2DModel
5
6# 1) Load the base Flux 1-Lite pipeline
7base_model = "Freepik/flux.1-lite-8B"
8pipe = FluxPipeline.from_pretrained(base_model, torch_dtype=torch.bfloat16).to("cuda")
9
10# 2) Swap in the GRPO-tuned transformer from this repo
11grpo_transformer = "Owen777/flux.1-lite-8B-GRPO"
12transformer = FluxTransformer2DModel.from_pretrained(grpo_transformer, torch_dtype=torch.bfloat16).to("cuda")
13pipe.transformer = transformer # replace in-place
14
15
16prompt="A studio portrait of a woman with bold makeup, highly detailed eyelashes, and glossy red lips, dramatic directional lighting creating high contrast shadows, perfect catchlights in the eyes, smooth skin texture without blemishes"
17image = pipeline(prompt,
18 num_inference_steps=50,
19 guidance_scale=2.5,
20 height=1024,
21 width=1024,
22 generator=torch.Generator(device="cuda").manual_seed(42)
23 ).images[0]
24image.save("flux_1_lite_grpo.png")num_inference_steps=28–60, guidance_scale=2.5–4.5.generator seed.FluxTransformer2DModel only (no VAE, no tokenizer, no text encoder).Freepik/flux.1-lite-8BNote: Dataset specifics, compute budget, and exact hyperparameters are not disclosed here. The method is model-agnostic and can be applied to other Flux variants.
torch.backends.cuda.matmul.allow_tf32 = True if your environment supports it.Freepik/flux.1-lite-8B) andflux.1-lite-8B.