Skip to content

Commit 1f19d91

Browse files
add fetch safetensors (#54)
1 parent 3e65b06 commit 1f19d91

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

diffsynth_engine/utils/download.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,10 @@ def fetch_model(
2626
path: Optional[str] = None,
2727
access_token: Optional[str] = None,
2828
source: str = "modelscope",
29+
fetch_safetensors: bool = True,
2930
) -> str:
3031
if source == "modelscope":
31-
return fetch_modelscope_model(model_uri, revision, path, access_token)
32+
return fetch_modelscope_model(model_uri, revision, path, access_token, fetch_safetensors)
3233
if source == "civitai":
3334
return fetch_civitai_model(model_uri)
3435
raise ValueError(f'source should be one of {MODEL_SOURCES} but got "{source}"')
@@ -39,6 +40,7 @@ def fetch_modelscope_model(
3940
revision: Optional[str] = None,
4041
path: Optional[str] = None,
4142
access_token: Optional[str] = None,
43+
fetch_safetensors: bool = True,
4244
) -> str:
4345
lock_file_name = f"modelscope.{model_id.replace('/', '--')}.{revision if revision else '__version'}.lock"
4446
lock_file_path = os.path.join(DIFFSYNTH_FILELOCK_DIR, lock_file_name)
@@ -55,7 +57,7 @@ def fetch_modelscope_model(
5557
else:
5658
path = dirpath
5759

58-
if os.path.isdir(path):
60+
if os.path.isdir(path) and fetch_safetensors:
5961
return _fetch_safetensors(path)
6062
return path
6163

0 commit comments

Comments
 (0)