Browse Source

strip_optimizer() default to save FP16 model

5.0
Glenn Jocher 4 years ago
parent
commit
10145833c3
1 changed files with 1 additions and 0 deletions
  1. +1
    -0
      utils/utils.py

+ 1
- 0
utils/utils.py View File

@@ -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)


Loading…
Cancel
Save