From f5bb103f88219fbba3de7dcbe2960e90c4c6ddcf Mon Sep 17 00:00:00 2001 From: Cem Philipp Freimoser Date: Sun, 28 Apr 2019 11:37:44 +0200 Subject: [PATCH 1/3] Updated Dockerfile * use python 3 * include git-lfs * allow checkout from GitHub instead of local copy step --- Dockerfile | 45 ++++++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/Dockerfile b/Dockerfile index 59ca86f7..322b8b2c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,17 +5,24 @@ FROM nvidia/cuda:10.0-cudnn7-devel-ubuntu18.04 # >> START Install base software +RUN apt-get update && apt-get install -y \ + software-properties-common \ + curl + +RUN add-apt-repository ppa:git-core/ppa && \ + curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash + # Get basic packages RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ curl \ wget \ git \ - python \ - python-dev \ - python-pip \ - python-wheel \ - python-numpy \ + python3 \ + python3-dev \ + python3-pip \ + python3-wheel \ + python3-numpy \ libcurl3-dev \ ca-certificates \ gcc \ @@ -35,7 +42,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ openjdk-8-jdk \ bash-completion \ g++ \ - unzip + unzip \ + git-lfs + +RUN ln -s -f /usr/bin/python3 /usr/bin/python # Install NCCL 2.2 RUN apt-get install -qq -y --allow-downgrades --allow-change-held-packages libnccl2=2.3.7-1+cuda10.0 libnccl-dev=2.3.7-1+cuda10.0 @@ -49,7 +59,7 @@ RUN apt-get install -qq -y cuda-command-line-tools-10-0 # Install pip RUN wget https://bootstrap.pypa.io/get-pip.py && \ - python get-pip.py && \ + python3 get-pip.py && \ rm get-pip.py # << END Install base software @@ -80,7 +90,7 @@ ENV TF_BUILD_CONTAINER_TYPE GPU ENV TF_BUILD_OPTIONS OPT ENV TF_BUILD_DISABLE_GCP 1 ENV TF_BUILD_ENABLE_XLA 0 -ENV TF_BUILD_PYTHON_VERSION PYTHON2 +ENV TF_BUILD_PYTHON_VERSION PYTHON3 ENV TF_BUILD_IS_OPT OPT ENV TF_BUILD_IS_PIP PIP @@ -101,8 +111,8 @@ ENV TF_NEED_TENSORRT 0 ENV TF_NEED_GDR 0 ENV TF_NEED_VERBS 0 ENV TF_NEED_OPENCL_SYCL 0 -ENV PYTHON_BIN_PATH /usr/bin/python2.7 -ENV PYTHON_LIB_PATH /usr/lib/python2.7/dist-packages +ENV PYTHON_BIN_PATH /usr/bin/python3.6 +ENV PYTHON_LIB_PATH /usr/lib/python3.6/dist-packages # << END Configure Tensorflow Build @@ -134,14 +144,15 @@ ENV LD_LIBRARY_PATH $LD_LIBRARY_PATH:/usr/local/cuda/extras/CUPTI/lib64:/usr/loc # << END Configure Bazel - - # Copy DeepSpeech repo contents to container's /DeepSpeech COPY . /DeepSpeech/ +# Alternative clone from GitHub +# WORKDIR / +# RUN git clone https://github.com/mozilla/DeepSpeech.git WORKDIR /DeepSpeech -RUN pip --no-cache-dir install -r requirements.txt +RUN pip3 --no-cache-dir install -r requirements.txt # Link DeepSpeech native_client libs to tf folder RUN ln -s /DeepSpeech/native_client /tensorflow @@ -176,7 +187,7 @@ RUN bazel build --config=monolithic --config=cuda -c opt --copt=-O3 --copt="-D_G # RUN bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg # # # Install tensorflow from our custom wheel -# RUN pip install /tmp/tensorflow_pkg/*.whl +# RUN pip3 install /tmp/tensorflow_pkg/*.whl # Copy built libs to /DeepSpeech/native_client RUN cp /tensorflow/bazel-bin/native_client/generate_trie /DeepSpeech/native_client/ \ @@ -184,7 +195,7 @@ RUN cp /tensorflow/bazel-bin/native_client/generate_trie /DeepSpeech/native_clie # Install TensorFlow WORKDIR /DeepSpeech/ -RUN pip install tensorflow-gpu==1.13.1 +RUN pip3 install tensorflow-gpu==1.13.1 # Make DeepSpeech and install Python bindings @@ -193,10 +204,10 @@ WORKDIR /DeepSpeech/native_client RUN make deepspeech WORKDIR /DeepSpeech/native_client/python RUN make bindings -RUN pip install dist/deepspeech* +RUN pip3 install dist/deepspeech* WORKDIR /DeepSpeech/native_client/ctcdecode RUN make -RUN pip install dist/*.whl +RUN pip3 install dist/*.whl # << END Build and bind From 2050aa4cf65807d3f1537d27e77e199d10bce78e Mon Sep 17 00:00:00 2001 From: Cem Philipp Freimoser Date: Sun, 28 Apr 2019 17:50:07 +0200 Subject: [PATCH 2/3] make git lfs optinal --- Dockerfile | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index 322b8b2c..9d6d453e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,13 +5,6 @@ FROM nvidia/cuda:10.0-cudnn7-devel-ubuntu18.04 # >> START Install base software -RUN apt-get update && apt-get install -y \ - software-properties-common \ - curl - -RUN add-apt-repository ppa:git-core/ppa && \ - curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash - # Get basic packages RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ @@ -42,8 +35,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ openjdk-8-jdk \ bash-completion \ g++ \ - unzip \ - git-lfs + unzip RUN ln -s -f /usr/bin/python3 /usr/bin/python @@ -146,7 +138,14 @@ ENV LD_LIBRARY_PATH $LD_LIBRARY_PATH:/usr/local/cuda/extras/CUPTI/lib64:/usr/loc # Copy DeepSpeech repo contents to container's /DeepSpeech COPY . /DeepSpeech/ + # Alternative clone from GitHub +# RUN apt-get update && apt-get install -y \ +# software-properties-common \ +# curl +# RUN add-apt-repository ppa:git-core/ppa && \ +# curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash +# RUN apt-get update && apt-get install -y git-lfs # WORKDIR / # RUN git clone https://github.com/mozilla/DeepSpeech.git From 7cfd7b85ddec4b6d67dd4751f5a9fe3dcf8f252d Mon Sep 17 00:00:00 2001 From: Cem Philipp Freimoser Date: Sun, 28 Apr 2019 20:08:31 +0200 Subject: [PATCH 3/3] Removed software-properties-common and curl --- Dockerfile | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9d6d453e..d36a3531 100644 --- a/Dockerfile +++ b/Dockerfile @@ -140,11 +140,6 @@ ENV LD_LIBRARY_PATH $LD_LIBRARY_PATH:/usr/local/cuda/extras/CUPTI/lib64:/usr/loc COPY . /DeepSpeech/ # Alternative clone from GitHub -# RUN apt-get update && apt-get install -y \ -# software-properties-common \ -# curl -# RUN add-apt-repository ppa:git-core/ppa && \ -# curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash # RUN apt-get update && apt-get install -y git-lfs # WORKDIR / # RUN git clone https://github.com/mozilla/DeepSpeech.git