forked from espnet/espnet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
devel.dockerfile
83 lines (66 loc) · 2.29 KB
/
devel.dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
ARG FROM_TAG
FROM espnet/espnet:${FROM_TAG} as devel
LABEL maintainer "Nelson Yalta <[email protected]>"
ARG CUDA_VER
ENV CUDA_VER ${CUDA_VER}
ARG TH_VERSION
ENV TH_VERSION ${TH_VERSION}
WORKDIR /
ARG ESPNET_LOCATION=https://github.com/espnet/espnet
ENV PATH=/opt/miniconda/bin:${PATH}
# Download ESPnet
RUN git clone ${ESPNET_LOCATION} && \
cd espnet && \
rm -rf docker egs egs2 espnet2 test utils && \
rm -rf .git
# Install espnet
WORKDIR /espnet/tools
# Disable cupy test
# Docker build does not load libcuda.so.1
# Replace nvidia-smi for nvcc because docker does not load nvidia-smi
RUN if [ -z "${CUDA_VER}" ]; then \
echo "Build without CUDA" && \
MY_OPTS='CUPY_VERSION=""'; \
else \
echo "Build with CUDA ${CUDA_VER}" && \
# Docker containers cannot load cuda libs during build.
# So, their checks on cuda packages are disabled.
sed -i '200s|install.py|install.py --no-cuda --no-cupy |' Makefile && \
export CFLAGS="-I${CUDA_HOME}/include ${CFLAGS}" && \
MY_OPTS="CUDA_VERSION=${CUDA_VER}" && \
. ./setup_cuda_env.sh /usr/local/cuda; \
fi; \
if [ ! -z "${TH_VERSION}" ]; then \
MY_OPTS="${MY_OPTS} TH_VERSION=${TH_VERSION} "; \
fi; \
echo "Make with options ${MY_OPTS}" && \
ln -s /opt/kaldi ./ && \
rm -f activate_python.sh && touch activate_python.sh && \
conda install -y conda "python=3.7.4" && \
make KALDI=/opt/kaldi ${MY_OPTS} && \
. ./activate_python.sh && \
./installers/install_warp-ctc.sh && \
./installers/install_kenlm.sh && \
./installers/install_chainer.sh cpu && \
conda clean --all && \
rm -f *.tar.* && \
pip cache purge
RUN rm -rf ../espnet
WORKDIR /
#### For local docker
FROM devel as espnet_local
LABEL maintainer "Nelson Yalta <[email protected]>"
ARG CUDA_VER
WORKDIR /
# IF using a local ESPNet repository, a temporary file containing the ESPnet git repo is copied over
ARG ESPNET_ARCHIVE=./espnet-local.tar
COPY ${ESPNET_ARCHIVE} /espnet-local.tar
# Download ESPnet
RUN echo "Getting ESPnet sources from local repository, in temporary file: " ${ESPNET_ARCHIVE}
RUN mkdir /espnet
RUN tar xf espnet-local.tar -C /espnet/
RUN rm espnet-local.tar
RUN cd espnet && \
rm -rf docker egs test utils
# Install espnet
WORKDIR /espnet/tools