From 8b70e64fca7a3b7d9f77012dc0371a7af72f9c78 Mon Sep 17 00:00:00 2001 From: glennjocher Date: Sun, 21 Aug 2022 00:34:22 +0200 Subject: [PATCH] restore deterministic init_seeds code --- segment/train.py | 2 +- utils/general.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/segment/train.py b/segment/train.py index 102de6239342..d1d7b8dc1686 100644 --- a/segment/train.py +++ b/segment/train.py @@ -99,7 +99,7 @@ def train(hyp, opt, device): # hyp is path/to/hyp.yaml or hyp dictionary plots = not evolve and not opt.noplots # create plots overlap = opt.overlap_mask cuda = device.type != 'cpu' - init_seeds(opt.seed + 1 + RANK, True) + init_seeds(opt.seed + 1 + RANK, deterministic=False) with torch_distributed_zero_first(LOCAL_RANK): data_dict = data_dict or check_dataset(data) # check if None train_path, val_path = data_dict['train'], data_dict['val'] diff --git a/utils/general.py b/utils/general.py index 30ad949e06cf..35c2e52cb6b3 100644 --- a/utils/general.py +++ b/utils/general.py @@ -242,7 +242,7 @@ def init_seeds(seed=0, deterministic=False): import torch.backends.cudnn as cudnn if deterministic and check_version(torch.__version__, '1.12.0'): # https://github.com/ultralytics/yolov5/pull/8213 - # torch.use_deterministic_algorithms(True) + torch.use_deterministic_algorithms(True) os.environ['CUBLAS_WORKSPACE_CONFIG'] = ':4096:8' os.environ['PYTHONHASHSEED'] = str(seed)