You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think the code here omits calling tensor.to(device) when the device is "cpu". However, if you've called torch.set_default_device("something other than cpu") the tensor will be loaded on that device instead. I think the device argument should be optional, and remain optional throughout the code base and then always apply .to(device) when it is not None.
Expected behavior
tensor is loaded on cpu when calling load_model(..., device="cpu")
The text was updated successfully, but these errors were encountered:
This fixeshuggingface#582 where if setting torch.set_default_device('not cpu'), the device for the tensor ends up being the default device rather than the passed device.
System Info
latest
Information
Reproduction
I think the code here omits calling
tensor.to(device)
when the device is"cpu"
. However, if you've calledtorch.set_default_device("something other than cpu")
the tensor will be loaded on that device instead. I think the device argument should be optional, and remain optional throughout the code base and then always apply.to(device)
when it is notNone
.Expected behavior
tensor is loaded on cpu when calling
load_model(..., device="cpu")
The text was updated successfully, but these errors were encountered: