MusicGen Unified - v2.0
A clean, focused implementation of Facebook's MusicGen for instrumental music generation.
What This Is
- Simple: Just music generation, no unnecessary complexity
- Fast: GPU-optimized for 10x realtime generation
- Practical: CLI, API, and web interface included
- Deployable: One-click AWS deployment
What This Isn't
- Not for vocal/singing generation (MusicGen doesn't support it)
- Not a microservices architecture (it's a simple tool)
- Not a research framework (it's for practical use)
Quick Start
# Install
pip install musicgen-unified
# Generate music
musicgen generate "upbeat jazz piano" --duration 30
# Start web interface
musicgen serve
# Start API
musicgen api
Features
- ✅ Text-to-music generation
- ✅ Extended generation (>30 seconds)
- ✅ Batch processing from CSV
- ✅ GPU acceleration
- ✅ Web interface
- ✅ REST API
- ✅ AWS deployment ready
Installation
# Basic installation
pip install musicgen-unified
# With GPU support
pip install musicgen-unified[gpu]
# Development
git clone https://github.com/yourusername/musicgen-unified
cd musicgen-unified
pip install -e ".[dev]"
Usage
Command Line
# Basic generation
musicgen generate "smooth jazz saxophone" -o jazz.mp3
# Extended generation
musicgen generate "epic orchestral" --duration 120 -o epic.mp3
# Batch processing
musicgen batch playlist.csv --output-dir music/
Python API
from musicgen import MusicGenerator
# Initialize
generator = MusicGenerator(device="cuda")
# Generate music
audio, sample_rate = generator.generate(
"ambient electronic",
duration=30.0
)
# Save
generator.save_audio(audio, sample_rate, "output.mp3")
Web Interface
musicgen serve --port 8080
# Open http://localhost:8080
REST API
musicgen api --port 8000
# Generate music
curl -X POST http://localhost:8000/generate \
-H "Content-Type: application/json" \
-d '{"prompt": "classical piano", "duration": 30}'
Deployment
Docker
docker build -t musicgen .
docker run -p 8080:8080 --gpus all musicgen
AWS
# Configure AWS credentials
aws configure
# Deploy
./deployment/deploy_aws.sh
Architecture
musicgen-unified/
├── musicgen/
│ ├── generator.py # Core generation with GPU optimization
│ ├── batch.py # Batch processing
│ ├── prompt.py # Prompt engineering
│ ├── api.py # FastAPI server
│ ├── cli.py # CLI interface
│ └── utils.py # Utilities
├── static/ # Web UI files
├── tests/ # Test suite
└── deployment/ # Deployment scripts
Performance
- GPU: 10x faster than realtime
- CPU: 1x realtime (approximate)
- Memory: <1GB base, ~4GB with large model
- Startup: <10 seconds
Models
small: Fast, lower quality (300M parameters)medium: Balanced (1.5B parameters)large: Best quality (3.3B parameters)
Contributing
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
License
MIT License - see LICENSE file for details.
Acknowledgments
- Facebook Research for MusicGen
- The open source community
Support
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: support@example.com
Metadata
Release files for musicgen-unified 2.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| musicgen_unified-2.0.1.tar.gz | 32.1 kB | Without provenance | Details for musicgen_unified-2.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| musicgen_unified-2.0.1-py3-none-any.whl | Python 3 | none | any | Details for musicgen_unified-2.0.1-py3-none-any.whl |
Total release size: 60.7 kB
Release files / musicgen_unified-2.0.1.tar.gz
| Download URL | musicgen_unified-2.0.1.tar.gz |
|---|---|
| Size | 32.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e520d838a519031689f2d68a53899b5dd009ac32a7bf3cf29902c85da74dd90c
|
|
BLAKE2b-256 checksum How to use checksums |
f4be9198dc4b7f15eb65c1eb7a6b7bee46ee17c4a2d4c1649e3f5061b1fbe7d5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.13
|
Release files / musicgen_unified-2.0.1-py3-none-any.whl
| Download URL | musicgen_unified-2.0.1-py3-none-any.whl |
|---|---|
| Size | 28.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7d8617d406e7dc22265e8acb46dffbef619160a8afe481acfb82d13a7658cd36
|
|
BLAKE2b-256 checksum How to use checksums |
842aa5d13416d5fc86ca4ccf1ed2dc6c2824f6ed557efa0d3a12101a870b3198
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.13
|
Security for musicgen-unified 2.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.