> For the complete documentation index, see [llms.txt](https://docs.clore.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.clore.ai/guides/guides_v2-de/bildgenerierung/flux.md).

# FLUX.1

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

Hochmodernes 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
* **Textdarstellung** - Tatsächlich lesbarer Text in Bildern
* **Prompt-Befolgung** - Hervorragende Einhaltung von Anweisungen
* **Schnelle Varianten** - FLUX.1-schnell für schnelle Generierung

## Modellvarianten

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

## Schnellbereitstellung auf CLORE.AI

**Docker-Image:**

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

**Ports:**

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

Für die einfachste Bereitstellung verwenden Sie **ComfyUI mit FLUX-Nodes**.

## 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 ausführen
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 in einem 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 integrierte FLUX-Unterstützung:

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

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

## ComfyUI-Workflow

### FLUX.1-schnell (Schnell)

Benötigte Nodes:

1. **Diffusionsmodell laden** → flux1-schnell.safetensors
2. **DualCLIPLoader** → clip\_l.safetensors + t5xxl\_fp16.safetensors
3. **CLIP-Textkodierung** → Ihr Prompt
4. **Leeres SD3-Latentbild** → Abmessungen festlegen
5. **KSampler** → Schritte: 4, cfg: 1,0
6. **VAE-Dekodierung** → ae.safetensors
7. **Bild speichern**

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

Gleicher Workflow, aber:

* Schritte: 20–50
* CFG: 3,5
* guidance\_scale im Prompt verwenden

## 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
)

# Optimierungen aktivieren
pipe.enable_model_cpu_offload()  # Spart ca. 10 GB 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]
```

### Stapelgenerierung

```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 älteren Fischers",
    height=1024,
    width=1024,
    num_inference_steps=50,
    guidance_scale=3.5,
).images[0]
```

## Prompt-Tipps

### FLUX ist besonders gut bei:

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

### Beispiel-Prompts

```
# Fotorealistisch
Ein professionelles Foto eines Golden-Retriever-Welpen, der in Herbstblättern spielt, 
geringe Tiefenschärfe, warmes Nachmittagslicht, Canon EOS R5

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

# Textdarstellung
Ein Vintage-Filmposter mit dem Titel "COSMIC VOYAGE" in fetten Retro-Buchstaben,
Sci-Fi-Ästhetik der 1960er, Astronautenillustration

# Komplexe Szene
Ein gemütliches Bibliotheksinterieur mit Bücherregalen bis zur Decke, 
ein Ledersessel neben einem Kamin, Regen durch ein Fenster sichtbar,
warmes Lampenlicht, fotorealistisch
```

## Speicheroptimierung

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

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

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

### Für 8 GB VRAM

Verwenden Sie die quantisierte Version oder ComfyUI mit GGUF:

```bash
# In ComfyUI die GGUF-Nodes 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.    | Gut          |
| FLUX.1-dev     | 20       | \~12 Sek.   | Hervorragend |
| FLUX.1-dev     | 50       | \~30 Sek.   | Am besten    |
| SDXL           | 30       | \~8 Sek.    | Gut          |

## GPU-Anforderungen

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

## GPU-Voreinstellungen

### RTX 3060 12 GB (Budget)

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

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

### RTX 3090 24 GB (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 24 GB](https://clore.ai/rent-4090.html?utm_source=docs\&utm_medium=guide\&utm_campaign=flux) (Leistung)

```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
# - 1536x1536 mit Tiling möglich
```

### A100 40 GB/80 GB (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
```

## Kostenschätzung

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

## Fehlerbehebung

### Speicher voll

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

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

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

### Langsame Generierung

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

### Schlechte Qualität

* Mehr Schritte verwenden (FLUX-dev: 30–50)
* guidance\_scale erhöhen (3,0–4,0 für dev)
* Detailliertere Prompts schreiben

***

## FLUX LoRA

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

### Installation

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

### Eine einzelne LoRA laden

```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")
```

### Vom HuggingFace Hub laden

```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
# Den Einfluss der LoRA mit cross_attention_kwargs steuern
image = pipe(
    "Eine Cyberpunk-Figur, Neonlichter",
    num_inference_steps=20,
    guidance_scale=3.5,
    cross_attention_kwargs={"scale": 0.8},  # 0,0 = kein Effekt, 1,0 = voller Effekt
).images[0]
```

### Mehrere LoRAs kombinieren

```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 in aufwendigem Kostüm, 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()
```

### Ihre eigene FLUX LoRA trainieren

```bash
# Verwenden Sie kohya-ss oder ai-toolkit für das 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 Bildunterschriften
# Config-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         | Trainierte Modelle durchsuchen |

