https://pytorch.org/docs/master/tensor_attributes.html#torch-device Now this function only return `cpu` or `cuda`. I failed to run some transformer based models on my MacOS due to this limitation.  I fixed it by calling model.to('mps'). 