mirror of
https://git.datalinker.icu/vllm-project/vllm.git
synced 2025-12-21 06:15:01 +08:00
[Bugfix] Gracefully handle huggingface hub http error (#12571)
This commit is contained in:
parent
cabaf4eff3
commit
7a8987dac5
@ -7,7 +7,8 @@ from typing import Any, Dict, Optional, Type, Union
|
|||||||
import huggingface_hub
|
import huggingface_hub
|
||||||
from huggingface_hub import (file_exists, hf_hub_download,
|
from huggingface_hub import (file_exists, hf_hub_download,
|
||||||
try_to_load_from_cache)
|
try_to_load_from_cache)
|
||||||
from huggingface_hub.utils import (EntryNotFoundError, LocalEntryNotFoundError,
|
from huggingface_hub.utils import (EntryNotFoundError, HfHubHTTPError,
|
||||||
|
LocalEntryNotFoundError,
|
||||||
RepositoryNotFoundError,
|
RepositoryNotFoundError,
|
||||||
RevisionNotFoundError)
|
RevisionNotFoundError)
|
||||||
from torch import nn
|
from torch import nn
|
||||||
@ -294,6 +295,13 @@ def get_hf_file_to_dict(file_name: str,
|
|||||||
logger.debug("File or repository not found in hf_hub_download",
|
logger.debug("File or repository not found in hf_hub_download",
|
||||||
e)
|
e)
|
||||||
return None
|
return None
|
||||||
|
except HfHubHTTPError as e:
|
||||||
|
logger.warning(
|
||||||
|
"Cannot connect to Hugging Face Hub. Skipping file "
|
||||||
|
"download for '%s':",
|
||||||
|
file_name,
|
||||||
|
exc_info=e)
|
||||||
|
return None
|
||||||
file_path = Path(hf_hub_file)
|
file_path = Path(hf_hub_file)
|
||||||
|
|
||||||
with open(file_path) as file:
|
with open(file_path) as file:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user