***

## ControlNet für FLUX

ControlNet ermöglicht die Steuerung der FLUX-Generierung mit strukturellen Eingaben wie Canny-Kanten, Tiefenkarten und Poseskeletten. 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-Steuerung 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 Marmorskulptur 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 zusammenführen
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, der in einem Wald steht, 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                                        | Anwendungsfall                |
| ------------- | ------------------------------------------- | ----------------------------- |
| Canny         | XLabs-AI/flux-controlnet-canny-diffusers    | Kanten-geführte Generierung   |
| Depth         | 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)
* Verwende **1024×1024** oder Vielfache für beste Qualität
* Mit LoRA kombinieren für Stil- + Strukturkontrolle
* Niedrigere Schritte (20–25) reichen mit ControlNet meist aus

***

## FLUX.1-schnell: Modus für schnelle Generierung

FLUX.1-schnell ist die destillierte, auf Geschwindigkeit optimierte Variante von FLUX. Sie erzeugt hochwertige Bilder in nur **4 Schritten** (vs. 20–50 für FLUX.1-dev) und ist damit ideal für schnelles Prototyping und Workflows mit hohem Durchsatz.

### 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** (frei kommerziell) | Nicht-kommerziell |
| guidance\_scale        | 0,0 (kein CFG)                    | 3.5               |
| Qualität               | Gut                               | Hervorragend      |
| VRAM                   | 12 GB+                            | 16 GB+            |

> **Lizenzhinweis:** FLUX.1-schnell ist unter Apache 2.0 lizenziert — Sie können es frei in kommerziellen Produkten verwenden. FLUX.1-dev benötigt 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="Ein atemberaubender Luftblick auf New York City zur goldenen Stunde, fotorealistisch",
    height=1024,
    width=1024,
    num_inference_steps=4,   # Nur 4 Schritte nötig!
    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("In ~3 Sekunden auf einer RTX 4090 generiert!")
```

### Hochdurchsatz-Stapelgenerierung

```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")  # Für Geschwindigkeit auf der GPU belassen, kein cpu_offload verwenden

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

prompts = [
    "Ein ruhiger Bergsee im Morgengrauen, neblige Atmosphäre",
    "Ein geschäftiger Tokyoter Straßenmarkt bei Nacht, Neon-Reflexionen",
    "Ein Makrofoto eines von Tau bedeckten Spinnennetzes",
    "Eine alte Bibliothek mit schwebenden Büchern und magischem Licht",
    "Eine futuristische Unterwasserstadt mit biolumineszentem Meeresleben",
]

# Stapelgenerierung
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"{i+1}/{len(prompts)} generiert: {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 Wildlife-Fotografie"

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"{name} gespeichert: {width}x{height}")
```

### schnell mit Speicheroptimierungen

```python
import torch
from diffusers import FluxPipeline

# Für 12 GB 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 in einem Herbstwald, warmes Licht durch die Fenster",
    height=768,
    width=768,
    num_inference_steps=4,
    guidance_scale=0.0,
).images[0]
image.save("schnell_low_vram.png")
```

### Leistungs-Benchmarks (schnell)

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

### Wann man schnell vs. dev verwenden sollte

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

* Schnelles Prototyping / Testen von Prompts
* Batch-Generierung mit hohem Volumen
* Kommerzielle Projekte (Apache 2.0)
* Begrenztes GPU-Budget
* Echtzeit- oder nahezu Echtzeitanwendungen

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

* Maximale Bildqualität hat Priorität
* Feine Details und komplexe Szenen
* Forschung / künstlerische Arbeit
* Kombination mit LoRA/ControlNet (dev neigt dazu, besser zu reagieren)

***

## Nächste Schritte

* [ComfyUI](/guides/guides_v2-de/bildgenerierung/comfyui.md) - Beste Oberfläche für FLUX
* [Fooocus](/guides/guides_v2-de/bildgenerierung/fooocus-simple-sd.md) - Einfache Alternative
* [ControlNet](/guides/guides_v2-de/bildverarbeitung/controlnet-advanced.md) - Geführte Generierung
* [Kohya-Training](/guides/guides_v2-de/training/kohya-training.md) - Trainiere FLUX-LoRAs


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.clore.ai/guides/guides_v2-de/bildgenerierung/flux.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
