From b06f9b746839e0307628a34b0309ec29a4ce303e Mon Sep 17 00:00:00 2001 From: otaj <6065855+otaj@users.noreply.github.com> Date: Thu, 29 Sep 2022 11:55:12 +0200 Subject: [PATCH] Improve building times of IPU docker image (#14934) --- dockers/base-ipu/Dockerfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dockers/base-ipu/Dockerfile b/dockers/base-ipu/Dockerfile index af1f615034..3132766cfb 100644 --- a/dockers/base-ipu/Dockerfile +++ b/dockers/base-ipu/Dockerfile @@ -18,6 +18,7 @@ LABEL maintainer="Lightning-AI " ARG PYTHON_VERSION=3.9 ARG CONDA_VERSION=4.9.2 +ARG PYTORCH_VERSION=1.9 SHELL ["/bin/bash", "-c"] @@ -56,13 +57,12 @@ ENV \ COPY environment.yml environment.yml -RUN conda create -y --name $CONDA_ENV python=${PYTHON_VERSION} pytorch=${PYTORCH_VERSION} cudatoolkit=${CUDA_VERSION} -c pytorch && \ - conda init bash && \ +RUN conda init bash && \ python -c "import re ; fname = 'environment.yml' ; req = re.sub(r'python>=[\d\.]+', 'python=${PYTHON_VERSION}', open(fname).read()) ; open(fname, 'w').write(req)" && \ - python -c "import re ; fname = 'environment.yml' ; req = re.sub(r'- pytorch[>=]+[\d\.]+', '# - pytorch=${PYTORCH_VERSION}', open(fname).read()) ; open(fname, 'w').write(req)" && \ + python -c "import re ; fname = 'environment.yml' ; req = re.sub(r'- pytorch[>=]+[\d\.]+', '- pytorch=${PYTORCH_VERSION}', open(fname).read()) ; open(fname, 'w').write(req)" && \ python -c "fname = 'environment.yml' ; req = open(fname).readlines() ; open(fname, 'w').writelines([ln for ln in req if not any(n in ln for n in ['pytorch>', 'horovod'])])" && \ cat environment.yml && \ - conda env update --file environment.yml && \ + conda env create -f environment.yml && \ conda clean -ya && \ rm environment.yml