mirror of
https://github.com/huggingface/transformers.git
synced 2025-07-31 02:02:21 +06:00
deprecate function get_default_device
in tools/base.py
(#26774)
* get default device through `PartialState().default_device` as is has been officially released * apply code review suggestion * apply code review suggestion Co-authored-by: Zach Mueller <muellerzr@gmail.com> --------- Co-authored-by: Zach Mueller <muellerzr@gmail.com>
This commit is contained in:
parent
8211c59b9a
commit
df6f36a171
@ -599,6 +599,10 @@ def launch_gradio_demo(tool_class: Tool):
|
||||
|
||||
# TODO: Migrate to Accelerate for this once `PartialState.default_device` makes its way into a release.
|
||||
def get_default_device():
|
||||
logger.warning(
|
||||
"`get_default_device` is deprecated and will be replaced with `accelerate`'s `PartialState().default_device` "
|
||||
"in version 4.36 of 🤗 Transformers. "
|
||||
)
|
||||
if not is_torch_available():
|
||||
raise ImportError("Please install torch in order to use this tool.")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user