adapt to BundleWorkflow interface
Browse files- README.md +5 -5
- configs/evaluate.json +4 -2
- configs/inference.json +5 -3
- configs/metadata.json +7 -5
- configs/multi_gpu_evaluate.json +8 -4
- configs/multi_gpu_train.json +8 -4
- configs/train.json +5 -3
- docs/README.md +5 -5
README.md
CHANGED
@@ -127,13 +127,13 @@ A graph showing the validation mean Dice over 50 epochs.
|
|
127 |
Execute training:
|
128 |
|
129 |
```
|
130 |
-
python -m monai.bundle run
|
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
|
137 |
```
|
138 |
|
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.
|
@@ -142,19 +142,19 @@ Please refer to [pytorch's official tutorial](https://pytorch.org/tutorials/inte
|
|
142 |
Override the `train` config to execute evaluation with the trained model:
|
143 |
|
144 |
```
|
145 |
-
python -m monai.bundle run
|
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
|
152 |
```
|
153 |
|
154 |
Execute inference:
|
155 |
|
156 |
```
|
157 |
-
python -m monai.bundle run
|
158 |
```
|
159 |
|
160 |
# Disclaimer
|
|
|
127 |
Execute training:
|
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']"
|
137 |
```
|
138 |
|
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.
|
|
|
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
|
158 |
```
|
159 |
|
160 |
# Disclaimer
|
configs/evaluate.json
CHANGED
@@ -49,10 +49,12 @@
|
|
49 |
"summary_ops": "*"
|
50 |
}
|
51 |
],
|
52 |
-
"
|
53 |
"$import sys",
|
54 |
"$sys.path.append(@bundle_root)",
|
55 |
-
"$setattr(torch.backends.cudnn, 'benchmark', True)"
|
|
|
|
|
56 |
"$@validate#evaluator.run()"
|
57 |
]
|
58 |
}
|
|
|
49 |
"summary_ops": "*"
|
50 |
}
|
51 |
],
|
52 |
+
"initialize": [
|
53 |
"$import sys",
|
54 |
"$sys.path.append(@bundle_root)",
|
55 |
+
"$setattr(torch.backends.cudnn, 'benchmark', True)"
|
56 |
+
],
|
57 |
+
"run": [
|
58 |
"$@validate#evaluator.run()"
|
59 |
]
|
60 |
}
|
configs/inference.json
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
"$import pathlib",
|
6 |
"$import os"
|
7 |
],
|
8 |
-
"bundle_root": "
|
9 |
"output_dir": "$@bundle_root + '/eval'",
|
10 |
"dataset_dir": "/workspace/data/CoNSePNuclei",
|
11 |
"images": "$list(sorted(glob.glob(@dataset_dir + '/Test/Images/*.png')))[:1]",
|
@@ -123,8 +123,10 @@
|
|
123 |
"val_handlers": "@handlers",
|
124 |
"amp": true
|
125 |
},
|
126 |
-
"
|
127 |
-
"$setattr(torch.backends.cudnn, 'benchmark', True)"
|
|
|
|
|
128 |
"$@evaluator.run()"
|
129 |
]
|
130 |
}
|
|
|
5 |
"$import pathlib",
|
6 |
"$import os"
|
7 |
],
|
8 |
+
"bundle_root": ".",
|
9 |
"output_dir": "$@bundle_root + '/eval'",
|
10 |
"dataset_dir": "/workspace/data/CoNSePNuclei",
|
11 |
"images": "$list(sorted(glob.glob(@dataset_dir + '/Test/Images/*.png')))[:1]",
|
|
|
123 |
"val_handlers": "@handlers",
|
124 |
"amp": true
|
125 |
},
|
126 |
+
"initialize": [
|
127 |
+
"$setattr(torch.backends.cudnn, 'benchmark', True)"
|
128 |
+
],
|
129 |
+
"run": [
|
130 |
"$@evaluator.run()"
|
131 |
]
|
132 |
}
|
configs/metadata.json
CHANGED
@@ -1,19 +1,21 @@
|
|
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.5": "add name tag",
|
6 |
"0.0.4": "Fix evaluation",
|
7 |
"0.0.3": "Update to use MONAI 1.1.0",
|
8 |
"0.0.2": "Update The Torch Vision Transform",
|
9 |
"0.0.1": "initialize the model package structure"
|
10 |
},
|
11 |
-
"monai_version": "1.
|
12 |
-
"pytorch_version": "1.13.
|
13 |
-
"numpy_version": "1.
|
14 |
"optional_packages_version": {
|
15 |
"nibabel": "4.0.1",
|
16 |
-
"pytorch-ignite": "0.4.9"
|
|
|
17 |
},
|
18 |
"name": "Pathology nuclick annotation",
|
19 |
"task": "Pathology Nuclick annotation",
|
|
|
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.6",
|
4 |
"changelog": {
|
5 |
+
"0.0.6": "adapt to BundleWorkflow interface",
|
6 |
"0.0.5": "add name tag",
|
7 |
"0.0.4": "Fix evaluation",
|
8 |
"0.0.3": "Update to use MONAI 1.1.0",
|
9 |
"0.0.2": "Update The Torch Vision Transform",
|
10 |
"0.0.1": "initialize the model package structure"
|
11 |
},
|
12 |
+
"monai_version": "1.2.0rc3",
|
13 |
+
"pytorch_version": "1.13.1",
|
14 |
+
"numpy_version": "1.22.2",
|
15 |
"optional_packages_version": {
|
16 |
"nibabel": "4.0.1",
|
17 |
+
"pytorch-ignite": "0.4.9",
|
18 |
+
"torchvision": "0.14.1"
|
19 |
},
|
20 |
"name": "Pathology nuclick annotation",
|
21 |
"task": "Pathology Nuclick annotation",
|
configs/multi_gpu_evaluate.json
CHANGED
@@ -15,16 +15,20 @@
|
|
15 |
},
|
16 |
"validate#dataloader#sampler": "@validate#sampler",
|
17 |
"validate#handlers#1#_disabled_": "$dist.get_rank() > 0",
|
18 |
-
"
|
19 |
"$import sys",
|
20 |
"$sys.path.append(@bundle_root)",
|
21 |
"$import torch.distributed as dist",
|
22 |
-
"$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 |
-
|
|
|
|
|
|
|
|
|
28 |
"$dist.destroy_process_group()"
|
29 |
]
|
30 |
}
|
|
|
15 |
},
|
16 |
"validate#dataloader#sampler": "@validate#sampler",
|
17 |
"validate#handlers#1#_disabled_": "$dist.get_rank() > 0",
|
18 |
+
"initialize": [
|
19 |
"$import sys",
|
20 |
"$sys.path.append(@bundle_root)",
|
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 |
+
],
|
28 |
+
"run": [
|
29 |
+
"$@validate#evaluator.run()"
|
30 |
+
],
|
31 |
+
"finalize": [
|
32 |
"$dist.destroy_process_group()"
|
33 |
]
|
34 |
}
|
configs/multi_gpu_train.json
CHANGED
@@ -24,18 +24,22 @@
|
|
24 |
},
|
25 |
"validate#dataloader#sampler": "@validate#sampler",
|
26 |
"validate#evaluator#val_handlers": "$None if dist.get_rank() > 0 else @validate#handlers",
|
27 |
-
"
|
28 |
"$import sys",
|
29 |
"$sys.path.append(@bundle_root)",
|
30 |
"$import torch.distributed as dist",
|
31 |
-
"$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)"
|
38 |
-
|
|
|
|
|
|
|
|
|
39 |
"$dist.destroy_process_group()"
|
40 |
]
|
41 |
}
|
|
|
24 |
},
|
25 |
"validate#dataloader#sampler": "@validate#sampler",
|
26 |
"validate#evaluator#val_handlers": "$None if dist.get_rank() > 0 else @validate#handlers",
|
27 |
+
"initialize": [
|
28 |
"$import sys",
|
29 |
"$sys.path.append(@bundle_root)",
|
30 |
"$import torch.distributed as dist",
|
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)"
|
38 |
+
],
|
39 |
+
"run": [
|
40 |
+
"$@train#trainer.run()"
|
41 |
+
],
|
42 |
+
"finalize": [
|
43 |
"$dist.destroy_process_group()"
|
44 |
]
|
45 |
}
|
configs/train.json
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
"$import pathlib",
|
7 |
"$import os"
|
8 |
],
|
9 |
-
"bundle_root": "
|
10 |
"ckpt_dir": "$@bundle_root + '/models'",
|
11 |
"output_dir": "$@bundle_root + '/eval'",
|
12 |
"dataset_dir": "/workspace/data/CoNSePNuclei",
|
@@ -318,11 +318,13 @@
|
|
318 |
"amp": true
|
319 |
}
|
320 |
},
|
321 |
-
"
|
322 |
"$import sys",
|
323 |
"$sys.path.append(@bundle_root)",
|
324 |
"$monai.utils.set_determinism(seed=123)",
|
325 |
-
"$setattr(torch.backends.cudnn, 'benchmark', True)"
|
|
|
|
|
326 |
"$@train#trainer.run()"
|
327 |
]
|
328 |
}
|
|
|
6 |
"$import pathlib",
|
7 |
"$import os"
|
8 |
],
|
9 |
+
"bundle_root": ".",
|
10 |
"ckpt_dir": "$@bundle_root + '/models'",
|
11 |
"output_dir": "$@bundle_root + '/eval'",
|
12 |
"dataset_dir": "/workspace/data/CoNSePNuclei",
|
|
|
318 |
"amp": true
|
319 |
}
|
320 |
},
|
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()"
|
329 |
]
|
330 |
}
|
docs/README.md
CHANGED
@@ -120,13 +120,13 @@ A graph showing the validation mean Dice over 50 epochs.
|
|
120 |
Execute training:
|
121 |
|
122 |
```
|
123 |
-
python -m monai.bundle run
|
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
|
130 |
```
|
131 |
|
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.
|
@@ -135,19 +135,19 @@ Please refer to [pytorch's official tutorial](https://pytorch.org/tutorials/inte
|
|
135 |
Override the `train` config to execute evaluation with the trained model:
|
136 |
|
137 |
```
|
138 |
-
python -m monai.bundle run
|
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
|
145 |
```
|
146 |
|
147 |
Execute inference:
|
148 |
|
149 |
```
|
150 |
-
python -m monai.bundle run
|
151 |
```
|
152 |
|
153 |
# Disclaimer
|
|
|
120 |
Execute training:
|
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']"
|
130 |
```
|
131 |
|
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.
|
|
|
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
|
151 |
```
|
152 |
|
153 |
# Disclaimer
|