⚠️ In starker Entwicklung
Diese Einrichtung befindet sich noch in der experimentellen Phase.
Nutzen Sie es als Inspiration für die WAN-basierte Videogenerierung (T2V/I2V/V2V/S2V) anstelle einer produktionsreifen Anleitung.
GPU-Server für WAN-Video bestellen
Erstellen Sie eine saubere Python-Umgebung mit Conda (empfohlen) oder venv:
# 1) Conda / Virtual Environment
conda create -n wan22 python=3.10 -y
conda activate wan22
# 2) Install PyTorch (CUDA 12.x Build)
pip install --upgrade torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
pip install xformers accelerate transformers datasets peft bitsandbytes==0.43.3 safetensors einops
pip install opencv-python pillow tqdm
# 3) Clone Trainer
git clone https://github.com/Wan-Video/DiffSynth-Studio.git
cd DiffSynth-Studio
pip install -r requirements.txt || true
cd ..
💡 Tipp: Auf NVIDIA A100 GPUsverwenden Sie immer BF16 Präzision für stabiles und effizientes Training.
Platziere deine WAN 2.2 Modellgewichte (abhängig von Ihrer Aufgabe: T2V, I2V, V2V, S2V) zusammen mit VAE und Text Encoder in die erwarteten Verzeichnisse des Trainers legen – oder manuell übergeben --model_name_or_path.
Beispiele: Nur die RTX 4090 und RTX 5090 unterstützen derzeit NVLink. 🔗
--model_name_or_path Wan-AI/Wan2.2-T2V-A14B # Text-to-Video
--model_name_or_path Wan-AI/Wan2.2-I2V-A14B # Image-to-Video
WAN erwartet eine JSONL-Datensatz Datei mit jeweils einem Eintrag pro Videoclip.
{"video": "/data/myset/clip_0001.mp4", "prompt": "a cozy coffee shop scene at golden hour", "fps": 24, "seconds": 4, "resolution": "1280x720"}
{"video": "/data/myset/clip_0002.mp4", "prompt": "rainy neon city street, cinematic", "fps": 24, "seconds": 4, "resolution": "1280x720"}
📘 Hinweise:
Für Text-to-Video (T2V)Sie können Standbilder, Frames oder ein Dummy-Video als Referenz verwenden. prompt und Zielspezifikationen (fps, seconds, resolutionsind erforderlich.
Speichern Sie Ihre Datensätze als:
/data/wan22/train.jsonl/data/wan22/val.jsonlaccelerate KonfigurationEinmalig initialisieren:
accelerate config default
Oder definieren Sie es manuell in
~/.cache/huggingface/accelerate/default_config.yaml:
compute_environment: LOCAL_MACHINE
distributed_type: NO
mixed_precision: bf16
num_processes: 1
gpu_ids: "0"
dynamo_backend: NO
👉 Für Multi-GPU-Training setzen Sie:
distributed_type: MULTI_GPU
conda activate wan22
cd DiffSynth-Studio
accelerate launch \
train_wan_lora.py \
--model_name_or_path "Wan-AI/Wan2.2-T2V-A14B" \
--output_dir /data/wan22_lora_out \
--dataset_json /data/wan22/train.jsonl \
--resolution 720 --fps 24 --clip_seconds 4 \
--train_batch_size 1 \
--gradient_accumulation_steps 8 \
--max_train_steps 20000 \
--learning_rate 1e-4 --warmup_steps 500 \
--lora_rank 64 --lora_alpha 64 \
--use_bf16 --enable_xformers --gradient_checkpointing \
--checkpointing_steps 1000 \
--validation_json /data/wan22/val.jsonl --validation_steps 2000
Ändere nur das Modell:
--model_name_or_path "Wan-AI/Wan2.2-I2V-A14B"
| Situation | Empfohlene Anpassung |
|---|---|
| Ausreichend VRAM | Erhöhen --train_batch_size 2 oder verwende --lora_rank 96–128 |
| Begrenzter VRAM | Erhöhen --gradient_accumulation_steps to 12–16 |
| Charakter-/Stil-LoRAs | 6.000–12.000 Schritte, Rang 32–64 |
| Präzision | Bevorzuge immer BF16 anstelle von FP16 |
| Optimierung | Aktivieren --gradient_checkpointing + --enable_xformers |
accelerate launch train_wan_lora.py \
... (same parameters) \
--resume_from_checkpoint "/data/wan22_lora_out/checkpoint-10000"
Die meisten WAN-Workflows (CLI, ComfyUI usw.) unterstützen das direkte Laden von LoRA-Adaptern.
python infer_wan.py \
--model_name_or_path "Wan-AI/Wan2.2-T2V-A14B" \
--lora_path "/data/wan22_lora_out" \
--prompt "cozy coffee shop at golden hour, bokeh" \
--negative_prompt "distorted faces, artifacts" \
--resolution 720 --fps 24 --seconds 4 \
--output /data/wan22/samples/test001.mp4 \
--use_bf16 --enable_xformers
💡 ComfyUI: Verwenden Sie den WAN Loader → fügen Sie LoRA(s) hinzu → rendern Sie Ihre Testvideos.
Nutzen Sie mehrere GPUs (z.B. 2× A100 40GB) für schnelleres Fine-Tuning.
accelerate config # set distributed_type=MULTI_GPU, num_processes=2
accelerate launch \
--multi_gpu \
train_wan_lora.py \
... (same parameters) \
--train_batch_size 1 --gradient_accumulation_steps 8
Für Konfigurationen mit 4+ GPUs aktivieren --seq_parallel falls unterstützt – reduziert die VRAM-Last erheblich.
| Typ | LR | Rang | Alpha | Schritte | Batch | Gradientenakkumulation | Hinweise |
|---|---|---|---|---|---|---|---|
| Allgemein | 1e-4 | 64 | 64 | 10k–20k | 1 | 8–12 | Ausgewogene Basislinie |
| Charakter | 1e-4 | 64–128 | 64 | 8k–12k | 1 | 8 | Ideal für kurze 2–4-sekündige Clips |
| Stil | 1e-4 | 32–64 | 64 | 6k–10k | 1 | 8–12 | Größerer stilistischer Spielraum |
| Bewertung | — | — | — | alle 1–2k | — | — | Test 2–4 fest + 2 reale Prompts |
WAN LoRA-Training ermöglicht:
Empfohlene Konfiguration:
Environment → Model Setup → Dataset Prep → LoRA Fine-tune → Inference
🎥 Intelligenter trainieren. Schneller generieren. Stärkeres WAN.