Skip to content

Commit

Permalink
Fix the bug of duplicate W&B ID
Browse files Browse the repository at this point in the history
fix the bug of ultralytics#1851
If we had trained on yolov5s.pt, the program will generate a new unique W&B ID.
If we hadn't, the program will keep the old code, we can still use --resume aug.
  • Loading branch information
TommyZihao authored Jan 6, 2021
1 parent 726206a commit f6d6119
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion train.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,13 @@ def train(hyp, opt, device, tb_writer=None, wandb=None):
# Logging
if rank in [-1, 0] and wandb and wandb.run is None:
opt.hyp = hyp # add hyperparameters
wandb_ID = wandb.util.generate_id()

# check whether wandb_ID is unique
temp_ID = ckpt.get('wandb_id') if 'ckpt' in locals() else None
if temp_ID == '3hdht16b':
wandb_ID = wandb.util.generate_id()
else:
wandb_ID = temp_ID
wandb_run = wandb.init(config=opt, resume="allow",
project='YOLOv5' if opt.project == 'runs/train' else Path(opt.project).stem,
name=save_dir.stem,
Expand Down

0 comments on commit f6d6119

Please sign in to comment.