johntito commited on
Commit
e44a604
·
1 Parent(s): 2ef7c17

修改模型权重加载方式为'cpu'而不是'cuda'

Browse files
Files changed (1) hide show
  1. utils.py +2 -2
utils.py CHANGED
@@ -17,8 +17,8 @@ logger = logging
17
 
18
  def load_checkpoint(checkpoint_path, model, optimizer=None):
19
  assert os.path.isfile(checkpoint_path)
20
- # checkpoint_dict = torch.load(checkpoint_path, map_location='cpu')
21
- checkpoint_dict = torch.load(checkpoint_path, map_location='cuda:0', weights_only=True)
22
 
23
  iteration = checkpoint_dict['iteration']
24
  learning_rate = checkpoint_dict['learning_rate']
 
17
 
18
  def load_checkpoint(checkpoint_path, model, optimizer=None):
19
  assert os.path.isfile(checkpoint_path)
20
+ checkpoint_dict = torch.load(checkpoint_path, map_location='cpu')
21
+ #checkpoint_dict = torch.load(checkpoint_path, map_location='cuda:0', weights_only=True)
22
 
23
  iteration = checkpoint_dict['iteration']
24
  learning_rate = checkpoint_dict['learning_rate']