Skip to content

option for non-strict preloading ckpt #1785

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: pytorch
Choose a base branch
from
Open

Conversation

hnyu
Copy link
Collaborator

@hnyu hnyu commented Jun 19, 2025

While currently we allow the user to configure whether a ckpt is strictly loaded or not in policy_trainer.py for loading an algorithm's entire ckpt, there is no such an option for in-alg ckpt preloading. This PR adds a flag to Algorithm to allow partial loading. This is useful if we want to ignore loading some model weights that can be downloaded as pretrained ones.

@hnyu hnyu requested a review from emailweixu June 19, 2025 20:46
@@ -62,6 +62,7 @@ def _flatten_module(module):
return [module]


@alf.configurable(whitelist=['checkpoint_preload_strict'])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel it is better to pass this argument from the subclass algorithms and config for the subclass algorithm so we don't make global change for the behavior of Algorithm.

Copy link
Collaborator Author

@hnyu hnyu Jun 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel it is better to pass this argument from the subclass algorithms and config for the subclass algorithm so we don't make global change for the behavior of Algorithm.

I think the question is down to which subalgorithm? If all the way down to each leaf algorithm, there will be lots of argument change lines across the entire repo.

Or I can add this option to TrainerConfig so that it's easier for the change.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel it is better to pass this argument from the subclass algorithms and config for the subclass algorithm so we don't make global change for the behavior of Algorithm.

I think the question is down to which subalgorithm? If all the way down to each leaf algorithm, there will be lots of argument change lines across the entire repo.

Just change the specific algorithm that needs this behavior at this moment.

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