Sign inSign up

camilbradea/sam-audio-worker

By camilbradea

•Updated about 15 hours ago

GPU worker for Meta's SAM-Audio model. Text-prompted audio source separation on RunPod.

Image
Machine learning & AI
0

3.7K

camilbradea/sam-audio-worker repository overview

⁠SAM-Audio GPU Worker

RunPod-ready container for Meta's SAM-Audio⁠ audio separation model.

⁠Contents
  • Base: nvidia/cuda:12.4.1-cudnn-devel-ubuntu22.04
  • Python 3.11 with PyTorch, torchaudio, xformers
  • SAM-Audio + dependencies (CLAP, ImageBind, DAC-VAE, perception-models)
  • FastAPI handler on port 8000
  • SSH server (optional, for debugging)
⁠Optimizations

Uses a "lite" mode (inspired by AudioGhostAI⁠) that strips unused video components to reduce VRAM:

  • Removed vision_encoder (~2GB saved)
  • Removed visual_ranker (~2GB saved)
  • Removed text_ranker (~2GB saved)

Audio-only processing - video input not supported.

⁠Authentication

All endpoints require X-API-Key header.

⁠API Endpoints
⁠POST /process

Start an audio separation job.

Request:

{
  "job_id": "uuid-string",
  "user_id": "user-identifier",
  "prompt": "drums",
  "original_filename": "song.wav",
  "use_float32": true,
  "timeout_seconds": 43200
}

Response:

{
  "status": "processing",
  "job_id": "uuid-string"
}
⁠GET /status/{job_id}

Poll job progress.

Response:

{
  "job_id": "uuid-string",
  "status": "processing|completed|failed",
  "output_key": "user-id/outputs/song_drums_residual.wav",
  "error": null,
  "chunks_processed": 3,
  "total_chunks": 10,
  "last_progress_ts": 1708012345.123
}
⁠GET /health

Response:

{
  "status": "ok",
  "model_loaded": true,
  "active_jobs": 1
}
⁠GET /startup-status

Response:

{
  "state": "starting|loading_model|ready|error",
  "error": null
}
⁠Requirements
  • NVIDIA GPU with CUDA 12.4+ support
  • ~32GB VRAM recommended
⁠Environment Variables
VariableRequiredDescription
R2_ACCOUNT_IDYesCloudflare account ID
R2_ACCESS_KEYYesR2 access key
R2_SECRET_KEYYesR2 secret key
R2_BUCKETYesR2 bucket name
API_KEYYesAPI authentication key
HF_TOKENYesHuggingFace token for model download
SSH_PUBLIC_KEYOptionalSSH access for debugging (recommended for remote deployments)
⁠Usage
docker run --gpus all -p 8000:8000 \
  -e R2_ACCOUNT_ID=xxx \
  -e R2_ACCESS_KEY=xxx \
  -e R2_SECRET_KEY=xxx \
  -e R2_BUCKET=xxx \
  -e API_KEY=xxx \
  -e HF_TOKEN=xxx \
  bradeac/sam-audio-worker:latest

Tag summary

Content type

Image

Digest

sha256:c85a4a3a2…

Size

7.5 GB

Last updated

about 15 hours ago

docker pull camilbradea/sam-audio-worker:v1.0.19-10s