mirror of
https://github.com/THU-MIG/yolov10.git
synced 2025-05-26 07:54:21 +08:00
Error -> Warn on non-deterministic ops (#3613)
This commit is contained in:
parent
e97958ef6f
commit
10eb0b6229
@ -319,9 +319,9 @@ def init_seeds(seed=0, deterministic=False):
|
|||||||
torch.cuda.manual_seed(seed)
|
torch.cuda.manual_seed(seed)
|
||||||
torch.cuda.manual_seed_all(seed) # for Multi-GPU, exception safe
|
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
|
# 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:
|
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
|
torch.backends.cudnn.deterministic = True
|
||||||
os.environ['CUBLAS_WORKSPACE_CONFIG'] = ':4096:8'
|
os.environ['CUBLAS_WORKSPACE_CONFIG'] = ':4096:8'
|
||||||
os.environ['PYTHONHASHSEED'] = str(seed)
|
os.environ['PYTHONHASHSEED'] = str(seed)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user