提交 14523bb0 authored 作者: Glenn Jocher's avatar Glenn Jocher

FP16 to FP32 ckpt load

上级 c5966abb
...@@ -112,8 +112,8 @@ def train(hyp): ...@@ -112,8 +112,8 @@ def train(hyp):
# load model # load model
try: try:
ckpt['model'] = \ ckpt['model'] = {k: v for k, v in ckpt['model'].float().state_dict().items()
{k: v for k, v in ckpt['model'].state_dict().items() if model.state_dict()[k].numel() == v.numel()} 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. Specify --weights '' or specify a --cfg compatible with %s." \
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论