# FLUX.1

{% hint style="info" %}
**Schnellere Alternative!** [**FLUX.2 Klein**](https://docs.clore.ai/guides/guides_v2-de/bildgenerierung/flux2-klein) erstellt Bilder in < 0,5 Sekunden (vs. 10–30s für FLUX.1) mit vergleichbarer Qualität. Dieser Leitfaden ist weiterhin relevant für LoRA-Training und ControlNet-Workflows.
{% endhint %}

State-of-the-art Bildgenerierungsmodell von Black Forest Labs auf CLORE.AI GPUs.

{% hint style="success" %}
Alle Beispiele können auf GPU-Servern ausgeführt werden, die über [CLORE.AI Marketplace](https://clore.ai/marketplace).
{% endhint %}

## Warum FLUX.1?

* **Beste Qualität** - Überlegen gegenüber SDXL und Midjourney v5
* **Textrendering** - Tatsächlich lesbarer Text in Bildern
* **Prompt-Folge** - Hervorragende Befolgung von Anweisungen
* **Schnelle Varianten** - FLUX.1-schnell für schnelle Generierung

## Modellvarianten

| Modell         | Geschwindigkeit      | Qualität      | VRAM  | Lizenz            |
| -------------- | -------------------- | ------------- | ----- | ----------------- |
| FLUX.1-schnell | Schnell (4 Schritte) | Großartig     | 12GB+ | Apache 2.0        |
| FLUX.1-dev     | Mittel (20 Schritte) | Ausgezeichnet | 16GB+ | Nicht-kommerziell |
| FLUX.1-pro     | Nur API              | Am besten     | -     | Kommerziell       |

## Schnelle Bereitstellung auf CLORE.AI

**Docker-Image:**

```
ghcr.io/huggingface/text-generation-inference:latest
```

**Ports:**

```
22/tcp
7860/http
```

Für die einfachste Bereitstellung, benutze **ComfyUI mit FLUX-Knoten**.

## Installationsmethoden

### Methode 1: ComfyUI (Empfohlen)

```bash
# ComfyUI installieren
git clone https://github.com/comfyanonymous/ComfyUI
cd ComfyUI
pip install -r requirements.txt

# FLUX-Modelle herunterladen
cd models/unet
wget https://huggingface.co/black-forest-labs/FLUX.1-schnell/resolve/main/flux1-schnell.safetensors

# Erforderliche Komponenten herunterladen
cd ../clip
wget https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/clip_l.safetensors
wget https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/t5xxl_fp16.safetensors

cd ../vae
wget https://huggingface.co/black-forest-labs/FLUX.1-schnell/resolve/main/ae.safetensors

# ComfyUI starten
python main.py --listen 0.0.0.0
```

### Methode 2: Diffusers

```bash
pip install diffusers transformers accelerate torch

python << 'PYEOF'
import torch
from diffusers import FluxPipeline

pipe = FluxPipeline.from_pretrained(
    "black-forest-labs/FLUX.1-schnell",
    torch_dtype=torch.bfloat16
)
pipe.enable_model_cpu_offload()

image = pipe(
    "Eine Katze mit Raumanzug auf dem Mars",
    num_inference_steps=4,
    guidance_scale=0.0,
).images[0]

image.save("flux_output.png")
PYEOF
```

### Methode 3: Fooocus

Fooocus hat eingebaute FLUX-Unterstützung:

```bash
git clone https://github.com/lllyasviel/Fooocus
cd Fooocus
pip install -r requirements.txt

# FLUX-Modell nach models/checkpoints/ herunterladen
python launch.py --listen
```

## ComfyUI-Workflow

### FLUX.1-schnell (Schnell)

Benötigte Knoten:

1. **Load Diffusion Model** → flux1-schnell.safetensors
2. **DualCLIPLoader** → clip\_l.safetensors + t5xxl\_fp16.safetensors
3. **CLIP Text Encode** → dein Prompt
4. **Empty SD3 Latent Image** → Abmessungen einstellen
5. **KSampler** → Schritte: 4, cfg: 1.0
6. **VAE-Decodierung** → ae.safetensors
7. **Bild speichern**

### FLUX.1-dev (Qualität)

Gleicher Workflow, aber:

* Schritte: 20-50
* CFG: 3.5
* Verwende guidance\_scale im Prompt

## Python-API

### Grundlegende Generierung

```python
import torch
from diffusers import FluxPipeline

# Modell laden
pipe = FluxPipeline.from_pretrained(
    "black-forest-labs/FLUX.1-schnell",
    torch_dtype=torch.bfloat16
)
pipe.to("cuda")

# Generieren
image = pipe(
    prompt="Ein ruhiger japanischer Garten mit Kirschblüten",
    height=1024,
    width=1024,
    num_inference_steps=4,
    guidance_scale=0.0,
).images[0]

image.save("output.png")
```

### Mit Speicheroptimierung

```python
from diffusers import FluxPipeline
import torch

pipe = FluxPipeline.from_pretrained(
    "black-forest-labs/FLUX.1-schnell",
    torch_dtype=torch.bfloat16
)

# Aktivieren von Optimierungen
pipe.enable_model_cpu_offload()  # Spart ~10GB VRAM
pipe.enable_vae_slicing()
pipe.enable_vae_tiling()

image = pipe(
    "Porträt eines Cyberpunk-Samurai",
    height=1024,
    width=1024,
    num_inference_steps=4,
).images[0]
```

### Batch-Erzeugung

```python
prompts = [
    "Ein Sonnenuntergang über Bergen",
    "Eine futuristische Stadt bei Nacht",
    "Ein Unterwasser-Korallenriff",
]

images = pipe(
    Prompts,
    height=1024,
    width=1024,
    num_inference_steps=4,
).images

for i, img in enumerate(images):
    img.save(f"output_{i}.png")
```

## FLUX.1-dev (Höhere Qualität)

```python
from diffusers import FluxPipeline
import torch

pipe = FluxPipeline.from_pretrained(
    "black-forest-labs/FLUX.1-dev",
    torch_dtype=torch.bfloat16
)
pipe.enable_model_cpu_offload()

image = pipe(
    prompt="Hyperrealistisches Porträt eines alten Fischers",
    height=1024,
    width=1024,
    num_inference_steps=50,
    guidance_scale=3.5,
).images[0]
```

## Prompt-Tipps

### FLUX glänzt bei:

* **Text in Bildern**: "Ein Neonschild mit der Aufschrift 'OPEN 24/7'"
* **Komplexe Szenen**: "Eine belebte Straße in Tokio bei Nacht mit Spiegelungen"
* **Spezifische Stile**: "Ölgemälde im Stil von Monet"
* **Detaillierte Beschreibungen**: Lange, detaillierte Prompts funktionieren gut

### Beispiel-Prompts

```
# Fotorealistisch
Ein professionelles Foto eines Golden-Retriever-Welpen, der in Herbstlaub spielt, 
geringe Schärfentiefe, warmes Nachmittagslicht, Canon EOS R5

# Künstlerisch
Ein impressionistisches Gemälde eines Pariser Cafés im Regen, 
Öl auf Leinwand, sichtbare Pinselstriche, warme Farben

# Textrendering
Ein Vintage-Filmplakat mit dem Titel "COSMIC VOYAGE" in fetten Retro-Buchstaben,
60er-Jahre Sci-Fi-Ästhetik, Astronauten-Illustration

# Komplexe Szene
Ein gemütliches Bibliotheksinterieur mit bodenhohen Bücherregalen, 
ein Ledersessel am Kamin, Regen durch ein Fenster sichtbar,
warmes Lampenlicht, fotorealistisch
```

## Speicheroptimierung

### Für 12GB VRAM (RTX 3060)

```python
pipe = FluxPipeline.from_pretrained(
    "black-forest-labs/FLUX.1-schnell",
    torch_dtype=torch.float16  # Verwende fp16 statt bf16
)
pipe.enable_model_cpu_offload()
pipe.enable_vae_slicing()
pipe.enable_vae_tiling()

# Bei niedrigerer Auflösung generieren
image = pipe(prompt, height=768, width=768, num_inference_steps=4).images[0]
```

### Für 8GB VRAM

Verwende quantisierte Version oder ComfyUI mit GGUF:

```bash
# In ComfyUI GGUF-Knoten installieren
cd custom_nodes
git clone https://github.com/city96/ComfyUI-GGUF

# Quantisiertes Modell herunterladen
wget https://huggingface.co/city96/FLUX.1-schnell-gguf/resolve/main/flux1-schnell-Q4_K_S.gguf
```

## Leistungsvergleich

| Modell         | Schritte | Zeit (4090) | Qualität      |
| -------------- | -------- | ----------- | ------------- |
| FLUX.1-schnell | 4        | \~3 Sek.    | Großartig     |
| FLUX.1-dev     | 20       | \~12 Sek.   | Ausgezeichnet |
| FLUX.1-dev     | 50       | \~30 Sek.   | Am besten     |
| SDXL           | 30       | \~8 Sek.    | Gut           |

## GPU-Anforderungen

| Einrichtung        | Minimum | Empfohlen |
| ------------------ | ------- | --------- |
| FLUX.1-schnell     | 12GB    | 16GB+     |
| FLUX.1-dev         | 16GB    | 24GB+     |
| Mit CPU-Offload    | 8GB     | 12GB+     |
| Quantisiert (GGUF) | 6GB     | 8GB+      |

## GPU-Voreinstellungen

### RTX 3060 12GB (Budget)

```python
# Verwenden Sie quantisiertes Modell
pipe = FluxPipeline.from_pretrained(
    "black-forest-labs/FLUX.1-schnell",
    torch_dtype=torch.float16
)
pipe.enable_model_cpu_offload()
pipe.enable_vae_tiling()

# Einstellungen:
# - schnell nur (dev kann OOM verursachen)
# - 512x512 bis 768x768
# - 4 Schritte
# - Batch-Größe 1
```

### RTX 3090 24GB (Optimal)

```python
pipe = FluxPipeline.from_pretrained(
    "black-forest-labs/FLUX.1-dev",
    torch_dtype=torch.float16
)
pipe.to("cuda")
pipe.enable_vae_tiling()

# Einstellungen:
# - schnell: 1024x1024, Batch 2
# - dev: 1024x1024, Batch 1
# - 20-30 Schritte für dev
# - VAE-Tiling für hohe Auflösung aktivieren
```

### RTX 4090 24GB (Performance)

```python
pipe = FluxPipeline.from_pretrained(
    "black-forest-labs/FLUX.1-dev",
    torch_dtype=torch.float16
)
pipe.to("cuda")

# Einstellungen:
# - schnell: 1024x1024, Batch 4
# - dev: 1024x1024, Batch 2
# - 30-50 Schritte für beste Qualität
# - Kann 1536x1536 mit Tiling erreichen
```

### A100 40GB/80GB (Produktion)

```python
pipe = FluxPipeline.from_pretrained(
    "black-forest-labs/FLUX.1-dev",
    torch_dtype=torch.bfloat16
)
pipe.to("cuda")

# Einstellungen:
# - schnell: 1024x1024, Batch 8+
# - dev: 1024x1024, Batch 4
# - 50 Schritte für maximale Qualität
# - 2048x2048 möglich
```

## Kostenabschätzung

| GPU           | Stündlich | Bilder/Stunde    |
| ------------- | --------- | ---------------- |
| RTX 3060 12GB | \~$0.03   | \~200 (schnell)  |
| RTX 3090 24GB | \~$0.06   | \~600 (schnell)  |
| RTX 4090 24GB | \~$0.10   | \~1000 (schnell) |
| A100 40GB     | \~$0.17   | \~1500 (schnell) |

## Fehlerbehebung

### Kein Speicher mehr

```python
# CPU-Offload verwenden
pipe.enable_model_cpu_offload()

# Oder sequenzielles CPU-Offload (langsamer, aber weniger VRAM)
pipe.enable_sequential_cpu_offload()

# Auflösung reduzieren
height=768, width=768
```

### Langsame Generierung

* Verwende FLUX.1-schnell (4 Schritte)
* torch.compile aktivieren: `pipe.unet = torch.compile(pipe.unet)`
* Verwende fp16 statt bf16 auf älteren GPUs

### Schlechte Qualität

* Verwende mehr Schritte (FLUX-dev: 30-50)
* Erhöhe guidance\_scale (3.0-4.0 für dev)
* Schreiben Sie detailliertere Prompts

***

## FLUX LoRA

LoRA (Low-Rank Adaptation)-Gewichte ermöglichen es, FLUX für bestimmte Stile, Charaktere oder Konzepte feinzujustieren, ohne das komplette Modell neu zu trainieren. Hunderte von Community-LoRAs sind auf HuggingFace und CivitAI verfügbar.

### Installation

```bash
pip install diffusers transformers accelerate peft
```

### Laden einer einzelnen LoRA

```python
import torch
from diffusers import FluxPipeline

pipe = FluxPipeline.from_pretrained(
    "black-forest-labs/FLUX.1-dev",
    torch_dtype=torch.bfloat16
)
pipe.enable_model_cpu_offload()

# LoRA-Gewichte aus einer lokalen Datei laden
pipe.load_lora_weights("path/to/lora.safetensors")

image = pipe(
    "Ein Porträt im Stil von Van Gogh, wirbelnde Pinselstriche",
    num_inference_steps=20,
    guidance_scale=3.5,
    generator=torch.Generator(device="cuda").manual_seed(42),
).images[0]
image.save("flux_lora_output.png")
```

### Laden aus dem HuggingFace Hub

```python
import torch
from diffusers import FluxPipeline

pipe = FluxPipeline.from_pretrained(
    "black-forest-labs/FLUX.1-dev",
    torch_dtype=torch.bfloat16
)
pipe.enable_model_cpu_offload()

# LoRA direkt aus dem HuggingFace-Repo laden
pipe.load_lora_weights(
    "username/my-flux-lora",          # HF-Repo-ID
    weight_name="my_lora.safetensors" # Dateiname im Repo
)

image = pipe(
    "trigger_word eine schöne Landschaft",
    num_inference_steps=20,
    guidance_scale=3.5,
).images[0]
image.save("output.png")
```

### LoRA-Skala (Stärke)

```python
# Beeinflussung der LoRA mit cross_attention_kwargs steuern
image = pipe(
    "Ein Cyberpunk-Charakter, Neonlichter",
    num_inference_steps=20,
    guidance_scale=3.5,
    cross_attention_kwargs={"scale": 0.8},  # 0.0 = keine Wirkung, 1.0 = volle Wirkung
).images[0]
```

### Kombinieren mehrerer LoRAs

```python
from diffusers import FluxPipeline
import torch

pipe = FluxPipeline.from_pretrained(
    "black-forest-labs/FLUX.1-dev",
    torch_dtype=torch.bfloat16
)
pipe.enable_model_cpu_offload()

# Erste LoRA laden
pipe.load_lora_weights(
    "path/to/style_lora.safetensors",
    adapter_name="style"
)

# Zweite LoRA laden
pipe.load_lora_weights(
    "path/to/character_lora.safetensors",
    adapter_name="character"
)

# Mit Gewichten kombinieren
pipe.set_adapters(["style", "character"], adapter_weights=[0.7, 0.9])

image = pipe(
    "character_trigger trägt aufwändige Kleidung, artistic_trigger Stil",
    num_inference_steps=25,
    guidance_scale=3.5,
).images[0]
image.save("combined_lora.png")
```

### LoRA entladen

```python
# LoRA-Gewichte entfernen, um das Basismodell wiederherzustellen
pipe.unload_lora_weights()
```

### Eigene FLUX-LoRA trainieren

```bash
# Verwende kohya-ss oder ai-toolkit für FLUX-LoRA-Training
git clone https://github.com/ostris/ai-toolkit
cd ai-toolkit
pip install -r requirements.txt

# Datensatz vorbereiten: 10-30 Bilder mit Beschriftungen
# Konfigurations-YAML bearbeiten, dann:
python run.py config/flux_lora_train.yaml
```

### Empfohlene LoRA-Quellen

| Quelle      | URL                   | Hinweise                         |
| ----------- | --------------------- | -------------------------------- |
| CivitAI     | civitai.com           | Große Community-Bibliothek       |
| HuggingFace | huggingface.co/models | Nach FLUX filtern                |
| Replicate   | replicate.com         | Durch trainierte Modelle stöbern |

***

## ControlNet für FLUX

ControlNet ermöglicht die Steuerung der FLUX-Generierung mit strukturellen Eingaben wie Canny-Kanten, Tiefenkarten und Posen-Skeletten. XLabs-AI hat die ersten ControlNet-Modelle speziell für FLUX.1 veröffentlicht.

### Installation

```bash
pip install diffusers transformers accelerate controlnet-aux pillow
```

### FLUX ControlNet Canny (XLabs-AI)

```python
import torch
import numpy as np
from PIL import Image
from diffusers import FluxControlNetPipeline, FluxControlNetModel
from diffusers.utils import load_image
from controlnet_aux import CannyDetector

# Das FLUX ControlNet-Modell laden (Canny-Variante)
controlnet = FluxControlNetModel.from_pretrained(
    "XLabs-AI/flux-controlnet-canny-diffusers",
    torch_dtype=torch.bfloat16
)

# Die Pipeline mit ControlNet laden
pipe = FluxControlNetPipeline.from_pretrained(
    "black-forest-labs/FLUX.1-dev",
    controlnet=controlnet,
    torch_dtype=torch.bfloat16
)
pipe.enable_model_cpu_offload()

# Das Steuerbild vorbereiten (Canny-Kanten)
input_image = load_image("your_input.jpg").resize((1024, 1024))
canny = CannyDetector()
control_image = canny(input_image, low_threshold=50, high_threshold=200)

# Mit ControlNet-Guidance generieren
image = pipe(
    prompt="Eine futuristische Stadtlandschaft mit Neonschildern, fotorealistisch, 8K",
    control_image=control_image,
    controlnet_conditioning_scale=0.7,
    num_inference_steps=25,
    guidance_scale=3.5,
    generator=torch.Generator(device="cuda").manual_seed(0),
).images[0]

image.save("controlnet_flux_output.png")
```

### FLUX ControlNet Depth

```python
import torch
from PIL import Image
from diffusers import FluxControlNetPipeline, FluxControlNetModel
from diffusers.utils import load_image
from transformers import pipeline as hf_pipeline

# Tiefenschätzer laden
depth_estimator = hf_pipeline("depth-estimation", model="LiheYoung/depth-anything-small-hf")

# Tiefenkarte vorbereiten
input_image = load_image("portrait.jpg").resize((1024, 1024))
depth_result = depth_estimator(input_image)["depth"]
depth_image = depth_result.convert("RGB")

# ControlNet Depth laden
controlnet = FluxControlNetModel.from_pretrained(
    "XLabs-AI/flux-controlnet-depth-diffusers",
    torch_dtype=torch.bfloat16
)

pipe = FluxControlNetPipeline.from_pretrained(
    "black-forest-labs/FLUX.1-dev",
    controlnet=controlnet,
    torch_dtype=torch.bfloat16
)
pipe.enable_model_cpu_offload()

image = pipe(
    prompt="Eine Marmorstatuette eines Kriegers, dramatische Beleuchtung, Museumsfoto",
    control_image=depth_image,
    controlnet_conditioning_scale=0.6,
    num_inference_steps=20,
    guidance_scale=3.5,
).images[0]
image.save("depth_controlnet_output.png")
```

### Multi-ControlNet für FLUX

```python
import torch
from diffusers import FluxControlNetPipeline, FluxMultiControlNetModel, FluxControlNetModel
from diffusers.utils import load_image
from controlnet_aux import CannyDetector

# Mehrere ControlNets laden
controlnet_canny = FluxControlNetModel.from_pretrained(
    "XLabs-AI/flux-controlnet-canny-diffusers",
    torch_dtype=torch.bfloat16
)
controlnet_depth = FluxControlNetModel.from_pretrained(
    "XLabs-AI/flux-controlnet-depth-diffusers",
    torch_dtype=torch.bfloat16
)

# Zu MultiControlNet kombinieren
multi_controlnet = FluxMultiControlNetModel([controlnet_canny, controlnet_depth])

pipe = FluxControlNetPipeline.from_pretrained(
    "black-forest-labs/FLUX.1-dev",
    controlnet=multi_controlnet,
    torch_dtype=torch.bfloat16
)
pipe.enable_model_cpu_offload()

image = pipe(
    prompt="Ein Ritter in Rüstung, stehend in einem Wald, dramatische Beleuchtung",
    control_image=[canny_image, depth_image],
    controlnet_conditioning_scale=[0.7, 0.5],
    num_inference_steps=25,
    guidance_scale=3.5,
).images[0]
```

### Verfügbare FLUX ControlNet-Modelle

| Modell        | Repo                                        | Einsatzgebiet                 |
| ------------- | ------------------------------------------- | ----------------------------- |
| Canny         | XLabs-AI/flux-controlnet-canny-diffusers    | Kanten-geführte Generierung   |
| Tiefe         | XLabs-AI/flux-controlnet-depth-diffusers    | Tiefen-geführte Generierung   |
| HED/Soft Edge | XLabs-AI/flux-controlnet-hed-diffusers      | Weiche strukturelle Steuerung |
| Pose          | XLabs-AI/flux-controlnet-openpose-diffusers | Pose-geführte Porträts        |

### ControlNet-Tipps

* **conditioning\_scale 0.5–0.8** funktioniert am besten für FLUX (zu hoch verliert Kreativität)
* Verwenden Sie **1024×1024** oder Vielfache für beste Qualität
* Mit LoRA für Stil + Struktur kombinieren
* Weniger Schritte (20–25) sind mit ControlNet meist ausreichend

***

## FLUX.1-schnell: Schneller Generierungsmodus

FLUX.1-schnell ist die destillierte, geschwindigkeitsoptimierte Variante von FLUX. Es erzeugt hochwertige Bilder in nur **4 Schritte** (vs. 20–50 für FLUX.1-dev), was es ideal für schnelles Prototyping und Workflows mit hoher Durchsatzrate macht.

### Wesentliche Unterschiede zu FLUX.1-dev

| Funktion               | FLUX.1-schnell                         | FLUX.1-dev        |
| ---------------------- | -------------------------------------- | ----------------- |
| Schritte               | 4                                      | 20–50             |
| Geschwindigkeit (4090) | \~3 Sek.                               | \~12–30 Sek.      |
| Lizenz                 | **Apache 2.0** (kostenlos kommerziell) | Nicht-kommerziell |
| guidance\_scale        | 0.0 (kein CFG)                         | 3.5               |
| Qualität               | Großartig                              | Ausgezeichnet     |
| VRAM                   | 12GB+                                  | 16GB+             |

> **Hinweis zur Lizenz:** FLUX.1-schnell ist Apache 2.0 — du kannst es frei in kommerziellen Produkten verwenden. FLUX.1-dev erfordert eine separate kommerzielle Lizenz von Black Forest Labs.

### Schnellstart

```python
import torch
from diffusers import FluxPipeline

pipe = FluxPipeline.from_pretrained(
    "black-forest-labs/FLUX.1-schnell",
    torch_dtype=torch.bfloat16
)
pipe.enable_model_cpu_offload()

image = pipe(
    prompt="Eine atemberaubende Luftaufnahme von New York City zur goldenen Stunde, fotorealistisch",
    height=1024,
    width=1024,
    num_inference_steps=4,   # Es werden nur 4 Schritte benötigt!
    guidance_scale=0.0,       # CFG für schnell deaktiviert
    max_sequence_length=256,
    generator=torch.Generator(device="cpu").manual_seed(0),
).images[0]

image.save("schnell_output.png")
print("Generiert in ~3 Sekunden auf RTX 4090!")
```

### Hochdurchsatz-Batch-Generierung

```python
import torch
from diffusers import FluxPipeline
from pathlib import Path

pipe = FluxPipeline.from_pretrained(
    "black-forest-labs/FLUX.1-schnell",
    torch_dtype=torch.bfloat16
)
pipe.to("cuda")  # Auf GPU belassen für Geschwindigkeit, kein cpu_offload verwenden

output_dir = Path("schnell_outputs")
output_dir.mkdir(exist_ok=True)

prompts = [
    "Ein ruhiger Bergsee bei Morgendämmerung, neblige Atmosphäre",
    "Ein belebter Straßenmarkt in Tokio bei Nacht, Neonspiegelungen",
    "Eine Makrofotografie eines mit Tau bedeckten Spinnennetzes",
    "Eine antike Bibliothek mit schwebenden Büchern und magischem Licht",
    "Eine futuristische Unterwasserstadt mit biolumineszentem Meeresleben",
]

# Batch-Generierung
for i, prompt in enumerate(prompts):
    image = pipe(
        prompt=prompt,
        height=1024,
        width=1024,
        num_inference_steps=4,
        guidance_scale=0.0,
        generator=torch.Generator(device="cuda").manual_seed(i),
    ).images[0]
    image.save(output_dir / f"image_{i:04d}.png")
    print(f"Generiert {i+1}/{len(prompts)}: {prompt[:50]}...")
```

### Mehrere Seitenverhältnisse mit schnell

```python
import torch
from diffusers import FluxPipeline

pipe = FluxPipeline.from_pretrained(
    "black-forest-labs/FLUX.1-schnell",
    torch_dtype=torch.bfloat16
)
pipe.enable_model_cpu_offload()

# FLUX unterstützt flexible Seitenverhältnisse
resolutions = {
    "square":    (1024, 1024),
    "portrait":  (768,  1360),
    "landscape": (1360, 768),
    "tall":      (576,  1792),
    "wide":      (1792, 576),
}

prompt = "Ein majestätischer Wolf in einem verschneiten Wald, professionelle Wildtierfotografie"

for name, (width, height) in resolutions.items():
    image = pipe(
        prompt=prompt,
        height=height,
        width=width,
        num_inference_steps=4,
        guidance_scale=0.0,
    ).images[0]
    image.save(f"schnell_{name}.png")
    print(f"Gespeichert {name}: {width}x{height}")
```

### schnell mit Speicheroptimierungen

```python
import torch
from diffusers import FluxPipeline

# Für 12GB VRAM (RTX 3060/3080)
pipe = FluxPipeline.from_pretrained(
    "black-forest-labs/FLUX.1-schnell",
    torch_dtype=torch.float16  # fp16 spart Speicher auf älteren GPUs
)
pipe.enable_model_cpu_offload()
pipe.enable_vae_slicing()
pipe.enable_vae_tiling()

image = pipe(
    prompt="Eine gemütliche Hütte im herbstlichen Wald, warmes Licht durch Fenster",
    height=768,
    width=768,
    num_inference_steps=4,
    guidance_scale=0.0,
).images[0]
image.save("schnell_low_vram.png")
```

### Performance-Benchmarks (schnell)

| GPU           | VRAM | Zeit/Bild (1024px) | Bilder/Stunde |
| ------------- | ---- | ------------------ | ------------- |
| RTX 3060 12GB | 12GB | \~8 Sek.           | \~450         |
| RTX 3090 24GB | 24GB | \~4 Sek.           | \~900         |
| RTX 4090 24GB | 24GB | \~3 Sek.           | \~1200        |
| A100 40GB     | 40GB | \~2 Sek.           | \~1800        |

### Wann schnell vs dev verwenden

**Verwende FLUX.1-schnell, wenn:**

* Schnelles Prototyping / Prompt-Tests
* Großvolumige Batch-Generierung
* Kommerzielle Projekte (Apache 2.0)
* Begrenztes GPU-Budget
* Echtzeit- oder Near-Echtzeit-Anwendungen

**Verwende FLUX.1-dev, wenn:**

* Maximale Bildqualität Priorität hat
* Feine Details und komplexe Szenen
* Forschung / künstlerische Arbeit
* Kombination mit LoRA/ControlNet (dev reagiert tendenziell besser)

***

## Nächste Schritte

* [ComfyUI](https://docs.clore.ai/guides/guides_v2-de/bildgenerierung/comfyui) - Beste Schnittstelle für FLUX
* [Fooocus](https://docs.clore.ai/guides/guides_v2-de/bildgenerierung/fooocus-simple-sd) - Einfache Alternative
* [ControlNet](https://docs.clore.ai/guides/guides_v2-de/bildverarbeitung/controlnet-advanced) - Geführte Generierung
* [Kohya Training](https://docs.clore.ai/guides/guides_v2-de/training/kohya-training) - FLUX-LoRAs trainieren
