glenn-jocher commited on
Commit
1f698af
·
1 Parent(s): 546f973

create_backbone with SourceChangeWarning update

Browse files
Files changed (1) hide show
  1. utils/utils.py +5 -1
utils/utils.py CHANGED
@@ -557,7 +557,11 @@ def strip_optimizer(f='weights/best.pt'): # from utils.utils import *; strip_op
557
 
558
  def create_backbone(f='weights/best.pt', s='weights/backbone.pt'): # from utils.utils import *; create_backbone()
559
  # create backbone 's' from 'f'
560
- x = torch.load(f, map_location=torch.device('cpu'))
 
 
 
 
561
  x['optimizer'] = None
562
  x['training_results'] = None
563
  x['epoch'] = -1
 
557
 
558
  def create_backbone(f='weights/best.pt', s='weights/backbone.pt'): # from utils.utils import *; create_backbone()
559
  # create backbone 's' from 'f'
560
+ device = torch.device('cpu')
561
+ x = torch.load(f, map_location=device)
562
+ torch.save(x, s) # update model if SourceChangeWarning
563
+ x = torch.load(s, map_location=device)
564
+
565
  x['optimizer'] = None
566
  x['training_results'] = None
567
  x['epoch'] = -1