huggingface-hub 0.30.0rc2__py3-none-any.whl → 0.30.1__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 +1 -1
- huggingface_hub/constants.py +1 -0
- huggingface_hub/inference/_client.py +23 -1
- huggingface_hub/inference/_generated/_async_client.py +23 -1
- huggingface_hub/inference/_providers/hf_inference.py +8 -0
- {huggingface_hub-0.30.0rc2.dist-info → huggingface_hub-0.30.1.dist-info}/METADATA +1 -1
- {huggingface_hub-0.30.0rc2.dist-info → huggingface_hub-0.30.1.dist-info}/RECORD +11 -11
- {huggingface_hub-0.30.0rc2.dist-info → huggingface_hub-0.30.1.dist-info}/LICENSE +0 -0
- {huggingface_hub-0.30.0rc2.dist-info → huggingface_hub-0.30.1.dist-info}/WHEEL +0 -0
- {huggingface_hub-0.30.0rc2.dist-info → huggingface_hub-0.30.1.dist-info}/entry_points.txt +0 -0
- {huggingface_hub-0.30.0rc2.dist-info → huggingface_hub-0.30.1.dist-info}/top_level.txt +0 -0
huggingface_hub/__init__.py
CHANGED
huggingface_hub/constants.py
CHANGED
|
@@ -73,6 +73,7 @@ if _staging_mode:
|
|
|
73
73
|
HUGGINGFACE_HEADER_X_REPO_COMMIT = "X-Repo-Commit"
|
|
74
74
|
HUGGINGFACE_HEADER_X_LINKED_ETAG = "X-Linked-Etag"
|
|
75
75
|
HUGGINGFACE_HEADER_X_LINKED_SIZE = "X-Linked-Size"
|
|
76
|
+
HUGGINGFACE_HEADER_X_BILL_TO = "X-HF-Bill-To"
|
|
76
77
|
|
|
77
78
|
INFERENCE_ENDPOINT = os.environ.get("HF_INFERENCE_ENDPOINT", "https://api-inference.huggingface.co")
|
|
78
79
|
|
|
@@ -146,6 +146,9 @@ class InferenceClient:
|
|
|
146
146
|
headers (`Dict[str, str]`, `optional`):
|
|
147
147
|
Additional headers to send to the server. By default only the authorization and user-agent headers are sent.
|
|
148
148
|
Values in this dictionary will override the default values.
|
|
149
|
+
bill_to (`str`, `optional`):
|
|
150
|
+
The billing account to use for the requests. By default the requests are billed on the user's account.
|
|
151
|
+
Requests can only be billed to an organization the user is a member of, and which has subscribed to Enterprise Hub.
|
|
149
152
|
cookies (`Dict[str, str]`, `optional`):
|
|
150
153
|
Additional cookies to send to the server.
|
|
151
154
|
proxies (`Any`, `optional`):
|
|
@@ -168,6 +171,7 @@ class InferenceClient:
|
|
|
168
171
|
headers: Optional[Dict[str, str]] = None,
|
|
169
172
|
cookies: Optional[Dict[str, str]] = None,
|
|
170
173
|
proxies: Optional[Any] = None,
|
|
174
|
+
bill_to: Optional[str] = None,
|
|
171
175
|
# OpenAI compatibility
|
|
172
176
|
base_url: Optional[str] = None,
|
|
173
177
|
api_key: Optional[str] = None,
|
|
@@ -203,7 +207,25 @@ class InferenceClient:
|
|
|
203
207
|
|
|
204
208
|
self.model: Optional[str] = base_url or model
|
|
205
209
|
self.token: Optional[str] = token
|
|
206
|
-
|
|
210
|
+
|
|
211
|
+
self.headers = {**headers} if headers is not None else {}
|
|
212
|
+
if bill_to is not None:
|
|
213
|
+
if (
|
|
214
|
+
constants.HUGGINGFACE_HEADER_X_BILL_TO in self.headers
|
|
215
|
+
and self.headers[constants.HUGGINGFACE_HEADER_X_BILL_TO] != bill_to
|
|
216
|
+
):
|
|
217
|
+
warnings.warn(
|
|
218
|
+
f"Overriding existing '{self.headers[constants.HUGGINGFACE_HEADER_X_BILL_TO]}' value in headers with '{bill_to}'.",
|
|
219
|
+
UserWarning,
|
|
220
|
+
)
|
|
221
|
+
self.headers[constants.HUGGINGFACE_HEADER_X_BILL_TO] = bill_to
|
|
222
|
+
|
|
223
|
+
if token is not None and not token.startswith("hf_"):
|
|
224
|
+
warnings.warn(
|
|
225
|
+
"You've provided an external provider's API key, so requests will be billed directly by the provider. "
|
|
226
|
+
"The `bill_to` parameter is only applicable for Hugging Face billing and will be ignored.",
|
|
227
|
+
UserWarning,
|
|
228
|
+
)
|
|
207
229
|
|
|
208
230
|
# Configure provider
|
|
209
231
|
self.provider = provider if provider is not None else "hf-inference"
|
|
@@ -134,6 +134,9 @@ class AsyncInferenceClient:
|
|
|
134
134
|
headers (`Dict[str, str]`, `optional`):
|
|
135
135
|
Additional headers to send to the server. By default only the authorization and user-agent headers are sent.
|
|
136
136
|
Values in this dictionary will override the default values.
|
|
137
|
+
bill_to (`str`, `optional`):
|
|
138
|
+
The billing account to use for the requests. By default the requests are billed on the user's account.
|
|
139
|
+
Requests can only be billed to an organization the user is a member of, and which has subscribed to Enterprise Hub.
|
|
137
140
|
cookies (`Dict[str, str]`, `optional`):
|
|
138
141
|
Additional cookies to send to the server.
|
|
139
142
|
trust_env ('bool', 'optional'):
|
|
@@ -159,6 +162,7 @@ class AsyncInferenceClient:
|
|
|
159
162
|
cookies: Optional[Dict[str, str]] = None,
|
|
160
163
|
trust_env: bool = False,
|
|
161
164
|
proxies: Optional[Any] = None,
|
|
165
|
+
bill_to: Optional[str] = None,
|
|
162
166
|
# OpenAI compatibility
|
|
163
167
|
base_url: Optional[str] = None,
|
|
164
168
|
api_key: Optional[str] = None,
|
|
@@ -194,7 +198,25 @@ class AsyncInferenceClient:
|
|
|
194
198
|
|
|
195
199
|
self.model: Optional[str] = base_url or model
|
|
196
200
|
self.token: Optional[str] = token
|
|
197
|
-
|
|
201
|
+
|
|
202
|
+
self.headers = {**headers} if headers is not None else {}
|
|
203
|
+
if bill_to is not None:
|
|
204
|
+
if (
|
|
205
|
+
constants.HUGGINGFACE_HEADER_X_BILL_TO in self.headers
|
|
206
|
+
and self.headers[constants.HUGGINGFACE_HEADER_X_BILL_TO] != bill_to
|
|
207
|
+
):
|
|
208
|
+
warnings.warn(
|
|
209
|
+
f"Overriding existing '{self.headers[constants.HUGGINGFACE_HEADER_X_BILL_TO]}' value in headers with '{bill_to}'.",
|
|
210
|
+
UserWarning,
|
|
211
|
+
)
|
|
212
|
+
self.headers[constants.HUGGINGFACE_HEADER_X_BILL_TO] = bill_to
|
|
213
|
+
|
|
214
|
+
if token is not None and not token.startswith("hf_"):
|
|
215
|
+
warnings.warn(
|
|
216
|
+
"You've provided an external provider's API key, so requests will be billed directly by the provider. "
|
|
217
|
+
"The `bill_to` parameter is only applicable for Hugging Face billing and will be ignored.",
|
|
218
|
+
UserWarning,
|
|
219
|
+
)
|
|
198
220
|
|
|
199
221
|
# Configure provider
|
|
200
222
|
self.provider = provider if provider is not None else "hf-inference"
|
|
@@ -151,6 +151,14 @@ def _check_supported_task(model: str, task: str) -> None:
|
|
|
151
151
|
return # Only conversational allowed if tagged as conversational
|
|
152
152
|
raise ValueError("Non-conversational image-text-to-text task is not supported.")
|
|
153
153
|
|
|
154
|
+
if (
|
|
155
|
+
task in ("feature-extraction", "sentence-similarity")
|
|
156
|
+
and pipeline_tag in ("feature-extraction", "sentence-similarity")
|
|
157
|
+
and task in tags
|
|
158
|
+
):
|
|
159
|
+
# feature-extraction and sentence-similarity are interchangeable for HF Inference
|
|
160
|
+
return
|
|
161
|
+
|
|
154
162
|
# For all other tasks, just check pipeline tag
|
|
155
163
|
if pipeline_tag != task:
|
|
156
164
|
raise ValueError(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: huggingface-hub
|
|
3
|
-
Version: 0.30.
|
|
3
|
+
Version: 0.30.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.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
huggingface_hub/__init__.py,sha256=
|
|
1
|
+
huggingface_hub/__init__.py,sha256=hNa8rkJtZJkpw6ZIpTkY6if38nViltBFbMDSy3nhpj4,49368
|
|
2
2
|
huggingface_hub/_commit_api.py,sha256=cihZ2Zn4_AEjSVSuxwN7Sr42aKz2a38OkBFSqD-JB7I,38777
|
|
3
3
|
huggingface_hub/_commit_scheduler.py,sha256=tfIoO1xWHjTJ6qy6VS6HIoymDycFPg0d6pBSZprrU2U,14679
|
|
4
4
|
huggingface_hub/_inference_endpoints.py,sha256=SLoZOQtv_hNl0Xuafo34L--zuCZ3zSJja2tSkYkG5V4,17268
|
|
@@ -11,7 +11,7 @@ huggingface_hub/_upload_large_folder.py,sha256=eedUTowflZx1thFVLDv7hLd_LQqixa5NV
|
|
|
11
11
|
huggingface_hub/_webhooks_payload.py,sha256=Xm3KaK7tCOGBlXkuZvbym6zjHXrT1XCrbUFWuXiBmNY,3617
|
|
12
12
|
huggingface_hub/_webhooks_server.py,sha256=5J63wk9MUGKBNJVsOD9i60mJ-VMp0YYmlf87vQsl-L8,15767
|
|
13
13
|
huggingface_hub/community.py,sha256=4MtcoxEI9_0lmmilBEnvUEi8_O1Ivfa8p6eKxYU5-ts,12198
|
|
14
|
-
huggingface_hub/constants.py,sha256=
|
|
14
|
+
huggingface_hub/constants.py,sha256=4rn5JWp4k5JRNWcnl1XkPPFr-d6GkYtkkg0-qLcxcj4,9481
|
|
15
15
|
huggingface_hub/errors.py,sha256=cE0bwLHbv8e34tbOdlkl-exjDoFxGgCLYmTYlDkpJgI,10155
|
|
16
16
|
huggingface_hub/fastai_utils.py,sha256=DpeH9d-6ut2k_nCAAwglM51XmRmgfbRe2SPifpVL5Yk,16745
|
|
17
17
|
huggingface_hub/file_download.py,sha256=s3kUdf7NhcRjoJpLcYRZOz1deC0Q7k-_gWIBwcd2MG4,76327
|
|
@@ -40,10 +40,10 @@ huggingface_hub/commands/upload_large_folder.py,sha256=P-EO44JWVl39Ax4b0E0Z873d0
|
|
|
40
40
|
huggingface_hub/commands/user.py,sha256=M6Ef045YcyV4mFCbLaTRPciQDC6xtV9MMheeen69D0E,11168
|
|
41
41
|
huggingface_hub/commands/version.py,sha256=vfCJn7GO1m-DtDmbdsty8_RTVtnZ7lX6MJsx0Bf4e-s,1266
|
|
42
42
|
huggingface_hub/inference/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
43
|
-
huggingface_hub/inference/_client.py,sha256=
|
|
43
|
+
huggingface_hub/inference/_client.py,sha256=9QydbGgybtFeAsqxFVCG-Usb8GIUcK2lAU0xfQ_Tl_8,162678
|
|
44
44
|
huggingface_hub/inference/_common.py,sha256=iwCkq2fWE1MVoPTeeXN7UN5FZi7g5fZ3K8PHSOCi5dU,14591
|
|
45
45
|
huggingface_hub/inference/_generated/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
46
|
-
huggingface_hub/inference/_generated/_async_client.py,sha256=
|
|
46
|
+
huggingface_hub/inference/_generated/_async_client.py,sha256=k20fioyWjC7B8UohguFZSIp6GR-CbJgp3fCvNhgzMGE,168883
|
|
47
47
|
huggingface_hub/inference/_generated/types/__init__.py,sha256=--r3nBmBRtgyQR9TkdQl53_crcKYJhWfTkFK2VE2gUk,6307
|
|
48
48
|
huggingface_hub/inference/_generated/types/audio_classification.py,sha256=Jg3mzfGhCSH6CfvVvgJSiFpkz6v4nNA0G4LJXacEgNc,1573
|
|
49
49
|
huggingface_hub/inference/_generated/types/audio_to_audio.py,sha256=2Ep4WkePL7oJwcp5nRJqApwviumGHbft9HhXE9XLHj4,891
|
|
@@ -84,7 +84,7 @@ huggingface_hub/inference/_providers/cerebras.py,sha256=YT1yFhXvDJiKZcqcJcA_7VZJ
|
|
|
84
84
|
huggingface_hub/inference/_providers/cohere.py,sha256=GkFsuKSaqsyfeerPx0ewv-EX44MtJ8a3XXEfmAiTpb0,419
|
|
85
85
|
huggingface_hub/inference/_providers/fal_ai.py,sha256=Pko6CHSB30jkuuxBNC6rpDWWWN07lvPCNxxIlteBtik,6099
|
|
86
86
|
huggingface_hub/inference/_providers/fireworks_ai.py,sha256=6uDsaxJRaN2xWNQX8u1bvF8zO-8J31TAnHdsrf_TO5g,337
|
|
87
|
-
huggingface_hub/inference/_providers/hf_inference.py,sha256=
|
|
87
|
+
huggingface_hub/inference/_providers/hf_inference.py,sha256=s-mHKGN1BQ1gb-l4wYfYZPZW6voJ9XhdNG55ZYYpUoI,7148
|
|
88
88
|
huggingface_hub/inference/_providers/hyperbolic.py,sha256=ZIwD50fUv3QnL091XlKA7TOs_E33Df5stsewpnbDNZ4,1824
|
|
89
89
|
huggingface_hub/inference/_providers/nebius.py,sha256=VcgjvQCNnFifU4GMFXJENgdqgQXSu4uHcu2hUljNDaY,1593
|
|
90
90
|
huggingface_hub/inference/_providers/novita.py,sha256=_ofZzGxtKn9v9anmS1kElnOiJa9Hmoeyi4Exv_jVOVg,2023
|
|
@@ -127,9 +127,9 @@ huggingface_hub/utils/insecure_hashlib.py,sha256=OjxlvtSQHpbLp9PWSrXBDJ0wHjxCBU-
|
|
|
127
127
|
huggingface_hub/utils/logging.py,sha256=0A8fF1yh3L9Ka_bCDX2ml4U5Ht0tY8Dr3JcbRvWFuwo,4909
|
|
128
128
|
huggingface_hub/utils/sha.py,sha256=OFnNGCba0sNcT2gUwaVCJnldxlltrHHe0DS_PCpV3C4,2134
|
|
129
129
|
huggingface_hub/utils/tqdm.py,sha256=xAKcyfnNHsZ7L09WuEM5Ew5-MDhiahLACbbN2zMmcLs,10671
|
|
130
|
-
huggingface_hub-0.30.
|
|
131
|
-
huggingface_hub-0.30.
|
|
132
|
-
huggingface_hub-0.30.
|
|
133
|
-
huggingface_hub-0.30.
|
|
134
|
-
huggingface_hub-0.30.
|
|
135
|
-
huggingface_hub-0.30.
|
|
130
|
+
huggingface_hub-0.30.1.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
131
|
+
huggingface_hub-0.30.1.dist-info/METADATA,sha256=yb4jdtYon84q0whgsLOLbLf2Z-2HIN6tsp3jckuFBz4,13551
|
|
132
|
+
huggingface_hub-0.30.1.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
|
133
|
+
huggingface_hub-0.30.1.dist-info/entry_points.txt,sha256=Y3Z2L02rBG7va_iE6RPXolIgwOdwUFONyRN3kXMxZ0g,131
|
|
134
|
+
huggingface_hub-0.30.1.dist-info/top_level.txt,sha256=8KzlQJAY4miUvjAssOAJodqKOw3harNzuiwGQ9qLSSk,16
|
|
135
|
+
huggingface_hub-0.30.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|