Tommy in Tongji glenn-jocher commited on
Commit
135ec5c
·
unverified ·
1 Parent(s): 69be8e7

W&B ID reset on training completion (#1852)

Browse files

* Update train.py

Fix the bug of always the same W&B ID and continue overwrite with the old logging.
BUG report
https://github.com/ultralytics/yolov5/issues/1851

* Fix the bug of duplicate W&B ID

fix the bug of https://github.com/ultralytics/yolov5/issues/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.

* Update general.py

* revert train.py changes

Co-authored-by: Glenn Jocher <[email protected]>

Files changed (1) hide show
  1. utils/general.py +2 -2
utils/general.py CHANGED
@@ -361,8 +361,8 @@ def non_max_suppression(prediction, conf_thres=0.25, iou_thres=0.45, classes=Non
361
  def strip_optimizer(f='weights/best.pt', s=''): # from utils.general import *; strip_optimizer()
362
  # Strip optimizer from 'f' to finalize training, optionally save as 's'
363
  x = torch.load(f, map_location=torch.device('cpu'))
364
- x['optimizer'] = None
365
- x['training_results'] = None
366
  x['epoch'] = -1
367
  x['model'].half() # to FP16
368
  for p in x['model'].parameters():
 
361
  def strip_optimizer(f='weights/best.pt', s=''): # from utils.general import *; strip_optimizer()
362
  # Strip optimizer from 'f' to finalize training, optionally save as 's'
363
  x = torch.load(f, map_location=torch.device('cpu'))
364
+ for key in 'optimizer', 'training_results', 'wandb_id':
365
+ x[key] = None
366
  x['epoch'] = -1
367
  x['model'].half() # to FP16
368
  for p in x['model'].parameters():