提交 10145833 authored 作者: Glenn Jocher's avatar Glenn Jocher

strip_optimizer() default to save FP16 model

上级 cce95e74
......@@ -620,6 +620,7 @@ def strip_optimizer(f='weights/best.pt'): # from utils.utils import *; strip_op
# Strip optimizer from *.pt files for lighter files (reduced by 1/2 size)
x = torch.load(f, map_location=torch.device('cpu'))
x['optimizer'] = None
x['model'].half() # to FP16
torch.save(x, f)
print('Optimizer stripped from %s' % f)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论