Fix subpath model downloads

This commit is contained in:
doctorpangloss 2024-03-18 10:10:34 -07:00
parent a892411cf8
commit 74a9c45395
2 changed files with 3 additions and 1 deletions

View File

@ -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]
known_file: Optional[HuggingFile | CivitFile] = None
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
break
if known_file is None:

View File

@ -24,6 +24,8 @@ PROGRESS_BAR_HOOK = None
def load_torch_file(ckpt, safe_load=False, device=None):
if device is None:
device = torch.device("cpu")
if ckpt is None:
raise FileNotFoundError("the checkpoint was not found")
if ckpt.lower().endswith(".safetensors"):
sd = safetensors.torch.load_file(ckpt, device=device.type)
else: