enable deterministic training
Browse files- README.md +10 -6
- configs/metadata.json +3 -2
- configs/multi_gpu_evaluate.json +0 -1
- configs/multi_gpu_train.json +0 -1
- configs/train.json +1 -2
- docs/README.md +10 -6
README.md
CHANGED
@@ -123,14 +123,18 @@ A graph showing the validation mean Dice over 50 epochs.
|
|
123 |
![](https://developer.download.nvidia.com/assets/Clara/Images/monai_pathology_nuclick_annotation_val_dice.jpeg) <br>
|
124 |
|
125 |
|
126 |
-
##
|
127 |
-
|
|
|
|
|
|
|
|
|
128 |
|
129 |
```
|
130 |
python -m monai.bundle run --config_file configs/train.json
|
131 |
```
|
132 |
|
133 |
-
Override the `train` config to execute multi-GPU training:
|
134 |
|
135 |
```
|
136 |
torchrun --standalone --nnodes=1 --nproc_per_node=2 -m monai.bundle run --config_file "['configs/train.json','configs/multi_gpu_train.json']"
|
@@ -139,19 +143,19 @@ torchrun --standalone --nnodes=1 --nproc_per_node=2 -m monai.bundle run --config
|
|
139 |
Please note that the distributed training related options depend on the actual running environment, thus you may need to remove `--standalone`, modify `--nnodes` or do some other necessary changes according to the machine you used.
|
140 |
Please refer to [pytorch's official tutorial](https://pytorch.org/tutorials/intermediate/ddp_tutorial.html) for more details.
|
141 |
|
142 |
-
Override the `train` config to execute evaluation with the trained model:
|
143 |
|
144 |
```
|
145 |
python -m monai.bundle run --config_file "['configs/train.json','configs/evaluate.json']"
|
146 |
```
|
147 |
|
148 |
-
Override the `train` config and `evaluate` config to execute multi-GPU evaluation:
|
149 |
|
150 |
```
|
151 |
torchrun --standalone --nnodes=1 --nproc_per_node=2 -m monai.bundle run --config_file "['configs/train.json','configs/evaluate.json','configs/multi_gpu_evaluate.json']"
|
152 |
```
|
153 |
|
154 |
-
Execute inference:
|
155 |
|
156 |
```
|
157 |
python -m monai.bundle run --config_file configs/inference.json
|
|
|
123 |
![](https://developer.download.nvidia.com/assets/Clara/Images/monai_pathology_nuclick_annotation_val_dice.jpeg) <br>
|
124 |
|
125 |
|
126 |
+
## MONAI Bundle Commands
|
127 |
+
In addition to the Pythonic APIs, a few command line interfaces (CLI) are provided to interact with the bundle. The CLI supports flexible use cases, such as overriding configs at runtime and predefining arguments in a file.
|
128 |
+
|
129 |
+
For more details usage instructions, visit the [MONAI Bundle Configuration Page](https://docs.monai.io/en/latest/config_syntax.html).
|
130 |
+
|
131 |
+
#### Execute training:
|
132 |
|
133 |
```
|
134 |
python -m monai.bundle run --config_file configs/train.json
|
135 |
```
|
136 |
|
137 |
+
#### Override the `train` config to execute multi-GPU training:
|
138 |
|
139 |
```
|
140 |
torchrun --standalone --nnodes=1 --nproc_per_node=2 -m monai.bundle run --config_file "['configs/train.json','configs/multi_gpu_train.json']"
|
|
|
143 |
Please note that the distributed training related options depend on the actual running environment, thus you may need to remove `--standalone`, modify `--nnodes` or do some other necessary changes according to the machine you used.
|
144 |
Please refer to [pytorch's official tutorial](https://pytorch.org/tutorials/intermediate/ddp_tutorial.html) for more details.
|
145 |
|
146 |
+
#### Override the `train` config to execute evaluation with the trained model:
|
147 |
|
148 |
```
|
149 |
python -m monai.bundle run --config_file "['configs/train.json','configs/evaluate.json']"
|
150 |
```
|
151 |
|
152 |
+
#### Override the `train` config and `evaluate` config to execute multi-GPU evaluation:
|
153 |
|
154 |
```
|
155 |
torchrun --standalone --nnodes=1 --nproc_per_node=2 -m monai.bundle run --config_file "['configs/train.json','configs/evaluate.json','configs/multi_gpu_evaluate.json']"
|
156 |
```
|
157 |
|
158 |
+
#### Execute inference:
|
159 |
|
160 |
```
|
161 |
python -m monai.bundle run --config_file configs/inference.json
|
configs/metadata.json
CHANGED
@@ -1,7 +1,8 @@
|
|
1 |
{
|
2 |
"schema": "https://github.com/Project-MONAI/MONAI-extra-test-data/releases/download/0.8.1/meta_schema_20220324.json",
|
3 |
-
"version": "0.0.
|
4 |
"changelog": {
|
|
|
5 |
"0.0.7": "Update with figure links",
|
6 |
"0.0.6": "adapt to BundleWorkflow interface",
|
7 |
"0.0.5": "add name tag",
|
@@ -10,7 +11,7 @@
|
|
10 |
"0.0.2": "Update The Torch Vision Transform",
|
11 |
"0.0.1": "initialize the model package structure"
|
12 |
},
|
13 |
-
"monai_version": "1.2.
|
14 |
"pytorch_version": "1.13.1",
|
15 |
"numpy_version": "1.22.2",
|
16 |
"optional_packages_version": {
|
|
|
1 |
{
|
2 |
"schema": "https://github.com/Project-MONAI/MONAI-extra-test-data/releases/download/0.8.1/meta_schema_20220324.json",
|
3 |
+
"version": "0.0.8",
|
4 |
"changelog": {
|
5 |
+
"0.0.8": "enable deterministic training",
|
6 |
"0.0.7": "Update with figure links",
|
7 |
"0.0.6": "adapt to BundleWorkflow interface",
|
8 |
"0.0.5": "add name tag",
|
|
|
11 |
"0.0.2": "Update The Torch Vision Transform",
|
12 |
"0.0.1": "initialize the model package structure"
|
13 |
},
|
14 |
+
"monai_version": "1.2.0rc4",
|
15 |
"pytorch_version": "1.13.1",
|
16 |
"numpy_version": "1.22.2",
|
17 |
"optional_packages_version": {
|
configs/multi_gpu_evaluate.json
CHANGED
@@ -21,7 +21,6 @@
|
|
21 |
"$import torch.distributed as dist",
|
22 |
"$dist.is_initialized() or dist.init_process_group(backend='nccl')",
|
23 |
"$torch.cuda.set_device(@device)",
|
24 |
-
"$setattr(torch.backends.cudnn, 'benchmark', True)",
|
25 |
"$import logging",
|
26 |
"$@validate#evaluator.logger.setLevel(logging.WARNING if dist.get_rank() > 0 else logging.INFO)"
|
27 |
],
|
|
|
21 |
"$import torch.distributed as dist",
|
22 |
"$dist.is_initialized() or dist.init_process_group(backend='nccl')",
|
23 |
"$torch.cuda.set_device(@device)",
|
|
|
24 |
"$import logging",
|
25 |
"$@validate#evaluator.logger.setLevel(logging.WARNING if dist.get_rank() > 0 else logging.INFO)"
|
26 |
],
|
configs/multi_gpu_train.json
CHANGED
@@ -31,7 +31,6 @@
|
|
31 |
"$dist.is_initialized() or dist.init_process_group(backend='nccl')",
|
32 |
"$torch.cuda.set_device(@device)",
|
33 |
"$monai.utils.set_determinism(seed=123)",
|
34 |
-
"$setattr(torch.backends.cudnn, 'benchmark', True)",
|
35 |
"$import logging",
|
36 |
"$@train#trainer.logger.setLevel(logging.WARNING if dist.get_rank() > 0 else logging.INFO)",
|
37 |
"$@validate#evaluator.logger.setLevel(logging.WARNING if dist.get_rank() > 0 else logging.INFO)"
|
|
|
31 |
"$dist.is_initialized() or dist.init_process_group(backend='nccl')",
|
32 |
"$torch.cuda.set_device(@device)",
|
33 |
"$monai.utils.set_determinism(seed=123)",
|
|
|
34 |
"$import logging",
|
35 |
"$@train#trainer.logger.setLevel(logging.WARNING if dist.get_rank() > 0 else logging.INFO)",
|
36 |
"$@validate#evaluator.logger.setLevel(logging.WARNING if dist.get_rank() > 0 else logging.INFO)"
|
configs/train.json
CHANGED
@@ -321,8 +321,7 @@
|
|
321 |
"initialize": [
|
322 |
"$import sys",
|
323 |
"$sys.path.append(@bundle_root)",
|
324 |
-
"$monai.utils.set_determinism(seed=123)"
|
325 |
-
"$setattr(torch.backends.cudnn, 'benchmark', True)"
|
326 |
],
|
327 |
"run": [
|
328 |
"$@train#trainer.run()"
|
|
|
321 |
"initialize": [
|
322 |
"$import sys",
|
323 |
"$sys.path.append(@bundle_root)",
|
324 |
+
"$monai.utils.set_determinism(seed=123)"
|
|
|
325 |
],
|
326 |
"run": [
|
327 |
"$@train#trainer.run()"
|
docs/README.md
CHANGED
@@ -116,14 +116,18 @@ A graph showing the validation mean Dice over 50 epochs.
|
|
116 |
![](https://developer.download.nvidia.com/assets/Clara/Images/monai_pathology_nuclick_annotation_val_dice.jpeg) <br>
|
117 |
|
118 |
|
119 |
-
##
|
120 |
-
|
|
|
|
|
|
|
|
|
121 |
|
122 |
```
|
123 |
python -m monai.bundle run --config_file configs/train.json
|
124 |
```
|
125 |
|
126 |
-
Override the `train` config to execute multi-GPU training:
|
127 |
|
128 |
```
|
129 |
torchrun --standalone --nnodes=1 --nproc_per_node=2 -m monai.bundle run --config_file "['configs/train.json','configs/multi_gpu_train.json']"
|
@@ -132,19 +136,19 @@ torchrun --standalone --nnodes=1 --nproc_per_node=2 -m monai.bundle run --config
|
|
132 |
Please note that the distributed training related options depend on the actual running environment, thus you may need to remove `--standalone`, modify `--nnodes` or do some other necessary changes according to the machine you used.
|
133 |
Please refer to [pytorch's official tutorial](https://pytorch.org/tutorials/intermediate/ddp_tutorial.html) for more details.
|
134 |
|
135 |
-
Override the `train` config to execute evaluation with the trained model:
|
136 |
|
137 |
```
|
138 |
python -m monai.bundle run --config_file "['configs/train.json','configs/evaluate.json']"
|
139 |
```
|
140 |
|
141 |
-
Override the `train` config and `evaluate` config to execute multi-GPU evaluation:
|
142 |
|
143 |
```
|
144 |
torchrun --standalone --nnodes=1 --nproc_per_node=2 -m monai.bundle run --config_file "['configs/train.json','configs/evaluate.json','configs/multi_gpu_evaluate.json']"
|
145 |
```
|
146 |
|
147 |
-
Execute inference:
|
148 |
|
149 |
```
|
150 |
python -m monai.bundle run --config_file configs/inference.json
|
|
|
116 |
![](https://developer.download.nvidia.com/assets/Clara/Images/monai_pathology_nuclick_annotation_val_dice.jpeg) <br>
|
117 |
|
118 |
|
119 |
+
## MONAI Bundle Commands
|
120 |
+
In addition to the Pythonic APIs, a few command line interfaces (CLI) are provided to interact with the bundle. The CLI supports flexible use cases, such as overriding configs at runtime and predefining arguments in a file.
|
121 |
+
|
122 |
+
For more details usage instructions, visit the [MONAI Bundle Configuration Page](https://docs.monai.io/en/latest/config_syntax.html).
|
123 |
+
|
124 |
+
#### Execute training:
|
125 |
|
126 |
```
|
127 |
python -m monai.bundle run --config_file configs/train.json
|
128 |
```
|
129 |
|
130 |
+
#### Override the `train` config to execute multi-GPU training:
|
131 |
|
132 |
```
|
133 |
torchrun --standalone --nnodes=1 --nproc_per_node=2 -m monai.bundle run --config_file "['configs/train.json','configs/multi_gpu_train.json']"
|
|
|
136 |
Please note that the distributed training related options depend on the actual running environment, thus you may need to remove `--standalone`, modify `--nnodes` or do some other necessary changes according to the machine you used.
|
137 |
Please refer to [pytorch's official tutorial](https://pytorch.org/tutorials/intermediate/ddp_tutorial.html) for more details.
|
138 |
|
139 |
+
#### Override the `train` config to execute evaluation with the trained model:
|
140 |
|
141 |
```
|
142 |
python -m monai.bundle run --config_file "['configs/train.json','configs/evaluate.json']"
|
143 |
```
|
144 |
|
145 |
+
#### Override the `train` config and `evaluate` config to execute multi-GPU evaluation:
|
146 |
|
147 |
```
|
148 |
torchrun --standalone --nnodes=1 --nproc_per_node=2 -m monai.bundle run --config_file "['configs/train.json','configs/evaluate.json','configs/multi_gpu_evaluate.json']"
|
149 |
```
|
150 |
|
151 |
+
#### Execute inference:
|
152 |
|
153 |
```
|
154 |
python -m monai.bundle run --config_file configs/inference.json
|