huggingface-hub 0.23.5__tar.gz → 0.24.1__tar.gz
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-0.23.5 → huggingface_hub-0.24.1}/PKG-INFO +2 -2
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/README.md +1 -1
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/setup.py +4 -3
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/__init__.py +47 -15
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/_commit_api.py +38 -8
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/_inference_endpoints.py +11 -4
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/_local_folder.py +22 -13
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/_snapshot_download.py +12 -7
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/_webhooks_server.py +3 -1
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/commands/huggingface_cli.py +4 -3
- huggingface_hub-0.24.1/src/huggingface_hub/commands/repo_files.py +128 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/constants.py +12 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/file_download.py +127 -91
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/hf_api.py +976 -341
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/hf_file_system.py +30 -3
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/inference/_client.py +408 -147
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/inference/_common.py +25 -63
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/inference/_generated/_async_client.py +425 -153
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/inference/_generated/types/__init__.py +4 -1
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/inference/_generated/types/chat_completion.py +41 -21
- huggingface_hub-0.24.1/src/huggingface_hub/inference/_generated/types/feature_extraction.py +37 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/inference/_generated/types/text_generation.py +29 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/lfs.py +11 -6
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/repocard_data.py +3 -3
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/repository.py +6 -6
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/serialization/__init__.py +8 -3
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/serialization/_base.py +13 -16
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/serialization/_tensorflow.py +4 -3
- huggingface_hub-0.24.1/src/huggingface_hub/serialization/_torch.py +577 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/utils/__init__.py +0 -1
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/utils/_errors.py +1 -1
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/utils/_fixes.py +14 -3
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/utils/_paths.py +17 -6
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/utils/_subprocess.py +0 -1
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/utils/_telemetry.py +9 -1
- huggingface_hub-0.24.1/src/huggingface_hub/utils/endpoint_helpers.py +66 -0
- huggingface_hub-0.24.1/src/huggingface_hub/utils/sha.py +64 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/utils/tqdm.py +0 -1
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub.egg-info/PKG-INFO +2 -2
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub.egg-info/SOURCES.txt +1 -1
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub.egg-info/requires.txt +10 -7
- huggingface_hub-0.23.5/src/huggingface_hub/inference/_generated/types/feature_extraction.py +0 -19
- huggingface_hub-0.23.5/src/huggingface_hub/serialization/_numpy.py +0 -68
- huggingface_hub-0.23.5/src/huggingface_hub/serialization/_torch.py +0 -200
- huggingface_hub-0.23.5/src/huggingface_hub/utils/endpoint_helpers.py +0 -250
- huggingface_hub-0.23.5/src/huggingface_hub/utils/sha.py +0 -29
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/LICENSE +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/MANIFEST.in +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/pyproject.toml +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/setup.cfg +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/_commit_scheduler.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/_login.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/_multi_commits.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/_space_api.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/_tensorboard_logger.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/_webhooks_payload.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/commands/__init__.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/commands/_cli_utils.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/commands/delete_cache.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/commands/download.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/commands/env.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/commands/lfs.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/commands/scan_cache.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/commands/tag.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/commands/upload.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/commands/user.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/community.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/errors.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/fastai_utils.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/hub_mixin.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/inference/__init__.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/inference/_generated/__init__.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/inference/_generated/types/audio_classification.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/inference/_generated/types/audio_to_audio.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/inference/_generated/types/automatic_speech_recognition.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/inference/_generated/types/base.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/inference/_generated/types/depth_estimation.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/inference/_generated/types/document_question_answering.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/inference/_generated/types/fill_mask.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/inference/_generated/types/image_classification.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/inference/_generated/types/image_segmentation.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/inference/_generated/types/image_to_image.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/inference/_generated/types/image_to_text.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/inference/_generated/types/object_detection.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/inference/_generated/types/question_answering.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/inference/_generated/types/sentence_similarity.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/inference/_generated/types/summarization.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/inference/_generated/types/table_question_answering.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/inference/_generated/types/text2text_generation.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/inference/_generated/types/text_classification.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/inference/_generated/types/text_to_audio.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/inference/_generated/types/text_to_image.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/inference/_generated/types/token_classification.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/inference/_generated/types/translation.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/inference/_generated/types/video_classification.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/inference/_generated/types/visual_question_answering.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/inference/_generated/types/zero_shot_classification.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/inference/_generated/types/zero_shot_image_classification.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/inference/_generated/types/zero_shot_object_detection.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/inference/_templating.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/inference/_types.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/inference_api.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/keras_mixin.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/repocard.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/templates/datasetcard_template.md +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/templates/modelcard_template.md +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/utils/_cache_assets.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/utils/_cache_manager.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/utils/_chunk_utils.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/utils/_datetime.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/utils/_deprecation.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/utils/_experimental.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/utils/_git_credential.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/utils/_headers.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/utils/_hf_folder.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/utils/_http.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/utils/_pagination.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/utils/_runtime.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/utils/_safetensors.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/utils/_token.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/utils/_typing.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/utils/_validators.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/utils/insecure_hashlib.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/utils/logging.py +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub.egg-info/dependency_links.txt +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub.egg-info/entry_points.txt +0 -0
- {huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: huggingface_hub
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.24.1
|
|
4
4
|
Summary: Client library to download and publish models, datasets and other repos on the huggingface.co hub
|
|
5
5
|
Home-page: https://github.com/huggingface/huggingface_hub
|
|
6
6
|
Author: Hugging Face, Inc.
|
|
@@ -50,7 +50,7 @@ License-File: LICENSE
|
|
|
50
50
|
<a href="https://huggingface.co/docs/huggingface_hub/en/index"><img alt="Documentation" src="https://img.shields.io/website/http/huggingface.co/docs/huggingface_hub/index.svg?down_color=red&down_message=offline&up_message=online&label=doc"></a>
|
|
51
51
|
<a href="https://github.com/huggingface/huggingface_hub/releases"><img alt="GitHub release" src="https://img.shields.io/github/release/huggingface/huggingface_hub.svg"></a>
|
|
52
52
|
<a href="https://github.com/huggingface/huggingface_hub"><img alt="PyPi version" src="https://img.shields.io/pypi/pyversions/huggingface_hub.svg"></a>
|
|
53
|
-
<a href="https://pypi.org/project/huggingface-hub"><img alt="
|
|
53
|
+
<a href="https://pypi.org/project/huggingface-hub"><img alt="PyPI - Downloads" src="https://img.shields.io/pypi/dm/huggingface_hub"></a>
|
|
54
54
|
<a href="https://codecov.io/gh/huggingface/huggingface_hub"><img alt="Code coverage" src="https://codecov.io/gh/huggingface/huggingface_hub/branch/main/graph/badge.svg?token=RXP95LE2XL"></a>
|
|
55
55
|
</p>
|
|
56
56
|
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
<a href="https://huggingface.co/docs/huggingface_hub/en/index"><img alt="Documentation" src="https://img.shields.io/website/http/huggingface.co/docs/huggingface_hub/index.svg?down_color=red&down_message=offline&up_message=online&label=doc"></a>
|
|
13
13
|
<a href="https://github.com/huggingface/huggingface_hub/releases"><img alt="GitHub release" src="https://img.shields.io/github/release/huggingface/huggingface_hub.svg"></a>
|
|
14
14
|
<a href="https://github.com/huggingface/huggingface_hub"><img alt="PyPi version" src="https://img.shields.io/pypi/pyversions/huggingface_hub.svg"></a>
|
|
15
|
-
<a href="https://pypi.org/project/huggingface-hub"><img alt="
|
|
15
|
+
<a href="https://pypi.org/project/huggingface-hub"><img alt="PyPI - Downloads" src="https://img.shields.io/pypi/dm/huggingface_hub"></a>
|
|
16
16
|
<a href="https://codecov.io/gh/huggingface/huggingface_hub"><img alt="Code coverage" src="https://codecov.io/gh/huggingface/huggingface_hub/branch/main/graph/badge.svg?token=RXP95LE2XL"></a>
|
|
17
17
|
</p>
|
|
18
18
|
|
|
@@ -34,7 +34,7 @@ extras["inference"] = [
|
|
|
34
34
|
|
|
35
35
|
extras["torch"] = [
|
|
36
36
|
"torch",
|
|
37
|
-
"safetensors",
|
|
37
|
+
"safetensors[torch]",
|
|
38
38
|
]
|
|
39
39
|
extras["hf_transfer"] = [
|
|
40
40
|
"hf_transfer>=0.1.4", # Pin for progress bars
|
|
@@ -63,13 +63,14 @@ extras["testing"] = (
|
|
|
63
63
|
+ [
|
|
64
64
|
"jedi",
|
|
65
65
|
"Jinja2",
|
|
66
|
-
"pytest",
|
|
66
|
+
"pytest>=8.1.1,<8.2.2", # at least until 8.2.3 is released with https://github.com/pytest-dev/pytest/pull/12436
|
|
67
67
|
"pytest-cov",
|
|
68
68
|
"pytest-env",
|
|
69
69
|
"pytest-xdist",
|
|
70
70
|
"pytest-vcr", # to mock Inference
|
|
71
71
|
"pytest-asyncio", # for AsyncInferenceClient
|
|
72
72
|
"pytest-rerunfailures", # to rerun flaky tests in CI
|
|
73
|
+
"pytest-mock",
|
|
73
74
|
"urllib3<2.0", # VCR.py broken with urllib3 2.0 (see https://urllib3.readthedocs.io/en/stable/v2-migration-guide.html)
|
|
74
75
|
"soundfile",
|
|
75
76
|
"Pillow",
|
|
@@ -92,7 +93,7 @@ extras["typing"] = [
|
|
|
92
93
|
]
|
|
93
94
|
|
|
94
95
|
extras["quality"] = [
|
|
95
|
-
"ruff>=0.
|
|
96
|
+
"ruff>=0.5.0",
|
|
96
97
|
"mypy==1.5.1",
|
|
97
98
|
]
|
|
98
99
|
|
|
@@ -46,7 +46,7 @@ import sys
|
|
|
46
46
|
from typing import TYPE_CHECKING
|
|
47
47
|
|
|
48
48
|
|
|
49
|
-
__version__ = "0.
|
|
49
|
+
__version__ = "0.24.1"
|
|
50
50
|
|
|
51
51
|
# Alphabetical order of definitions is ensured in tests
|
|
52
52
|
# WARNING: any comment added in this dictionary definition will be lost when
|
|
@@ -150,6 +150,8 @@ _SUBMOD_ATTRS = {
|
|
|
150
150
|
"RepoUrl",
|
|
151
151
|
"User",
|
|
152
152
|
"UserLikes",
|
|
153
|
+
"WebhookInfo",
|
|
154
|
+
"WebhookWatchedItem",
|
|
153
155
|
"accept_access_request",
|
|
154
156
|
"add_collection_item",
|
|
155
157
|
"add_space_secret",
|
|
@@ -166,6 +168,7 @@ _SUBMOD_ATTRS = {
|
|
|
166
168
|
"create_pull_request",
|
|
167
169
|
"create_repo",
|
|
168
170
|
"create_tag",
|
|
171
|
+
"create_webhook",
|
|
169
172
|
"dataset_info",
|
|
170
173
|
"delete_branch",
|
|
171
174
|
"delete_collection",
|
|
@@ -178,8 +181,11 @@ _SUBMOD_ATTRS = {
|
|
|
178
181
|
"delete_space_storage",
|
|
179
182
|
"delete_space_variable",
|
|
180
183
|
"delete_tag",
|
|
184
|
+
"delete_webhook",
|
|
185
|
+
"disable_webhook",
|
|
181
186
|
"duplicate_space",
|
|
182
187
|
"edit_discussion_comment",
|
|
188
|
+
"enable_webhook",
|
|
183
189
|
"file_exists",
|
|
184
190
|
"get_collection",
|
|
185
191
|
"get_dataset_tags",
|
|
@@ -193,6 +199,7 @@ _SUBMOD_ATTRS = {
|
|
|
193
199
|
"get_space_runtime",
|
|
194
200
|
"get_space_variables",
|
|
195
201
|
"get_token_permission",
|
|
202
|
+
"get_webhook",
|
|
196
203
|
"grant_access",
|
|
197
204
|
"like",
|
|
198
205
|
"list_accepted_access_requests",
|
|
@@ -210,6 +217,7 @@ _SUBMOD_ATTRS = {
|
|
|
210
217
|
"list_repo_refs",
|
|
211
218
|
"list_repo_tree",
|
|
212
219
|
"list_spaces",
|
|
220
|
+
"list_webhooks",
|
|
213
221
|
"merge_pull_request",
|
|
214
222
|
"model_info",
|
|
215
223
|
"move_repo",
|
|
@@ -237,6 +245,7 @@ _SUBMOD_ATTRS = {
|
|
|
237
245
|
"update_collection_metadata",
|
|
238
246
|
"update_inference_endpoint",
|
|
239
247
|
"update_repo_visibility",
|
|
248
|
+
"update_webhook",
|
|
240
249
|
"upload_file",
|
|
241
250
|
"upload_folder",
|
|
242
251
|
"whoami",
|
|
@@ -271,10 +280,13 @@ _SUBMOD_ATTRS = {
|
|
|
271
280
|
"AutomaticSpeechRecognitionParameters",
|
|
272
281
|
"ChatCompletionInput",
|
|
273
282
|
"ChatCompletionInputFunctionDefinition",
|
|
283
|
+
"ChatCompletionInputFunctionName",
|
|
284
|
+
"ChatCompletionInputGrammarType",
|
|
274
285
|
"ChatCompletionInputMessage",
|
|
286
|
+
"ChatCompletionInputMessageChunk",
|
|
275
287
|
"ChatCompletionInputTool",
|
|
276
|
-
"ChatCompletionInputToolCall",
|
|
277
288
|
"ChatCompletionInputToolTypeClass",
|
|
289
|
+
"ChatCompletionInputURL",
|
|
278
290
|
"ChatCompletionOutput",
|
|
279
291
|
"ChatCompletionOutputComplete",
|
|
280
292
|
"ChatCompletionOutputFunctionDefinition",
|
|
@@ -414,7 +426,11 @@ _SUBMOD_ATTRS = {
|
|
|
414
426
|
],
|
|
415
427
|
"serialization": [
|
|
416
428
|
"StateDictSplit",
|
|
417
|
-
"
|
|
429
|
+
"get_tf_storage_size",
|
|
430
|
+
"get_torch_storage_id",
|
|
431
|
+
"get_torch_storage_size",
|
|
432
|
+
"save_torch_model",
|
|
433
|
+
"save_torch_state_dict",
|
|
418
434
|
"split_state_dict_into_shards_factory",
|
|
419
435
|
"split_tf_state_dict_into_shards",
|
|
420
436
|
"split_torch_state_dict_into_shards",
|
|
@@ -436,10 +452,6 @@ _SUBMOD_ATTRS = {
|
|
|
436
452
|
"logging",
|
|
437
453
|
"scan_cache_dir",
|
|
438
454
|
],
|
|
439
|
-
"utils.endpoint_helpers": [
|
|
440
|
-
"DatasetFilter",
|
|
441
|
-
"ModelFilter",
|
|
442
|
-
],
|
|
443
455
|
}
|
|
444
456
|
|
|
445
457
|
|
|
@@ -497,10 +509,18 @@ def _attach(package_name, submodules=None, submod_attrs=None):
|
|
|
497
509
|
|
|
498
510
|
def __getattr__(name):
|
|
499
511
|
if name in submodules:
|
|
500
|
-
|
|
512
|
+
try:
|
|
513
|
+
return importlib.import_module(f"{package_name}.{name}")
|
|
514
|
+
except Exception as e:
|
|
515
|
+
print(f"Error importing {package_name}.{name}: {e}")
|
|
516
|
+
raise
|
|
501
517
|
elif name in attr_to_modules:
|
|
502
518
|
submod_path = f"{package_name}.{attr_to_modules[name]}"
|
|
503
|
-
|
|
519
|
+
try:
|
|
520
|
+
submod = importlib.import_module(submod_path)
|
|
521
|
+
except Exception as e:
|
|
522
|
+
print(f"Error importing {submod_path}: {e}")
|
|
523
|
+
raise
|
|
504
524
|
attr = getattr(submod, name)
|
|
505
525
|
|
|
506
526
|
# If the attribute lives in a file (module) with the same
|
|
@@ -630,6 +650,8 @@ if TYPE_CHECKING: # pragma: no cover
|
|
|
630
650
|
RepoUrl, # noqa: F401
|
|
631
651
|
User, # noqa: F401
|
|
632
652
|
UserLikes, # noqa: F401
|
|
653
|
+
WebhookInfo, # noqa: F401
|
|
654
|
+
WebhookWatchedItem, # noqa: F401
|
|
633
655
|
accept_access_request, # noqa: F401
|
|
634
656
|
add_collection_item, # noqa: F401
|
|
635
657
|
add_space_secret, # noqa: F401
|
|
@@ -646,6 +668,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|
|
646
668
|
create_pull_request, # noqa: F401
|
|
647
669
|
create_repo, # noqa: F401
|
|
648
670
|
create_tag, # noqa: F401
|
|
671
|
+
create_webhook, # noqa: F401
|
|
649
672
|
dataset_info, # noqa: F401
|
|
650
673
|
delete_branch, # noqa: F401
|
|
651
674
|
delete_collection, # noqa: F401
|
|
@@ -658,8 +681,11 @@ if TYPE_CHECKING: # pragma: no cover
|
|
|
658
681
|
delete_space_storage, # noqa: F401
|
|
659
682
|
delete_space_variable, # noqa: F401
|
|
660
683
|
delete_tag, # noqa: F401
|
|
684
|
+
delete_webhook, # noqa: F401
|
|
685
|
+
disable_webhook, # noqa: F401
|
|
661
686
|
duplicate_space, # noqa: F401
|
|
662
687
|
edit_discussion_comment, # noqa: F401
|
|
688
|
+
enable_webhook, # noqa: F401
|
|
663
689
|
file_exists, # noqa: F401
|
|
664
690
|
get_collection, # noqa: F401
|
|
665
691
|
get_dataset_tags, # noqa: F401
|
|
@@ -673,6 +699,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|
|
673
699
|
get_space_runtime, # noqa: F401
|
|
674
700
|
get_space_variables, # noqa: F401
|
|
675
701
|
get_token_permission, # noqa: F401
|
|
702
|
+
get_webhook, # noqa: F401
|
|
676
703
|
grant_access, # noqa: F401
|
|
677
704
|
like, # noqa: F401
|
|
678
705
|
list_accepted_access_requests, # noqa: F401
|
|
@@ -690,6 +717,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|
|
690
717
|
list_repo_refs, # noqa: F401
|
|
691
718
|
list_repo_tree, # noqa: F401
|
|
692
719
|
list_spaces, # noqa: F401
|
|
720
|
+
list_webhooks, # noqa: F401
|
|
693
721
|
merge_pull_request, # noqa: F401
|
|
694
722
|
model_info, # noqa: F401
|
|
695
723
|
move_repo, # noqa: F401
|
|
@@ -717,6 +745,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|
|
717
745
|
update_collection_metadata, # noqa: F401
|
|
718
746
|
update_inference_endpoint, # noqa: F401
|
|
719
747
|
update_repo_visibility, # noqa: F401
|
|
748
|
+
update_webhook, # noqa: F401
|
|
720
749
|
upload_file, # noqa: F401
|
|
721
750
|
upload_folder, # noqa: F401
|
|
722
751
|
whoami, # noqa: F401
|
|
@@ -749,10 +778,13 @@ if TYPE_CHECKING: # pragma: no cover
|
|
|
749
778
|
AutomaticSpeechRecognitionParameters, # noqa: F401
|
|
750
779
|
ChatCompletionInput, # noqa: F401
|
|
751
780
|
ChatCompletionInputFunctionDefinition, # noqa: F401
|
|
781
|
+
ChatCompletionInputFunctionName, # noqa: F401
|
|
782
|
+
ChatCompletionInputGrammarType, # noqa: F401
|
|
752
783
|
ChatCompletionInputMessage, # noqa: F401
|
|
784
|
+
ChatCompletionInputMessageChunk, # noqa: F401
|
|
753
785
|
ChatCompletionInputTool, # noqa: F401
|
|
754
|
-
ChatCompletionInputToolCall, # noqa: F401
|
|
755
786
|
ChatCompletionInputToolTypeClass, # noqa: F401
|
|
787
|
+
ChatCompletionInputURL, # noqa: F401
|
|
756
788
|
ChatCompletionOutput, # noqa: F401
|
|
757
789
|
ChatCompletionOutputComplete, # noqa: F401
|
|
758
790
|
ChatCompletionOutputFunctionDefinition, # noqa: F401
|
|
@@ -888,7 +920,11 @@ if TYPE_CHECKING: # pragma: no cover
|
|
|
888
920
|
from .repository import Repository # noqa: F401
|
|
889
921
|
from .serialization import (
|
|
890
922
|
StateDictSplit, # noqa: F401
|
|
891
|
-
|
|
923
|
+
get_tf_storage_size, # noqa: F401
|
|
924
|
+
get_torch_storage_id, # noqa: F401
|
|
925
|
+
get_torch_storage_size, # noqa: F401
|
|
926
|
+
save_torch_model, # noqa: F401
|
|
927
|
+
save_torch_state_dict, # noqa: F401
|
|
892
928
|
split_state_dict_into_shards_factory, # noqa: F401
|
|
893
929
|
split_tf_state_dict_into_shards, # noqa: F401
|
|
894
930
|
split_torch_state_dict_into_shards, # noqa: F401
|
|
@@ -910,7 +946,3 @@ if TYPE_CHECKING: # pragma: no cover
|
|
|
910
946
|
logging, # noqa: F401
|
|
911
947
|
scan_cache_dir, # noqa: F401
|
|
912
948
|
)
|
|
913
|
-
from .utils.endpoint_helpers import (
|
|
914
|
-
DatasetFilter, # noqa: F401
|
|
915
|
-
ModelFilter, # noqa: F401
|
|
916
|
-
)
|
|
@@ -25,6 +25,7 @@ from .utils import (
|
|
|
25
25
|
get_session,
|
|
26
26
|
hf_raise_for_status,
|
|
27
27
|
logging,
|
|
28
|
+
sha,
|
|
28
29
|
tqdm_stream_file,
|
|
29
30
|
validate_hf_hub_args,
|
|
30
31
|
)
|
|
@@ -146,6 +147,10 @@ class CommitOperationAdd:
|
|
|
146
147
|
# (server-side check)
|
|
147
148
|
_should_ignore: Optional[bool] = field(init=False, repr=False, default=None)
|
|
148
149
|
|
|
150
|
+
# set to the remote OID of the file if it has already been uploaded
|
|
151
|
+
# useful to determine if a commit will be empty or not
|
|
152
|
+
_remote_oid: Optional[str] = field(init=False, repr=False, default=None)
|
|
153
|
+
|
|
149
154
|
# set to True once the file has been uploaded as LFS
|
|
150
155
|
_is_uploaded: bool = field(init=False, repr=False, default=False)
|
|
151
156
|
|
|
@@ -246,6 +251,29 @@ class CommitOperationAdd:
|
|
|
246
251
|
with self.as_file() as file:
|
|
247
252
|
return base64.b64encode(file.read())
|
|
248
253
|
|
|
254
|
+
@property
|
|
255
|
+
def _local_oid(self) -> Optional[str]:
|
|
256
|
+
"""Return the OID of the local file.
|
|
257
|
+
|
|
258
|
+
This OID is then compared to `self._remote_oid` to check if the file has changed compared to the remote one.
|
|
259
|
+
If the file did not change, we won't upload it again to prevent empty commits.
|
|
260
|
+
|
|
261
|
+
For LFS files, the OID corresponds to the SHA256 of the file content (used a LFS ref).
|
|
262
|
+
For regular files, the OID corresponds to the SHA1 of the file content.
|
|
263
|
+
Note: this is slightly different to git OID computation since the oid of an LFS file is usually the git-SHA1 of the
|
|
264
|
+
pointer file content (not the actual file content). However, using the SHA256 is enough to detect changes
|
|
265
|
+
and more convenient client-side.
|
|
266
|
+
"""
|
|
267
|
+
if self._upload_mode is None:
|
|
268
|
+
return None
|
|
269
|
+
elif self._upload_mode == "lfs":
|
|
270
|
+
return self.upload_info.sha256.hex()
|
|
271
|
+
else:
|
|
272
|
+
# Regular file => compute sha1
|
|
273
|
+
# => no need to read by chunk since the file is guaranteed to be <=5MB.
|
|
274
|
+
with self.as_file() as file:
|
|
275
|
+
return sha.git_hash(file.read())
|
|
276
|
+
|
|
249
277
|
|
|
250
278
|
def _validate_path_in_repo(path_in_repo: str) -> str:
|
|
251
279
|
# Validate `path_in_repo` value to prevent a server-side issue
|
|
@@ -345,13 +373,13 @@ def _upload_lfs_files(
|
|
|
345
373
|
revision (`str`, *optional*):
|
|
346
374
|
The git revision to upload to.
|
|
347
375
|
|
|
348
|
-
Raises:
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
376
|
+
Raises:
|
|
377
|
+
[`EnvironmentError`](https://docs.python.org/3/library/exceptions.html#EnvironmentError)
|
|
378
|
+
If an upload failed for any reason
|
|
379
|
+
[`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError)
|
|
380
|
+
If the server returns malformed responses
|
|
381
|
+
[`HTTPError`](https://requests.readthedocs.io/en/latest/api/#requests.HTTPError)
|
|
382
|
+
If the LFS batch endpoint returned an HTTP error.
|
|
355
383
|
"""
|
|
356
384
|
# Step 1: retrieve upload instructions from the LFS batch endpoint.
|
|
357
385
|
# Upload instructions are retrieved by chunk of 256 files to avoid reaching
|
|
@@ -483,6 +511,7 @@ def _fetch_upload_modes(
|
|
|
483
511
|
# Fetch upload mode (LFS or regular) chunk by chunk.
|
|
484
512
|
upload_modes: Dict[str, UploadMode] = {}
|
|
485
513
|
should_ignore_info: Dict[str, bool] = {}
|
|
514
|
+
oid_info: Dict[str, Optional[str]] = {}
|
|
486
515
|
|
|
487
516
|
for chunk in chunk_iterable(additions, 256):
|
|
488
517
|
payload: Dict = {
|
|
@@ -491,7 +520,6 @@ def _fetch_upload_modes(
|
|
|
491
520
|
"path": op.path_in_repo,
|
|
492
521
|
"sample": base64.b64encode(op.upload_info.sample).decode("ascii"),
|
|
493
522
|
"size": op.upload_info.size,
|
|
494
|
-
"sha": op.upload_info.sha256.hex(),
|
|
495
523
|
}
|
|
496
524
|
for op in chunk
|
|
497
525
|
]
|
|
@@ -509,11 +537,13 @@ def _fetch_upload_modes(
|
|
|
509
537
|
preupload_info = _validate_preupload_info(resp.json())
|
|
510
538
|
upload_modes.update(**{file["path"]: file["uploadMode"] for file in preupload_info["files"]})
|
|
511
539
|
should_ignore_info.update(**{file["path"]: file["shouldIgnore"] for file in preupload_info["files"]})
|
|
540
|
+
oid_info.update(**{file["path"]: file.get("oid") for file in preupload_info["files"]})
|
|
512
541
|
|
|
513
542
|
# Set upload mode for each addition operation
|
|
514
543
|
for addition in additions:
|
|
515
544
|
addition._upload_mode = upload_modes[addition.path_in_repo]
|
|
516
545
|
addition._should_ignore = should_ignore_info[addition.path_in_repo]
|
|
546
|
+
addition._remote_oid = oid_info[addition.path_in_repo]
|
|
517
547
|
|
|
518
548
|
# Empty files cannot be uploaded as LFS (S3 would fail with a 501 Not Implemented)
|
|
519
549
|
# => empty files are uploaded as "regular" to still allow users to commit them.
|
{huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/_inference_endpoints.py
RENAMED
|
@@ -256,9 +256,9 @@ class InferenceEndpoint:
|
|
|
256
256
|
accelerator (`str`, *optional*):
|
|
257
257
|
The hardware accelerator to be used for inference (e.g. `"cpu"`).
|
|
258
258
|
instance_size (`str`, *optional*):
|
|
259
|
-
The size or type of the instance to be used for hosting the model (e.g. `"
|
|
259
|
+
The size or type of the instance to be used for hosting the model (e.g. `"x4"`).
|
|
260
260
|
instance_type (`str`, *optional*):
|
|
261
|
-
The cloud instance type where the Inference Endpoint will be deployed (e.g. `"
|
|
261
|
+
The cloud instance type where the Inference Endpoint will be deployed (e.g. `"intel-icl"`).
|
|
262
262
|
min_replica (`int`, *optional*):
|
|
263
263
|
The minimum number of replicas (instances) to keep running for the Inference Endpoint.
|
|
264
264
|
max_replica (`int`, *optional*):
|
|
@@ -315,16 +315,23 @@ class InferenceEndpoint:
|
|
|
315
315
|
self._populate_from_raw()
|
|
316
316
|
return self
|
|
317
317
|
|
|
318
|
-
def resume(self) -> "InferenceEndpoint":
|
|
318
|
+
def resume(self, running_ok: bool = True) -> "InferenceEndpoint":
|
|
319
319
|
"""Resume the Inference Endpoint.
|
|
320
320
|
|
|
321
321
|
This is an alias for [`HfApi.resume_inference_endpoint`]. The current object is mutated in place with the
|
|
322
322
|
latest data from the server.
|
|
323
323
|
|
|
324
|
+
Args:
|
|
325
|
+
running_ok (`bool`, *optional*):
|
|
326
|
+
If `True`, the method will not raise an error if the Inference Endpoint is already running. Defaults to
|
|
327
|
+
`True`.
|
|
328
|
+
|
|
324
329
|
Returns:
|
|
325
330
|
[`InferenceEndpoint`]: the same Inference Endpoint, mutated in place with the latest data.
|
|
326
331
|
"""
|
|
327
|
-
obj = self._api.resume_inference_endpoint(
|
|
332
|
+
obj = self._api.resume_inference_endpoint(
|
|
333
|
+
name=self.name, namespace=self.namespace, running_ok=running_ok, token=self._token
|
|
334
|
+
) # type: ignore [arg-type]
|
|
328
335
|
self.raw = obj.raw
|
|
329
336
|
self._populate_from_raw()
|
|
330
337
|
return self
|
|
@@ -12,20 +12,21 @@
|
|
|
12
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
|
-
"""Contains utilities to handle the `../.huggingface` folder in local directories.
|
|
15
|
+
"""Contains utilities to handle the `../.cache/huggingface` folder in local directories.
|
|
16
16
|
|
|
17
17
|
First discussed in https://github.com/huggingface/huggingface_hub/issues/1738 to store
|
|
18
18
|
download metadata when downloading files from the hub to a local directory (without
|
|
19
19
|
using the cache).
|
|
20
20
|
|
|
21
|
-
./.huggingface folder structure:
|
|
21
|
+
./.cache/huggingface folder structure:
|
|
22
22
|
[4.0K] data
|
|
23
|
-
├── [4.0K] .
|
|
24
|
-
│ └── [4.0K]
|
|
25
|
-
│
|
|
26
|
-
│
|
|
27
|
-
│
|
|
28
|
-
│ └── [
|
|
23
|
+
├── [4.0K] .cache
|
|
24
|
+
│ └── [4.0K] huggingface
|
|
25
|
+
│ └── [4.0K] download
|
|
26
|
+
│ ├── [ 16] file.parquet.metadata
|
|
27
|
+
│ ├── [ 16] file.txt.metadata
|
|
28
|
+
│ └── [4.0K] folder
|
|
29
|
+
│ └── [ 16] file.parquet.metadata
|
|
29
30
|
│
|
|
30
31
|
├── [6.5G] file.parquet
|
|
31
32
|
├── [1.5K] file.txt
|
|
@@ -138,6 +139,14 @@ def get_local_download_paths(local_dir: Path, filename: str) -> LocalDownloadFil
|
|
|
138
139
|
metadata_path = _huggingface_dir(local_dir) / "download" / f"{sanitized_filename}.metadata"
|
|
139
140
|
lock_path = metadata_path.with_suffix(".lock")
|
|
140
141
|
|
|
142
|
+
# Some Windows versions do not allow for paths longer than 255 characters.
|
|
143
|
+
# In this case, we must specify it as an extended path by using the "\\?\" prefix
|
|
144
|
+
if os.name == "nt":
|
|
145
|
+
if not str(local_dir).startswith("\\\\?\\") and len(os.path.abspath(lock_path)) > 255:
|
|
146
|
+
file_path = Path("\\\\?\\" + os.path.abspath(file_path))
|
|
147
|
+
lock_path = Path("\\\\?\\" + os.path.abspath(lock_path))
|
|
148
|
+
metadata_path = Path("\\\\?\\" + os.path.abspath(metadata_path))
|
|
149
|
+
|
|
141
150
|
file_path.parent.mkdir(parents=True, exist_ok=True)
|
|
142
151
|
metadata_path.parent.mkdir(parents=True, exist_ok=True)
|
|
143
152
|
return LocalDownloadFilePaths(file_path=file_path, lock_path=lock_path, metadata_path=metadata_path)
|
|
@@ -210,19 +219,19 @@ def write_download_metadata(local_dir: Path, filename: str, commit_hash: str, et
|
|
|
210
219
|
|
|
211
220
|
@lru_cache()
|
|
212
221
|
def _huggingface_dir(local_dir: Path) -> Path:
|
|
213
|
-
"""Return the path to the `.huggingface` directory in a local directory."""
|
|
222
|
+
"""Return the path to the `.cache/huggingface` directory in a local directory."""
|
|
214
223
|
# Wrap in lru_cache to avoid overwriting the .gitignore file if called multiple times
|
|
215
|
-
path = local_dir / ".huggingface"
|
|
224
|
+
path = local_dir / ".cache" / "huggingface"
|
|
216
225
|
path.mkdir(exist_ok=True, parents=True)
|
|
217
226
|
|
|
218
|
-
# Create a .gitignore file in the .huggingface directory if it doesn't exist
|
|
227
|
+
# Create a .gitignore file in the .cache/huggingface directory if it doesn't exist
|
|
219
228
|
# Should be thread-safe enough like this.
|
|
220
229
|
gitignore = path / ".gitignore"
|
|
221
230
|
gitignore_lock = path / ".gitignore.lock"
|
|
222
231
|
if not gitignore.exists():
|
|
223
|
-
with WeakFileLock(gitignore_lock):
|
|
224
|
-
gitignore.write_text("*")
|
|
225
232
|
try:
|
|
233
|
+
with WeakFileLock(gitignore_lock):
|
|
234
|
+
gitignore.write_text("*")
|
|
226
235
|
gitignore_lock.unlink()
|
|
227
236
|
except OSError: # FileNotFoundError, PermissionError, etc.
|
|
228
237
|
pass
|
|
@@ -65,7 +65,7 @@ def snapshot_download(
|
|
|
65
65
|
`allow_patterns` and `ignore_patterns`.
|
|
66
66
|
|
|
67
67
|
If `local_dir` is provided, the file structure from the repo will be replicated in this location. When using this
|
|
68
|
-
option, the `cache_dir` will not be used and a `.huggingface/` folder will be created at the root of `local_dir`
|
|
68
|
+
option, the `cache_dir` will not be used and a `.cache/huggingface/` folder will be created at the root of `local_dir`
|
|
69
69
|
to store some metadata related to the downloaded files. While this mechanism is not as robust as the main
|
|
70
70
|
cache-system, it's optimized for regularly pulling the latest version of a repository.
|
|
71
71
|
|
|
@@ -127,12 +127,17 @@ def snapshot_download(
|
|
|
127
127
|
`str`: folder path of the repo snapshot.
|
|
128
128
|
|
|
129
129
|
Raises:
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
130
|
+
[`~utils.RepositoryNotFoundError`]
|
|
131
|
+
If the repository to download from cannot be found. This may be because it doesn't exist,
|
|
132
|
+
or because it is set to `private` and you do not have access.
|
|
133
|
+
[`~utils.RevisionNotFoundError`]
|
|
134
|
+
If the revision to download from cannot be found.
|
|
135
|
+
[`EnvironmentError`](https://docs.python.org/3/library/exceptions.html#EnvironmentError)
|
|
136
|
+
If `token=True` and the token cannot be found.
|
|
137
|
+
[`OSError`](https://docs.python.org/3/library/exceptions.html#OSError) if
|
|
138
|
+
ETag cannot be determined.
|
|
139
|
+
[`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError)
|
|
140
|
+
if some parameter value is invalid.
|
|
136
141
|
"""
|
|
137
142
|
if cache_dir is None:
|
|
138
143
|
cache_dir = HF_HUB_CACHE
|
|
@@ -184,7 +184,9 @@ class WebhooksServer:
|
|
|
184
184
|
self.fastapi_app.post(path)(func)
|
|
185
185
|
|
|
186
186
|
# Print instructions and block main thread
|
|
187
|
-
|
|
187
|
+
space_host = os.environ.get("SPACE_HOST")
|
|
188
|
+
url = "https://" + space_host if space_host is not None else (ui.share_url or ui.local_url)
|
|
189
|
+
url = url.strip("/")
|
|
188
190
|
message = "\nWebhooks are correctly setup and ready to use:"
|
|
189
191
|
message += "\n" + "\n".join(f" - POST {url}{webhook}" for webhook in self.registered_webhooks)
|
|
190
192
|
message += "\nGo to https://huggingface.co/settings/webhooks to setup your webhooks."
|
{huggingface_hub-0.23.5 → huggingface_hub-0.24.1}/src/huggingface_hub/commands/huggingface_cli.py
RENAMED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
#!/usr/bin/env python
|
|
2
1
|
# Copyright 2020 The HuggingFace Team. All rights reserved.
|
|
3
2
|
#
|
|
4
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -19,6 +18,7 @@ from huggingface_hub.commands.delete_cache import DeleteCacheCommand
|
|
|
19
18
|
from huggingface_hub.commands.download import DownloadCommand
|
|
20
19
|
from huggingface_hub.commands.env import EnvironmentCommand
|
|
21
20
|
from huggingface_hub.commands.lfs import LfsCommands
|
|
21
|
+
from huggingface_hub.commands.repo_files import RepoFilesCommand
|
|
22
22
|
from huggingface_hub.commands.scan_cache import ScanCacheCommand
|
|
23
23
|
from huggingface_hub.commands.tag import TagCommands
|
|
24
24
|
from huggingface_hub.commands.upload import UploadCommand
|
|
@@ -30,10 +30,11 @@ def main():
|
|
|
30
30
|
commands_parser = parser.add_subparsers(help="huggingface-cli command helpers")
|
|
31
31
|
|
|
32
32
|
# Register commands
|
|
33
|
+
DownloadCommand.register_subcommand(commands_parser)
|
|
34
|
+
UploadCommand.register_subcommand(commands_parser)
|
|
35
|
+
RepoFilesCommand.register_subcommand(commands_parser)
|
|
33
36
|
EnvironmentCommand.register_subcommand(commands_parser)
|
|
34
37
|
UserCommands.register_subcommand(commands_parser)
|
|
35
|
-
UploadCommand.register_subcommand(commands_parser)
|
|
36
|
-
DownloadCommand.register_subcommand(commands_parser)
|
|
37
38
|
LfsCommands.register_subcommand(commands_parser)
|
|
38
39
|
ScanCacheCommand.register_subcommand(commands_parser)
|
|
39
40
|
DeleteCacheCommand.register_subcommand(commands_parser)
|