From 3083054178224f8cc7ccfad3fccd5788f2291ddf Mon Sep 17 00:00:00 2001
From: Xuan Gu <xuan.gu@liu.se>
Date: Thu, 28 Sep 2023 12:13:19 +0000
Subject: [PATCH] Update 2 files

- /PyTorch/Segmentation/nnUNet/benchmark.txt
- /PyTorch/Segmentation/nnUNet/nnunet_for_pytorch_21.11.0.def
---
 PyTorch/Segmentation/nnUNet/benchmark.txt           | 13 ++++++++++---
 .../nnUNet/nnunet_for_pytorch_21.11.0.def           |  4 ++--
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/PyTorch/Segmentation/nnUNet/benchmark.txt b/PyTorch/Segmentation/nnUNet/benchmark.txt
index 5aa121a..9257eb6 100644
--- a/PyTorch/Segmentation/nnUNet/benchmark.txt
+++ b/PyTorch/Segmentation/nnUNet/benchmark.txt
@@ -24,6 +24,13 @@ apptainer exec --nv --pwd /workspace/nnunet_pyt $CONTAINER_DIR python scripts/be
 apptainer exec --nv --pwd /workspace/nnunet_pyt $CONTAINER_DIR python scripts/benchmark.py --mode predict --gpus 1 --dim 2 --batch_size 256 --amp
 
 
-# Known issue 
-# ImportError: cannot import name 'get_num_classes' from 'torchmetrics.utilities.data' (/opt/conda/lib/python3.8/site-packages/torchmetrics/utilities/data.py)
-https://github.com/NVIDIA/DeepLearningExamples/issues/1113
+# Known issue https://github.com/NVIDIA/DeepLearningExamples/issues/1113
+ImportError: cannot import name 'get_num_classes' from 'torchmetrics.utilities.data' (/opt/conda/lib/python3.8/site-packages/torchmetrics/utilities/data.py)
+
+Solution: pip install pytorch-lightning==1.5.10, another error raised when benchmarking predict:
+Traceback (most recent call last):
+  File "main.py", line 110, in <module>
+    trainer.current_epoch = 1
+AttributeError: can't set attribute
+
+# 2023-09-28: Not working on the devel reservation
\ No newline at end of file
diff --git a/PyTorch/Segmentation/nnUNet/nnunet_for_pytorch_21.11.0.def b/PyTorch/Segmentation/nnUNet/nnunet_for_pytorch_21.11.0.def
index ddb60ce..810c9c2 100644
--- a/PyTorch/Segmentation/nnUNet/nnunet_for_pytorch_21.11.0.def
+++ b/PyTorch/Segmentation/nnUNet/nnunet_for_pytorch_21.11.0.def
@@ -16,12 +16,12 @@ cd /workspace/nnunet_pyt
 wget --content-disposition https://api.ngc.nvidia.com/v2/resources/nvidia/nnunet_for_pytorch/versions/$VERSION/zip -O nnunet_for_pytorch_$VERSION.zip
 unzip nnunet_for_pytorch_21.11.0.zip
 
-sed 's/pytorch-lightning==1.3.8/pytorch-lightning==1.5.10/g' requirements.txt > temp_file && mv temp_file requirements.txt
+#sed 's/pytorch-lightning==1.3.8/pytorch-lightning==1.5.10/g' requirements.txt > temp_file && mv temp_file requirements.txt
 pip install --disable-pip-version-check -r requirements.txt
 pip install monai==0.8.0 --no-dependencies
 pip uninstall -y torchtext 
 # Fix for https://github.com/NVIDIA/DeepLearningExamples/issues/1113
-#pip install torchmetrics==0.6.0
+pip install torchmetrics==0.6.0
 
 curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
 unzip -qq awscliv2.zip
-- 
GitLab