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

Add inference_only option to trainers #850

Merged
merged 9 commits into from
Sep 13, 2024
Merged

Conversation

lbluque
Copy link
Collaborator

@lbluque lbluque commented Sep 12, 2024

Add inference_only option to trainers, so that datasets, optimizer, and other objects not necessary for inference are not loaded from checkpoints.

This is mostly for the OCPCalculator, and makes resolves a handful of issues that otherwise arise:

  • no need to delete datasets anymore since these will not be loaded
  • creating the trainer will not look for files that were used for training but are not necessary for inference (such as normalizers which are already part of the checkpoint)
  • no need to specify the specific trainer when loading a checkpoint in OCPCalculator, the default OCPTrainer should work almost all of the time.

And deprecate OCPCollater in favor of using a partial to set otf_graph.

@lbluque lbluque added bug Something isn't working patch Patch version release minor Minor version release labels Sep 12, 2024
misko
misko previously approved these changes Sep 12, 2024
Copy link
Collaborator

@misko misko 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! LGTM!

Copy link

codecov bot commented Sep 13, 2024

Codecov Report

Attention: Patch coverage is 81.25000% with 9 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/fairchem/core/trainers/base_trainer.py 79.06% 9 Missing ⚠️
Files with missing lines Coverage Δ
src/fairchem/core/common/data_parallel.py 77.50% <100.00%> (-1.50%) ⬇️
src/fairchem/core/common/relaxation/ase_utils.py 61.95% <ø> (-0.81%) ⬇️
...e/models/equiformer_v2/equiformer_v2_deprecated.py 91.15% <ø> (ø)
src/fairchem/core/trainers/ocp_trainer.py 69.49% <100.00%> (ø)
src/fairchem/core/trainers/base_trainer.py 86.12% <79.06%> (-2.20%) ⬇️

... and 2 files with indirect coverage changes

@misko misko self-requested a review September 13, 2024 20:05
@lbluque lbluque added this pull request to the merge queue Sep 13, 2024
Merged via the queue into main with commit 6ded0d3 Sep 13, 2024
7 checks passed
@lbluque lbluque deleted the load-normalizers-patch-2 branch September 13, 2024 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working minor Minor version release patch Patch version release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants