Skip to content

Commit

Permalink
Update the checkpoint loader logic for inference (#521)
Browse files Browse the repository at this point in the history
### Description
This PR enhanced the checkpoint loader logic of DeepEdit inference, to
load weights in the initialization.

### Status
**Ready**

### Please ensure all the checkboxes:
<!--- Put an `x` in all the boxes that apply, and remove the not
applicable items -->
- [x] Codeformat tests passed locally by running `./runtests.sh
--codeformat`.
- [ ] In-line docstrings updated.
- [ ] Update `version` and `changelog` in `metadata.json` if changing an
existing bundle.
- [ ] Please ensure the naming rules in config files meet our
requirements (please refer to: `CONTRIBUTING.md`).
- [ ] Ensure versions of packages such as `monai`, `pytorch` and `numpy`
are correct in `metadata.json`.
- [ ] Descriptions should be consistent with the content, such as
`eval_metrics` of the provided weights and TorchScript modules.
- [ ] Files larger than 25MB are excluded and replaced by providing
download links in `large_file.yml`.
- [ ] Avoid using path that contains personal information within config
files (such as use `/home/your_name/` for `"bundle_root"`).

---------

Signed-off-by: Nic Ma <[email protected]>
Signed-off-by: Yiheng Wang <[email protected]>
Co-authored-by: Yiheng Wang <[email protected]>
Co-authored-by: Yiheng Wang <[email protected]>
  • Loading branch information
3 people authored Oct 13, 2023
1 parent bdd9f9b commit 2a9b8c6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
17 changes: 9 additions & 8 deletions models/spleen_deepedit_annotation/configs/inference.json
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,6 @@
]
},
"handlers": [
{
"_target_": "CheckpointLoader",
"load_path": "$@bundle_root + '/models/model.pt'",
"load_dict": {
"model": "@network"
}
},
{
"_target_": "StatsHandler",
"iteration_log": false
Expand All @@ -205,8 +198,16 @@
"val_handlers": "@handlers",
"amp": true
},
"checkpointloader": {
"_target_": "CheckpointLoader",
"load_path": "$@bundle_root + '/models/model.pt'",
"load_dict": {
"model": "@network"
}
},
"initialize": [
"$monai.utils.set_determinism(seed=123)"
"$monai.utils.set_determinism(seed=123)",
"$@checkpointloader(@evaluator)"
],
"run": [
"[email protected]()"
Expand Down
6 changes: 4 additions & 2 deletions models/spleen_deepedit_annotation/configs/inference_trt.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
"$import ignite",
"$import torch_tensorrt"
],
"handlers#0#_disabled_": true,
"network_def": "$torch.jit.load(@bundle_root + '/models/model_trt.ts')",
"evaluator#amp": false
"evaluator#amp": false,
"initialize": [
"$monai.utils.set_determinism(seed=123)"
]
}
3 changes: 2 additions & 1 deletion models/spleen_deepedit_annotation/configs/metadata.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"schema": "https://github.com/Project-MONAI/MONAI-extra-test-data/releases/download/0.8.1/meta_schema_20220324.json",
"version": "0.5.1",
"version": "0.5.2",
"changelog": {
"0.5.2": "update the checkpoint loader logic for inference",
"0.5.1": "add option to validate at training start, and I/O param entries",
"0.5.0": "enable finetune and early stop",
"0.4.9": "fix orientation issue on clicks",
Expand Down

0 comments on commit 2a9b8c6

Please sign in to comment.