Spaces:
Sleeping
Sleeping
File size: 8,244 Bytes
a602628 | 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 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 | # HuggingFace Spaces Deployment Guide
## Quick Deploy to HuggingFace Spaces
### Prerequisites
- HuggingFace account (create at https://huggingface.co/join)
- Git installed on your machine
- Git LFS installed (for large files)
### Method 1: Web Upload (Easiest)
1. **Create New Space**
- Go to https://huggingface.co/new-space
- Name: `ace-step-custom` (or your choice)
- License: MIT
- SDK: Gradio
- Hardware: A10G Small (or better)
- Click "Create Space"
2. **Upload Files**
- Click "Files and versions" tab
- Click "Add file" → "Upload files"
- Upload all files from `d:\2025-vibe-coding\ACE-Step-Custom\`:
- `app.py`
- `requirements.txt`
- `config.yaml`
- `README.md` (with YAML frontmatter)
- `LICENSE`
- `.gitignore`
- Entire `src/` directory
- Entire `scripts/` directory
- Commit changes
3. **Configure Space**
- Go to "Settings" tab
- Set Python version: 3.10
- Enable GPU: A10G Small (minimum) or A100 (recommended)
- Set timeout: 30 minutes (for long generations)
- Save settings
4. **Wait for Build**
- Space will automatically build and deploy
- First build takes 5-10 minutes
- Model will download on first run (~7GB)
### Method 2: Git Push (For Developers)
1. **Create Space on HuggingFace**
- Go to https://huggingface.co/new-space
- Create space as above
2. **Clone and Push**
```powershell
# Navigate to project
cd d:\2025-vibe-coding\ACE-Step-Custom
# Initialize git (if not already)
git init
git add .
git commit -m "Initial commit"
# Add HuggingFace remote
git remote add hf https://huggingface.co/spaces/YOUR_USERNAME/ace-step-custom
# Push to HuggingFace
git push hf main
```
3. **Configure Git LFS for Large Files**
```powershell
git lfs install
git lfs track "*.wav"
git lfs track "*.pth"
git lfs track "*.bin"
git lfs track "models/**"
git add .gitattributes
git commit -m "Add LFS tracking"
git push hf main
```
### Method 3: HuggingFace CLI (Fastest)
1. **Install HuggingFace CLI**
```powershell
pip install huggingface_hub
```
2. **Login**
```powershell
huggingface-cli login
# Enter your HuggingFace token
```
3. **Create and Upload**
```powershell
cd d:\2025-vibe-coding\ACE-Step-Custom
# Create space
huggingface-cli repo create ace-step-custom --type space --space_sdk gradio
# Upload files
huggingface-cli upload YOUR_USERNAME/ace-step-custom . --repo-type space
```
## Space Configuration
### Hardware Recommendations
| GPU | VRAM | Cost | Performance | Recommended For |
|-----|------|------|-------------|-----------------|
| CPU | - | Free | Very Slow | Testing only |
| T4 Small | 16GB | ~$0.60/hr | Slow | Light testing |
| **A10G Small** | **24GB** | **~$1.05/hr** | **Good** | **Recommended** |
| A10G Large | 24GB | ~$3.15/hr | Good | Production |
| A100 Large | 40GB | ~$4.13/hr | Excellent | Best quality |
**Recommendation:** Start with A10G Small for testing, upgrade to A100 for production.
### Environment Variables (Optional)
In Space settings, you can add:
```
GRADIO_SERVER_NAME=0.0.0.0
GRADIO_SERVER_PORT=7860
HF_HOME=/data/huggingface
TORCH_HOME=/data/torch
```
### Secrets (If Needed)
For API keys or sensitive data:
- Go to Space Settings → Repository secrets
- Add secrets like `HF_TOKEN`, `API_KEY`, etc.
- Access in code: `os.environ.get("SECRET_NAME")`
## Post-Deployment Setup
### First Launch
1. **Wait for Model Download**
- First launch downloads ACE-Step model (~7GB)
- Takes 5-10 minutes depending on connection
- Model cached for subsequent runs
2. **Test Basic Generation**
- Go to Tab 1 (Standard ACE-Step)
- Enter simple prompt: "Happy pop song"
- Set duration to 10 seconds
- Click Generate
3. **Test Timeline**
- Go to Tab 2 (Timeline Workflow)
- Enter prompt and lyrics
- Set context length to 30s
- Generate first clip
4. **Test LoRA Training**
- Go to Tab 3 (LoRA Training)
- Upload 2-3 test audio files
- Run quick training (2-3 epochs)
### Monitoring
**View Logs:**
- Click "Logs" tab in your Space
- Monitor for errors or warnings
- Check GPU usage and memory
**Performance Metrics:**
- Generation time
- Memory usage
- Error rate
- User feedback
### Troubleshooting
**Space Not Building:**
- Check requirements.txt for conflicts
- Verify Python 3.10 compatibility
- Check logs for specific errors
**Out of Memory:**
- Upgrade to larger GPU
- Reduce batch size in LoRA training
- Limit generation duration
**Model Not Loading:**
- Check HuggingFace Hub access
- Verify model ID in config.yaml
- Check internet connectivity
**Slow Performance:**
- Upgrade GPU tier
- Reduce concurrent users
- Optimize generation parameters
## Optimization Tips
### Reduce Startup Time
1. **Cache Models**
```python
# In app.py, add before model loading:
os.environ["HF_HOME"] = "/data/huggingface"
```
2. **Preload on Startup**
- Models download on first run
- Cached for subsequent uses
- Consider pre-downloading to Space
### Improve Response Time
1. **Use Queuing**
- Gradio automatically queues requests
- Set `max_size` in `app.launch()`
2. **Optimize Generation**
- Lower default duration
- Reduce sampling steps
- Use FP16 precision
### Cost Optimization
1. **Auto-Sleep**
- Space sleeps after inactivity
- Wakes on first request
- Configure in Space settings
2. **Usage Limits**
- Set max concurrent users
- Limit generation duration
- Add rate limiting if needed
## Going Live
### Before Public Release
- [ ] Test all three tabs thoroughly
- [ ] Verify LoRA training works
- [ ] Test with different prompts and styles
- [ ] Check error handling
- [ ] Review logs for issues
- [ ] Test on mobile devices
- [ ] Add usage examples
- [ ] Create demo video
### Public Space Settings
1. **Enable Discussions**
- Let users report issues
- Gather feedback
2. **Add Examples**
- Create example prompts
- Show best practices
- Include sample outputs
3. **Update README**
- Clear usage instructions
- Feature highlights
- Limitations and known issues
4. **Pin Space**
- Makes it discoverable
- Shows on your profile
## Maintenance
### Regular Updates
```powershell
# Update code
cd d:\2025-vibe-coding\ACE-Step-Custom
git add .
git commit -m "Update description"
git push hf main
```
### Monitor Usage
- Check Space analytics
- Review user feedback
- Monitor error rates
- Track popular features
### Scaling
**If Space Gets Popular:**
1. Upgrade GPU tier
2. Add request queuing
3. Implement caching
4. Consider duplicate Spaces for load balancing
## Support & Community
### Get Help
- HuggingFace Forums: https://discuss.huggingface.co/
- Discord: https://discord.gg/huggingface
- Docs: https://huggingface.co/docs/hub/spaces
### Share Your Space
- Post on Twitter/X with #HuggingFace #ACEStep
- Share in AI music communities
- Add to your portfolio
- Write blog post about it
## Advanced Configuration
### Custom Domain (Pro)
HuggingFace Pro users can set custom domains:
1. Go to Space settings
2. Add custom domain
3. Configure DNS
### Persistent Storage
For saving user data:
```python
import os
PERSIST_DIR = os.environ.get("SPACE_ID", "local")
# Save to /data/{SPACE_ID}/
```
### Analytics Integration
Add Google Analytics or similar:
```python
# In app.py
analytics_code = """
<script async src="https://www.googletagmanager.com/gtag/js?id=YOUR-ID"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'YOUR-ID');
</script>
"""
```
## Success Checklist
Before announcing your Space:
- ✅ All features working
- ✅ Clear documentation
- ✅ Example outputs included
- ✅ Error handling robust
- ✅ Performance optimized
- ✅ Mobile-friendly UI
- ✅ Clear limitations stated
- ✅ License properly attributed
- ✅ Usage guidelines clear
- ✅ Contact/support info provided
## Your Space URL
After deployment, your Space will be available at:
```
https://huggingface.co/spaces/YOUR_USERNAME/ace-step-custom
```
Share it with the world! 🎵🚀
|