Skip to content

Commit

Permalink
Fix copyright and guidelines test errors for remaining tutorials (Pro…
Browse files Browse the repository at this point in the history
…ject-MONAI#1182)

Fixes Project-MONAI#1181 .

### Description

- Update the guideline test to avoid counting line returns in non-text
outputs (for example, html data)
- Add copyright for all remaining scripts and clean replicates of old
copyright info in the following notebooks
  - 2d_classification\mednist_tutorial.ipynb
  - 2d_registration\registration_mednist.ipynb
  - 3d_classification\densenet_training_array.ipynb
  - acceleration\multi_gpu_test.ipynb
  - acceleration\threadbuffer_performance.ipynb
  - acceleration\transform_speed.ipynb
  - modules\TorchIO_MONAI_PyTorch_Lightning.ipynb
  - modules\UNet_input_size_constrains.ipynb
-
multimodal\openi_multilabel_classification_transchex\transchex_openi_multilabel_classification.ipynb
  - experiment_management\spleen_segmentation_aim.ipynb
  - experiment_management\spleen_segmentation_mlflow.ipynb
 
- Fix markdown cells for notebooks to match guidelines
  - experiment_management\bundle_integrate_mlflow.ipynb
  - modules\resample_benchmark.ipynb

- Update the outputs in the following notebooks:
  - 2d_classification\mednist_tutorial.ipynb
  - 2d_registration\registration_mednist.ipynb
  - 3d_classification\densenet_training_array.ipynb
 
### Checks
<!--- Put an `x` in all the boxes that apply, and remove the not
applicable items -->
- [x] Avoid including large-size files in the PR.
- [x] Clean up long text outputs from code cells in the notebook.
- [x] For security purposes, please check the contents and remove any
sensitive info such as user names and private key.
- [x] 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: Mingxin Zheng <[email protected]>
Signed-off-by: Mingxin Zheng <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
mingxin-zheng and pre-commit-ci[bot] authored Jan 21, 2023
1 parent bb33315 commit 4b2771a
Show file tree
Hide file tree
Showing 73 changed files with 741 additions and 928 deletions.
130 changes: 64 additions & 66 deletions 2d_classification/mednist_tutorial.ipynb

Large diffs are not rendered by default.

155 changes: 88 additions & 67 deletions 2d_registration/registration_mednist.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion 2d_segmentation/torch/unet_evaluation_array.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020 MONAI Consortium
# Copyright (c) MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion 2d_segmentation/torch/unet_evaluation_dict.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020 MONAI Consortium
# Copyright (c) MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion 2d_segmentation/torch/unet_training_array.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020 MONAI Consortium
# Copyright (c) MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion 2d_segmentation/torch/unet_training_dict.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020 MONAI Consortium
# Copyright (c) MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand Down
25 changes: 13 additions & 12 deletions 3d_classification/densenet_training_array.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion 3d_classification/ignite/densenet_evaluation_array.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020 MONAI Consortium
# Copyright (c) MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion 3d_classification/ignite/densenet_evaluation_dict.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020 MONAI Consortium
# Copyright (c) MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion 3d_classification/ignite/densenet_training_array.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020 MONAI Consortium
# Copyright (c) MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion 3d_classification/ignite/densenet_training_dict.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020 MONAI Consortium
# Copyright (c) MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion 3d_classification/torch/densenet_evaluation_array.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020 MONAI Consortium
# Copyright (c) MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion 3d_classification/torch/densenet_evaluation_dict.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020 MONAI Consortium
# Copyright (c) MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion 3d_classification/torch/densenet_training_array.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020 MONAI Consortium
# Copyright (c) MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion 3d_classification/torch/densenet_training_dict.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020 MONAI Consortium
# Copyright (c) MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion acceleration/distributed_training/unet_evaluation_ddp.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020 MONAI Consortium
# Copyright (c) MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020 MONAI Consortium
# Copyright (c) MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020 MONAI Consortium
# Copyright (c) MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion acceleration/distributed_training/unet_training_ddp.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020 MONAI Consortium
# Copyright (c) MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion acceleration/distributed_training/unet_training_horovod.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020 MONAI Consortium
# Copyright (c) MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020 MONAI Consortium
# Copyright (c) MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020 MONAI Consortium
# Copyright (c) MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand Down
125 changes: 76 additions & 49 deletions acceleration/multi_gpu_test.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Copyright (c) MONAI Consortium \n",
"Licensed under the Apache License, Version 2.0 (the \"License\"); \n",
"you may not use this file except in compliance with the License. \n",
"You may obtain a copy of the License at \n",
"&nbsp;&nbsp;&nbsp;&nbsp;http://www.apache.org/licenses/LICENSE-2.0 \n",
"Unless required by applicable law or agreed to in writing, software \n",
"distributed under the License is distributed on an \"AS IS\" BASIS, \n",
"WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. \n",
"See the License for the specific language governing permissions and \n",
"limitations under the License.\n",
"\n",
"# Multi GPU Test\n",
"\n",
"[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/Project-MONAI/tutorials/blob/main/acceleration/multi_gpu_test.ipynb)"
Expand All @@ -18,19 +29,11 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Note: you may need to restart the kernel to use updated packages.\n"
]
}
],
"outputs": [],
"source": [
"!python -c \"import monai\" || pip install -q \"monai-weekly[ignite]\""
]
Expand All @@ -44,7 +47,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {
"tags": []
},
Expand All @@ -53,24 +56,29 @@
"name": "stdout",
"output_type": "stream",
"text": [
"MONAI version: 0.4.0\n",
"Numpy version: 1.19.1\n",
"Pytorch version: 1.7.0a0+7036e91\n",
"MONAI flags: HAS_EXT = False, USE_COMPILED = False\n",
"MONAI rev id: 0563a4467fa602feca92d91c7f47261868d171a1\n",
"MONAI version: 1.1.0+2.g97918e46\n",
"Numpy version: 1.22.2\n",
"Pytorch version: 1.13.0a0+d0d6b1f\n",
"MONAI flags: HAS_EXT = False, USE_COMPILED = False, USE_META_DICT = False\n",
"MONAI rev id: 97918e46e0d2700c050e678d72e3edb35afbd737\n",
"MONAI __file__: /workspace/monai/monai-in-dev/monai/__init__.py\n",
"\n",
"Optional dependencies:\n",
"Pytorch Ignite version: 0.4.2\n",
"Nibabel version: 3.2.1\n",
"scikit-image version: 0.15.0\n",
"Pillow version: 8.0.1\n",
"Tensorboard version: 2.2.0\n",
"gdown version: 3.12.2\n",
"TorchVision version: 0.8.0a0\n",
"ITK version: 5.1.2\n",
"tqdm version: 4.54.1\n",
"lmdb version: 1.0.0\n",
"psutil version: 5.7.2\n",
"Pytorch Ignite version: 0.4.10\n",
"Nibabel version: 4.0.2\n",
"scikit-image version: 0.19.3\n",
"Pillow version: 9.0.1\n",
"Tensorboard version: 2.10.1\n",
"gdown version: 4.6.0\n",
"TorchVision version: 0.14.0a0\n",
"tqdm version: 4.64.1\n",
"lmdb version: 1.3.0\n",
"psutil version: 5.9.2\n",
"pandas version: 1.4.4\n",
"einops version: 0.6.0\n",
"transformers version: 4.21.3\n",
"mlflow version: 2.0.1\n",
"pynrrd version: 1.0.0\n",
"\n",
"For details about installing the optional dependencies, please visit:\n",
" https://docs.monai.io/en/latest/installation.html#installing-the-recommended-dependencies\n",
Expand All @@ -79,17 +87,6 @@
}
],
"source": [
"# Copyright 2020 MONAI Consortium\n",
"# Licensed under the Apache License, Version 2.0 (the \"License\");\n",
"# you may not use this file except in compliance with the License.\n",
"# You may obtain a copy of the License at\n",
"# http://www.apache.org/licenses/LICENSE-2.0\n",
"# Unless required by applicable law or agreed to in writing, software\n",
"# distributed under the License is distributed on an \"AS IS\" BASIS,\n",
"# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n",
"# See the License for the specific language governing permissions and\n",
"# limitations under the License.\n",
"\n",
"import torch\n",
"from monai.config import print_config\n",
"from monai.engines import create_multigpu_supervised_trainer\n",
Expand All @@ -107,7 +104,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -142,13 +139,23 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2023-01-20 14:16:00,009 - Engine run starting with max_epochs=2.\n",
"2023-01-20 14:16:00,189 - Epoch[1] Complete. Time taken: 00:00:00.180\n",
"2023-01-20 14:16:00,201 - Epoch[2] Complete. Time taken: 00:00:00.011\n",
"2023-01-20 14:16:00,201 - Engine run complete. Time taken: 00:00:00.192\n"
]
},
{
"data": {
"text/plain": [
Expand All @@ -157,15 +164,15 @@
"\tepoch: 2\n",
"\tepoch_length: 2\n",
"\tmax_epochs: 2\n",
"\toutput: 34253.46875\n",
"\toutput: 23339.560546875\n",
"\tbatch: <class 'tuple'>\n",
"\tmetrics: <class 'dict'>\n",
"\tdataloader: <class 'generator'>\n",
"\tseed: <class 'NoneType'>\n",
"\ttimes: <class 'dict'>"
]
},
"execution_count": 3,
"execution_count": null,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -185,14 +192,24 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"metadata": {
"pycharm": {
"name": "#%%\n"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2023-01-20 14:16:00,208 - Engine run starting with max_epochs=2.\n",
"2023-01-20 14:16:01,364 - Epoch[1] Complete. Time taken: 00:00:01.154\n",
"2023-01-20 14:16:01,391 - Epoch[2] Complete. Time taken: 00:00:00.026\n",
"2023-01-20 14:16:01,391 - Engine run complete. Time taken: 00:00:01.181\n"
]
},
{
"data": {
"text/plain": [
Expand All @@ -201,15 +218,15 @@
"\tepoch: 2\n",
"\tepoch_length: 2\n",
"\tmax_epochs: 2\n",
"\toutput: 30694.720703125\n",
"\toutput: 22608.560546875\n",
"\tbatch: <class 'tuple'>\n",
"\tmetrics: <class 'dict'>\n",
"\tdataloader: <class 'generator'>\n",
"\tseed: <class 'NoneType'>\n",
"\ttimes: <class 'dict'>"
]
},
"execution_count": 4,
"execution_count": null,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -229,13 +246,23 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": null,
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2023-01-20 14:16:01,402 - Engine run starting with max_epochs=2.\n",
"2023-01-20 14:16:01,475 - Epoch[1] Complete. Time taken: 00:00:00.073\n",
"2023-01-20 14:16:01,575 - Epoch[2] Complete. Time taken: 00:00:00.100\n",
"2023-01-20 14:16:01,576 - Engine run complete. Time taken: 00:00:00.174\n"
]
},
{
"data": {
"text/plain": [
Expand All @@ -244,15 +271,15 @@
"\tepoch: 2\n",
"\tepoch_length: 2\n",
"\tmax_epochs: 2\n",
"\toutput: 26988.939453125\n",
"\toutput: 21955.39453125\n",
"\tbatch: <class 'tuple'>\n",
"\tmetrics: <class 'dict'>\n",
"\tdataloader: <class 'generator'>\n",
"\tseed: <class 'NoneType'>\n",
"\ttimes: <class 'dict'>"
]
},
"execution_count": 6,
"execution_count": null,
"metadata": {},
"output_type": "execute_result"
}
Expand Down Expand Up @@ -281,7 +308,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
"version": "3.8.13"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit 4b2771a

Please sign in to comment.