mirror of
https://github.com/huggingface/transformers.git
synced 2025-07-31 02:02:21 +06:00
Use hf_raise_for_status
instead of deprecated _raise_for_status
(#19244)
* Use instead of from huggingface_hub * bump huggingface_hub to 0.10.0 + make deps_table_update
This commit is contained in:
parent
3a27ba3d18
commit
902d30b31a
2
setup.py
2
setup.py
@ -116,7 +116,7 @@ _deps = [
|
||||
"fugashi>=1.0",
|
||||
"GitPython<3.1.19",
|
||||
"hf-doc-builder>=0.3.0",
|
||||
"huggingface-hub>=0.9.0,<1.0",
|
||||
"huggingface-hub>=0.10.0,<1.0",
|
||||
"importlib_metadata",
|
||||
"ipadic>=1.0.0,<2.0",
|
||||
"isort>=5.5.4",
|
||||
|
@ -22,7 +22,7 @@ deps = {
|
||||
"fugashi": "fugashi>=1.0",
|
||||
"GitPython": "GitPython<3.1.19",
|
||||
"hf-doc-builder": "hf-doc-builder>=0.3.0",
|
||||
"huggingface-hub": "huggingface-hub>=0.9.0,<1.0",
|
||||
"huggingface-hub": "huggingface-hub>=0.10.0,<1.0",
|
||||
"importlib_metadata": "importlib_metadata",
|
||||
"ipadic": "ipadic>=1.0.0,<2.0",
|
||||
"isort": "isort>=5.5.4",
|
||||
|
@ -45,6 +45,7 @@ from huggingface_hub.utils import (
|
||||
LocalEntryNotFoundError,
|
||||
RepositoryNotFoundError,
|
||||
RevisionNotFoundError,
|
||||
hf_raise_for_status,
|
||||
)
|
||||
from requests.exceptions import HTTPError
|
||||
from transformers.utils.logging import tqdm
|
||||
@ -607,7 +608,7 @@ def has_file(
|
||||
|
||||
r = requests.head(url, headers=headers, allow_redirects=False, proxies=proxies, timeout=10)
|
||||
try:
|
||||
huggingface_hub.utils._errors._raise_for_status(r)
|
||||
hf_raise_for_status(r)
|
||||
return True
|
||||
except RepositoryNotFoundError as e:
|
||||
logger.error(e)
|
||||
@ -993,7 +994,7 @@ def get_hub_metadata(url, token=None):
|
||||
r = huggingface_hub.file_download._request_with_retry(
|
||||
method="HEAD", url=url, headers=headers, allow_redirects=False
|
||||
)
|
||||
huggingface_hub.file_download._raise_for_status(r)
|
||||
hf_raise_for_status(r)
|
||||
commit_hash = r.headers.get(HUGGINGFACE_HEADER_X_REPO_COMMIT)
|
||||
etag = r.headers.get(HUGGINGFACE_HEADER_X_LINKED_ETAG) or r.headers.get("ETag")
|
||||
if etag is not None:
|
||||
|
Loading…
Reference in New Issue
Block a user