Skip to content
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

Bug fixes and unit testing for Callbacks #242

Merged
merged 25 commits into from
Oct 24, 2023

Conversation

dhpitt
Copy link
Collaborator

@dhpitt dhpitt commented Oct 18, 2023

Simple change. Model loads checkpoint in Trainer.train() instead of Trainer.__init__()

@dhpitt dhpitt changed the title Load model from checkpoint in a trainer Bug fixes and unit testing for Callbacks Oct 18, 2023
Copy link
Member

@JeanKossaifi JeanKossaifi left a comment

Choose a reason for hiding this comment

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

Looks good, left some comments

neuralop/training/callbacks.py Outdated Show resolved Hide resolved
examples/checkpoint_FNO_darcy.py Outdated Show resolved Hide resolved
examples/checkpoint_FNO_darcy.py Outdated Show resolved Hide resolved
examples/checkpoint_FNO_darcy.py Show resolved Hide resolved
neuralop/training/__init__.py Outdated Show resolved Hide resolved
neuralop/training/callbacks.py Outdated Show resolved Hide resolved
neuralop/training/callbacks.py Outdated Show resolved Hide resolved
folder from which to resume training state.
Expects saved states in the form: (all but model optional)
model.pt, optimizer.pt, scheduler.pt, regularizer.pt
All state files present will be loaded.
Copy link
Member

Choose a reason for hiding this comment

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

I'm wondering whether we should
i) try to load best_model.pt (if monitor_metric is not None this will exist)
ii) if that fails, load model.pt (which will be the model from the latest save_interval)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Currently isn't the way I have things set up - at each save_interval I create a new folder that saves the state. Same for best_model. Do you think it would be better to continually overwrite the save in one folder?

Copy link
Member

Choose a reason for hiding this comment

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

I think so - to avoid blowing up memory?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

neuralop/training/callbacks.py Outdated Show resolved Hide resolved
neuralop/training/callbacks.py Outdated Show resolved Hide resolved
@JeanKossaifi
Copy link
Member

Awesome, thank you @dhpitt !

@JeanKossaifi JeanKossaifi merged commit 9b388be into neuraloperator:main Oct 24, 2023
1 check passed
@dhpitt dhpitt deleted the load_from_ckpt branch March 25, 2024 17:48
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.

None yet

2 participants