Skip to content

3744 Add save_state utility to handle saving logic#3780

Merged
Nic-Ma merged 13 commits intoProject-MONAI:devfrom
Nic-Ma:3744-add-state-saver
Feb 9, 2022
Merged

3744 Add save_state utility to handle saving logic#3780
Nic-Ma merged 13 commits intoProject-MONAI:devfrom
Nic-Ma:3744-add-state-saver

Conversation

@Nic-Ma
Copy link
Copy Markdown
Contributor

@Nic-Ma Nic-Ma commented Feb 8, 2022

Fixes #3744 .

Description

Currently, we already have the copy_model_state utility to help load state_dict, this PR added the save_state utility to help simplify the model saving logic. Users easy to face the multi-gpu saving issue (like state_dict.module in #3744 ) and may need to save multiple objects in a dict.
And we also received the requests for such a saving utility from NVIDIA Clara users, especially when saving model in BYOW logic without ignite, etc.

Status

Ready

Types of changes

  • Non-breaking change (fix or new feature that would not break existing functionality).
  • Breaking change (fix or new feature that would cause existing functionality to change).
  • New tests added to cover the changes.
  • Integration tests passed locally by running ./runtests.sh -f -u --net --coverage.
  • Quick tests passed locally by running ./runtests.sh --quick --unittests --disttests.
  • In-line docstrings updated.
  • Documentation updated, tested make html command in the docs/ folder.

@Nic-Ma
Copy link
Copy Markdown
Contributor Author

Nic-Ma commented Feb 8, 2022

/black

@Nic-Ma
Copy link
Copy Markdown
Contributor Author

Nic-Ma commented Feb 8, 2022

/build

@Nic-Ma Nic-Ma requested review from ericspod, rijobro and wyli February 8, 2022 16:19
@Nic-Ma
Copy link
Copy Markdown
Contributor Author

Nic-Ma commented Feb 8, 2022

/black

@Nic-Ma
Copy link
Copy Markdown
Contributor Author

Nic-Ma commented Feb 8, 2022

/build

@Nic-Ma
Copy link
Copy Markdown
Contributor Author

Nic-Ma commented Feb 9, 2022

/black

@Nic-Ma
Copy link
Copy Markdown
Contributor Author

Nic-Ma commented Feb 9, 2022

/build

@Nic-Ma
Copy link
Copy Markdown
Contributor Author

Nic-Ma commented Feb 9, 2022

Hi @wyli ,

I totally updated the saving logic, could you please help review it again?

Thanks in advance.

@Nic-Ma
Copy link
Copy Markdown
Contributor Author

Nic-Ma commented Feb 9, 2022

/build

@Nic-Ma
Copy link
Copy Markdown
Contributor Author

Nic-Ma commented Feb 9, 2022

/black

@Nic-Ma
Copy link
Copy Markdown
Contributor Author

Nic-Ma commented Feb 9, 2022

/build

@Nic-Ma Nic-Ma requested a review from wyli February 9, 2022 16:41
@Nic-Ma Nic-Ma enabled auto-merge (squash) February 9, 2022 17:10
@Nic-Ma Nic-Ma merged commit 7c9fefb into Project-MONAI:dev Feb 9, 2022
wyli pushed a commit that referenced this pull request Feb 9, 2022
* [DLMED] add save_state utility

Signed-off-by: Nic Ma <[email protected]>

* [DLMED] update according to comments

Signed-off-by: Nic Ma <[email protected]>

* [DLMED] update according to comments

Signed-off-by: Nic Ma <[email protected]>

* [DLMED] add atomic and func

Signed-off-by: Nic Ma <[email protected]>

* [DLMED] refactor saving logic

Signed-off-by: Nic Ma <[email protected]>

* [DLMED] fix flake8

Signed-off-by: Nic Ma <[email protected]>

* [DLMED] restore persistent dataset

Signed-off-by: Nic Ma <[email protected]>

* [DLMED] simplify kwargs

Signed-off-by: Nic Ma <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants