Describe the bug
The following code assumes that the only devices supported in PyTorch are CPU and CUDA. macOS devices now come with a Torch-supported built-in GPU known as "mps". Specifying "mps" as the device type will result in this error: AttributeError: 'ASRBrain' object has no attribute 'device_type'
if self.device == "cpu":
self.device_type = "cpu"
elif "cuda" in self.device:
self.device_type = "cuda"
# Set cuda device based on device string
try:
_, device_index = self.device.split(":")
torch.cuda.set_device(int(device_index))
except ValueError:
torch.cuda.set_device(0)
The code below will then check device_type and crash:
if self.device_type == "cpu" and (
self.precision == "fp16" or self.eval_precision == "fp16"
):
raise ValueError(
"The option `--precision` or `--eval_precision` is set to fp16. "
"This option is not yet supported on CPU. "
"Please use `--precision=bf16` or `--eval_precision=bf16` instead "
"to enable mixed precision on CPU."
)
While it is understandable that full compatibility with non-CUDA GPUs cannot be guaranteed, I have verified that basic training/inference is possible with MPS, and I would expect this to also affect AMD GPUs and others.
Expected behaviour
Recipes should be able to load on non-CUDA GPUs as long as they are not using any CUDA-specific functionality or Torch functionality unsupported by the device itself.
To Reproduce
No response
Environment Details
No response
Relevant Log Output
Additional Context
No response
Describe the bug
The following code assumes that the only devices supported in PyTorch are CPU and CUDA. macOS devices now come with a Torch-supported built-in GPU known as "mps". Specifying "mps" as the device type will result in this error:
AttributeError: 'ASRBrain' object has no attribute 'device_type'The code below will then check device_type and crash:
While it is understandable that full compatibility with non-CUDA GPUs cannot be guaranteed, I have verified that basic training/inference is possible with MPS, and I would expect this to also affect AMD GPUs and others.
Expected behaviour
Recipes should be able to load on non-CUDA GPUs as long as they are not using any CUDA-specific functionality or Torch functionality unsupported by the device itself.
To Reproduce
No response
Environment Details
No response
Relevant Log Output
Additional Context
No response