MCPcopy
hub / github.com/huggingface/transformers / device

Method device

src/transformers/modeling_utils.py:906–911  ·  view source on GitHub ↗

`torch.device`: The device on which the module is (assuming that all the module parameters are on the same device).

(self: "PreTrainedModel")

Source from the content-addressed store, hash-verified

904
905 @property
906 def device(self: "PreTrainedModel") -> torch.device:
907 """
908 `torch.device`: The device on which the module is (assuming that all the module parameters are on the same
909 device).
910 """
911 return next(param.device for param in self.parameters())
912
913 @property
914 def dtype(self: "PreTrainedModel") -> torch.dtype:

Callers 15

run_benchmarkFunction · 0.45
init_weightsMethod · 0.45
get_init_contextMethod · 0.45
from_pretrainedMethod · 0.45
is_accelerator_deviceFunction · 0.45
caching_allocator_warmupFunction · 0.45
testing_utils.pyFile · 0.45
__init__Method · 0.45

Calls

no outgoing calls