File size: 6,986 Bytes
343fdaf
65fdee2
0e2318f
343fdaf
 
 
79afe16
343fdaf
 
60fd701
65fdee2
343fdaf
79afe16
343fdaf
79afe16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
---
title: FLUX Fast & Furious
emoji: πŸ–ΌπŸ†
colorFrom: purple
colorTo: red
sdk: gradio
sdk_version: 5.35.0
app_file: app.py
pinned: false
license: openrail++
short_description: 'FLUX 8 Step Fast & High Quality Mode'
---
I'll create comprehensive documentation for this FLUX Fast & Furious image generation code in both English and Korean.

## English Documentation

### FLUX: Fast & Furious - Hyper-Speed Image Generation

This application implements an accelerated version of the FLUX.1-dev image generation model, optimized by ByteDance's AutoML team using their Hyper-SD technology to achieve high-quality image generation in just 8 steps instead of the typical 20-50 steps.

#### Key Features

1. **Hyper-Speed Generation**
   - Utilizes Hyper-SD LoRA (Low-Rank Adaptation) technology from ByteDance
   - Reduces inference steps from 20-50 to just 6-25 steps (default: 8)
   - Maintains high image quality while dramatically reducing generation time
   - Optimized for CUDA with TF32 precision enabled for maximum performance

2. **Neon-Themed User Interface**
   - Custom cyberpunk-inspired design with glowing neon effects
   - Animated hover effects and dynamic visual feedback
   - Dark theme with blue, cyan, and magenta color accents
   - Responsive layout optimized for both desktop and mobile devices

3. **User-Friendly Features**
   - **Example Prompts**: Five pre-written creative prompts covering various genres:
     - Cyberpunk cityscapes
     - Fantasy fairy scenes
     - Epic dragon imagery
     - Sci-fi space stations
     - Underwater ancient cities
   - **Click-to-Use Examples**: Simply click any example to instantly populate the prompt field
   - **Advanced Settings**: Collapsible panel for fine-tuning generation parameters

4. **Customizable Generation Parameters**
   - **Image Dimensions**: Adjustable width and height (256-1152 pixels)
   - **Inference Steps**: Control speed vs. quality trade-off (6-25 steps)
   - **Guidance Scale**: Adjust prompt adherence (0.0-5.0)
   - **Seed Control**: Reproducible results with manual seed input

#### Technical Implementation

The application leverages cutting-edge technologies:
- **FLUX.1-dev**: State-of-the-art diffusion model from Black Forest Labs
- **Hyper-SD LoRA**: ByteDance's acceleration technology achieving 5-10x speedup
- **BFloat16 Precision**: Reduced memory usage while maintaining quality
- **Gradio Spaces**: GPU-accelerated deployment with automatic resource management
- **Custom CSS**: Neon-themed styling with glow effects and animations

The generation pipeline:
1. Loads the base FLUX.1-dev model in bfloat16 precision
2. Applies Hyper-SD LoRA weights with 0.125 scaling factor
3. Fuses LoRA weights for optimal performance
4. Generates images using accelerated inference with custom parameters
5. Outputs high-quality 1024x1024 images (default) in seconds

#### Performance Optimization

- **GPU Acceleration**: Automatic CUDA optimization with @spaces.GPU decorator
- **Memory Efficiency**: BFloat16 precision reduces VRAM usage by 50%
- **Inference Mode**: Torch inference mode and autocast for maximum speed
- **TF32 Support**: Enabled for compatible GPUs for additional speedup
- **Cached Models**: Local model caching to reduce loading times

#### Use Cases

Perfect for:
- Rapid prototyping of visual concepts
- Creative exploration with instant feedback
- Production of high-quality images for various projects
- Testing different artistic styles and compositions
- Educational purposes to understand AI image generation

---

## ν•œκΈ€ μ„€λͺ…μ„œ

### FLUX: Fast & Furious - μ΄ˆκ³ μ† 이미지 생성기

이 μ• ν”Œλ¦¬μΌ€μ΄μ…˜μ€ ByteDance의 AutoML νŒ€μ΄ κ°œλ°œν•œ Hyper-SD κΈ°μˆ μ„ ν™œμš©ν•˜μ—¬ FLUX.1-dev 이미지 생성 λͺ¨λΈμ„ κ°€μ†ν™”ν•œ λ²„μ „μœΌλ‘œ, κΈ°μ‘΄ 20-50단계가 ν•„μš”ν–ˆλ˜ 과정을 단 8λ‹¨κ³„λ‘œ 쀄여 κ³ ν’ˆμ§ˆ 이미지λ₯Ό μƒμ„±ν•©λ‹ˆλ‹€.

#### μ£Όμš” κΈ°λŠ₯

1. **μ΄ˆκ³ μ† 생성**
   - ByteDance의 Hyper-SD LoRA(Low-Rank Adaptation) 기술 ν™œμš©
   - μΆ”λ‘  단계λ₯Ό 20-50λ‹¨κ³„μ—μ„œ 6-25λ‹¨κ³„λ‘œ λŒ€ν­ μΆ•μ†Œ (κΈ°λ³Έκ°’: 8단계)
   - 생성 μ‹œκ°„μ„ 획기적으둜 λ‹¨μΆ•ν•˜λ©΄μ„œλ„ 높은 이미지 ν’ˆμ§ˆ μœ μ§€
   - μ΅œλŒ€ μ„±λŠ₯을 μœ„ν•œ TF32 정밀도가 ν™œμ„±ν™”λœ CUDA μ΅œμ ν™”

2. **λ„€μ˜¨ ν…Œλ§ˆ μ‚¬μš©μž μΈν„°νŽ˜μ΄μŠ€**
   - λ°œκ΄‘ λ„€μ˜¨ νš¨κ³Όκ°€ 적용된 μ‚¬μ΄λ²„νŽ‘ν¬ μŠ€νƒ€μΌμ˜ λ§žμΆ€ν˜• λ””μžμΈ
   - μ• λ‹ˆλ©”μ΄μ…˜ ν˜Έλ²„ νš¨κ³Όμ™€ 동적 μ‹œκ° ν”Όλ“œλ°±
   - νŒŒλž€μƒ‰, 청둝색, λ§ˆμ  νƒ€ 색상 μ•…μ„ΌνŠΈκ°€ μžˆλŠ” 닀크 ν…Œλ§ˆ
   - λ°μŠ€ν¬ν†±κ³Ό λͺ¨λ°”일 κΈ°κΈ° λͺ¨λ‘μ— μ΅œμ ν™”λœ λ°˜μ‘ν˜• λ ˆμ΄μ•„μ›ƒ

3. **μ‚¬μš©μž μΉœν™”μ  κΈ°λŠ₯**
   - **μ˜ˆμ‹œ ν”„λ‘¬ν”„νŠΈ**: λ‹€μ–‘ν•œ μž₯λ₯΄λ₯Ό λ‹€λ£¨λŠ” 5개의 창의적인 ν”„λ‘¬ν”„νŠΈ 제곡:
     - μ‚¬μ΄λ²„νŽ‘ν¬ λ„μ‹œ 풍경
     - νŒνƒ€μ§€ μš”μ • μž₯λ©΄
     - μ›…μž₯ν•œ λ“œλž˜κ³€ 이미지
     - SF 우주 μ •κ±°μž₯
     - μˆ˜μ€‘ κ³ λŒ€ λ„μ‹œ
   - **ν΄λ¦­ν•˜μ—¬ μ‚¬μš©**: μ˜ˆμ‹œλ₯Ό ν΄λ¦­ν•˜λ©΄ μ¦‰μ‹œ ν”„λ‘¬ν”„νŠΈ ν•„λ“œμ— μž…λ ₯
   - **κ³ κΈ‰ μ„€μ •**: 생성 λ§€κ°œλ³€μˆ˜ λ―Έμ„Έ 쑰정을 μœ„ν•œ 접을 수 μžˆλŠ” νŒ¨λ„

4. **λ§žμΆ€ν˜• 생성 λ§€κ°œλ³€μˆ˜**
   - **이미지 크기**: μ‘°μ • κ°€λŠ₯ν•œ λ„ˆλΉ„μ™€ 높이 (256-1152 ν”½μ…€)
   - **μΆ”λ‘  단계**: 속도 λŒ€ ν’ˆμ§ˆ κ· ν˜• 쑰절 (6-25단계)
   - **κ°€μ΄λ˜μŠ€ μŠ€μΌ€μΌ**: ν”„λ‘¬ν”„νŠΈ μ€€μˆ˜λ„ μ‘°μ • (0.0-5.0)
   - **μ‹œλ“œ μ œμ–΄**: μˆ˜λ™ μ‹œλ“œ μž…λ ₯으둜 μž¬ν˜„ κ°€λŠ₯ν•œ κ²°κ³Ό

