huggingface-hub 0.28.1__py3-none-any.whl → 0.29.0rc0__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 -4
- huggingface_hub/constants.py +16 -10
- huggingface_hub/file_download.py +10 -6
- huggingface_hub/hf_api.py +53 -23
- huggingface_hub/inference/_client.py +151 -84
- huggingface_hub/inference/_common.py +3 -27
- huggingface_hub/inference/_generated/_async_client.py +147 -83
- huggingface_hub/inference/_generated/types/__init__.py +1 -1
- huggingface_hub/inference/_generated/types/audio_classification.py +4 -5
- huggingface_hub/inference/_generated/types/audio_to_audio.py +3 -4
- huggingface_hub/inference/_generated/types/automatic_speech_recognition.py +7 -8
- huggingface_hub/inference/_generated/types/base.py +21 -0
- huggingface_hub/inference/_generated/types/chat_completion.py +29 -30
- huggingface_hub/inference/_generated/types/depth_estimation.py +3 -4
- huggingface_hub/inference/_generated/types/document_question_answering.py +5 -6
- huggingface_hub/inference/_generated/types/feature_extraction.py +5 -6
- huggingface_hub/inference/_generated/types/fill_mask.py +4 -5
- huggingface_hub/inference/_generated/types/image_classification.py +4 -5
- huggingface_hub/inference/_generated/types/image_segmentation.py +4 -5
- huggingface_hub/inference/_generated/types/image_to_image.py +5 -6
- huggingface_hub/inference/_generated/types/image_to_text.py +5 -6
- huggingface_hub/inference/_generated/types/object_detection.py +5 -6
- huggingface_hub/inference/_generated/types/question_answering.py +5 -6
- huggingface_hub/inference/_generated/types/sentence_similarity.py +3 -4
- huggingface_hub/inference/_generated/types/summarization.py +4 -5
- huggingface_hub/inference/_generated/types/table_question_answering.py +5 -6
- huggingface_hub/inference/_generated/types/text2text_generation.py +4 -5
- huggingface_hub/inference/_generated/types/text_classification.py +4 -5
- huggingface_hub/inference/_generated/types/text_generation.py +12 -13
- huggingface_hub/inference/_generated/types/text_to_audio.py +5 -6
- huggingface_hub/inference/_generated/types/text_to_image.py +8 -15
- huggingface_hub/inference/_generated/types/text_to_speech.py +5 -6
- huggingface_hub/inference/_generated/types/text_to_video.py +4 -5
- huggingface_hub/inference/_generated/types/token_classification.py +4 -5
- huggingface_hub/inference/_generated/types/translation.py +4 -5
- huggingface_hub/inference/_generated/types/video_classification.py +4 -5
- huggingface_hub/inference/_generated/types/visual_question_answering.py +5 -6
- huggingface_hub/inference/_generated/types/zero_shot_classification.py +4 -5
- huggingface_hub/inference/_generated/types/zero_shot_image_classification.py +4 -5
- huggingface_hub/inference/_generated/types/zero_shot_object_detection.py +5 -6
- huggingface_hub/inference/_providers/__init__.py +44 -8
- huggingface_hub/inference/_providers/_common.py +239 -0
- huggingface_hub/inference/_providers/black_forest_labs.py +66 -0
- huggingface_hub/inference/_providers/fal_ai.py +31 -100
- huggingface_hub/inference/_providers/fireworks_ai.py +6 -0
- huggingface_hub/inference/_providers/hf_inference.py +58 -142
- huggingface_hub/inference/_providers/hyperbolic.py +43 -0
- huggingface_hub/inference/_providers/nebius.py +41 -0
- huggingface_hub/inference/_providers/novita.py +26 -0
- huggingface_hub/inference/_providers/replicate.py +24 -119
- huggingface_hub/inference/_providers/sambanova.py +3 -86
- huggingface_hub/inference/_providers/together.py +36 -130
- huggingface_hub/utils/_headers.py +5 -0
- huggingface_hub/utils/_hf_folder.py +4 -32
- huggingface_hub/utils/_http.py +85 -2
- huggingface_hub/utils/_typing.py +1 -1
- huggingface_hub/utils/logging.py +6 -0
- {huggingface_hub-0.28.1.dist-info → huggingface_hub-0.29.0rc0.dist-info}/METADATA +1 -1
- {huggingface_hub-0.28.1.dist-info → huggingface_hub-0.29.0rc0.dist-info}/RECORD +63 -57
- {huggingface_hub-0.28.1.dist-info → huggingface_hub-0.29.0rc0.dist-info}/LICENSE +0 -0
- {huggingface_hub-0.28.1.dist-info → huggingface_hub-0.29.0rc0.dist-info}/WHEEL +0 -0
- {huggingface_hub-0.28.1.dist-info → huggingface_hub-0.29.0rc0.dist-info}/entry_points.txt +0 -0
- {huggingface_hub-0.28.1.dist-info → huggingface_hub-0.29.0rc0.dist-info}/top_level.txt +0 -0
|
@@ -3,16 +3,15 @@
|
|
|
3
3
|
# See:
|
|
4
4
|
# - script: https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/scripts/inference-codegen.ts
|
|
5
5
|
# - specs: https://github.com/huggingface/huggingface.js/tree/main/packages/tasks/src/tasks.
|
|
6
|
-
from dataclasses import dataclass
|
|
7
6
|
from typing import List, Literal, Optional, Union
|
|
8
7
|
|
|
9
|
-
from .base import BaseInferenceType
|
|
8
|
+
from .base import BaseInferenceType, dataclass_with_extra
|
|
10
9
|
|
|
11
10
|
|
|
12
11
|
AutomaticSpeechRecognitionEarlyStoppingEnum = Literal["never"]
|
|
13
12
|
|
|
14
13
|
|
|
15
|
-
@
|
|
14
|
+
@dataclass_with_extra
|
|
16
15
|
class AutomaticSpeechRecognitionGenerationParameters(BaseInferenceType):
|
|
17
16
|
"""Parametrization of the text generation process"""
|
|
18
17
|
|
|
@@ -72,7 +71,7 @@ class AutomaticSpeechRecognitionGenerationParameters(BaseInferenceType):
|
|
|
72
71
|
"""Whether the model should use the past last key/values attentions to speed up decoding"""
|
|
73
72
|
|
|
74
73
|
|
|
75
|
-
@
|
|
74
|
+
@dataclass_with_extra
|
|
76
75
|
class AutomaticSpeechRecognitionParameters(BaseInferenceType):
|
|
77
76
|
"""Additional inference parameters for Automatic Speech Recognition"""
|
|
78
77
|
|
|
@@ -83,7 +82,7 @@ class AutomaticSpeechRecognitionParameters(BaseInferenceType):
|
|
|
83
82
|
"""Parametrization of the text generation process"""
|
|
84
83
|
|
|
85
84
|
|
|
86
|
-
@
|
|
85
|
+
@dataclass_with_extra
|
|
87
86
|
class AutomaticSpeechRecognitionInput(BaseInferenceType):
|
|
88
87
|
"""Inputs for Automatic Speech Recognition inference"""
|
|
89
88
|
|
|
@@ -95,15 +94,15 @@ class AutomaticSpeechRecognitionInput(BaseInferenceType):
|
|
|
95
94
|
"""Additional inference parameters for Automatic Speech Recognition"""
|
|
96
95
|
|
|
97
96
|
|
|
98
|
-
@
|
|
97
|
+
@dataclass_with_extra
|
|
99
98
|
class AutomaticSpeechRecognitionOutputChunk(BaseInferenceType):
|
|
100
99
|
text: str
|
|
101
100
|
"""A chunk of text identified by the model"""
|
|
102
|
-
|
|
101
|
+
timestamp: List[float]
|
|
103
102
|
"""The start and end timestamps corresponding with the text"""
|
|
104
103
|
|
|
105
104
|
|
|
106
|
-
@
|
|
105
|
+
@dataclass_with_extra
|
|
107
106
|
class AutomaticSpeechRecognitionOutput(BaseInferenceType):
|
|
108
107
|
"""Outputs of inference for the Automatic Speech Recognition task"""
|
|
109
108
|
|
|
@@ -22,6 +22,22 @@ from typing import Any, Dict, List, Type, TypeVar, Union, get_args
|
|
|
22
22
|
T = TypeVar("T", bound="BaseInferenceType")
|
|
23
23
|
|
|
24
24
|
|
|
25
|
+
def _repr_with_extra(self):
|
|
26
|
+
fields = list(self.__dataclass_fields__.keys())
|
|
27
|
+
other_fields = list(k for k in self.__dict__ if k not in fields)
|
|
28
|
+
return f"{self.__class__.__name__}({', '.join(f'{k}={self.__dict__[k]!r}' for k in fields + other_fields)})"
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def dataclass_with_extra(cls: Type[T]) -> Type[T]:
|
|
32
|
+
"""Decorator to add a custom __repr__ method to a dataclass, showing all fields, including extra ones.
|
|
33
|
+
|
|
34
|
+
This decorator only works with dataclasses that inherit from `BaseInferenceType`.
|
|
35
|
+
"""
|
|
36
|
+
cls = dataclass(cls)
|
|
37
|
+
cls.__repr__ = _repr_with_extra # type: ignore[method-assign]
|
|
38
|
+
return cls
|
|
39
|
+
|
|
40
|
+
|
|
25
41
|
@dataclass
|
|
26
42
|
class BaseInferenceType(dict):
|
|
27
43
|
"""Base class for all inference types.
|
|
@@ -115,6 +131,11 @@ class BaseInferenceType(dict):
|
|
|
115
131
|
|
|
116
132
|
# Add remaining fields as dict attributes
|
|
117
133
|
item.update(other_values)
|
|
134
|
+
|
|
135
|
+
# Add remaining fields as extra dataclass fields.
|
|
136
|
+
# They won't be part of the dataclass fields but will be accessible as attributes.
|
|
137
|
+
# Use @dataclass_with_extra to show them in __repr__.
|
|
138
|
+
item.__dict__.update(other_values)
|
|
118
139
|
return item
|
|
119
140
|
|
|
120
141
|
def __post_init__(self):
|
|
@@ -3,13 +3,12 @@
|
|
|
3
3
|
# See:
|
|
4
4
|
# - script: https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/scripts/inference-codegen.ts
|
|
5
5
|
# - specs: https://github.com/huggingface/huggingface.js/tree/main/packages/tasks/src/tasks.
|
|
6
|
-
from dataclasses import dataclass
|
|
7
6
|
from typing import Any, List, Literal, Optional, Union
|
|
8
7
|
|
|
9
|
-
from .base import BaseInferenceType
|
|
8
|
+
from .base import BaseInferenceType, dataclass_with_extra
|
|
10
9
|
|
|
11
10
|
|
|
12
|
-
@
|
|
11
|
+
@dataclass_with_extra
|
|
13
12
|
class ChatCompletionInputURL(BaseInferenceType):
|
|
14
13
|
url: str
|
|
15
14
|
|
|
@@ -17,14 +16,14 @@ class ChatCompletionInputURL(BaseInferenceType):
|
|
|
17
16
|
ChatCompletionInputMessageChunkType = Literal["text", "image_url"]
|
|
18
17
|
|
|
19
18
|
|
|
20
|
-
@
|
|
19
|
+
@dataclass_with_extra
|
|
21
20
|
class ChatCompletionInputMessageChunk(BaseInferenceType):
|
|
22
21
|
type: "ChatCompletionInputMessageChunkType"
|
|
23
22
|
image_url: Optional[ChatCompletionInputURL] = None
|
|
24
23
|
text: Optional[str] = None
|
|
25
24
|
|
|
26
25
|
|
|
27
|
-
@
|
|
26
|
+
@dataclass_with_extra
|
|
28
27
|
class ChatCompletionInputMessage(BaseInferenceType):
|
|
29
28
|
content: Union[List[ChatCompletionInputMessageChunk], str]
|
|
30
29
|
role: str
|
|
@@ -34,7 +33,7 @@ class ChatCompletionInputMessage(BaseInferenceType):
|
|
|
34
33
|
ChatCompletionInputGrammarTypeType = Literal["json", "regex"]
|
|
35
34
|
|
|
36
35
|
|
|
37
|
-
@
|
|
36
|
+
@dataclass_with_extra
|
|
38
37
|
class ChatCompletionInputGrammarType(BaseInferenceType):
|
|
39
38
|
type: "ChatCompletionInputGrammarTypeType"
|
|
40
39
|
value: Any
|
|
@@ -44,7 +43,7 @@ class ChatCompletionInputGrammarType(BaseInferenceType):
|
|
|
44
43
|
"""
|
|
45
44
|
|
|
46
45
|
|
|
47
|
-
@
|
|
46
|
+
@dataclass_with_extra
|
|
48
47
|
class ChatCompletionInputStreamOptions(BaseInferenceType):
|
|
49
48
|
include_usage: bool
|
|
50
49
|
"""If set, an additional chunk will be streamed before the data: [DONE] message. The usage
|
|
@@ -54,12 +53,12 @@ class ChatCompletionInputStreamOptions(BaseInferenceType):
|
|
|
54
53
|
"""
|
|
55
54
|
|
|
56
55
|
|
|
57
|
-
@
|
|
56
|
+
@dataclass_with_extra
|
|
58
57
|
class ChatCompletionInputFunctionName(BaseInferenceType):
|
|
59
58
|
name: str
|
|
60
59
|
|
|
61
60
|
|
|
62
|
-
@
|
|
61
|
+
@dataclass_with_extra
|
|
63
62
|
class ChatCompletionInputToolChoiceClass(BaseInferenceType):
|
|
64
63
|
function: ChatCompletionInputFunctionName
|
|
65
64
|
|
|
@@ -67,20 +66,20 @@ class ChatCompletionInputToolChoiceClass(BaseInferenceType):
|
|
|
67
66
|
ChatCompletionInputToolChoiceEnum = Literal["auto", "none", "required"]
|
|
68
67
|
|
|
69
68
|
|
|
70
|
-
@
|
|
69
|
+
@dataclass_with_extra
|
|
71
70
|
class ChatCompletionInputFunctionDefinition(BaseInferenceType):
|
|
72
71
|
arguments: Any
|
|
73
72
|
name: str
|
|
74
73
|
description: Optional[str] = None
|
|
75
74
|
|
|
76
75
|
|
|
77
|
-
@
|
|
76
|
+
@dataclass_with_extra
|
|
78
77
|
class ChatCompletionInputTool(BaseInferenceType):
|
|
79
78
|
function: ChatCompletionInputFunctionDefinition
|
|
80
79
|
type: str
|
|
81
80
|
|
|
82
81
|
|
|
83
|
-
@
|
|
82
|
+
@dataclass_with_extra
|
|
84
83
|
class ChatCompletionInput(BaseInferenceType):
|
|
85
84
|
"""Chat Completion Input.
|
|
86
85
|
Auto-generated from TGI specs.
|
|
@@ -162,46 +161,46 @@ class ChatCompletionInput(BaseInferenceType):
|
|
|
162
161
|
"""
|
|
163
162
|
|
|
164
163
|
|
|
165
|
-
@
|
|
164
|
+
@dataclass_with_extra
|
|
166
165
|
class ChatCompletionOutputTopLogprob(BaseInferenceType):
|
|
167
166
|
logprob: float
|
|
168
167
|
token: str
|
|
169
168
|
|
|
170
169
|
|
|
171
|
-
@
|
|
170
|
+
@dataclass_with_extra
|
|
172
171
|
class ChatCompletionOutputLogprob(BaseInferenceType):
|
|
173
172
|
logprob: float
|
|
174
173
|
token: str
|
|
175
174
|
top_logprobs: List[ChatCompletionOutputTopLogprob]
|
|
176
175
|
|
|
177
176
|
|
|
178
|
-
@
|
|
177
|
+
@dataclass_with_extra
|
|
179
178
|
class ChatCompletionOutputLogprobs(BaseInferenceType):
|
|
180
179
|
content: List[ChatCompletionOutputLogprob]
|
|
181
180
|
|
|
182
181
|
|
|
183
|
-
@
|
|
182
|
+
@dataclass_with_extra
|
|
184
183
|
class ChatCompletionOutputFunctionDefinition(BaseInferenceType):
|
|
185
184
|
arguments: Any
|
|
186
185
|
name: str
|
|
187
186
|
description: Optional[str] = None
|
|
188
187
|
|
|
189
188
|
|
|
190
|
-
@
|
|
189
|
+
@dataclass_with_extra
|
|
191
190
|
class ChatCompletionOutputToolCall(BaseInferenceType):
|
|
192
191
|
function: ChatCompletionOutputFunctionDefinition
|
|
193
192
|
id: str
|
|
194
193
|
type: str
|
|
195
194
|
|
|
196
195
|
|
|
197
|
-
@
|
|
196
|
+
@dataclass_with_extra
|
|
198
197
|
class ChatCompletionOutputMessage(BaseInferenceType):
|
|
199
198
|
role: str
|
|
200
199
|
content: Optional[str] = None
|
|
201
200
|
tool_calls: Optional[List[ChatCompletionOutputToolCall]] = None
|
|
202
201
|
|
|
203
202
|
|
|
204
|
-
@
|
|
203
|
+
@dataclass_with_extra
|
|
205
204
|
class ChatCompletionOutputComplete(BaseInferenceType):
|
|
206
205
|
finish_reason: str
|
|
207
206
|
index: int
|
|
@@ -209,14 +208,14 @@ class ChatCompletionOutputComplete(BaseInferenceType):
|
|
|
209
208
|
logprobs: Optional[ChatCompletionOutputLogprobs] = None
|
|
210
209
|
|
|
211
210
|
|
|
212
|
-
@
|
|
211
|
+
@dataclass_with_extra
|
|
213
212
|
class ChatCompletionOutputUsage(BaseInferenceType):
|
|
214
213
|
completion_tokens: int
|
|
215
214
|
prompt_tokens: int
|
|
216
215
|
total_tokens: int
|
|
217
216
|
|
|
218
217
|
|
|
219
|
-
@
|
|
218
|
+
@dataclass_with_extra
|
|
220
219
|
class ChatCompletionOutput(BaseInferenceType):
|
|
221
220
|
"""Chat Completion Output.
|
|
222
221
|
Auto-generated from TGI specs.
|
|
@@ -232,13 +231,13 @@ class ChatCompletionOutput(BaseInferenceType):
|
|
|
232
231
|
usage: ChatCompletionOutputUsage
|
|
233
232
|
|
|
234
233
|
|
|
235
|
-
@
|
|
234
|
+
@dataclass_with_extra
|
|
236
235
|
class ChatCompletionStreamOutputFunction(BaseInferenceType):
|
|
237
236
|
arguments: str
|
|
238
237
|
name: Optional[str] = None
|
|
239
238
|
|
|
240
239
|
|
|
241
|
-
@
|
|
240
|
+
@dataclass_with_extra
|
|
242
241
|
class ChatCompletionStreamOutputDeltaToolCall(BaseInferenceType):
|
|
243
242
|
function: ChatCompletionStreamOutputFunction
|
|
244
243
|
id: str
|
|
@@ -246,32 +245,32 @@ class ChatCompletionStreamOutputDeltaToolCall(BaseInferenceType):
|
|
|
246
245
|
type: str
|
|
247
246
|
|
|
248
247
|
|
|
249
|
-
@
|
|
248
|
+
@dataclass_with_extra
|
|
250
249
|
class ChatCompletionStreamOutputDelta(BaseInferenceType):
|
|
251
250
|
role: str
|
|
252
251
|
content: Optional[str] = None
|
|
253
252
|
tool_calls: Optional[ChatCompletionStreamOutputDeltaToolCall] = None
|
|
254
253
|
|
|
255
254
|
|
|
256
|
-
@
|
|
255
|
+
@dataclass_with_extra
|
|
257
256
|
class ChatCompletionStreamOutputTopLogprob(BaseInferenceType):
|
|
258
257
|
logprob: float
|
|
259
258
|
token: str
|
|
260
259
|
|
|
261
260
|
|
|
262
|
-
@
|
|
261
|
+
@dataclass_with_extra
|
|
263
262
|
class ChatCompletionStreamOutputLogprob(BaseInferenceType):
|
|
264
263
|
logprob: float
|
|
265
264
|
token: str
|
|
266
265
|
top_logprobs: List[ChatCompletionStreamOutputTopLogprob]
|
|
267
266
|
|
|
268
267
|
|
|
269
|
-
@
|
|
268
|
+
@dataclass_with_extra
|
|
270
269
|
class ChatCompletionStreamOutputLogprobs(BaseInferenceType):
|
|
271
270
|
content: List[ChatCompletionStreamOutputLogprob]
|
|
272
271
|
|
|
273
272
|
|
|
274
|
-
@
|
|
273
|
+
@dataclass_with_extra
|
|
275
274
|
class ChatCompletionStreamOutputChoice(BaseInferenceType):
|
|
276
275
|
delta: ChatCompletionStreamOutputDelta
|
|
277
276
|
index: int
|
|
@@ -279,14 +278,14 @@ class ChatCompletionStreamOutputChoice(BaseInferenceType):
|
|
|
279
278
|
logprobs: Optional[ChatCompletionStreamOutputLogprobs] = None
|
|
280
279
|
|
|
281
280
|
|
|
282
|
-
@
|
|
281
|
+
@dataclass_with_extra
|
|
283
282
|
class ChatCompletionStreamOutputUsage(BaseInferenceType):
|
|
284
283
|
completion_tokens: int
|
|
285
284
|
prompt_tokens: int
|
|
286
285
|
total_tokens: int
|
|
287
286
|
|
|
288
287
|
|
|
289
|
-
@
|
|
288
|
+
@dataclass_with_extra
|
|
290
289
|
class ChatCompletionStreamOutput(BaseInferenceType):
|
|
291
290
|
"""Chat Completion Stream Output.
|
|
292
291
|
Auto-generated from TGI specs.
|
|
@@ -3,13 +3,12 @@
|
|
|
3
3
|
# See:
|
|
4
4
|
# - script: https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/scripts/inference-codegen.ts
|
|
5
5
|
# - specs: https://github.com/huggingface/huggingface.js/tree/main/packages/tasks/src/tasks.
|
|
6
|
-
from dataclasses import dataclass
|
|
7
6
|
from typing import Any, Dict, Optional
|
|
8
7
|
|
|
9
|
-
from .base import BaseInferenceType
|
|
8
|
+
from .base import BaseInferenceType, dataclass_with_extra
|
|
10
9
|
|
|
11
10
|
|
|
12
|
-
@
|
|
11
|
+
@dataclass_with_extra
|
|
13
12
|
class DepthEstimationInput(BaseInferenceType):
|
|
14
13
|
"""Inputs for Depth Estimation inference"""
|
|
15
14
|
|
|
@@ -19,7 +18,7 @@ class DepthEstimationInput(BaseInferenceType):
|
|
|
19
18
|
"""Additional inference parameters for Depth Estimation"""
|
|
20
19
|
|
|
21
20
|
|
|
22
|
-
@
|
|
21
|
+
@dataclass_with_extra
|
|
23
22
|
class DepthEstimationOutput(BaseInferenceType):
|
|
24
23
|
"""Outputs of inference for the Depth Estimation task"""
|
|
25
24
|
|
|
@@ -3,13 +3,12 @@
|
|
|
3
3
|
# See:
|
|
4
4
|
# - script: https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/scripts/inference-codegen.ts
|
|
5
5
|
# - specs: https://github.com/huggingface/huggingface.js/tree/main/packages/tasks/src/tasks.
|
|
6
|
-
from dataclasses import dataclass
|
|
7
6
|
from typing import Any, List, Optional, Union
|
|
8
7
|
|
|
9
|
-
from .base import BaseInferenceType
|
|
8
|
+
from .base import BaseInferenceType, dataclass_with_extra
|
|
10
9
|
|
|
11
10
|
|
|
12
|
-
@
|
|
11
|
+
@dataclass_with_extra
|
|
13
12
|
class DocumentQuestionAnsweringInputData(BaseInferenceType):
|
|
14
13
|
"""One (document, question) pair to answer"""
|
|
15
14
|
|
|
@@ -19,7 +18,7 @@ class DocumentQuestionAnsweringInputData(BaseInferenceType):
|
|
|
19
18
|
"""A question to ask of the document"""
|
|
20
19
|
|
|
21
20
|
|
|
22
|
-
@
|
|
21
|
+
@dataclass_with_extra
|
|
23
22
|
class DocumentQuestionAnsweringParameters(BaseInferenceType):
|
|
24
23
|
"""Additional inference parameters for Document Question Answering"""
|
|
25
24
|
|
|
@@ -53,7 +52,7 @@ class DocumentQuestionAnsweringParameters(BaseInferenceType):
|
|
|
53
52
|
"""
|
|
54
53
|
|
|
55
54
|
|
|
56
|
-
@
|
|
55
|
+
@dataclass_with_extra
|
|
57
56
|
class DocumentQuestionAnsweringInput(BaseInferenceType):
|
|
58
57
|
"""Inputs for Document Question Answering inference"""
|
|
59
58
|
|
|
@@ -63,7 +62,7 @@ class DocumentQuestionAnsweringInput(BaseInferenceType):
|
|
|
63
62
|
"""Additional inference parameters for Document Question Answering"""
|
|
64
63
|
|
|
65
64
|
|
|
66
|
-
@
|
|
65
|
+
@dataclass_with_extra
|
|
67
66
|
class DocumentQuestionAnsweringOutputElement(BaseInferenceType):
|
|
68
67
|
"""Outputs of inference for the Document Question Answering task"""
|
|
69
68
|
|
|
@@ -3,16 +3,15 @@
|
|
|
3
3
|
# See:
|
|
4
4
|
# - script: https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/scripts/inference-codegen.ts
|
|
5
5
|
# - specs: https://github.com/huggingface/huggingface.js/tree/main/packages/tasks/src/tasks.
|
|
6
|
-
from
|
|
7
|
-
from typing import Literal, Optional
|
|
6
|
+
from typing import List, Literal, Optional, Union
|
|
8
7
|
|
|
9
|
-
from .base import BaseInferenceType
|
|
8
|
+
from .base import BaseInferenceType, dataclass_with_extra
|
|
10
9
|
|
|
11
10
|
|
|
12
11
|
FeatureExtractionInputTruncationDirection = Literal["Left", "Right"]
|
|
13
12
|
|
|
14
13
|
|
|
15
|
-
@
|
|
14
|
+
@dataclass_with_extra
|
|
16
15
|
class FeatureExtractionInput(BaseInferenceType):
|
|
17
16
|
"""Feature Extraction Input.
|
|
18
17
|
Auto-generated from TEI specs.
|
|
@@ -20,8 +19,8 @@ class FeatureExtractionInput(BaseInferenceType):
|
|
|
20
19
|
https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/scripts/inference-tei-import.ts.
|
|
21
20
|
"""
|
|
22
21
|
|
|
23
|
-
inputs: str
|
|
24
|
-
"""The text to embed."""
|
|
22
|
+
inputs: Union[List[str], str]
|
|
23
|
+
"""The text or list of texts to embed."""
|
|
25
24
|
normalize: Optional[bool] = None
|
|
26
25
|
prompt_name: Optional[str] = None
|
|
27
26
|
"""The name of the prompt that should be used by for encoding. If not set, no prompt
|
|
@@ -3,13 +3,12 @@
|
|
|
3
3
|
# See:
|
|
4
4
|
# - script: https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/scripts/inference-codegen.ts
|
|
5
5
|
# - specs: https://github.com/huggingface/huggingface.js/tree/main/packages/tasks/src/tasks.
|
|
6
|
-
from dataclasses import dataclass
|
|
7
6
|
from typing import Any, List, Optional
|
|
8
7
|
|
|
9
|
-
from .base import BaseInferenceType
|
|
8
|
+
from .base import BaseInferenceType, dataclass_with_extra
|
|
10
9
|
|
|
11
10
|
|
|
12
|
-
@
|
|
11
|
+
@dataclass_with_extra
|
|
13
12
|
class FillMaskParameters(BaseInferenceType):
|
|
14
13
|
"""Additional inference parameters for Fill Mask"""
|
|
15
14
|
|
|
@@ -23,7 +22,7 @@ class FillMaskParameters(BaseInferenceType):
|
|
|
23
22
|
"""When passed, overrides the number of predictions to return."""
|
|
24
23
|
|
|
25
24
|
|
|
26
|
-
@
|
|
25
|
+
@dataclass_with_extra
|
|
27
26
|
class FillMaskInput(BaseInferenceType):
|
|
28
27
|
"""Inputs for Fill Mask inference"""
|
|
29
28
|
|
|
@@ -33,7 +32,7 @@ class FillMaskInput(BaseInferenceType):
|
|
|
33
32
|
"""Additional inference parameters for Fill Mask"""
|
|
34
33
|
|
|
35
34
|
|
|
36
|
-
@
|
|
35
|
+
@dataclass_with_extra
|
|
37
36
|
class FillMaskOutputElement(BaseInferenceType):
|
|
38
37
|
"""Outputs of inference for the Fill Mask task"""
|
|
39
38
|
|
|
@@ -3,16 +3,15 @@
|
|
|
3
3
|
# See:
|
|
4
4
|
# - script: https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/scripts/inference-codegen.ts
|
|
5
5
|
# - specs: https://github.com/huggingface/huggingface.js/tree/main/packages/tasks/src/tasks.
|
|
6
|
-
from dataclasses import dataclass
|
|
7
6
|
from typing import Literal, Optional
|
|
8
7
|
|
|
9
|
-
from .base import BaseInferenceType
|
|
8
|
+
from .base import BaseInferenceType, dataclass_with_extra
|
|
10
9
|
|
|
11
10
|
|
|
12
11
|
ImageClassificationOutputTransform = Literal["sigmoid", "softmax", "none"]
|
|
13
12
|
|
|
14
13
|
|
|
15
|
-
@
|
|
14
|
+
@dataclass_with_extra
|
|
16
15
|
class ImageClassificationParameters(BaseInferenceType):
|
|
17
16
|
"""Additional inference parameters for Image Classification"""
|
|
18
17
|
|
|
@@ -22,7 +21,7 @@ class ImageClassificationParameters(BaseInferenceType):
|
|
|
22
21
|
"""When specified, limits the output to the top K most probable classes."""
|
|
23
22
|
|
|
24
23
|
|
|
25
|
-
@
|
|
24
|
+
@dataclass_with_extra
|
|
26
25
|
class ImageClassificationInput(BaseInferenceType):
|
|
27
26
|
"""Inputs for Image Classification inference"""
|
|
28
27
|
|
|
@@ -34,7 +33,7 @@ class ImageClassificationInput(BaseInferenceType):
|
|
|
34
33
|
"""Additional inference parameters for Image Classification"""
|
|
35
34
|
|
|
36
35
|
|
|
37
|
-
@
|
|
36
|
+
@dataclass_with_extra
|
|
38
37
|
class ImageClassificationOutputElement(BaseInferenceType):
|
|
39
38
|
"""Outputs of inference for the Image Classification task"""
|
|
40
39
|
|
|
@@ -3,16 +3,15 @@
|
|
|
3
3
|
# See:
|
|
4
4
|
# - script: https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/scripts/inference-codegen.ts
|
|
5
5
|
# - specs: https://github.com/huggingface/huggingface.js/tree/main/packages/tasks/src/tasks.
|
|
6
|
-
from dataclasses import dataclass
|
|
7
6
|
from typing import Literal, Optional
|
|
8
7
|
|
|
9
|
-
from .base import BaseInferenceType
|
|
8
|
+
from .base import BaseInferenceType, dataclass_with_extra
|
|
10
9
|
|
|
11
10
|
|
|
12
11
|
ImageSegmentationSubtask = Literal["instance", "panoptic", "semantic"]
|
|
13
12
|
|
|
14
13
|
|
|
15
|
-
@
|
|
14
|
+
@dataclass_with_extra
|
|
16
15
|
class ImageSegmentationParameters(BaseInferenceType):
|
|
17
16
|
"""Additional inference parameters for Image Segmentation"""
|
|
18
17
|
|
|
@@ -26,7 +25,7 @@ class ImageSegmentationParameters(BaseInferenceType):
|
|
|
26
25
|
"""Probability threshold to filter out predicted masks."""
|
|
27
26
|
|
|
28
27
|
|
|
29
|
-
@
|
|
28
|
+
@dataclass_with_extra
|
|
30
29
|
class ImageSegmentationInput(BaseInferenceType):
|
|
31
30
|
"""Inputs for Image Segmentation inference"""
|
|
32
31
|
|
|
@@ -38,7 +37,7 @@ class ImageSegmentationInput(BaseInferenceType):
|
|
|
38
37
|
"""Additional inference parameters for Image Segmentation"""
|
|
39
38
|
|
|
40
39
|
|
|
41
|
-
@
|
|
40
|
+
@dataclass_with_extra
|
|
42
41
|
class ImageSegmentationOutputElement(BaseInferenceType):
|
|
43
42
|
"""Outputs of inference for the Image Segmentation task
|
|
44
43
|
A predicted mask / segment
|
|
@@ -3,13 +3,12 @@
|
|
|
3
3
|
# See:
|
|
4
4
|
# - script: https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/scripts/inference-codegen.ts
|
|
5
5
|
# - specs: https://github.com/huggingface/huggingface.js/tree/main/packages/tasks/src/tasks.
|
|
6
|
-
from dataclasses import dataclass
|
|
7
6
|
from typing import Any, Optional
|
|
8
7
|
|
|
9
|
-
from .base import BaseInferenceType
|
|
8
|
+
from .base import BaseInferenceType, dataclass_with_extra
|
|
10
9
|
|
|
11
10
|
|
|
12
|
-
@
|
|
11
|
+
@dataclass_with_extra
|
|
13
12
|
class ImageToImageTargetSize(BaseInferenceType):
|
|
14
13
|
"""The size in pixel of the output image."""
|
|
15
14
|
|
|
@@ -17,7 +16,7 @@ class ImageToImageTargetSize(BaseInferenceType):
|
|
|
17
16
|
width: int
|
|
18
17
|
|
|
19
18
|
|
|
20
|
-
@
|
|
19
|
+
@dataclass_with_extra
|
|
21
20
|
class ImageToImageParameters(BaseInferenceType):
|
|
22
21
|
"""Additional inference parameters for Image To Image"""
|
|
23
22
|
|
|
@@ -35,7 +34,7 @@ class ImageToImageParameters(BaseInferenceType):
|
|
|
35
34
|
"""The size in pixel of the output image."""
|
|
36
35
|
|
|
37
36
|
|
|
38
|
-
@
|
|
37
|
+
@dataclass_with_extra
|
|
39
38
|
class ImageToImageInput(BaseInferenceType):
|
|
40
39
|
"""Inputs for Image To Image inference"""
|
|
41
40
|
|
|
@@ -47,7 +46,7 @@ class ImageToImageInput(BaseInferenceType):
|
|
|
47
46
|
"""Additional inference parameters for Image To Image"""
|
|
48
47
|
|
|
49
48
|
|
|
50
|
-
@
|
|
49
|
+
@dataclass_with_extra
|
|
51
50
|
class ImageToImageOutput(BaseInferenceType):
|
|
52
51
|
"""Outputs of inference for the Image To Image task"""
|
|
53
52
|
|
|
@@ -3,16 +3,15 @@
|
|
|
3
3
|
# See:
|
|
4
4
|
# - script: https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/scripts/inference-codegen.ts
|
|
5
5
|
# - specs: https://github.com/huggingface/huggingface.js/tree/main/packages/tasks/src/tasks.
|
|
6
|
-
from dataclasses import dataclass
|
|
7
6
|
from typing import Any, Literal, Optional, Union
|
|
8
7
|
|
|
9
|
-
from .base import BaseInferenceType
|
|
8
|
+
from .base import BaseInferenceType, dataclass_with_extra
|
|
10
9
|
|
|
11
10
|
|
|
12
11
|
ImageToTextEarlyStoppingEnum = Literal["never"]
|
|
13
12
|
|
|
14
13
|
|
|
15
|
-
@
|
|
14
|
+
@dataclass_with_extra
|
|
16
15
|
class ImageToTextGenerationParameters(BaseInferenceType):
|
|
17
16
|
"""Parametrization of the text generation process"""
|
|
18
17
|
|
|
@@ -72,7 +71,7 @@ class ImageToTextGenerationParameters(BaseInferenceType):
|
|
|
72
71
|
"""Whether the model should use the past last key/values attentions to speed up decoding"""
|
|
73
72
|
|
|
74
73
|
|
|
75
|
-
@
|
|
74
|
+
@dataclass_with_extra
|
|
76
75
|
class ImageToTextParameters(BaseInferenceType):
|
|
77
76
|
"""Additional inference parameters for Image To Text"""
|
|
78
77
|
|
|
@@ -83,7 +82,7 @@ class ImageToTextParameters(BaseInferenceType):
|
|
|
83
82
|
"""Parametrization of the text generation process"""
|
|
84
83
|
|
|
85
84
|
|
|
86
|
-
@
|
|
85
|
+
@dataclass_with_extra
|
|
87
86
|
class ImageToTextInput(BaseInferenceType):
|
|
88
87
|
"""Inputs for Image To Text inference"""
|
|
89
88
|
|
|
@@ -93,7 +92,7 @@ class ImageToTextInput(BaseInferenceType):
|
|
|
93
92
|
"""Additional inference parameters for Image To Text"""
|
|
94
93
|
|
|
95
94
|
|
|
96
|
-
@
|
|
95
|
+
@dataclass_with_extra
|
|
97
96
|
class ImageToTextOutput(BaseInferenceType):
|
|
98
97
|
"""Outputs of inference for the Image To Text task"""
|
|
99
98
|
|
|
@@ -3,13 +3,12 @@
|
|
|
3
3
|
# See:
|
|
4
4
|
# - script: https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/scripts/inference-codegen.ts
|
|
5
5
|
# - specs: https://github.com/huggingface/huggingface.js/tree/main/packages/tasks/src/tasks.
|
|
6
|
-
from dataclasses import dataclass
|
|
7
6
|
from typing import Optional
|
|
8
7
|
|
|
9
|
-
from .base import BaseInferenceType
|
|
8
|
+
from .base import BaseInferenceType, dataclass_with_extra
|
|
10
9
|
|
|
11
10
|
|
|
12
|
-
@
|
|
11
|
+
@dataclass_with_extra
|
|
13
12
|
class ObjectDetectionParameters(BaseInferenceType):
|
|
14
13
|
"""Additional inference parameters for Object Detection"""
|
|
15
14
|
|
|
@@ -17,7 +16,7 @@ class ObjectDetectionParameters(BaseInferenceType):
|
|
|
17
16
|
"""The probability necessary to make a prediction."""
|
|
18
17
|
|
|
19
18
|
|
|
20
|
-
@
|
|
19
|
+
@dataclass_with_extra
|
|
21
20
|
class ObjectDetectionInput(BaseInferenceType):
|
|
22
21
|
"""Inputs for Object Detection inference"""
|
|
23
22
|
|
|
@@ -29,7 +28,7 @@ class ObjectDetectionInput(BaseInferenceType):
|
|
|
29
28
|
"""Additional inference parameters for Object Detection"""
|
|
30
29
|
|
|
31
30
|
|
|
32
|
-
@
|
|
31
|
+
@dataclass_with_extra
|
|
33
32
|
class ObjectDetectionBoundingBox(BaseInferenceType):
|
|
34
33
|
"""The predicted bounding box. Coordinates are relative to the top left corner of the input
|
|
35
34
|
image.
|
|
@@ -45,7 +44,7 @@ class ObjectDetectionBoundingBox(BaseInferenceType):
|
|
|
45
44
|
"""The y-coordinate of the top-left corner of the bounding box."""
|
|
46
45
|
|
|
47
46
|
|
|
48
|
-
@
|
|
47
|
+
@dataclass_with_extra
|
|
49
48
|
class ObjectDetectionOutputElement(BaseInferenceType):
|
|
50
49
|
"""Outputs of inference for the Object Detection task"""
|
|
51
50
|
|