mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-28 23:30:16 +08:00
Fix subpath model downloads
This commit is contained in:
parent
a892411cf8
commit
74a9c45395
@ -33,7 +33,7 @@ def get_or_download(folder_name: str, filename: str, known_files: List[HuggingFi
|
|||||||
destination = folder_paths.get_folder_paths(folder_name)[0]
|
destination = folder_paths.get_folder_paths(folder_name)[0]
|
||||||
known_file: Optional[HuggingFile | CivitFile] = None
|
known_file: Optional[HuggingFile | CivitFile] = None
|
||||||
for candidate in known_files:
|
for candidate in known_files:
|
||||||
if candidate.filename == filename or filename in candidate.alternate_filenames or filename == candidate.save_with_filename:
|
if str(candidate) == filename or candidate.filename == filename or filename in candidate.alternate_filenames or filename == candidate.save_with_filename:
|
||||||
known_file = candidate
|
known_file = candidate
|
||||||
break
|
break
|
||||||
if known_file is None:
|
if known_file is None:
|
||||||
|
|||||||
@ -24,6 +24,8 @@ PROGRESS_BAR_HOOK = None
|
|||||||
def load_torch_file(ckpt, safe_load=False, device=None):
|
def load_torch_file(ckpt, safe_load=False, device=None):
|
||||||
if device is None:
|
if device is None:
|
||||||
device = torch.device("cpu")
|
device = torch.device("cpu")
|
||||||
|
if ckpt is None:
|
||||||
|
raise FileNotFoundError("the checkpoint was not found")
|
||||||
if ckpt.lower().endswith(".safetensors"):
|
if ckpt.lower().endswith(".safetensors"):
|
||||||
sd = safetensors.torch.load_file(ckpt, device=device.type)
|
sd = safetensors.torch.load_file(ckpt, device=device.type)
|
||||||
else:
|
else:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user