"...git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "8ac29fe0905c3f7f04963ef22c4f61e59ee1004a"
Unverified Commit a9a671cb authored by Maksim Skobeev's avatar Maksim Skobeev Committed by GitHub
Browse files

replace to hf_hub_download

parent 362a0316
...@@ -4,7 +4,7 @@ from torch.nn import functional as F ...@@ -4,7 +4,7 @@ from torch.nn import functional as F
from PIL import Image from PIL import Image
import numpy as np import numpy as np
import cv2 import cv2
from huggingface_hub import hf_hub_url, cached_download from huggingface_hub import hf_hub_url, hf_hub_download
from .rrdbnet_arch import RRDBNet from .rrdbnet_arch import RRDBNet
from .utils import pad_reflect, split_image_into_overlapping_patches, stich_together, \ from .utils import pad_reflect, split_image_into_overlapping_patches, stich_together, \
...@@ -43,7 +43,7 @@ class RealESRGAN: ...@@ -43,7 +43,7 @@ class RealESRGAN:
cache_dir = os.path.dirname(model_path) cache_dir = os.path.dirname(model_path)
local_filename = os.path.basename(model_path) local_filename = os.path.basename(model_path)
config_file_url = hf_hub_url(repo_id=config['repo_id'], filename=config['filename']) config_file_url = hf_hub_url(repo_id=config['repo_id'], filename=config['filename'])
cached_download(config_file_url, cache_dir=cache_dir, force_filename=local_filename) hf_hub_download(repo_id=config['repo_id'], cache_dir=cache_dir, force_filename=local_filename)
print('Weights downloaded to:', os.path.join(cache_dir, local_filename)) print('Weights downloaded to:', os.path.join(cache_dir, local_filename))
loadnet = torch.load(model_path) loadnet = torch.load(model_path)
...@@ -87,4 +87,4 @@ class RealESRGAN: ...@@ -87,4 +87,4 @@ class RealESRGAN:
sr_img = unpad_image(sr_img, pad_size*scale) sr_img = unpad_image(sr_img, pad_size*scale)
sr_img = Image.fromarray(sr_img) sr_img = Image.fromarray(sr_img)
return sr_img return sr_img
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment