Skip to content

Commit 521f3e9

Browse files
authored
Merge branch 'main' into docs/fix-typo-unet-metadata
2 parents 43f0943 + 9948f26 commit 521f3e9

File tree

3 files changed

+47
-2
lines changed

3 files changed

+47
-2
lines changed

README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,50 @@ Running:
4141

4242
in a cell will verify this has worked and show you what kind of hardware you have access to.
4343

44+
#### Google Colab Setup (CUDA 12.x, PyTorch 2.6, MONAI 1.5)
45+
46+
In Google Colab, the default environment may cause version conflicts with MONAI.
47+
To ensure compatibility, install PyTorch and MONAI explicitly as follows:
48+
49+
# Install PyTorch 2.6.0 with CUDA 12.4
50+
pip install --index-url https://download.pytorch.org/whl/cu124 \
51+
torch==2.6.0 torchvision==0.21.0 torchaudio==2.6.0
52+
53+
# Install MONAI and common dependencies
54+
pip install "monai[all]" nibabel pydicom ipywidgets==8.1.2
55+
56+
57+
### Known issues and fixes
58+
59+
- Torchaudio mismatch
60+
Colab may come with torchaudio 2.8.0, which is incompatible with torch 2.6.0.
61+
Installing the versions above resolves this issue.
62+
63+
- filelock conflicts with nni
64+
Some preinstalled packages (such as pytensor with newer filelock) may conflict.
65+
Use the following commands to fix:
66+
67+
pip uninstall -y pytensor
68+
pip install -U filelock
69+
70+
- Too many workers warning
71+
Colab has limited CPU resources, and high num_workers settings may freeze execution.
72+
It is recommended to use --num_workers=2 when running tutorials and adjust the `num_workers` parameters where it is used in notebooks (eg. for data loaders).
73+
74+
75+
### Quick smoke test
76+
77+
After installation, verify the environment by running:
78+
79+
git clone https://github.com/Project-MONAI/tutorials.git
80+
cd tutorials/3d_segmentation/torch
81+
python -u unet_training_array.py --max_epochs 2 --batch_size 1 --num_workers 2
82+
83+
If the logs show decreasing training loss and a Dice score, the setup is correct.
84+
85+
**Note:** In most cases, users can run MONAI tutorials directly in Colab notebooks without additional installation.
86+
The steps above are mainly for resolving dependency conflicts when installing extra packages.
87+
4488
#### Data
4589

4690
Some notebooks will require additional data.

generation/maisi/maisi_train_vae_tutorial.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,7 @@
692692
},
693693
{
694694
"cell_type": "code",
695-
"execution_count": 14,
695+
"execution_count": null,
696696
"id": "4c251a32-390f-46dd-a613-75b12a7884c1",
697697
"metadata": {
698698
"scrolled": true
@@ -850,7 +850,7 @@
850850
" with torch.no_grad():\n",
851851
" with autocast(\"cuda\", enabled=args.amp):\n",
852852
" images = batch[\"image\"]\n",
853-
" reconstruction, _, _ = dynamic_infer(val_inferer, autoencoder, images)\n",
853+
" reconstruction, z_mu, z_sigma = dynamic_infer(val_inferer, autoencoder, images)\n",
854854
" reconstruction = reconstruction.to(device)\n",
855855
" val_epoch_losses[\"recons_loss\"] += intensity_loss(reconstruction, images.to(device)).item()\n",
856856
" val_epoch_losses[\"kl_loss\"] += KL_loss(z_mu, z_sigma).item()\n",

runner.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ skip_run_papermill=("${skip_run_papermill[@]}" .*unet_segmentation_3d_ignite_cle
131131
skip_run_papermill=("${skip_run_papermill[@]}" .*vista_2d_tutorial_monai.ipynb*)
132132
skip_run_papermill=("${skip_run_papermill[@]}" .*learn2reg_oasis_unpaired_brain_mr.ipynb*)
133133
skip_run_papermill=("${skip_run_papermill[@]}" .*finetune_vista3d_for_hugging_face_pipeline.ipynb*)
134+
skip_run_papermill=("${skip_run_papermill[@]}" .*TCIA_PROSTATEx_Prostate_MRI_Anatomy_Model.ipynb*) # https://github.com/Project-MONAI/tutorials/issues/2029
134135

135136
# output formatting
136137
separator=""

0 commit comments

Comments
 (0)