From 48df89ba7da5c3a93b56c4399f53a7c11d4c8210 Mon Sep 17 00:00:00 2001
From: Xuan Gu <xuan.gu@liu.se>
Date: Wed, 27 Sep 2023 20:21:21 +0000
Subject: [PATCH] Update 2 files

- /PyTorch/Segmentation/nnUNet/build.txt
- /PyTorch/Segmentation/nnUNet/nnunet_for_pytorch.def
---
 PyTorch/Segmentation/nnUNet/build.txt         | 26 ++++++++++++++++++-
 .../nnUNet/nnunet_for_pytorch.def             |  2 ++
 2 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/PyTorch/Segmentation/nnUNet/build.txt b/PyTorch/Segmentation/nnUNet/build.txt
index 26d71ae..8adaefb 100644
--- a/PyTorch/Segmentation/nnUNet/build.txt
+++ b/PyTorch/Segmentation/nnUNet/build.txt
@@ -1,8 +1,32 @@
+https://catalog.ngc.nvidia.com/orgs/nvidia/resources/nnunet_for_pytorch/quick-start-guide
+
 apptainer build containers/nvidia_pytorch_21.11-py3.sif  docker://nvcr.io/nvidia/pytorch:21.11-py3
 
 
+gotesting
+
 MODULE_NAME=nnunet_for_pytorch
 MODULE_VERSION=21.11.0
-gotesting
+
 apptainer build ./containers/${MODULE_NAME}_${MODULE_VERSION}.sif ./berzelius-benchmarks/${MODULE_NAME}.def
 
+
+WORK_DIR=/proj/nsc_testing/xuan/berzelius-benchmarks/PyTorch/Segmentation/nnUNet
+CONTAINER_DIR=/proj/nsc_testing/xuan/containers/${MODULE_NAME}_${MODULE_VERSION}.sif
+
+cd $WORK_DIR
+mkdir -p data results
+
+
+To download and preprocess the data run:
+
+apptainer exec --nv --pwd /workspace/nnunet_pyt $CONTAINER_DIR python download.py --task 01 --results $WORK_DIR/data
+
+apptainer exec --nv --pwd /workspace/nnunet_pyt $CONTAINER_DIR  python /workspace/nnunet_pyt/preprocess.py --task 01 --data $WORK_DIR/data --results $WORK_DIR/results
+ 
+
+apptainer exec --nv --pwd /workspace/nnunet_pyt $CONTAINER_DIR python scripts/benchmark.py --mode train --gpus 1 --dim 2 --batch_size 128 --amp
+
+
+# Known issue 
+https://github.com/NVIDIA/DeepLearningExamples/issues/1113
diff --git a/PyTorch/Segmentation/nnUNet/nnunet_for_pytorch.def b/PyTorch/Segmentation/nnUNet/nnunet_for_pytorch.def
index f580334..c9f11ed 100644
--- a/PyTorch/Segmentation/nnUNet/nnunet_for_pytorch.def
+++ b/PyTorch/Segmentation/nnUNet/nnunet_for_pytorch.def
@@ -16,6 +16,8 @@ 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
 
+# Fix for https://github.com/NVIDIA/DeepLearningExamples/issues/1113
+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
-- 
GitLab