Spaces:
Running
Running
Update config.py from anycoder
Browse files
config.py
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Configuration for Wan2.2-TI2V-5B Video Generator
|
| 3 |
+
"""
|
| 4 |
+
|
| 5 |
+
# Model Configuration
|
| 6 |
+
MODEL_CONFIG = {
|
| 7 |
+
"model_id": "Wan-AI/Wan2.1-T2V-14B-Diffusers",
|
| 8 |
+
"revision": "main",
|
| 9 |
+
"torch_dtype": "bfloat16",
|
| 10 |
+
"use_safetensors": True,
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
# Default Generation Parameters
|
| 14 |
+
DEFAULT_PARAMS = {
|
| 15 |
+
"height": 480,
|
| 16 |
+
"width": 848,
|
| 17 |
+
"num_frames": 25,
|
| 18 |
+
"guidance_scale": 5.0,
|
| 19 |
+
"num_inference_steps": 20,
|
| 20 |
+
"fps": 16,
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
# LoRA Configuration
|
| 24 |
+
LORA_CONFIG = {
|
| 25 |
+
"default_scale": 0.8,
|
| 26 |
+
"max_scale": 1.0,
|
| 27 |
+
"cache_dir": "/tmp/lora_cache",
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
# Memory Optimization
|
| 31 |
+
MEMORY_CONFIG = {
|
| 32 |
+
"enable_cpu_offload": True,
|
| 33 |
+
"enable_attention_slicing": True,
|
| 34 |
+
"enable_vae_slicing": True,
|
| 35 |
+
"max_memory_reserved_gb": 24,
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
# Available LoRAs with their configurations
|
| 39 |
+
AVAILABLE_LORAS = {
|
| 40 |
+
"wan-fast-lora": {
|
| 41 |
+
"repo": "Kijai/Wan2.1-fp8-diffusers",
|
| 42 |
+
"filename": "wan2.1_fast_lora.safetensors",
|
| 43 |
+
"description": "Optimized for 2-3x faster generation",
|
| 44 |
+
"trigger_words": [],
|
| 45 |
+
"recommended_scale": 0.8,
|
| 46 |
+
"speed_factor": 2.5,
|
| 47 |
+
},
|
| 48 |
+
"wan-quality-lora": {
|
| 49 |
+
"repo": "Kijai/Wan2.1-fp8-diffusers",
|
| 50 |
+
"filename": "wan2.1_quality_lora.safetensors",
|
| 51 |
+
"description": "Enhanced visual quality",
|
| 52 |
+
"trigger_words": ["high quality", "detailed", "4K"],
|
| 53 |
+
"recommended_scale": 0.7,
|
| 54 |
+
"speed_factor": 1.0,
|
| 55 |
+
},
|
| 56 |
+
"wan-motion-lora": {
|
| 57 |
+
"repo": "Kijai/Wan2.1-fp8-diffusers",
|
| 58 |
+
"filename": "wan2.1_motion_lora.safetensors",
|
| 59 |
+
"description": "Better motion dynamics",
|
| 60 |
+
"trigger_words": ["smooth motion", "dynamic", "flowing"],
|
| 61 |
+
"recommended_scale": 0.75,
|
| 62 |
+
"speed_factor": 1.0,
|
| 63 |
+
},
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
# UI Configuration
|
| 67 |
+
UI_CONFIG = {
|
| 68 |
+
"title": "Wan2.2-TI2V-5B Video Generator",
|
| 69 |
+
"description": "Generate stunning videos from text or image prompts with LoRA acceleration",
|
| 70 |
+
"theme": {
|
| 71 |
+
"primary_hue": "indigo",
|
| 72 |
+
"secondary_hue": "purple",
|
| 73 |
+
"neutral_hue": "slate",
|
| 74 |
+
},
|
| 75 |
+
"max_prompt_length": 500,
|
| 76 |
+
"example_prompts": [
|
| 77 |
+
"A majestic dragon flying through clouds at sunset, cinematic lighting, 4K quality",
|
| 78 |
+
"A serene ocean wave crashing on a beach, slow motion, golden hour",
|
| 79 |
+
"A futuristic city with flying cars and neon lights, cyberpunk style",
|
| 80 |
+
"A cat playing with a ball of yarn, cute, fluffy, soft lighting",
|
| 81 |
+
"Time-lapse of flowers blooming in a garden, vibrant colors",
|
| 82 |
+
],
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
# API Configuration
|
| 86 |
+
API_CONFIG = {
|
| 87 |
+
"max_concurrent_requests": 3,
|
| 88 |
+
"request_timeout_seconds": 600,
|
| 89 |
+
"max_video_duration_frames": 81,
|
| 90 |
+
"supported_output_formats": ["mp4", "webm"],
|
| 91 |
+
}
|