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 filter to config for when trained on overcomplete batches #219

Merged
merged 3 commits into from
Jun 13, 2024

Conversation

dfulu
Copy link
Member

@dfulu dfulu commented Jun 13, 2024

Since the _adapt_batch() method we can train a model with batches which are larger than the model requires. i.e. with larger spatial area, longer time horizon, or more inputs (i.e. more NWPs or with/without sat)

However, allowing this means that the config we copy from the batches used to train is overcomplete for the model. Previously we used the workflow of saving the model during train and pushing it to hugging face using the checkpoint_to_huggingface.py` script. But now this means we push a config to huggingface which is overcomplete for the model ans wastes time at inference making bigger batches than required. So we need to edit the config manually somewhere along the way.

This pull request addresses this problem by stripping out parts of the config not required for the model. This is used at the stage when we are pushing the model and its data config to huggingface

@dfulu dfulu requested a review from peterdudfield June 13, 2024 10:33
Copy link

codecov bot commented Jun 13, 2024

Codecov Report

Attention: Patch coverage is 5.88235% with 32 lines in your changes missing coverage. Please review.

Project coverage is 57.77%. Comparing base (5f5d154) to head (ee352d7).
Report is 88 commits behind head on main.

Files Patch % Lines
pvnet/models/base_model.py 3.03% 32 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #219      +/-   ##
==========================================
- Coverage   61.39%   57.77%   -3.63%     
==========================================
  Files          28       29       +1     
  Lines        1790     1878      +88     
==========================================
- Hits         1099     1085      -14     
- Misses        691      793     +102     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -15,6 +15,7 @@
from pvnet.load_model import get_model_from_checkpoints

wandb_repo = "openclimatefix/pvnet2.1"
Copy link
Contributor

Choose a reason for hiding this comment

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

does this variable still et used?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeh it does

@dfulu dfulu merged commit c67d36f into main Jun 13, 2024
3 of 5 checks passed
@dfulu dfulu deleted the upload_config_fix branch June 13, 2024 13:29
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