From 10eb0b6229dc714a889f270bc1471cfac635ad69 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Sun, 9 Jul 2023 17:30:28 +0200 Subject: [PATCH] Error -> Warn on non-deterministic ops (#3613) --- ultralytics/yolo/utils/torch_utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ultralytics/yolo/utils/torch_utils.py b/ultralytics/yolo/utils/torch_utils.py index a9d7917..e5a62dc 100644 --- a/ultralytics/yolo/utils/torch_utils.py +++ b/ultralytics/yolo/utils/torch_utils.py @@ -319,9 +319,9 @@ def init_seeds(seed=0, deterministic=False): torch.cuda.manual_seed(seed) torch.cuda.manual_seed_all(seed) # for Multi-GPU, exception safe # torch.backends.cudnn.benchmark = True # AutoBatch problem https://github.com/ultralytics/yolov5/issues/9287 - if deterministic: # https://github.com/ultralytics/yolov5/pull/8213 + if deterministic: if TORCH_2_0: - torch.use_deterministic_algorithms(True) + torch.use_deterministic_algorithms(True, warn_only=True) # warn if deterministic is not possible torch.backends.cudnn.deterministic = True os.environ['CUBLAS_WORKSPACE_CONFIG'] = ':4096:8' os.environ['PYTHONHASHSEED'] = str(seed)