From 2efd469fed2df5dc696eb25a6d8bf1765324bccc Mon Sep 17 00:00:00 2001 From: Sergei Monakhov Date: Sun, 15 Oct 2023 12:09:59 +0300 Subject: [PATCH] update images --- images/keras/cuda11-8/README.md | 1 + images/keras/cuda11-8/metadata.json | 1 + template/required.j2 | 32 +++++++++++++++++++++-------- 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/images/keras/cuda11-8/README.md b/images/keras/cuda11-8/README.md index c57865d..5ed084e 100644 --- a/images/keras/cuda11-8/README.md +++ b/images/keras/cuda11-8/README.md @@ -4,6 +4,7 @@ Keras ML framework with various python runtime. Non-root Docker image used by Puzl [Kubernetes cloud](https://puzl.cloud) service. Based on [official tensorflow](https://hub.docker.com/r/tensorflow/tensorflow) Docker image. ## Supported languages and interpreter versions +- python3.9 - python3.10 - python3.11 diff --git a/images/keras/cuda11-8/metadata.json b/images/keras/cuda11-8/metadata.json index 882bf2b..c9be066 100644 --- a/images/keras/cuda11-8/metadata.json +++ b/images/keras/cuda11-8/metadata.json @@ -4,6 +4,7 @@ "sourceTag":"2.14.0-gpu", "version": "1.2.0", "interpreters": [ + "python3.9", "python3.10", "python3.11" ], diff --git a/template/required.j2 b/template/required.j2 index 59caa18..719c3fb 100644 --- a/template/required.j2 +++ b/template/required.j2 @@ -106,20 +106,34 @@ RUN curl -o ~/miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest RUN ${INTERPRETER} -m pip install -r /tmp/requirements.txt {% endmacro %} -{%- macro install_pip_package(packages) -%} -RUN ${INTERPRETER} -m pip install \ +{%- macro convert_interpreter_to_cp(interpreter) -%} + {%- if interpreter == "python3.9" -%} + cp39 + {%- elif interpreter == "python3.10" -%} + cp310 + {%- elif interpreter == "python3.11" -%} + cp311 + {%- else -%} + unknown + {%- endif %} +{% endmacro %} + +{%- macro install_pip_package(packages, INTERPRETER) -%} +RUN \ {%- for package in packages -%} - {%- if package.type == "pip" -%} - {% if package.version is defined %} - {{ package.name }}=={{ package.version }} \ + {%- if package.type == "pip" and package.name != "tensorflow" -%} + {%- if package.version is defined %} + ${INTERPRETER} -m pip install {{ package.name }}=={{ package.version }} \ {%- else %} - {{ package.name }} \ + ${INTERPRETER} -m pip install {{ package.name }} \ {%- endif %} + {%- elif package.type == "pip" and package.name == "tensorflow" -%} + ${INTERPRETER} -m pip install https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-{{ package.version }}-{{ convert_interpreter_to_cp(INTERPRETER) }}-{{ convert_interpreter_to_cp(INTERPRETER) }}-manylinux_2_17_x86_64.manylinux2014_x86_64.whl \ {%- endif %} {%- endfor %} - --index-url https://download.pytorch.org/whl/cu118 \ - --extra-index-url https://pypi.org/simple \ - && ${INTERPRETER} -m pip cache purge + --index-url https://download.pytorch.org/whl/cu118 \ + --extra-index-url https://pypi.org/simple \ + && ${INTERPRETER} -m pip cache purge {% endmacro %} {%- macro install_yarn_package(packages) -%}