Skip to content

Commit a8deddd

Browse files
committed
Clean up Dockerfile for ESPNet
1 parent d5ee344 commit a8deddd

File tree

1 file changed

+11
-51
lines changed

1 file changed

+11
-51
lines changed

python-espnet/Dockerfile

Lines changed: 11 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ENV DEBIAN_FRONTEND=noninteractive \
77
LIBRARY_PATH=/usr/local/cuda/lib64/stubs \
88
_CUDA_COMPAT_PATH="/usr/local/cuda/compat" \
99
LD_LIBRARY_PATH="/usr/local/cuda/extras/CUPTI/lib64:/usr/local/cuda/compat/lib:/usr/local/nvidia/lib:/usr/local/nvidia/lib64:/usr/local/cuda/lib64:/usr/include/x86_64-linux-gnu"\
10-
PATH="/usr/local/nvidia/bin:/usr/local/cuda/bin:/minicondaenv/espnet/bin:/usr/local/sbin:/usr/bin/cmake/bin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/tensorrt/bin" \
10+
PATH="/usr/local/nvidia/bin:/usr/local/cuda/bin:/opt/conda/bin:/usr/local/sbin:/usr/bin/cmake/bin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/tensorrt/bin" \
1111
LANG=C.UTF-8
1212

1313
ENV CUDA_VERSION 11.0.3
@@ -70,8 +70,7 @@ RUN apt-get update && \
7070
apt-get clean && \
7171
rm -rf /var/lib/apt/lists/*
7272

73-
## FROM CUDA 11.0 base [https://gitlab.com/nvidia/cuda/blob/ubuntu18.04/11.0/base/Dockerfile]
74-
73+
## FROM CUDA 11.0 base
7574
RUN apt-get update && \
7675
apt-get install -y --no-install-recommends gnupg2 curl ca-certificates && \
7776
curl -fsSL https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub | apt-key add - && \
@@ -90,8 +89,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
9089
RUN echo "/usr/local/nvidia/lib" >> /etc/ld.so.conf.d/nvidia.conf && \
9190
echo "/usr/local/nvidia/lib64" >> /etc/ld.so.conf.d/nvidia.conf
9291

93-
## FROM CUDA 11.0 runtime [https://gitlab.com/nvidia/cuda/blob/ubuntu18.04/11.0/runtime/Dockerfile]
94-
92+
## FROM CUDA 11.0 runtime
9593
RUN apt-get update && apt-get install -y --no-install-recommends \
9694
cuda-libraries-11-0=11.0.3-1 \
9795
libnpp-11-0=11.1.0.245-1 \
@@ -103,8 +101,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
103101
apt-mark hold libcublas-11-0 libnccl2 && \
104102
rm -rf /var/lib/apt/lists/*
105103

106-
## FROM CUDA 11.0 devel [https://gitlab.com/nvidia/cuda/blob/ubuntu18.04/11.0/devel/Dockerfile]
107-
104+
## FROM CUDA 11.0 devel
108105
RUN apt-get update && apt-get install -y --no-install-recommends \
109106
cuda-cudart-dev-11-0=11.0.221-1 \
110107
cuda-command-line-tools-11-0=11.0.3-1 \
@@ -120,14 +117,13 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
120117
rm -rf /var/lib/apt/lists/*
121118

122119
## FROM CUDA 11.0-CUDNN 8 devel
123-
124120
RUN apt-get update && apt-get install -y --no-install-recommends \
125121
libcudnn8=$CUDNN_VERSION-1+cuda11.0 \
126122
libcudnn8-dev=$CUDNN_VERSION-1+cuda11.0 && \
127123
apt-mark hold libcudnn8 && \
128124
rm -rf /var/lib/apt/lists/*
129125

130-
126+
# Install Conda
131127
RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-py37_4.9.2-Linux-x86_64.sh -O miniconda.sh && \
132128
mkdir -p /opt && \
133129
sh miniconda.sh -b -p /opt/conda && \
@@ -139,11 +135,7 @@ RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-py37_4.9.2-Linux
139135
find /opt/conda/ -follow -type f -name '*.js.map' -delete && \
140136
/opt/conda/bin/conda clean -afy
141137

142-
# Install Kaldi
143-
#RUN git clone https://github.com/kaldi-asr/kaldi
144-
145-
WORKDIR /tmp
146-
# OpenBlas
138+
# Install OpenBlas
147139
RUN git clone -q --branch=master git://github.com/xianyi/OpenBLAS.git && \
148140
cd OpenBLAS && \
149141
make DYNAMIC_ARCH=1 NO_AFFINITY=1 NUM_THREADS=48 FC=gfortran && \
@@ -173,12 +165,9 @@ RUN mkdir /tmp/openmpi && \
173165
ldconfig && \
174166
rm -rf /tmp/openmpi*
175167

176-
# Install OpenSSH for MPI to communicate between containers
177-
RUN apt-get install -y --no-install-recommends openssh-client openssh-server && \
178-
mkdir -p /var/run/sshd
179-
180168
# Allow OpenSSH to talk to containers without asking for confirmation
181-
RUN cat /etc/ssh/ssh_config | grep -v StrictHostKeyChecking > /etc/ssh/ssh_config.new && \
169+
RUN mkdir -p /var/run/sshd && \
170+
cat /etc/ssh/ssh_config | grep -v StrictHostKeyChecking > /etc/ssh/ssh_config.new && \
182171
echo " StrictHostKeyChecking no" >> /etc/ssh/ssh_config.new && \
183172
mv /etc/ssh/ssh_config.new /etc/ssh/ssh_config
184173

@@ -191,14 +180,6 @@ RUN mv /usr/local/bin/mpirun /usr/local/bin/mpirun.real && \
191180
# Configure OpenMPI to run good defaults:
192181
RUN echo "btl_tcp_if_exclude = lo,docker0" >> /usr/local/etc/openmpi-mca-params.conf
193182

194-
# Install OpenSSH for MPI to communicate between containers
195-
RUN mkdir -p /var/run/sshd
196-
197-
# Allow OpenSSH to talk to containers without asking for confirmation
198-
RUN cat /etc/ssh/ssh_config | grep -v StrictHostKeyChecking > /etc/ssh/ssh_config.new && \
199-
echo " StrictHostKeyChecking no" >> /etc/ssh/ssh_config.new && \
200-
mv /etc/ssh/ssh_config.new /etc/ssh/ssh_config
201-
202183
# Install git-lfs
203184
WORKDIR /tmp
204185
RUN curl -sLO https://github.com/git-lfs/git-lfs/releases/download/v2.13.1/git-lfs-linux-amd64-v2.13.1.tar.gz && \
@@ -212,6 +193,7 @@ RUN curl -fL https://github.com/cdr/code-server/releases/download/v3.8.0/code-se
212193
mv /usr/local/lib/code-server-3.8.0-linux-amd64 /usr/local/lib/code-server-3.8.0 && \
213194
ln -s /usr/local/lib/code-server-3.8.0/bin/code-server /usr/local/bin/code-server
214195

196+
# Install Kaldi
215197
RUN git clone https://github.com/hephaex/kaldi.git /opt/kaldi && \
216198
cd /opt/kaldi/tools && \
217199
./extras/install_mkl.sh -sp debian intel-mkl-64bit-2019.2-057 && \
@@ -232,22 +214,8 @@ RUN git clone https://github.com/hephaex/kaldi.git /opt/kaldi && \
232214
find /opt/kaldi/src -name "*.o" -exec rm -f {} \;
233215

234216

235-
ENV CUDA_VER 11.0
236-
#WORKDIR /
237-
238-
RUN git clone https://github.com/espnet/espnet /opt/espnet
239-
# IF using a local ESPNet repository, a temporary file containing the ESPnet git repo is copied over
240-
#ARG ESPNET_ARCHIVE=./espnet-local.tar
241-
#COPY ${ESPNET_ARCHIVE} /espnet-local.tar
242-
243-
244217
# Download ESPnet
245-
#RUN echo "Getting ESPnet sources from local repository, in temporary file: " ${ESPNET_ARCHIVE}
246-
#RUN mkdir /espnet
247-
#RUN tar xf espnet-local.tar -C /espnet/
248-
249-
#RUN cd espnet && \
250-
# rm -rf docker egs test utils
218+
RUN git clone https://github.com/espnet/espnet /opt/espnet
251219

252220
# Install espnet
253221
WORKDIR /opt/espnet/tools
@@ -276,7 +244,6 @@ RUN if [ -z "$( which nvcc )" ]; then \
276244
make KALDI=/opt/kaldi ${MY_OPTS}
277245

278246
# Add extra libraries (VC/TTS)
279-
280247
WORKDIR /opt/espnet/tools
281248
RUN /opt/conda/bin/python3 -m pip install --no-cache-dir \
282249
torch==1.7.1 parallel_wavegan && \
@@ -294,15 +261,8 @@ RUN /opt/conda/bin/python3 -m pip install --no-cache-dir \
294261
COPY ./service-defs /etc/backend.ai/service-defs
295262
RUN echo ". /opt/espnet/tools/activate_python.sh" >> /etc/profile
296263

297-
RUN \
298-
# mkdir -p /opt/espnet/egs/ljspeech/tts1/downloads && \
299-
# cd /opt/espnet/egs/ljspeech/tts1/downloads && \
300-
# wget http://data.keithito.com/data/speech/LJSpeech-1.1.tar.bz2 && \
301-
# tar -vxf ./*.tar.bz2 && \
302-
# rm ./*.tar.bz2 && \
303-
chmod +x /opt/espnet/tools/activate_python.sh && \
264+
RUN chmod +x /opt/espnet/tools/activate_python.sh && \
304265
chmod -R 777 /opt/espnet
305-
# chmod -R 777 /opt/espnet/egs/ljspeech/tts1/downloads
306266

307267
# Install ipython kernelspec
308268
Run /opt/conda/bin/python3 -m ipykernel install --display-name "A4003 (ESPNet, PyTorch 1.7.1 on Python 3.7 & CUDA 11.0)" && \

0 commit comments

Comments
 (0)