From 53eb14545961075133a17d350f92c98d5beb10c7 Mon Sep 17 00:00:00 2001 From: hongbozheng <112345628+hongbozheng@users.noreply.github.com> Date: Tue, 9 Jul 2024 14:24:49 -0500 Subject: [PATCH 1/4] correct forward operations order --- GANDLF/models/seg_modules/DownsamplingModule.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GANDLF/models/seg_modules/DownsamplingModule.py b/GANDLF/models/seg_modules/DownsamplingModule.py index ab4a54ff3..2ccf3ba41 100644 --- a/GANDLF/models/seg_modules/DownsamplingModule.py +++ b/GANDLF/models/seg_modules/DownsamplingModule.py @@ -57,6 +57,6 @@ def forward(self, x): Returns: torch.Tensor: The output tensor, of shape (batch_size, output_channels, height // 2, width // 2). """ - x = self.act(self.in_0(self.conv0(x))) + x = self.conv0(self.act(self.in_0(x))) return x From 346e7c22885cbbc8b563b3d5af6da03806f47af6 Mon Sep 17 00:00:00 2001 From: Sarthak Pati Date: Tue, 9 Jul 2024 13:31:22 -0600 Subject: [PATCH 2/4] fixed pip version for CI tests --- .devcontainer/onCreateCommand.sh | 2 +- .github/workflows/black.yml | 2 +- .github/workflows/main.yml | 2 +- .github/workflows/mlcube-test.yml | 2 +- .github/workflows/openfl-test.yml | 2 +- .github/workflows/publish-nightly.yml | 2 +- .github/workflows/python-test.yml | 2 +- Dockerfile-CPU | 2 +- Dockerfile-CUDA11.8 | 2 +- Dockerfile-CUDA12.1 | 2 +- Dockerfile-ROCm | 4 ++-- 11 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.devcontainer/onCreateCommand.sh b/.devcontainer/onCreateCommand.sh index baf4c7aa0..2d8463aef 100755 --- a/.devcontainer/onCreateCommand.sh +++ b/.devcontainer/onCreateCommand.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash python -m ensurepip # ensures pip is installed in the current environment -pip install --upgrade pip +pip install --upgrade pip==24.0 pip install wheel pip install openvino-dev==2023.0.1 # [OPTIONAL] to generate optimized models for inference pip install mlcube_docker # [OPTIONAL] to deploy GaNDLF models as MLCube-compliant Docker containers diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml index 64421525b..3e7fd0864 100644 --- a/.github/workflows/black.yml +++ b/.github/workflows/black.yml @@ -27,7 +27,7 @@ jobs: - name: Install dependencies run: | - python -m pip install --upgrade pip + python -m pip install --upgrade pip==24.0 python -m pip install black==${{ env.BLACK_VERSION }} - name: Run tests diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 03c911647..ba5e79b7a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -38,7 +38,7 @@ jobs: ${{ runner.os }}-pip- - name: Install dependencies run: | - python -m pip install --upgrade pip + python -m pip install --upgrade pip==24.0 pip install scikit-build pip install -e . pip install build diff --git a/.github/workflows/mlcube-test.yml b/.github/workflows/mlcube-test.yml index 064f6a053..69a94fa31 100644 --- a/.github/workflows/mlcube-test.yml +++ b/.github/workflows/mlcube-test.yml @@ -70,7 +70,7 @@ jobs: run: | sudo apt-get update sudo apt-get install libvips libvips-tools -y - python -m pip install --upgrade pip + python -m pip install --upgrade pip==24.0 python -m pip install wheel python -m pip install openvino-dev==2023.0.1 mlcube_docker pip install torch==2.1.2 torchvision==0.16.2 torchaudio==2.1.2 --index-url https://download.pytorch.org/whl/cpu diff --git a/.github/workflows/openfl-test.yml b/.github/workflows/openfl-test.yml index 6caa31e97..727a13de0 100644 --- a/.github/workflows/openfl-test.yml +++ b/.github/workflows/openfl-test.yml @@ -71,7 +71,7 @@ jobs: run: | sudo apt-get update sudo apt-get install libvips libvips-tools -y - python -m pip install --upgrade pip + python -m pip install --upgrade pip==24.0 python -m pip install wheel pip install torch==2.1.2 torchvision==0.16.2 torchaudio==2.1.2 --index-url https://download.pytorch.org/whl/cpu pip install -e . diff --git a/.github/workflows/publish-nightly.yml b/.github/workflows/publish-nightly.yml index 21185fd86..d296bcff6 100644 --- a/.github/workflows/publish-nightly.yml +++ b/.github/workflows/publish-nightly.yml @@ -52,7 +52,7 @@ jobs: - name: Install dependencies if: env.publish_nightly run: | - python -m pip install --upgrade pip + python -m pip install --upgrade pip==24.0 pip install scikit-build pip install -e . pip install build diff --git a/.github/workflows/python-test.yml b/.github/workflows/python-test.yml index 6513c5109..c220b7a19 100644 --- a/.github/workflows/python-test.yml +++ b/.github/workflows/python-test.yml @@ -71,7 +71,7 @@ jobs: run: | sudo apt-get update sudo apt-get install libvips libvips-tools -y - python -m pip install --upgrade pip + python -m pip install --upgrade pip==24.0 python -m pip install wheel python -m pip install openvino-dev==2023.0.1 mlcube_docker pip install torch==2.1.2 torchvision==0.16.2 torchaudio==2.1.2 --index-url https://download.pytorch.org/whl/cpu diff --git a/Dockerfile-CPU b/Dockerfile-CPU index df066d294..1cb510679 100644 --- a/Dockerfile-CPU +++ b/Dockerfile-CPU @@ -7,7 +7,7 @@ LABEL version=1.0 RUN apt-get update && apt-get install -y software-properties-common RUN add-apt-repository ppa:deadsnakes/ppa RUN apt-get update && apt-get install -y python3.9 python3-pip libjpeg8-dev zlib1g-dev python3-dev libpython3.9-dev libffi-dev libgl1 -RUN python3.9 -m pip install --upgrade pip +RUN python3.9 -m pip install --upgrade pip==24.0 # EXPLICITLY install cpu versions of torch/torchvision (not all versions have +cpu modes on PyPI...) RUN python3.9 -m pip install torch==2.1.2 torchvision==0.16.2 torchaudio==2.1.2 --index-url https://download.pytorch.org/whl/cpu RUN python3.9 -m pip install openvino-dev==2023.0.1 opencv-python-headless mlcube_docker diff --git a/Dockerfile-CUDA11.8 b/Dockerfile-CUDA11.8 index bc4817868..9d5de251f 100644 --- a/Dockerfile-CUDA11.8 +++ b/Dockerfile-CUDA11.8 @@ -11,7 +11,7 @@ ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install -y software-properties-common RUN add-apt-repository ppa:deadsnakes/ppa RUN apt-get update && apt-get install -y python3.9 python3-pip libjpeg8-dev zlib1g-dev python3-dev libpython3.9-dev libffi-dev libgl1 -RUN python3.9 -m pip install --upgrade pip +RUN python3.9 -m pip install --upgrade pip==24.0 RUN python3.9 -m pip install torch==2.1.2 torchvision==0.16.2 torchaudio==2.1.2 --index-url https://download.pytorch.org/whl/cu118 RUN python3.9 -m pip install openvino-dev==2023.0.1 opencv-python-headless mlcube_docker diff --git a/Dockerfile-CUDA12.1 b/Dockerfile-CUDA12.1 index 5a520397d..8d4bc90f8 100644 --- a/Dockerfile-CUDA12.1 +++ b/Dockerfile-CUDA12.1 @@ -11,7 +11,7 @@ ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install -y software-properties-common RUN add-apt-repository ppa:deadsnakes/ppa RUN apt-get update && apt-get install -y python3.9 python3-pip libjpeg8-dev zlib1g-dev python3-dev libpython3.9-dev libffi-dev libgl1 -RUN python3.9 -m pip install --upgrade pip +RUN python3.9 -m pip install --upgrade pip==24.0 RUN python3.9 -m pip install torch==2.1.2 torchvision==0.16.2 torchaudio==2.1.2 --index-url https://download.pytorch.org/whl/cu121 RUN python3.9 -m pip install openvino-dev==2023.0.1 opencv-python-headless mlcube_docker diff --git a/Dockerfile-ROCm b/Dockerfile-ROCm index ee5d7dff8..8c81089fe 100644 --- a/Dockerfile-ROCm +++ b/Dockerfile-ROCm @@ -9,9 +9,9 @@ LABEL version=1.0 RUN apt-get update && apt-get install -y software-properties-common RUN add-apt-repository ppa:deadsnakes/ppa RUN apt-get update && apt-get install -y python3.9 python3-pip libjpeg8-dev zlib1g-dev python3-dev libpython3.9-dev libffi-dev libgl1 -RUN python3.9 -m pip install --upgrade pip +RUN python3.9 -m pip install --upgrade pip==24.0 RUN python3.9 -m pip install torch==2.1.2 torchvision==0.16.2 torchaudio==2.1.2 --index-url https://download.pytorch.org/whl/rocm5.6 -RUN python3.9 -m pip install --upgrade pip && python3.9 -m pip install openvino-dev==2023.0.1 opencv-python-headless mlcube_docker +RUN python3.9 -m pip install --upgrade pip==24.0 && python3.9 -m pip install openvino-dev==2023.0.1 opencv-python-headless mlcube_docker RUN apt-get update && apt-get install -y libgl1 # Do some dependency installation separately here to make layer caching more efficient From df8627113ebf4c60f646e73a63aea0ccb81c420e Mon Sep 17 00:00:00 2001 From: Sarthak Pati Date: Tue, 9 Jul 2024 15:47:33 -0400 Subject: [PATCH 3/4] removed additional space --- GANDLF/models/seg_modules/DownsamplingModule.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GANDLF/models/seg_modules/DownsamplingModule.py b/GANDLF/models/seg_modules/DownsamplingModule.py index 2ccf3ba41..24c92ce77 100644 --- a/GANDLF/models/seg_modules/DownsamplingModule.py +++ b/GANDLF/models/seg_modules/DownsamplingModule.py @@ -49,7 +49,7 @@ def forward(self, x): """ Applies a downsampling operation to the input tensor. - [input -- > in --> lrelu --> ConvDS --> output] + [input --> in --> lrelu --> ConvDS --> output] Args: x (torch.Tensor): Input tensor of shape (batch_size, channels, height, width) From 2cb0ac094267e45a2c5c76885969b998fb828ace Mon Sep 17 00:00:00 2001 From: hongbozheng <112345628+hongbozheng@users.noreply.github.com> Date: Tue, 9 Jul 2024 20:19:24 -0500 Subject: [PATCH 4/4] Corrected forward operations order and norm layer parameter --- GANDLF/models/seg_modules/DownsamplingModule.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GANDLF/models/seg_modules/DownsamplingModule.py b/GANDLF/models/seg_modules/DownsamplingModule.py index 24c92ce77..10eded967 100644 --- a/GANDLF/models/seg_modules/DownsamplingModule.py +++ b/GANDLF/models/seg_modules/DownsamplingModule.py @@ -39,7 +39,7 @@ def __init__( if act_kwargs is None: act_kwargs = {"negative_slope": 1e-2, "inplace": True} - self.in_0 = norm(output_channels, **norm_kwargs) + self.in_0 = norm(input_channels, **norm_kwargs) self.conv0 = conv(input_channels, output_channels, **conv_kwargs)