Skip to content

Instantly share code, notes, and snippets.

@beveradb
Created July 29, 2024 22:07
Show Gist options
  • Save beveradb/b54129b847a7fc319d98a95d8c132960 to your computer and use it in GitHub Desktop.
Save beveradb/b54129b847a7fc319d98a95d8c132960 to your computer and use it in GitHub Desktop.
Runpod serverless CUDA 12 Dockerfile for audio-separator
# Runpod Base image: https://github.com/runpod/containers/blob/main/official-templates/base/Dockerfile
FROM runpod/base:0.6.2-cuda12.1.0
RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb
RUN dpkg -i cuda-keyring_1.1-1_all.deb
RUN apt-get update && apt-get upgrade -y
# Install various needed dependencies
RUN apt-get install -y \
ffmpeg \
gcc \
python3-dev
# Install CUDA dependencies
RUN apt-get install -y \
cuda-toolkit \
cudnn9-cuda-12
RUN python3 -m pip install --upgrade pip
WORKDIR /app
# Install audio-separator without any specific onnxruntime (onnxruntime should already be satisfied by the above)
RUN pip install --no-input --ignore-requires-python runpod "audio-separator"
# Remove onnxruntime and onnxruntime-gpu which may have been installed as part of karaoke-prep
RUN pip uninstall --yes onnxruntime onnxruntime-gpu
# Install the CUDA 12 compatible version of ONNXRuntime (the default CUDA version for ORT is still 11.8 so they've provided a separate package index)
# See https://onnxruntime.ai/docs/install/
RUN pip install --no-input onnxruntime-gpu --extra-index-url https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/onnxruntime-cuda-12/pypi/simple/
# Download models in a single layer (so these are part of the image already to avoid wasted downloads)
RUN audio-separator --download_model_only -m UVR_MDXNET_KARA_2.onnx \
&& audio-separator --download_model_only -m MDX23C-8KFFT-InstVoc_HQ_2.ckpt \
&& audio-separator --download_model_only -m model_bs_roformer_ep_317_sdr_12.9755.yaml \
&& audio-separator --download_model_only -m UVR-MDX-NET-Inst_HQ_3.onnx \
&& audio-separator --download_model_only -m 2_HP-UVR.pth
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment