soiz commited on
Commit
522f04e
·
verified ·
1 Parent(s): a9c6794

Update CodeFormer/basicsr/utils/realesrgan_utils.py

Browse files
CodeFormer/basicsr/utils/realesrgan_utils.py CHANGED
@@ -53,7 +53,7 @@ class RealESRGANer():
53
  if model_path.startswith('https://'):
54
  model_path = load_file_from_url(
55
  url=model_path, model_dir=os.path.join('weights/realesrgan'), progress=True, file_name=None)
56
- loadnet = torch.load(model_path, map_location=torch.device('cpu'))
57
  # prefer to use params_ema
58
  if 'params_ema' in loadnet:
59
  keyname = 'params_ema'
 
53
  if model_path.startswith('https://'):
54
  model_path = load_file_from_url(
55
  url=model_path, model_dir=os.path.join('weights/realesrgan'), progress=True, file_name=None)
56
+ loadnet = torch.load(model_path, map_location=torch.device('cpu'), weights_only=True)
57
  # prefer to use params_ema
58
  if 'params_ema' in loadnet:
59
  keyname = 'params_ema'