Add files using upload-large-folder tool
Browse files
README.md
CHANGED
|
@@ -1,25 +1,18 @@
|
|
| 1 |
-
<!-- README Version: v1.0 -->
|
| 2 |
-
|
| 3 |
---
|
| 4 |
license: other
|
| 5 |
-
license_name: wan-license
|
| 6 |
library_name: diffusers
|
| 7 |
pipeline_tag: text-to-video
|
| 8 |
tags:
|
| 9 |
-
- video-generation
|
| 10 |
-
- vae
|
| 11 |
- wan
|
| 12 |
-
-
|
| 13 |
-
-
|
| 14 |
-
- video-compression
|
| 15 |
-
- wan2.5
|
| 16 |
-
base_model: Wan-AI/Wan2.5
|
| 17 |
-
base_model_relation: component
|
| 18 |
---
|
| 19 |
|
| 20 |
-
|
|
|
|
|
|
|
| 21 |
|
| 22 |
-
⚠️ **Repository Status**: This repository is currently a placeholder for WAN 2.5 VAE models. The directory structure is prepared but model files have not yet been downloaded.
|
| 23 |
|
| 24 |
High-performance Variational Autoencoder (VAE) component for the WAN 2.5 (World Anything Now) video generation system. This VAE provides efficient latent space encoding and decoding for video content, enabling high-quality video generation with reduced computational requirements.
|
| 25 |
|
|
@@ -47,29 +40,38 @@ The WAN25-VAE is the next-generation variational autoencoder designed for video
|
|
| 47 |
|
| 48 |
### WAN VAE Evolution
|
| 49 |
|
| 50 |
-
| Version | Compression Ratio | Key Features |
|
| 51 |
-
|---------|------------------|--------------|
|
| 52 |
-
| **WAN 2.1 VAE** | 4×8×8 (temporal×spatial) | Initial 3D causal VAE, efficient 1080P encoding |
|
| 53 |
-
| **WAN 2.2 VAE** | 4×16×16 | Enhanced compression (64x overall), improved quality |
|
| 54 |
-
| **WAN 2.5 VAE** | TBD | Expected: Audio-visual integration, further optimizations |
|
| 55 |
|
| 56 |
## Repository Contents
|
| 57 |
|
|
|
|
|
|
|
| 58 |
```
|
| 59 |
-
wan25-vae/
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
```
|
| 64 |
|
| 65 |
**Current Status**: Directory structure prepared, awaiting model file downloads.
|
| 66 |
|
| 67 |
-
### Expected
|
| 68 |
|
| 69 |
| File | Expected Size | Description |
|
| 70 |
|------|--------------|-------------|
|
| 71 |
-
| `
|
| 72 |
-
| `config.json` | ~1-5 KB | Model configuration and architecture parameters |
|
|
|
|
|
|
|
|
|
|
| 73 |
|
| 74 |
## Hardware Requirements
|
| 75 |
|
|
@@ -78,28 +80,33 @@ wan25-vae/
|
|
| 78 |
- **System RAM**: 4 GB
|
| 79 |
- **Disk Space**: 2.5 GB free space
|
| 80 |
- **GPU**: CUDA-compatible GPU (NVIDIA) or compatible accelerator
|
|
|
|
|
|
|
| 81 |
|
| 82 |
### Recommended Specifications
|
| 83 |
- **VRAM**: 6+ GB for comfortable operation with video generation pipeline
|
| 84 |
- **System RAM**: 16+ GB
|
| 85 |
- **GPU**: NVIDIA RTX 3060 or better, RTX 4060+ recommended
|
| 86 |
-
- **Storage**: SSD for faster model loading
|
|
|
|
| 87 |
|
| 88 |
### Performance Notes
|
| 89 |
- VAE operations are typically memory-bound rather than compute-bound
|
| 90 |
- Larger batch sizes require proportionally more VRAM
|
| 91 |
- CPU inference is possible but significantly slower (30-50x)
|
| 92 |
- WAN 2.5 may include audio processing requiring additional compute
|
|
|
|
|
|
|
| 93 |
|
| 94 |
## Usage Examples
|
| 95 |
|
| 96 |
-
### Basic Usage with Diffusers
|
| 97 |
|
| 98 |
```python
|
| 99 |
import torch
|
| 100 |
from diffusers import AutoencoderKL
|
| 101 |
|
| 102 |
-
# Load the WAN25 VAE
|
| 103 |
vae_path = r"E:\huggingface\wan25-vae\vae\wan"
|
| 104 |
vae = AutoencoderKL.from_pretrained(
|
| 105 |
vae_path,
|
|
@@ -189,6 +196,26 @@ for alpha in np.linspace(0, 1, 24):
|
|
| 189 |
smooth_video = vae.decode(torch.stack(interpolated_latents)).sample
|
| 190 |
```
|
| 191 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 192 |
## Model Specifications
|
| 193 |
|
| 194 |
### Architecture Details (Expected)
|
|
@@ -198,6 +225,7 @@ smooth_video = vae.decode(torch.stack(interpolated_latents)).sample
|
|
| 198 |
- **Latent Dimensions**: Compressed spatial resolution with channel expansion
|
| 199 |
- **Temporal Processing**: 3D causal convolutions for temporal coherence
|
| 200 |
- **Activation Functions**: Mixed (SiLU, tanh for output)
|
|
|
|
| 201 |
|
| 202 |
### Technical Specifications
|
| 203 |
- **Format**: SafeTensors (secure, efficient binary format)
|
|
@@ -206,20 +234,23 @@ smooth_video = vae.decode(torch.stack(interpolated_latents)).sample
|
|
| 206 |
- **Parameters**: Estimated ~400-500M parameters (based on WAN 2.2 progression)
|
| 207 |
- **Compression Ratio**: Expected improvements over WAN 2.2's 4×16×16
|
| 208 |
- **Perceptual Optimization**: Pre-trained perceptual networks for quality preservation
|
|
|
|
| 209 |
|
| 210 |
### Supported Input Resolutions
|
| 211 |
- **Standard**: 480P (854×480), 720P (1280×720), 1080P (1920×1080)
|
| 212 |
- **Aspect Ratios**: 16:9, 4:3, 1:1, and custom ratios
|
| 213 |
- **Frame Rates**: 24fps, 30fps, 60fps support expected
|
|
|
|
| 214 |
|
| 215 |
## Performance Tips and Optimization
|
| 216 |
|
| 217 |
### Memory Optimization
|
|
|
|
| 218 |
```python
|
| 219 |
# Enable gradient checkpointing for training (if fine-tuning)
|
| 220 |
vae.enable_gradient_checkpointing()
|
| 221 |
|
| 222 |
-
# Use float16 for inference to reduce VRAM usage
|
| 223 |
vae = vae.half()
|
| 224 |
|
| 225 |
# Process frames in batches
|
|
@@ -227,9 +258,13 @@ batch_size = 4 # Adjust based on available VRAM
|
|
| 227 |
|
| 228 |
# Enable CPU offloading for large models
|
| 229 |
vae.enable_model_cpu_offload()
|
|
|
|
|
|
|
|
|
|
| 230 |
```
|
| 231 |
|
| 232 |
### Speed Optimization
|
|
|
|
| 233 |
```python
|
| 234 |
# Compile model with torch.compile (PyTorch 2.0+)
|
| 235 |
vae = torch.compile(vae, mode="reduce-overhead")
|
|
@@ -237,27 +272,36 @@ vae = torch.compile(vae, mode="reduce-overhead")
|
|
| 237 |
# Use channels_last memory format for better performance
|
| 238 |
vae = vae.to(memory_format=torch.channels_last)
|
| 239 |
|
| 240 |
-
# Enable TF32 on Ampere+ GPUs
|
| 241 |
torch.backends.cuda.matmul.allow_tf32 = True
|
| 242 |
torch.backends.cudnn.allow_tf32 = True
|
| 243 |
|
| 244 |
# Use xFormers for memory-efficient attention
|
| 245 |
vae.enable_xformers_memory_efficient_attention()
|
|
|
|
|
|
|
|
|
|
| 246 |
```
|
| 247 |
|
| 248 |
### Quality vs Speed Trade-offs
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
-
|
| 252 |
-
|
|
|
|
|
|
|
|
|
|
| 253 |
|
| 254 |
### Best Practices
|
|
|
|
| 255 |
- Always use safetensors format for security and compatibility
|
| 256 |
-
- Monitor VRAM usage with `torch.cuda.memory_allocated()`
|
| 257 |
- Clear cache between large operations: `torch.cuda.empty_cache()`
|
| 258 |
- Use mixed precision training if fine-tuning the VAE
|
| 259 |
- Validate reconstruction quality with perceptual metrics (LPIPS, SSIM, PSNR)
|
| 260 |
- Consider using video-specific quality metrics (VMAF, VQM)
|
|
|
|
|
|
|
| 261 |
|
| 262 |
## Getting Started
|
| 263 |
|
|
@@ -265,30 +309,49 @@ vae.enable_xformers_memory_efficient_attention()
|
|
| 265 |
|
| 266 |
When WAN 2.5 VAE becomes available, download from Hugging Face:
|
| 267 |
|
| 268 |
-
|
| 269 |
-
|
|
|
|
| 270 |
from huggingface_hub import snapshot_download
|
| 271 |
|
| 272 |
snapshot_download(
|
| 273 |
-
repo_id="Wan-AI/Wan2.5-VAE", # Check official repo name
|
| 274 |
-
local_dir="E:
|
| 275 |
-
allow_patterns=["*.safetensors", "*.json"]
|
|
|
|
| 276 |
)
|
| 277 |
```
|
| 278 |
|
| 279 |
-
|
| 280 |
|
| 281 |
```bash
|
| 282 |
-
cd E:
|
| 283 |
git lfs install
|
| 284 |
git clone https://huggingface.co/Wan-AI/Wan2.5-VAE .
|
| 285 |
```
|
| 286 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 287 |
### Step 2: Install Dependencies
|
| 288 |
|
| 289 |
```bash
|
|
|
|
| 290 |
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
|
| 291 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 292 |
```
|
| 293 |
|
| 294 |
### Step 3: Verify Installation
|
|
@@ -296,14 +359,31 @@ pip install diffusers transformers accelerate xformers safetensors
|
|
| 296 |
```python
|
| 297 |
import torch
|
| 298 |
from diffusers import AutoencoderKL
|
|
|
|
| 299 |
|
| 300 |
# Check if model files exist
|
| 301 |
-
import os
|
| 302 |
vae_path = r"E:\huggingface\wan25-vae\vae\wan"
|
| 303 |
-
|
| 304 |
-
|
| 305 |
-
|
| 306 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 307 |
else:
|
| 308 |
print("✗ WAN25 VAE model not found. Please download first.")
|
| 309 |
```
|
|
@@ -321,6 +401,8 @@ For complete license details, refer to the official WAN model repository or lice
|
|
| 321 |
- https://huggingface.co/Wan-AI
|
| 322 |
- https://wan.video/
|
| 323 |
|
|
|
|
|
|
|
| 324 |
## Citation
|
| 325 |
|
| 326 |
If you use this VAE in your research or projects, please cite:
|
|
@@ -354,7 +436,7 @@ For the broader WAN 2.5 system:
|
|
| 354 |
- **Hugging Face Organization**: [https://huggingface.co/Wan-AI](https://huggingface.co/Wan-AI)
|
| 355 |
- **GitHub Repository**: [https://github.com/Wan-Video](https://github.com/Wan-Video)
|
| 356 |
- **Diffusers Documentation**: [https://huggingface.co/docs/diffusers](https://huggingface.co/docs/diffusers)
|
| 357 |
-
- **Model Hub**: [https://huggingface.co/models](https://huggingface.co/models)
|
| 358 |
|
| 359 |
### Related WAN Models (Local Repository)
|
| 360 |
- **WAN 2.1 VAE**: `E:\huggingface\wan21-vae\` - Previous generation VAE
|
|
@@ -367,7 +449,7 @@ For the broader WAN 2.5 system:
|
|
| 367 |
- **WAN Community**: Discussions and examples for WAN video generation
|
| 368 |
- **Video Generation Papers**: Research on video diffusion and VAE architectures
|
| 369 |
- **Optimization Guides**: Tips for efficient video processing with VAEs
|
| 370 |
-
- **ArXiv Paper**: Wan: Open and Advanced Large-Scale Video Generative Models
|
| 371 |
|
| 372 |
### Compatibility
|
| 373 |
- **Required Libraries**: `torch>=2.0.0`, `diffusers>=0.21.0`, `transformers>=4.30.0`
|
|
@@ -379,11 +461,11 @@ For the broader WAN 2.5 system:
|
|
| 379 |
|
| 380 |
For technical issues, questions, or contributions:
|
| 381 |
|
| 382 |
-
1. **Model Issues**: Report to WAN-AI Hugging Face repository
|
| 383 |
-
2. **Integration Questions**: Consult Diffusers documentation and community
|
| 384 |
-
3. **Performance Optimization**: Check PyTorch performance tuning guides
|
| 385 |
-
4. **Local Setup**: Verify CUDA installation
|
| 386 |
-
5. **Community Support**: WAN Discord/Forum (check official website)
|
| 387 |
|
| 388 |
## Troubleshooting
|
| 389 |
|
|
@@ -391,36 +473,92 @@ For technical issues, questions, or contributions:
|
|
| 391 |
|
| 392 |
**Model Not Found Error:**
|
| 393 |
```python
|
| 394 |
-
#
|
| 395 |
# Expected location: E:\huggingface\wan25-vae\vae\wan\
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 396 |
```
|
| 397 |
|
| 398 |
**VRAM Out of Memory:**
|
| 399 |
```python
|
| 400 |
-
# Reduce batch size
|
|
|
|
| 401 |
vae.enable_model_cpu_offload()
|
| 402 |
-
|
|
|
|
| 403 |
vae = vae.half()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 404 |
```
|
| 405 |
|
| 406 |
**Slow Inference Speed:**
|
| 407 |
```python
|
| 408 |
# Enable xFormers and model compilation
|
| 409 |
vae.enable_xformers_memory_efficient_attention()
|
| 410 |
-
vae = torch.compile(vae)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 411 |
```
|
| 412 |
|
| 413 |
---
|
| 414 |
|
| 415 |
-
**Version**: v1.
|
| 416 |
-
**Last Updated**: 2025-10-
|
| 417 |
**Model Format**: SafeTensors (when available)
|
| 418 |
**Repository Status**: Placeholder - Awaiting model download
|
| 419 |
**Expected Model Size**: ~1.5-2.0 GB
|
|
|
|
| 420 |
|
| 421 |
## Changelog
|
| 422 |
|
| 423 |
-
### v1.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 424 |
- Initial placeholder documentation for WAN25-VAE repository
|
| 425 |
- Comprehensive usage examples based on WAN 2.1/2.2 patterns
|
| 426 |
- Hardware requirements and optimization guidelines
|
|
@@ -435,3 +573,4 @@ vae = torch.compile(vae)
|
|
| 435 |
- Add benchmark results and performance comparisons
|
| 436 |
- Include official usage examples from WAN team
|
| 437 |
- Document any audio-visual integration features
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: other
|
|
|
|
| 3 |
library_name: diffusers
|
| 4 |
pipeline_tag: text-to-video
|
| 5 |
tags:
|
|
|
|
|
|
|
| 6 |
- wan
|
| 7 |
+
- text-to-video
|
| 8 |
+
- image-generation
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
---
|
| 10 |
|
| 11 |
+
<!-- README Version: v1.2 -->
|
| 12 |
+
|
| 13 |
+
# WAN25 VAE - Video Autoencoder v2.5
|
| 14 |
|
| 15 |
+
⚠️ **Repository Status**: This repository is currently a placeholder for WAN 2.5 VAE models. The directory structure is prepared (`vae/wan/`) but model files have not yet been downloaded. Total current size: ~18 KB (metadata only).
|
| 16 |
|
| 17 |
High-performance Variational Autoencoder (VAE) component for the WAN 2.5 (World Anything Now) video generation system. This VAE provides efficient latent space encoding and decoding for video content, enabling high-quality video generation with reduced computational requirements.
|
| 18 |
|
|
|
|
| 40 |
|
| 41 |
### WAN VAE Evolution
|
| 42 |
|
| 43 |
+
| Version | Compression Ratio | Key Features | Status |
|
| 44 |
+
|---------|------------------|--------------|--------|
|
| 45 |
+
| **WAN 2.1 VAE** | 4×8×8 (temporal×spatial) | Initial 3D causal VAE, efficient 1080P encoding | Available |
|
| 46 |
+
| **WAN 2.2 VAE** | 4×16×16 | Enhanced compression (64x overall), improved quality | Available |
|
| 47 |
+
| **WAN 2.5 VAE** | TBD | Expected: Audio-visual integration, further optimizations | Pending Release |
|
| 48 |
|
| 49 |
## Repository Contents
|
| 50 |
|
| 51 |
+
### Current Directory Structure
|
| 52 |
+
|
| 53 |
```
|
| 54 |
+
wan25-vae/ # Root directory (18 KB)
|
| 55 |
+
├── README.md # This file (~18 KB)
|
| 56 |
+
├── .cache/ # Hugging Face upload cache
|
| 57 |
+
│ └── huggingface/
|
| 58 |
+
│ └── upload/
|
| 59 |
+
│ └── README.md.metadata # Upload metadata
|
| 60 |
+
└── vae/ # VAE model directory (empty)
|
| 61 |
+
└── wan/ # WAN model subdirectory (empty - ready for download)
|
| 62 |
```
|
| 63 |
|
| 64 |
**Current Status**: Directory structure prepared, awaiting model file downloads.
|
| 65 |
|
| 66 |
+
### Expected Files After Download
|
| 67 |
|
| 68 |
| File | Expected Size | Description |
|
| 69 |
|------|--------------|-------------|
|
| 70 |
+
| `vae/wan/diffusion_pytorch_model.safetensors` | ~1.5-2.0 GB | WAN25 VAE model weights in safetensors format |
|
| 71 |
+
| `vae/wan/config.json` | ~1-5 KB | Model configuration and architecture parameters |
|
| 72 |
+
| `vae/wan/README.md` | ~5-10 KB | Official model documentation (optional) |
|
| 73 |
+
|
| 74 |
+
**Total Repository Size After Download**: ~1.5-2.0 GB
|
| 75 |
|
| 76 |
## Hardware Requirements
|
| 77 |
|
|
|
|
| 80 |
- **System RAM**: 4 GB
|
| 81 |
- **Disk Space**: 2.5 GB free space
|
| 82 |
- **GPU**: CUDA-compatible GPU (NVIDIA) or compatible accelerator
|
| 83 |
+
- **CUDA**: Version 11.8+ or 12.1+
|
| 84 |
+
- **Operating System**: Windows 10/11, Linux (Ubuntu 20.04+), macOS (limited GPU support)
|
| 85 |
|
| 86 |
### Recommended Specifications
|
| 87 |
- **VRAM**: 6+ GB for comfortable operation with video generation pipeline
|
| 88 |
- **System RAM**: 16+ GB
|
| 89 |
- **GPU**: NVIDIA RTX 3060 or better, RTX 4060+ recommended
|
| 90 |
+
- **Storage**: SSD for faster model loading (NVMe preferred)
|
| 91 |
+
- **CPU**: Modern multi-core processor (Intel i5/AMD Ryzen 5 or better)
|
| 92 |
|
| 93 |
### Performance Notes
|
| 94 |
- VAE operations are typically memory-bound rather than compute-bound
|
| 95 |
- Larger batch sizes require proportionally more VRAM
|
| 96 |
- CPU inference is possible but significantly slower (30-50x)
|
| 97 |
- WAN 2.5 may include audio processing requiring additional compute
|
| 98 |
+
- FP16 precision reduces VRAM usage by ~50% with minimal quality loss
|
| 99 |
+
- Batch processing of frames is more efficient than sequential processing
|
| 100 |
|
| 101 |
## Usage Examples
|
| 102 |
|
| 103 |
+
### Basic Usage with Diffusers
|
| 104 |
|
| 105 |
```python
|
| 106 |
import torch
|
| 107 |
from diffusers import AutoencoderKL
|
| 108 |
|
| 109 |
+
# Load the WAN25 VAE from local directory
|
| 110 |
vae_path = r"E:\huggingface\wan25-vae\vae\wan"
|
| 111 |
vae = AutoencoderKL.from_pretrained(
|
| 112 |
vae_path,
|
|
|
|
| 196 |
smooth_video = vae.decode(torch.stack(interpolated_latents)).sample
|
| 197 |
```
|
| 198 |
|
| 199 |
+
### Loading from Absolute Path (Windows)
|
| 200 |
+
|
| 201 |
+
```python
|
| 202 |
+
import torch
|
| 203 |
+
from diffusers import AutoencoderKL
|
| 204 |
+
|
| 205 |
+
# Explicit absolute path for Windows systems
|
| 206 |
+
vae = AutoencoderKL.from_pretrained(
|
| 207 |
+
r"E:\huggingface\wan25-vae\vae\wan",
|
| 208 |
+
torch_dtype=torch.float16,
|
| 209 |
+
local_files_only=True # Ensure loading from local directory
|
| 210 |
+
)
|
| 211 |
+
|
| 212 |
+
# Alternative: Using forward slashes
|
| 213 |
+
vae = AutoencoderKL.from_pretrained(
|
| 214 |
+
"E:/huggingface/wan25-vae/vae/wan",
|
| 215 |
+
torch_dtype=torch.float16
|
| 216 |
+
)
|
| 217 |
+
```
|
| 218 |
+
|
| 219 |
## Model Specifications
|
| 220 |
|
| 221 |
### Architecture Details (Expected)
|
|
|
|
| 225 |
- **Latent Dimensions**: Compressed spatial resolution with channel expansion
|
| 226 |
- **Temporal Processing**: 3D causal convolutions for temporal coherence
|
| 227 |
- **Activation Functions**: Mixed (SiLU, tanh for output)
|
| 228 |
+
- **Normalization**: Group normalization for stable training
|
| 229 |
|
| 230 |
### Technical Specifications
|
| 231 |
- **Format**: SafeTensors (secure, efficient binary format)
|
|
|
|
| 234 |
- **Parameters**: Estimated ~400-500M parameters (based on WAN 2.2 progression)
|
| 235 |
- **Compression Ratio**: Expected improvements over WAN 2.2's 4×16×16
|
| 236 |
- **Perceptual Optimization**: Pre-trained perceptual networks for quality preservation
|
| 237 |
+
- **Model Size**: ~1.5-2.0 GB (FP16 safetensors format)
|
| 238 |
|
| 239 |
### Supported Input Resolutions
|
| 240 |
- **Standard**: 480P (854×480), 720P (1280×720), 1080P (1920×1080)
|
| 241 |
- **Aspect Ratios**: 16:9, 4:3, 1:1, and custom ratios
|
| 242 |
- **Frame Rates**: 24fps, 30fps, 60fps support expected
|
| 243 |
+
- **Batch Processing**: Supports batch encoding/decoding for efficiency
|
| 244 |
|
| 245 |
## Performance Tips and Optimization
|
| 246 |
|
| 247 |
### Memory Optimization
|
| 248 |
+
|
| 249 |
```python
|
| 250 |
# Enable gradient checkpointing for training (if fine-tuning)
|
| 251 |
vae.enable_gradient_checkpointing()
|
| 252 |
|
| 253 |
+
# Use float16 for inference to reduce VRAM usage (~50% reduction)
|
| 254 |
vae = vae.half()
|
| 255 |
|
| 256 |
# Process frames in batches
|
|
|
|
| 258 |
|
| 259 |
# Enable CPU offloading for large models
|
| 260 |
vae.enable_model_cpu_offload()
|
| 261 |
+
|
| 262 |
+
# Enable sequential CPU offload for lowest VRAM usage
|
| 263 |
+
vae.enable_sequential_cpu_offload()
|
| 264 |
```
|
| 265 |
|
| 266 |
### Speed Optimization
|
| 267 |
+
|
| 268 |
```python
|
| 269 |
# Compile model with torch.compile (PyTorch 2.0+)
|
| 270 |
vae = torch.compile(vae, mode="reduce-overhead")
|
|
|
|
| 272 |
# Use channels_last memory format for better performance
|
| 273 |
vae = vae.to(memory_format=torch.channels_last)
|
| 274 |
|
| 275 |
+
# Enable TF32 on Ampere+ GPUs (RTX 30/40 series)
|
| 276 |
torch.backends.cuda.matmul.allow_tf32 = True
|
| 277 |
torch.backends.cudnn.allow_tf32 = True
|
| 278 |
|
| 279 |
# Use xFormers for memory-efficient attention
|
| 280 |
vae.enable_xformers_memory_efficient_attention()
|
| 281 |
+
|
| 282 |
+
# Pre-allocate CUDA memory for stable performance
|
| 283 |
+
torch.cuda.set_per_process_memory_fraction(0.9)
|
| 284 |
```
|
| 285 |
|
| 286 |
### Quality vs Speed Trade-offs
|
| 287 |
+
|
| 288 |
+
| Mode | Precision | Batch Size | VRAM Usage | Speed | Quality |
|
| 289 |
+
|------|-----------|------------|------------|-------|---------|
|
| 290 |
+
| **High Quality** | FP32 | 8-16 frames | ~8-12 GB | Slow | Best |
|
| 291 |
+
| **Balanced** | FP16 | 4-8 frames | ~4-6 GB | Good | Excellent |
|
| 292 |
+
| **Fast Inference** | FP16 | 1-2 frames | ~2-3 GB | Fast | Very Good |
|
| 293 |
+
| **Ultra Fast** | BF16 | 1 frame | ~1.5-2 GB | Very Fast | Good |
|
| 294 |
|
| 295 |
### Best Practices
|
| 296 |
+
|
| 297 |
- Always use safetensors format for security and compatibility
|
| 298 |
+
- Monitor VRAM usage with `torch.cuda.memory_allocated()` and `torch.cuda.max_memory_allocated()`
|
| 299 |
- Clear cache between large operations: `torch.cuda.empty_cache()`
|
| 300 |
- Use mixed precision training if fine-tuning the VAE
|
| 301 |
- Validate reconstruction quality with perceptual metrics (LPIPS, SSIM, PSNR)
|
| 302 |
- Consider using video-specific quality metrics (VMAF, VQM)
|
| 303 |
+
- Profile code with PyTorch profiler to identify bottlenecks
|
| 304 |
+
- Use `torch.no_grad()` context for all inference operations
|
| 305 |
|
| 306 |
## Getting Started
|
| 307 |
|
|
|
|
| 309 |
|
| 310 |
When WAN 2.5 VAE becomes available, download from Hugging Face:
|
| 311 |
|
| 312 |
+
**Method 1: Using huggingface_hub (Recommended)**
|
| 313 |
+
|
| 314 |
+
```python
|
| 315 |
from huggingface_hub import snapshot_download
|
| 316 |
|
| 317 |
snapshot_download(
|
| 318 |
+
repo_id="Wan-AI/Wan2.5-VAE", # Check official repo name when available
|
| 319 |
+
local_dir=r"E:\huggingface\wan25-vae\vae\wan",
|
| 320 |
+
allow_patterns=["*.safetensors", "*.json"],
|
| 321 |
+
local_dir_use_symlinks=False # Direct copy for Windows
|
| 322 |
)
|
| 323 |
```
|
| 324 |
|
| 325 |
+
**Method 2: Using git-lfs**
|
| 326 |
|
| 327 |
```bash
|
| 328 |
+
cd E:\huggingface\wan25-vae\vae\wan
|
| 329 |
git lfs install
|
| 330 |
git clone https://huggingface.co/Wan-AI/Wan2.5-VAE .
|
| 331 |
```
|
| 332 |
|
| 333 |
+
**Method 3: Manual Download**
|
| 334 |
+
|
| 335 |
+
Visit the Hugging Face repository in your browser and download:
|
| 336 |
+
- `diffusion_pytorch_model.safetensors` (~1.5-2.0 GB)
|
| 337 |
+
- `config.json` (~1-5 KB)
|
| 338 |
+
|
| 339 |
+
Place files in: `E:\huggingface\wan25-vae\vae\wan\`
|
| 340 |
+
|
| 341 |
### Step 2: Install Dependencies
|
| 342 |
|
| 343 |
```bash
|
| 344 |
+
# Install PyTorch with CUDA support (Windows/Linux)
|
| 345 |
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
|
| 346 |
+
|
| 347 |
+
# Install required libraries
|
| 348 |
+
pip install diffusers transformers accelerate safetensors
|
| 349 |
+
|
| 350 |
+
# Optional: Install xFormers for memory-efficient attention
|
| 351 |
+
pip install xformers
|
| 352 |
+
|
| 353 |
+
# Optional: Install for better performance
|
| 354 |
+
pip install triton
|
| 355 |
```
|
| 356 |
|
| 357 |
### Step 3: Verify Installation
|
|
|
|
| 359 |
```python
|
| 360 |
import torch
|
| 361 |
from diffusers import AutoencoderKL
|
| 362 |
+
import os
|
| 363 |
|
| 364 |
# Check if model files exist
|
|
|
|
| 365 |
vae_path = r"E:\huggingface\wan25-vae\vae\wan"
|
| 366 |
+
config_path = os.path.join(vae_path, "config.json")
|
| 367 |
+
model_path = os.path.join(vae_path, "diffusion_pytorch_model.safetensors")
|
| 368 |
+
|
| 369 |
+
if os.path.exists(config_path):
|
| 370 |
+
print("✓ WAN25 VAE config found")
|
| 371 |
+
|
| 372 |
+
if os.path.exists(model_path):
|
| 373 |
+
print("✓ WAN25 VAE model weights found")
|
| 374 |
+
vae = AutoencoderKL.from_pretrained(vae_path, torch_dtype=torch.float16)
|
| 375 |
+
param_count = sum(p.numel() for p in vae.parameters()) / 1e6
|
| 376 |
+
print(f"✓ Model loaded successfully with {param_count:.1f}M parameters")
|
| 377 |
+
|
| 378 |
+
# Check GPU availability
|
| 379 |
+
if torch.cuda.is_available():
|
| 380 |
+
print(f"✓ CUDA available: {torch.cuda.get_device_name(0)}")
|
| 381 |
+
print(f"✓ CUDA version: {torch.version.cuda}")
|
| 382 |
+
print(f"✓ Available VRAM: {torch.cuda.get_device_properties(0).total_memory / 1e9:.1f} GB")
|
| 383 |
+
else:
|
| 384 |
+
print("⚠ CUDA not available - CPU inference will be slow")
|
| 385 |
+
else:
|
| 386 |
+
print("✗ Model weights not found. Please download the safetensors file.")
|
| 387 |
else:
|
| 388 |
print("✗ WAN25 VAE model not found. Please download first.")
|
| 389 |
```
|
|
|
|
| 401 |
- https://huggingface.co/Wan-AI
|
| 402 |
- https://wan.video/
|
| 403 |
|
| 404 |
+
**Important**: Always verify the specific license terms for WAN 2.5 VAE when it becomes available, as terms may differ from previous versions.
|
| 405 |
+
|
| 406 |
## Citation
|
| 407 |
|
| 408 |
If you use this VAE in your research or projects, please cite:
|
|
|
|
| 436 |
- **Hugging Face Organization**: [https://huggingface.co/Wan-AI](https://huggingface.co/Wan-AI)
|
| 437 |
- **GitHub Repository**: [https://github.com/Wan-Video](https://github.com/Wan-Video)
|
| 438 |
- **Diffusers Documentation**: [https://huggingface.co/docs/diffusers](https://huggingface.co/docs/diffusers)
|
| 439 |
+
- **Model Hub**: [https://huggingface.co/models?pipeline_tag=text-to-video](https://huggingface.co/models?pipeline_tag=text-to-video)
|
| 440 |
|
| 441 |
### Related WAN Models (Local Repository)
|
| 442 |
- **WAN 2.1 VAE**: `E:\huggingface\wan21-vae\` - Previous generation VAE
|
|
|
|
| 449 |
- **WAN Community**: Discussions and examples for WAN video generation
|
| 450 |
- **Video Generation Papers**: Research on video diffusion and VAE architectures
|
| 451 |
- **Optimization Guides**: Tips for efficient video processing with VAEs
|
| 452 |
+
- **ArXiv Paper**: [Wan: Open and Advanced Large-Scale Video Generative Models](https://arxiv.org/search/?query=wan+video+generation)
|
| 453 |
|
| 454 |
### Compatibility
|
| 455 |
- **Required Libraries**: `torch>=2.0.0`, `diffusers>=0.21.0`, `transformers>=4.30.0`
|
|
|
|
| 461 |
|
| 462 |
For technical issues, questions, or contributions:
|
| 463 |
|
| 464 |
+
1. **Model Issues**: Report to WAN-AI Hugging Face repository issues page
|
| 465 |
+
2. **Integration Questions**: Consult Diffusers documentation and community forums
|
| 466 |
+
3. **Performance Optimization**: Check PyTorch performance tuning guides and profiling tools
|
| 467 |
+
4. **Local Setup**: Verify CUDA installation, GPU compatibility, and driver versions
|
| 468 |
+
5. **Community Support**: WAN Discord/Forum (check official website for links)
|
| 469 |
|
| 470 |
## Troubleshooting
|
| 471 |
|
|
|
|
| 473 |
|
| 474 |
**Model Not Found Error:**
|
| 475 |
```python
|
| 476 |
+
# Verify model files are downloaded to correct path
|
| 477 |
# Expected location: E:\huggingface\wan25-vae\vae\wan\
|
| 478 |
+
# Required files: config.json, diffusion_pytorch_model.safetensors
|
| 479 |
+
|
| 480 |
+
import os
|
| 481 |
+
vae_path = r"E:\huggingface\wan25-vae\vae\wan"
|
| 482 |
+
print("Config exists:", os.path.exists(os.path.join(vae_path, "config.json")))
|
| 483 |
+
print("Model exists:", os.path.exists(os.path.join(vae_path, "diffusion_pytorch_model.safetensors")))
|
| 484 |
```
|
| 485 |
|
| 486 |
**VRAM Out of Memory:**
|
| 487 |
```python
|
| 488 |
+
# Reduce batch size to 1-2 frames
|
| 489 |
+
# Enable model CPU offloading
|
| 490 |
vae.enable_model_cpu_offload()
|
| 491 |
+
|
| 492 |
+
# Use FP16 precision (50% VRAM reduction)
|
| 493 |
vae = vae.half()
|
| 494 |
+
|
| 495 |
+
# Process in smaller chunks
|
| 496 |
+
chunk_size = 2 # Reduce if still OOM
|
| 497 |
+
|
| 498 |
+
# Clear CUDA cache before processing
|
| 499 |
+
torch.cuda.empty_cache()
|
| 500 |
```
|
| 501 |
|
| 502 |
**Slow Inference Speed:**
|
| 503 |
```python
|
| 504 |
# Enable xFormers and model compilation
|
| 505 |
vae.enable_xformers_memory_efficient_attention()
|
| 506 |
+
vae = torch.compile(vae, mode="reduce-overhead")
|
| 507 |
+
|
| 508 |
+
# Enable TF32 (Ampere+ GPUs)
|
| 509 |
+
torch.backends.cuda.matmul.allow_tf32 = True
|
| 510 |
+
|
| 511 |
+
# Verify GPU utilization with nvidia-smi
|
| 512 |
+
```
|
| 513 |
+
|
| 514 |
+
**Import Errors:**
|
| 515 |
+
```bash
|
| 516 |
+
# Verify installations
|
| 517 |
+
pip list | grep torch
|
| 518 |
+
pip list | grep diffusers
|
| 519 |
+
|
| 520 |
+
# Reinstall if needed
|
| 521 |
+
pip install --upgrade torch torchvision diffusers transformers
|
| 522 |
+
```
|
| 523 |
+
|
| 524 |
+
**Poor Quality Reconstructions:**
|
| 525 |
+
```python
|
| 526 |
+
# Use higher precision (FP32 instead of FP16)
|
| 527 |
+
vae = vae.float()
|
| 528 |
+
|
| 529 |
+
# Verify scaling factor is applied correctly
|
| 530 |
+
latents = latents * vae.config.scaling_factor # When encoding
|
| 531 |
+
decoded = vae.decode(latents / vae.config.scaling_factor) # When decoding
|
| 532 |
+
|
| 533 |
+
# Check input normalization (should be [-1, 1] range)
|
| 534 |
```
|
| 535 |
|
| 536 |
---
|
| 537 |
|
| 538 |
+
**Version**: v1.2
|
| 539 |
+
**Last Updated**: 2025-10-14
|
| 540 |
**Model Format**: SafeTensors (when available)
|
| 541 |
**Repository Status**: Placeholder - Awaiting model download
|
| 542 |
**Expected Model Size**: ~1.5-2.0 GB
|
| 543 |
+
**Current Size**: ~18 KB (metadata only)
|
| 544 |
|
| 545 |
## Changelog
|
| 546 |
|
| 547 |
+
### v1.2 (Updated Documentation - 2025-10-14)
|
| 548 |
+
- Updated README version to v1.2 with comprehensive improvements
|
| 549 |
+
- Added actual directory structure analysis (18 KB placeholder repository)
|
| 550 |
+
- Enhanced hardware requirements with detailed specifications
|
| 551 |
+
- Expanded usage examples with Windows absolute path examples
|
| 552 |
+
- Added detailed model specifications table
|
| 553 |
+
- Improved performance optimization section with comparison table
|
| 554 |
+
- Enhanced troubleshooting section with specific solutions
|
| 555 |
+
- Added verification script with detailed system checks
|
| 556 |
+
- Updated repository contents section with current file listing
|
| 557 |
+
- Improved installation instructions with multiple download methods
|
| 558 |
+
- Added quality vs speed trade-offs comparison table
|
| 559 |
+
- Enhanced best practices with profiling and monitoring recommendations
|
| 560 |
+
|
| 561 |
+
### v1.1 (Initial Documentation - 2025-10-13)
|
| 562 |
- Initial placeholder documentation for WAN25-VAE repository
|
| 563 |
- Comprehensive usage examples based on WAN 2.1/2.2 patterns
|
| 564 |
- Hardware requirements and optimization guidelines
|
|
|
|
| 573 |
- Add benchmark results and performance comparisons
|
| 574 |
- Include official usage examples from WAN team
|
| 575 |
- Document any audio-visual integration features
|
| 576 |
+
- Add example outputs and quality comparisons with previous VAE versions
|