Skip to content

Commit 29fba69

Browse files
KumoLiuericspod
andauthored
Make notebooks under bundle folder runable (Project-MONAI#1831)
### Checks <!--- Put an `x` in all the boxes that apply, and remove the not applicable items --> - [ ] Avoid including large-size files in the PR. - [ ] Clean up long text outputs from code cells in the notebook. - [ ] For security purposes, please check the contents and remove any sensitive info such as user names and private key. - [ ] Ensure (1) hyperlinks and markdown anchors are working (2) use relative paths for tutorial repo files (3) put figure and graphs in the `./figure` folder - [ ] Notebook runs automatically `./runner.sh -t <path to .ipynb file>` --------- Signed-off-by: YunLiu <[email protected]> Co-authored-by: Eric Kerfoot <[email protected]>
1 parent 11c2266 commit 29fba69

6 files changed

+408
-466
lines changed

bundle/01_bundle_intro.ipynb

Lines changed: 118 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
},
2828
{
2929
"cell_type": "code",
30-
"execution_count": null,
30+
"execution_count": 1,
3131
"id": "1bf88e03-1c87-4901-9cfb-9c626d454b98",
3232
"metadata": {},
3333
"outputs": [],
@@ -101,7 +101,7 @@
101101
},
102102
{
103103
"cell_type": "code",
104-
"execution_count": 1,
104+
"execution_count": 3,
105105
"id": "a1d9d107-58d6-4ed8-9cf1-6e9103e78a92",
106106
"metadata": {},
107107
"outputs": [
@@ -140,7 +140,7 @@
140140
},
141141
{
142142
"cell_type": "code",
143-
"execution_count": 2,
143+
"execution_count": 4,
144144
"id": "3e19c030-4e03-4a96-a127-ee0daa604052",
145145
"metadata": {},
146146
"outputs": [
@@ -153,10 +153,10 @@
153153
" \"changelog\": {\n",
154154
" \"0.0.1\": \"Initial version\"\n",
155155
" },\n",
156-
" \"monai_version\": \"1.2.0\",\n",
157-
" \"pytorch_version\": \"2.0.0\",\n",
158-
" \"numpy_version\": \"1.23.5\",\n",
159-
" \"optional_packages_version\": {},\n",
156+
" \"monai_version\": \"1.4.0\",\n",
157+
" \"pytorch_version\": \"2.5.0\",\n",
158+
" \"numpy_version\": \"1.24.4\",\n",
159+
" \"required_packages_version\": {},\n",
160160
" \"task\": \"Describe what the network predicts\",\n",
161161
" \"description\": \"A longer description of what the network does, use context, inputs, outputs, etc.\",\n",
162162
" \"authors\": \"Your Name Here\",\n",
@@ -183,7 +183,7 @@
183183
},
184184
{
185185
"cell_type": "code",
186-
"execution_count": 2,
186+
"execution_count": 5,
187187
"id": "a56e4833-171c-432c-8145-f325fad3bfcb",
188188
"metadata": {},
189189
"outputs": [
@@ -206,7 +206,7 @@
206206
" \"monai_version\": \"1.2.0\",\n",
207207
" \"pytorch_version\": \"2.0.0\",\n",
208208
" \"numpy_version\": \"1.23.5\",\n",
209-
" \"optional_packages_version\": {},\n",
209+
" \"required_packages_version\": {},\n",
210210
" \"name\": \"TestBundle\",\n",
211211
" \"task\": \"Demonstration Bundle Network\",\n",
212212
" \"description\": \"This is a demonstration bundle meant to showcase features of the MONAI bundle system only and does nothing useful\",\n",
@@ -238,7 +238,7 @@
238238
},
239239
{
240240
"cell_type": "code",
241-
"execution_count": 32,
241+
"execution_count": 6,
242242
"id": "63322909-1a24-426e-a744-39452cdff14f",
243243
"metadata": {},
244244
"outputs": [
@@ -288,67 +288,61 @@
288288
},
289289
{
290290
"cell_type": "code",
291-
"execution_count": 33,
291+
"execution_count": 7,
292292
"id": "7968ceb4-89ef-40a9-ac9b-f048c6cca73b",
293293
"metadata": {},
294294
"outputs": [
295295
{
296296
"name": "stdout",
297297
"output_type": "stream",
298298
"text": [
299-
"2023-07-14 15:34:52,646 - INFO - --- input summary of monai.bundle.scripts.run ---\n",
300-
"2023-07-14 15:34:52,647 - INFO - > run_id: 'test_config'\n",
301-
"2023-07-14 15:34:52,647 - INFO - > meta_file: './TestBundle/configs/metadata.json'\n",
302-
"2023-07-14 15:34:52,647 - INFO - > config_file: './TestBundle/configs/test_config.yaml'\n",
303-
"2023-07-14 15:34:52,647 - INFO - ---\n",
299+
"2024-09-18 08:15:12,299 - INFO - --- input summary of monai.bundle.scripts.run ---\n",
300+
"2024-09-18 08:15:12,299 - INFO - > config_file: './TestBundle/configs/test_config.yaml'\n",
301+
"2024-09-18 08:15:12,299 - INFO - > meta_file: './TestBundle/configs/metadata.json'\n",
302+
"2024-09-18 08:15:12,299 - INFO - > run_id: 'test_config'\n",
303+
"2024-09-18 08:15:12,299 - INFO - ---\n",
304304
"\n",
305305
"\n"
306306
]
307307
},
308-
{
309-
"name": "stderr",
310-
"output_type": "stream",
311-
"text": [
312-
"/home/localek10/workspace/monai/MONAI_mine/monai/bundle/workflows.py:213: UserWarning: Default logging file in 'configs/logging.conf' does not exist, skipping logging.\n",
313-
" warnings.warn(\"Default logging file in 'configs/logging.conf' does not exist, skipping logging.\")\n"
314-
]
315-
},
316308
{
317309
"name": "stdout",
318310
"output_type": "stream",
319311
"text": [
320-
"MONAI version: 1.2.0\n",
321-
"Numpy version: 1.23.5\n",
322-
"Pytorch version: 2.0.0\n",
312+
"MONAI version: 1.4.0\n",
313+
"Numpy version: 1.24.4\n",
314+
"Pytorch version: 2.5.0a0+872d972e41.nv24.08\n",
323315
"MONAI flags: HAS_EXT = False, USE_COMPILED = False, USE_META_DICT = False\n",
324-
"MONAI rev id: c33f1ba588ee00229a309000e888f9817b4f1934\n",
325-
"MONAI __file__: /home/localek10/workspace/monai/MONAI_mine/monai/__init__.py\n",
316+
"MONAI rev id: ab3ee18ba32bb9bd67cd3a55717684bbd343c94c\n",
317+
"MONAI __file__: /workspace/Code/MONAI/monai/__init__.py\n",
326318
"\n",
327319
"Optional dependencies:\n",
328-
"Pytorch Ignite version: 0.4.12\n",
329-
"ITK version: NOT INSTALLED or UNKNOWN VERSION.\n",
330-
"Nibabel version: 5.0.1\n",
331-
"scikit-image version: NOT INSTALLED or UNKNOWN VERSION.\n",
332-
"Pillow version: 9.4.0\n",
333-
"Tensorboard version: NOT INSTALLED or UNKNOWN VERSION.\n",
334-
"gdown version: NOT INSTALLED or UNKNOWN VERSION.\n",
335-
"TorchVision version: 0.15.0\n",
336-
"tqdm version: 4.65.0\n",
337-
"lmdb version: NOT INSTALLED or UNKNOWN VERSION.\n",
338-
"psutil version: 5.9.0\n",
339-
"pandas version: 1.5.3\n",
340-
"einops version: 0.6.1\n",
341-
"transformers version: NOT INSTALLED or UNKNOWN VERSION.\n",
342-
"mlflow version: NOT INSTALLED or UNKNOWN VERSION.\n",
343-
"pynrrd version: NOT INSTALLED or UNKNOWN VERSION.\n",
320+
"Pytorch Ignite version: 0.4.11\n",
321+
"ITK version: 5.4.0\n",
322+
"Nibabel version: 5.2.1\n",
323+
"scikit-image version: 0.23.2\n",
324+
"scipy version: 1.14.0\n",
325+
"Pillow version: 10.4.0\n",
326+
"Tensorboard version: 2.16.2\n",
327+
"gdown version: 5.2.0\n",
328+
"TorchVision version: 0.20.0a0\n",
329+
"tqdm version: 4.66.5\n",
330+
"lmdb version: 1.5.1\n",
331+
"psutil version: 6.0.0\n",
332+
"pandas version: 2.2.2\n",
333+
"einops version: 0.8.0\n",
334+
"transformers version: 4.40.2\n",
335+
"mlflow version: 2.16.0\n",
336+
"pynrrd version: 1.0.0\n",
337+
"clearml version: 1.16.4\n",
344338
"\n",
345339
"For details about installing the optional dependencies, please visit:\n",
346340
" https://docs.monai.io/en/latest/installation.html#installing-the-recommended-dependencies\n",
347341
"\n",
348-
"Test tensor: tensor([[0.5281, 0.1114, 0.5124, 0.2523],\n",
349-
" [0.6561, 0.0298, 0.6393, 0.8636],\n",
350-
" [0.3730, 0.8315, 0.1390, 0.6233],\n",
351-
" [0.2646, 0.8929, 0.5250, 0.0472]], device='cuda:0')\n"
342+
"Test tensor: tensor([[0.7786, 0.5913, 0.6661, 0.2732],\n",
343+
" [0.6756, 0.3978, 0.7760, 0.7936],\n",
344+
" [0.0093, 0.6293, 0.1988, 0.0280],\n",
345+
" [0.8460, 0.5727, 0.6339, 0.7825]], device='cuda:0')\n"
352346
]
353347
}
354348
],
@@ -384,15 +378,15 @@
384378
},
385379
{
386380
"cell_type": "code",
387-
"execution_count": 30,
381+
"execution_count": 8,
388382
"id": "cb762695-8c5d-4f42-9c29-eb6260990b0c",
389383
"metadata": {},
390384
"outputs": [
391385
{
392386
"name": "stdout",
393387
"output_type": "stream",
394388
"text": [
395-
"Overwriting TestBundle/configs/test_object.yaml\n"
389+
"Writing TestBundle/configs/test_object.yaml\n"
396390
]
397391
}
398392
],
@@ -415,24 +409,30 @@
415409
},
416410
{
417411
"cell_type": "code",
418-
"execution_count": 31,
412+
"execution_count": 9,
419413
"id": "2cd1287c-f287-4831-bfc7-4cbdc394a3a1",
420414
"metadata": {},
421415
"outputs": [
422416
{
423417
"name": "stdout",
424418
"output_type": "stream",
425419
"text": [
426-
"2023-07-14 15:28:36,063 - INFO - --- input summary of monai.bundle.scripts.run ---\n",
427-
"2023-07-14 15:28:36,063 - INFO - > run_id: 'test'\n",
428-
"2023-07-14 15:28:36,063 - INFO - > meta_file: './TestBundle/configs/metadata.json'\n",
429-
"2023-07-14 15:28:36,063 - INFO - > config_file: './TestBundle/configs/test_object.yaml'\n",
430-
"2023-07-14 15:28:36,063 - INFO - ---\n",
431-
"\n",
420+
"2024-09-18 08:15:22,338 - INFO - --- input summary of monai.bundle.scripts.run ---\n",
421+
"2024-09-18 08:15:22,338 - INFO - > config_file: './TestBundle/configs/test_object.yaml'\n",
422+
"2024-09-18 08:15:22,338 - INFO - > meta_file: './TestBundle/configs/metadata.json'\n",
423+
"2024-09-18 08:15:22,338 - INFO - > run_id: 'test'\n",
424+
"2024-09-18 08:15:22,338 - INFO - ---\n",
432425
"\n",
433-
"Dataset <monai.data.dataset.Dataset object at 0x7fa6d117f100>\n",
426+
"\n"
427+
]
428+
},
429+
{
430+
"name": "stdout",
431+
"output_type": "stream",
432+
"text": [
433+
"Dataset <monai.data.dataset.Dataset object at 0x7f1777fd7b20>\n",
434434
"Size 10\n",
435-
"Transform member None\n",
435+
"Transform member <monai.transforms.compose.Compose object at 0x7f1777fd5a20>\n",
436436
"Values [{0: 0}, {1: 1}, {2: 4}, {3: 9}, {4: 16}, {5: 25}, {6: 36}, {7: 49}, {8: 64}, {9: 81}]\n"
437437
]
438438
}
@@ -470,7 +470,7 @@
470470
},
471471
{
472472
"cell_type": "code",
473-
"execution_count": 20,
473+
"execution_count": 10,
474474
"id": "391ec82b-43a2-4b6f-8307-e3c853986719",
475475
"metadata": {},
476476
"outputs": [
@@ -496,43 +496,61 @@
496496
},
497497
{
498498
"cell_type": "code",
499-
"execution_count": 21,
499+
"execution_count": 11,
500500
"id": "229617a0-1120-4054-9232-1991cfa21ae9",
501501
"metadata": {},
502502
"outputs": [
503503
{
504504
"name": "stdout",
505505
"output_type": "stream",
506506
"text": [
507-
"2023-07-14 15:22:37,435 - INFO - --- input summary of monai.bundle.scripts.run ---\n",
508-
"2023-07-14 15:22:37,435 - INFO - > run_id: 'test'\n",
509-
"2023-07-14 15:22:37,436 - INFO - > meta_file: './TestBundle/configs/metadata.json'\n",
510-
"2023-07-14 15:22:37,436 - INFO - > config_file: './TestBundle/configs/test_cmdline.yaml'\n",
511-
"2023-07-14 15:22:37,436 - INFO - ---\n",
512-
"\n",
507+
"2024-09-18 08:15:32,092 - INFO - --- input summary of monai.bundle.scripts.run ---\n",
508+
"2024-09-18 08:15:32,092 - INFO - > config_file: './TestBundle/configs/test_cmdline.yaml'\n",
509+
"2024-09-18 08:15:32,092 - INFO - > meta_file: './TestBundle/configs/metadata.json'\n",
510+
"2024-09-18 08:15:32,092 - INFO - > run_id: 'test'\n",
511+
"2024-09-18 08:15:32,092 - INFO - ---\n",
513512
"\n",
513+
"\n"
514+
]
515+
},
516+
{
517+
"name": "stdout",
518+
"output_type": "stream",
519+
"text": [
514520
"Height 8\n",
515521
"Width 8\n",
516522
"Area 64\n",
517-
"2023-07-14 15:22:40,876 - INFO - --- input summary of monai.bundle.scripts.run ---\n",
518-
"2023-07-14 15:22:40,876 - INFO - > run_id: 'test'\n",
519-
"2023-07-14 15:22:40,876 - INFO - > meta_file: './TestBundle/configs/metadata.json'\n",
520-
"2023-07-14 15:22:40,876 - INFO - > config_file: './TestBundle/configs/test_cmdline.yaml'\n",
521-
"2023-07-14 15:22:40,876 - INFO - > shape#0: 4\n",
522-
"2023-07-14 15:22:40,876 - INFO - ---\n",
523-
"\n",
523+
"2024-09-18 08:15:41,817 - INFO - --- input summary of monai.bundle.scripts.run ---\n",
524+
"2024-09-18 08:15:41,817 - INFO - > config_file: './TestBundle/configs/test_cmdline.yaml'\n",
525+
"2024-09-18 08:15:41,817 - INFO - > meta_file: './TestBundle/configs/metadata.json'\n",
526+
"2024-09-18 08:15:41,817 - INFO - > run_id: 'test'\n",
527+
"2024-09-18 08:15:41,817 - INFO - > shape#0: 4\n",
528+
"2024-09-18 08:15:41,817 - INFO - ---\n",
524529
"\n",
530+
"\n"
531+
]
532+
},
533+
{
534+
"name": "stdout",
535+
"output_type": "stream",
536+
"text": [
525537
"Height 4\n",
526538
"Width 8\n",
527539
"Area 32\n",
528-
"2023-07-14 15:22:44,279 - INFO - --- input summary of monai.bundle.scripts.run ---\n",
529-
"2023-07-14 15:22:44,279 - INFO - > run_id: 'test'\n",
530-
"2023-07-14 15:22:44,279 - INFO - > meta_file: './TestBundle/configs/metadata.json'\n",
531-
"2023-07-14 15:22:44,279 - INFO - > config_file: './TestBundle/configs/test_cmdline.yaml'\n",
532-
"2023-07-14 15:22:44,279 - INFO - > area: 32\n",
533-
"2023-07-14 15:22:44,279 - INFO - ---\n",
534-
"\n",
540+
"2024-09-18 08:15:51,574 - INFO - --- input summary of monai.bundle.scripts.run ---\n",
541+
"2024-09-18 08:15:51,574 - INFO - > config_file: './TestBundle/configs/test_cmdline.yaml'\n",
542+
"2024-09-18 08:15:51,574 - INFO - > meta_file: './TestBundle/configs/metadata.json'\n",
543+
"2024-09-18 08:15:51,574 - INFO - > run_id: 'test'\n",
544+
"2024-09-18 08:15:51,574 - INFO - > area: 32\n",
545+
"2024-09-18 08:15:51,574 - INFO - ---\n",
535546
"\n",
547+
"\n"
548+
]
549+
},
550+
{
551+
"name": "stdout",
552+
"output_type": "stream",
553+
"text": [
536554
"Height 8\n",
537555
"Width 8\n",
538556
"Area 32\n"
@@ -574,7 +592,7 @@
574592
},
575593
{
576594
"cell_type": "code",
577-
"execution_count": 17,
595+
"execution_count": 12,
578596
"id": "55c034c5-b03f-4ac1-8aa0-a7b768bbbb7e",
579597
"metadata": {},
580598
"outputs": [
@@ -595,7 +613,7 @@
595613
},
596614
{
597615
"cell_type": "code",
598-
"execution_count": 18,
616+
"execution_count": 13,
599617
"id": "2511798a-cd44-4aec-954c-c766b29f0a43",
600618
"metadata": {},
601619
"outputs": [
@@ -618,21 +636,27 @@
618636
},
619637
{
620638
"cell_type": "code",
621-
"execution_count": 19,
639+
"execution_count": 14,
622640
"id": "dc6adf63-c4b5-4f97-805a-2321dc1e8d2c",
623641
"metadata": {},
624642
"outputs": [
625643
{
626644
"name": "stdout",
627645
"output_type": "stream",
628646
"text": [
629-
"2023-07-14 15:09:59,663 - INFO - --- input summary of monai.bundle.scripts.run ---\n",
630-
"2023-07-14 15:09:59,663 - INFO - > run_id: 'test'\n",
631-
"2023-07-14 15:09:59,663 - INFO - > meta_file: './TestBundle/configs/metadata.json'\n",
632-
"2023-07-14 15:09:59,663 - INFO - > config_file: ['./TestBundle/configs/multifile1.yaml', './TestBundle/configs/multifile2.yaml']\n",
633-
"2023-07-14 15:09:59,663 - INFO - ---\n",
634-
"\n",
647+
"2024-09-18 08:16:01,272 - INFO - --- input summary of monai.bundle.scripts.run ---\n",
648+
"2024-09-18 08:16:01,273 - INFO - > config_file: ['./TestBundle/configs/multifile1.yaml', './TestBundle/configs/multifile2.yaml']\n",
649+
"2024-09-18 08:16:01,273 - INFO - > meta_file: './TestBundle/configs/metadata.json'\n",
650+
"2024-09-18 08:16:01,273 - INFO - > run_id: 'test'\n",
651+
"2024-09-18 08:16:01,273 - INFO - ---\n",
635652
"\n",
653+
"\n"
654+
]
655+
},
656+
{
657+
"name": "stdout",
658+
"output_type": "stream",
659+
"text": [
636660
"Area 64\n"
637661
]
638662
}
@@ -676,9 +700,9 @@
676700
],
677701
"metadata": {
678702
"kernelspec": {
679-
"display_name": "Python [conda env:monai]",
703+
"display_name": "Python 3",
680704
"language": "python",
681-
"name": "conda-env-monai-py"
705+
"name": "python3"
682706
},
683707
"language_info": {
684708
"codemirror_mode": {
@@ -690,7 +714,7 @@
690714
"name": "python",
691715
"nbconvert_exporter": "python",
692716
"pygments_lexer": "ipython3",
693-
"version": "3.10.10"
717+
"version": "3.10.12"
694718
}
695719
},
696720
"nbformat": 4,

0 commit comments

Comments
 (0)