ymyy307 commited on
Commit
4e11645
·
verified ·
1 Parent(s): b24093a

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +99 -0
README.md ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model:
4
+ - black-forest-labs/FLUX.1-dev
5
+ - Qwen/Qwen-Image
6
+ ---
7
+ # ArcFlow
8
+ ArcFlow: Unleashing 2-Step Text-to-Image Generation via High-Precision Non-Linear Flow Distillation
9
+ <br/>
10
+ Zihan Yang<sup>1</sup>,
11
+ [Shuyuan Tu](https://github.com/Francis-Rings)<sup>1</sup>,
12
+ Licheng Zhang<sup>1</sup>,
13
+ [Qi Dai](https://scholar.google.com/citations?hl=en&user=NSJY12IAAAAJ)<sup>2</sup>,
14
+ [Yu-Gang Jiang](https://scholar.google.com/citations?hl=en&user=f3_FP8AAAAAJ)<sup>1</sup>,
15
+ [Zuxuan Wu](https://zxwu.azurewebsites.net/)<sup>1</sup>
16
+ <br/>
17
+ [<sup>1</sup>Fudan University; <sup>2</sup>Microsoft Research Asia]
18
+ ## Usage
19
+
20
+ Please first install the [official code repository](https://github.com/pnotp/ArcFlow).
21
+
22
+ We provide diffusers pipelines for easy inference. The following code demonstrates how to sample images from the distilled FLUX.2 models.
23
+
24
+ ### 4-NFE/2-NFE Arc-Qwen (Distilled from Qwen-Image-20B)
25
+
26
+ ```python
27
+ import torch
28
+ from diffusers import FlowMatchEulerDiscreteScheduler
29
+ from lakonlab.pipelines.arcqwen_pipeline import ArcQwenImagePipeline
30
+
31
+ pipe = ArcQwenImagePipeline.from_pretrained(
32
+ 'Qwen/Qwen-Image',
33
+ torch_dtype=torch.bfloat16)
34
+ adapter_name = pipe.load_arcflow_adapter(
35
+ 'ymyy307/ArcFlow',
36
+ subfolder='arcflow-qwen-2steps',
37
+ target_module_name='transformer')
38
+ pipe.scheduler = FlowMatchEulerDiscreteScheduler.from_config( # use fixed shift=3.2
39
+ pipe.scheduler.config, shift=3.2, shift_terminal=None, use_dynamic_shifting=False)
40
+ pipe = pipe.to('cuda')
41
+
42
+ nfe = 4
43
+ # nfe = 2
44
+ out = pipe(
45
+ prompt = 'A semi-realistic fantasy illustration featuring a split composition of two young men in profile, facing away from each other. On the left, a pale man with sharp features and slicked-back black hair wears a dark coat. On the right, a tan man with messy wavy hair wears a blue tunic. The ornate, 3D metallic gold title "Sultan\'s Game" overlays the bottom center. The background is divided into distinct sections: vibrant red abstract shapes in the upper half and deep teal textures in the lower half, creating a sharp color contrast. Painterly brushstrokes.',
46
+ num_images_per_prompt=1,
47
+ width=1024,
48
+ height=1024,
49
+ num_inference_steps=nfe,
50
+ generator=torch.Generator(device="cuda").manual_seed(42),
51
+ timestep_ratio=1.0,
52
+ ).images[0]
53
+ out.save(f'arcqwen_{nfe}nfe.png')
54
+ ```
55
+
56
+ ### 4-NFE/2-NFE Arc-FLUX (Distilled from FLUX.1-dev)
57
+
58
+ ```python
59
+ import torch
60
+ from diffusers import FlowMatchEulerDiscreteScheduler
61
+ from lakonlab.pipelines.arcflux_pipeline import ArcFluxPipeline
62
+
63
+ pipe = ArcFluxPipeline.from_pretrained(
64
+ 'black-forest-labs/FLUX.1-dev',
65
+ torch_dtype=torch.bfloat16)
66
+ adapter_name = pipe.load_arcflow_adapter( # you may later call `pipe.set_adapters([adapter_name, ...])` to combine other adapters (e.g., style LoRAs)
67
+ 'ymyy307/ArcFlow',
68
+ subfolder='arcflow-flux-2steps',
69
+ target_module_name='transformer')
70
+ pipe.scheduler = FlowMatchEulerDiscreteScheduler.from_config( # use fixed shift=3.2
71
+ pipe.scheduler.config, shift=3.2, shift_terminal=None, use_dynamic_shifting=False)
72
+ pipe = pipe.to('cuda')
73
+
74
+ nfe = 4
75
+ # nfe = 2
76
+ out = pipe(
77
+ prompt = 'A portrait photo of a kangaroo wearing an orange hoodie and blue sunglasses standing in front of the Sydney Opera House holding a sign on the chest that says "Welcome Friends"',
78
+ num_images_per_prompt=1,
79
+ width=1024,
80
+ height=1024,
81
+ num_inference_steps=nfe,
82
+ generator=torch.Generator(device="cuda").manual_seed(42),
83
+ timestep_ratio=1.0,
84
+ ).images[0]
85
+ out.save(f'arcflux_{nfe}nfe.png')
86
+ ```
87
+
88
+ ## Citation
89
+ ```
90
+ @misc{yang2026arcflowunleashing2steptexttoimage,
91
+ title={ArcFlow: Unleashing 2-Step Text-to-Image Generation via High-Precision Non-Linear Flow Distillation},
92
+ author={Zihan Yang and Shuyuan Tu and Licheng Zhang and Qi Dai and Yu-Gang Jiang and Zuxuan Wu},
93
+ year={2026},
94
+ eprint={2602.09014},
95
+ archivePrefix={arXiv},
96
+ primaryClass={cs.CV},
97
+ url={https://arxiv.org/abs/2602.09014},
98
+ }
99
+ ```