This commit is contained in:
Glenn Jocher 2019-11-14 17:32:28 -08:00
parent 985006a52a
commit eb8b39535a
1 changed files with 2 additions and 1 deletions

View File

@ -578,7 +578,8 @@ def print_model_biases(model):
def strip_optimizer(f='weights/last.pt'): # from utils.utils import *; strip_optimizer() def strip_optimizer(f='weights/last.pt'): # from utils.utils import *; strip_optimizer()
# Strip optimizer from *.pt files for lighter files (reduced by 2/3 size) # Strip optimizer from *.pt files for lighter files (reduced by 2/3 size)
x = torch.load(f) x = torch.load(f, map_location=torch.device('cpu'))
# x['epoch'] = 0 # uncomment to create a backbone
x['optimizer'] = None x['optimizer'] = None
torch.save(x, f) torch.save(x, f)