#### 기술적 κ΅¬ν˜„

μ• ν”Œλ¦¬μΌ€μ΄μ…˜μ€ μ΅œμ²¨λ‹¨ κΈ°μˆ μ„ ν™œμš©ν•©λ‹ˆλ‹€:
- **FLUX.1-dev**: Black Forest Labs의 μ΅œμ‹  ν™•μ‚° λͺ¨λΈ
- **Hyper-SD LoRA**: 5-10λ°° 속도 ν–₯상을 λ‹¬μ„±ν•˜λŠ” ByteDance의 가속 기술
- **BFloat16 정밀도**: ν’ˆμ§ˆμ„ μœ μ§€ν•˜λ©΄μ„œ λ©”λͺ¨λ¦¬ μ‚¬μš©λŸ‰ κ°μ†Œ
- **Gradio Spaces**: μžλ™ λ¦¬μ†ŒμŠ€ 관리가 ν¬ν•¨λœ GPU 가속 배포
- **μ»€μŠ€ν…€ CSS**: λ°œκ΄‘ νš¨κ³Όμ™€ μ• λ‹ˆλ©”μ΄μ…˜μ΄ μžˆλŠ” λ„€μ˜¨ ν…Œλ§ˆ μŠ€νƒ€μΌλ§

생성 νŒŒμ΄ν”„λΌμΈ:
1. bfloat16 μ •λ°€λ„λ‘œ κΈ°λ³Έ FLUX.1-dev λͺ¨λΈ λ‘œλ“œ
2. 0.125 μŠ€μΌ€μΌλ§ νŒ©ν„°λ‘œ Hyper-SD LoRA κ°€μ€‘μΉ˜ 적용
3. 졜적 μ„±λŠ₯을 μœ„ν•œ LoRA κ°€μ€‘μΉ˜ μœ΅ν•©
4. μ‚¬μš©μž μ •μ˜ λ§€κ°œλ³€μˆ˜λ‘œ κ°€μ†ν™”λœ 좔둠을 μ‚¬μš©ν•˜μ—¬ 이미지 생성
5. λͺ‡ 초 λ§Œμ— κ³ ν’ˆμ§ˆ 1024x1024 이미지(κΈ°λ³Έκ°’) 좜λ ₯

#### μ„±λŠ₯ μ΅œμ ν™”

- **GPU 가속**: @spaces.GPU λ°μ½”λ ˆμ΄ν„°λ‘œ μžλ™ CUDA μ΅œμ ν™”
- **λ©”λͺ¨λ¦¬ νš¨μœ¨μ„±**: BFloat16 μ •λ°€λ„λ‘œ VRAM μ‚¬μš©λŸ‰ 50% κ°μ†Œ
- **μΆ”λ‘  λͺ¨λ“œ**: μ΅œλŒ€ 속도λ₯Ό μœ„ν•œ Torch μΆ”λ‘  λͺ¨λ“œμ™€ μžλ™ 캐슀트
- **TF32 지원**: ν˜Έν™˜ GPUμ—μ„œ μΆ”κ°€ 속도 ν–₯상을 μœ„ν•΄ ν™œμ„±ν™”
- **μΊμ‹œλœ λͺ¨λΈ**: λ‘œλ”© μ‹œκ°„ 단좕을 μœ„ν•œ 둜컬 λͺ¨λΈ 캐싱

#### μ‚¬μš© 사둀

λ‹€μŒκ³Ό 같은 μš©λ„μ— μ ν•©ν•©λ‹ˆλ‹€:
- μ‹œκ°μ  μ»¨μ…‰μ˜ μ‹ μ†ν•œ ν”„λ‘œν† νƒ€μ΄ν•‘
- 즉각적인 ν”Όλ“œλ°±μœΌλ‘œ 창의적 탐색
- λ‹€μ–‘ν•œ ν”„λ‘œμ νŠΈλ₯Ό μœ„ν•œ κ³ ν’ˆμ§ˆ 이미지 μ œμž‘
- λ‹€μ–‘ν•œ 예술적 μŠ€νƒ€μΌκ³Ό ꡬ성 ν…ŒμŠ€νŠΈ
- AI 이미지 생성 이해λ₯Ό μœ„ν•œ ꡐ윑 λͺ©μ 