Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move away from cached_download #8419

Merged
merged 4 commits into from
Jun 7, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 5 additions & 11 deletions src/diffusers/utils/dynamic_modules_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,14 @@
from typing import Dict, Optional, Union
from urllib import request

from huggingface_hub import cached_download, hf_hub_download, model_info
from huggingface_hub import hf_hub_download, model_info
from huggingface_hub.utils import validate_hf_hub_args
from packaging import version

from .. import __version__
from . import DIFFUSERS_DYNAMIC_MODULE_NAME, HF_MODULES_CACHE, logging


COMMUNITY_PIPELINES_URL = (
"https://raw.githubusercontent.com/huggingface/diffusers/{revision}/examples/community/{pipeline}.py"
)


logger = logging.get_logger(__name__) # pylint: disable=invalid-name


Expand Down Expand Up @@ -282,16 +277,15 @@ def get_cached_module_file(
)

# community pipeline on GitHub
github_url = COMMUNITY_PIPELINES_URL.format(revision=revision, pipeline=pretrained_model_name_or_path)
try:
resolved_module_file = cached_download(
github_url,
resolved_module_file = hf_hub_download(
repo_id="diffusers/community-pipelines-mirror",
Wauplin marked this conversation as resolved.
Show resolved Hide resolved
repo_type="dataset",
filename=f"{revision}/{pretrained_model_name_or_path}.py",
cache_dir=cache_dir,
force_download=force_download,
proxies=proxies,
resume_download=resume_download,
local_files_only=local_files_only,
token=False,
)
submodule = "git"
module_file = pretrained_model_name_or_path + ".py"
Expand Down
Loading