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

Long term saving and loading standards - using TorchScript? #67

Open
bkmi opened this issue Sep 30, 2021 · 1 comment
Open

Long term saving and loading standards - using TorchScript? #67

bkmi opened this issue Sep 30, 2021 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@bkmi
Copy link
Collaborator

bkmi commented Sep 30, 2021

I propose that we operate under the assumption that all of our users will be able to instantiate the class again, then load the parameters using state_dict, as usual in pytorch. Why? This is how pytorch works and we are not better at coding that the devs of pytorch. If we try to support this, we will only answering corner cases for individuals who should be able to handle this themselves.

To address the implicit main question of using swyft in production, namely what if I want to use the ratio estimator fast and without access to the defining python code? Well there is an answer for that, TorchScript. I propose that we create a long term goal of supporting the export of our ratio estimators to TorchScript for production use, i.e., integrating into the gw detection pipeline, etc.

@bkmi bkmi added the enhancement New feature or request label Sep 30, 2021
@bkmi bkmi self-assigned this Sep 30, 2021
@bkmi
Copy link
Collaborator Author

bkmi commented Nov 5, 2021

I encountered the saving and loading standards of __getstate__ and __setstate__. Perhaps we can use those going forward?

https://realpython.com/lessons/getstate-setstate/

@cweniger cweniger changed the title Long term saving and loading standards Long term saving and loading standards - using TorchScript? Nov 18, 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
None yet
Development

No branches or pull requests

1 participant