diff --git a/ultralytics/utils/torch_utils.py b/ultralytics/utils/torch_utils.py index ed5bc2ed..bf34b1d6 100644 --- a/ultralytics/utils/torch_utils.py +++ b/ultralytics/utils/torch_utils.py @@ -115,7 +115,7 @@ def select_device(device="", batch=0, newline=False, verbose=True): device = "0" visible = os.environ.get("CUDA_VISIBLE_DEVICES", None) os.environ["CUDA_VISIBLE_DEVICES"] = device # set environment variable - must be before assert is_available() - if not (torch.cuda.is_available() and torch.cuda.device_count() >= len(device.replace(",", ""))): + if not (torch.cuda.is_available() and torch.cuda.device_count() >= len(device.split(","))): LOGGER.info(s) install = ( "See https://pytorch.org/get-started/locally/ for up-to-date torch install instructions if no "