huggingface-hub 0.30.1__py3-none-any.whl → 0.30.2__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.1"
49
+ __version__ = "0.30.2"
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
@@ -2400,8 +2400,8 @@ class InferenceClient:
2400
2400
  # Data can be a single element (dict) or an iterable of dicts where we select the first element of.
2401
2401
  if isinstance(data, list):
2402
2402
  data = data[0]
2403
-
2404
- return TextGenerationOutput.parse_obj_as_instance(data) if details else data["generated_text"]
2403
+ response = provider_helper.get_response(data, request_parameters)
2404
+ return TextGenerationOutput.parse_obj_as_instance(response) if details else response["generated_text"]
2405
2405
 
2406
2406
  def text_to_image(
2407
2407
  self,
@@ -2456,8 +2456,8 @@ class AsyncInferenceClient:
2456
2456
  # Data can be a single element (dict) or an iterable of dicts where we select the first element of.
2457
2457
  if isinstance(data, list):
2458
2458
  data = data[0]
2459
-
2460
- return TextGenerationOutput.parse_obj_as_instance(data) if details else data["generated_text"]
2459
+ response = provider_helper.get_response(data, request_parameters)
2460
+ return TextGenerationOutput.parse_obj_as_instance(response) if details else response["generated_text"]
2461
2461
 
2462
2462
  async def text_to_image(
2463
2463
  self,
@@ -82,7 +82,7 @@ class HFInferenceBinaryInputTask(HFInferenceTask):
82
82
 
83
83
  class HFInferenceConversational(HFInferenceTask):
84
84
  def __init__(self):
85
- super().__init__("text-generation")
85
+ super().__init__("conversational")
86
86
 
87
87
  def _prepare_payload_as_dict(self, inputs: Any, parameters: Dict, mapped_model: str) -> Optional[Dict]:
88
88
  payload_model = parameters.get("model") or mapped_model
@@ -14,6 +14,16 @@ class NebiusTextGenerationTask(BaseTextGenerationTask):
14
14
  def __init__(self):
15
15
  super().__init__(provider="nebius", base_url="https://api.studio.nebius.ai")
16
16
 
17
+ def get_response(self, response: Union[bytes, Dict], request_params: Optional[RequestParameters] = None) -> Any:
18
+ output = _as_dict(response)["choices"][0]
19
+ return {
20
+ "generated_text": output["text"],
21
+ "details": {
22
+ "finish_reason": output.get("finish_reason"),
23
+ "seed": output.get("seed"),
24
+ },
25
+ }
26
+
17
27
 
18
28
  class NebiusConversationalTask(BaseConversationalTask):
19
29
  def __init__(self):
@@ -22,6 +22,16 @@ class NovitaTextGenerationTask(BaseTextGenerationTask):
22
22
  # there is no v1/ route for novita
23
23
  return "/v3/openai/completions"
24
24
 
25
+ def get_response(self, response: Union[bytes, Dict], request_params: Optional[RequestParameters] = None) -> Any:
26
+ output = _as_dict(response)["choices"][0]
27
+ return {
28
+ "generated_text": output["text"],
29
+ "details": {
30
+ "finish_reason": output.get("finish_reason"),
31
+ "seed": output.get("seed"),
32
+ },
33
+ }
34
+
25
35
 
26
36
  class NovitaConversationalTask(BaseConversationalTask):
27
37
  def __init__(self):
@@ -35,6 +35,16 @@ class TogetherTextGenerationTask(BaseTextGenerationTask):
35
35
  def __init__(self):
36
36
  super().__init__(provider=_PROVIDER, base_url=_BASE_URL)
37
37
 
38
+ def get_response(self, response: Union[bytes, Dict], request_params: Optional[RequestParameters] = None) -> Any:
39
+ output = _as_dict(response)["choices"][0]
40
+ return {
41
+ "generated_text": output["text"],
42
+ "details": {
43
+ "finish_reason": output.get("finish_reason"),
44
+ "seed": output.get("seed"),
45
+ },
46
+ }
47
+
38
48
 
39
49
  class TogetherConversationalTask(BaseConversationalTask):
40
50
  def __init__(self):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: huggingface-hub
3
- Version: 0.30.1
3
+ Version: 0.30.2
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=hNa8rkJtZJkpw6ZIpTkY6if38nViltBFbMDSy3nhpj4,49368
1
+ huggingface_hub/__init__.py,sha256=3XEq6NrvmanS_Vl2Ozamcs5TfIynXdQI0ima4zPAxus,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
@@ -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=9QydbGgybtFeAsqxFVCG-Usb8GIUcK2lAU0xfQ_Tl_8,162678
43
+ huggingface_hub/inference/_client.py,sha256=7m_WAbLasJKcB-TXgEGNU-QSXxhmz8T8Uv-3CWPgdds,162759
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=k20fioyWjC7B8UohguFZSIp6GR-CbJgp3fCvNhgzMGE,168883
46
+ huggingface_hub/inference/_generated/_async_client.py,sha256=zE3dZSBh_RdTiH5wI8Fu8wZbA_KFNzQbFgQJxK-4pEw,168964
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,14 +84,14 @@ 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=s-mHKGN1BQ1gb-l4wYfYZPZW6voJ9XhdNG55ZYYpUoI,7148
87
+ huggingface_hub/inference/_providers/hf_inference.py,sha256=5mP0NaeFdMwI4jYoQaehNd5gc8LlPW-RERO6nI1X5jI,7147
88
88
  huggingface_hub/inference/_providers/hyperbolic.py,sha256=ZIwD50fUv3QnL091XlKA7TOs_E33Df5stsewpnbDNZ4,1824
89
- huggingface_hub/inference/_providers/nebius.py,sha256=VcgjvQCNnFifU4GMFXJENgdqgQXSu4uHcu2hUljNDaY,1593
90
- huggingface_hub/inference/_providers/novita.py,sha256=_ofZzGxtKn9v9anmS1kElnOiJa9Hmoeyi4Exv_jVOVg,2023
89
+ huggingface_hub/inference/_providers/nebius.py,sha256=wei1W80lMXpJ-3MGw9JRrO_LbRsqYVYgx67lSNYiV1Q,1980
90
+ huggingface_hub/inference/_providers/novita.py,sha256=xlP1xZcFsouAJiJ_mXgaBngUOZ1x9OzEaHPH5DD2Dx0,2410
91
91
  huggingface_hub/inference/_providers/openai.py,sha256=J5YO5h6vZrZmf6WC5_sgXcu6qMv6yAd72U16vKXi628,873
92
92
  huggingface_hub/inference/_providers/replicate.py,sha256=WIO4DEz1Imgdn02XHxDYwkDxOxF1ir2eba3HgUn1cQg,2348
93
93
  huggingface_hub/inference/_providers/sambanova.py,sha256=pR2MajO3ffga9FxzruzrTfTm3eBQ3AC0TPeSIdiQeco,249
94
- huggingface_hub/inference/_providers/together.py,sha256=NXBZVtfOF5MWsafSJFwmjOfnr8BNVR3JT4uPfPdHvnc,2113
94
+ huggingface_hub/inference/_providers/together.py,sha256=qa3Ns-b5HpJBdSkT8PchLobfE6Z48i8sIcfy6N1a5-A,2500
95
95
  huggingface_hub/serialization/__init__.py,sha256=kn-Fa-m4FzMnN8lNsF-SwFcfzug4CucexybGKyvZ8S0,1041
96
96
  huggingface_hub/serialization/_base.py,sha256=Df3GwGR9NzeK_SD75prXLucJAzPiNPgHbgXSw-_LTk8,8126
97
97
  huggingface_hub/serialization/_dduf.py,sha256=s42239rLiHwaJE36QDEmS5GH7DSmQ__BffiHJO5RjIg,15424
@@ -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.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,,
130
+ huggingface_hub-0.30.2.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
131
+ huggingface_hub-0.30.2.dist-info/METADATA,sha256=EIYpeFwEendNmFnsE0LVZoFFv0t1RzBhBaUjxc4OKuo,13551
132
+ huggingface_hub-0.30.2.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
133
+ huggingface_hub-0.30.2.dist-info/entry_points.txt,sha256=Y3Z2L02rBG7va_iE6RPXolIgwOdwUFONyRN3kXMxZ0g,131
134
+ huggingface_hub-0.30.2.dist-info/top_level.txt,sha256=8KzlQJAY4miUvjAssOAJodqKOw3harNzuiwGQ9qLSSk,16
135
+ huggingface_hub-0.30.2.dist-info/RECORD,,