From f8b8d8d48437d5724333048bb017730a884d706c Mon Sep 17 00:00:00 2001 From: Andrey Velichkevich Date: Tue, 18 Jun 2024 07:57:58 +0100 Subject: [PATCH] [SDK] Fix empty list for env variables and numpy version (#2360) * [SDK] Fix empty list for env variables Signed-off-by: Andrey Velichkevich * Fix numpy version in tests Signed-off-by: Andrey Velichkevich --------- Signed-off-by: Andrey Velichkevich --- .../v1beta1/trial-images/darts-cnn-cifar10/Dockerfile.cpu | 6 ++++-- .../v1beta1/trial-images/darts-cnn-cifar10/requirements.txt | 1 - examples/v1beta1/trial-images/pytorch-mnist/Dockerfile.cpu | 3 +++ .../v1beta1/trial-images/pytorch-mnist/requirements.txt | 1 - sdk/python/v1beta1/kubeflow/katib/api/katib_client.py | 4 ++-- 5 files changed, 9 insertions(+), 6 deletions(-) delete mode 100644 examples/v1beta1/trial-images/darts-cnn-cifar10/requirements.txt diff --git a/examples/v1beta1/trial-images/darts-cnn-cifar10/Dockerfile.cpu b/examples/v1beta1/trial-images/darts-cnn-cifar10/Dockerfile.cpu index 00f22a2c709..0b816be381d 100644 --- a/examples/v1beta1/trial-images/darts-cnn-cifar10/Dockerfile.cpu +++ b/examples/v1beta1/trial-images/darts-cnn-cifar10/Dockerfile.cpu @@ -4,10 +4,12 @@ ENV TARGET_DIR /opt/darts-cnn-cifar10 ADD examples/v1beta1/trial-images/darts-cnn-cifar10 ${TARGET_DIR} -WORKDIR ${TARGET_DIR} +WORKDIR ${TARGET_DIR} +# TODO (andreyvelich): This is required since torchvision==0.17.1 is incompatible with numpy 2.0 +RUN pip install numpy==1.26.0 RUN pip install --prefer-binary --no-cache-dir torch==2.2.1 torchvision==0.17.1 -RUN pip install --prefer-binary --no-cache-dir -r requirements.txt + RUN chgrp -R 0 ${TARGET_DIR} \ && chmod -R g+rwX ${TARGET_DIR} diff --git a/examples/v1beta1/trial-images/darts-cnn-cifar10/requirements.txt b/examples/v1beta1/trial-images/darts-cnn-cifar10/requirements.txt deleted file mode 100644 index e20575024df..00000000000 --- a/examples/v1beta1/trial-images/darts-cnn-cifar10/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -Pillow>=9.1.1 diff --git a/examples/v1beta1/trial-images/pytorch-mnist/Dockerfile.cpu b/examples/v1beta1/trial-images/pytorch-mnist/Dockerfile.cpu index 05f1269ca13..277e89df54e 100644 --- a/examples/v1beta1/trial-images/pytorch-mnist/Dockerfile.cpu +++ b/examples/v1beta1/trial-images/pytorch-mnist/Dockerfile.cpu @@ -6,6 +6,9 @@ WORKDIR /opt/pytorch-mnist # Add folder for the logs. RUN mkdir /katib + +# TODO (andreyvelich): This is required since torchvision==0.17.1 is incompatible with numpy 2.0 +RUN pip install numpy==1.26.0 RUN pip install --prefer-binary --no-cache-dir torch==2.2.1 torchvision==0.17.1 RUN pip install --prefer-binary --no-cache-dir -r requirements.txt diff --git a/examples/v1beta1/trial-images/pytorch-mnist/requirements.txt b/examples/v1beta1/trial-images/pytorch-mnist/requirements.txt index 23b6c8aaa07..09fded6c376 100644 --- a/examples/v1beta1/trial-images/pytorch-mnist/requirements.txt +++ b/examples/v1beta1/trial-images/pytorch-mnist/requirements.txt @@ -1,2 +1 @@ cloudml-hypertune==0.1.0.dev6 -Pillow>=9.1.1 diff --git a/sdk/python/v1beta1/kubeflow/katib/api/katib_client.py b/sdk/python/v1beta1/kubeflow/katib/api/katib_client.py index 8be9e52f6da..f6876d322e4 100644 --- a/sdk/python/v1beta1/kubeflow/katib/api/katib_client.py +++ b/sdk/python/v1beta1/kubeflow/katib/api/katib_client.py @@ -386,8 +386,8 @@ def tune( image=base_image, command=["bash", "-c"], args=[exec_script], - env=env, - env_from=env_from, + env=env if env else None, + env_from=env_from if env_from else None, resources=resources_per_trial, ) ],