Spaces:
Running
on
Zero
Running
on
Zero
quantumiracle
commited on
Commit
·
a552667
1
Parent(s):
2848fdc
fix
Browse files- SUPIR/util.py +6 -4
SUPIR/util.py
CHANGED
@@ -32,14 +32,16 @@ def create_model(config_path):
|
|
32 |
|
33 |
def resolve_ckpt_path(path_or_hub):
|
34 |
if os.path.exists(path_or_hub):
|
35 |
-
return path_or_hub #
|
36 |
-
|
37 |
-
|
|
|
38 |
parts = path_or_hub.split("/")
|
39 |
repo_id = "/".join(parts[:2])
|
40 |
filename = "/".join(parts[2:])
|
41 |
return hf_hub_download(repo_id=repo_id, filename=filename)
|
42 |
-
|
|
|
43 |
|
44 |
def create_SUPIR_model(config_path, SUPIR_sign=None, load_default_setting=False):
|
45 |
config = OmegaConf.load(config_path)
|
|
|
32 |
|
33 |
def resolve_ckpt_path(path_or_hub):
|
34 |
if os.path.exists(path_or_hub):
|
35 |
+
return path_or_hub # Local path
|
36 |
+
|
37 |
+
# Handle Hugging Face Hub repo/file pattern
|
38 |
+
if "/" in path_or_hub and path_or_hub.endswith((".ckpt", ".safetensors", ".bin")):
|
39 |
parts = path_or_hub.split("/")
|
40 |
repo_id = "/".join(parts[:2])
|
41 |
filename = "/".join(parts[2:])
|
42 |
return hf_hub_download(repo_id=repo_id, filename=filename)
|
43 |
+
|
44 |
+
raise FileNotFoundError(f"Could not resolve checkpoint path: {path_or_hub}")
|
45 |
|
46 |
def create_SUPIR_model(config_path, SUPIR_sign=None, load_default_setting=False):
|
47 |
config = OmegaConf.load(config_path)
|