From e0f507ee1f0d3f49e68112505ee0265fce6eab71 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Fri, 28 Jul 2023 09:42:50 +0800 Subject: [PATCH] add more dockerfiles --- .github/workflows/build-docker-image.yml | 11 ++-- .github/workflows/run-docker-image.yml | 45 +++++++++++--- docker/README.md | 15 +++++ docker/torch1.12.1-cuda11.3.dockerfile | 62 +++++++++++++++++++ ...erfile => torch1.13.0-cuda11.6.dockerfile} | 21 ++++--- docker/torch1.9.0-cuda10.2.dockerfile | 62 +++++++++++++++++++ docker/torch2.0.0-cuda11.7.dockerfile | 62 +++++++++++++++++++ docker/torch2.0.1-cuda11.7.dockerfile | 62 +++++++++++++++++++ 8 files changed, 318 insertions(+), 22 deletions(-) create mode 100644 docker/torch1.12.1-cuda11.3.dockerfile rename docker/{torch1.13.0-cuda11.6-cudnn8.dockerfile => torch1.13.0-cuda11.6.dockerfile} (65%) create mode 100644 docker/torch1.9.0-cuda10.2.dockerfile create mode 100644 docker/torch2.0.0-cuda11.7.dockerfile create mode 100644 docker/torch2.0.1-cuda11.7.dockerfile diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/build-docker-image.yml index 2e07a3e4d..094853573 100644 --- a/.github/workflows/build-docker-image.yml +++ b/.github/workflows/build-docker-image.yml @@ -5,6 +5,7 @@ on: push: branches: - docker2 + workflow_dispatch: concurrency: @@ -19,6 +20,8 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] + image: ["torch2.0.1-cuda11.7", "torch2.0.0-cuda11.7", "torch1.13.0-cuda11.6", "torch1.12.1-cuda11.3", "torch1.9.0-cuda10.2"] + steps: # refer to https://github.com/actions/checkout - uses: actions/checkout@v2 @@ -28,10 +31,8 @@ jobs: - name: Rename shell: bash run: | - ls -lh - ls -lh ./docker - mv -v ./docker/torch1.13.0-cuda11.6-cudnn8.dockerfile ./Dockerfile - ls -lh + image=${{ matrix.image }} + mv -v ./docker/$image.dockerfile ./Dockerfile - name: Log in to Docker Hub uses: docker/login-action@v2 @@ -45,4 +46,4 @@ jobs: context: . file: ./Dockerfile push: true - tags: k2fsa/icefall:torch1.13.0-cuda11.6 + tags: k2fsa/icefall:${{ matrix.image }} diff --git a/.github/workflows/run-docker-image.yml b/.github/workflows/run-docker-image.yml index 4b1d00533..346dae17b 100644 --- a/.github/workflows/run-docker-image.yml +++ b/.github/workflows/run-docker-image.yml @@ -3,6 +3,7 @@ on: push: branches: - docker2 + workflow_dispatch: concurrency: @@ -17,6 +18,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] + image: ["torch2.0.1-cuda11.7", "torch2.0.0-cuda11.7", "torch1.13.0-cuda11.6", "torch1.12.1-cuda11.3", "torch1.9.0-cuda10.2"] steps: # refer to https://github.com/actions/checkout - uses: actions/checkout@v2 @@ -26,16 +28,43 @@ jobs: - name: Run the build process with Docker uses: addnab/docker-run-action@v3 with: - image: k2fsa/icefall:torch1.13.0-cuda11.6 + image: k2fsa/icefall:${{ matrix.image }} run: | uname -a - python3 --version - python3 -m torch.utils.collect_env - python3 -m k2.version - python3 -c "import lhotse; print(lhotse.__version__)" - python3 -c "import kaldifeat; print(kaldifeat.__version__)" + cat /etc/*release + nvcc --version + which nvcc - find /usr/ -name libcuda.so* - find /opt/ -name libcuda.so* + cuda_dir=$(dirname $(which nvcc)) + echo "cuda_dir: $cuda_dir" + + find $cuda_dir -name libcuda.so* + echo "--------------------" + find / -name libcuda.so* 2>/dev/null + + pushd /opt/conda/lib/stubs && ln -s libcuda.so libcuda.so.1 && popd + + export LD_LIBRARY_PATH=/opt/conda/lib/stubs:$LD_LIBRARY_PATH + echo "LD_LIBRARY_PATH $LD_LIBRARY_PATH" + + python3 --version + which python3 + + echo "----------torch----------" + python3 -m torch.utils.collect_env + + echo "----------k2----------" + python3 -c "import k2; print(k2.__file__)" + python3 -c "import k2; print(k2.__version__)" + python3 -m k2.version + + echo "----------lhotse----------" + python3 -c "import lhotse; print(lhotse.__file__)" + python3 -c "import lhotse; print(lhotse.__version__)" + + echo "----------kaldifeat----------" + python3 -c "import kaldifeat; print(kaldifeat.__file__)" + python3 -c "import kaldifeat; print(kaldifeat.__version__)" + diff --git a/docker/README.md b/docker/README.md index c14b9bf75..fd31d903f 100644 --- a/docker/README.md +++ b/docker/README.md @@ -1,5 +1,20 @@ # icefall dockerfile +## Download from dockerhub + +You can find pre-built docker image for icefall at the following address: + + ``_ + +Example usage: + +```bash +docker run --gpus all --rm -it k2fsa/icefall:torch1.13.0-cuda11.6 /bin/bash +``` + + +## Build from dockerfile + 2 sets of configuration are provided - (a) Ubuntu18.04-pytorch1.12.1-cuda11.3-cudnn8, and (b) Ubuntu18.04-pytorch1.7.1-cuda11.0-cudnn8. If your NVIDIA driver supports CUDA Version: 11.3, please go for case (a) Ubuntu18.04-pytorch1.12.1-cuda11.3-cudnn8. diff --git a/docker/torch1.12.1-cuda11.3.dockerfile b/docker/torch1.12.1-cuda11.3.dockerfile new file mode 100644 index 000000000..b6273682f --- /dev/null +++ b/docker/torch1.12.1-cuda11.3.dockerfile @@ -0,0 +1,62 @@ +FROM pytorch/pytorch:1.12.1-cuda11.3-cudnn8-runtime + +ARG K2_VERSION="1.24.3.dev20230725+cuda11.3.torch1.12.1" +ARG KALDIFEAT_VERSION="1.25.0.dev20230726+cuda11.3.torch1.12.1" +ARG TORCHAUDIO_VERSION="0.12.1+cu113" + +LABEL authors="Fangjun Kuang " +LABEL k2_version=${K2_VERSION} +LABEL kaldifeat_version=${KALDIFEAT_VERSION} +LABEL github_repo="https://github.com/k2-fsa/icefall" + +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + curl \ + vim \ + libssl-dev \ + autoconf \ + automake \ + bzip2 \ + ca-certificates \ + ffmpeg \ + g++ \ + gfortran \ + git \ + libtool \ + make \ + patch \ + sox \ + subversion \ + unzip \ + valgrind \ + wget \ + zlib1g-dev \ + && rm -rf /var/lib/apt/lists/* + +# Install dependencies +RUN pip install --no-cache-dir \ + torchaudio==${TORCHAUDIO_VERSION} -f https://download.pytorch.org/whl/torch_stable.html \ + k2==${K2_VERSION} -f https://k2-fsa.github.io/k2/cuda.html \ + git+https://github.com/lhotse-speech/lhotse \ + kaldifeat==${KALDIFEAT_VERSION} -f https://csukuangfj.github.io/kaldifeat/cuda.html \ + \ + kaldi_native_io \ + kaldialign \ + kaldifst \ + kaldilm \ + sentencepiece>=0.1.96 \ + tensorboard \ + typeguard \ + dill + +RUN git clone https://github.com/k2-fsa/icefall /workspace/icefall && \ + cd /workspace/icefall && \ + pip install --no-cache-dir -r requirements.txt + +ENV PYTHONPATH /workspace/icefall:$PYTHONPATH + +ENV LD_LIBRARY_PATH /opt/conda/lib/stubs:$LD_LIBRARY_PATH + +WORKDIR /workspace/icefall + + diff --git a/docker/torch1.13.0-cuda11.6-cudnn8.dockerfile b/docker/torch1.13.0-cuda11.6.dockerfile similarity index 65% rename from docker/torch1.13.0-cuda11.6-cudnn8.dockerfile rename to docker/torch1.13.0-cuda11.6.dockerfile index dd95ce441..69dbe652f 100644 --- a/docker/torch1.13.0-cuda11.6-cudnn8.dockerfile +++ b/docker/torch1.13.0-cuda11.6.dockerfile @@ -1,8 +1,12 @@ FROM pytorch/pytorch:1.13.0-cuda11.6-cudnn8-runtime -LABEL authors="Fangjun Kuang" -LABEL k2_version="1.24.3.dev20230725+cuda11.6.torch1.13.0" -LABEL kaldifeat_version="1.25.0.dev20230726+cuda11.6.torch1.13.0" +ARG K2_VERSION="1.24.3.dev20230725+cuda11.6.torch1.13.0" +ARG KALDIFEAT_VERSION="1.25.0.dev20230726+cuda11.6.torch1.13.0" +ARG TORCHAUDIO_VERSION="0.13.0+cu116" + +LABEL authors="Fangjun Kuang " +LABEL k2_version=${K2_VERSION} +LABEL kaldifeat_version=${KALDIFEAT_VERSION} LABEL github_repo="https://github.com/k2-fsa/icefall" RUN apt-get update && \ @@ -31,21 +35,20 @@ RUN apt-get update && \ # Install dependencies RUN pip install --no-cache-dir \ - torchaudio==0.13.0+cu116 -f https://download.pytorch.org/whl/torch_stable.html \ - k2==1.24.3.dev20230725+cuda11.6.torch1.13.0 -f https://k2-fsa.github.io/k2/cuda.html \ + torchaudio==${TORCHAUDIO_VERSION} -f https://download.pytorch.org/whl/torch_stable.html \ + k2==${K2_VERSION} -f https://k2-fsa.github.io/k2/cuda.html \ git+https://github.com/lhotse-speech/lhotse \ - kaldifeat==1.25.0.dev20230726+cuda11.6.torch1.13.0 -f https://csukuangfj.github.io/kaldifeat/cuda.html \ + kaldifeat==${KALDIFEAT_VERSION} -f https://csukuangfj.github.io/kaldifeat/cuda.html \ \ + kaldi_native_io \ + kaldialign \ kaldifst \ kaldilm \ - kaldialign \ sentencepiece>=0.1.96 \ tensorboard \ typeguard \ dill -RUN cd /opt/conda/lib/stubs && ln -s libcuda.so libcuda.so.1 - RUN git clone https://github.com/k2-fsa/icefall /workspace/icefall && \ cd /workspace/icefall && \ pip install --no-cache-dir -r requirements.txt diff --git a/docker/torch1.9.0-cuda10.2.dockerfile b/docker/torch1.9.0-cuda10.2.dockerfile new file mode 100644 index 000000000..c50836545 --- /dev/null +++ b/docker/torch1.9.0-cuda10.2.dockerfile @@ -0,0 +1,62 @@ +FROM pytorch/pytorch:1.9.0-cuda10.2-cudnn7-runtime + +ARG K2_VERSION="1.24.3.dev20230726+cuda10.2.torch1.9.0" +ARG KALDIFEAT_VERSION="1.25.0.dev20230726+cuda10.2.torch1.9.0" +ARG TORCHAUDIO_VERSION="0.9.0" + +LABEL authors="Fangjun Kuang " +LABEL k2_version=${K2_VERSION} +LABEL kaldifeat_version=${KALDIFEAT_VERSION} +LABEL github_repo="https://github.com/k2-fsa/icefall" + +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + curl \ + vim \ + libssl-dev \ + autoconf \ + automake \ + bzip2 \ + ca-certificates \ + ffmpeg \ + g++ \ + gfortran \ + git \ + libtool \ + make \ + patch \ + sox \ + subversion \ + unzip \ + valgrind \ + wget \ + zlib1g-dev \ + && rm -rf /var/lib/apt/lists/* + +# Install dependencies +RUN pip install --no-cache-dir \ + torchaudio==${TORCHAUDIO_VERSION} -f https://download.pytorch.org/whl/torch_stable.html \ + k2==${K2_VERSION} -f https://k2-fsa.github.io/k2/cuda.html \ + kaldifeat==${KALDIFEAT_VERSION} -f https://csukuangfj.github.io/kaldifeat/cuda.html \ + git+https://github.com/lhotse-speech/lhotse \ + \ + kaldi_native_io \ + kaldialign \ + kaldifst \ + kaldilm \ + sentencepiece>=0.1.96 \ + tensorboard \ + typeguard \ + dill + +RUN git clone https://github.com/k2-fsa/icefall /workspace/icefall && \ + cd /workspace/icefall && \ + pip install --no-cache-dir -r requirements.txt + +ENV PYTHONPATH /workspace/icefall:$PYTHONPATH + +ENV LD_LIBRARY_PATH /opt/conda/lib/stubs:$LD_LIBRARY_PATH + +WORKDIR /workspace/icefall + + diff --git a/docker/torch2.0.0-cuda11.7.dockerfile b/docker/torch2.0.0-cuda11.7.dockerfile new file mode 100644 index 000000000..410bd5a1a --- /dev/null +++ b/docker/torch2.0.0-cuda11.7.dockerfile @@ -0,0 +1,62 @@ +FROM pytorch/pytorch:2.0.0-cuda11.7-cudnn8-runtime + +ARG K2_VERSION="1.24.3.dev20230718+cuda11.7.torch2.0.0" +ARG KALDIFEAT_VERSION="1.25.0.dev20230726+cuda11.7.torch2.0.0" +ARG TORCHAUDIO_VERSION="2.0.0+cu117" + +LABEL authors="Fangjun Kuang " +LABEL k2_version=${K2_VERSION} +LABEL kaldifeat_version=${KALDIFEAT_VERSION} +LABEL github_repo="https://github.com/k2-fsa/icefall" + +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + curl \ + vim \ + libssl-dev \ + autoconf \ + automake \ + bzip2 \ + ca-certificates \ + ffmpeg \ + g++ \ + gfortran \ + git \ + libtool \ + make \ + patch \ + sox \ + subversion \ + unzip \ + valgrind \ + wget \ + zlib1g-dev \ + && rm -rf /var/lib/apt/lists/* + +# Install dependencies +RUN pip install --no-cache-dir \ + torchaudio==${TORCHAUDIO_VERSION} -f https://download.pytorch.org/whl/torch_stable.html \ + k2==${K2_VERSION} -f https://k2-fsa.github.io/k2/cuda.html \ + git+https://github.com/lhotse-speech/lhotse \ + kaldifeat==${KALDIFEAT_VERSION} -f https://csukuangfj.github.io/kaldifeat/cuda.html \ + \ + kaldi_native_io \ + kaldialign \ + kaldifst \ + kaldilm \ + sentencepiece>=0.1.96 \ + tensorboard \ + typeguard \ + dill + +RUN git clone https://github.com/k2-fsa/icefall /workspace/icefall && \ + cd /workspace/icefall && \ + pip install --no-cache-dir -r requirements.txt + +ENV PYTHONPATH /workspace/icefall:$PYTHONPATH + +ENV LD_LIBRARY_PATH /opt/conda/lib/stubs:$LD_LIBRARY_PATH + +WORKDIR /workspace/icefall + + diff --git a/docker/torch2.0.1-cuda11.7.dockerfile b/docker/torch2.0.1-cuda11.7.dockerfile new file mode 100644 index 000000000..b69da28c7 --- /dev/null +++ b/docker/torch2.0.1-cuda11.7.dockerfile @@ -0,0 +1,62 @@ +FROM pytorch/pytorch:2.0.1-cuda11.7-cudnn8-runtime + +ARG K2_VERSION="1.24.3.dev20230718+cuda11.7.torch2.0.1" +ARG KALDIFEAT_VERSION="1.25.0.dev20230726+cuda11.7.torch2.0.1" +ARG TORCHAUDIO_VERSION="2.0.1+cu117" + +LABEL authors="Fangjun Kuang " +LABEL k2_version=${K2_VERSION} +LABEL kaldifeat_version=${KALDIFEAT_VERSION} +LABEL github_repo="https://github.com/k2-fsa/icefall" + +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + curl \ + vim \ + libssl-dev \ + autoconf \ + automake \ + bzip2 \ + ca-certificates \ + ffmpeg \ + g++ \ + gfortran \ + git \ + libtool \ + make \ + patch \ + sox \ + subversion \ + unzip \ + valgrind \ + wget \ + zlib1g-dev \ + && rm -rf /var/lib/apt/lists/* + +# Install dependencies +RUN pip install --no-cache-dir \ + torchaudio==${TORCHAUDIO_VERSION} -f https://download.pytorch.org/whl/torch_stable.html \ + k2==${K2_VERSION} -f https://k2-fsa.github.io/k2/cuda.html \ + git+https://github.com/lhotse-speech/lhotse \ + kaldifeat==${KALDIFEAT_VERSION} -f https://csukuangfj.github.io/kaldifeat/cuda.html \ + \ + kaldi_native_io \ + kaldialign \ + kaldifst \ + kaldilm \ + sentencepiece>=0.1.96 \ + tensorboard \ + typeguard \ + dill + +RUN git clone https://github.com/k2-fsa/icefall /workspace/icefall && \ + cd /workspace/icefall && \ + pip install --no-cache-dir -r requirements.txt + +ENV PYTHONPATH /workspace/icefall:$PYTHONPATH + +ENV LD_LIBRARY_PATH /opt/conda/lib/stubs:$LD_LIBRARY_PATH + +WORKDIR /workspace/icefall + +