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 model weight versioning #76

Closed
yetinam opened this issue Apr 1, 2022 · 1 comment · Fixed by #77
Closed

Add model weight versioning #76

yetinam opened this issue Apr 1, 2022 · 1 comment · Fixed by #77
Assignees
Labels
enhancement New feature or request
Projects

Comments

@yetinam
Copy link
Member

yetinam commented Apr 1, 2022

As #73 nicely showed, it might sometimes be desirable to update models weights. I'd therefore suggest to add model weight versioning. My proposal would be to keep all versions available in the repo, but by default download the latest version. Older versions can explicitly be queried using a version kwarg. If a version is already cached locally, checks for new versions are only performed when explicitly initiated by the user, for example through an argument like check_latest. This way, we avoid that SeisBench needs to "call home" every time from_pretrained is called. I think that would be a privacy issue.

#49 proposes a similar addition for datasets. However, I think versioning for models is considerably easier as the file size is much smaller.

@yetinam yetinam added the enhancement New feature or request label Apr 1, 2022
@yetinam yetinam self-assigned this Apr 1, 2022
@yetinam yetinam added this to Ideas in v0.2 Apr 1, 2022
@yetinam yetinam moved this from Ideas to In progress in v0.2 Apr 1, 2022
@jawooll
Copy link
Contributor

jawooll commented Apr 1, 2022

Just from my side, I think this is a good-idea. It also slightly relates to #71. We can actually integrate this into the model saving and loading once implemented, where some form of 'development' versioning can be defined for local saving. This allows for automatic model checkpointing during training.

yetinam added a commit that referenced this issue Apr 4, 2022
This commit adds versioning for model weights. This commit includes the following changes:
- Added a weights_version property to SeisBenchModel.
- Added a "version" field to json configs of model weights.
- json config files are now mandatory for each set of model weights (but using the standard pytorch interface, it is still possible to load weights without config).
- The local cache structure now stores models as [name].[json|pt].v[version], i.e., a version suffix was added. Old caches are automatically converted. For compatibility reasons, the required remote cache structure is still downward-compatible.
- The list_pretrained function now takes local models into account.
- Added list_versions function.
- Implemented fine-grained control whether the remote repository or the local cache should be used.
- The documentation has been updated to include a remark on versioning.

In addition, the control flow of these functions was modified. Tests for all changes were added.
@yetinam yetinam linked a pull request Apr 4, 2022 that will close this issue
jawooll pushed a commit that referenced this issue Apr 5, 2022
* Implement model weight versioning (#76)

This commit adds versioning for model weights. This commit includes the following changes:
- Added a weights_version property to SeisBenchModel.
- Added a "version" field to json configs of model weights.
- json config files are now mandatory for each set of model weights (but using the standard PyTorch interface, it is still possible to load weights without config).
- The local cache structure now stores models as [name].[json|pt].v[version], i.e., a version suffix was added. Old caches are automatically converted. For compatibility reasons, the required remote cache structure is still downward-compatible.
- The list_pretrained function now takes local models into account.
- Added list_versions function.
- Implemented fine-grained control whether the remote repository or the local cache should be used.
- The documentation has been updated to include a remark on versioning.

In addition, the control flow of these functions was modified. Tests for all changes were added.
@yetinam yetinam moved this from In progress to Done in v0.2 Apr 5, 2022
@yetinam yetinam moved this from Done to In release notes in v0.2 May 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
No open projects
v0.2
In release notes
Development

Successfully merging a pull request may close this issue.

2 participants