mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-12 07:10:52 +08:00
Fix model downloader
This commit is contained in:
parent
34c9482cfb
commit
0b45fa8db1
@ -458,7 +458,7 @@ def _get_cache_hits(cache_dirs: Sequence[str], local_dirs: Sequence[str], repo_i
|
||||
# remove .huggingface
|
||||
local_files = set(f for f in local_files if not f.startswith(f"{repo_id}/.huggingface"))
|
||||
# local_files.issubsetof(repo_files)
|
||||
if local_files.issubset(repo_files):
|
||||
if len(local_files) > 0 and local_files.issubset(repo_files):
|
||||
local_dirs_snapshots.append(str(local_path))
|
||||
else:
|
||||
# an empty repository or unknown repository info, trust that if the directory exists, it matches
|
||||
|
||||
@ -58,11 +58,12 @@ def test_known_repos(tmp_path_factory):
|
||||
_delete_repo_from_huggingface_cache(test_repo_id)
|
||||
_delete_repo_from_huggingface_cache(test_repo_id, test_cache_dir)
|
||||
try:
|
||||
folder_paths.folder_names_and_paths["huggingface"] = FolderPathsTuple("huggingface", [test_local_dir], {""})
|
||||
folder_paths.folder_names_and_paths["huggingface_cache"] = FolderPathsTuple("huggingface_cache", [test_cache_dir], {""})
|
||||
folder_paths.folder_names_and_paths["huggingface"] += FolderPathsTuple("huggingface", [test_local_dir], {""})
|
||||
folder_paths.folder_names_and_paths["huggingface_cache"] += FolderPathsTuple("huggingface_cache", [test_cache_dir], {""})
|
||||
|
||||
cache_hits, locals_hits = _get_cache_hits([test_cache_dir], [test_local_dir], test_repo_id)
|
||||
assert len(cache_hits) == len(locals_hits) == 0, "not downloaded yet"
|
||||
assert len(cache_hits) == 0, "not downloaded yet"
|
||||
assert len(locals_hits) == 0, "not downloaded yet"
|
||||
|
||||
# test downloading the repo and observing a cache hit on second access
|
||||
existing_repos = get_huggingface_repo_list()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user