Views
No views yet

1import math
2import torch
3from lakonlab.models.architectures import OklabColorEncoder
4from lakonlab.models.diffusions.schedulers import FlowAdapterScheduler
5from lakonlab.pipelines.pipeline_pixelflux2_klein import PixelFlux2KleinPipeline
6
7pipe = PixelFlux2KleinPipeline.from_pretrained(
8 'black-forest-labs/FLUX.2-klein-base-9B',
9 vae=OklabColorEncoder(
10 use_affine_norm=True,
11 mean=(0.56, 0.0, 0.01),
12 std=0.16),
13 scheduler=FlowAdapterScheduler(
14 shift=17.0,
15 use_dynamic_shifting=True,
16 base_seq_len=1024 ** 2,
17 max_seq_len=2048 ** 2,
18 base_logshift=math.log(17.0),
19 max_logshift=math.log(34.0),
20 dynamic_shifting_type='sqrt',
21 base_scheduler='UniPCMultistep'),
22 torch_dtype=torch.bfloat16)
23adapter_name = pipe.load_lakonlab_adapter( # you may later call `pipe.set_adapters([adapter_name, ...])` to combine other adapters (e.g., style LoRAs)
24 'Lakonik/AsymFLUX.2-klein-9B',
25 target_module_name='transformer')
26pipe = pipe.to('cuda')
27
28# Text-to-image generation example
29prompt = 'Restored color photo from the 1900s. A middle-aged man with cybernetic metal hands is sitting on an old wooden chair and reading the newspaper. The newspaper has the prominent headline "AsymFLOW RELEASED" in large bold font. Close-up shot focusing on the newspaper.'
30neg_prompt = 'Low quality, worst quality, blurry, deformed, bad anatomy, unclear text'
31out = pipe(
32 prompt=prompt,
33 negative_prompt=neg_prompt,
34 width=960,
35 height=1280,
36 num_inference_steps=38,
37 guidance_scale=4.0,
38 generator=torch.Generator().manual_seed(42),
39).images[0]
40out.save('asymflux2_klein.png')@article{chen2026asymmetric,
title={Asymmetric Flow Models},
author={Hansheng Chen and Jan Ackermann and Minseo Kim and Gordon Wetzstein and Leonidas Guibas},
journal={arXiv preprint arXiv:2605.12964},
url={https://arxiv.org/abs/2605.12964},
year={2026},
}