Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix the bug that MAISI ckpt cannot be loaded after finetune. (#654)
Fixes # . ### Description MAISI output checkpoint after finetuning cannot be used as ``trained_controlnet_path``. This problem came from the `CheckpointSaver`. When a single key is provided for `save_dict` such as: "save_dict": { "controlnet_state_dict": "@ControlNet" }, The saved dict does contain the key " "controlnet_state_dict". However, it directly saves the state_dict of controlnet as the checkpoint. The workaround is that we also save the optimizer state. For example, "save_dict": { "controlnet_state_dict": "@ControlNet", "optimizer": "@optimizer" }. Then, the MAISI output checkpoint after fine-tuning can be properly loaded. ### Status **Ready/Work in progress/Hold** ### 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: Pengfei Guo <[email protected]>
- Loading branch information