From e4bab505f160cb518cdf328e4a810c15cbbe187a Mon Sep 17 00:00:00 2001 From: yongjie-lv Date: Fri, 17 Oct 2025 11:44:27 +0800 Subject: [PATCH] add dockerfile and setup --- README.md | 27 +++++++------ docker/ming_uniaudio.dockerfile | 67 +++++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+), 12 deletions(-) create mode 100644 docker/ming_uniaudio.dockerfile diff --git a/README.md b/README.md index 545443d..fb647ef 100644 --- a/README.md +++ b/README.md @@ -677,20 +677,23 @@ pip install -r requirements.txt ### Installation with docker -You can also initialize the environment by building the docker image. First clone this repository: -```shell -git clone --depth 1 https://github.com/inclusionAI/Ming-UniAudio -cd Ming-UniAudio -``` -Then build the docker image with the provided Dockerfile in `docker/docker-py310-cu121`. This step might take a while: -```shell -docker build -t ming:py310-cu121 docker/docker-py310-cu121 +You can set up the environment using Docker in two ways. +- Option 1: Pull from Docker Hub (**Recommended**) +```bash +# 1. Pull the pre-built image +docker pull yongjielv/ming_uniaudio:v1.0 + +# 2. Run the container +docker run -it --gpus all yongjielv/ming_uniaudio:v1.0 /bin/bash ``` -At last, start the container with the current repo directory mounted: -```shell -docker run -it --gpus all -v "$(pwd)":/workspace/Ming-UniAudio ming:py310-cu121 ming:py310-cu121 /bin/bash +- Option 2: Build from Source +``` bash +# 1. Build the image +docker build -t ming-uniaudio:v1.0 -f ./docker/ming_uniaudio.dockerfile . + +# 2. Run the container +docker run -it --gpus all ming-uniaudio:v1.0 /bin/bash ``` -You can run the model with python interface. You may download the huggingface model in the repo directory first (`.../Ming-UniAudio/`) or mount the downloaded model path when starting the container. ## Example Usage diff --git a/docker/ming_uniaudio.dockerfile b/docker/ming_uniaudio.dockerfile new file mode 100644 index 0000000..91f9e70 --- /dev/null +++ b/docker/ming_uniaudio.dockerfile @@ -0,0 +1,67 @@ +FROM pytorch/pytorch:2.6.0-cuda12.4-cudnn9-runtime + +ENV DEBIAN_FRONTEND=noninteractive +ENV TZ=Asia/Shanghai + +RUN sed -i 's|http://archive.ubuntu.com/ubuntu|https://mirrors.aliyun.com/ubuntu|g' /etc/apt/sources.list && \ + sed -i 's|http://security.ubuntu.com/ubuntu|https://mirrors.aliyun.com/ubuntu|g' /etc/apt/sources.list && \ + apt-get clean && \ + apt-get update + +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + git \ + wget \ + vim \ + libsndfile1 \ + build-essential \ + python3-dev \ + && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +RUN ln -s /usr/bin/python3.11 /usr/bin/python && \ + ln -s /usr/bin/pip3.11 /usr/bin/pip + +RUN pip install --no-cache-dir --upgrade pip +RUN pip config set global.index-url https://pypi.mirrors.ustc.edu.cn/simple/ + +RUN pip install --no-cache-dir \ + torch==2.6.0 \ + torchaudio==2.6.0 \ + torchvision==0.21.0 + + +ENV FORCE_CUDA="1" +# A100: 8.0, RTX 30xx: 8.6, RTX 40xx/H100: 8.9 or 9.0 +ENV TORCH_CUDA_ARCH_LIST="8.0" +ENV GROUPED_GEMM_CUTLASS="1" + +ENV CUDA_HOME=/usr/local/cuda +ENV CUDA_ROOT=/usr/local/cuda +ENV PATH=/usr/local/cuda/bin:$PATH +ENV LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH + +RUN pip install --no-cache-dir --no-build-isolation \ + tokenizers \ + # grouped_gemm==0.1.4 \ + peft==0.13.2 \ + diffusers==0.33.0 \ + decord==0.6.0 \ + hyperpyyaml==1.2.2 \ + soundfile==0.12.1 \ + transformers==4.52.4 \ + x_transformers \ + torchdiffeq \ + torchtune \ + torchao + +ARG FLASH_ATTN_WHEEL=flash_attn-2.7.0.post1+cu12torch2.5cxx11abiFALSE-cp311-cp311-linux_x86_64.whl +ARG FLASH_ATTN_URL=https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.0.post1/${FLASH_ATTN_WHEEL} +RUN wget -q ${FLASH_ATTN_URL} -O /tmp/${FLASH_ATTN_WHEEL} && \ + pip install --no-cache-dir /tmp/${FLASH_ATTN_WHEEL} && \ + rm /tmp/${FLASH_ATTN_WHEEL} + +WORKDIR /app + +CMD ["/bin/bash"]