Skip to content

Commit

Permalink
Explicit None Check in get_device (mosaicml#3586)
Browse files Browse the repository at this point in the history
  • Loading branch information
mvpatel2000 authored Aug 29, 2024
1 parent dec6718 commit eda41dc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion composer/utils/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def get_device(device: Optional[Union[str, 'Device']] = None) -> 'Device':
"""
from composer.devices import DeviceCPU, DeviceGPU, DeviceHPU, DeviceMPS, DeviceNeuron, DeviceTPU

if not device:
if device is None:
device = DeviceGPU() if torch.cuda.is_available() else DeviceCPU()
elif isinstance(device, str):
if device.lower() == 'cpu':
Expand Down

0 comments on commit eda41dc

Please sign in to comment.