Spaces:
Build error
Build error
π Quick Setup: Hugging Face Token Configuration
β±οΈ Time Required: 5 minutes
π― Goal: Configure your .env file with Hugging Face token for AI model access
π¬ TL;DR - Fastest Setup
# Run this ONE command:
python scripts/setup_env.py
Then follow the prompts! β¨
π Step-by-Step Guide
Step 1: Get Your Hugging Face Token (2 minutes)
- Go to: https://huggingface.co/settings/tokens
- Click: "New token"
- Name it: "AudioForge"
- Permission: Select "Read" (sufficient)
- Click: "Generate token"
- Copy: Your token (starts with
hf_...)
β οΈ Important: Save this token somewhere safe! You won't see it again.
Step 2: Run Setup Script (3 minutes)
Windows:
cd C:\Users\Keith\AudioForge
scripts\setup_env.bat
Linux/Mac:
cd /path/to/AudioForge
python scripts/setup_env.py
What it asks:
- β Hugging Face token (paste the token you copied)
- β Environment type (press Enter for "development")
- β Device (press Enter for "cpu" or type "cuda" if you have GPU)
- β Done! Everything else is auto-configured
Step 3: Verify Setup
cd backend
python -c "from app.core.config import settings; print('β
Token configured!')"
If you see β
Token configured!, you're good to go!
π― What Gets Configured
Your .env file will contain:
# β
Hugging Face Token (for model downloads)
HUGGINGFACE_TOKEN=hf_your_token_here
HF_TOKEN=hf_your_token_here
# β
Device Configuration
MUSICGEN_DEVICE=cpu # or cuda for GPU
BARK_DEVICE=cpu
DEMUCS_DEVICE=cpu
# β
Database & Redis
DATABASE_URL=postgresql+asyncpg://postgres:postgres@localhost:5432/audioforge
REDIS_URL=redis://localhost:6379/0
# β
Security
SECRET_KEY=auto-generated-secure-key
# β
CORS
ALLOWED_ORIGINS=http://localhost:3000
π Next Steps After Setup
# 1. Install backend dependencies
cd backend
pip install -e ".[dev]"
# 2. Initialize database
python scripts/init_db.py
# 3. Start backend
uvicorn app.main:app --reload
# 4. In another terminal, start frontend
cd frontend
pnpm install
pnpm dev
Access:
- Frontend: http://localhost:3000
- Backend: http://localhost:8000
- API Docs: http://localhost:8000/docs
π‘ Pro Tips
π Use GPU for 10-50x Faster Generation
If you have NVIDIA GPU:
# Check if CUDA is available
python -c "import torch; print(torch.cuda.is_available())"
# If True, edit .env:
MUSICGEN_DEVICE=cuda
BARK_DEVICE=cuda
DEMUCS_DEVICE=cuda
π¦ Model Download Info
Models download automatically on first use:
- MusicGen: ~1.5GB (takes 2-5 minutes)
- Bark: ~2GB (takes 3-7 minutes)
- Demucs: ~300MB (takes 1-2 minutes)
Total: ~4GB, one-time download
π Security
Your .env file is:
- β
Already in
.gitignore(won't be committed) - β Local to your machine only
- β Contains sensitive credentials (keep it safe!)
π Troubleshooting
"Token not found" Error
Solution: Make sure .env file exists
# Check if file exists
ls backend/.env
# If not, run setup again
python scripts/setup_env.py
"401 Unauthorized" When Downloading Models
Solution: Token might be invalid
# Test your token
curl -H "Authorization: Bearer YOUR_TOKEN" https://huggingface.co/api/whoami
If it fails, generate a new token at https://huggingface.co/settings/tokens
Models Won't Download
Solutions:
- Check internet connection
- Verify token in
.envfile - Try manual download:
cd backend python -c "from transformers import AutoProcessor; AutoProcessor.from_pretrained('facebook/musicgen-small')"
Out of Memory
Solutions:
- Close other applications
- Use smaller models (already default)
- Increase system RAM/swap
π Additional Documentation
- Full Setup Guide: SETUP.md
- Detailed HF Guide: HUGGINGFACE_SETUP.md
- Launch Guide: LAUNCH_GUIDE.md
- Troubleshooting: SETUP.md#troubleshooting
β Checklist
Before starting the application, ensure:
- Hugging Face token obtained
-
.envfile created (viasetup_env.py) - Token added to
.env - Backend dependencies installed
- Database initialized
- PostgreSQL running
- Redis running (or Docker Compose)
π You're Ready!
Once setup is complete, you can:
- β Generate music from text
- β Add vocals with lyrics
- β Apply mastering effects
- β Download your creations
πΌβ‘ Happy music generation!
π Need Help?
- Run verification:
python backend/scripts/verify_setup.py - Check logs:
tail -f backend/logs/app.log - Review docs: All
.mdfiles in project root - Test API: Visit http://localhost:8000/docs after starting backend
Last Updated: January 16, 2026
Forged By: FusionPanda πΌβ‘