Skip to content

Commit eef05e8

Browse files
authored
update 3d seg demo (#326)
Signed-off-by: Wenqi Li <[email protected]>
1 parent 4f82b6e commit eef05e8

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

3d_segmentation/spleen_segmentation_3d_lightning.ipynb

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"source": [
6161
"!python -c \"import monai\" || pip install -q \"monai-weekly[nibabel]\"\n",
6262
"!python -c \"import matplotlib\" || pip install -q matplotlib\n",
63-
"!pip install -q pytorch-lightning==0.9.0\n",
63+
"!pip install -q pytorch-lightning==1.4.0\n",
6464
"%matplotlib inline"
6565
]
6666
},
@@ -145,8 +145,6 @@
145145
"from monai.apps import download_and_extract\n",
146146
"import torch\n",
147147
"import pytorch_lightning\n",
148-
"from pytorch_lightning.callbacks.model_checkpoint \\\n",
149-
" import ModelCheckpoint\n",
150148
"import matplotlib.pyplot as plt\n",
151149
"import tempfile\n",
152150
"import shutil\n",
@@ -424,17 +422,13 @@
424422
"tb_logger = pytorch_lightning.loggers.TensorBoardLogger(\n",
425423
" save_dir=log_dir\n",
426424
")\n",
427-
"checkpoint_callback = ModelCheckpoint(\n",
428-
" filepath=os.path.join(\n",
429-
" log_dir, \"{epoch}-{val_loss:.2f}-{val_dice:.2f}\")\n",
430-
")\n",
431425
"\n",
432426
"# initialise Lightning's trainer.\n",
433427
"trainer = pytorch_lightning.Trainer(\n",
434428
" gpus=[0],\n",
435429
" max_epochs=600,\n",
436430
" logger=tb_logger,\n",
437-
" checkpoint_callback=checkpoint_callback,\n",
431+
" checkpoint_callback=True,\n",
438432
" num_sanity_val_steps=1,\n",
439433
")\n",
440434
"\n",
@@ -710,7 +704,7 @@
710704
"name": "python",
711705
"nbconvert_exporter": "python",
712706
"pygments_lexer": "ipython3",
713-
"version": "3.8.10"
707+
"version": "3.7.10"
714708
}
715709
},
716710
"nbformat": 4,

0 commit comments

Comments
 (0)