jblast94's picture
Upload 6 files
2149543 verified
#!/bin/bash
# WAN 2.2 Character Generator with Lightning LoRA - ZeroGPU Deployment Script
# This script helps deploy the space to Hugging Face Spaces with ZeroGPU
echo "🎨 WAN 2.2 Character Generator with Lightning LoRA - ZeroGPU Deployment Helper"
echo "==============================================================================="
# Check if git is available
if ! command -v git &> /dev/null; then
echo "❌ Git is not installed. Please install git first."
exit 1
fi
# Check if huggingface_hub is available
if ! python -c "import huggingface_hub" &> /dev/null; then
echo "❌ huggingface_hub is not installed. Installing..."
pip install huggingface_hub
fi
echo "πŸ“‹ Pre-deployment checklist:"
echo "βœ… app.py - Main application file with @spaces.GPU decorators"
echo "βœ… requirements.txt - Dependencies including 'spaces' package"
echo "βœ… README.md - Documentation with ZeroGPU configuration"
echo "βœ… .gitignore - Git ignore rules"
echo "βœ… config.json - Space metadata"
echo ""
echo "πŸš€ ZeroGPU Deployment Instructions:"
echo "1. Create a new Space on Hugging Face Hub:"
echo " - Go to https://huggingface.co/new-space"
echo " - Choose 'Gradio' as SDK"
echo " - Select 'ZeroGPU' as hardware (requires PRO subscription)"
echo " - Note: Personal accounts can have max 10 ZeroGPU spaces"
echo ""
echo "2. Clone your space repository:"
echo " git clone https://huggingface.co/spaces/YOUR_USERNAME/YOUR_SPACE_NAME"
echo ""
echo "3. Copy files to your space directory:"
echo " cp app.py requirements.txt README.md .gitignore config.json YOUR_SPACE_DIR/"
echo ""
echo "4. Commit and push:"
echo " cd YOUR_SPACE_DIR"
echo " git add ."
echo " git commit -m 'Initial deployment of WAN 2.2 Character Generator with Lightning LoRA on ZeroGPU'"
echo " git push"
echo ""
echo "5. Your space will be available at:"
echo " https://huggingface.co/spaces/YOUR_USERNAME/YOUR_SPACE_NAME"
echo ""
echo "πŸ”§ ZeroGPU Configuration Notes:"
echo "- Hardware: ZeroGPU with NVIDIA H200 GPUs (70GB VRAM per workload)"
echo "- Dynamic GPU allocation: GPUs allocated only during inference"
echo "- Duration management: Intelligent calculation based on parameters"
echo "- Memory optimization: Automatic cleanup and efficient loading"
echo "- Requires PRO subscription for personal accounts"
echo ""
echo "⚑ Performance Optimizations:"
echo "- @spaces.GPU decorators on all GPU-dependent functions"
echo "- Lazy model loading (models loaded only when GPU allocated)"
echo "- Dynamic duration calculation (30-120 seconds based on parameters)"
echo "- Memory efficient attention and VAE slicing enabled"
echo "- Automatic GPU memory cleanup after each generation"
echo ""
echo "πŸ“š Integration with Eliza Character Generator:"
echo "- Use the API endpoints for programmatic access"
echo "- Base URL: https://YOUR_USERNAME-YOUR_SPACE_NAME.hf.space"
echo "- Text-to-Video: POST /api/text-to-image (supports both image and video generation)"
echo "- Image-to-Video: POST /api/image-to-image (supports both image and video generation)"
echo "- GPU allocation is handled automatically"
echo ""
echo "🎯 ZeroGPU Best Practices:"
echo "- Shorter durations improve queue priority"
echo "- PRO users get 5x more daily usage quota"
echo "- Use appropriate image sizes for your needs"
echo "- Batch similar requests when possible"
echo "- Monitor usage to stay within quotas"
echo ""
echo "⚠️ Requirements:"
echo "- Gradio 4.0+ (required for ZeroGPU compatibility)"
echo "- PyTorch 2.1.0+ (most versions supported)"
echo "- Python 3.10.13"
echo "- 'spaces' package in requirements.txt"
echo "- PRO subscription for ZeroGPU access"
echo ""
echo "πŸ”— Useful Links:"
echo "- ZeroGPU Documentation: https://huggingface.co/docs/hub/spaces-zerogpu"
echo "- Feedback: https://huggingface.co/spaces/zero-gpu-explorers/README/discussions"
echo "- Curated ZeroGPU Spaces: https://huggingface.co/spaces?hardware=zero"
echo ""
echo "✨ ZeroGPU deployment ready! Your space will have dynamic GPU allocation."