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-collection',
25 subfolder='asymflux2_klein_9b_sft_zimage_turbo',
26 target_module_name='transformer')
27pipe = pipe.to('cuda')
28
29# Text-to-image generation example
30prompt = '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.'
31neg_prompt = 'Low quality, worst quality, blurry, deformed, bad anatomy, unclear text'
32out = pipe(
33 prompt=prompt,
34 negative_prompt=neg_prompt,
35 width=960,
36 height=1280,
37 num_inference_steps=38,
38 guidance_scale=4.0,
39 generator=torch.Generator().manual_seed(42),
40).images[0]
41out.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},
}