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 PyTorch device setting #503
Conversation
Hi @kuutsav, welcome! and thanks for contributing 🙂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this @kuutsav. The overall strategy looks good to me (assuming you are OK with the get_torch_device
function name and location @arnaudvl?).
There are a few issues that need addressing though:
- The
flake8
linting issues. SeeCONTRIBUTING.md
for more guidance, but essentially if you runpip install -r requirements/dev.txt
you can then runflake8 alibi_detect
andmypy alibi_detect
to check these both pass locally before pushing. - The new function can also be added to
pytorch/learned_kernel.py
andpytorch/classifier.py
. (You've correctly left outpytorch/spot_the_diff.py
, the logic is different for this one).
Thanks for the contribution @kuutsav . Just left a small comment which is applicable to the various detectors. |
@arnaudvl Have addressed the issue along with the linting issue. Have also added the method at Do we want to print or log here? |
Good question. IMO we should stick with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Would be grateful if you could fix the 3 minor comment typo's I've just spotted (these were already there)
I'll also leave @arnaudvl to review one more time.
One more place where it makes sense to use this utility function is the |
Made this change as well. Had to ignore the types at couple of places as mypy was complaining due to reassignment of |
Sorry @kuutsav, after looking at this a bit more (after the most recent Changing Instead of adding multiple (i.e. 5 or 6) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but will leave @arnaudvl to do a final pass since I'm now self-reviewing...
Congrats (and thanks) on your first contribution @kuutsav! 🎉 |
Addresses #493