diff --git a/comfy/model_downloader.py b/comfy/model_downloader.py index 42a781c00..605f55e85 100644 --- a/comfy/model_downloader.py +++ b/comfy/model_downloader.py @@ -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 diff --git a/tests/downloader/test_huggingface_downloads.py b/tests/downloader/test_huggingface_downloads.py index 692701d6d..1afe1dbeb 100644 --- a/tests/downloader/test_huggingface_downloads.py +++ b/tests/downloader/test_huggingface_downloads.py @@ -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()