AutoBatch cudnn.benchmark=True fix (#9448)

* AutoBatch `cudnn.benchmark=True` fix

May resolve https://github.com/ultralytics/yolov5/issues/9287

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>

* Update autobatch.py

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>

* Update autobatch.py

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>

* Update general.py

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
Glenn Jocher authored and GitHub committed 2022-09-16 21:46:07 +02:00
1 parent db06f495db
commit 5e1a9553fb
2 files changed
+4 -1

No files matched your search

+1 -1
View File
@@ -223,7 +223,7 @@ def init_seeds(seed=0, deterministic=False):
torch.manual_seed(seed)
torch.cuda.manual_seed(seed)
torch.cuda.manual_seed_all(seed) # for Multi-GPU, exception safe
torch.backends.cudnn.benchmark = True # for faster training
# torch.backends.cudnn.benchmark = True # AutoBatch problem https://github.com/ultralytics/yolov5/issues/9287
if deterministic and check_version(torch.__version__, '1.12.0'): # https://github.com/ultralytics/yolov5/pull/8213
torch.use_deterministic_algorithms(True)
torch.backends.cudnn.deterministic = True