Skip to content
QuangClerPublic

About

GenBGM — Dockerized GPU API that generates background music from chat context with MusicGen (Transformers), tuned to run on 4 GB VRAM

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

10 Commits

Folders and files

Repository files navigation

GenBGM (GPU, Py3.9, Transformers)

Run (Docker)

docker compose up --build -d
# health
curl http://localhost:8000/health
# generate
$json = @'
>> {
>>   "data": {
>>     "messages": [
>>       {
>>         "id": "555e4567-e89b-12d3-a456-426614174005",
>>         "body": "Hello everyone!",
>>         "user_id": "111e4567-e89b-12d3-a456-426614174001",
>>         "created_at": "2025-09-28T11:52:10.000Z"
>>       },
>>       {
>>         "id": "666e4567-e89b-12d3-a456-426614174006",
>>         "body": "How are you today?",
>>         "user_id": "222e4567-e89b-12d3-a456-426614174002",
>>         "created_at": "2025-09-28T11:52:10.000Z"
>>       },
>>       {
>>         "id": "777e4567-e89b-12d3-a456-426614174007",
>>         "body": "I love this new song!",
>>         "user_id": "333e4567-e89b-12d3-a456-426614174003",
>>         "created_at": "2025-09-28T11:52:10.000Z"
>>       }
>>     ]
>>   }
>> }
>> '@
 Invoke-RestMethod -Uri http://localhost:8000/generate/from-json -Method POST -ContentType "application/json" -Body $json


#To update main.py while still in the docker space:
docker cp ./app/. genbgm-api-gpu:/app/app/
docker restart genbgm-api-gpu


## Notes
- Python 3.9, CUDA 12.1, Torch 2.1.0 (cu121)
- Tracks saved under `/tracks/musicgen/v1/<window_id>/<seed>.wav` and served via `/tracks/...`
- TOKEN_CAP is set to 2600 by default for 4GB VRAM GPUs (≈50s). Increase at your own risk.

About

GenBGM — Dockerized GPU API that generates background music from chat context with MusicGen (Transformers), tuned to run on 4 GB VRAM

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages