huggingface-hub 0.29.1__py3-none-any.whl → 0.29.3__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.29.1"
49
+ __version__ = "0.29.3"
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
@@ -132,7 +132,7 @@ class InferenceClient:
132
132
  path will be appended to the base URL (see the [TGI Messages API](https://huggingface.co/docs/text-generation-inference/en/messages_api)
133
133
  documentation for details). When passing a URL as `model`, the client will not append any suffix path to it.
134
134
  provider (`str`, *optional*):
135
- Name of the provider to use for inference. Can be `"black-forest-labs"`, `"fal-ai"`, `"fireworks-ai"`, `"hf-inference"`, `"hyperbolic"`, `"nebius"`, `"novita"`, `"replicate"`, "sambanova"` or `"together"`.
135
+ Name of the provider to use for inference. Can be `"black-forest-labs"`, `"cerebras"`, `"cohere"`, `"fal-ai"`, `"fireworks-ai"`, `"hf-inference"`, `"hyperbolic"`, `"nebius"`, `"novita"`, `"replicate"`, "sambanova"` or `"together"`.
136
136
  defaults to hf-inference (Hugging Face Serverless Inference API).
137
137
  If model is a URL or `base_url` is passed, then `provider` is not used.
138
138
  token (`str` or `bool`, *optional*):
@@ -120,7 +120,7 @@ class AsyncInferenceClient:
120
120
  path will be appended to the base URL (see the [TGI Messages API](https://huggingface.co/docs/text-generation-inference/en/messages_api)
121
121
  documentation for details). When passing a URL as `model`, the client will not append any suffix path to it.
122
122
  provider (`str`, *optional*):
123
- Name of the provider to use for inference. Can be `"black-forest-labs"`, `"fal-ai"`, `"fireworks-ai"`, `"hf-inference"`, `"hyperbolic"`, `"nebius"`, `"novita"`, `"replicate"`, "sambanova"` or `"together"`.
123
+ Name of the provider to use for inference. Can be `"black-forest-labs"`, `"cerebras"`, `"cohere"`, `"fal-ai"`, `"fireworks-ai"`, `"hf-inference"`, `"hyperbolic"`, `"nebius"`, `"novita"`, `"replicate"`, "sambanova"` or `"together"`.
124
124
  defaults to hf-inference (Hugging Face Serverless Inference API).
125
125
  If model is a URL or `base_url` is passed, then `provider` is not used.
126
126
  token (`str` or `bool`, *optional*):
@@ -2,6 +2,8 @@ from typing import Dict, Literal
2
2
 
3
3
  from ._common import TaskProviderHelper
4
4
  from .black_forest_labs import BlackForestLabsTextToImageTask
5
+ from .cerebras import CerebrasConversationalTask
6
+ from .cohere import CohereConversationalTask
5
7
  from .fal_ai import (
6
8
  FalAIAutomaticSpeechRecognitionTask,
7
9
  FalAITextToImageTask,
@@ -20,6 +22,8 @@ from .together import TogetherConversationalTask, TogetherTextGenerationTask, To
20
22
 
21
23
  PROVIDER_T = Literal[
22
24
  "black-forest-labs",
25
+ "cerebras",
26
+ "cohere",
23
27
  "fal-ai",
24
28
  "fireworks-ai",
25
29
  "hf-inference",
@@ -35,6 +39,12 @@ PROVIDERS: Dict[PROVIDER_T, Dict[str, TaskProviderHelper]] = {
35
39
  "black-forest-labs": {
36
40
  "text-to-image": BlackForestLabsTextToImageTask(),
37
41
  },
42
+ "cerebras": {
43
+ "conversational": CerebrasConversationalTask(),
44
+ },
45
+ "cohere": {
46
+ "conversational": CohereConversationalTask(),
47
+ },
38
48
  "fal-ai": {
39
49
  "automatic-speech-recognition": FalAIAutomaticSpeechRecognitionTask(),
40
50
  "text-to-image": FalAITextToImageTask(),
@@ -17,6 +17,8 @@ HARDCODED_MODEL_ID_MAPPING: Dict[str, Dict[str, str]] = {
17
17
  #
18
18
  # Example:
19
19
  # "Qwen/Qwen2.5-Coder-32B-Instruct": "Qwen2.5-Coder-32B-Instruct",
20
+ "cerebras": {},
21
+ "cohere": {},
20
22
  "fal-ai": {},
21
23
  "fireworks-ai": {},
22
24
  "hf-inference": {},
@@ -0,0 +1,6 @@
1
+ from huggingface_hub.inference._providers._common import BaseConversationalTask
2
+
3
+
4
+ class CerebrasConversationalTask(BaseConversationalTask):
5
+ def __init__(self):
6
+ super().__init__(provider="cerebras", base_url="https://api.cerebras.ai")
@@ -0,0 +1,15 @@
1
+ from huggingface_hub.inference._providers._common import (
2
+ BaseConversationalTask,
3
+ )
4
+
5
+
6
+ _PROVIDER = "cohere"
7
+ _BASE_URL = "https://api.cohere.com"
8
+
9
+
10
+ class CohereConversationalTask(BaseConversationalTask):
11
+ def __init__(self):
12
+ super().__init__(provider=_PROVIDER, base_url=_BASE_URL)
13
+
14
+ def _prepare_route(self, mapped_model: str) -> str:
15
+ return "/compatibility/v1/chat/completions"
@@ -84,7 +84,11 @@ class HFInferenceConversational(HFInferenceTask):
84
84
  super().__init__("text-generation")
85
85
 
86
86
  def _prepare_payload_as_dict(self, inputs: Any, parameters: Dict, mapped_model: str) -> Optional[Dict]:
87
- payload_model = "tgi" if mapped_model.startswith(("http://", "https://")) else mapped_model
87
+ payload_model = parameters.get("model") or mapped_model
88
+
89
+ if payload_model is None or payload_model.startswith(("http://", "https://")):
90
+ payload_model = "dummy"
91
+
88
92
  return {**filter_none(parameters), "model": payload_model, "messages": inputs}
89
93
 
90
94
  def _prepare_url(self, api_key: str, mapped_model: str) -> str:
@@ -44,8 +44,10 @@ def capture_output() -> Generator[StringIO, None, None]:
44
44
  output = StringIO()
45
45
  previous_output = sys.stdout
46
46
  sys.stdout = output
47
- yield output
48
- sys.stdout = previous_output
47
+ try:
48
+ yield output
49
+ finally:
50
+ sys.stdout = previous_output
49
51
 
50
52
 
51
53
  def run_subprocess(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: huggingface-hub
3
- Version: 0.29.1
3
+ Version: 0.29.3
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=T-o7tRMXCYjO5nPSgmN_PAVEpFlQTOp7gh-gh8ucXak,48761
1
+ huggingface_hub/__init__.py,sha256=-rSbs6ih-D0d2-rOjcKUbjeilJXmEIUzWlAo61vy25w,48761
2
2
  huggingface_hub/_commit_api.py,sha256=TqXmu5moVAhBa7iuyJdsqsfRTxTpGMnvsPkb4GgC3dc,32636
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=aiiVqLiYisaEZTOxkv90vGhsdIM-fvXdhuDwhoNbjSQ,162205
43
+ huggingface_hub/inference/_client.py,sha256=IUpjnUpPLxHOqeAHYLPBTt5LjM18f6TEopoB_uJT3q4,162231
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=barbsIBB5d76l3zO3Tj_2WV6Phmwfjtuq7277qHfOYg,168438
46
+ huggingface_hub/inference/_generated/_async_client.py,sha256=IKANJspLZgHLgpmB_F-h3lfdToJkFt4V5Rc3qtJQuY4,168464
47
47
  huggingface_hub/inference/_generated/types/__init__.py,sha256=CJwdkaPbR-vzCWU1ITr4aHOHax87JaewaIs_7rKaRXE,6274
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
@@ -77,12 +77,14 @@ huggingface_hub/inference/_generated/types/visual_question_answering.py,sha256=A
77
77
  huggingface_hub/inference/_generated/types/zero_shot_classification.py,sha256=BAiebPjsqoNa8EU35Dx0pfIv8W2c4GSl-TJckV1MaxQ,1738
78
78
  huggingface_hub/inference/_generated/types/zero_shot_image_classification.py,sha256=8J9n6VqFARkWvPfAZNWEG70AlrMGldU95EGQQwn06zI,1487
79
79
  huggingface_hub/inference/_generated/types/zero_shot_object_detection.py,sha256=GUd81LIV7oEbRWayDlAVgyLmY596r1M3AW0jXDp1yTA,1630
80
- huggingface_hub/inference/_providers/__init__.py,sha256=Q1hPPQgN3gKTa3NWQSANUBOB3oeCLr4miVQAVaZK8DU,5352
81
- huggingface_hub/inference/_providers/_common.py,sha256=8mgu95x46aRhvuHOVijczBpRJK4LFHusC_FU3t4iXGw,9200
80
+ huggingface_hub/inference/_providers/__init__.py,sha256=654l914yPC_FZG1D-wcZzNHEn3qDDdr-gVdXf01mZ4U,5634
81
+ huggingface_hub/inference/_providers/_common.py,sha256=soJa-5v_SIsIVeZzVBD_s7Y2puS2XGmwHn2r6-0b0cQ,9238
82
82
  huggingface_hub/inference/_providers/black_forest_labs.py,sha256=YacbRSMwTcWMCtNfLZGRnjAwyOLAM9sIj06ZUKDb7n0,2647
83
+ huggingface_hub/inference/_providers/cerebras.py,sha256=YT1yFhXvDJiKZcqcJcA_7VZJFZVkABnv6QiEb0S90rE,246
84
+ huggingface_hub/inference/_providers/cohere.py,sha256=zfqK2iO6VzIDbjGqi25XvD-u98pe2DwIBEDtBxdmwGA,405
83
85
  huggingface_hub/inference/_providers/fal_ai.py,sha256=pjWeMfxatAXSVJsEQf142MQVvAz5x-jtZLYXapXJFlI,3455
84
86
  huggingface_hub/inference/_providers/fireworks_ai.py,sha256=NazpDeD4agtFW6ISaXEvq5XAPVNeoG9XWk3O4NCxBNI,228
85
- huggingface_hub/inference/_providers/hf_inference.py,sha256=5CUR4LzPHiHfd5JN3ooP3DbOAyRgEzbQb0ZoaaiiNPY,5183
87
+ huggingface_hub/inference/_providers/hf_inference.py,sha256=UCDiW26pbBx9P0JGnBOAoortNH2rvDURvRry2kThK6Y,5272
86
88
  huggingface_hub/inference/_providers/hyperbolic.py,sha256=qccC_gcMstGnvjmRyslgnuFVa9VAKS9w6F1ohwysvMU,1739
87
89
  huggingface_hub/inference/_providers/nebius.py,sha256=P34BO2y8MdBWqYzzt4VlkPePkXAIbMlRxvV87UhZVdU,1508
88
90
  huggingface_hub/inference/_providers/novita.py,sha256=SLOgZuAP1-Zs9NB2JmLf6kgX8R4O1Yy_64Ok9CmEZNs,745
@@ -114,7 +116,7 @@ huggingface_hub/utils/_pagination.py,sha256=hzLFLd8i_DKkPRVYzOx2CxLt5lcocEiAxDJr
114
116
  huggingface_hub/utils/_paths.py,sha256=w1ZhFmmD5ykWjp_hAvhjtOoa2ZUcOXJrF4a6O3QpAWo,5042
115
117
  huggingface_hub/utils/_runtime.py,sha256=tUyWylDgqaOXnMg39rvyusiruVN5ulcqiSwUEkQ9jjg,11195
116
118
  huggingface_hub/utils/_safetensors.py,sha256=GW3nyv7xQcuwObKYeYoT9VhURVzG1DZTbKBKho8Bbos,4458
117
- huggingface_hub/utils/_subprocess.py,sha256=6GpGD4qE9-Z1-Ocs3JuCLjR4NcRlknA-hAuQlqiprYY,4595
119
+ huggingface_hub/utils/_subprocess.py,sha256=u9FFUDE7TrzQTiuEzlUnHx7S2P57GbYRV8u16GJwrFw,4625
118
120
  huggingface_hub/utils/_telemetry.py,sha256=54LXeIJU5pEGghPAh06gqNAR-UoxOjVLvKqAQscwqZs,4890
119
121
  huggingface_hub/utils/_typing.py,sha256=Dgp6TQUlpzStfVLoSvXHCBP4b3NzHZ8E0Gg9mYAoDS4,2903
120
122
  huggingface_hub/utils/_validators.py,sha256=dDsVG31iooTYrIyi5Vwr1DukL0fEmJwu3ceVNduhsuE,9204
@@ -123,9 +125,9 @@ huggingface_hub/utils/insecure_hashlib.py,sha256=OjxlvtSQHpbLp9PWSrXBDJ0wHjxCBU-
123
125
  huggingface_hub/utils/logging.py,sha256=0A8fF1yh3L9Ka_bCDX2ml4U5Ht0tY8Dr3JcbRvWFuwo,4909
124
126
  huggingface_hub/utils/sha.py,sha256=OFnNGCba0sNcT2gUwaVCJnldxlltrHHe0DS_PCpV3C4,2134
125
127
  huggingface_hub/utils/tqdm.py,sha256=ZgdphuTnwAIaUKnnD2P7qVvNHpzHAyrYoItkiV0aEjQ,9835
126
- huggingface_hub-0.29.1.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
127
- huggingface_hub-0.29.1.dist-info/METADATA,sha256=B8dl2q55ILPp7jxGZ3Nx0zT0AlCd74Z0ipYxygbW3FI,13480
128
- huggingface_hub-0.29.1.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
129
- huggingface_hub-0.29.1.dist-info/entry_points.txt,sha256=Y3Z2L02rBG7va_iE6RPXolIgwOdwUFONyRN3kXMxZ0g,131
130
- huggingface_hub-0.29.1.dist-info/top_level.txt,sha256=8KzlQJAY4miUvjAssOAJodqKOw3harNzuiwGQ9qLSSk,16
131
- huggingface_hub-0.29.1.dist-info/RECORD,,
128
+ huggingface_hub-0.29.3.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
129
+ huggingface_hub-0.29.3.dist-info/METADATA,sha256=2YNFg7jwDyl9lQIFl4PZtBLsxPyi9VXExk98eKV0jKo,13480
130
+ huggingface_hub-0.29.3.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
131
+ huggingface_hub-0.29.3.dist-info/entry_points.txt,sha256=Y3Z2L02rBG7va_iE6RPXolIgwOdwUFONyRN3kXMxZ0g,131
132
+ huggingface_hub-0.29.3.dist-info/top_level.txt,sha256=8KzlQJAY4miUvjAssOAJodqKOw3harNzuiwGQ9qLSSk,16
133
+ huggingface_hub-0.29.3.dist-info/RECORD,,