@huggingface/tasks 0.9.0 → 0.10.0

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.
Files changed (190) hide show
  1. package/README.md +12 -14
  2. package/dist/index.cjs +91 -18
  3. package/dist/index.js +90 -18
  4. package/dist/scripts/inference-codegen.d.ts +2 -0
  5. package/dist/scripts/inference-codegen.d.ts.map +1 -0
  6. package/dist/scripts/inference-tgi-import.d.ts +2 -0
  7. package/dist/scripts/inference-tgi-import.d.ts.map +1 -0
  8. package/dist/src/default-widget-inputs.d.ts +6 -0
  9. package/dist/src/default-widget-inputs.d.ts.map +1 -0
  10. package/dist/src/index.d.ts +17 -0
  11. package/dist/src/index.d.ts.map +1 -0
  12. package/dist/src/library-to-tasks.d.ts +11 -0
  13. package/dist/src/library-to-tasks.d.ts.map +1 -0
  14. package/dist/src/local-apps.d.ts +104 -0
  15. package/dist/src/local-apps.d.ts.map +1 -0
  16. package/dist/src/model-data.d.ts +144 -0
  17. package/dist/src/model-data.d.ts.map +1 -0
  18. package/dist/src/model-libraries-downloads.d.ts +26 -0
  19. package/dist/src/model-libraries-downloads.d.ts.map +1 -0
  20. package/dist/src/model-libraries-snippets.d.ts +43 -0
  21. package/dist/src/model-libraries-snippets.d.ts.map +1 -0
  22. package/dist/src/model-libraries.d.ts +490 -0
  23. package/dist/src/model-libraries.d.ts.map +1 -0
  24. package/dist/src/pipelines.d.ts +404 -0
  25. package/dist/src/pipelines.d.ts.map +1 -0
  26. package/dist/src/snippets/curl.d.ts +9 -0
  27. package/dist/src/snippets/curl.d.ts.map +1 -0
  28. package/dist/src/snippets/index.d.ts +6 -0
  29. package/dist/src/snippets/index.d.ts.map +1 -0
  30. package/dist/src/snippets/inputs.d.ts +3 -0
  31. package/dist/src/snippets/inputs.d.ts.map +1 -0
  32. package/dist/src/snippets/js.d.ts +11 -0
  33. package/dist/src/snippets/js.d.ts.map +1 -0
  34. package/dist/src/snippets/python.d.ts +14 -0
  35. package/dist/src/snippets/python.d.ts.map +1 -0
  36. package/dist/src/snippets/types.d.ts +8 -0
  37. package/dist/src/snippets/types.d.ts.map +1 -0
  38. package/dist/src/tasks/audio-classification/data.d.ts +4 -0
  39. package/dist/src/tasks/audio-classification/data.d.ts.map +1 -0
  40. package/dist/src/tasks/audio-classification/inference.d.ts +52 -0
  41. package/dist/src/tasks/audio-classification/inference.d.ts.map +1 -0
  42. package/dist/src/tasks/audio-to-audio/data.d.ts +4 -0
  43. package/dist/src/tasks/audio-to-audio/data.d.ts.map +1 -0
  44. package/dist/src/tasks/automatic-speech-recognition/data.d.ts +4 -0
  45. package/dist/src/tasks/automatic-speech-recognition/data.d.ts.map +1 -0
  46. package/dist/src/tasks/automatic-speech-recognition/inference.d.ts +154 -0
  47. package/dist/src/tasks/automatic-speech-recognition/inference.d.ts.map +1 -0
  48. package/dist/src/tasks/chat-completion/inference.d.ts +254 -0
  49. package/dist/src/tasks/chat-completion/inference.d.ts.map +1 -0
  50. package/dist/src/tasks/depth-estimation/data.d.ts +4 -0
  51. package/dist/src/tasks/depth-estimation/data.d.ts.map +1 -0
  52. package/dist/src/tasks/depth-estimation/inference.d.ts +36 -0
  53. package/dist/src/tasks/depth-estimation/inference.d.ts.map +1 -0
  54. package/dist/src/tasks/document-question-answering/data.d.ts +4 -0
  55. package/dist/src/tasks/document-question-answering/data.d.ts.map +1 -0
  56. package/dist/src/tasks/document-question-answering/inference.d.ts +111 -0
  57. package/dist/src/tasks/document-question-answering/inference.d.ts.map +1 -0
  58. package/dist/src/tasks/feature-extraction/data.d.ts +4 -0
  59. package/dist/src/tasks/feature-extraction/data.d.ts.map +1 -0
  60. package/dist/src/tasks/feature-extraction/inference.d.ts +23 -0
  61. package/dist/src/tasks/feature-extraction/inference.d.ts.map +1 -0
  62. package/dist/src/tasks/fill-mask/data.d.ts +4 -0
  63. package/dist/src/tasks/fill-mask/data.d.ts.map +1 -0
  64. package/dist/src/tasks/fill-mask/inference.d.ts +63 -0
  65. package/dist/src/tasks/fill-mask/inference.d.ts.map +1 -0
  66. package/dist/src/tasks/image-classification/data.d.ts +4 -0
  67. package/dist/src/tasks/image-classification/data.d.ts.map +1 -0
  68. package/dist/src/tasks/image-classification/inference.d.ts +52 -0
  69. package/dist/src/tasks/image-classification/inference.d.ts.map +1 -0
  70. package/dist/src/tasks/image-feature-extraction/data.d.ts +4 -0
  71. package/dist/src/tasks/image-feature-extraction/data.d.ts.map +1 -0
  72. package/dist/src/tasks/image-segmentation/data.d.ts +4 -0
  73. package/dist/src/tasks/image-segmentation/data.d.ts.map +1 -0
  74. package/dist/src/tasks/image-segmentation/inference.d.ts +66 -0
  75. package/dist/src/tasks/image-segmentation/inference.d.ts.map +1 -0
  76. package/dist/src/tasks/image-to-image/data.d.ts +4 -0
  77. package/dist/src/tasks/image-to-image/data.d.ts.map +1 -0
  78. package/dist/src/tasks/image-to-image/inference.d.ts +64 -0
  79. package/dist/src/tasks/image-to-image/inference.d.ts.map +1 -0
  80. package/dist/src/tasks/image-to-text/data.d.ts +4 -0
  81. package/dist/src/tasks/image-to-text/data.d.ts.map +1 -0
  82. package/dist/src/tasks/image-to-text/inference.d.ts +139 -0
  83. package/dist/src/tasks/image-to-text/inference.d.ts.map +1 -0
  84. package/dist/src/tasks/index.d.ts +87 -0
  85. package/dist/src/tasks/index.d.ts.map +1 -0
  86. package/dist/src/tasks/mask-generation/data.d.ts +4 -0
  87. package/dist/src/tasks/mask-generation/data.d.ts.map +1 -0
  88. package/dist/src/tasks/object-detection/data.d.ts +4 -0
  89. package/dist/src/tasks/object-detection/data.d.ts.map +1 -0
  90. package/dist/src/tasks/object-detection/inference.d.ts +63 -0
  91. package/dist/src/tasks/object-detection/inference.d.ts.map +1 -0
  92. package/dist/src/tasks/placeholder/data.d.ts +4 -0
  93. package/dist/src/tasks/placeholder/data.d.ts.map +1 -0
  94. package/dist/src/tasks/question-answering/data.d.ts +4 -0
  95. package/dist/src/tasks/question-answering/data.d.ts.map +1 -0
  96. package/dist/src/tasks/question-answering/inference.d.ts +100 -0
  97. package/dist/src/tasks/question-answering/inference.d.ts.map +1 -0
  98. package/dist/src/tasks/reinforcement-learning/data.d.ts +4 -0
  99. package/dist/src/tasks/reinforcement-learning/data.d.ts.map +1 -0
  100. package/dist/src/tasks/sentence-similarity/data.d.ts +4 -0
  101. package/dist/src/tasks/sentence-similarity/data.d.ts.map +1 -0
  102. package/dist/src/tasks/sentence-similarity/inference.d.ts +32 -0
  103. package/dist/src/tasks/sentence-similarity/inference.d.ts.map +1 -0
  104. package/dist/src/tasks/summarization/data.d.ts +4 -0
  105. package/dist/src/tasks/summarization/data.d.ts.map +1 -0
  106. package/dist/src/tasks/summarization/inference.d.ts +55 -0
  107. package/dist/src/tasks/summarization/inference.d.ts.map +1 -0
  108. package/dist/src/tasks/table-question-answering/data.d.ts +4 -0
  109. package/dist/src/tasks/table-question-answering/data.d.ts.map +1 -0
  110. package/dist/src/tasks/table-question-answering/inference.d.ts +62 -0
  111. package/dist/src/tasks/table-question-answering/inference.d.ts.map +1 -0
  112. package/dist/src/tasks/tabular-classification/data.d.ts +4 -0
  113. package/dist/src/tasks/tabular-classification/data.d.ts.map +1 -0
  114. package/dist/src/tasks/tabular-regression/data.d.ts +4 -0
  115. package/dist/src/tasks/tabular-regression/data.d.ts.map +1 -0
  116. package/dist/src/tasks/text-classification/data.d.ts +4 -0
  117. package/dist/src/tasks/text-classification/data.d.ts.map +1 -0
  118. package/dist/src/tasks/text-classification/inference.d.ts +52 -0
  119. package/dist/src/tasks/text-classification/inference.d.ts.map +1 -0
  120. package/dist/src/tasks/text-generation/data.d.ts +4 -0
  121. package/dist/src/tasks/text-generation/data.d.ts.map +1 -0
  122. package/dist/src/tasks/text-generation/inference.d.ts +126 -0
  123. package/dist/src/tasks/text-generation/inference.d.ts.map +1 -0
  124. package/dist/src/tasks/text-to-audio/inference.d.ts +139 -0
  125. package/dist/src/tasks/text-to-audio/inference.d.ts.map +1 -0
  126. package/dist/src/tasks/text-to-image/data.d.ts +4 -0
  127. package/dist/src/tasks/text-to-image/data.d.ts.map +1 -0
  128. package/dist/src/tasks/text-to-image/inference.d.ts +68 -0
  129. package/dist/src/tasks/text-to-image/inference.d.ts.map +1 -0
  130. package/dist/src/tasks/text-to-speech/data.d.ts +4 -0
  131. package/dist/src/tasks/text-to-speech/data.d.ts.map +1 -0
  132. package/dist/src/tasks/text-to-speech/inference.d.ts +143 -0
  133. package/dist/src/tasks/text-to-speech/inference.d.ts.map +1 -0
  134. package/dist/src/tasks/text-to-video/data.d.ts +4 -0
  135. package/dist/src/tasks/text-to-video/data.d.ts.map +1 -0
  136. package/dist/src/tasks/text2text-generation/inference.d.ts +54 -0
  137. package/dist/src/tasks/text2text-generation/inference.d.ts.map +1 -0
  138. package/dist/src/tasks/token-classification/data.d.ts +4 -0
  139. package/dist/src/tasks/token-classification/data.d.ts.map +1 -0
  140. package/dist/src/tasks/token-classification/inference.d.ts +83 -0
  141. package/dist/src/tasks/token-classification/inference.d.ts.map +1 -0
  142. package/dist/src/tasks/translation/data.d.ts +4 -0
  143. package/dist/src/tasks/translation/data.d.ts.map +1 -0
  144. package/dist/src/tasks/translation/inference.d.ts +55 -0
  145. package/dist/src/tasks/translation/inference.d.ts.map +1 -0
  146. package/dist/src/tasks/unconditional-image-generation/data.d.ts +4 -0
  147. package/dist/src/tasks/unconditional-image-generation/data.d.ts.map +1 -0
  148. package/dist/src/tasks/video-classification/data.d.ts +4 -0
  149. package/dist/src/tasks/video-classification/data.d.ts.map +1 -0
  150. package/dist/src/tasks/video-classification/inference.d.ts +60 -0
  151. package/dist/src/tasks/video-classification/inference.d.ts.map +1 -0
  152. package/dist/src/tasks/visual-question-answering/data.d.ts +4 -0
  153. package/dist/src/tasks/visual-question-answering/data.d.ts.map +1 -0
  154. package/dist/src/tasks/visual-question-answering/inference.d.ts +64 -0
  155. package/dist/src/tasks/visual-question-answering/inference.d.ts.map +1 -0
  156. package/dist/src/tasks/zero-shot-classification/data.d.ts +4 -0
  157. package/dist/src/tasks/zero-shot-classification/data.d.ts.map +1 -0
  158. package/dist/src/tasks/zero-shot-classification/inference.d.ts +68 -0
  159. package/dist/src/tasks/zero-shot-classification/inference.d.ts.map +1 -0
  160. package/dist/src/tasks/zero-shot-image-classification/data.d.ts +4 -0
  161. package/dist/src/tasks/zero-shot-image-classification/data.d.ts.map +1 -0
  162. package/dist/src/tasks/zero-shot-image-classification/inference.d.ts +62 -0
  163. package/dist/src/tasks/zero-shot-image-classification/inference.d.ts.map +1 -0
  164. package/dist/src/tasks/zero-shot-object-detection/data.d.ts +4 -0
  165. package/dist/src/tasks/zero-shot-object-detection/data.d.ts.map +1 -0
  166. package/dist/src/tasks/zero-shot-object-detection/inference.d.ts +67 -0
  167. package/dist/src/tasks/zero-shot-object-detection/inference.d.ts.map +1 -0
  168. package/dist/src/tokenizer-data.d.ts +26 -0
  169. package/dist/src/tokenizer-data.d.ts.map +1 -0
  170. package/dist/src/widget-example.d.ts +86 -0
  171. package/dist/src/widget-example.d.ts.map +1 -0
  172. package/package.json +11 -6
  173. package/src/index.ts +3 -0
  174. package/src/local-apps.ts +119 -0
  175. package/src/model-data.ts +1 -5
  176. package/src/model-libraries-snippets.ts +21 -18
  177. package/src/model-libraries.ts +9 -0
  178. package/src/tasks/chat-completion/inference.ts +204 -85
  179. package/src/tasks/chat-completion/spec/input.json +198 -34
  180. package/src/tasks/chat-completion/spec/output.json +178 -40
  181. package/src/tasks/chat-completion/spec/stream_output.json +170 -0
  182. package/src/tasks/index.ts +7 -8
  183. package/src/tasks/text-generation/inference.ts +58 -170
  184. package/src/tasks/text-generation/spec/input.json +130 -29
  185. package/src/tasks/text-generation/spec/output.json +104 -90
  186. package/src/tasks/text-generation/spec/stream_output.json +97 -0
  187. package/tsconfig.json +3 -1
  188. package/dist/index.d.ts +0 -3531
  189. package/src/tasks/chat-completion/spec/output_stream.json +0 -48
  190. package/src/tasks/text-generation/spec/output_stream.json +0 -47
package/dist/index.d.ts DELETED
@@ -1,3531 +0,0 @@
1
- declare const MODALITIES: readonly ["cv", "nlp", "audio", "tabular", "multimodal", "rl", "other"];
2
- type Modality = (typeof MODALITIES)[number];
3
- declare const MODALITY_LABELS: {
4
- multimodal: string;
5
- nlp: string;
6
- audio: string;
7
- cv: string;
8
- rl: string;
9
- tabular: string;
10
- other: string;
11
- };
12
- /**
13
- * Public interface for a sub task.
14
- *
15
- * This can be used in a model card's `model-index` metadata.
16
- * and is more granular classification that can grow significantly
17
- * over time as new tasks are added.
18
- */
19
- interface SubTask {
20
- /**
21
- * type of the task (e.g. audio-source-separation)
22
- */
23
- type: string;
24
- /**
25
- * displayed name of the task (e.g. Audio Source Separation)
26
- */
27
- name: string;
28
- }
29
- /**
30
- * Public interface for a PipelineData.
31
- *
32
- * This information corresponds to a pipeline type (aka task)
33
- * in the Hub.
34
- */
35
- interface PipelineData {
36
- /**
37
- * displayed name of the task (e.g. Text Classification)
38
- */
39
- name: string;
40
- subtasks?: SubTask[];
41
- modality: Modality;
42
- /**
43
- * color for the tag icon.
44
- */
45
- color: "blue" | "green" | "indigo" | "orange" | "red" | "yellow";
46
- /**
47
- * whether to hide in /models filters
48
- */
49
- hideInModels?: boolean;
50
- /**
51
- * whether to hide in /datasets filters
52
- */
53
- hideInDatasets?: boolean;
54
- }
55
- declare const PIPELINE_DATA: {
56
- "text-classification": {
57
- name: string;
58
- subtasks: {
59
- type: string;
60
- name: string;
61
- }[];
62
- modality: "nlp";
63
- color: "orange";
64
- };
65
- "token-classification": {
66
- name: string;
67
- subtasks: {
68
- type: string;
69
- name: string;
70
- }[];
71
- modality: "nlp";
72
- color: "blue";
73
- };
74
- "table-question-answering": {
75
- name: string;
76
- modality: "nlp";
77
- color: "green";
78
- };
79
- "question-answering": {
80
- name: string;
81
- subtasks: {
82
- type: string;
83
- name: string;
84
- }[];
85
- modality: "nlp";
86
- color: "blue";
87
- };
88
- "zero-shot-classification": {
89
- name: string;
90
- modality: "nlp";
91
- color: "yellow";
92
- };
93
- translation: {
94
- name: string;
95
- modality: "nlp";
96
- color: "green";
97
- };
98
- summarization: {
99
- name: string;
100
- subtasks: {
101
- type: string;
102
- name: string;
103
- }[];
104
- modality: "nlp";
105
- color: "indigo";
106
- };
107
- "feature-extraction": {
108
- name: string;
109
- modality: "nlp";
110
- color: "red";
111
- };
112
- "text-generation": {
113
- name: string;
114
- subtasks: {
115
- type: string;
116
- name: string;
117
- }[];
118
- modality: "nlp";
119
- color: "indigo";
120
- };
121
- "text2text-generation": {
122
- name: string;
123
- subtasks: {
124
- type: string;
125
- name: string;
126
- }[];
127
- modality: "nlp";
128
- color: "indigo";
129
- };
130
- "fill-mask": {
131
- name: string;
132
- subtasks: {
133
- type: string;
134
- name: string;
135
- }[];
136
- modality: "nlp";
137
- color: "red";
138
- };
139
- "sentence-similarity": {
140
- name: string;
141
- modality: "nlp";
142
- color: "yellow";
143
- };
144
- "text-to-speech": {
145
- name: string;
146
- modality: "audio";
147
- color: "yellow";
148
- };
149
- "text-to-audio": {
150
- name: string;
151
- modality: "audio";
152
- color: "yellow";
153
- };
154
- "automatic-speech-recognition": {
155
- name: string;
156
- modality: "audio";
157
- color: "yellow";
158
- };
159
- "audio-to-audio": {
160
- name: string;
161
- modality: "audio";
162
- color: "blue";
163
- };
164
- "audio-classification": {
165
- name: string;
166
- subtasks: {
167
- type: string;
168
- name: string;
169
- }[];
170
- modality: "audio";
171
- color: "green";
172
- };
173
- "voice-activity-detection": {
174
- name: string;
175
- modality: "audio";
176
- color: "red";
177
- };
178
- "depth-estimation": {
179
- name: string;
180
- modality: "cv";
181
- color: "yellow";
182
- };
183
- "image-classification": {
184
- name: string;
185
- subtasks: {
186
- type: string;
187
- name: string;
188
- }[];
189
- modality: "cv";
190
- color: "blue";
191
- };
192
- "object-detection": {
193
- name: string;
194
- subtasks: {
195
- type: string;
196
- name: string;
197
- }[];
198
- modality: "cv";
199
- color: "yellow";
200
- };
201
- "image-segmentation": {
202
- name: string;
203
- subtasks: {
204
- type: string;
205
- name: string;
206
- }[];
207
- modality: "cv";
208
- color: "green";
209
- };
210
- "text-to-image": {
211
- name: string;
212
- modality: "cv";
213
- color: "yellow";
214
- };
215
- "image-to-text": {
216
- name: string;
217
- subtasks: {
218
- type: string;
219
- name: string;
220
- }[];
221
- modality: "cv";
222
- color: "red";
223
- };
224
- "image-to-image": {
225
- name: string;
226
- subtasks: {
227
- type: string;
228
- name: string;
229
- }[];
230
- modality: "cv";
231
- color: "indigo";
232
- };
233
- "image-to-video": {
234
- name: string;
235
- modality: "cv";
236
- color: "indigo";
237
- };
238
- "unconditional-image-generation": {
239
- name: string;
240
- modality: "cv";
241
- color: "green";
242
- };
243
- "video-classification": {
244
- name: string;
245
- modality: "cv";
246
- color: "blue";
247
- };
248
- "reinforcement-learning": {
249
- name: string;
250
- modality: "rl";
251
- color: "red";
252
- };
253
- robotics: {
254
- name: string;
255
- modality: "rl";
256
- subtasks: {
257
- type: string;
258
- name: string;
259
- }[];
260
- color: "blue";
261
- };
262
- "tabular-classification": {
263
- name: string;
264
- modality: "tabular";
265
- subtasks: {
266
- type: string;
267
- name: string;
268
- }[];
269
- color: "blue";
270
- };
271
- "tabular-regression": {
272
- name: string;
273
- modality: "tabular";
274
- subtasks: {
275
- type: string;
276
- name: string;
277
- }[];
278
- color: "blue";
279
- };
280
- "tabular-to-text": {
281
- name: string;
282
- modality: "tabular";
283
- subtasks: {
284
- type: string;
285
- name: string;
286
- }[];
287
- color: "blue";
288
- hideInModels: true;
289
- };
290
- "table-to-text": {
291
- name: string;
292
- modality: "nlp";
293
- color: "blue";
294
- hideInModels: true;
295
- };
296
- "multiple-choice": {
297
- name: string;
298
- subtasks: {
299
- type: string;
300
- name: string;
301
- }[];
302
- modality: "nlp";
303
- color: "blue";
304
- hideInModels: true;
305
- };
306
- "text-retrieval": {
307
- name: string;
308
- subtasks: {
309
- type: string;
310
- name: string;
311
- }[];
312
- modality: "nlp";
313
- color: "indigo";
314
- hideInModels: true;
315
- };
316
- "time-series-forecasting": {
317
- name: string;
318
- modality: "tabular";
319
- subtasks: {
320
- type: string;
321
- name: string;
322
- }[];
323
- color: "blue";
324
- hideInModels: true;
325
- };
326
- "text-to-video": {
327
- name: string;
328
- modality: "cv";
329
- color: "green";
330
- };
331
- "image-text-to-text": {
332
- name: string;
333
- modality: "multimodal";
334
- color: "red";
335
- hideInDatasets: true;
336
- };
337
- "visual-question-answering": {
338
- name: string;
339
- subtasks: {
340
- type: string;
341
- name: string;
342
- }[];
343
- modality: "multimodal";
344
- color: "red";
345
- };
346
- "document-question-answering": {
347
- name: string;
348
- subtasks: {
349
- type: string;
350
- name: string;
351
- }[];
352
- modality: "multimodal";
353
- color: "blue";
354
- hideInDatasets: true;
355
- };
356
- "zero-shot-image-classification": {
357
- name: string;
358
- modality: "cv";
359
- color: "yellow";
360
- };
361
- "graph-ml": {
362
- name: string;
363
- modality: "other";
364
- color: "green";
365
- };
366
- "mask-generation": {
367
- name: string;
368
- modality: "cv";
369
- color: "indigo";
370
- };
371
- "zero-shot-object-detection": {
372
- name: string;
373
- modality: "cv";
374
- color: "yellow";
375
- };
376
- "text-to-3d": {
377
- name: string;
378
- modality: "cv";
379
- color: "yellow";
380
- };
381
- "image-to-3d": {
382
- name: string;
383
- modality: "cv";
384
- color: "green";
385
- };
386
- "image-feature-extraction": {
387
- name: string;
388
- modality: "cv";
389
- color: "indigo";
390
- };
391
- other: {
392
- name: string;
393
- modality: "other";
394
- color: "blue";
395
- hideInModels: true;
396
- hideInDatasets: true;
397
- };
398
- };
399
- type PipelineType = keyof typeof PIPELINE_DATA;
400
- type WidgetType = PipelineType | "conversational";
401
- declare const PIPELINE_TYPES: ("other" | "text-classification" | "token-classification" | "table-question-answering" | "question-answering" | "zero-shot-classification" | "translation" | "summarization" | "feature-extraction" | "text-generation" | "text2text-generation" | "fill-mask" | "sentence-similarity" | "text-to-speech" | "text-to-audio" | "automatic-speech-recognition" | "audio-to-audio" | "audio-classification" | "voice-activity-detection" | "depth-estimation" | "image-classification" | "object-detection" | "image-segmentation" | "text-to-image" | "image-to-text" | "image-to-image" | "image-to-video" | "unconditional-image-generation" | "video-classification" | "reinforcement-learning" | "robotics" | "tabular-classification" | "tabular-regression" | "tabular-to-text" | "table-to-text" | "multiple-choice" | "text-retrieval" | "time-series-forecasting" | "text-to-video" | "image-text-to-text" | "visual-question-answering" | "document-question-answering" | "zero-shot-image-classification" | "graph-ml" | "mask-generation" | "zero-shot-object-detection" | "text-to-3d" | "image-to-3d" | "image-feature-extraction")[];
402
- declare const SUBTASK_TYPES: string[];
403
- declare const PIPELINE_TYPES_SET: Set<"other" | "text-classification" | "token-classification" | "table-question-answering" | "question-answering" | "zero-shot-classification" | "translation" | "summarization" | "feature-extraction" | "text-generation" | "text2text-generation" | "fill-mask" | "sentence-similarity" | "text-to-speech" | "text-to-audio" | "automatic-speech-recognition" | "audio-to-audio" | "audio-classification" | "voice-activity-detection" | "depth-estimation" | "image-classification" | "object-detection" | "image-segmentation" | "text-to-image" | "image-to-text" | "image-to-image" | "image-to-video" | "unconditional-image-generation" | "video-classification" | "reinforcement-learning" | "robotics" | "tabular-classification" | "tabular-regression" | "tabular-to-text" | "table-to-text" | "multiple-choice" | "text-retrieval" | "time-series-forecasting" | "text-to-video" | "image-text-to-text" | "visual-question-answering" | "document-question-answering" | "zero-shot-image-classification" | "graph-ml" | "mask-generation" | "zero-shot-object-detection" | "text-to-3d" | "image-to-3d" | "image-feature-extraction">;
404
-
405
- /**
406
- * See default-widget-inputs.ts for the default widget inputs, this files only contains the types
407
- */
408
- type TableData = Record<string, (string | number)[]>;
409
- type WidgetExampleOutputLabels = Array<{
410
- label: string;
411
- score: number;
412
- }>;
413
- interface WidgetExampleOutputAnswerScore {
414
- answer: string;
415
- score: number;
416
- }
417
- interface WidgetExampleOutputText {
418
- text: string;
419
- }
420
- interface WidgetExampleOutputUrl {
421
- url: string;
422
- }
423
- type WidgetExampleOutput = WidgetExampleOutputLabels | WidgetExampleOutputAnswerScore | WidgetExampleOutputText | WidgetExampleOutputUrl;
424
- interface WidgetExampleBase<TOutput> {
425
- example_title?: string;
426
- group?: string;
427
- /**
428
- * Potential overrides to API parameters for this specific example
429
- * (takes precedences over the model card metadata's inference.parameters)
430
- */
431
- parameters?: {
432
- aggregation_strategy?: string;
433
- top_k?: number;
434
- top_p?: number;
435
- temperature?: number;
436
- max_new_tokens?: number;
437
- do_sample?: boolean;
438
- negative_prompt?: string;
439
- guidance_scale?: number;
440
- num_inference_steps?: number;
441
- };
442
- /**
443
- * Optional output
444
- */
445
- output?: TOutput;
446
- }
447
- interface ChatMessage {
448
- role: "user" | "assistant" | "system";
449
- content: string;
450
- }
451
- interface WidgetExampleChatInput<TOutput = WidgetExampleOutput> extends WidgetExampleBase<TOutput> {
452
- messages: ChatMessage[];
453
- }
454
- interface WidgetExampleTextInput<TOutput = WidgetExampleOutput> extends WidgetExampleBase<TOutput> {
455
- text: string;
456
- }
457
- interface WidgetExampleTextAndContextInput<TOutput = WidgetExampleOutput> extends WidgetExampleTextInput<TOutput> {
458
- context: string;
459
- }
460
- interface WidgetExampleTextAndTableInput<TOutput = WidgetExampleOutput> extends WidgetExampleTextInput<TOutput> {
461
- table: TableData;
462
- }
463
- interface WidgetExampleAssetInput<TOutput = WidgetExampleOutput> extends WidgetExampleBase<TOutput> {
464
- src: string;
465
- }
466
- interface WidgetExampleAssetAndPromptInput<TOutput = WidgetExampleOutput> extends WidgetExampleAssetInput<TOutput> {
467
- prompt: string;
468
- }
469
- type WidgetExampleAssetAndTextInput<TOutput = WidgetExampleOutput> = WidgetExampleAssetInput<TOutput> & WidgetExampleTextInput<TOutput>;
470
- type WidgetExampleAssetAndZeroShotInput<TOutput = WidgetExampleOutput> = WidgetExampleAssetInput<TOutput> & WidgetExampleZeroShotTextInput<TOutput>;
471
- interface WidgetExampleStructuredDataInput<TOutput = WidgetExampleOutput> extends WidgetExampleBase<TOutput> {
472
- structured_data: TableData;
473
- }
474
- interface WidgetExampleTableDataInput<TOutput = WidgetExampleOutput> extends WidgetExampleBase<TOutput> {
475
- table: TableData;
476
- }
477
- interface WidgetExampleZeroShotTextInput<TOutput = WidgetExampleOutput> extends WidgetExampleTextInput<TOutput> {
478
- text: string;
479
- candidate_labels: string;
480
- multi_class: boolean;
481
- }
482
- interface WidgetExampleSentenceSimilarityInput<TOutput = WidgetExampleOutput> extends WidgetExampleBase<TOutput> {
483
- source_sentence: string;
484
- sentences: string[];
485
- }
486
- type WidgetExample<TOutput = WidgetExampleOutput> = WidgetExampleChatInput<TOutput> | WidgetExampleTextInput<TOutput> | WidgetExampleTextAndContextInput<TOutput> | WidgetExampleTextAndTableInput<TOutput> | WidgetExampleAssetInput<TOutput> | WidgetExampleAssetAndPromptInput<TOutput> | WidgetExampleAssetAndTextInput<TOutput> | WidgetExampleAssetAndZeroShotInput<TOutput> | WidgetExampleStructuredDataInput<TOutput> | WidgetExampleTableDataInput<TOutput> | WidgetExampleZeroShotTextInput<TOutput> | WidgetExampleSentenceSimilarityInput<TOutput>;
487
- type KeysOfUnion<T> = T extends unknown ? keyof T : never;
488
- type WidgetExampleAttribute = KeysOfUnion<WidgetExample>;
489
-
490
- declare const SPECIAL_TOKENS_ATTRIBUTES: readonly ["bos_token", "eos_token", "unk_token", "sep_token", "pad_token", "cls_token", "mask_token"];
491
- /**
492
- * Public interface for a tokenizer's special tokens mapping
493
- */
494
- interface AddedToken {
495
- __type: "AddedToken";
496
- content?: string;
497
- lstrip?: boolean;
498
- normalized?: boolean;
499
- rstrip?: boolean;
500
- single_word?: boolean;
501
- }
502
- type SpecialTokensMap = {
503
- [key in (typeof SPECIAL_TOKENS_ATTRIBUTES)[number]]?: string | AddedToken | null;
504
- };
505
- /**
506
- * Public interface for tokenizer config
507
- */
508
- interface TokenizerConfig extends SpecialTokensMap {
509
- use_default_system_prompt?: boolean;
510
- chat_template?: string | Array<{
511
- name: string;
512
- template: string;
513
- }>;
514
- }
515
-
516
- declare enum InferenceDisplayability {
517
- /**
518
- * Yes
519
- */
520
- Yes = "Yes",
521
- /**
522
- * And then, all the possible reasons why it's no:
523
- */
524
- ExplicitOptOut = "ExplicitOptOut",
525
- CustomCode = "CustomCode",
526
- LibraryNotDetected = "LibraryNotDetected",
527
- PipelineNotDetected = "PipelineNotDetected",
528
- PipelineLibraryPairNotSupported = "PipelineLibraryPairNotSupported"
529
- }
530
- /**
531
- * Public interface for model metadata
532
- */
533
- interface ModelData {
534
- /**
535
- * id of model (e.g. 'user/repo_name')
536
- */
537
- id: string;
538
- /**
539
- * Kept for backward compatibility
540
- */
541
- modelId?: string;
542
- /**
543
- * Whether or not to enable inference widget for this model
544
- */
545
- inference: InferenceDisplayability;
546
- /**
547
- * is this model private?
548
- */
549
- private?: boolean;
550
- /**
551
- * this dictionary has useful information about the model configuration
552
- */
553
- config?: {
554
- architectures?: string[];
555
- /**
556
- * Dict of AutoModel or Auto… class name to local import path in the repo
557
- */
558
- auto_map?: {
559
- /**
560
- * String Property
561
- */
562
- [x: string]: string;
563
- };
564
- model_type?: string;
565
- quantization_config?: {
566
- bits?: number;
567
- load_in_4bit?: boolean;
568
- load_in_8bit?: boolean;
569
- };
570
- tokenizer_config?: TokenizerConfig;
571
- adapter_transformers?: {
572
- model_name?: string;
573
- model_class?: string;
574
- };
575
- diffusers?: {
576
- _class_name?: string;
577
- };
578
- sklearn?: {
579
- model?: {
580
- file?: string;
581
- };
582
- model_format?: string;
583
- };
584
- speechbrain?: {
585
- speechbrain_interface?: string;
586
- vocoder_interface?: string;
587
- vocoder_model_id?: string;
588
- };
589
- peft?: {
590
- base_model_name_or_path?: string;
591
- task_type?: string;
592
- };
593
- };
594
- /**
595
- * all the model tags
596
- */
597
- tags?: string[];
598
- /**
599
- * transformers-specific info to display in the code sample.
600
- */
601
- transformersInfo?: TransformersInfo;
602
- /**
603
- * Pipeline type
604
- */
605
- pipeline_tag?: PipelineType | undefined;
606
- /**
607
- * for relevant models, get mask token
608
- */
609
- mask_token?: string | undefined;
610
- /**
611
- * Example data that will be fed into the widget.
612
- *
613
- * can be set in the model card metadata (under `widget`),
614
- * or by default in `DefaultWidget.ts`
615
- */
616
- widgetData?: WidgetExample[] | undefined;
617
- /**
618
- * Parameters that will be used by the widget when calling Inference API (serverless)
619
- * https://huggingface.co/docs/api-inference/detailed_parameters
620
- *
621
- * can be set in the model card metadata (under `inference/parameters`)
622
- * Example:
623
- * inference:
624
- * parameters:
625
- * key: val
626
- */
627
- cardData?: {
628
- inference?: boolean | {
629
- parameters?: Record<string, unknown>;
630
- };
631
- base_model?: string | string[];
632
- };
633
- /**
634
- * Library name
635
- * Example: transformers, SpeechBrain, Stanza, etc.
636
- */
637
- library_name?: string;
638
- }
639
- /**
640
- * transformers-specific info to display in the code sample.
641
- */
642
- interface TransformersInfo {
643
- /**
644
- * e.g. AutoModelForSequenceClassification
645
- */
646
- auto_model: string;
647
- /**
648
- * if set in config.json's auto_map
649
- */
650
- custom_class?: string;
651
- /**
652
- * e.g. text-classification
653
- */
654
- pipeline_tag?: PipelineType;
655
- /**
656
- * e.g. "AutoTokenizer" | "AutoFeatureExtractor" | "AutoProcessor"
657
- */
658
- processor?: string;
659
- }
660
-
661
- /**
662
- * This file contains the (simplified) types used
663
- * to represent queries that are made to Elastic
664
- * in order to count number of model downloads
665
- *
666
- * Read this doc about download stats on the Hub:
667
- *
668
- * https://huggingface.co/docs/hub/models-download-stats
669
- *
670
- * see also:
671
- * https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html
672
- */
673
- type ElasticBoolQueryFilter = {
674
- term?: {
675
- path: string;
676
- };
677
- } | {
678
- terms?: {
679
- path: string[];
680
- };
681
- } | {
682
- wildcard?: {
683
- path: string;
684
- };
685
- };
686
-
687
- /**
688
- * Elements configurable by a model library.
689
- */
690
- interface LibraryUiElement {
691
- /**
692
- * Pretty name of the library.
693
- * displayed in tags, and on the main
694
- * call-to-action button on the model page.
695
- */
696
- prettyLabel: string;
697
- /**
698
- * Repo name of the library's (usually on GitHub) code repo
699
- */
700
- repoName: string;
701
- /**
702
- * URL to library's (usually on GitHub) code repo
703
- */
704
- repoUrl: string;
705
- /**
706
- * URL to library's docs
707
- */
708
- docsUrl?: string;
709
- /**
710
- * Code snippet(s) displayed on model page
711
- */
712
- snippets?: (model: ModelData) => string[];
713
- /**
714
- * Elastic query used to count this library's model downloads
715
- *
716
- * By default, those files are counted:
717
- * "config.json", "config.yaml", "hyperparams.yaml", "meta.yaml"
718
- */
719
- countDownloads?: ElasticBoolQueryFilter;
720
- /**
721
- * should we display this library in hf.co/models filter
722
- * (only for popular libraries with > 100 models)
723
- */
724
- filter?: boolean;
725
- }
726
- /**
727
- * Add your new library here.
728
- *
729
- * This is for modeling (= architectures) libraries, not for file formats (like ONNX, etc).
730
- * (unlike libraries, file formats live in an enum inside the internal codebase.)
731
- *
732
- * Doc on how to add a library to the Hub:
733
- *
734
- * https://huggingface.co/docs/hub/models-adding-libraries
735
- *
736
- * /!\ IMPORTANT
737
- *
738
- * The key you choose is the tag your models have in their library_name on the Hub.
739
- */
740
- declare const MODEL_LIBRARIES_UI_ELEMENTS: {
741
- "adapter-transformers": {
742
- prettyLabel: string;
743
- repoName: string;
744
- repoUrl: string;
745
- docsUrl: string;
746
- snippets: (model: ModelData) => string[];
747
- filter: true;
748
- countDownloads: {
749
- term: {
750
- path: string;
751
- };
752
- };
753
- };
754
- allennlp: {
755
- prettyLabel: string;
756
- repoName: string;
757
- repoUrl: string;
758
- docsUrl: string;
759
- snippets: (model: ModelData) => string[];
760
- filter: true;
761
- };
762
- asteroid: {
763
- prettyLabel: string;
764
- repoName: string;
765
- repoUrl: string;
766
- docsUrl: string;
767
- snippets: (model: ModelData) => string[];
768
- filter: true;
769
- countDownloads: {
770
- term: {
771
- path: string;
772
- };
773
- };
774
- };
775
- audiocraft: {
776
- prettyLabel: string;
777
- repoName: string;
778
- repoUrl: string;
779
- snippets: (model: ModelData) => string[];
780
- filter: false;
781
- };
782
- bertopic: {
783
- prettyLabel: string;
784
- repoName: string;
785
- repoUrl: string;
786
- snippets: (model: ModelData) => string[];
787
- filter: true;
788
- };
789
- diffusers: {
790
- prettyLabel: string;
791
- repoName: string;
792
- repoUrl: string;
793
- docsUrl: string;
794
- snippets: (model: ModelData) => string[];
795
- filter: true;
796
- };
797
- doctr: {
798
- prettyLabel: string;
799
- repoName: string;
800
- repoUrl: string;
801
- };
802
- espnet: {
803
- prettyLabel: string;
804
- repoName: string;
805
- repoUrl: string;
806
- docsUrl: string;
807
- snippets: (model: ModelData) => string[];
808
- filter: true;
809
- };
810
- fairseq: {
811
- prettyLabel: string;
812
- repoName: string;
813
- repoUrl: string;
814
- snippets: (model: ModelData) => string[];
815
- filter: true;
816
- };
817
- fastai: {
818
- prettyLabel: string;
819
- repoName: string;
820
- repoUrl: string;
821
- docsUrl: string;
822
- snippets: (model: ModelData) => string[];
823
- filter: true;
824
- };
825
- fasttext: {
826
- prettyLabel: string;
827
- repoName: string;
828
- repoUrl: string;
829
- snippets: (model: ModelData) => string[];
830
- filter: true;
831
- };
832
- flair: {
833
- prettyLabel: string;
834
- repoName: string;
835
- repoUrl: string;
836
- docsUrl: string;
837
- snippets: (model: ModelData) => string[];
838
- filter: true;
839
- countDownloads: {
840
- term: {
841
- path: string;
842
- };
843
- };
844
- };
845
- gliner: {
846
- prettyLabel: string;
847
- repoName: string;
848
- repoUrl: string;
849
- snippets: (model: ModelData) => string[];
850
- filter: false;
851
- countDownloads: {
852
- term: {
853
- path: string;
854
- };
855
- };
856
- };
857
- grok: {
858
- prettyLabel: string;
859
- repoName: string;
860
- repoUrl: string;
861
- filter: false;
862
- countDownloads: {
863
- terms: {
864
- path: string[];
865
- };
866
- };
867
- };
868
- keras: {
869
- prettyLabel: string;
870
- repoName: string;
871
- repoUrl: string;
872
- docsUrl: string;
873
- snippets: (model: ModelData) => string[];
874
- filter: true;
875
- countDownloads: {
876
- term: {
877
- path: string;
878
- };
879
- };
880
- };
881
- "keras-nlp": {
882
- prettyLabel: string;
883
- repoName: string;
884
- repoUrl: string;
885
- docsUrl: string;
886
- snippets: (model: ModelData) => string[];
887
- };
888
- k2: {
889
- prettyLabel: string;
890
- repoName: string;
891
- repoUrl: string;
892
- };
893
- mindspore: {
894
- prettyLabel: string;
895
- repoName: string;
896
- repoUrl: string;
897
- };
898
- "ml-agents": {
899
- prettyLabel: string;
900
- repoName: string;
901
- repoUrl: string;
902
- docsUrl: string;
903
- snippets: (model: ModelData) => string[];
904
- filter: true;
905
- countDownloads: {
906
- wildcard: {
907
- path: string;
908
- };
909
- };
910
- };
911
- mlx: {
912
- prettyLabel: string;
913
- repoName: string;
914
- repoUrl: string;
915
- snippets: (model: ModelData) => string[];
916
- filter: true;
917
- };
918
- "mlx-image": {
919
- prettyLabel: string;
920
- repoName: string;
921
- repoUrl: string;
922
- docsUrl: string;
923
- snippets: (model: ModelData) => string[];
924
- filter: false;
925
- countDownloads: {
926
- term: {
927
- path: string;
928
- };
929
- };
930
- };
931
- nemo: {
932
- prettyLabel: string;
933
- repoName: string;
934
- repoUrl: string;
935
- snippets: (model: ModelData) => string[];
936
- filter: true;
937
- countDownloads: {
938
- wildcard: {
939
- path: string;
940
- };
941
- };
942
- };
943
- open_clip: {
944
- prettyLabel: string;
945
- repoName: string;
946
- repoUrl: string;
947
- snippets: (model: ModelData) => string[];
948
- filter: true;
949
- countDownloads: {
950
- wildcard: {
951
- path: string;
952
- };
953
- };
954
- };
955
- paddlenlp: {
956
- prettyLabel: string;
957
- repoName: string;
958
- repoUrl: string;
959
- docsUrl: string;
960
- snippets: (model: ModelData) => string[];
961
- filter: true;
962
- countDownloads: {
963
- term: {
964
- path: string;
965
- };
966
- };
967
- };
968
- peft: {
969
- prettyLabel: string;
970
- repoName: string;
971
- repoUrl: string;
972
- snippets: (model: ModelData) => string[];
973
- filter: true;
974
- countDownloads: {
975
- term: {
976
- path: string;
977
- };
978
- };
979
- };
980
- "pyannote-audio": {
981
- prettyLabel: string;
982
- repoName: string;
983
- repoUrl: string;
984
- snippets: (model: ModelData) => string[];
985
- filter: true;
986
- };
987
- pythae: {
988
- prettyLabel: string;
989
- repoName: string;
990
- repoUrl: string;
991
- snippets: (model: ModelData) => string[];
992
- filter: true;
993
- };
994
- "sample-factory": {
995
- prettyLabel: string;
996
- repoName: string;
997
- repoUrl: string;
998
- docsUrl: string;
999
- snippets: (model: ModelData) => string[];
1000
- filter: true;
1001
- countDownloads: {
1002
- term: {
1003
- path: string;
1004
- };
1005
- };
1006
- };
1007
- "sentence-transformers": {
1008
- prettyLabel: string;
1009
- repoName: string;
1010
- repoUrl: string;
1011
- docsUrl: string;
1012
- snippets: (model: ModelData) => string[];
1013
- filter: true;
1014
- };
1015
- setfit: {
1016
- prettyLabel: string;
1017
- repoName: string;
1018
- repoUrl: string;
1019
- docsUrl: string;
1020
- snippets: (model: ModelData) => string[];
1021
- filter: true;
1022
- };
1023
- sklearn: {
1024
- prettyLabel: string;
1025
- repoName: string;
1026
- repoUrl: string;
1027
- snippets: (model: ModelData) => string[];
1028
- filter: true;
1029
- countDownloads: {
1030
- term: {
1031
- path: string;
1032
- };
1033
- };
1034
- };
1035
- spacy: {
1036
- prettyLabel: string;
1037
- repoName: string;
1038
- repoUrl: string;
1039
- docsUrl: string;
1040
- snippets: (model: ModelData) => string[];
1041
- filter: true;
1042
- countDownloads: {
1043
- wildcard: {
1044
- path: string;
1045
- };
1046
- };
1047
- };
1048
- "span-marker": {
1049
- prettyLabel: string;
1050
- repoName: string;
1051
- repoUrl: string;
1052
- docsUrl: string;
1053
- snippets: (model: ModelData) => string[];
1054
- filter: true;
1055
- };
1056
- speechbrain: {
1057
- prettyLabel: string;
1058
- repoName: string;
1059
- repoUrl: string;
1060
- docsUrl: string;
1061
- snippets: (model: ModelData) => string[];
1062
- filter: true;
1063
- countDownloads: {
1064
- term: {
1065
- path: string;
1066
- };
1067
- };
1068
- };
1069
- "stable-baselines3": {
1070
- prettyLabel: string;
1071
- repoName: string;
1072
- repoUrl: string;
1073
- docsUrl: string;
1074
- snippets: (model: ModelData) => string[];
1075
- filter: true;
1076
- countDownloads: {
1077
- wildcard: {
1078
- path: string;
1079
- };
1080
- };
1081
- };
1082
- stanza: {
1083
- prettyLabel: string;
1084
- repoName: string;
1085
- repoUrl: string;
1086
- docsUrl: string;
1087
- snippets: (model: ModelData) => string[];
1088
- filter: true;
1089
- countDownloads: {
1090
- term: {
1091
- path: string;
1092
- };
1093
- };
1094
- };
1095
- tensorflowtts: {
1096
- prettyLabel: string;
1097
- repoName: string;
1098
- repoUrl: string;
1099
- snippets: (model: ModelData) => string[];
1100
- };
1101
- timm: {
1102
- prettyLabel: string;
1103
- repoName: string;
1104
- repoUrl: string;
1105
- docsUrl: string;
1106
- snippets: (model: ModelData) => string[];
1107
- filter: true;
1108
- countDownloads: {
1109
- terms: {
1110
- path: string[];
1111
- };
1112
- };
1113
- };
1114
- transformers: {
1115
- prettyLabel: string;
1116
- repoName: string;
1117
- repoUrl: string;
1118
- docsUrl: string;
1119
- snippets: (model: ModelData) => string[];
1120
- filter: true;
1121
- };
1122
- "transformers.js": {
1123
- prettyLabel: string;
1124
- repoName: string;
1125
- repoUrl: string;
1126
- docsUrl: string;
1127
- snippets: (model: ModelData) => string[];
1128
- filter: true;
1129
- };
1130
- "unity-sentis": {
1131
- prettyLabel: string;
1132
- repoName: string;
1133
- repoUrl: string;
1134
- snippets: () => string[];
1135
- filter: true;
1136
- countDownloads: {
1137
- wildcard: {
1138
- path: string;
1139
- };
1140
- };
1141
- };
1142
- voicecraft: {
1143
- prettyLabel: string;
1144
- repoName: string;
1145
- repoUrl: string;
1146
- docsUrl: string;
1147
- snippets: (model: ModelData) => string[];
1148
- };
1149
- whisperkit: {
1150
- prettyLabel: string;
1151
- repoName: string;
1152
- repoUrl: string;
1153
- countDownloads: {
1154
- wildcard: {
1155
- path: string;
1156
- };
1157
- };
1158
- };
1159
- };
1160
- type ModelLibraryKey = keyof typeof MODEL_LIBRARIES_UI_ELEMENTS;
1161
- declare const ALL_MODEL_LIBRARY_KEYS: ("sklearn" | "adapter-transformers" | "allennlp" | "asteroid" | "audiocraft" | "bertopic" | "diffusers" | "doctr" | "espnet" | "fairseq" | "fastai" | "fasttext" | "flair" | "gliner" | "grok" | "keras" | "keras-nlp" | "k2" | "mindspore" | "ml-agents" | "mlx" | "mlx-image" | "nemo" | "open_clip" | "paddlenlp" | "peft" | "pyannote-audio" | "pythae" | "sample-factory" | "sentence-transformers" | "setfit" | "spacy" | "span-marker" | "speechbrain" | "stable-baselines3" | "stanza" | "tensorflowtts" | "timm" | "transformers" | "transformers.js" | "unity-sentis" | "voicecraft" | "whisperkit")[];
1162
- declare const ALL_DISPLAY_MODEL_LIBRARY_KEYS: ("sklearn" | "adapter-transformers" | "allennlp" | "asteroid" | "audiocraft" | "bertopic" | "diffusers" | "doctr" | "espnet" | "fairseq" | "fastai" | "fasttext" | "flair" | "gliner" | "grok" | "keras" | "keras-nlp" | "k2" | "mindspore" | "ml-agents" | "mlx" | "mlx-image" | "nemo" | "open_clip" | "paddlenlp" | "peft" | "pyannote-audio" | "pythae" | "sample-factory" | "sentence-transformers" | "setfit" | "spacy" | "span-marker" | "speechbrain" | "stable-baselines3" | "stanza" | "tensorflowtts" | "timm" | "transformers" | "transformers.js" | "unity-sentis" | "voicecraft" | "whisperkit")[];
1163
-
1164
- /**
1165
- * Mapping from library name to its supported tasks.
1166
- * Inference API (serverless) should be disabled for all other (library, task) pairs beyond this mapping.
1167
- * This mapping is partially generated automatically by "python-api-export-tasks" action in
1168
- * huggingface/api-inference-community repo upon merge. For transformers, the mapping is manually
1169
- * based on api-inference (hf_types.rs).
1170
- */
1171
- declare const LIBRARY_TASK_MAPPING: Partial<Record<ModelLibraryKey, PipelineType[]>>;
1172
-
1173
- type PerLanguageMapping = Map<WidgetType, string[] | WidgetExample[]>;
1174
- declare const MAPPING_DEFAULT_WIDGET: Map<string, PerLanguageMapping>;
1175
-
1176
- /**
1177
- * Inference code generated from the JSON schema spec in ./spec
1178
- *
1179
- * Using src/scripts/inference-codegen
1180
- */
1181
- /**
1182
- * Inputs for Audio Classification inference
1183
- */
1184
- interface AudioClassificationInput {
1185
- /**
1186
- * The input audio data
1187
- */
1188
- inputs: unknown;
1189
- /**
1190
- * Additional inference parameters
1191
- */
1192
- parameters?: AudioClassificationParameters;
1193
- [property: string]: unknown;
1194
- }
1195
- /**
1196
- * Additional inference parameters
1197
- *
1198
- * Additional inference parameters for Audio Classification
1199
- */
1200
- interface AudioClassificationParameters {
1201
- function_to_apply?: ClassificationOutputTransform$3;
1202
- /**
1203
- * When specified, limits the output to the top K most probable classes.
1204
- */
1205
- top_k?: number;
1206
- [property: string]: unknown;
1207
- }
1208
- /**
1209
- * The function to apply to the model outputs in order to retrieve the scores.
1210
- */
1211
- type ClassificationOutputTransform$3 = "sigmoid" | "softmax" | "none";
1212
- type AudioClassificationOutput = AudioClassificationOutputElement[];
1213
- /**
1214
- * Outputs for Audio Classification inference
1215
- */
1216
- interface AudioClassificationOutputElement {
1217
- /**
1218
- * The predicted class label.
1219
- */
1220
- label: string;
1221
- /**
1222
- * The corresponding probability.
1223
- */
1224
- score: number;
1225
- [property: string]: unknown;
1226
- }
1227
-
1228
- /**
1229
- * Inference code generated from the JSON schema spec in ./spec
1230
- *
1231
- * Using src/scripts/inference-codegen
1232
- */
1233
- /**
1234
- * Inputs for Automatic Speech Recognition inference
1235
- */
1236
- interface AutomaticSpeechRecognitionInput {
1237
- /**
1238
- * The input audio data
1239
- */
1240
- inputs: unknown;
1241
- /**
1242
- * Additional inference parameters
1243
- */
1244
- parameters?: AutomaticSpeechRecognitionParameters;
1245
- [property: string]: unknown;
1246
- }
1247
- /**
1248
- * Additional inference parameters
1249
- *
1250
- * Additional inference parameters for Automatic Speech Recognition
1251
- */
1252
- interface AutomaticSpeechRecognitionParameters {
1253
- /**
1254
- * Parametrization of the text generation process
1255
- */
1256
- generate?: GenerationParameters$2;
1257
- /**
1258
- * Whether to output corresponding timestamps with the generated text
1259
- */
1260
- return_timestamps?: boolean;
1261
- [property: string]: unknown;
1262
- }
1263
- /**
1264
- * Parametrization of the text generation process
1265
- *
1266
- * Ad-hoc parametrization of the text generation process
1267
- */
1268
- interface GenerationParameters$2 {
1269
- /**
1270
- * Whether to use sampling instead of greedy decoding when generating new tokens.
1271
- */
1272
- do_sample?: boolean;
1273
- /**
1274
- * Controls the stopping condition for beam-based methods.
1275
- */
1276
- early_stopping?: EarlyStoppingUnion$2;
1277
- /**
1278
- * If set to float strictly between 0 and 1, only tokens with a conditional probability
1279
- * greater than epsilon_cutoff will be sampled. In the paper, suggested values range from
1280
- * 3e-4 to 9e-4, depending on the size of the model. See [Truncation Sampling as Language
1281
- * Model Desmoothing](https://hf.co/papers/2210.15191) for more details.
1282
- */
1283
- epsilon_cutoff?: number;
1284
- /**
1285
- * Eta sampling is a hybrid of locally typical sampling and epsilon sampling. If set to
1286
- * float strictly between 0 and 1, a token is only considered if it is greater than either
1287
- * eta_cutoff or sqrt(eta_cutoff) * exp(-entropy(softmax(next_token_logits))). The latter
1288
- * term is intuitively the expected next token probability, scaled by sqrt(eta_cutoff). In
1289
- * the paper, suggested values range from 3e-4 to 2e-3, depending on the size of the model.
1290
- * See [Truncation Sampling as Language Model Desmoothing](https://hf.co/papers/2210.15191)
1291
- * for more details.
1292
- */
1293
- eta_cutoff?: number;
1294
- /**
1295
- * The maximum length (in tokens) of the generated text, including the input.
1296
- */
1297
- max_length?: number;
1298
- /**
1299
- * The maximum number of tokens to generate. Takes precedence over maxLength.
1300
- */
1301
- max_new_tokens?: number;
1302
- /**
1303
- * The minimum length (in tokens) of the generated text, including the input.
1304
- */
1305
- min_length?: number;
1306
- /**
1307
- * The minimum number of tokens to generate. Takes precedence over maxLength.
1308
- */
1309
- min_new_tokens?: number;
1310
- /**
1311
- * Number of groups to divide num_beams into in order to ensure diversity among different
1312
- * groups of beams. See [this paper](https://hf.co/papers/1610.02424) for more details.
1313
- */
1314
- num_beam_groups?: number;
1315
- /**
1316
- * Number of beams to use for beam search.
1317
- */
1318
- num_beams?: number;
1319
- /**
1320
- * The value balances the model confidence and the degeneration penalty in contrastive
1321
- * search decoding.
1322
- */
1323
- penalty_alpha?: number;
1324
- /**
1325
- * The value used to modulate the next token probabilities.
1326
- */
1327
- temperature?: number;
1328
- /**
1329
- * The number of highest probability vocabulary tokens to keep for top-k-filtering.
1330
- */
1331
- top_k?: number;
1332
- /**
1333
- * If set to float < 1, only the smallest set of most probable tokens with probabilities
1334
- * that add up to top_p or higher are kept for generation.
1335
- */
1336
- top_p?: number;
1337
- /**
1338
- * Local typicality measures how similar the conditional probability of predicting a target
1339
- * token next is to the expected conditional probability of predicting a random token next,
1340
- * given the partial text already generated. If set to float < 1, the smallest set of the
1341
- * most locally typical tokens with probabilities that add up to typical_p or higher are
1342
- * kept for generation. See [this paper](https://hf.co/papers/2202.00666) for more details.
1343
- */
1344
- typical_p?: number;
1345
- /**
1346
- * Whether the model should use the past last key/values attentions to speed up decoding
1347
- */
1348
- use_cache?: boolean;
1349
- [property: string]: unknown;
1350
- }
1351
- /**
1352
- * Controls the stopping condition for beam-based methods.
1353
- */
1354
- type EarlyStoppingUnion$2 = boolean | "never";
1355
- /**
1356
- * Outputs of inference for the Automatic Speech Recognition task
1357
- */
1358
- interface AutomaticSpeechRecognitionOutput {
1359
- /**
1360
- * When returnTimestamps is enabled, chunks contains a list of audio chunks identified by
1361
- * the model.
1362
- */
1363
- chunks?: AutomaticSpeechRecognitionOutputChunk[];
1364
- /**
1365
- * The recognized text.
1366
- */
1367
- text: string;
1368
- [property: string]: unknown;
1369
- }
1370
- interface AutomaticSpeechRecognitionOutputChunk {
1371
- /**
1372
- * A chunk of text identified by the model
1373
- */
1374
- text: string;
1375
- /**
1376
- * The start and end timestamps corresponding with the text
1377
- */
1378
- timestamps: number[];
1379
- [property: string]: unknown;
1380
- }
1381
-
1382
- /**
1383
- * Inference code generated from the JSON schema spec in ./spec
1384
- *
1385
- * Using src/scripts/inference-codegen
1386
- */
1387
- /**
1388
- * Inputs for ChatCompletion inference
1389
- */
1390
- interface ChatCompletionInput {
1391
- /**
1392
- * Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing
1393
- * frequency in the text so far, decreasing the model's likelihood to repeat the same line
1394
- * verbatim.
1395
- */
1396
- frequency_penalty?: number;
1397
- /**
1398
- * The maximum number of tokens that can be generated in the chat completion.
1399
- */
1400
- max_tokens?: number;
1401
- messages: ChatCompletionInputMessage[];
1402
- /**
1403
- * The random sampling seed.
1404
- */
1405
- seed?: number;
1406
- /**
1407
- * Stop generating tokens if a stop token is generated.
1408
- */
1409
- stop?: ChatCompletionInputStopReason;
1410
- /**
1411
- * If set, partial message deltas will be sent.
1412
- */
1413
- stream?: boolean;
1414
- /**
1415
- * The value used to modulate the logits distribution.
1416
- */
1417
- temperature?: number;
1418
- /**
1419
- * If set to < 1, only the smallest set of most probable tokens with probabilities that add
1420
- * up to `top_p` or higher are kept for generation.
1421
- */
1422
- top_p?: number;
1423
- [property: string]: unknown;
1424
- }
1425
- interface ChatCompletionInputMessage {
1426
- /**
1427
- * The content of the message.
1428
- */
1429
- content: string;
1430
- role: ChatCompletionMessageRole;
1431
- [property: string]: unknown;
1432
- }
1433
- /**
1434
- * The role of the message author.
1435
- */
1436
- type ChatCompletionMessageRole = "assistant" | "system" | "user";
1437
- /**
1438
- * Stop generating tokens if a stop token is generated.
1439
- */
1440
- type ChatCompletionInputStopReason = string[] | string;
1441
- /**
1442
- * Outputs for Chat Completion inference
1443
- */
1444
- interface ChatCompletionOutput {
1445
- /**
1446
- * A list of chat completion choices.
1447
- */
1448
- choices: ChatCompletionOutputChoice[];
1449
- /**
1450
- * The Unix timestamp (in seconds) of when the chat completion was created.
1451
- */
1452
- created: number;
1453
- [property: string]: unknown;
1454
- }
1455
- interface ChatCompletionOutputChoice {
1456
- /**
1457
- * The reason why the generation was stopped.
1458
- */
1459
- finish_reason: ChatCompletionFinishReason;
1460
- /**
1461
- * The index of the choice in the list of choices.
1462
- */
1463
- index: number;
1464
- message: ChatCompletionOutputChoiceMessage;
1465
- [property: string]: unknown;
1466
- }
1467
- /**
1468
- * The reason why the generation was stopped.
1469
- *
1470
- * The generated sequence reached the maximum allowed length
1471
- *
1472
- * The model generated an end-of-sentence (EOS) token
1473
- *
1474
- * One of the sequence in stop_sequences was generated
1475
- */
1476
- type ChatCompletionFinishReason = "length" | "eos_token" | "stop_sequence";
1477
- interface ChatCompletionOutputChoiceMessage {
1478
- /**
1479
- * The content of the chat completion message.
1480
- */
1481
- content: string;
1482
- role: ChatCompletionMessageRole;
1483
- [property: string]: unknown;
1484
- }
1485
- /**
1486
- * Chat Completion Stream Output
1487
- */
1488
- interface ChatCompletionStreamOutput {
1489
- /**
1490
- * A list of chat completion choices.
1491
- */
1492
- choices: ChatCompletionStreamOutputChoice[];
1493
- /**
1494
- * The Unix timestamp (in seconds) of when the chat completion was created. Each chunk has
1495
- * the same timestamp.
1496
- */
1497
- created: number;
1498
- [property: string]: unknown;
1499
- }
1500
- interface ChatCompletionStreamOutputChoice {
1501
- /**
1502
- * A chat completion delta generated by streamed model responses.
1503
- */
1504
- delta: ChatCompletionStreamOutputDelta;
1505
- /**
1506
- * The reason why the generation was stopped.
1507
- */
1508
- finish_reason?: ChatCompletionFinishReason;
1509
- /**
1510
- * The index of the choice in the list of choices.
1511
- */
1512
- index: number;
1513
- [property: string]: unknown;
1514
- }
1515
- /**
1516
- * A chat completion delta generated by streamed model responses.
1517
- */
1518
- interface ChatCompletionStreamOutputDelta {
1519
- /**
1520
- * The contents of the chunk message.
1521
- */
1522
- content?: string;
1523
- /**
1524
- * The role of the author of this message.
1525
- */
1526
- role?: string;
1527
- [property: string]: unknown;
1528
- }
1529
-
1530
- /**
1531
- * Inference code generated from the JSON schema spec in ./spec
1532
- *
1533
- * Using src/scripts/inference-codegen
1534
- */
1535
- /**
1536
- * Inputs for Document Question Answering inference
1537
- */
1538
- interface DocumentQuestionAnsweringInput {
1539
- /**
1540
- * One (document, question) pair to answer
1541
- */
1542
- inputs: DocumentQuestionAnsweringInputData;
1543
- /**
1544
- * Additional inference parameters
1545
- */
1546
- parameters?: DocumentQuestionAnsweringParameters;
1547
- [property: string]: unknown;
1548
- }
1549
- /**
1550
- * One (document, question) pair to answer
1551
- */
1552
- interface DocumentQuestionAnsweringInputData {
1553
- /**
1554
- * The image on which the question is asked
1555
- */
1556
- image: unknown;
1557
- /**
1558
- * A question to ask of the document
1559
- */
1560
- question: string;
1561
- [property: string]: unknown;
1562
- }
1563
- /**
1564
- * Additional inference parameters
1565
- *
1566
- * Additional inference parameters for Document Question Answering
1567
- */
1568
- interface DocumentQuestionAnsweringParameters {
1569
- /**
1570
- * If the words in the document are too long to fit with the question for the model, it will
1571
- * be split in several chunks with some overlap. This argument controls the size of that
1572
- * overlap.
1573
- */
1574
- doc_stride?: number;
1575
- /**
1576
- * Whether to accept impossible as an answer
1577
- */
1578
- handle_impossible_answer?: boolean;
1579
- /**
1580
- * Language to use while running OCR. Defaults to english.
1581
- */
1582
- lang?: string;
1583
- /**
1584
- * The maximum length of predicted answers (e.g., only answers with a shorter length are
1585
- * considered).
1586
- */
1587
- max_answer_len?: number;
1588
- /**
1589
- * The maximum length of the question after tokenization. It will be truncated if needed.
1590
- */
1591
- max_question_len?: number;
1592
- /**
1593
- * The maximum length of the total sentence (context + question) in tokens of each chunk
1594
- * passed to the model. The context will be split in several chunks (using doc_stride as
1595
- * overlap) if needed.
1596
- */
1597
- max_seq_len?: number;
1598
- /**
1599
- * The number of answers to return (will be chosen by order of likelihood). Can return less
1600
- * than top_k answers if there are not enough options available within the context.
1601
- */
1602
- top_k?: number;
1603
- /**
1604
- * A list of words and bounding boxes (normalized 0->1000). If provided, the inference will
1605
- * skip the OCR step and use the provided bounding boxes instead.
1606
- */
1607
- word_boxes?: WordBox[];
1608
- [property: string]: unknown;
1609
- }
1610
- type WordBox = number[] | string;
1611
- type DocumentQuestionAnsweringOutput = DocumentQuestionAnsweringOutputElement[];
1612
- /**
1613
- * Outputs of inference for the Document Question Answering task
1614
- */
1615
- interface DocumentQuestionAnsweringOutputElement {
1616
- /**
1617
- * The answer to the question.
1618
- */
1619
- answer: string;
1620
- /**
1621
- * The end word index of the answer (in the OCR’d version of the input or provided word
1622
- * boxes).
1623
- */
1624
- end: number;
1625
- /**
1626
- * The probability associated to the answer.
1627
- */
1628
- score: number;
1629
- /**
1630
- * The start word index of the answer (in the OCR’d version of the input or provided word
1631
- * boxes).
1632
- */
1633
- start: number;
1634
- /**
1635
- * The index of each word/box pair that is in the answer
1636
- */
1637
- words: number[];
1638
- [property: string]: unknown;
1639
- }
1640
-
1641
- /**
1642
- * Inference code generated from the JSON schema spec in ./spec
1643
- *
1644
- * Using src/scripts/inference-codegen
1645
- */
1646
- type FeatureExtractionOutput = unknown[];
1647
- /**
1648
- * Inputs for Text Embedding inference
1649
- */
1650
- interface FeatureExtractionInput {
1651
- /**
1652
- * The text to get the embeddings of
1653
- */
1654
- inputs: string;
1655
- /**
1656
- * Additional inference parameters
1657
- */
1658
- parameters?: {
1659
- [key: string]: unknown;
1660
- };
1661
- [property: string]: unknown;
1662
- }
1663
-
1664
- /**
1665
- * Inference code generated from the JSON schema spec in ./spec
1666
- *
1667
- * Using src/scripts/inference-codegen
1668
- */
1669
- /**
1670
- * Inputs for Fill Mask inference
1671
- */
1672
- interface FillMaskInput {
1673
- /**
1674
- * The text with masked tokens
1675
- */
1676
- inputs: string;
1677
- /**
1678
- * Additional inference parameters
1679
- */
1680
- parameters?: FillMaskParameters;
1681
- [property: string]: unknown;
1682
- }
1683
- /**
1684
- * Additional inference parameters
1685
- *
1686
- * Additional inference parameters for Fill Mask
1687
- */
1688
- interface FillMaskParameters {
1689
- /**
1690
- * When passed, the model will limit the scores to the passed targets instead of looking up
1691
- * in the whole vocabulary. If the provided targets are not in the model vocab, they will be
1692
- * tokenized and the first resulting token will be used (with a warning, and that might be
1693
- * slower).
1694
- */
1695
- targets?: string[];
1696
- /**
1697
- * When passed, overrides the number of predictions to return.
1698
- */
1699
- top_k?: number;
1700
- [property: string]: unknown;
1701
- }
1702
- type FillMaskOutput = FillMaskOutputElement[];
1703
- /**
1704
- * Outputs of inference for the Fill Mask task
1705
- */
1706
- interface FillMaskOutputElement {
1707
- /**
1708
- * The corresponding probability
1709
- */
1710
- score: number;
1711
- /**
1712
- * The corresponding input with the mask token prediction.
1713
- */
1714
- sequence: string;
1715
- /**
1716
- * The predicted token id (to replace the masked one).
1717
- */
1718
- token: number;
1719
- tokenStr: unknown;
1720
- /**
1721
- * The predicted token (to replace the masked one).
1722
- */
1723
- token_str?: string;
1724
- [property: string]: unknown;
1725
- }
1726
-
1727
- /**
1728
- * Inference code generated from the JSON schema spec in ./spec
1729
- *
1730
- * Using src/scripts/inference-codegen
1731
- */
1732
- /**
1733
- * Inputs for Image Classification inference
1734
- */
1735
- interface ImageClassificationInput {
1736
- /**
1737
- * The input image data
1738
- */
1739
- inputs: unknown;
1740
- /**
1741
- * Additional inference parameters
1742
- */
1743
- parameters?: ImageClassificationParameters;
1744
- [property: string]: unknown;
1745
- }
1746
- /**
1747
- * Additional inference parameters
1748
- *
1749
- * Additional inference parameters for Image Classification
1750
- */
1751
- interface ImageClassificationParameters {
1752
- function_to_apply?: ClassificationOutputTransform$2;
1753
- /**
1754
- * When specified, limits the output to the top K most probable classes.
1755
- */
1756
- top_k?: number;
1757
- [property: string]: unknown;
1758
- }
1759
- /**
1760
- * The function to apply to the model outputs in order to retrieve the scores.
1761
- */
1762
- type ClassificationOutputTransform$2 = "sigmoid" | "softmax" | "none";
1763
- type ImageClassificationOutput = ImageClassificationOutputElement[];
1764
- /**
1765
- * Outputs of inference for the Image Classification task
1766
- */
1767
- interface ImageClassificationOutputElement {
1768
- /**
1769
- * The predicted class label.
1770
- */
1771
- label: string;
1772
- /**
1773
- * The corresponding probability.
1774
- */
1775
- score: number;
1776
- [property: string]: unknown;
1777
- }
1778
-
1779
- /**
1780
- * Inference code generated from the JSON schema spec in ./spec
1781
- *
1782
- * Using src/scripts/inference-codegen
1783
- */
1784
- /**
1785
- * Inputs for Image To Image inference
1786
- */
1787
- interface ImageToImageInput {
1788
- /**
1789
- * The input image data
1790
- */
1791
- inputs: unknown;
1792
- /**
1793
- * Additional inference parameters
1794
- */
1795
- parameters?: ImageToImageParameters;
1796
- [property: string]: unknown;
1797
- }
1798
- /**
1799
- * Additional inference parameters
1800
- *
1801
- * Additional inference parameters for Image To Image
1802
- */
1803
- interface ImageToImageParameters {
1804
- /**
1805
- * For diffusion models. A higher guidance scale value encourages the model to generate
1806
- * images closely linked to the text prompt at the expense of lower image quality.
1807
- */
1808
- guidance_scale?: number;
1809
- /**
1810
- * One or several prompt to guide what NOT to include in image generation.
1811
- */
1812
- negative_prompt?: string[];
1813
- /**
1814
- * For diffusion models. The number of denoising steps. More denoising steps usually lead to
1815
- * a higher quality image at the expense of slower inference.
1816
- */
1817
- num_inference_steps?: number;
1818
- /**
1819
- * The size in pixel of the output image
1820
- */
1821
- target_size?: TargetSize$1;
1822
- [property: string]: unknown;
1823
- }
1824
- /**
1825
- * The size in pixel of the output image
1826
- */
1827
- interface TargetSize$1 {
1828
- height: number;
1829
- width: number;
1830
- [property: string]: unknown;
1831
- }
1832
- /**
1833
- * Outputs of inference for the Image To Image task
1834
- */
1835
- interface ImageToImageOutput {
1836
- /**
1837
- * The output image
1838
- */
1839
- image?: unknown;
1840
- [property: string]: unknown;
1841
- }
1842
-
1843
- /**
1844
- * Inference code generated from the JSON schema spec in ./spec
1845
- *
1846
- * Using src/scripts/inference-codegen
1847
- */
1848
- /**
1849
- * Inputs for Image To Text inference
1850
- */
1851
- interface ImageToTextInput {
1852
- /**
1853
- * The input image data
1854
- */
1855
- inputs: unknown;
1856
- /**
1857
- * Additional inference parameters
1858
- */
1859
- parameters?: ImageToTextParameters;
1860
- [property: string]: unknown;
1861
- }
1862
- /**
1863
- * Additional inference parameters
1864
- *
1865
- * Additional inference parameters for Image To Text
1866
- */
1867
- interface ImageToTextParameters {
1868
- /**
1869
- * Parametrization of the text generation process
1870
- */
1871
- generate?: GenerationParameters$1;
1872
- /**
1873
- * The amount of maximum tokens to generate.
1874
- */
1875
- max_new_tokens?: number;
1876
- [property: string]: unknown;
1877
- }
1878
- /**
1879
- * Parametrization of the text generation process
1880
- *
1881
- * Ad-hoc parametrization of the text generation process
1882
- */
1883
- interface GenerationParameters$1 {
1884
- /**
1885
- * Whether to use sampling instead of greedy decoding when generating new tokens.
1886
- */
1887
- do_sample?: boolean;
1888
- /**
1889
- * Controls the stopping condition for beam-based methods.
1890
- */
1891
- early_stopping?: EarlyStoppingUnion$1;
1892
- /**
1893
- * If set to float strictly between 0 and 1, only tokens with a conditional probability
1894
- * greater than epsilon_cutoff will be sampled. In the paper, suggested values range from
1895
- * 3e-4 to 9e-4, depending on the size of the model. See [Truncation Sampling as Language
1896
- * Model Desmoothing](https://hf.co/papers/2210.15191) for more details.
1897
- */
1898
- epsilon_cutoff?: number;
1899
- /**
1900
- * Eta sampling is a hybrid of locally typical sampling and epsilon sampling. If set to
1901
- * float strictly between 0 and 1, a token is only considered if it is greater than either
1902
- * eta_cutoff or sqrt(eta_cutoff) * exp(-entropy(softmax(next_token_logits))). The latter
1903
- * term is intuitively the expected next token probability, scaled by sqrt(eta_cutoff). In
1904
- * the paper, suggested values range from 3e-4 to 2e-3, depending on the size of the model.
1905
- * See [Truncation Sampling as Language Model Desmoothing](https://hf.co/papers/2210.15191)
1906
- * for more details.
1907
- */
1908
- eta_cutoff?: number;
1909
- /**
1910
- * The maximum length (in tokens) of the generated text, including the input.
1911
- */
1912
- max_length?: number;
1913
- /**
1914
- * The maximum number of tokens to generate. Takes precedence over maxLength.
1915
- */
1916
- max_new_tokens?: number;
1917
- /**
1918
- * The minimum length (in tokens) of the generated text, including the input.
1919
- */
1920
- min_length?: number;
1921
- /**
1922
- * The minimum number of tokens to generate. Takes precedence over maxLength.
1923
- */
1924
- min_new_tokens?: number;
1925
- /**
1926
- * Number of groups to divide num_beams into in order to ensure diversity among different
1927
- * groups of beams. See [this paper](https://hf.co/papers/1610.02424) for more details.
1928
- */
1929
- num_beam_groups?: number;
1930
- /**
1931
- * Number of beams to use for beam search.
1932
- */
1933
- num_beams?: number;
1934
- /**
1935
- * The value balances the model confidence and the degeneration penalty in contrastive
1936
- * search decoding.
1937
- */
1938
- penalty_alpha?: number;
1939
- /**
1940
- * The value used to modulate the next token probabilities.
1941
- */
1942
- temperature?: number;
1943
- /**
1944
- * The number of highest probability vocabulary tokens to keep for top-k-filtering.
1945
- */
1946
- top_k?: number;
1947
- /**
1948
- * If set to float < 1, only the smallest set of most probable tokens with probabilities
1949
- * that add up to top_p or higher are kept for generation.
1950
- */
1951
- top_p?: number;
1952
- /**
1953
- * Local typicality measures how similar the conditional probability of predicting a target
1954
- * token next is to the expected conditional probability of predicting a random token next,
1955
- * given the partial text already generated. If set to float < 1, the smallest set of the
1956
- * most locally typical tokens with probabilities that add up to typical_p or higher are
1957
- * kept for generation. See [this paper](https://hf.co/papers/2202.00666) for more details.
1958
- */
1959
- typical_p?: number;
1960
- /**
1961
- * Whether the model should use the past last key/values attentions to speed up decoding
1962
- */
1963
- use_cache?: boolean;
1964
- [property: string]: unknown;
1965
- }
1966
- /**
1967
- * Controls the stopping condition for beam-based methods.
1968
- */
1969
- type EarlyStoppingUnion$1 = boolean | "never";
1970
- /**
1971
- * Outputs of inference for the Image To Text task
1972
- */
1973
- interface ImageToTextOutput {
1974
- generatedText: unknown;
1975
- /**
1976
- * The generated text.
1977
- */
1978
- generated_text?: string;
1979
- [property: string]: unknown;
1980
- }
1981
-
1982
- /**
1983
- * Inference code generated from the JSON schema spec in ./spec
1984
- *
1985
- * Using src/scripts/inference-codegen
1986
- */
1987
- /**
1988
- * Inputs for Image Segmentation inference
1989
- */
1990
- interface ImageSegmentationInput {
1991
- /**
1992
- * The input image data
1993
- */
1994
- inputs: unknown;
1995
- /**
1996
- * Additional inference parameters
1997
- */
1998
- parameters?: ImageSegmentationParameters;
1999
- [property: string]: unknown;
2000
- }
2001
- /**
2002
- * Additional inference parameters
2003
- *
2004
- * Additional inference parameters for Image Segmentation
2005
- */
2006
- interface ImageSegmentationParameters {
2007
- /**
2008
- * Threshold to use when turning the predicted masks into binary values.
2009
- */
2010
- mask_threshold?: number;
2011
- /**
2012
- * Mask overlap threshold to eliminate small, disconnected segments.
2013
- */
2014
- overlap_mask_area_threshold?: number;
2015
- /**
2016
- * Segmentation task to be performed, depending on model capabilities.
2017
- */
2018
- subtask?: ImageSegmentationSubtask;
2019
- /**
2020
- * Probability threshold to filter out predicted masks.
2021
- */
2022
- threshold?: number;
2023
- [property: string]: unknown;
2024
- }
2025
- type ImageSegmentationSubtask = "instance" | "panoptic" | "semantic";
2026
- type ImageSegmentationOutput = ImageSegmentationOutputElement[];
2027
- /**
2028
- * Outputs of inference for the Image Segmentation task
2029
- *
2030
- * A predicted mask / segment
2031
- */
2032
- interface ImageSegmentationOutputElement {
2033
- /**
2034
- * The label of the predicted segment
2035
- */
2036
- label: string;
2037
- /**
2038
- * The corresponding mask as a black-and-white image
2039
- */
2040
- mask: unknown;
2041
- /**
2042
- * The score or confidence degreee the model has
2043
- */
2044
- score?: number;
2045
- [property: string]: unknown;
2046
- }
2047
-
2048
- /**
2049
- * Inference code generated from the JSON schema spec in ./spec
2050
- *
2051
- * Using src/scripts/inference-codegen
2052
- */
2053
- /**
2054
- * Inputs for Object Detection inference
2055
- */
2056
- interface ObjectDetectionInput {
2057
- /**
2058
- * The input image data
2059
- */
2060
- inputs: unknown;
2061
- /**
2062
- * Additional inference parameters
2063
- */
2064
- parameters?: ObjectDetectionParameters;
2065
- [property: string]: unknown;
2066
- }
2067
- /**
2068
- * Additional inference parameters
2069
- *
2070
- * Additional inference parameters for Object Detection
2071
- */
2072
- interface ObjectDetectionParameters {
2073
- /**
2074
- * The probability necessary to make a prediction.
2075
- */
2076
- threshold?: number;
2077
- [property: string]: unknown;
2078
- }
2079
- /**
2080
- * The predicted bounding box. Coordinates are relative to the top left corner of the input
2081
- * image.
2082
- */
2083
- interface BoundingBox$1 {
2084
- xmax: number;
2085
- xmin: number;
2086
- ymax: number;
2087
- ymin: number;
2088
- [property: string]: unknown;
2089
- }
2090
- type ObjectDetectionOutput = ObjectDetectionOutputElement[];
2091
- /**
2092
- * Outputs of inference for the Object Detection task
2093
- */
2094
- interface ObjectDetectionOutputElement {
2095
- /**
2096
- * The predicted bounding box. Coordinates are relative to the top left corner of the input
2097
- * image.
2098
- */
2099
- box: BoundingBox$1;
2100
- /**
2101
- * The predicted label for the bounding box
2102
- */
2103
- label: string;
2104
- /**
2105
- * The associated score / probability
2106
- */
2107
- score: number;
2108
- [property: string]: unknown;
2109
- }
2110
-
2111
- /**
2112
- * Inference code generated from the JSON schema spec in ./spec
2113
- *
2114
- * Using src/scripts/inference-codegen
2115
- */
2116
- /**
2117
- * Inputs for Depth Estimation inference
2118
- */
2119
- interface DepthEstimationInput {
2120
- /**
2121
- * The input image data
2122
- */
2123
- inputs: unknown;
2124
- /**
2125
- * Additional inference parameters
2126
- */
2127
- parameters?: {
2128
- [key: string]: unknown;
2129
- };
2130
- [property: string]: unknown;
2131
- }
2132
- /**
2133
- * Outputs of inference for the Depth Estimation task
2134
- */
2135
- interface DepthEstimationOutput {
2136
- /**
2137
- * The predicted depth as an image
2138
- */
2139
- depth?: unknown;
2140
- /**
2141
- * The predicted depth as a tensor
2142
- */
2143
- predicted_depth?: unknown;
2144
- [property: string]: unknown;
2145
- }
2146
-
2147
- /**
2148
- * Inference code generated from the JSON schema spec in ./spec
2149
- *
2150
- * Using src/scripts/inference-codegen
2151
- */
2152
- /**
2153
- * Inputs for Question Answering inference
2154
- */
2155
- interface QuestionAnsweringInput {
2156
- /**
2157
- * One (context, question) pair to answer
2158
- */
2159
- inputs: QuestionAnsweringInputData;
2160
- /**
2161
- * Additional inference parameters
2162
- */
2163
- parameters?: QuestionAnsweringParameters;
2164
- [property: string]: unknown;
2165
- }
2166
- /**
2167
- * One (context, question) pair to answer
2168
- */
2169
- interface QuestionAnsweringInputData {
2170
- /**
2171
- * The context to be used for answering the question
2172
- */
2173
- context: string;
2174
- /**
2175
- * The question to be answered
2176
- */
2177
- question: string;
2178
- [property: string]: unknown;
2179
- }
2180
- /**
2181
- * Additional inference parameters
2182
- *
2183
- * Additional inference parameters for Question Answering
2184
- */
2185
- interface QuestionAnsweringParameters {
2186
- /**
2187
- * Attempts to align the answer to real words. Improves quality on space separated
2188
- * languages. Might hurt on non-space-separated languages (like Japanese or Chinese)
2189
- */
2190
- align_to_words?: boolean;
2191
- /**
2192
- * If the context is too long to fit with the question for the model, it will be split in
2193
- * several chunks with some overlap. This argument controls the size of that overlap.
2194
- */
2195
- doc_stride?: number;
2196
- /**
2197
- * Whether to accept impossible as an answer.
2198
- */
2199
- handle_impossible_answer?: boolean;
2200
- /**
2201
- * The maximum length of predicted answers (e.g., only answers with a shorter length are
2202
- * considered).
2203
- */
2204
- max_answer_len?: number;
2205
- /**
2206
- * The maximum length of the question after tokenization. It will be truncated if needed.
2207
- */
2208
- max_question_len?: number;
2209
- /**
2210
- * The maximum length of the total sentence (context + question) in tokens of each chunk
2211
- * passed to the model. The context will be split in several chunks (using docStride as
2212
- * overlap) if needed.
2213
- */
2214
- max_seq_len?: number;
2215
- /**
2216
- * The number of answers to return (will be chosen by order of likelihood). Note that we
2217
- * return less than topk answers if there are not enough options available within the
2218
- * context.
2219
- */
2220
- top_k?: number;
2221
- [property: string]: unknown;
2222
- }
2223
- type QuestionAnsweringOutput = QuestionAnsweringOutputElement[];
2224
- /**
2225
- * Outputs of inference for the Question Answering task
2226
- */
2227
- interface QuestionAnsweringOutputElement {
2228
- /**
2229
- * The answer to the question.
2230
- */
2231
- answer: string;
2232
- /**
2233
- * The character position in the input where the answer ends.
2234
- */
2235
- end: number;
2236
- /**
2237
- * The probability associated to the answer.
2238
- */
2239
- score: number;
2240
- /**
2241
- * The character position in the input where the answer begins.
2242
- */
2243
- start: number;
2244
- [property: string]: unknown;
2245
- }
2246
-
2247
- /**
2248
- * Inference code generated from the JSON schema spec in ./spec
2249
- *
2250
- * Using src/scripts/inference-codegen
2251
- */
2252
- type SentenceSimilarityOutput = number[];
2253
- /**
2254
- * Inputs for Sentence similarity inference
2255
- */
2256
- interface SentenceSimilarityInput {
2257
- inputs: SentenceSimilarityInputData;
2258
- /**
2259
- * Additional inference parameters
2260
- */
2261
- parameters?: {
2262
- [key: string]: unknown;
2263
- };
2264
- [property: string]: unknown;
2265
- }
2266
- interface SentenceSimilarityInputData {
2267
- /**
2268
- * A list of strings which will be compared against the source_sentence.
2269
- */
2270
- sentences: string[];
2271
- /**
2272
- * The string that you wish to compare the other strings with. This can be a phrase,
2273
- * sentence, or longer passage, depending on the model being used.
2274
- */
2275
- sourceSentence: string;
2276
- [property: string]: unknown;
2277
- }
2278
-
2279
- /**
2280
- * Inference code generated from the JSON schema spec in ./spec
2281
- *
2282
- * Using src/scripts/inference-codegen
2283
- */
2284
- /**
2285
- * Inputs for Summarization inference
2286
- *
2287
- * Inputs for Text2text Generation inference
2288
- */
2289
- interface SummarizationInput {
2290
- /**
2291
- * The input text data
2292
- */
2293
- inputs: string;
2294
- /**
2295
- * Additional inference parameters
2296
- */
2297
- parameters?: Text2TextGenerationParameters$1;
2298
- [property: string]: unknown;
2299
- }
2300
- /**
2301
- * Additional inference parameters
2302
- *
2303
- * Additional inference parameters for Text2text Generation
2304
- */
2305
- interface Text2TextGenerationParameters$1 {
2306
- /**
2307
- * Whether to clean up the potential extra spaces in the text output.
2308
- */
2309
- clean_up_tokenization_spaces?: boolean;
2310
- /**
2311
- * Additional parametrization of the text generation algorithm
2312
- */
2313
- generate_parameters?: {
2314
- [key: string]: unknown;
2315
- };
2316
- /**
2317
- * The truncation strategy to use
2318
- */
2319
- truncation?: Text2TextGenerationTruncationStrategy$1;
2320
- [property: string]: unknown;
2321
- }
2322
- type Text2TextGenerationTruncationStrategy$1 = "do_not_truncate" | "longest_first" | "only_first" | "only_second";
2323
- /**
2324
- * Outputs of inference for the Summarization task
2325
- */
2326
- interface SummarizationOutput {
2327
- /**
2328
- * The summarized text.
2329
- */
2330
- summary_text: string;
2331
- [property: string]: unknown;
2332
- }
2333
-
2334
- /**
2335
- * Inference code generated from the JSON schema spec in ./spec
2336
- *
2337
- * Using src/scripts/inference-codegen
2338
- */
2339
- /**
2340
- * Inputs for Table Question Answering inference
2341
- */
2342
- interface TableQuestionAnsweringInput {
2343
- /**
2344
- * One (table, question) pair to answer
2345
- */
2346
- inputs: TableQuestionAnsweringInputData;
2347
- /**
2348
- * Additional inference parameters
2349
- */
2350
- parameters?: {
2351
- [key: string]: unknown;
2352
- };
2353
- [property: string]: unknown;
2354
- }
2355
- /**
2356
- * One (table, question) pair to answer
2357
- */
2358
- interface TableQuestionAnsweringInputData {
2359
- /**
2360
- * The question to be answered about the table
2361
- */
2362
- question: string;
2363
- /**
2364
- * The table to serve as context for the questions
2365
- */
2366
- table: {
2367
- [key: string]: string[];
2368
- };
2369
- [property: string]: unknown;
2370
- }
2371
- type TableQuestionAnsweringOutput = TableQuestionAnsweringOutputElement[];
2372
- /**
2373
- * Outputs of inference for the Table Question Answering task
2374
- */
2375
- interface TableQuestionAnsweringOutputElement {
2376
- /**
2377
- * If the model has an aggregator, this returns the aggregator.
2378
- */
2379
- aggregator?: string;
2380
- /**
2381
- * The answer of the question given the table. If there is an aggregator, the answer will be
2382
- * preceded by `AGGREGATOR >`.
2383
- */
2384
- answer: string;
2385
- /**
2386
- * List of strings made up of the answer cell values.
2387
- */
2388
- cells: string[];
2389
- /**
2390
- * Coordinates of the cells of the answers.
2391
- */
2392
- coordinates: Array<number[]>;
2393
- [property: string]: unknown;
2394
- }
2395
-
2396
- /**
2397
- * Inference code generated from the JSON schema spec in ./spec
2398
- *
2399
- * Using src/scripts/inference-codegen
2400
- */
2401
- /**
2402
- * Inputs for Text To Image inference
2403
- */
2404
- interface TextToImageInput {
2405
- /**
2406
- * The input text data (sometimes called "prompt"
2407
- */
2408
- inputs: string;
2409
- /**
2410
- * Additional inference parameters
2411
- */
2412
- parameters?: TextToImageParameters;
2413
- [property: string]: unknown;
2414
- }
2415
- /**
2416
- * Additional inference parameters
2417
- *
2418
- * Additional inference parameters for Text To Image
2419
- */
2420
- interface TextToImageParameters {
2421
- /**
2422
- * For diffusion models. A higher guidance scale value encourages the model to generate
2423
- * images closely linked to the text prompt at the expense of lower image quality.
2424
- */
2425
- guidance_scale?: number;
2426
- /**
2427
- * One or several prompt to guide what NOT to include in image generation.
2428
- */
2429
- negative_prompt?: string[];
2430
- /**
2431
- * For diffusion models. The number of denoising steps. More denoising steps usually lead to
2432
- * a higher quality image at the expense of slower inference.
2433
- */
2434
- num_inference_steps?: number;
2435
- /**
2436
- * For diffusion models. Override the scheduler with a compatible one
2437
- */
2438
- scheduler?: string;
2439
- /**
2440
- * The size in pixel of the output image
2441
- */
2442
- target_size?: TargetSize;
2443
- [property: string]: unknown;
2444
- }
2445
- /**
2446
- * The size in pixel of the output image
2447
- */
2448
- interface TargetSize {
2449
- height: number;
2450
- width: number;
2451
- [property: string]: unknown;
2452
- }
2453
- /**
2454
- * Outputs of inference for the Text To Image task
2455
- */
2456
- interface TextToImageOutput {
2457
- /**
2458
- * The generated image
2459
- */
2460
- image: unknown;
2461
- [property: string]: unknown;
2462
- }
2463
-
2464
- /**
2465
- * Inference code generated from the JSON schema spec in ./spec
2466
- *
2467
- * Using src/scripts/inference-codegen
2468
- */
2469
- /**
2470
- * Inputs for Text to Speech inference
2471
- *
2472
- * Inputs for Text To Audio inference
2473
- */
2474
- interface TextToSpeechInput {
2475
- /**
2476
- * The input text data
2477
- */
2478
- inputs: string;
2479
- /**
2480
- * Additional inference parameters
2481
- */
2482
- parameters?: TextToAudioParameters;
2483
- [property: string]: unknown;
2484
- }
2485
- /**
2486
- * Additional inference parameters
2487
- *
2488
- * Additional inference parameters for Text To Audio
2489
- */
2490
- interface TextToAudioParameters {
2491
- /**
2492
- * Parametrization of the text generation process
2493
- */
2494
- generate?: GenerationParameters;
2495
- [property: string]: unknown;
2496
- }
2497
- /**
2498
- * Parametrization of the text generation process
2499
- *
2500
- * Ad-hoc parametrization of the text generation process
2501
- */
2502
- interface GenerationParameters {
2503
- /**
2504
- * Whether to use sampling instead of greedy decoding when generating new tokens.
2505
- */
2506
- do_sample?: boolean;
2507
- /**
2508
- * Controls the stopping condition for beam-based methods.
2509
- */
2510
- early_stopping?: EarlyStoppingUnion;
2511
- /**
2512
- * If set to float strictly between 0 and 1, only tokens with a conditional probability
2513
- * greater than epsilon_cutoff will be sampled. In the paper, suggested values range from
2514
- * 3e-4 to 9e-4, depending on the size of the model. See [Truncation Sampling as Language
2515
- * Model Desmoothing](https://hf.co/papers/2210.15191) for more details.
2516
- */
2517
- epsilon_cutoff?: number;
2518
- /**
2519
- * Eta sampling is a hybrid of locally typical sampling and epsilon sampling. If set to
2520
- * float strictly between 0 and 1, a token is only considered if it is greater than either
2521
- * eta_cutoff or sqrt(eta_cutoff) * exp(-entropy(softmax(next_token_logits))). The latter
2522
- * term is intuitively the expected next token probability, scaled by sqrt(eta_cutoff). In
2523
- * the paper, suggested values range from 3e-4 to 2e-3, depending on the size of the model.
2524
- * See [Truncation Sampling as Language Model Desmoothing](https://hf.co/papers/2210.15191)
2525
- * for more details.
2526
- */
2527
- eta_cutoff?: number;
2528
- /**
2529
- * The maximum length (in tokens) of the generated text, including the input.
2530
- */
2531
- max_length?: number;
2532
- /**
2533
- * The maximum number of tokens to generate. Takes precedence over maxLength.
2534
- */
2535
- max_new_tokens?: number;
2536
- /**
2537
- * The minimum length (in tokens) of the generated text, including the input.
2538
- */
2539
- min_length?: number;
2540
- /**
2541
- * The minimum number of tokens to generate. Takes precedence over maxLength.
2542
- */
2543
- min_new_tokens?: number;
2544
- /**
2545
- * Number of groups to divide num_beams into in order to ensure diversity among different
2546
- * groups of beams. See [this paper](https://hf.co/papers/1610.02424) for more details.
2547
- */
2548
- num_beam_groups?: number;
2549
- /**
2550
- * Number of beams to use for beam search.
2551
- */
2552
- num_beams?: number;
2553
- /**
2554
- * The value balances the model confidence and the degeneration penalty in contrastive
2555
- * search decoding.
2556
- */
2557
- penalty_alpha?: number;
2558
- /**
2559
- * The value used to modulate the next token probabilities.
2560
- */
2561
- temperature?: number;
2562
- /**
2563
- * The number of highest probability vocabulary tokens to keep for top-k-filtering.
2564
- */
2565
- top_k?: number;
2566
- /**
2567
- * If set to float < 1, only the smallest set of most probable tokens with probabilities
2568
- * that add up to top_p or higher are kept for generation.
2569
- */
2570
- top_p?: number;
2571
- /**
2572
- * Local typicality measures how similar the conditional probability of predicting a target
2573
- * token next is to the expected conditional probability of predicting a random token next,
2574
- * given the partial text already generated. If set to float < 1, the smallest set of the
2575
- * most locally typical tokens with probabilities that add up to typical_p or higher are
2576
- * kept for generation. See [this paper](https://hf.co/papers/2202.00666) for more details.
2577
- */
2578
- typical_p?: number;
2579
- /**
2580
- * Whether the model should use the past last key/values attentions to speed up decoding
2581
- */
2582
- use_cache?: boolean;
2583
- [property: string]: unknown;
2584
- }
2585
- /**
2586
- * Controls the stopping condition for beam-based methods.
2587
- */
2588
- type EarlyStoppingUnion = boolean | "never";
2589
- /**
2590
- * Outputs for Text to Speech inference
2591
- *
2592
- * Outputs of inference for the Text To Audio task
2593
- */
2594
- interface TextToSpeechOutput {
2595
- /**
2596
- * The generated audio waveform.
2597
- */
2598
- audio: unknown;
2599
- samplingRate: unknown;
2600
- /**
2601
- * The sampling rate of the generated audio waveform.
2602
- */
2603
- sampling_rate?: number;
2604
- [property: string]: unknown;
2605
- }
2606
-
2607
- /**
2608
- * Inference code generated from the JSON schema spec in ./spec
2609
- *
2610
- * Using src/scripts/inference-codegen
2611
- */
2612
- /**
2613
- * Inputs for Token Classification inference
2614
- */
2615
- interface TokenClassificationInput {
2616
- /**
2617
- * The input text data
2618
- */
2619
- inputs: string;
2620
- /**
2621
- * Additional inference parameters
2622
- */
2623
- parameters?: TokenClassificationParameters;
2624
- [property: string]: unknown;
2625
- }
2626
- /**
2627
- * Additional inference parameters
2628
- *
2629
- * Additional inference parameters for Token Classification
2630
- */
2631
- interface TokenClassificationParameters {
2632
- /**
2633
- * The strategy used to fuse tokens based on model predictions
2634
- */
2635
- aggregation_strategy?: TokenClassificationAggregationStrategy;
2636
- /**
2637
- * A list of labels to ignore
2638
- */
2639
- ignore_labels?: string[];
2640
- /**
2641
- * The number of overlapping tokens between chunks when splitting the input text.
2642
- */
2643
- stride?: number;
2644
- [property: string]: unknown;
2645
- }
2646
- /**
2647
- * Do not aggregate tokens
2648
- *
2649
- * Group consecutive tokens with the same label in a single entity.
2650
- *
2651
- * Similar to "simple", also preserves word integrity (use the label predicted for the first
2652
- * token in a word).
2653
- *
2654
- * Similar to "simple", also preserves word integrity (uses the label with the highest
2655
- * score, averaged across the word's tokens).
2656
- *
2657
- * Similar to "simple", also preserves word integrity (uses the label with the highest score
2658
- * across the word's tokens).
2659
- */
2660
- type TokenClassificationAggregationStrategy = "none" | "simple" | "first" | "average" | "max";
2661
- type TokenClassificationOutput = TokenClassificationOutputElement[];
2662
- /**
2663
- * Outputs of inference for the Token Classification task
2664
- */
2665
- interface TokenClassificationOutputElement {
2666
- /**
2667
- * The character position in the input where this group ends.
2668
- */
2669
- end?: number;
2670
- /**
2671
- * The predicted label for that group of tokens
2672
- */
2673
- entity_group?: string;
2674
- label: unknown;
2675
- /**
2676
- * The associated score / probability
2677
- */
2678
- score: number;
2679
- /**
2680
- * The character position in the input where this group begins.
2681
- */
2682
- start?: number;
2683
- /**
2684
- * The corresponding text
2685
- */
2686
- word?: string;
2687
- [property: string]: unknown;
2688
- }
2689
-
2690
- /**
2691
- * Inference code generated from the JSON schema spec in ./spec
2692
- *
2693
- * Using src/scripts/inference-codegen
2694
- */
2695
- /**
2696
- * Inputs for Translation inference
2697
- *
2698
- * Inputs for Text2text Generation inference
2699
- */
2700
- interface TranslationInput {
2701
- /**
2702
- * The input text data
2703
- */
2704
- inputs: string;
2705
- /**
2706
- * Additional inference parameters
2707
- */
2708
- parameters?: Text2TextGenerationParameters;
2709
- [property: string]: unknown;
2710
- }
2711
- /**
2712
- * Additional inference parameters
2713
- *
2714
- * Additional inference parameters for Text2text Generation
2715
- */
2716
- interface Text2TextGenerationParameters {
2717
- /**
2718
- * Whether to clean up the potential extra spaces in the text output.
2719
- */
2720
- clean_up_tokenization_spaces?: boolean;
2721
- /**
2722
- * Additional parametrization of the text generation algorithm
2723
- */
2724
- generate_parameters?: {
2725
- [key: string]: unknown;
2726
- };
2727
- /**
2728
- * The truncation strategy to use
2729
- */
2730
- truncation?: Text2TextGenerationTruncationStrategy;
2731
- [property: string]: unknown;
2732
- }
2733
- type Text2TextGenerationTruncationStrategy = "do_not_truncate" | "longest_first" | "only_first" | "only_second";
2734
- /**
2735
- * Outputs of inference for the Translation task
2736
- */
2737
- interface TranslationOutput {
2738
- /**
2739
- * The translated text.
2740
- */
2741
- translation_text: string;
2742
- [property: string]: unknown;
2743
- }
2744
-
2745
- /**
2746
- * Inference code generated from the JSON schema spec in ./spec
2747
- *
2748
- * Using src/scripts/inference-codegen
2749
- */
2750
- /**
2751
- * Inputs for Text Classification inference
2752
- */
2753
- interface TextClassificationInput {
2754
- /**
2755
- * The text to classify
2756
- */
2757
- inputs: string;
2758
- /**
2759
- * Additional inference parameters
2760
- */
2761
- parameters?: TextClassificationParameters;
2762
- [property: string]: unknown;
2763
- }
2764
- /**
2765
- * Additional inference parameters
2766
- *
2767
- * Additional inference parameters for Text Classification
2768
- */
2769
- interface TextClassificationParameters {
2770
- function_to_apply?: ClassificationOutputTransform$1;
2771
- /**
2772
- * When specified, limits the output to the top K most probable classes.
2773
- */
2774
- top_k?: number;
2775
- [property: string]: unknown;
2776
- }
2777
- /**
2778
- * The function to apply to the model outputs in order to retrieve the scores.
2779
- */
2780
- type ClassificationOutputTransform$1 = "sigmoid" | "softmax" | "none";
2781
- type TextClassificationOutput = TextClassificationOutputElement[];
2782
- /**
2783
- * Outputs of inference for the Text Classification task
2784
- */
2785
- interface TextClassificationOutputElement {
2786
- /**
2787
- * The predicted class label.
2788
- */
2789
- label: string;
2790
- /**
2791
- * The corresponding probability.
2792
- */
2793
- score: number;
2794
- [property: string]: unknown;
2795
- }
2796
-
2797
- /**
2798
- * Inference code generated from the JSON schema spec in ./spec
2799
- *
2800
- * Using src/scripts/inference-codegen
2801
- */
2802
- /**
2803
- * Inputs for Text Generation inference
2804
- */
2805
- interface TextGenerationInput {
2806
- /**
2807
- * The text to initialize generation with
2808
- */
2809
- inputs: string;
2810
- /**
2811
- * Additional inference parameters
2812
- */
2813
- parameters?: TextGenerationParameters;
2814
- /**
2815
- * Whether to stream output tokens
2816
- */
2817
- stream?: boolean;
2818
- [property: string]: unknown;
2819
- }
2820
- /**
2821
- * Additional inference parameters
2822
- *
2823
- * Additional inference parameters for Text Generation
2824
- */
2825
- interface TextGenerationParameters {
2826
- /**
2827
- * The number of sampling queries to run. Only the best one (in terms of total logprob) will
2828
- * be returned.
2829
- */
2830
- best_of?: number;
2831
- /**
2832
- * Whether or not to output decoder input details
2833
- */
2834
- decoder_input_details?: boolean;
2835
- /**
2836
- * Whether or not to output details
2837
- */
2838
- details?: boolean;
2839
- /**
2840
- * Whether to use logits sampling instead of greedy decoding when generating new tokens.
2841
- */
2842
- do_sample?: boolean;
2843
- /**
2844
- * The maximum number of tokens to generate.
2845
- */
2846
- max_new_tokens?: number;
2847
- /**
2848
- * The parameter for repetition penalty. A value of 1.0 means no penalty. See [this
2849
- * paper](https://hf.co/papers/1909.05858) for more details.
2850
- */
2851
- repetition_penalty?: number;
2852
- /**
2853
- * Whether to prepend the prompt to the generated text.
2854
- */
2855
- return_full_text?: boolean;
2856
- /**
2857
- * The random sampling seed.
2858
- */
2859
- seed?: number;
2860
- /**
2861
- * Stop generating tokens if a member of `stop_sequences` is generated.
2862
- */
2863
- stop_sequences?: string[];
2864
- /**
2865
- * The value used to modulate the logits distribution.
2866
- */
2867
- temperature?: number;
2868
- /**
2869
- * The number of highest probability vocabulary tokens to keep for top-k-filtering.
2870
- */
2871
- top_k?: number;
2872
- /**
2873
- * If set to < 1, only the smallest set of most probable tokens with probabilities that add
2874
- * up to `top_p` or higher are kept for generation.
2875
- */
2876
- top_p?: number;
2877
- /**
2878
- * Truncate input tokens to the given size.
2879
- */
2880
- truncate?: number;
2881
- /**
2882
- * Typical Decoding mass. See [Typical Decoding for Natural Language
2883
- * Generation](https://hf.co/papers/2202.00666) for more information
2884
- */
2885
- typical_p?: number;
2886
- /**
2887
- * Watermarking with [A Watermark for Large Language Models](https://hf.co/papers/2301.10226)
2888
- */
2889
- watermark?: boolean;
2890
- [property: string]: unknown;
2891
- }
2892
- /**
2893
- * Outputs for Text Generation inference
2894
- */
2895
- interface TextGenerationOutput {
2896
- /**
2897
- * When enabled, details about the generation
2898
- */
2899
- details?: TextGenerationOutputDetails;
2900
- /**
2901
- * The generated text
2902
- */
2903
- generated_text: string;
2904
- [property: string]: unknown;
2905
- }
2906
- /**
2907
- * When enabled, details about the generation
2908
- */
2909
- interface TextGenerationOutputDetails {
2910
- /**
2911
- * Details about additional sequences when best_of is provided
2912
- */
2913
- best_of_sequences?: TextGenerationOutputSequenceDetails[];
2914
- /**
2915
- * The reason why the generation was stopped.
2916
- */
2917
- finish_reason: TextGenerationFinishReason;
2918
- /**
2919
- * The number of generated tokens
2920
- */
2921
- generated_tokens: number;
2922
- prefill: TextGenerationPrefillToken[];
2923
- /**
2924
- * The random seed used for generation
2925
- */
2926
- seed?: number;
2927
- /**
2928
- * The generated tokens and associated details
2929
- */
2930
- tokens: TextGenerationOutputToken[];
2931
- /**
2932
- * Most likely tokens
2933
- */
2934
- top_tokens?: Array<TextGenerationOutputToken[]>;
2935
- [property: string]: unknown;
2936
- }
2937
- interface TextGenerationOutputSequenceDetails {
2938
- finish_reason: TextGenerationFinishReason;
2939
- /**
2940
- * The generated text
2941
- */
2942
- generated_text: string;
2943
- /**
2944
- * The number of generated tokens
2945
- */
2946
- generated_tokens: number;
2947
- prefill: TextGenerationPrefillToken[];
2948
- /**
2949
- * The random seed used for generation
2950
- */
2951
- seed?: number;
2952
- /**
2953
- * The generated tokens and associated details
2954
- */
2955
- tokens: TextGenerationOutputToken[];
2956
- /**
2957
- * Most likely tokens
2958
- */
2959
- top_tokens?: Array<TextGenerationOutputToken[]>;
2960
- [property: string]: unknown;
2961
- }
2962
- /**
2963
- * The reason why the generation was stopped.
2964
- *
2965
- * length: The generated sequence reached the maximum allowed length
2966
- *
2967
- * eos_token: The model generated an end-of-sentence (EOS) token
2968
- *
2969
- * stop_sequence: One of the sequence in stop_sequences was generated
2970
- */
2971
- type TextGenerationFinishReason = "length" | "eos_token" | "stop_sequence";
2972
- interface TextGenerationPrefillToken {
2973
- id: number;
2974
- logprob: number;
2975
- /**
2976
- * The text associated with that token
2977
- */
2978
- text: string;
2979
- [property: string]: unknown;
2980
- }
2981
- /**
2982
- * Generated token.
2983
- */
2984
- interface TextGenerationOutputToken {
2985
- id: number;
2986
- logprob?: number;
2987
- /**
2988
- * Whether or not that token is a special one
2989
- */
2990
- special: boolean;
2991
- /**
2992
- * The text associated with that token
2993
- */
2994
- text: string;
2995
- [property: string]: unknown;
2996
- }
2997
- /**
2998
- * Text Generation Stream Output
2999
- */
3000
- interface TextGenerationStreamOutput {
3001
- /**
3002
- * Generation details. Only available when the generation is finished.
3003
- */
3004
- details?: TextGenerationStreamDetails;
3005
- /**
3006
- * The complete generated text. Only available when the generation is finished.
3007
- */
3008
- generated_text?: string;
3009
- /**
3010
- * The token index within the stream. Optional to support older clients that omit it.
3011
- */
3012
- index?: number;
3013
- /**
3014
- * Generated token.
3015
- */
3016
- token: TextGenerationOutputToken;
3017
- [property: string]: unknown;
3018
- }
3019
- /**
3020
- * Generation details. Only available when the generation is finished.
3021
- */
3022
- interface TextGenerationStreamDetails {
3023
- /**
3024
- * The reason why the generation was stopped.
3025
- */
3026
- finish_reason: TextGenerationFinishReason;
3027
- /**
3028
- * The number of generated tokens
3029
- */
3030
- generated_tokens: number;
3031
- /**
3032
- * The random seed used for generation
3033
- */
3034
- seed: number;
3035
- [property: string]: unknown;
3036
- }
3037
-
3038
- /**
3039
- * Inference code generated from the JSON schema spec in ./spec
3040
- *
3041
- * Using src/scripts/inference-codegen
3042
- */
3043
- /**
3044
- * Inputs for Video Classification inference
3045
- */
3046
- interface VideoClassificationInput {
3047
- /**
3048
- * The input video data
3049
- */
3050
- inputs: unknown;
3051
- /**
3052
- * Additional inference parameters
3053
- */
3054
- parameters?: VideoClassificationParameters;
3055
- [property: string]: unknown;
3056
- }
3057
- /**
3058
- * Additional inference parameters
3059
- *
3060
- * Additional inference parameters for Video Classification
3061
- */
3062
- interface VideoClassificationParameters {
3063
- /**
3064
- * The sampling rate used to select frames from the video.
3065
- */
3066
- frame_sampling_rate?: number;
3067
- function_to_apply?: ClassificationOutputTransform;
3068
- /**
3069
- * The number of sampled frames to consider for classification.
3070
- */
3071
- num_frames?: number;
3072
- /**
3073
- * When specified, limits the output to the top K most probable classes.
3074
- */
3075
- top_k?: number;
3076
- [property: string]: unknown;
3077
- }
3078
- /**
3079
- * The function to apply to the model outputs in order to retrieve the scores.
3080
- */
3081
- type ClassificationOutputTransform = "sigmoid" | "softmax" | "none";
3082
- type VideoClassificationOutput = VideoClassificationOutputElement[];
3083
- /**
3084
- * Outputs of inference for the Video Classification task
3085
- */
3086
- interface VideoClassificationOutputElement {
3087
- /**
3088
- * The predicted class label.
3089
- */
3090
- label: string;
3091
- /**
3092
- * The corresponding probability.
3093
- */
3094
- score: number;
3095
- [property: string]: unknown;
3096
- }
3097
-
3098
- /**
3099
- * Inference code generated from the JSON schema spec in ./spec
3100
- *
3101
- * Using src/scripts/inference-codegen
3102
- */
3103
- /**
3104
- * Inputs for Visual Question Answering inference
3105
- */
3106
- interface VisualQuestionAnsweringInput {
3107
- /**
3108
- * One (image, question) pair to answer
3109
- */
3110
- inputs: VisualQuestionAnsweringInputData;
3111
- /**
3112
- * Additional inference parameters
3113
- */
3114
- parameters?: VisualQuestionAnsweringParameters;
3115
- [property: string]: unknown;
3116
- }
3117
- /**
3118
- * One (image, question) pair to answer
3119
- */
3120
- interface VisualQuestionAnsweringInputData {
3121
- /**
3122
- * The image.
3123
- */
3124
- image: unknown;
3125
- /**
3126
- * The question to answer based on the image.
3127
- */
3128
- question: unknown;
3129
- [property: string]: unknown;
3130
- }
3131
- /**
3132
- * Additional inference parameters
3133
- *
3134
- * Additional inference parameters for Visual Question Answering
3135
- */
3136
- interface VisualQuestionAnsweringParameters {
3137
- /**
3138
- * The number of answers to return (will be chosen by order of likelihood). Note that we
3139
- * return less than topk answers if there are not enough options available within the
3140
- * context.
3141
- */
3142
- top_k?: number;
3143
- [property: string]: unknown;
3144
- }
3145
- type VisualQuestionAnsweringOutput = VisualQuestionAnsweringOutputElement[];
3146
- /**
3147
- * Outputs of inference for the Visual Question Answering task
3148
- */
3149
- interface VisualQuestionAnsweringOutputElement {
3150
- /**
3151
- * The answer to the question
3152
- */
3153
- answer?: string;
3154
- label: unknown;
3155
- /**
3156
- * The associated score / probability
3157
- */
3158
- score: number;
3159
- [property: string]: unknown;
3160
- }
3161
-
3162
- /**
3163
- * Inference code generated from the JSON schema spec in ./spec
3164
- *
3165
- * Using src/scripts/inference-codegen
3166
- */
3167
- /**
3168
- * Inputs for Zero Shot Classification inference
3169
- */
3170
- interface ZeroShotClassificationInput {
3171
- /**
3172
- * The input text data, with candidate labels
3173
- */
3174
- inputs: ZeroShotClassificationInputData;
3175
- /**
3176
- * Additional inference parameters
3177
- */
3178
- parameters?: ZeroShotClassificationParameters;
3179
- [property: string]: unknown;
3180
- }
3181
- /**
3182
- * The input text data, with candidate labels
3183
- */
3184
- interface ZeroShotClassificationInputData {
3185
- /**
3186
- * The set of possible class labels to classify the text into.
3187
- */
3188
- candidateLabels: string[];
3189
- /**
3190
- * The text to classify
3191
- */
3192
- text: string;
3193
- [property: string]: unknown;
3194
- }
3195
- /**
3196
- * Additional inference parameters
3197
- *
3198
- * Additional inference parameters for Zero Shot Classification
3199
- */
3200
- interface ZeroShotClassificationParameters {
3201
- /**
3202
- * The sentence used in conjunction with candidateLabels to attempt the text classification
3203
- * by replacing the placeholder with the candidate labels.
3204
- */
3205
- hypothesis_template?: string;
3206
- /**
3207
- * Whether multiple candidate labels can be true. If false, the scores are normalized such
3208
- * that the sum of the label likelihoods for each sequence is 1. If true, the labels are
3209
- * considered independent and probabilities are normalized for each candidate.
3210
- */
3211
- multi_label?: boolean;
3212
- [property: string]: unknown;
3213
- }
3214
- type ZeroShotClassificationOutput = ZeroShotClassificationOutputElement[];
3215
- /**
3216
- * Outputs of inference for the Zero Shot Classification task
3217
- */
3218
- interface ZeroShotClassificationOutputElement {
3219
- /**
3220
- * The predicted class label.
3221
- */
3222
- label: string;
3223
- /**
3224
- * The corresponding probability.
3225
- */
3226
- score: number;
3227
- [property: string]: unknown;
3228
- }
3229
-
3230
- /**
3231
- * Inference code generated from the JSON schema spec in ./spec
3232
- *
3233
- * Using src/scripts/inference-codegen
3234
- */
3235
- /**
3236
- * Inputs for Zero Shot Image Classification inference
3237
- */
3238
- interface ZeroShotImageClassificationInput {
3239
- /**
3240
- * The input image data, with candidate labels
3241
- */
3242
- inputs: ZeroShotImageClassificationInputData;
3243
- /**
3244
- * Additional inference parameters
3245
- */
3246
- parameters?: ZeroShotImageClassificationParameters;
3247
- [property: string]: unknown;
3248
- }
3249
- /**
3250
- * The input image data, with candidate labels
3251
- */
3252
- interface ZeroShotImageClassificationInputData {
3253
- /**
3254
- * The candidate labels for this image
3255
- */
3256
- candidateLabels: string[];
3257
- /**
3258
- * The image data to classify
3259
- */
3260
- image: unknown;
3261
- [property: string]: unknown;
3262
- }
3263
- /**
3264
- * Additional inference parameters
3265
- *
3266
- * Additional inference parameters for Zero Shot Image Classification
3267
- */
3268
- interface ZeroShotImageClassificationParameters {
3269
- /**
3270
- * The sentence used in conjunction with candidateLabels to attempt the text classification
3271
- * by replacing the placeholder with the candidate labels.
3272
- */
3273
- hypothesis_template?: string;
3274
- [property: string]: unknown;
3275
- }
3276
- type ZeroShotImageClassificationOutput = ZeroShotImageClassificationOutputElement[];
3277
- /**
3278
- * Outputs of inference for the Zero Shot Image Classification task
3279
- */
3280
- interface ZeroShotImageClassificationOutputElement {
3281
- /**
3282
- * The predicted class label.
3283
- */
3284
- label: string;
3285
- /**
3286
- * The corresponding probability.
3287
- */
3288
- score: number;
3289
- [property: string]: unknown;
3290
- }
3291
-
3292
- /**
3293
- * Inference code generated from the JSON schema spec in ./spec
3294
- *
3295
- * Using src/scripts/inference-codegen
3296
- */
3297
- /**
3298
- * Inputs for Zero Shot Object Detection inference
3299
- */
3300
- interface ZeroShotObjectDetectionInput {
3301
- /**
3302
- * The input image data, with candidate labels
3303
- */
3304
- inputs: ZeroShotObjectDetectionInputData;
3305
- /**
3306
- * Additional inference parameters
3307
- */
3308
- parameters?: {
3309
- [key: string]: unknown;
3310
- };
3311
- [property: string]: unknown;
3312
- }
3313
- /**
3314
- * The input image data, with candidate labels
3315
- */
3316
- interface ZeroShotObjectDetectionInputData {
3317
- /**
3318
- * The candidate labels for this image
3319
- */
3320
- candidateLabels: string[];
3321
- /**
3322
- * The image data to generate bounding boxes from
3323
- */
3324
- image: unknown;
3325
- [property: string]: unknown;
3326
- }
3327
- /**
3328
- * The predicted bounding box. Coordinates are relative to the top left corner of the input
3329
- * image.
3330
- */
3331
- interface BoundingBox {
3332
- xmax: number;
3333
- xmin: number;
3334
- ymax: number;
3335
- ymin: number;
3336
- [property: string]: unknown;
3337
- }
3338
- type ZeroShotObjectDetectionOutput = ZeroShotObjectDetectionOutputElement[];
3339
- /**
3340
- * Outputs of inference for the Zero Shot Object Detection task
3341
- */
3342
- interface ZeroShotObjectDetectionOutputElement {
3343
- /**
3344
- * The predicted bounding box. Coordinates are relative to the top left corner of the input
3345
- * image.
3346
- */
3347
- box: BoundingBox;
3348
- /**
3349
- * A candidate label
3350
- */
3351
- label: string;
3352
- /**
3353
- * The associated score / probability
3354
- */
3355
- score: number;
3356
- [property: string]: unknown;
3357
- }
3358
-
3359
- /**
3360
- * Model libraries compatible with each ML task
3361
- */
3362
- declare const TASKS_MODEL_LIBRARIES: Record<PipelineType, ModelLibraryKey[]>;
3363
- declare const TASKS_DATA: Record<PipelineType, TaskData | undefined>;
3364
- interface ExampleRepo {
3365
- description: string;
3366
- id: string;
3367
- }
3368
- type TaskDemoEntry = {
3369
- filename: string;
3370
- type: "audio";
3371
- } | {
3372
- data: Array<{
3373
- label: string;
3374
- score: number;
3375
- }>;
3376
- type: "chart";
3377
- } | {
3378
- filename: string;
3379
- type: "img";
3380
- } | {
3381
- table: string[][];
3382
- type: "tabular";
3383
- } | {
3384
- content: string;
3385
- label: string;
3386
- type: "text";
3387
- } | {
3388
- text: string;
3389
- tokens: Array<{
3390
- end: number;
3391
- start: number;
3392
- type: string;
3393
- }>;
3394
- type: "text-with-tokens";
3395
- };
3396
- interface TaskDemo {
3397
- inputs: TaskDemoEntry[];
3398
- outputs: TaskDemoEntry[];
3399
- }
3400
- interface TaskData {
3401
- datasets: ExampleRepo[];
3402
- demo: TaskDemo;
3403
- id: PipelineType;
3404
- canonicalId?: PipelineType;
3405
- isPlaceholder?: boolean;
3406
- label: string;
3407
- libraries: ModelLibraryKey[];
3408
- metrics: ExampleRepo[];
3409
- models: ExampleRepo[];
3410
- spaces: ExampleRepo[];
3411
- summary: string;
3412
- widgetModels: string[];
3413
- youtubeId?: string;
3414
- }
3415
- type TaskDataCustom = Omit<TaskData, "id" | "label" | "libraries">;
3416
-
3417
- /**
3418
- * Minimal model data required for snippets.
3419
- *
3420
- * Add more fields as needed.
3421
- */
3422
- type ModelDataMinimal = Pick<ModelData, "id" | "pipeline_tag" | "mask_token" | "library_name">;
3423
-
3424
- declare function getModelInputSnippet(model: ModelDataMinimal, noWrap?: boolean, noQuotes?: boolean): string;
3425
-
3426
- declare const inputs_getModelInputSnippet: typeof getModelInputSnippet;
3427
- declare namespace inputs {
3428
- export {
3429
- inputs_getModelInputSnippet as getModelInputSnippet,
3430
- };
3431
- }
3432
-
3433
- declare const snippetBasic$2: (model: ModelDataMinimal, accessToken: string) => string;
3434
- declare const snippetZeroShotClassification$2: (model: ModelDataMinimal, accessToken: string) => string;
3435
- declare const snippetFile$2: (model: ModelDataMinimal, accessToken: string) => string;
3436
- declare const curlSnippets: Partial<Record<PipelineType, (model: ModelDataMinimal, accessToken: string) => string>>;
3437
- declare function getCurlInferenceSnippet(model: ModelDataMinimal, accessToken: string): string;
3438
- declare function hasCurlInferenceSnippet(model: Pick<ModelDataMinimal, "pipeline_tag">): boolean;
3439
-
3440
- declare const curl_curlSnippets: typeof curlSnippets;
3441
- declare const curl_getCurlInferenceSnippet: typeof getCurlInferenceSnippet;
3442
- declare const curl_hasCurlInferenceSnippet: typeof hasCurlInferenceSnippet;
3443
- declare namespace curl {
3444
- export {
3445
- curl_curlSnippets as curlSnippets,
3446
- curl_getCurlInferenceSnippet as getCurlInferenceSnippet,
3447
- curl_hasCurlInferenceSnippet as hasCurlInferenceSnippet,
3448
- snippetBasic$2 as snippetBasic,
3449
- snippetFile$2 as snippetFile,
3450
- snippetZeroShotClassification$2 as snippetZeroShotClassification,
3451
- };
3452
- }
3453
-
3454
- declare const snippetZeroShotClassification$1: (model: ModelDataMinimal) => string;
3455
- declare const snippetZeroShotImageClassification: (model: ModelDataMinimal) => string;
3456
- declare const snippetBasic$1: (model: ModelDataMinimal) => string;
3457
- declare const snippetFile$1: (model: ModelDataMinimal) => string;
3458
- declare const snippetTextToImage$1: (model: ModelDataMinimal) => string;
3459
- declare const snippetTabular: (model: ModelDataMinimal) => string;
3460
- declare const snippetTextToAudio$1: (model: ModelDataMinimal) => string;
3461
- declare const snippetDocumentQuestionAnswering: (model: ModelDataMinimal) => string;
3462
- declare const pythonSnippets: Partial<Record<PipelineType, (model: ModelDataMinimal) => string>>;
3463
- declare function getPythonInferenceSnippet(model: ModelDataMinimal, accessToken: string): string;
3464
- declare function hasPythonInferenceSnippet(model: ModelDataMinimal): boolean;
3465
-
3466
- declare const python_getPythonInferenceSnippet: typeof getPythonInferenceSnippet;
3467
- declare const python_hasPythonInferenceSnippet: typeof hasPythonInferenceSnippet;
3468
- declare const python_pythonSnippets: typeof pythonSnippets;
3469
- declare const python_snippetDocumentQuestionAnswering: typeof snippetDocumentQuestionAnswering;
3470
- declare const python_snippetTabular: typeof snippetTabular;
3471
- declare const python_snippetZeroShotImageClassification: typeof snippetZeroShotImageClassification;
3472
- declare namespace python {
3473
- export {
3474
- python_getPythonInferenceSnippet as getPythonInferenceSnippet,
3475
- python_hasPythonInferenceSnippet as hasPythonInferenceSnippet,
3476
- python_pythonSnippets as pythonSnippets,
3477
- snippetBasic$1 as snippetBasic,
3478
- python_snippetDocumentQuestionAnswering as snippetDocumentQuestionAnswering,
3479
- snippetFile$1 as snippetFile,
3480
- python_snippetTabular as snippetTabular,
3481
- snippetTextToAudio$1 as snippetTextToAudio,
3482
- snippetTextToImage$1 as snippetTextToImage,
3483
- snippetZeroShotClassification$1 as snippetZeroShotClassification,
3484
- python_snippetZeroShotImageClassification as snippetZeroShotImageClassification,
3485
- };
3486
- }
3487
-
3488
- declare const snippetBasic: (model: ModelDataMinimal, accessToken: string) => string;
3489
- declare const snippetZeroShotClassification: (model: ModelDataMinimal, accessToken: string) => string;
3490
- declare const snippetTextToImage: (model: ModelDataMinimal, accessToken: string) => string;
3491
- declare const snippetTextToAudio: (model: ModelDataMinimal, accessToken: string) => string;
3492
- declare const snippetFile: (model: ModelDataMinimal, accessToken: string) => string;
3493
- declare const jsSnippets: Partial<Record<PipelineType, (model: ModelDataMinimal, accessToken: string) => string>>;
3494
- declare function getJsInferenceSnippet(model: ModelDataMinimal, accessToken: string): string;
3495
- declare function hasJsInferenceSnippet(model: ModelDataMinimal): boolean;
3496
-
3497
- declare const js_getJsInferenceSnippet: typeof getJsInferenceSnippet;
3498
- declare const js_hasJsInferenceSnippet: typeof hasJsInferenceSnippet;
3499
- declare const js_jsSnippets: typeof jsSnippets;
3500
- declare const js_snippetBasic: typeof snippetBasic;
3501
- declare const js_snippetFile: typeof snippetFile;
3502
- declare const js_snippetTextToAudio: typeof snippetTextToAudio;
3503
- declare const js_snippetTextToImage: typeof snippetTextToImage;
3504
- declare const js_snippetZeroShotClassification: typeof snippetZeroShotClassification;
3505
- declare namespace js {
3506
- export {
3507
- js_getJsInferenceSnippet as getJsInferenceSnippet,
3508
- js_hasJsInferenceSnippet as hasJsInferenceSnippet,
3509
- js_jsSnippets as jsSnippets,
3510
- js_snippetBasic as snippetBasic,
3511
- js_snippetFile as snippetFile,
3512
- js_snippetTextToAudio as snippetTextToAudio,
3513
- js_snippetTextToImage as snippetTextToImage,
3514
- js_snippetZeroShotClassification as snippetZeroShotClassification,
3515
- };
3516
- }
3517
-
3518
- declare const index_curl: typeof curl;
3519
- declare const index_inputs: typeof inputs;
3520
- declare const index_js: typeof js;
3521
- declare const index_python: typeof python;
3522
- declare namespace index {
3523
- export {
3524
- index_curl as curl,
3525
- index_inputs as inputs,
3526
- index_js as js,
3527
- index_python as python,
3528
- };
3529
- }
3530
-
3531
- export { ALL_DISPLAY_MODEL_LIBRARY_KEYS, ALL_MODEL_LIBRARY_KEYS, AddedToken, AudioClassificationInput, AudioClassificationOutput, AudioClassificationOutputElement, AudioClassificationParameters, AutomaticSpeechRecognitionInput, AutomaticSpeechRecognitionOutput, AutomaticSpeechRecognitionOutputChunk, AutomaticSpeechRecognitionParameters, BoundingBox, ChatCompletionFinishReason, ChatCompletionInput, ChatCompletionInputMessage, ChatCompletionOutput, ChatCompletionOutputChoice, ChatCompletionOutputChoiceMessage, ChatCompletionStreamOutput, ChatCompletionStreamOutputChoice, ChatCompletionStreamOutputDelta, ChatMessage, ClassificationOutputTransform$1 as ClassificationOutputTransform, DepthEstimationInput, DepthEstimationOutput, DocumentQuestionAnsweringInput, DocumentQuestionAnsweringInputData, DocumentQuestionAnsweringOutput, DocumentQuestionAnsweringOutputElement, DocumentQuestionAnsweringParameters, EarlyStoppingUnion$2 as EarlyStoppingUnion, ExampleRepo, FeatureExtractionInput, FeatureExtractionOutput, FillMaskInput, FillMaskOutput, FillMaskOutputElement, FillMaskParameters, GenerationParameters$2 as GenerationParameters, ImageClassificationInput, ImageClassificationOutput, ImageClassificationOutputElement, ImageClassificationParameters, ImageSegmentationInput, ImageSegmentationOutput, ImageSegmentationOutputElement, ImageSegmentationParameters, ImageSegmentationSubtask, ImageToImageInput, ImageToImageOutput, ImageToImageParameters, ImageToTextInput, ImageToTextOutput, ImageToTextParameters, InferenceDisplayability, LIBRARY_TASK_MAPPING, LibraryUiElement, MAPPING_DEFAULT_WIDGET, MODALITIES, MODALITY_LABELS, MODEL_LIBRARIES_UI_ELEMENTS, Modality, ModelData, ModelLibraryKey, ObjectDetectionInput, ObjectDetectionOutput, ObjectDetectionOutputElement, ObjectDetectionParameters, PIPELINE_DATA, PIPELINE_TYPES, PIPELINE_TYPES_SET, PipelineData, PipelineType, QuestionAnsweringInput, QuestionAnsweringInputData, QuestionAnsweringOutput, QuestionAnsweringOutputElement, QuestionAnsweringParameters, SPECIAL_TOKENS_ATTRIBUTES, SUBTASK_TYPES, SentenceSimilarityInput, SentenceSimilarityInputData, SentenceSimilarityOutput, SpecialTokensMap, SummarizationInput, SummarizationOutput, TASKS_DATA, TASKS_MODEL_LIBRARIES, TableQuestionAnsweringInput, TableQuestionAnsweringInputData, TableQuestionAnsweringOutput, TableQuestionAnsweringOutputElement, TargetSize$1 as TargetSize, TaskData, TaskDataCustom, TaskDemo, TaskDemoEntry, Text2TextGenerationParameters, Text2TextGenerationTruncationStrategy, TextClassificationInput, TextClassificationOutput, TextClassificationOutputElement, TextClassificationParameters, TextGenerationFinishReason, TextGenerationInput, TextGenerationOutput, TextGenerationOutputDetails, TextGenerationOutputSequenceDetails, TextGenerationOutputToken, TextGenerationParameters, TextGenerationPrefillToken, TextGenerationStreamDetails, TextGenerationStreamOutput, TextToAudioParameters, TextToImageInput, TextToImageOutput, TextToImageParameters, TextToSpeechInput, TextToSpeechOutput, TokenClassificationAggregationStrategy, TokenClassificationInput, TokenClassificationOutput, TokenClassificationOutputElement, TokenClassificationParameters, TokenizerConfig, TransformersInfo, TranslationInput, TranslationOutput, VideoClassificationInput, VideoClassificationOutput, VideoClassificationOutputElement, VideoClassificationParameters, VisualQuestionAnsweringInput, VisualQuestionAnsweringInputData, VisualQuestionAnsweringOutput, VisualQuestionAnsweringOutputElement, VisualQuestionAnsweringParameters, WidgetExample, WidgetExampleAssetAndPromptInput, WidgetExampleAssetAndTextInput, WidgetExampleAssetAndZeroShotInput, WidgetExampleAssetInput, WidgetExampleAttribute, WidgetExampleChatInput, WidgetExampleOutput, WidgetExampleOutputAnswerScore, WidgetExampleOutputLabels, WidgetExampleOutputText, WidgetExampleOutputUrl, WidgetExampleSentenceSimilarityInput, WidgetExampleStructuredDataInput, WidgetExampleTableDataInput, WidgetExampleTextAndContextInput, WidgetExampleTextAndTableInput, WidgetExampleTextInput, WidgetExampleZeroShotTextInput, WidgetType, WordBox, ZeroShotClassificationInput, ZeroShotClassificationInputData, ZeroShotClassificationOutput, ZeroShotClassificationOutputElement, ZeroShotClassificationParameters, ZeroShotImageClassificationInput, ZeroShotImageClassificationInputData, ZeroShotImageClassificationOutput, ZeroShotImageClassificationOutputElement, ZeroShotImageClassificationParameters, ZeroShotObjectDetectionInput, ZeroShotObjectDetectionInputData, ZeroShotObjectDetectionOutput, ZeroShotObjectDetectionOutputElement, index as snippets };