Skip to content

Conversation

@matteobettini
Copy link
Collaborator

fixes #178

cc @itwasabhi

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Feb 26, 2025
args = parser.parse_args()
checkpoint_file = str(Path(args.checkpoint_file).resolve())
experiment = reload_experiment_from_file(checkpoint_file)
try:
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: for readability i'd suggest adapting the hydra_config util such that you can do:

if hydra_config.checkpoint_from_hydra_run(checkpoint_file)
    experiment = hydra_config.reload_experiment_from_file()
else:
    # Assume experiment can be loaded directly. 
    experiment = Experiment.reload_from_file(checkpoint_file)

Copy link
Contributor

Choose a reason for hiding this comment

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

Does it make sense in the medium term to maintain both hydra-based and non-hydra based saving/loading?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Does it make sense in the medium term to maintain both hydra-based and non-hydra based saving/loading?

I would think so, the hydra one is more interpretable so it should be the first choice if you can

@matteobettini
Copy link
Collaborator Author

Thanks a lot for the review!!

This should be ready now if you have any last comments

try:
hydra_folder = _find_hydra_folder(restore_file)
except ValueError as e:
if (
Copy link
Contributor

Choose a reason for hiding this comment

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

feel free to ignore style comments, but the best way to do this would be to raise a more specific error within _find_hydra_folder that you can catch here. I.e. MissingHydraMetadataError(FileNotFoundError). If someone changes the exception string in _find_hydra_folder, they may have no idea they are changing the functionality here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

thanksss for pushing me out of my lazyness ahahah

@matteobettini matteobettini merged commit b054451 into main Feb 26, 2025
13 of 14 checks passed
@matteobettini matteobettini deleted the save-configs branch February 26, 2025 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Saving and Loading Experiments

4 participants