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

Factor out backend (eg PyTorch, TensorFlow) validation. #230

Closed
arnaudvl opened this issue Apr 22, 2021 · 4 comments · Fixed by #537
Closed

Factor out backend (eg PyTorch, TensorFlow) validation. #230

arnaudvl opened this issue Apr 22, 2021 · 4 comments · Fixed by #537
Labels

Comments

@arnaudvl
Copy link
Contributor

Add _validate_backend functionality instead of checking on the fly as in https://github.com/SeldonIO/alibi-detect/blob/master/alibi_detect/cd/classifier.py#L98.

@arnaudvl arnaudvl added the good first issue Good for newcomers label Apr 22, 2021
@amanjha8100
Copy link

I would like to solve this issue. I am new to open source therefore If I make any mistakes please do guide me.

@jklaise
Copy link
Contributor

jklaise commented Apr 22, 2021

@amanjha8100 for sure! The most appropriate place for this function seems to be https://github.com/SeldonIO/alibi-detect/blob/master/alibi_detect/utils/frameworks.py. The function should take backend string provided by the user and validate it pretty much the same way as these lines:

backend = backend.lower()
if backend == 'tensorflow' and not has_tensorflow or backend == 'pytorch' and not has_pytorch:
raise ImportError(f'{backend} not installed. Cannot initialize and run the '
f'ClassifierDrift detector with {backend} backend.')
elif backend not in ['tensorflow', 'pytorch']:
raise NotImplementedError(f'{backend} not implemented. Use tensorflow or pytorch instead.')
It would also be useful to define a BACKENDS=['tensorflow', 'pytorch'] constant in this module.

@arnaudvl we may need additional functionality in the future, e.g. if some methods implement one backend but not the other.

@amanjha8100
Copy link

I will try to solve this issue. Thank you for the guidance.

@arnaudvl arnaudvl changed the title Factor out backend (ge PyTorch, TensorFlow) validation. Factor out backend (eg PyTorch, TensorFlow) validation. Apr 22, 2021
@ascillitoe ascillitoe linked a pull request Jul 21, 2022 that will close this issue
6 tasks
@ascillitoe
Copy link
Contributor

This issue will be solved by #537.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants