Skip to content

Support for saving detectors with pytorch backend #618

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

Closed
pthalasta opened this issue Sep 15, 2022 · 2 comments · Fixed by #656
Closed

Support for saving detectors with pytorch backend #618

pthalasta opened this issue Sep 15, 2022 · 2 comments · Fixed by #656
Labels
Type: Serialization Serialization proposals and changes

Comments

@pthalasta
Copy link

pthalasta commented Sep 15, 2022

I was executing MMD Drift detector with pytorch backend and while saving the detector i ended up with an error

---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
/tmp/ipykernel_2460/896443056.py in <module>
      1 # we can also save/load an initialised detector
      2 filepath = 'models'  # change to directory where detector is saved
----> 3 save_detector(cd, filepath)

/opt/conda/envs/test/lib/python3.8/site-packages/alibi_detect/saving/saving.py in save_detector(detector, filepath, legacy)
     48 
     49     if 'backend' in list(detector.meta.keys()) and detector.meta['backend'] in ['pytorch', 'sklearn']:
---> 50         raise NotImplementedError('Saving detectors with PyTorch or sklearn backend is not yet supported.')
     51 
     52     # TODO: Replace .__args__ w/ typing.get_args() once Python 3.7 dropped (and remove type ignore below)

NotImplementedError: Saving detectors with PyTorch or sklearn backend is not yet supported.

Is there any ETA on when we'll have the feature supported? I'm not sure how useful it is to have the detector trained without being able to export/save and use them in other environments? Any specific reason why it is not supported?

@ascillitoe
Copy link
Contributor

Hi @pthalasta, we are now actively working on this, and it will be released relatively soon. I shall make sure to update here once released. In the meantime, there is save/load support for the tensorflow backend, and for any detectors without a backend, such as KSDrift.

@ascillitoe ascillitoe added the Type: Serialization Serialization proposals and changes label Sep 21, 2022
@pthalasta
Copy link
Author

@ascillitoe thanks for the update! I'll look into KSDrift. Yes, i did use tensorflow for some but since our main code is pytorch, having the pytorch support would really help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Serialization Serialization proposals and changes
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants