From bc1574b36ee54ff8ae816f36428e74e8efa0c7b8 Mon Sep 17 00:00:00 2001 From: Jeroen Schweitzer Date: Thu, 26 Feb 2026 10:34:34 +0100 Subject: [PATCH] feat(stack): add Stable Audio and TRELLIS GPU service stacks - Stable Audio Open: AI audio generation on port 11500 (~6GB VRAM) - TRELLIS: 3D model generation on port 11510 (~6-8GB VRAM, low-VRAM fork) Co-Authored-By: Claude Opus 4.6 --- stacks/stable-audio.yml | 90 +++++++++++++++++++++++++++++++ stacks/trellis.yml | 116 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 206 insertions(+) create mode 100644 stacks/stable-audio.yml create mode 100644 stacks/trellis.yml diff --git a/stacks/stable-audio.yml b/stacks/stable-audio.yml new file mode 100644 index 0000000..bb946ee --- /dev/null +++ b/stacks/stable-audio.yml @@ -0,0 +1,90 @@ +version: '3.8' + +# Stable Audio Open - AI Audio Generation +# Phase: ML Infrastructure +# Ports: 8000 (Gradio Web UI) +# GPU: YES - Requires NVIDIA Container Toolkit (8GB+ VRAM) +# Storage: SSD recommended for model cache +# Image: Built locally from https://github.com/SaladTechnologies/stable-audio-open + +services: + stable-audio: + image: stable-audio-open:local + container_name: stable-audio + restart: unless-stopped + ports: + - "11500:8000" # Gradio Web UI (internal only) + volumes: + # HuggingFace cache for model weights (~6GB) + - /home/jpmschweitzer/docker-data/stable-audio/hf-cache:/root/.cache/huggingface + environment: + - TZ=Europe/Amsterdam + - NVIDIA_VISIBLE_DEVICES=all + - NVIDIA_DRIVER_CAPABILITIES=compute,utility + - HF_TOKEN=${HF_TOKEN} + healthcheck: + test: ["CMD-SHELL", "curl -fSs http://localhost:8000/ || exit 1"] + interval: 60s + timeout: 30s + retries: 3 + start_period: 300s # Model download + load takes time + deploy: + resources: + limits: + memory: 16G + reservations: + memory: 8G + devices: + - driver: nvidia + count: 1 + capabilities: [gpu] + networks: + - docker-dataplane + +networks: + docker-dataplane: + external: true + name: docker-dataplane + +# GPU Requirements: +# - RTX 2080 Ti (11GB VRAM) - minimum viable, may struggle with long generations +# - Recommended: 16GB+ VRAM for reliable 47s audio generation +# - NVIDIA Container Toolkit must be installed +# +# IMPORTANT: GPU Contention +# - This service shares GPU with Ollama and Jellyfin +# - Consider stopping Ollama when generating audio for better VRAM availability +# - Monitor with: watch -n 1 nvidia-smi +# +# Prerequisites: +# 1. Build image: cd /home/jpmschweitzer/docker-data/stable-audio-open && docker build -t stable-audio-open:local . +# 2. Create HuggingFace token: https://huggingface.co/settings/tokens (read access) +# 3. Accept model license: https://huggingface.co/stabilityai/stable-audio-open-1.0 +# 4. Create data directories: +# mkdir -p /home/jpmschweitzer/docker-data/stable-audio/{hf-cache,output} +# +# After Deployment: +# 1. Set HF_TOKEN in Portainer environment variables +# 2. Deploy stack via Portainer +# 3. First run downloads model weights (~6GB) - be patient +# 4. Verify GPU access: docker exec stable-audio nvidia-smi +# 5. Access Web UI: http://tower-of-joy:11500 or http://audio.schweitz.internal (via NPM) +# +# NPM Configuration (audio.schweitz.internal): +# - Domain: audio.schweitz.internal +# - Scheme: http +# - Forward Hostname: stable-audio (or tower-of-joy) +# - Forward Port: 11500 +# - Block Common Exploits: Yes +# - Websockets Support: Yes (required for Gradio) +# +# API Usage (Gradio API): +# curl -X POST http://audio.schweitz.internal/api/predict \ +# -H "Content-Type: application/json" \ +# -d '{"data": ["epic orchestral music, cinematic", 30, 100, 7]}' +# Parameters: [prompt, duration_seconds, diffusion_steps, cfg_scale] +# +# Rebuilding Image: +# cd /home/jpmschweitzer/docker-data/stable-audio-open +# git pull +# docker build -t stable-audio-open:local . diff --git a/stacks/trellis.yml b/stacks/trellis.yml new file mode 100644 index 0000000..656ca00 --- /dev/null +++ b/stacks/trellis.yml @@ -0,0 +1,116 @@ +version: '3.8' + +# TRELLIS 1 - 3D Model Generation (Low-VRAM Fork) +# Purpose: Generate 3D meshes with UV mappings for game asset pipeline +# Ports: 11510 (Gradio Web UI) +# GPU: YES - Optimized for 11GB VRAM (RTX 2080 Ti) +# Storage: SSD for model cache, HDD for GLB outputs +# Image: Built locally from /home/jpmschweitzer/docker-data/trellis/ + +services: + trellis: + image: trellis:local + container_name: trellis + restart: unless-stopped + ports: + - "11510:7860" # Gradio Web UI + volumes: + # SSD: HuggingFace model cache (~5GB) + - /home/jpmschweitzer/docker-data/trellis/hf-cache:/root/.cache/huggingface + # HDD: Generated GLB files + - /mnt/media/trellis/outputs:/app/outputs + # Entrypoint script (patches Gradio bugs without rebuilding image) + - /home/jpmschweitzer/docker-data/trellis/entrypoint.sh:/app/entrypoint.sh:ro + command: ["bash", "/app/entrypoint.sh"] + environment: + - TZ=Europe/Amsterdam + - NVIDIA_VISIBLE_DEVICES=all + - NVIDIA_DRIVER_CAPABILITIES=compute,utility + # VRAM Optimization (for 11GB card) + - ATTN_BACKEND=xformers + - SPCONV_ALGO=native + - PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True + # Gradio must bind to 0.0.0.0 inside Docker + - GRADIO_SERVER_NAME=0.0.0.0 + # HuggingFace token for model downloads (set in Portainer) + - HF_TOKEN=${HF_TOKEN:-} + healthcheck: + test: ["CMD-SHELL", "curl -fSs http://localhost:7860/ || exit 1"] + interval: 60s + timeout: 30s + retries: 3 + start_period: 300s # Model download + load time + memswap_limit: 20G + deploy: + resources: + limits: + memory: 20G + reservations: + memory: 4G + devices: + - driver: nvidia + count: 1 + capabilities: [gpu] + labels: + - "com.centurylinklabs.watchtower.enable=false" # Manual updates for local builds + networks: + - docker-dataplane + +networks: + docker-dataplane: + external: true + name: docker-dataplane + +# ============================================================================= +# PREREQUISITES +# ============================================================================= +# +# 1. Build the Docker image first: +# cd /home/jpmschweitzer/docker-data/trellis +# docker build -t trellis:local . +# (Takes ~20-30 minutes for CUDA compilation) +# +# 2. Directories are already created: +# /home/jpmschweitzer/docker-data/trellis/hf-cache (SSD - model cache) +# /mnt/media/trellis/outputs (HDD - generated GLB files) +# +# ============================================================================= +# AFTER DEPLOYMENT +# ============================================================================= +# +# 1. Verify GPU access: +# docker exec trellis nvidia-smi +# +# 2. Check logs: +# docker logs trellis +# +# 3. Access Web UI: +# http://tower-of-joy:11510 +# http://192.168.86.149:11510 +# +# 4. Monitor VRAM during generation: +# watch -n 1 nvidia-smi +# +# ============================================================================= +# USAGE - GAME ASSET PIPELINE +# ============================================================================= +# +# 1. Open Gradio UI at http://tower-of-joy:11510 +# 2. Upload reference image or enter text prompt +# 3. Generate 3D model (uses 6-8GB VRAM) +# 4. Download GLB file from outputs +# 5. Import GLB into Blender (File > Import > glTF) +# 6. Apply custom textures, set up isometric camera +# 7. Render at 1024x1024, downsample to 64x64 tile sprites +# +# ============================================================================= +# GPU CONTENTION NOTE +# ============================================================================= +# +# TRELLIS shares the RTX 2080 Ti with Ollama and Jellyfin. +# For best results during complex generations: +# docker stop ollama +# # Run TRELLIS generation +# docker start ollama +# +# =============================================================================