Skip to content

Commit

Permalink
restore deterministic init_seeds code
Browse files Browse the repository at this point in the history
  • Loading branch information
glenn-jocher committed Aug 20, 2022
1 parent 1a84f47 commit 8b70e64
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion segment/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down
2 changes: 1 addition & 1 deletion utils/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 8b70e64

Please sign in to comment.