huggingface-hub 0.30.0rc2__py3-none-any.whl → 0.30.0rc3__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.

@@ -46,7 +46,7 @@ import sys
46
46
  from typing import TYPE_CHECKING
47
47
 
48
48
 
49
- __version__ = "0.30.0rc2"
49
+ __version__ = "0.30.0.rc3"
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
@@ -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
- self.headers = headers if headers is not None else {}
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
- self.headers = headers if headers is not None else {}
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"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: huggingface-hub
3
- Version: 0.30.0rc2
3
+ Version: 0.30.0rc3
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=I04J88IWTa5PNrze79AZCmXiKl4p6MJZ9J7vmzEvWD4,49371
1
+ huggingface_hub/__init__.py,sha256=-tkGfHRGo-dMkwcyCshwx-CxxmmzNNkVA7t-NF1JzHo,49372
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=PgTmJ8f8PegpXBBaXoULUYTDnn7pHW9XlTB9vtZxSi8,9435
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=uRNW47cLJwwicE6wxJlJhKvv7uLDOIvqJGFkFlgE5tE,161457
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=5JeW50ZSj4GhZjF3eugZverLCwB81AGxolYWuweLZOY,167662
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
@@ -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.0rc2.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
131
- huggingface_hub-0.30.0rc2.dist-info/METADATA,sha256=FlsJn0Cep50BEx9Kap6HVuRXxw1mXPjuHP9gPpJl6T0,13554
132
- huggingface_hub-0.30.0rc2.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
133
- huggingface_hub-0.30.0rc2.dist-info/entry_points.txt,sha256=Y3Z2L02rBG7va_iE6RPXolIgwOdwUFONyRN3kXMxZ0g,131
134
- huggingface_hub-0.30.0rc2.dist-info/top_level.txt,sha256=8KzlQJAY4miUvjAssOAJodqKOw3harNzuiwGQ9qLSSk,16
135
- huggingface_hub-0.30.0rc2.dist-info/RECORD,,
130
+ huggingface_hub-0.30.0rc3.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
131
+ huggingface_hub-0.30.0rc3.dist-info/METADATA,sha256=6e5RnSC9W2asip6cNWXB1H9KSvK5mKOZ3xzinFf2LwU,13554
132
+ huggingface_hub-0.30.0rc3.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
133
+ huggingface_hub-0.30.0rc3.dist-info/entry_points.txt,sha256=Y3Z2L02rBG7va_iE6RPXolIgwOdwUFONyRN3kXMxZ0g,131
134
+ huggingface_hub-0.30.0rc3.dist-info/top_level.txt,sha256=8KzlQJAY4miUvjAssOAJodqKOw3harNzuiwGQ9qLSSk,16
135
+ huggingface_hub-0.30.0rc3.dist-info/RECORD,,