File size: 2,642 Bytes
06e50fb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""
Configuration for Wan2.2-TI2V-5B Video Generator
"""

# Model Configuration
MODEL_CONFIG = {
    "model_id": "Wan-AI/Wan2.1-T2V-14B-Diffusers",
    "revision": "main",
    "torch_dtype": "bfloat16",
    "use_safetensors": True,
}

# Default Generation Parameters
DEFAULT_PARAMS = {
    "height": 480,
    "width": 848,
    "num_frames": 25,
    "guidance_scale": 5.0,
    "num_inference_steps": 20,
    "fps": 16,
}

# LoRA Configuration
LORA_CONFIG = {
    "default_scale": 0.8,
    "max_scale": 1.0,
    "cache_dir": "/tmp/lora_cache",
}

# Memory Optimization
MEMORY_CONFIG = {
    "enable_cpu_offload": True,
    "enable_attention_slicing": True,
    "enable_vae_slicing": True,
    "max_memory_reserved_gb": 24,
}

# Available LoRAs with their configurations
AVAILABLE_LORAS = {
    "wan-fast-lora": {
        "repo": "Kijai/Wan2.1-fp8-diffusers",
        "filename": "wan2.1_fast_lora.safetensors",
        "description": "Optimized for 2-3x faster generation",
        "trigger_words": [],
        "recommended_scale": 0.8,
        "speed_factor": 2.5,
    },
    "wan-quality-lora": {
        "repo": "Kijai/Wan2.1-fp8-diffusers",
        "filename": "wan2.1_quality_lora.safetensors",
        "description": "Enhanced visual quality",
        "trigger_words": ["high quality", "detailed", "4K"],
        "recommended_scale": 0.7,
        "speed_factor": 1.0,
    },
    "wan-motion-lora": {
        "repo": "Kijai/Wan2.1-fp8-diffusers",
        "filename": "wan2.1_motion_lora.safetensors",
        "description": "Better motion dynamics",
        "trigger_words": ["smooth motion", "dynamic", "flowing"],
        "recommended_scale": 0.75,
        "speed_factor": 1.0,
    },
}

# UI Configuration
UI_CONFIG = {
    "title": "Wan2.2-TI2V-5B Video Generator",
    "description": "Generate stunning videos from text or image prompts with LoRA acceleration",
    "theme": {
        "primary_hue": "indigo",
        "secondary_hue": "purple",
        "neutral_hue": "slate",
    },
    "max_prompt_length": 500,
    "example_prompts": [
        "A majestic dragon flying through clouds at sunset, cinematic lighting, 4K quality",
        "A serene ocean wave crashing on a beach, slow motion, golden hour",
        "A futuristic city with flying cars and neon lights, cyberpunk style",
        "A cat playing with a ball of yarn, cute, fluffy, soft lighting",
        "Time-lapse of flowers blooming in a garden, vibrant colors",
    ],
}

# API Configuration
API_CONFIG = {
    "max_concurrent_requests": 3,
    "request_timeout_seconds": 600,
    "max_video_duration_frames": 81,
    "supported_output_formats": ["mp4", "webm"],
}