update train.py incompatible model message fix #222

pull/1/head
Glenn Jocher 5 years ago
parent 01895f3924
commit b203c9b7ff

@ -118,8 +118,9 @@ def train(hyp):
if model.state_dict()[k].shape == v.shape} # to FP32, filter if model.state_dict()[k].shape == v.shape} # to FP32, filter
model.load_state_dict(ckpt['model'], strict=False) model.load_state_dict(ckpt['model'], strict=False)
except KeyError as e: except KeyError as e:
s = "%s is not compatible with %s. Specify --weights '' or specify a --cfg compatible with %s." \ s = "%s is not compatible with %s. This may be due to model differences or %s may be out of date. " \
% (opt.weights, opt.cfg, opt.weights) "Please delete or update %s and try again, or use --weights '' to train from scatch." \
% (opt.weights, opt.cfg, opt.weights, opt.weights)
raise KeyError(s) from e raise KeyError(s) from e
# load optimizer # load optimizer

Loading…
Cancel
Save