-
Notifications
You must be signed in to change notification settings - Fork 28.2k
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
auto-detect device when no device is passed to pipeline #31398
Conversation
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 adding this @faaany
I'm not sure this is something we want to do - it can both lead to unexpected behaviour for the user (the default is changing), and doesn't match with the rest of the library (we don't automatically put a model onto a GPU if it's available in the environment when instantiating it). WDYT @ArthurZucker?
Co-authored-by: amyeroberts <22614925+amyeroberts@users.noreply.github.com>
Hi @ArthurZucker , any thoughts on this PR? |
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.
0.02$, also don't think we should do this automatically for the user. Feels a bit too "magical", even if it's useful. I'd rather switch to a good default to use the device if possible instead so it's exposed at the top level, if we were to.
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
How about we emit a warning if we detect there's a device but none is set for the pipeline? |
A warning sounds good, and at this level I feel users would pay attention to it (rather than it just being bloat on the warning logs etc) |
Thx for the suggestion! I will update the PR. |
I think we need to re-trigger the CI |
@faaany Could you try rebasing to include upstream changes from main? |
sure, done. |
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 adding!
What does this PR do?
Currently, if no
device
is passed topipeline
, the model will stay on CPU. This PR makes it possible to auto-detect the underlying hardware environment and move the model to the corresponding accelerator.@amyeroberts and @muellerzr