Skip to content

Commit

Permalink
πŸ”€ [Merge] branch 'TEST' into DOCKER
Browse files Browse the repository at this point in the history
  • Loading branch information
henrytsui000 committed Jul 10, 2024
2 parents 853bfba + ecc08c8 commit dbe7505
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion yolo/utils/model_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,13 @@ def get_device(device_spec: Union[str, int, List[int]]) -> torch.device:
device_spec = initialize_distributed()
if torch.cuda.is_available() and "cuda" in str(device_spec):
return torch.device(device_spec), ddp_flag
return torch.device("cpu"), False
if not torch.cuda.is_available() and not torch.backends.mps.is_available():
if device_spec != "cpu":
logger.warning(f"❎ Device spec: {device_spec} not support, Choosing CPU instead")
return torch.device("cpu"), False

device = torch.device(device_spec)
return device, ddp_flag


class PostProccess:
Expand Down

0 comments on commit dbe7505

Please sign in to comment.