huggingface-hub 0.26.2__py3-none-any.whl → 0.27.0rc0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of huggingface-hub might be problematic. Click here for more details.
- huggingface_hub/__init__.py +49 -23
- huggingface_hub/_commit_scheduler.py +30 -4
- huggingface_hub/_local_folder.py +0 -4
- huggingface_hub/_login.py +38 -54
- huggingface_hub/_snapshot_download.py +6 -3
- huggingface_hub/_tensorboard_logger.py +2 -3
- huggingface_hub/_upload_large_folder.py +1 -1
- huggingface_hub/errors.py +19 -0
- huggingface_hub/fastai_utils.py +3 -2
- huggingface_hub/file_download.py +10 -12
- huggingface_hub/hf_api.py +102 -498
- huggingface_hub/hf_file_system.py +274 -35
- huggingface_hub/hub_mixin.py +5 -25
- huggingface_hub/inference/_client.py +185 -136
- huggingface_hub/inference/_common.py +2 -2
- huggingface_hub/inference/_generated/_async_client.py +186 -137
- huggingface_hub/inference/_generated/types/__init__.py +31 -10
- huggingface_hub/inference/_generated/types/audio_classification.py +3 -5
- huggingface_hub/inference/_generated/types/automatic_speech_recognition.py +4 -8
- huggingface_hub/inference/_generated/types/chat_completion.py +8 -5
- huggingface_hub/inference/_generated/types/depth_estimation.py +1 -1
- huggingface_hub/inference/_generated/types/document_question_answering.py +2 -6
- huggingface_hub/inference/_generated/types/feature_extraction.py +1 -1
- huggingface_hub/inference/_generated/types/fill_mask.py +2 -4
- huggingface_hub/inference/_generated/types/image_classification.py +3 -5
- huggingface_hub/inference/_generated/types/image_segmentation.py +2 -4
- huggingface_hub/inference/_generated/types/image_to_image.py +2 -4
- huggingface_hub/inference/_generated/types/image_to_text.py +4 -8
- huggingface_hub/inference/_generated/types/object_detection.py +2 -4
- huggingface_hub/inference/_generated/types/question_answering.py +2 -4
- huggingface_hub/inference/_generated/types/sentence_similarity.py +1 -1
- huggingface_hub/inference/_generated/types/summarization.py +2 -4
- huggingface_hub/inference/_generated/types/table_question_answering.py +21 -3
- huggingface_hub/inference/_generated/types/text2text_generation.py +2 -4
- huggingface_hub/inference/_generated/types/text_classification.py +4 -10
- huggingface_hub/inference/_generated/types/text_to_audio.py +6 -10
- huggingface_hub/inference/_generated/types/text_to_image.py +2 -4
- huggingface_hub/inference/_generated/types/text_to_speech.py +6 -10
- huggingface_hub/inference/_generated/types/token_classification.py +11 -12
- huggingface_hub/inference/_generated/types/translation.py +2 -4
- huggingface_hub/inference/_generated/types/video_classification.py +3 -4
- huggingface_hub/inference/_generated/types/visual_question_answering.py +2 -5
- huggingface_hub/inference/_generated/types/zero_shot_classification.py +8 -18
- huggingface_hub/inference/_generated/types/zero_shot_image_classification.py +9 -19
- huggingface_hub/inference/_generated/types/zero_shot_object_detection.py +7 -9
- huggingface_hub/keras_mixin.py +3 -2
- huggingface_hub/lfs.py +2 -5
- huggingface_hub/repocard_data.py +4 -4
- huggingface_hub/serialization/__init__.py +2 -0
- huggingface_hub/serialization/_dduf.py +387 -0
- huggingface_hub/serialization/_torch.py +407 -25
- huggingface_hub/utils/_cache_manager.py +1 -1
- huggingface_hub/utils/_datetime.py +14 -9
- huggingface_hub/utils/_headers.py +9 -25
- huggingface_hub/utils/tqdm.py +15 -0
- {huggingface_hub-0.26.2.dist-info → huggingface_hub-0.27.0rc0.dist-info}/METADATA +8 -3
- {huggingface_hub-0.26.2.dist-info → huggingface_hub-0.27.0rc0.dist-info}/RECORD +61 -61
- {huggingface_hub-0.26.2.dist-info → huggingface_hub-0.27.0rc0.dist-info}/WHEEL +1 -1
- huggingface_hub/_multi_commits.py +0 -306
- {huggingface_hub-0.26.2.dist-info → huggingface_hub-0.27.0rc0.dist-info}/LICENSE +0 -0
- {huggingface_hub-0.26.2.dist-info → huggingface_hub-0.27.0rc0.dist-info}/entry_points.txt +0 -0
- {huggingface_hub-0.26.2.dist-info → huggingface_hub-0.27.0rc0.dist-info}/top_level.txt +0 -0
huggingface_hub/fastai_utils.py
CHANGED
|
@@ -345,7 +345,7 @@ def push_to_hub_fastai(
|
|
|
345
345
|
*,
|
|
346
346
|
repo_id: str,
|
|
347
347
|
commit_message: str = "Push FastAI model using huggingface_hub.",
|
|
348
|
-
private: bool =
|
|
348
|
+
private: Optional[bool] = None,
|
|
349
349
|
token: Optional[str] = None,
|
|
350
350
|
config: Optional[dict] = None,
|
|
351
351
|
branch: Optional[str] = None,
|
|
@@ -369,8 +369,9 @@ def push_to_hub_fastai(
|
|
|
369
369
|
The repository id for your model in Hub in the format of "namespace/repo_name". The namespace can be your individual account or an organization to which you have write access (for example, 'stanfordnlp/stanza-de').
|
|
370
370
|
commit_message (`str`, *optional*):
|
|
371
371
|
Message to commit while pushing. Will default to :obj:`"add model"`.
|
|
372
|
-
private (`bool`, *optional
|
|
372
|
+
private (`bool`, *optional*):
|
|
373
373
|
Whether or not the repository created should be private.
|
|
374
|
+
If `None` (default), will default to been public except if the organization's default is private.
|
|
374
375
|
token (`str`, *optional*):
|
|
375
376
|
The Hugging Face account token to use as HTTP bearer authorization for remote files. If :obj:`None`, the token will be asked by a prompt.
|
|
376
377
|
config (`dict`, *optional*):
|
huggingface_hub/file_download.py
CHANGED
|
@@ -62,6 +62,7 @@ from .utils import (
|
|
|
62
62
|
from .utils._runtime import _PY_VERSION # noqa: F401 # for backward compatibility
|
|
63
63
|
from .utils._typing import HTTP_METHOD_T
|
|
64
64
|
from .utils.sha import sha_fileobj
|
|
65
|
+
from .utils.tqdm import is_tqdm_disabled
|
|
65
66
|
|
|
66
67
|
|
|
67
68
|
logger = logging.get_logger(__name__)
|
|
@@ -390,9 +391,8 @@ def http_get(
|
|
|
390
391
|
|
|
391
392
|
consistency_error_message = (
|
|
392
393
|
f"Consistency check failed: file should be of size {expected_size} but has size"
|
|
393
|
-
f" {{actual_size}} ({displayed_filename}).\
|
|
394
|
-
" with `force_download=True
|
|
395
|
-
"on https://github.com/huggingface/huggingface_hub."
|
|
394
|
+
f" {{actual_size}} ({displayed_filename}).\nThis is usually due to network issues while downloading the file."
|
|
395
|
+
" Please retry with `force_download=True`."
|
|
396
396
|
)
|
|
397
397
|
|
|
398
398
|
# Stream file to buffer
|
|
@@ -403,9 +403,7 @@ def http_get(
|
|
|
403
403
|
total=total,
|
|
404
404
|
initial=resume_size,
|
|
405
405
|
desc=displayed_filename,
|
|
406
|
-
disable=
|
|
407
|
-
# ^ set `disable=None` rather than `disable=False` by default to disable progress bar when no TTY attached
|
|
408
|
-
# see https://github.com/huggingface/huggingface_hub/pull/2000
|
|
406
|
+
disable=is_tqdm_disabled(logger.getEffectiveLevel()),
|
|
409
407
|
name="huggingface_hub.http_get",
|
|
410
408
|
)
|
|
411
409
|
if _tqdm_bar is None
|
|
@@ -821,7 +819,7 @@ def hf_hub_download(
|
|
|
821
819
|
if repo_type not in constants.REPO_TYPES:
|
|
822
820
|
raise ValueError(f"Invalid repo type: {repo_type}. Accepted repo types are: {str(constants.REPO_TYPES)}")
|
|
823
821
|
|
|
824
|
-
|
|
822
|
+
hf_headers = build_hf_headers(
|
|
825
823
|
token=token,
|
|
826
824
|
library_name=library_name,
|
|
827
825
|
library_version=library_version,
|
|
@@ -850,7 +848,7 @@ def hf_hub_download(
|
|
|
850
848
|
# HTTP info
|
|
851
849
|
endpoint=endpoint,
|
|
852
850
|
etag_timeout=etag_timeout,
|
|
853
|
-
headers=
|
|
851
|
+
headers=hf_headers,
|
|
854
852
|
proxies=proxies,
|
|
855
853
|
token=token,
|
|
856
854
|
# Additional options
|
|
@@ -870,7 +868,7 @@ def hf_hub_download(
|
|
|
870
868
|
# HTTP info
|
|
871
869
|
endpoint=endpoint,
|
|
872
870
|
etag_timeout=etag_timeout,
|
|
873
|
-
headers=
|
|
871
|
+
headers=hf_headers,
|
|
874
872
|
proxies=proxies,
|
|
875
873
|
token=token,
|
|
876
874
|
# Additional options
|
|
@@ -1283,20 +1281,20 @@ def get_hf_file_metadata(
|
|
|
1283
1281
|
A [`HfFileMetadata`] object containing metadata such as location, etag, size and
|
|
1284
1282
|
commit_hash.
|
|
1285
1283
|
"""
|
|
1286
|
-
|
|
1284
|
+
hf_headers = build_hf_headers(
|
|
1287
1285
|
token=token,
|
|
1288
1286
|
library_name=library_name,
|
|
1289
1287
|
library_version=library_version,
|
|
1290
1288
|
user_agent=user_agent,
|
|
1291
1289
|
headers=headers,
|
|
1292
1290
|
)
|
|
1293
|
-
|
|
1291
|
+
hf_headers["Accept-Encoding"] = "identity" # prevent any compression => we want to know the real size of the file
|
|
1294
1292
|
|
|
1295
1293
|
# Retrieve metadata
|
|
1296
1294
|
r = _request_wrapper(
|
|
1297
1295
|
method="HEAD",
|
|
1298
1296
|
url=url,
|
|
1299
|
-
headers=
|
|
1297
|
+
headers=hf_headers,
|
|
1300
1298
|
allow_redirects=False,
|
|
1301
1299
|
follow_relative_redirects=True,
|
|
1302
1300
|
proxies=proxies,
|