add back local_files_only to from_pretrained

This commit is contained in:
Qing
2024-01-16 22:25:25 +08:00
parent 8dd3a06945
commit 84c2b515c8
12 changed files with 63 additions and 18 deletions

View File

@@ -971,6 +971,12 @@ def get_scheduler(sd_sampler, scheduler_config):
raise ValueError(sd_sampler)
def is_local_files_only(**kwargs) -> bool:
from huggingface_hub.constants import HF_HUB_OFFLINE
return HF_HUB_OFFLINE or kwargs.get("local_files_only", False)
def handle_from_pretrained_exceptions(func, **kwargs):
try:
return func(**kwargs)