@huggingface/tasks 0.9.1 → 0.10.1

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 +501 -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 +8 -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 -3542
  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,3542 +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
- elm: {
803
- prettyLabel: string;
804
- repoName: string;
805
- repoUrl: string;
806
- filter: false;
807
- countDownloads: {
808
- wildcard: {
809
- path: string;
810
- };
811
- };
812
- };
813
- espnet: {
814
- prettyLabel: string;
815
- repoName: string;
816
- repoUrl: string;
817
- docsUrl: string;
818
- snippets: (model: ModelData) => string[];
819
- filter: true;
820
- };
821
- fairseq: {
822
- prettyLabel: string;
823
- repoName: string;
824
- repoUrl: string;
825
- snippets: (model: ModelData) => string[];
826
- filter: true;
827
- };
828
- fastai: {
829
- prettyLabel: string;
830
- repoName: string;
831
- repoUrl: string;
832
- docsUrl: string;
833
- snippets: (model: ModelData) => string[];
834
- filter: true;
835
- };
836
- fasttext: {
837
- prettyLabel: string;
838
- repoName: string;
839
- repoUrl: string;
840
- snippets: (model: ModelData) => string[];
841
- filter: true;
842
- };
843
- flair: {
844
- prettyLabel: string;
845
- repoName: string;
846
- repoUrl: string;
847
- docsUrl: string;
848
- snippets: (model: ModelData) => string[];
849
- filter: true;
850
- countDownloads: {
851
- term: {
852
- path: string;
853
- };
854
- };
855
- };
856
- gliner: {
857
- prettyLabel: string;
858
- repoName: string;
859
- repoUrl: string;
860
- snippets: (model: ModelData) => string[];
861
- filter: false;
862
- countDownloads: {
863
- term: {
864
- path: string;
865
- };
866
- };
867
- };
868
- grok: {
869
- prettyLabel: string;
870
- repoName: string;
871
- repoUrl: string;
872
- filter: false;
873
- countDownloads: {
874
- terms: {
875
- path: string[];
876
- };
877
- };
878
- };
879
- keras: {
880
- prettyLabel: string;
881
- repoName: string;
882
- repoUrl: string;
883
- docsUrl: string;
884
- snippets: (model: ModelData) => string[];
885
- filter: true;
886
- countDownloads: {
887
- term: {
888
- path: string;
889
- };
890
- };
891
- };
892
- "keras-nlp": {
893
- prettyLabel: string;
894
- repoName: string;
895
- repoUrl: string;
896
- docsUrl: string;
897
- snippets: (model: ModelData) => string[];
898
- };
899
- k2: {
900
- prettyLabel: string;
901
- repoName: string;
902
- repoUrl: string;
903
- };
904
- mindspore: {
905
- prettyLabel: string;
906
- repoName: string;
907
- repoUrl: string;
908
- };
909
- "ml-agents": {
910
- prettyLabel: string;
911
- repoName: string;
912
- repoUrl: string;
913
- docsUrl: string;
914
- snippets: (model: ModelData) => string[];
915
- filter: true;
916
- countDownloads: {
917
- wildcard: {
918
- path: string;
919
- };
920
- };
921
- };
922
- mlx: {
923
- prettyLabel: string;
924
- repoName: string;
925
- repoUrl: string;
926
- snippets: (model: ModelData) => string[];
927
- filter: true;
928
- };
929
- "mlx-image": {
930
- prettyLabel: string;
931
- repoName: string;
932
- repoUrl: string;
933
- docsUrl: string;
934
- snippets: (model: ModelData) => string[];
935
- filter: false;
936
- countDownloads: {
937
- term: {
938
- path: string;
939
- };
940
- };
941
- };
942
- nemo: {
943
- prettyLabel: string;
944
- repoName: string;
945
- repoUrl: string;
946
- snippets: (model: ModelData) => string[];
947
- filter: true;
948
- countDownloads: {
949
- wildcard: {
950
- path: string;
951
- };
952
- };
953
- };
954
- open_clip: {
955
- prettyLabel: string;
956
- repoName: string;
957
- repoUrl: string;
958
- snippets: (model: ModelData) => string[];
959
- filter: true;
960
- countDownloads: {
961
- wildcard: {
962
- path: string;
963
- };
964
- };
965
- };
966
- paddlenlp: {
967
- prettyLabel: string;
968
- repoName: string;
969
- repoUrl: string;
970
- docsUrl: string;
971
- snippets: (model: ModelData) => string[];
972
- filter: true;
973
- countDownloads: {
974
- term: {
975
- path: string;
976
- };
977
- };
978
- };
979
- peft: {
980
- prettyLabel: string;
981
- repoName: string;
982
- repoUrl: string;
983
- snippets: (model: ModelData) => string[];
984
- filter: true;
985
- countDownloads: {
986
- term: {
987
- path: string;
988
- };
989
- };
990
- };
991
- "pyannote-audio": {
992
- prettyLabel: string;
993
- repoName: string;
994
- repoUrl: string;
995
- snippets: (model: ModelData) => string[];
996
- filter: true;
997
- };
998
- pythae: {
999
- prettyLabel: string;
1000
- repoName: string;
1001
- repoUrl: string;
1002
- snippets: (model: ModelData) => string[];
1003
- filter: true;
1004
- };
1005
- "sample-factory": {
1006
- prettyLabel: string;
1007
- repoName: string;
1008
- repoUrl: string;
1009
- docsUrl: string;
1010
- snippets: (model: ModelData) => string[];
1011
- filter: true;
1012
- countDownloads: {
1013
- term: {
1014
- path: string;
1015
- };
1016
- };
1017
- };
1018
- "sentence-transformers": {
1019
- prettyLabel: string;
1020
- repoName: string;
1021
- repoUrl: string;
1022
- docsUrl: string;
1023
- snippets: (model: ModelData) => string[];
1024
- filter: true;
1025
- };
1026
- setfit: {
1027
- prettyLabel: string;
1028
- repoName: string;
1029
- repoUrl: string;
1030
- docsUrl: string;
1031
- snippets: (model: ModelData) => string[];
1032
- filter: true;
1033
- };
1034
- sklearn: {
1035
- prettyLabel: string;
1036
- repoName: string;
1037
- repoUrl: string;
1038
- snippets: (model: ModelData) => string[];
1039
- filter: true;
1040
- countDownloads: {
1041
- term: {
1042
- path: string;
1043
- };
1044
- };
1045
- };
1046
- spacy: {
1047
- prettyLabel: string;
1048
- repoName: string;
1049
- repoUrl: string;
1050
- docsUrl: string;
1051
- snippets: (model: ModelData) => string[];
1052
- filter: true;
1053
- countDownloads: {
1054
- wildcard: {
1055
- path: string;
1056
- };
1057
- };
1058
- };
1059
- "span-marker": {
1060
- prettyLabel: string;
1061
- repoName: string;
1062
- repoUrl: string;
1063
- docsUrl: string;
1064
- snippets: (model: ModelData) => string[];
1065
- filter: true;
1066
- };
1067
- speechbrain: {
1068
- prettyLabel: string;
1069
- repoName: string;
1070
- repoUrl: string;
1071
- docsUrl: string;
1072
- snippets: (model: ModelData) => string[];
1073
- filter: true;
1074
- countDownloads: {
1075
- term: {
1076
- path: string;
1077
- };
1078
- };
1079
- };
1080
- "stable-baselines3": {
1081
- prettyLabel: string;
1082
- repoName: string;
1083
- repoUrl: string;
1084
- docsUrl: string;
1085
- snippets: (model: ModelData) => string[];
1086
- filter: true;
1087
- countDownloads: {
1088
- wildcard: {
1089
- path: string;
1090
- };
1091
- };
1092
- };
1093
- stanza: {
1094
- prettyLabel: string;
1095
- repoName: string;
1096
- repoUrl: string;
1097
- docsUrl: string;
1098
- snippets: (model: ModelData) => string[];
1099
- filter: true;
1100
- countDownloads: {
1101
- term: {
1102
- path: string;
1103
- };
1104
- };
1105
- };
1106
- tensorflowtts: {
1107
- prettyLabel: string;
1108
- repoName: string;
1109
- repoUrl: string;
1110
- snippets: (model: ModelData) => string[];
1111
- };
1112
- timm: {
1113
- prettyLabel: string;
1114
- repoName: string;
1115
- repoUrl: string;
1116
- docsUrl: string;
1117
- snippets: (model: ModelData) => string[];
1118
- filter: true;
1119
- countDownloads: {
1120
- terms: {
1121
- path: string[];
1122
- };
1123
- };
1124
- };
1125
- transformers: {
1126
- prettyLabel: string;
1127
- repoName: string;
1128
- repoUrl: string;
1129
- docsUrl: string;
1130
- snippets: (model: ModelData) => string[];
1131
- filter: true;
1132
- };
1133
- "transformers.js": {
1134
- prettyLabel: string;
1135
- repoName: string;
1136
- repoUrl: string;
1137
- docsUrl: string;
1138
- snippets: (model: ModelData) => string[];
1139
- filter: true;
1140
- };
1141
- "unity-sentis": {
1142
- prettyLabel: string;
1143
- repoName: string;
1144
- repoUrl: string;
1145
- snippets: () => string[];
1146
- filter: true;
1147
- countDownloads: {
1148
- wildcard: {
1149
- path: string;
1150
- };
1151
- };
1152
- };
1153
- voicecraft: {
1154
- prettyLabel: string;
1155
- repoName: string;
1156
- repoUrl: string;
1157
- docsUrl: string;
1158
- snippets: (model: ModelData) => string[];
1159
- };
1160
- whisperkit: {
1161
- prettyLabel: string;
1162
- repoName: string;
1163
- repoUrl: string;
1164
- countDownloads: {
1165
- wildcard: {
1166
- path: string;
1167
- };
1168
- };
1169
- };
1170
- };
1171
- type ModelLibraryKey = keyof typeof MODEL_LIBRARIES_UI_ELEMENTS;
1172
- declare const ALL_MODEL_LIBRARY_KEYS: ("sklearn" | "adapter-transformers" | "allennlp" | "asteroid" | "audiocraft" | "bertopic" | "diffusers" | "doctr" | "elm" | "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")[];
1173
- declare const ALL_DISPLAY_MODEL_LIBRARY_KEYS: ("sklearn" | "adapter-transformers" | "allennlp" | "asteroid" | "audiocraft" | "bertopic" | "diffusers" | "doctr" | "elm" | "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")[];
1174
-
1175
- /**
1176
- * Mapping from library name to its supported tasks.
1177
- * Inference API (serverless) should be disabled for all other (library, task) pairs beyond this mapping.
1178
- * This mapping is partially generated automatically by "python-api-export-tasks" action in
1179
- * huggingface/api-inference-community repo upon merge. For transformers, the mapping is manually
1180
- * based on api-inference (hf_types.rs).
1181
- */
1182
- declare const LIBRARY_TASK_MAPPING: Partial<Record<ModelLibraryKey, PipelineType[]>>;
1183
-
1184
- type PerLanguageMapping = Map<WidgetType, string[] | WidgetExample[]>;
1185
- declare const MAPPING_DEFAULT_WIDGET: Map<string, PerLanguageMapping>;
1186
-
1187
- /**
1188
- * Inference code generated from the JSON schema spec in ./spec
1189
- *
1190
- * Using src/scripts/inference-codegen
1191
- */
1192
- /**
1193
- * Inputs for Audio Classification inference
1194
- */
1195
- interface AudioClassificationInput {
1196
- /**
1197
- * The input audio data
1198
- */
1199
- inputs: unknown;
1200
- /**
1201
- * Additional inference parameters
1202
- */
1203
- parameters?: AudioClassificationParameters;
1204
- [property: string]: unknown;
1205
- }
1206
- /**
1207
- * Additional inference parameters
1208
- *
1209
- * Additional inference parameters for Audio Classification
1210
- */
1211
- interface AudioClassificationParameters {
1212
- function_to_apply?: ClassificationOutputTransform$3;
1213
- /**
1214
- * When specified, limits the output to the top K most probable classes.
1215
- */
1216
- top_k?: number;
1217
- [property: string]: unknown;
1218
- }
1219
- /**
1220
- * The function to apply to the model outputs in order to retrieve the scores.
1221
- */
1222
- type ClassificationOutputTransform$3 = "sigmoid" | "softmax" | "none";
1223
- type AudioClassificationOutput = AudioClassificationOutputElement[];
1224
- /**
1225
- * Outputs for Audio Classification inference
1226
- */
1227
- interface AudioClassificationOutputElement {
1228
- /**
1229
- * The predicted class label.
1230
- */
1231
- label: string;
1232
- /**
1233
- * The corresponding probability.
1234
- */
1235
- score: number;
1236
- [property: string]: unknown;
1237
- }
1238
-
1239
- /**
1240
- * Inference code generated from the JSON schema spec in ./spec
1241
- *
1242
- * Using src/scripts/inference-codegen
1243
- */
1244
- /**
1245
- * Inputs for Automatic Speech Recognition inference
1246
- */
1247
- interface AutomaticSpeechRecognitionInput {
1248
- /**
1249
- * The input audio data
1250
- */
1251
- inputs: unknown;
1252
- /**
1253
- * Additional inference parameters
1254
- */
1255
- parameters?: AutomaticSpeechRecognitionParameters;
1256
- [property: string]: unknown;
1257
- }
1258
- /**
1259
- * Additional inference parameters
1260
- *
1261
- * Additional inference parameters for Automatic Speech Recognition
1262
- */
1263
- interface AutomaticSpeechRecognitionParameters {
1264
- /**
1265
- * Parametrization of the text generation process
1266
- */
1267
- generate?: GenerationParameters$2;
1268
- /**
1269
- * Whether to output corresponding timestamps with the generated text
1270
- */
1271
- return_timestamps?: boolean;
1272
- [property: string]: unknown;
1273
- }
1274
- /**
1275
- * Parametrization of the text generation process
1276
- *
1277
- * Ad-hoc parametrization of the text generation process
1278
- */
1279
- interface GenerationParameters$2 {
1280
- /**
1281
- * Whether to use sampling instead of greedy decoding when generating new tokens.
1282
- */
1283
- do_sample?: boolean;
1284
- /**
1285
- * Controls the stopping condition for beam-based methods.
1286
- */
1287
- early_stopping?: EarlyStoppingUnion$2;
1288
- /**
1289
- * If set to float strictly between 0 and 1, only tokens with a conditional probability
1290
- * greater than epsilon_cutoff will be sampled. In the paper, suggested values range from
1291
- * 3e-4 to 9e-4, depending on the size of the model. See [Truncation Sampling as Language
1292
- * Model Desmoothing](https://hf.co/papers/2210.15191) for more details.
1293
- */
1294
- epsilon_cutoff?: number;
1295
- /**
1296
- * Eta sampling is a hybrid of locally typical sampling and epsilon sampling. If set to
1297
- * float strictly between 0 and 1, a token is only considered if it is greater than either
1298
- * eta_cutoff or sqrt(eta_cutoff) * exp(-entropy(softmax(next_token_logits))). The latter
1299
- * term is intuitively the expected next token probability, scaled by sqrt(eta_cutoff). In
1300
- * the paper, suggested values range from 3e-4 to 2e-3, depending on the size of the model.
1301
- * See [Truncation Sampling as Language Model Desmoothing](https://hf.co/papers/2210.15191)
1302
- * for more details.
1303
- */
1304
- eta_cutoff?: number;
1305
- /**
1306
- * The maximum length (in tokens) of the generated text, including the input.
1307
- */
1308
- max_length?: number;
1309
- /**
1310
- * The maximum number of tokens to generate. Takes precedence over maxLength.
1311
- */
1312
- max_new_tokens?: number;
1313
- /**
1314
- * The minimum length (in tokens) of the generated text, including the input.
1315
- */
1316
- min_length?: number;
1317
- /**
1318
- * The minimum number of tokens to generate. Takes precedence over maxLength.
1319
- */
1320
- min_new_tokens?: number;
1321
- /**
1322
- * Number of groups to divide num_beams into in order to ensure diversity among different
1323
- * groups of beams. See [this paper](https://hf.co/papers/1610.02424) for more details.
1324
- */
1325
- num_beam_groups?: number;
1326
- /**
1327
- * Number of beams to use for beam search.
1328
- */
1329
- num_beams?: number;
1330
- /**
1331
- * The value balances the model confidence and the degeneration penalty in contrastive
1332
- * search decoding.
1333
- */
1334
- penalty_alpha?: number;
1335
- /**
1336
- * The value used to modulate the next token probabilities.
1337
- */
1338
- temperature?: number;
1339
- /**
1340
- * The number of highest probability vocabulary tokens to keep for top-k-filtering.
1341
- */
1342
- top_k?: number;
1343
- /**
1344
- * If set to float < 1, only the smallest set of most probable tokens with probabilities
1345
- * that add up to top_p or higher are kept for generation.
1346
- */
1347
- top_p?: number;
1348
- /**
1349
- * Local typicality measures how similar the conditional probability of predicting a target
1350
- * token next is to the expected conditional probability of predicting a random token next,
1351
- * given the partial text already generated. If set to float < 1, the smallest set of the
1352
- * most locally typical tokens with probabilities that add up to typical_p or higher are
1353
- * kept for generation. See [this paper](https://hf.co/papers/2202.00666) for more details.
1354
- */
1355
- typical_p?: number;
1356
- /**
1357
- * Whether the model should use the past last key/values attentions to speed up decoding
1358
- */
1359
- use_cache?: boolean;
1360
- [property: string]: unknown;
1361
- }
1362
- /**
1363
- * Controls the stopping condition for beam-based methods.
1364
- */
1365
- type EarlyStoppingUnion$2 = boolean | "never";
1366
- /**
1367
- * Outputs of inference for the Automatic Speech Recognition task
1368
- */
1369
- interface AutomaticSpeechRecognitionOutput {
1370
- /**
1371
- * When returnTimestamps is enabled, chunks contains a list of audio chunks identified by
1372
- * the model.
1373
- */
1374
- chunks?: AutomaticSpeechRecognitionOutputChunk[];
1375
- /**
1376
- * The recognized text.
1377
- */
1378
- text: string;
1379
- [property: string]: unknown;
1380
- }
1381
- interface AutomaticSpeechRecognitionOutputChunk {
1382
- /**
1383
- * A chunk of text identified by the model
1384
- */
1385
- text: string;
1386
- /**
1387
- * The start and end timestamps corresponding with the text
1388
- */
1389
- timestamps: number[];
1390
- [property: string]: unknown;
1391
- }
1392
-
1393
- /**
1394
- * Inference code generated from the JSON schema spec in ./spec
1395
- *
1396
- * Using src/scripts/inference-codegen
1397
- */
1398
- /**
1399
- * Inputs for ChatCompletion inference
1400
- */
1401
- interface ChatCompletionInput {
1402
- /**
1403
- * Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing
1404
- * frequency in the text so far, decreasing the model's likelihood to repeat the same line
1405
- * verbatim.
1406
- */
1407
- frequency_penalty?: number;
1408
- /**
1409
- * The maximum number of tokens that can be generated in the chat completion.
1410
- */
1411
- max_tokens?: number;
1412
- messages: ChatCompletionInputMessage[];
1413
- /**
1414
- * The random sampling seed.
1415
- */
1416
- seed?: number;
1417
- /**
1418
- * Stop generating tokens if a stop token is generated.
1419
- */
1420
- stop?: ChatCompletionInputStopReason;
1421
- /**
1422
- * If set, partial message deltas will be sent.
1423
- */
1424
- stream?: boolean;
1425
- /**
1426
- * The value used to modulate the logits distribution.
1427
- */
1428
- temperature?: number;
1429
- /**
1430
- * If set to < 1, only the smallest set of most probable tokens with probabilities that add
1431
- * up to `top_p` or higher are kept for generation.
1432
- */
1433
- top_p?: number;
1434
- [property: string]: unknown;
1435
- }
1436
- interface ChatCompletionInputMessage {
1437
- /**
1438
- * The content of the message.
1439
- */
1440
- content: string;
1441
- role: ChatCompletionMessageRole;
1442
- [property: string]: unknown;
1443
- }
1444
- /**
1445
- * The role of the message author.
1446
- */
1447
- type ChatCompletionMessageRole = "assistant" | "system" | "user";
1448
- /**
1449
- * Stop generating tokens if a stop token is generated.
1450
- */
1451
- type ChatCompletionInputStopReason = string[] | string;
1452
- /**
1453
- * Outputs for Chat Completion inference
1454
- */
1455
- interface ChatCompletionOutput {
1456
- /**
1457
- * A list of chat completion choices.
1458
- */
1459
- choices: ChatCompletionOutputChoice[];
1460
- /**
1461
- * The Unix timestamp (in seconds) of when the chat completion was created.
1462
- */
1463
- created: number;
1464
- [property: string]: unknown;
1465
- }
1466
- interface ChatCompletionOutputChoice {
1467
- /**
1468
- * The reason why the generation was stopped.
1469
- */
1470
- finish_reason: ChatCompletionFinishReason;
1471
- /**
1472
- * The index of the choice in the list of choices.
1473
- */
1474
- index: number;
1475
- message: ChatCompletionOutputChoiceMessage;
1476
- [property: string]: unknown;
1477
- }
1478
- /**
1479
- * The reason why the generation was stopped.
1480
- *
1481
- * The generated sequence reached the maximum allowed length
1482
- *
1483
- * The model generated an end-of-sentence (EOS) token
1484
- *
1485
- * One of the sequence in stop_sequences was generated
1486
- */
1487
- type ChatCompletionFinishReason = "length" | "eos_token" | "stop_sequence";
1488
- interface ChatCompletionOutputChoiceMessage {
1489
- /**
1490
- * The content of the chat completion message.
1491
- */
1492
- content: string;
1493
- role: ChatCompletionMessageRole;
1494
- [property: string]: unknown;
1495
- }
1496
- /**
1497
- * Chat Completion Stream Output
1498
- */
1499
- interface ChatCompletionStreamOutput {
1500
- /**
1501
- * A list of chat completion choices.
1502
- */
1503
- choices: ChatCompletionStreamOutputChoice[];
1504
- /**
1505
- * The Unix timestamp (in seconds) of when the chat completion was created. Each chunk has
1506
- * the same timestamp.
1507
- */
1508
- created: number;
1509
- [property: string]: unknown;
1510
- }
1511
- interface ChatCompletionStreamOutputChoice {
1512
- /**
1513
- * A chat completion delta generated by streamed model responses.
1514
- */
1515
- delta: ChatCompletionStreamOutputDelta;
1516
- /**
1517
- * The reason why the generation was stopped.
1518
- */
1519
- finish_reason?: ChatCompletionFinishReason;
1520
- /**
1521
- * The index of the choice in the list of choices.
1522
- */
1523
- index: number;
1524
- [property: string]: unknown;
1525
- }
1526
- /**
1527
- * A chat completion delta generated by streamed model responses.
1528
- */
1529
- interface ChatCompletionStreamOutputDelta {
1530
- /**
1531
- * The contents of the chunk message.
1532
- */
1533
- content?: string;
1534
- /**
1535
- * The role of the author of this message.
1536
- */
1537
- role?: string;
1538
- [property: string]: unknown;
1539
- }
1540
-
1541
- /**
1542
- * Inference code generated from the JSON schema spec in ./spec
1543
- *
1544
- * Using src/scripts/inference-codegen
1545
- */
1546
- /**
1547
- * Inputs for Document Question Answering inference
1548
- */
1549
- interface DocumentQuestionAnsweringInput {
1550
- /**
1551
- * One (document, question) pair to answer
1552
- */
1553
- inputs: DocumentQuestionAnsweringInputData;
1554
- /**
1555
- * Additional inference parameters
1556
- */
1557
- parameters?: DocumentQuestionAnsweringParameters;
1558
- [property: string]: unknown;
1559
- }
1560
- /**
1561
- * One (document, question) pair to answer
1562
- */
1563
- interface DocumentQuestionAnsweringInputData {
1564
- /**
1565
- * The image on which the question is asked
1566
- */
1567
- image: unknown;
1568
- /**
1569
- * A question to ask of the document
1570
- */
1571
- question: string;
1572
- [property: string]: unknown;
1573
- }
1574
- /**
1575
- * Additional inference parameters
1576
- *
1577
- * Additional inference parameters for Document Question Answering
1578
- */
1579
- interface DocumentQuestionAnsweringParameters {
1580
- /**
1581
- * If the words in the document are too long to fit with the question for the model, it will
1582
- * be split in several chunks with some overlap. This argument controls the size of that
1583
- * overlap.
1584
- */
1585
- doc_stride?: number;
1586
- /**
1587
- * Whether to accept impossible as an answer
1588
- */
1589
- handle_impossible_answer?: boolean;
1590
- /**
1591
- * Language to use while running OCR. Defaults to english.
1592
- */
1593
- lang?: string;
1594
- /**
1595
- * The maximum length of predicted answers (e.g., only answers with a shorter length are
1596
- * considered).
1597
- */
1598
- max_answer_len?: number;
1599
- /**
1600
- * The maximum length of the question after tokenization. It will be truncated if needed.
1601
- */
1602
- max_question_len?: number;
1603
- /**
1604
- * The maximum length of the total sentence (context + question) in tokens of each chunk
1605
- * passed to the model. The context will be split in several chunks (using doc_stride as
1606
- * overlap) if needed.
1607
- */
1608
- max_seq_len?: number;
1609
- /**
1610
- * The number of answers to return (will be chosen by order of likelihood). Can return less
1611
- * than top_k answers if there are not enough options available within the context.
1612
- */
1613
- top_k?: number;
1614
- /**
1615
- * A list of words and bounding boxes (normalized 0->1000). If provided, the inference will
1616
- * skip the OCR step and use the provided bounding boxes instead.
1617
- */
1618
- word_boxes?: WordBox[];
1619
- [property: string]: unknown;
1620
- }
1621
- type WordBox = number[] | string;
1622
- type DocumentQuestionAnsweringOutput = DocumentQuestionAnsweringOutputElement[];
1623
- /**
1624
- * Outputs of inference for the Document Question Answering task
1625
- */
1626
- interface DocumentQuestionAnsweringOutputElement {
1627
- /**
1628
- * The answer to the question.
1629
- */
1630
- answer: string;
1631
- /**
1632
- * The end word index of the answer (in the OCR’d version of the input or provided word
1633
- * boxes).
1634
- */
1635
- end: number;
1636
- /**
1637
- * The probability associated to the answer.
1638
- */
1639
- score: number;
1640
- /**
1641
- * The start word index of the answer (in the OCR’d version of the input or provided word
1642
- * boxes).
1643
- */
1644
- start: number;
1645
- /**
1646
- * The index of each word/box pair that is in the answer
1647
- */
1648
- words: number[];
1649
- [property: string]: unknown;
1650
- }
1651
-
1652
- /**
1653
- * Inference code generated from the JSON schema spec in ./spec
1654
- *
1655
- * Using src/scripts/inference-codegen
1656
- */
1657
- type FeatureExtractionOutput = unknown[];
1658
- /**
1659
- * Inputs for Text Embedding inference
1660
- */
1661
- interface FeatureExtractionInput {
1662
- /**
1663
- * The text to get the embeddings of
1664
- */
1665
- inputs: string;
1666
- /**
1667
- * Additional inference parameters
1668
- */
1669
- parameters?: {
1670
- [key: string]: unknown;
1671
- };
1672
- [property: string]: unknown;
1673
- }
1674
-
1675
- /**
1676
- * Inference code generated from the JSON schema spec in ./spec
1677
- *
1678
- * Using src/scripts/inference-codegen
1679
- */
1680
- /**
1681
- * Inputs for Fill Mask inference
1682
- */
1683
- interface FillMaskInput {
1684
- /**
1685
- * The text with masked tokens
1686
- */
1687
- inputs: string;
1688
- /**
1689
- * Additional inference parameters
1690
- */
1691
- parameters?: FillMaskParameters;
1692
- [property: string]: unknown;
1693
- }
1694
- /**
1695
- * Additional inference parameters
1696
- *
1697
- * Additional inference parameters for Fill Mask
1698
- */
1699
- interface FillMaskParameters {
1700
- /**
1701
- * When passed, the model will limit the scores to the passed targets instead of looking up
1702
- * in the whole vocabulary. If the provided targets are not in the model vocab, they will be
1703
- * tokenized and the first resulting token will be used (with a warning, and that might be
1704
- * slower).
1705
- */
1706
- targets?: string[];
1707
- /**
1708
- * When passed, overrides the number of predictions to return.
1709
- */
1710
- top_k?: number;
1711
- [property: string]: unknown;
1712
- }
1713
- type FillMaskOutput = FillMaskOutputElement[];
1714
- /**
1715
- * Outputs of inference for the Fill Mask task
1716
- */
1717
- interface FillMaskOutputElement {
1718
- /**
1719
- * The corresponding probability
1720
- */
1721
- score: number;
1722
- /**
1723
- * The corresponding input with the mask token prediction.
1724
- */
1725
- sequence: string;
1726
- /**
1727
- * The predicted token id (to replace the masked one).
1728
- */
1729
- token: number;
1730
- tokenStr: unknown;
1731
- /**
1732
- * The predicted token (to replace the masked one).
1733
- */
1734
- token_str?: string;
1735
- [property: string]: unknown;
1736
- }
1737
-
1738
- /**
1739
- * Inference code generated from the JSON schema spec in ./spec
1740
- *
1741
- * Using src/scripts/inference-codegen
1742
- */
1743
- /**
1744
- * Inputs for Image Classification inference
1745
- */
1746
- interface ImageClassificationInput {
1747
- /**
1748
- * The input image data
1749
- */
1750
- inputs: unknown;
1751
- /**
1752
- * Additional inference parameters
1753
- */
1754
- parameters?: ImageClassificationParameters;
1755
- [property: string]: unknown;
1756
- }
1757
- /**
1758
- * Additional inference parameters
1759
- *
1760
- * Additional inference parameters for Image Classification
1761
- */
1762
- interface ImageClassificationParameters {
1763
- function_to_apply?: ClassificationOutputTransform$2;
1764
- /**
1765
- * When specified, limits the output to the top K most probable classes.
1766
- */
1767
- top_k?: number;
1768
- [property: string]: unknown;
1769
- }
1770
- /**
1771
- * The function to apply to the model outputs in order to retrieve the scores.
1772
- */
1773
- type ClassificationOutputTransform$2 = "sigmoid" | "softmax" | "none";
1774
- type ImageClassificationOutput = ImageClassificationOutputElement[];
1775
- /**
1776
- * Outputs of inference for the Image Classification task
1777
- */
1778
- interface ImageClassificationOutputElement {
1779
- /**
1780
- * The predicted class label.
1781
- */
1782
- label: string;
1783
- /**
1784
- * The corresponding probability.
1785
- */
1786
- score: number;
1787
- [property: string]: unknown;
1788
- }
1789
-
1790
- /**
1791
- * Inference code generated from the JSON schema spec in ./spec
1792
- *
1793
- * Using src/scripts/inference-codegen
1794
- */
1795
- /**
1796
- * Inputs for Image To Image inference
1797
- */
1798
- interface ImageToImageInput {
1799
- /**
1800
- * The input image data
1801
- */
1802
- inputs: unknown;
1803
- /**
1804
- * Additional inference parameters
1805
- */
1806
- parameters?: ImageToImageParameters;
1807
- [property: string]: unknown;
1808
- }
1809
- /**
1810
- * Additional inference parameters
1811
- *
1812
- * Additional inference parameters for Image To Image
1813
- */
1814
- interface ImageToImageParameters {
1815
- /**
1816
- * For diffusion models. A higher guidance scale value encourages the model to generate
1817
- * images closely linked to the text prompt at the expense of lower image quality.
1818
- */
1819
- guidance_scale?: number;
1820
- /**
1821
- * One or several prompt to guide what NOT to include in image generation.
1822
- */
1823
- negative_prompt?: string[];
1824
- /**
1825
- * For diffusion models. The number of denoising steps. More denoising steps usually lead to
1826
- * a higher quality image at the expense of slower inference.
1827
- */
1828
- num_inference_steps?: number;
1829
- /**
1830
- * The size in pixel of the output image
1831
- */
1832
- target_size?: TargetSize$1;
1833
- [property: string]: unknown;
1834
- }
1835
- /**
1836
- * The size in pixel of the output image
1837
- */
1838
- interface TargetSize$1 {
1839
- height: number;
1840
- width: number;
1841
- [property: string]: unknown;
1842
- }
1843
- /**
1844
- * Outputs of inference for the Image To Image task
1845
- */
1846
- interface ImageToImageOutput {
1847
- /**
1848
- * The output image
1849
- */
1850
- image?: unknown;
1851
- [property: string]: unknown;
1852
- }
1853
-
1854
- /**
1855
- * Inference code generated from the JSON schema spec in ./spec
1856
- *
1857
- * Using src/scripts/inference-codegen
1858
- */
1859
- /**
1860
- * Inputs for Image To Text inference
1861
- */
1862
- interface ImageToTextInput {
1863
- /**
1864
- * The input image data
1865
- */
1866
- inputs: unknown;
1867
- /**
1868
- * Additional inference parameters
1869
- */
1870
- parameters?: ImageToTextParameters;
1871
- [property: string]: unknown;
1872
- }
1873
- /**
1874
- * Additional inference parameters
1875
- *
1876
- * Additional inference parameters for Image To Text
1877
- */
1878
- interface ImageToTextParameters {
1879
- /**
1880
- * Parametrization of the text generation process
1881
- */
1882
- generate?: GenerationParameters$1;
1883
- /**
1884
- * The amount of maximum tokens to generate.
1885
- */
1886
- max_new_tokens?: number;
1887
- [property: string]: unknown;
1888
- }
1889
- /**
1890
- * Parametrization of the text generation process
1891
- *
1892
- * Ad-hoc parametrization of the text generation process
1893
- */
1894
- interface GenerationParameters$1 {
1895
- /**
1896
- * Whether to use sampling instead of greedy decoding when generating new tokens.
1897
- */
1898
- do_sample?: boolean;
1899
- /**
1900
- * Controls the stopping condition for beam-based methods.
1901
- */
1902
- early_stopping?: EarlyStoppingUnion$1;
1903
- /**
1904
- * If set to float strictly between 0 and 1, only tokens with a conditional probability
1905
- * greater than epsilon_cutoff will be sampled. In the paper, suggested values range from
1906
- * 3e-4 to 9e-4, depending on the size of the model. See [Truncation Sampling as Language
1907
- * Model Desmoothing](https://hf.co/papers/2210.15191) for more details.
1908
- */
1909
- epsilon_cutoff?: number;
1910
- /**
1911
- * Eta sampling is a hybrid of locally typical sampling and epsilon sampling. If set to
1912
- * float strictly between 0 and 1, a token is only considered if it is greater than either
1913
- * eta_cutoff or sqrt(eta_cutoff) * exp(-entropy(softmax(next_token_logits))). The latter
1914
- * term is intuitively the expected next token probability, scaled by sqrt(eta_cutoff). In
1915
- * the paper, suggested values range from 3e-4 to 2e-3, depending on the size of the model.
1916
- * See [Truncation Sampling as Language Model Desmoothing](https://hf.co/papers/2210.15191)
1917
- * for more details.
1918
- */
1919
- eta_cutoff?: number;
1920
- /**
1921
- * The maximum length (in tokens) of the generated text, including the input.
1922
- */
1923
- max_length?: number;
1924
- /**
1925
- * The maximum number of tokens to generate. Takes precedence over maxLength.
1926
- */
1927
- max_new_tokens?: number;
1928
- /**
1929
- * The minimum length (in tokens) of the generated text, including the input.
1930
- */
1931
- min_length?: number;
1932
- /**
1933
- * The minimum number of tokens to generate. Takes precedence over maxLength.
1934
- */
1935
- min_new_tokens?: number;
1936
- /**
1937
- * Number of groups to divide num_beams into in order to ensure diversity among different
1938
- * groups of beams. See [this paper](https://hf.co/papers/1610.02424) for more details.
1939
- */
1940
- num_beam_groups?: number;
1941
- /**
1942
- * Number of beams to use for beam search.
1943
- */
1944
- num_beams?: number;
1945
- /**
1946
- * The value balances the model confidence and the degeneration penalty in contrastive
1947
- * search decoding.
1948
- */
1949
- penalty_alpha?: number;
1950
- /**
1951
- * The value used to modulate the next token probabilities.
1952
- */
1953
- temperature?: number;
1954
- /**
1955
- * The number of highest probability vocabulary tokens to keep for top-k-filtering.
1956
- */
1957
- top_k?: number;
1958
- /**
1959
- * If set to float < 1, only the smallest set of most probable tokens with probabilities
1960
- * that add up to top_p or higher are kept for generation.
1961
- */
1962
- top_p?: number;
1963
- /**
1964
- * Local typicality measures how similar the conditional probability of predicting a target
1965
- * token next is to the expected conditional probability of predicting a random token next,
1966
- * given the partial text already generated. If set to float < 1, the smallest set of the
1967
- * most locally typical tokens with probabilities that add up to typical_p or higher are
1968
- * kept for generation. See [this paper](https://hf.co/papers/2202.00666) for more details.
1969
- */
1970
- typical_p?: number;
1971
- /**
1972
- * Whether the model should use the past last key/values attentions to speed up decoding
1973
- */
1974
- use_cache?: boolean;
1975
- [property: string]: unknown;
1976
- }
1977
- /**
1978
- * Controls the stopping condition for beam-based methods.
1979
- */
1980
- type EarlyStoppingUnion$1 = boolean | "never";
1981
- /**
1982
- * Outputs of inference for the Image To Text task
1983
- */
1984
- interface ImageToTextOutput {
1985
- generatedText: unknown;
1986
- /**
1987
- * The generated text.
1988
- */
1989
- generated_text?: string;
1990
- [property: string]: unknown;
1991
- }
1992
-
1993
- /**
1994
- * Inference code generated from the JSON schema spec in ./spec
1995
- *
1996
- * Using src/scripts/inference-codegen
1997
- */
1998
- /**
1999
- * Inputs for Image Segmentation inference
2000
- */
2001
- interface ImageSegmentationInput {
2002
- /**
2003
- * The input image data
2004
- */
2005
- inputs: unknown;
2006
- /**
2007
- * Additional inference parameters
2008
- */
2009
- parameters?: ImageSegmentationParameters;
2010
- [property: string]: unknown;
2011
- }
2012
- /**
2013
- * Additional inference parameters
2014
- *
2015
- * Additional inference parameters for Image Segmentation
2016
- */
2017
- interface ImageSegmentationParameters {
2018
- /**
2019
- * Threshold to use when turning the predicted masks into binary values.
2020
- */
2021
- mask_threshold?: number;
2022
- /**
2023
- * Mask overlap threshold to eliminate small, disconnected segments.
2024
- */
2025
- overlap_mask_area_threshold?: number;
2026
- /**
2027
- * Segmentation task to be performed, depending on model capabilities.
2028
- */
2029
- subtask?: ImageSegmentationSubtask;
2030
- /**
2031
- * Probability threshold to filter out predicted masks.
2032
- */
2033
- threshold?: number;
2034
- [property: string]: unknown;
2035
- }
2036
- type ImageSegmentationSubtask = "instance" | "panoptic" | "semantic";
2037
- type ImageSegmentationOutput = ImageSegmentationOutputElement[];
2038
- /**
2039
- * Outputs of inference for the Image Segmentation task
2040
- *
2041
- * A predicted mask / segment
2042
- */
2043
- interface ImageSegmentationOutputElement {
2044
- /**
2045
- * The label of the predicted segment
2046
- */
2047
- label: string;
2048
- /**
2049
- * The corresponding mask as a black-and-white image
2050
- */
2051
- mask: unknown;
2052
- /**
2053
- * The score or confidence degreee the model has
2054
- */
2055
- score?: number;
2056
- [property: string]: unknown;
2057
- }
2058
-
2059
- /**
2060
- * Inference code generated from the JSON schema spec in ./spec
2061
- *
2062
- * Using src/scripts/inference-codegen
2063
- */
2064
- /**
2065
- * Inputs for Object Detection inference
2066
- */
2067
- interface ObjectDetectionInput {
2068
- /**
2069
- * The input image data
2070
- */
2071
- inputs: unknown;
2072
- /**
2073
- * Additional inference parameters
2074
- */
2075
- parameters?: ObjectDetectionParameters;
2076
- [property: string]: unknown;
2077
- }
2078
- /**
2079
- * Additional inference parameters
2080
- *
2081
- * Additional inference parameters for Object Detection
2082
- */
2083
- interface ObjectDetectionParameters {
2084
- /**
2085
- * The probability necessary to make a prediction.
2086
- */
2087
- threshold?: number;
2088
- [property: string]: unknown;
2089
- }
2090
- /**
2091
- * The predicted bounding box. Coordinates are relative to the top left corner of the input
2092
- * image.
2093
- */
2094
- interface BoundingBox$1 {
2095
- xmax: number;
2096
- xmin: number;
2097
- ymax: number;
2098
- ymin: number;
2099
- [property: string]: unknown;
2100
- }
2101
- type ObjectDetectionOutput = ObjectDetectionOutputElement[];
2102
- /**
2103
- * Outputs of inference for the Object Detection task
2104
- */
2105
- interface ObjectDetectionOutputElement {
2106
- /**
2107
- * The predicted bounding box. Coordinates are relative to the top left corner of the input
2108
- * image.
2109
- */
2110
- box: BoundingBox$1;
2111
- /**
2112
- * The predicted label for the bounding box
2113
- */
2114
- label: string;
2115
- /**
2116
- * The associated score / probability
2117
- */
2118
- score: number;
2119
- [property: string]: unknown;
2120
- }
2121
-
2122
- /**
2123
- * Inference code generated from the JSON schema spec in ./spec
2124
- *
2125
- * Using src/scripts/inference-codegen
2126
- */
2127
- /**
2128
- * Inputs for Depth Estimation inference
2129
- */
2130
- interface DepthEstimationInput {
2131
- /**
2132
- * The input image data
2133
- */
2134
- inputs: unknown;
2135
- /**
2136
- * Additional inference parameters
2137
- */
2138
- parameters?: {
2139
- [key: string]: unknown;
2140
- };
2141
- [property: string]: unknown;
2142
- }
2143
- /**
2144
- * Outputs of inference for the Depth Estimation task
2145
- */
2146
- interface DepthEstimationOutput {
2147
- /**
2148
- * The predicted depth as an image
2149
- */
2150
- depth?: unknown;
2151
- /**
2152
- * The predicted depth as a tensor
2153
- */
2154
- predicted_depth?: unknown;
2155
- [property: string]: unknown;
2156
- }
2157
-
2158
- /**
2159
- * Inference code generated from the JSON schema spec in ./spec
2160
- *
2161
- * Using src/scripts/inference-codegen
2162
- */
2163
- /**
2164
- * Inputs for Question Answering inference
2165
- */
2166
- interface QuestionAnsweringInput {
2167
- /**
2168
- * One (context, question) pair to answer
2169
- */
2170
- inputs: QuestionAnsweringInputData;
2171
- /**
2172
- * Additional inference parameters
2173
- */
2174
- parameters?: QuestionAnsweringParameters;
2175
- [property: string]: unknown;
2176
- }
2177
- /**
2178
- * One (context, question) pair to answer
2179
- */
2180
- interface QuestionAnsweringInputData {
2181
- /**
2182
- * The context to be used for answering the question
2183
- */
2184
- context: string;
2185
- /**
2186
- * The question to be answered
2187
- */
2188
- question: string;
2189
- [property: string]: unknown;
2190
- }
2191
- /**
2192
- * Additional inference parameters
2193
- *
2194
- * Additional inference parameters for Question Answering
2195
- */
2196
- interface QuestionAnsweringParameters {
2197
- /**
2198
- * Attempts to align the answer to real words. Improves quality on space separated
2199
- * languages. Might hurt on non-space-separated languages (like Japanese or Chinese)
2200
- */
2201
- align_to_words?: boolean;
2202
- /**
2203
- * If the context is too long to fit with the question for the model, it will be split in
2204
- * several chunks with some overlap. This argument controls the size of that overlap.
2205
- */
2206
- doc_stride?: number;
2207
- /**
2208
- * Whether to accept impossible as an answer.
2209
- */
2210
- handle_impossible_answer?: boolean;
2211
- /**
2212
- * The maximum length of predicted answers (e.g., only answers with a shorter length are
2213
- * considered).
2214
- */
2215
- max_answer_len?: number;
2216
- /**
2217
- * The maximum length of the question after tokenization. It will be truncated if needed.
2218
- */
2219
- max_question_len?: number;
2220
- /**
2221
- * The maximum length of the total sentence (context + question) in tokens of each chunk
2222
- * passed to the model. The context will be split in several chunks (using docStride as
2223
- * overlap) if needed.
2224
- */
2225
- max_seq_len?: number;
2226
- /**
2227
- * The number of answers to return (will be chosen by order of likelihood). Note that we
2228
- * return less than topk answers if there are not enough options available within the
2229
- * context.
2230
- */
2231
- top_k?: number;
2232
- [property: string]: unknown;
2233
- }
2234
- type QuestionAnsweringOutput = QuestionAnsweringOutputElement[];
2235
- /**
2236
- * Outputs of inference for the Question Answering task
2237
- */
2238
- interface QuestionAnsweringOutputElement {
2239
- /**
2240
- * The answer to the question.
2241
- */
2242
- answer: string;
2243
- /**
2244
- * The character position in the input where the answer ends.
2245
- */
2246
- end: number;
2247
- /**
2248
- * The probability associated to the answer.
2249
- */
2250
- score: number;
2251
- /**
2252
- * The character position in the input where the answer begins.
2253
- */
2254
- start: number;
2255
- [property: string]: unknown;
2256
- }
2257
-
2258
- /**
2259
- * Inference code generated from the JSON schema spec in ./spec
2260
- *
2261
- * Using src/scripts/inference-codegen
2262
- */
2263
- type SentenceSimilarityOutput = number[];
2264
- /**
2265
- * Inputs for Sentence similarity inference
2266
- */
2267
- interface SentenceSimilarityInput {
2268
- inputs: SentenceSimilarityInputData;
2269
- /**
2270
- * Additional inference parameters
2271
- */
2272
- parameters?: {
2273
- [key: string]: unknown;
2274
- };
2275
- [property: string]: unknown;
2276
- }
2277
- interface SentenceSimilarityInputData {
2278
- /**
2279
- * A list of strings which will be compared against the source_sentence.
2280
- */
2281
- sentences: string[];
2282
- /**
2283
- * The string that you wish to compare the other strings with. This can be a phrase,
2284
- * sentence, or longer passage, depending on the model being used.
2285
- */
2286
- sourceSentence: string;
2287
- [property: string]: unknown;
2288
- }
2289
-
2290
- /**
2291
- * Inference code generated from the JSON schema spec in ./spec
2292
- *
2293
- * Using src/scripts/inference-codegen
2294
- */
2295
- /**
2296
- * Inputs for Summarization inference
2297
- *
2298
- * Inputs for Text2text Generation inference
2299
- */
2300
- interface SummarizationInput {
2301
- /**
2302
- * The input text data
2303
- */
2304
- inputs: string;
2305
- /**
2306
- * Additional inference parameters
2307
- */
2308
- parameters?: Text2TextGenerationParameters$1;
2309
- [property: string]: unknown;
2310
- }
2311
- /**
2312
- * Additional inference parameters
2313
- *
2314
- * Additional inference parameters for Text2text Generation
2315
- */
2316
- interface Text2TextGenerationParameters$1 {
2317
- /**
2318
- * Whether to clean up the potential extra spaces in the text output.
2319
- */
2320
- clean_up_tokenization_spaces?: boolean;
2321
- /**
2322
- * Additional parametrization of the text generation algorithm
2323
- */
2324
- generate_parameters?: {
2325
- [key: string]: unknown;
2326
- };
2327
- /**
2328
- * The truncation strategy to use
2329
- */
2330
- truncation?: Text2TextGenerationTruncationStrategy$1;
2331
- [property: string]: unknown;
2332
- }
2333
- type Text2TextGenerationTruncationStrategy$1 = "do_not_truncate" | "longest_first" | "only_first" | "only_second";
2334
- /**
2335
- * Outputs of inference for the Summarization task
2336
- */
2337
- interface SummarizationOutput {
2338
- /**
2339
- * The summarized text.
2340
- */
2341
- summary_text: string;
2342
- [property: string]: unknown;
2343
- }
2344
-
2345
- /**
2346
- * Inference code generated from the JSON schema spec in ./spec
2347
- *
2348
- * Using src/scripts/inference-codegen
2349
- */
2350
- /**
2351
- * Inputs for Table Question Answering inference
2352
- */
2353
- interface TableQuestionAnsweringInput {
2354
- /**
2355
- * One (table, question) pair to answer
2356
- */
2357
- inputs: TableQuestionAnsweringInputData;
2358
- /**
2359
- * Additional inference parameters
2360
- */
2361
- parameters?: {
2362
- [key: string]: unknown;
2363
- };
2364
- [property: string]: unknown;
2365
- }
2366
- /**
2367
- * One (table, question) pair to answer
2368
- */
2369
- interface TableQuestionAnsweringInputData {
2370
- /**
2371
- * The question to be answered about the table
2372
- */
2373
- question: string;
2374
- /**
2375
- * The table to serve as context for the questions
2376
- */
2377
- table: {
2378
- [key: string]: string[];
2379
- };
2380
- [property: string]: unknown;
2381
- }
2382
- type TableQuestionAnsweringOutput = TableQuestionAnsweringOutputElement[];
2383
- /**
2384
- * Outputs of inference for the Table Question Answering task
2385
- */
2386
- interface TableQuestionAnsweringOutputElement {
2387
- /**
2388
- * If the model has an aggregator, this returns the aggregator.
2389
- */
2390
- aggregator?: string;
2391
- /**
2392
- * The answer of the question given the table. If there is an aggregator, the answer will be
2393
- * preceded by `AGGREGATOR >`.
2394
- */
2395
- answer: string;
2396
- /**
2397
- * List of strings made up of the answer cell values.
2398
- */
2399
- cells: string[];
2400
- /**
2401
- * Coordinates of the cells of the answers.
2402
- */
2403
- coordinates: Array<number[]>;
2404
- [property: string]: unknown;
2405
- }
2406
-
2407
- /**
2408
- * Inference code generated from the JSON schema spec in ./spec
2409
- *
2410
- * Using src/scripts/inference-codegen
2411
- */
2412
- /**
2413
- * Inputs for Text To Image inference
2414
- */
2415
- interface TextToImageInput {
2416
- /**
2417
- * The input text data (sometimes called "prompt"
2418
- */
2419
- inputs: string;
2420
- /**
2421
- * Additional inference parameters
2422
- */
2423
- parameters?: TextToImageParameters;
2424
- [property: string]: unknown;
2425
- }
2426
- /**
2427
- * Additional inference parameters
2428
- *
2429
- * Additional inference parameters for Text To Image
2430
- */
2431
- interface TextToImageParameters {
2432
- /**
2433
- * For diffusion models. A higher guidance scale value encourages the model to generate
2434
- * images closely linked to the text prompt at the expense of lower image quality.
2435
- */
2436
- guidance_scale?: number;
2437
- /**
2438
- * One or several prompt to guide what NOT to include in image generation.
2439
- */
2440
- negative_prompt?: string[];
2441
- /**
2442
- * For diffusion models. The number of denoising steps. More denoising steps usually lead to
2443
- * a higher quality image at the expense of slower inference.
2444
- */
2445
- num_inference_steps?: number;
2446
- /**
2447
- * For diffusion models. Override the scheduler with a compatible one
2448
- */
2449
- scheduler?: string;
2450
- /**
2451
- * The size in pixel of the output image
2452
- */
2453
- target_size?: TargetSize;
2454
- [property: string]: unknown;
2455
- }
2456
- /**
2457
- * The size in pixel of the output image
2458
- */
2459
- interface TargetSize {
2460
- height: number;
2461
- width: number;
2462
- [property: string]: unknown;
2463
- }
2464
- /**
2465
- * Outputs of inference for the Text To Image task
2466
- */
2467
- interface TextToImageOutput {
2468
- /**
2469
- * The generated image
2470
- */
2471
- image: unknown;
2472
- [property: string]: unknown;
2473
- }
2474
-
2475
- /**
2476
- * Inference code generated from the JSON schema spec in ./spec
2477
- *
2478
- * Using src/scripts/inference-codegen
2479
- */
2480
- /**
2481
- * Inputs for Text to Speech inference
2482
- *
2483
- * Inputs for Text To Audio inference
2484
- */
2485
- interface TextToSpeechInput {
2486
- /**
2487
- * The input text data
2488
- */
2489
- inputs: string;
2490
- /**
2491
- * Additional inference parameters
2492
- */
2493
- parameters?: TextToAudioParameters;
2494
- [property: string]: unknown;
2495
- }
2496
- /**
2497
- * Additional inference parameters
2498
- *
2499
- * Additional inference parameters for Text To Audio
2500
- */
2501
- interface TextToAudioParameters {
2502
- /**
2503
- * Parametrization of the text generation process
2504
- */
2505
- generate?: GenerationParameters;
2506
- [property: string]: unknown;
2507
- }
2508
- /**
2509
- * Parametrization of the text generation process
2510
- *
2511
- * Ad-hoc parametrization of the text generation process
2512
- */
2513
- interface GenerationParameters {
2514
- /**
2515
- * Whether to use sampling instead of greedy decoding when generating new tokens.
2516
- */
2517
- do_sample?: boolean;
2518
- /**
2519
- * Controls the stopping condition for beam-based methods.
2520
- */
2521
- early_stopping?: EarlyStoppingUnion;
2522
- /**
2523
- * If set to float strictly between 0 and 1, only tokens with a conditional probability
2524
- * greater than epsilon_cutoff will be sampled. In the paper, suggested values range from
2525
- * 3e-4 to 9e-4, depending on the size of the model. See [Truncation Sampling as Language
2526
- * Model Desmoothing](https://hf.co/papers/2210.15191) for more details.
2527
- */
2528
- epsilon_cutoff?: number;
2529
- /**
2530
- * Eta sampling is a hybrid of locally typical sampling and epsilon sampling. If set to
2531
- * float strictly between 0 and 1, a token is only considered if it is greater than either
2532
- * eta_cutoff or sqrt(eta_cutoff) * exp(-entropy(softmax(next_token_logits))). The latter
2533
- * term is intuitively the expected next token probability, scaled by sqrt(eta_cutoff). In
2534
- * the paper, suggested values range from 3e-4 to 2e-3, depending on the size of the model.
2535
- * See [Truncation Sampling as Language Model Desmoothing](https://hf.co/papers/2210.15191)
2536
- * for more details.
2537
- */
2538
- eta_cutoff?: number;
2539
- /**
2540
- * The maximum length (in tokens) of the generated text, including the input.
2541
- */
2542
- max_length?: number;
2543
- /**
2544
- * The maximum number of tokens to generate. Takes precedence over maxLength.
2545
- */
2546
- max_new_tokens?: number;
2547
- /**
2548
- * The minimum length (in tokens) of the generated text, including the input.
2549
- */
2550
- min_length?: number;
2551
- /**
2552
- * The minimum number of tokens to generate. Takes precedence over maxLength.
2553
- */
2554
- min_new_tokens?: number;
2555
- /**
2556
- * Number of groups to divide num_beams into in order to ensure diversity among different
2557
- * groups of beams. See [this paper](https://hf.co/papers/1610.02424) for more details.
2558
- */
2559
- num_beam_groups?: number;
2560
- /**
2561
- * Number of beams to use for beam search.
2562
- */
2563
- num_beams?: number;
2564
- /**
2565
- * The value balances the model confidence and the degeneration penalty in contrastive
2566
- * search decoding.
2567
- */
2568
- penalty_alpha?: number;
2569
- /**
2570
- * The value used to modulate the next token probabilities.
2571
- */
2572
- temperature?: number;
2573
- /**
2574
- * The number of highest probability vocabulary tokens to keep for top-k-filtering.
2575
- */
2576
- top_k?: number;
2577
- /**
2578
- * If set to float < 1, only the smallest set of most probable tokens with probabilities
2579
- * that add up to top_p or higher are kept for generation.
2580
- */
2581
- top_p?: number;
2582
- /**
2583
- * Local typicality measures how similar the conditional probability of predicting a target
2584
- * token next is to the expected conditional probability of predicting a random token next,
2585
- * given the partial text already generated. If set to float < 1, the smallest set of the
2586
- * most locally typical tokens with probabilities that add up to typical_p or higher are
2587
- * kept for generation. See [this paper](https://hf.co/papers/2202.00666) for more details.
2588
- */
2589
- typical_p?: number;
2590
- /**
2591
- * Whether the model should use the past last key/values attentions to speed up decoding
2592
- */
2593
- use_cache?: boolean;
2594
- [property: string]: unknown;
2595
- }
2596
- /**
2597
- * Controls the stopping condition for beam-based methods.
2598
- */
2599
- type EarlyStoppingUnion = boolean | "never";
2600
- /**
2601
- * Outputs for Text to Speech inference
2602
- *
2603
- * Outputs of inference for the Text To Audio task
2604
- */
2605
- interface TextToSpeechOutput {
2606
- /**
2607
- * The generated audio waveform.
2608
- */
2609
- audio: unknown;
2610
- samplingRate: unknown;
2611
- /**
2612
- * The sampling rate of the generated audio waveform.
2613
- */
2614
- sampling_rate?: number;
2615
- [property: string]: unknown;
2616
- }
2617
-
2618
- /**
2619
- * Inference code generated from the JSON schema spec in ./spec
2620
- *
2621
- * Using src/scripts/inference-codegen
2622
- */
2623
- /**
2624
- * Inputs for Token Classification inference
2625
- */
2626
- interface TokenClassificationInput {
2627
- /**
2628
- * The input text data
2629
- */
2630
- inputs: string;
2631
- /**
2632
- * Additional inference parameters
2633
- */
2634
- parameters?: TokenClassificationParameters;
2635
- [property: string]: unknown;
2636
- }
2637
- /**
2638
- * Additional inference parameters
2639
- *
2640
- * Additional inference parameters for Token Classification
2641
- */
2642
- interface TokenClassificationParameters {
2643
- /**
2644
- * The strategy used to fuse tokens based on model predictions
2645
- */
2646
- aggregation_strategy?: TokenClassificationAggregationStrategy;
2647
- /**
2648
- * A list of labels to ignore
2649
- */
2650
- ignore_labels?: string[];
2651
- /**
2652
- * The number of overlapping tokens between chunks when splitting the input text.
2653
- */
2654
- stride?: number;
2655
- [property: string]: unknown;
2656
- }
2657
- /**
2658
- * Do not aggregate tokens
2659
- *
2660
- * Group consecutive tokens with the same label in a single entity.
2661
- *
2662
- * Similar to "simple", also preserves word integrity (use the label predicted for the first
2663
- * token in a word).
2664
- *
2665
- * Similar to "simple", also preserves word integrity (uses the label with the highest
2666
- * score, averaged across the word's tokens).
2667
- *
2668
- * Similar to "simple", also preserves word integrity (uses the label with the highest score
2669
- * across the word's tokens).
2670
- */
2671
- type TokenClassificationAggregationStrategy = "none" | "simple" | "first" | "average" | "max";
2672
- type TokenClassificationOutput = TokenClassificationOutputElement[];
2673
- /**
2674
- * Outputs of inference for the Token Classification task
2675
- */
2676
- interface TokenClassificationOutputElement {
2677
- /**
2678
- * The character position in the input where this group ends.
2679
- */
2680
- end?: number;
2681
- /**
2682
- * The predicted label for that group of tokens
2683
- */
2684
- entity_group?: string;
2685
- label: unknown;
2686
- /**
2687
- * The associated score / probability
2688
- */
2689
- score: number;
2690
- /**
2691
- * The character position in the input where this group begins.
2692
- */
2693
- start?: number;
2694
- /**
2695
- * The corresponding text
2696
- */
2697
- word?: string;
2698
- [property: string]: unknown;
2699
- }
2700
-
2701
- /**
2702
- * Inference code generated from the JSON schema spec in ./spec
2703
- *
2704
- * Using src/scripts/inference-codegen
2705
- */
2706
- /**
2707
- * Inputs for Translation inference
2708
- *
2709
- * Inputs for Text2text Generation inference
2710
- */
2711
- interface TranslationInput {
2712
- /**
2713
- * The input text data
2714
- */
2715
- inputs: string;
2716
- /**
2717
- * Additional inference parameters
2718
- */
2719
- parameters?: Text2TextGenerationParameters;
2720
- [property: string]: unknown;
2721
- }
2722
- /**
2723
- * Additional inference parameters
2724
- *
2725
- * Additional inference parameters for Text2text Generation
2726
- */
2727
- interface Text2TextGenerationParameters {
2728
- /**
2729
- * Whether to clean up the potential extra spaces in the text output.
2730
- */
2731
- clean_up_tokenization_spaces?: boolean;
2732
- /**
2733
- * Additional parametrization of the text generation algorithm
2734
- */
2735
- generate_parameters?: {
2736
- [key: string]: unknown;
2737
- };
2738
- /**
2739
- * The truncation strategy to use
2740
- */
2741
- truncation?: Text2TextGenerationTruncationStrategy;
2742
- [property: string]: unknown;
2743
- }
2744
- type Text2TextGenerationTruncationStrategy = "do_not_truncate" | "longest_first" | "only_first" | "only_second";
2745
- /**
2746
- * Outputs of inference for the Translation task
2747
- */
2748
- interface TranslationOutput {
2749
- /**
2750
- * The translated text.
2751
- */
2752
- translation_text: string;
2753
- [property: string]: unknown;
2754
- }
2755
-
2756
- /**
2757
- * Inference code generated from the JSON schema spec in ./spec
2758
- *
2759
- * Using src/scripts/inference-codegen
2760
- */
2761
- /**
2762
- * Inputs for Text Classification inference
2763
- */
2764
- interface TextClassificationInput {
2765
- /**
2766
- * The text to classify
2767
- */
2768
- inputs: string;
2769
- /**
2770
- * Additional inference parameters
2771
- */
2772
- parameters?: TextClassificationParameters;
2773
- [property: string]: unknown;
2774
- }
2775
- /**
2776
- * Additional inference parameters
2777
- *
2778
- * Additional inference parameters for Text Classification
2779
- */
2780
- interface TextClassificationParameters {
2781
- function_to_apply?: ClassificationOutputTransform$1;
2782
- /**
2783
- * When specified, limits the output to the top K most probable classes.
2784
- */
2785
- top_k?: number;
2786
- [property: string]: unknown;
2787
- }
2788
- /**
2789
- * The function to apply to the model outputs in order to retrieve the scores.
2790
- */
2791
- type ClassificationOutputTransform$1 = "sigmoid" | "softmax" | "none";
2792
- type TextClassificationOutput = TextClassificationOutputElement[];
2793
- /**
2794
- * Outputs of inference for the Text Classification task
2795
- */
2796
- interface TextClassificationOutputElement {
2797
- /**
2798
- * The predicted class label.
2799
- */
2800
- label: string;
2801
- /**
2802
- * The corresponding probability.
2803
- */
2804
- score: number;
2805
- [property: string]: unknown;
2806
- }
2807
-
2808
- /**
2809
- * Inference code generated from the JSON schema spec in ./spec
2810
- *
2811
- * Using src/scripts/inference-codegen
2812
- */
2813
- /**
2814
- * Inputs for Text Generation inference
2815
- */
2816
- interface TextGenerationInput {
2817
- /**
2818
- * The text to initialize generation with
2819
- */
2820
- inputs: string;
2821
- /**
2822
- * Additional inference parameters
2823
- */
2824
- parameters?: TextGenerationParameters;
2825
- /**
2826
- * Whether to stream output tokens
2827
- */
2828
- stream?: boolean;
2829
- [property: string]: unknown;
2830
- }
2831
- /**
2832
- * Additional inference parameters
2833
- *
2834
- * Additional inference parameters for Text Generation
2835
- */
2836
- interface TextGenerationParameters {
2837
- /**
2838
- * The number of sampling queries to run. Only the best one (in terms of total logprob) will
2839
- * be returned.
2840
- */
2841
- best_of?: number;
2842
- /**
2843
- * Whether or not to output decoder input details
2844
- */
2845
- decoder_input_details?: boolean;
2846
- /**
2847
- * Whether or not to output details
2848
- */
2849
- details?: boolean;
2850
- /**
2851
- * Whether to use logits sampling instead of greedy decoding when generating new tokens.
2852
- */
2853
- do_sample?: boolean;
2854
- /**
2855
- * The maximum number of tokens to generate.
2856
- */
2857
- max_new_tokens?: number;
2858
- /**
2859
- * The parameter for repetition penalty. A value of 1.0 means no penalty. See [this
2860
- * paper](https://hf.co/papers/1909.05858) for more details.
2861
- */
2862
- repetition_penalty?: number;
2863
- /**
2864
- * Whether to prepend the prompt to the generated text.
2865
- */
2866
- return_full_text?: boolean;
2867
- /**
2868
- * The random sampling seed.
2869
- */
2870
- seed?: number;
2871
- /**
2872
- * Stop generating tokens if a member of `stop_sequences` is generated.
2873
- */
2874
- stop_sequences?: string[];
2875
- /**
2876
- * The value used to modulate the logits distribution.
2877
- */
2878
- temperature?: number;
2879
- /**
2880
- * The number of highest probability vocabulary tokens to keep for top-k-filtering.
2881
- */
2882
- top_k?: number;
2883
- /**
2884
- * If set to < 1, only the smallest set of most probable tokens with probabilities that add
2885
- * up to `top_p` or higher are kept for generation.
2886
- */
2887
- top_p?: number;
2888
- /**
2889
- * Truncate input tokens to the given size.
2890
- */
2891
- truncate?: number;
2892
- /**
2893
- * Typical Decoding mass. See [Typical Decoding for Natural Language
2894
- * Generation](https://hf.co/papers/2202.00666) for more information
2895
- */
2896
- typical_p?: number;
2897
- /**
2898
- * Watermarking with [A Watermark for Large Language Models](https://hf.co/papers/2301.10226)
2899
- */
2900
- watermark?: boolean;
2901
- [property: string]: unknown;
2902
- }
2903
- /**
2904
- * Outputs for Text Generation inference
2905
- */
2906
- interface TextGenerationOutput {
2907
- /**
2908
- * When enabled, details about the generation
2909
- */
2910
- details?: TextGenerationOutputDetails;
2911
- /**
2912
- * The generated text
2913
- */
2914
- generated_text: string;
2915
- [property: string]: unknown;
2916
- }
2917
- /**
2918
- * When enabled, details about the generation
2919
- */
2920
- interface TextGenerationOutputDetails {
2921
- /**
2922
- * Details about additional sequences when best_of is provided
2923
- */
2924
- best_of_sequences?: TextGenerationOutputSequenceDetails[];
2925
- /**
2926
- * The reason why the generation was stopped.
2927
- */
2928
- finish_reason: TextGenerationFinishReason;
2929
- /**
2930
- * The number of generated tokens
2931
- */
2932
- generated_tokens: number;
2933
- prefill: TextGenerationPrefillToken[];
2934
- /**
2935
- * The random seed used for generation
2936
- */
2937
- seed?: number;
2938
- /**
2939
- * The generated tokens and associated details
2940
- */
2941
- tokens: TextGenerationOutputToken[];
2942
- /**
2943
- * Most likely tokens
2944
- */
2945
- top_tokens?: Array<TextGenerationOutputToken[]>;
2946
- [property: string]: unknown;
2947
- }
2948
- interface TextGenerationOutputSequenceDetails {
2949
- finish_reason: TextGenerationFinishReason;
2950
- /**
2951
- * The generated text
2952
- */
2953
- generated_text: string;
2954
- /**
2955
- * The number of generated tokens
2956
- */
2957
- generated_tokens: number;
2958
- prefill: TextGenerationPrefillToken[];
2959
- /**
2960
- * The random seed used for generation
2961
- */
2962
- seed?: number;
2963
- /**
2964
- * The generated tokens and associated details
2965
- */
2966
- tokens: TextGenerationOutputToken[];
2967
- /**
2968
- * Most likely tokens
2969
- */
2970
- top_tokens?: Array<TextGenerationOutputToken[]>;
2971
- [property: string]: unknown;
2972
- }
2973
- /**
2974
- * The reason why the generation was stopped.
2975
- *
2976
- * length: The generated sequence reached the maximum allowed length
2977
- *
2978
- * eos_token: The model generated an end-of-sentence (EOS) token
2979
- *
2980
- * stop_sequence: One of the sequence in stop_sequences was generated
2981
- */
2982
- type TextGenerationFinishReason = "length" | "eos_token" | "stop_sequence";
2983
- interface TextGenerationPrefillToken {
2984
- id: number;
2985
- logprob: number;
2986
- /**
2987
- * The text associated with that token
2988
- */
2989
- text: string;
2990
- [property: string]: unknown;
2991
- }
2992
- /**
2993
- * Generated token.
2994
- */
2995
- interface TextGenerationOutputToken {
2996
- id: number;
2997
- logprob?: number;
2998
- /**
2999
- * Whether or not that token is a special one
3000
- */
3001
- special: boolean;
3002
- /**
3003
- * The text associated with that token
3004
- */
3005
- text: string;
3006
- [property: string]: unknown;
3007
- }
3008
- /**
3009
- * Text Generation Stream Output
3010
- */
3011
- interface TextGenerationStreamOutput {
3012
- /**
3013
- * Generation details. Only available when the generation is finished.
3014
- */
3015
- details?: TextGenerationStreamDetails;
3016
- /**
3017
- * The complete generated text. Only available when the generation is finished.
3018
- */
3019
- generated_text?: string;
3020
- /**
3021
- * The token index within the stream. Optional to support older clients that omit it.
3022
- */
3023
- index?: number;
3024
- /**
3025
- * Generated token.
3026
- */
3027
- token: TextGenerationOutputToken;
3028
- [property: string]: unknown;
3029
- }
3030
- /**
3031
- * Generation details. Only available when the generation is finished.
3032
- */
3033
- interface TextGenerationStreamDetails {
3034
- /**
3035
- * The reason why the generation was stopped.
3036
- */
3037
- finish_reason: TextGenerationFinishReason;
3038
- /**
3039
- * The number of generated tokens
3040
- */
3041
- generated_tokens: number;
3042
- /**
3043
- * The random seed used for generation
3044
- */
3045
- seed: number;
3046
- [property: string]: unknown;
3047
- }
3048
-
3049
- /**
3050
- * Inference code generated from the JSON schema spec in ./spec
3051
- *
3052
- * Using src/scripts/inference-codegen
3053
- */
3054
- /**
3055
- * Inputs for Video Classification inference
3056
- */
3057
- interface VideoClassificationInput {
3058
- /**
3059
- * The input video data
3060
- */
3061
- inputs: unknown;
3062
- /**
3063
- * Additional inference parameters
3064
- */
3065
- parameters?: VideoClassificationParameters;
3066
- [property: string]: unknown;
3067
- }
3068
- /**
3069
- * Additional inference parameters
3070
- *
3071
- * Additional inference parameters for Video Classification
3072
- */
3073
- interface VideoClassificationParameters {
3074
- /**
3075
- * The sampling rate used to select frames from the video.
3076
- */
3077
- frame_sampling_rate?: number;
3078
- function_to_apply?: ClassificationOutputTransform;
3079
- /**
3080
- * The number of sampled frames to consider for classification.
3081
- */
3082
- num_frames?: number;
3083
- /**
3084
- * When specified, limits the output to the top K most probable classes.
3085
- */
3086
- top_k?: number;
3087
- [property: string]: unknown;
3088
- }
3089
- /**
3090
- * The function to apply to the model outputs in order to retrieve the scores.
3091
- */
3092
- type ClassificationOutputTransform = "sigmoid" | "softmax" | "none";
3093
- type VideoClassificationOutput = VideoClassificationOutputElement[];
3094
- /**
3095
- * Outputs of inference for the Video Classification task
3096
- */
3097
- interface VideoClassificationOutputElement {
3098
- /**
3099
- * The predicted class label.
3100
- */
3101
- label: string;
3102
- /**
3103
- * The corresponding probability.
3104
- */
3105
- score: number;
3106
- [property: string]: unknown;
3107
- }
3108
-
3109
- /**
3110
- * Inference code generated from the JSON schema spec in ./spec
3111
- *
3112
- * Using src/scripts/inference-codegen
3113
- */
3114
- /**
3115
- * Inputs for Visual Question Answering inference
3116
- */
3117
- interface VisualQuestionAnsweringInput {
3118
- /**
3119
- * One (image, question) pair to answer
3120
- */
3121
- inputs: VisualQuestionAnsweringInputData;
3122
- /**
3123
- * Additional inference parameters
3124
- */
3125
- parameters?: VisualQuestionAnsweringParameters;
3126
- [property: string]: unknown;
3127
- }
3128
- /**
3129
- * One (image, question) pair to answer
3130
- */
3131
- interface VisualQuestionAnsweringInputData {
3132
- /**
3133
- * The image.
3134
- */
3135
- image: unknown;
3136
- /**
3137
- * The question to answer based on the image.
3138
- */
3139
- question: unknown;
3140
- [property: string]: unknown;
3141
- }
3142
- /**
3143
- * Additional inference parameters
3144
- *
3145
- * Additional inference parameters for Visual Question Answering
3146
- */
3147
- interface VisualQuestionAnsweringParameters {
3148
- /**
3149
- * The number of answers to return (will be chosen by order of likelihood). Note that we
3150
- * return less than topk answers if there are not enough options available within the
3151
- * context.
3152
- */
3153
- top_k?: number;
3154
- [property: string]: unknown;
3155
- }
3156
- type VisualQuestionAnsweringOutput = VisualQuestionAnsweringOutputElement[];
3157
- /**
3158
- * Outputs of inference for the Visual Question Answering task
3159
- */
3160
- interface VisualQuestionAnsweringOutputElement {
3161
- /**
3162
- * The answer to the question
3163
- */
3164
- answer?: string;
3165
- label: unknown;
3166
- /**
3167
- * The associated score / probability
3168
- */
3169
- score: number;
3170
- [property: string]: unknown;
3171
- }
3172
-
3173
- /**
3174
- * Inference code generated from the JSON schema spec in ./spec
3175
- *
3176
- * Using src/scripts/inference-codegen
3177
- */
3178
- /**
3179
- * Inputs for Zero Shot Classification inference
3180
- */
3181
- interface ZeroShotClassificationInput {
3182
- /**
3183
- * The input text data, with candidate labels
3184
- */
3185
- inputs: ZeroShotClassificationInputData;
3186
- /**
3187
- * Additional inference parameters
3188
- */
3189
- parameters?: ZeroShotClassificationParameters;
3190
- [property: string]: unknown;
3191
- }
3192
- /**
3193
- * The input text data, with candidate labels
3194
- */
3195
- interface ZeroShotClassificationInputData {
3196
- /**
3197
- * The set of possible class labels to classify the text into.
3198
- */
3199
- candidateLabels: string[];
3200
- /**
3201
- * The text to classify
3202
- */
3203
- text: string;
3204
- [property: string]: unknown;
3205
- }
3206
- /**
3207
- * Additional inference parameters
3208
- *
3209
- * Additional inference parameters for Zero Shot Classification
3210
- */
3211
- interface ZeroShotClassificationParameters {
3212
- /**
3213
- * The sentence used in conjunction with candidateLabels to attempt the text classification
3214
- * by replacing the placeholder with the candidate labels.
3215
- */
3216
- hypothesis_template?: string;
3217
- /**
3218
- * Whether multiple candidate labels can be true. If false, the scores are normalized such
3219
- * that the sum of the label likelihoods for each sequence is 1. If true, the labels are
3220
- * considered independent and probabilities are normalized for each candidate.
3221
- */
3222
- multi_label?: boolean;
3223
- [property: string]: unknown;
3224
- }
3225
- type ZeroShotClassificationOutput = ZeroShotClassificationOutputElement[];
3226
- /**
3227
- * Outputs of inference for the Zero Shot Classification task
3228
- */
3229
- interface ZeroShotClassificationOutputElement {
3230
- /**
3231
- * The predicted class label.
3232
- */
3233
- label: string;
3234
- /**
3235
- * The corresponding probability.
3236
- */
3237
- score: number;
3238
- [property: string]: unknown;
3239
- }
3240
-
3241
- /**
3242
- * Inference code generated from the JSON schema spec in ./spec
3243
- *
3244
- * Using src/scripts/inference-codegen
3245
- */
3246
- /**
3247
- * Inputs for Zero Shot Image Classification inference
3248
- */
3249
- interface ZeroShotImageClassificationInput {
3250
- /**
3251
- * The input image data, with candidate labels
3252
- */
3253
- inputs: ZeroShotImageClassificationInputData;
3254
- /**
3255
- * Additional inference parameters
3256
- */
3257
- parameters?: ZeroShotImageClassificationParameters;
3258
- [property: string]: unknown;
3259
- }
3260
- /**
3261
- * The input image data, with candidate labels
3262
- */
3263
- interface ZeroShotImageClassificationInputData {
3264
- /**
3265
- * The candidate labels for this image
3266
- */
3267
- candidateLabels: string[];
3268
- /**
3269
- * The image data to classify
3270
- */
3271
- image: unknown;
3272
- [property: string]: unknown;
3273
- }
3274
- /**
3275
- * Additional inference parameters
3276
- *
3277
- * Additional inference parameters for Zero Shot Image Classification
3278
- */
3279
- interface ZeroShotImageClassificationParameters {
3280
- /**
3281
- * The sentence used in conjunction with candidateLabels to attempt the text classification
3282
- * by replacing the placeholder with the candidate labels.
3283
- */
3284
- hypothesis_template?: string;
3285
- [property: string]: unknown;
3286
- }
3287
- type ZeroShotImageClassificationOutput = ZeroShotImageClassificationOutputElement[];
3288
- /**
3289
- * Outputs of inference for the Zero Shot Image Classification task
3290
- */
3291
- interface ZeroShotImageClassificationOutputElement {
3292
- /**
3293
- * The predicted class label.
3294
- */
3295
- label: string;
3296
- /**
3297
- * The corresponding probability.
3298
- */
3299
- score: number;
3300
- [property: string]: unknown;
3301
- }
3302
-
3303
- /**
3304
- * Inference code generated from the JSON schema spec in ./spec
3305
- *
3306
- * Using src/scripts/inference-codegen
3307
- */
3308
- /**
3309
- * Inputs for Zero Shot Object Detection inference
3310
- */
3311
- interface ZeroShotObjectDetectionInput {
3312
- /**
3313
- * The input image data, with candidate labels
3314
- */
3315
- inputs: ZeroShotObjectDetectionInputData;
3316
- /**
3317
- * Additional inference parameters
3318
- */
3319
- parameters?: {
3320
- [key: string]: unknown;
3321
- };
3322
- [property: string]: unknown;
3323
- }
3324
- /**
3325
- * The input image data, with candidate labels
3326
- */
3327
- interface ZeroShotObjectDetectionInputData {
3328
- /**
3329
- * The candidate labels for this image
3330
- */
3331
- candidateLabels: string[];
3332
- /**
3333
- * The image data to generate bounding boxes from
3334
- */
3335
- image: unknown;
3336
- [property: string]: unknown;
3337
- }
3338
- /**
3339
- * The predicted bounding box. Coordinates are relative to the top left corner of the input
3340
- * image.
3341
- */
3342
- interface BoundingBox {
3343
- xmax: number;
3344
- xmin: number;
3345
- ymax: number;
3346
- ymin: number;
3347
- [property: string]: unknown;
3348
- }
3349
- type ZeroShotObjectDetectionOutput = ZeroShotObjectDetectionOutputElement[];
3350
- /**
3351
- * Outputs of inference for the Zero Shot Object Detection task
3352
- */
3353
- interface ZeroShotObjectDetectionOutputElement {
3354
- /**
3355
- * The predicted bounding box. Coordinates are relative to the top left corner of the input
3356
- * image.
3357
- */
3358
- box: BoundingBox;
3359
- /**
3360
- * A candidate label
3361
- */
3362
- label: string;
3363
- /**
3364
- * The associated score / probability
3365
- */
3366
- score: number;
3367
- [property: string]: unknown;
3368
- }
3369
-
3370
- /**
3371
- * Model libraries compatible with each ML task
3372
- */
3373
- declare const TASKS_MODEL_LIBRARIES: Record<PipelineType, ModelLibraryKey[]>;
3374
- declare const TASKS_DATA: Record<PipelineType, TaskData | undefined>;
3375
- interface ExampleRepo {
3376
- description: string;
3377
- id: string;
3378
- }
3379
- type TaskDemoEntry = {
3380
- filename: string;
3381
- type: "audio";
3382
- } | {
3383
- data: Array<{
3384
- label: string;
3385
- score: number;
3386
- }>;
3387
- type: "chart";
3388
- } | {
3389
- filename: string;
3390
- type: "img";
3391
- } | {
3392
- table: string[][];
3393
- type: "tabular";
3394
- } | {
3395
- content: string;
3396
- label: string;
3397
- type: "text";
3398
- } | {
3399
- text: string;
3400
- tokens: Array<{
3401
- end: number;
3402
- start: number;
3403
- type: string;
3404
- }>;
3405
- type: "text-with-tokens";
3406
- };
3407
- interface TaskDemo {
3408
- inputs: TaskDemoEntry[];
3409
- outputs: TaskDemoEntry[];
3410
- }
3411
- interface TaskData {
3412
- datasets: ExampleRepo[];
3413
- demo: TaskDemo;
3414
- id: PipelineType;
3415
- canonicalId?: PipelineType;
3416
- isPlaceholder?: boolean;
3417
- label: string;
3418
- libraries: ModelLibraryKey[];
3419
- metrics: ExampleRepo[];
3420
- models: ExampleRepo[];
3421
- spaces: ExampleRepo[];
3422
- summary: string;
3423
- widgetModels: string[];
3424
- youtubeId?: string;
3425
- }
3426
- type TaskDataCustom = Omit<TaskData, "id" | "label" | "libraries">;
3427
-
3428
- /**
3429
- * Minimal model data required for snippets.
3430
- *
3431
- * Add more fields as needed.
3432
- */
3433
- type ModelDataMinimal = Pick<ModelData, "id" | "pipeline_tag" | "mask_token" | "library_name">;
3434
-
3435
- declare function getModelInputSnippet(model: ModelDataMinimal, noWrap?: boolean, noQuotes?: boolean): string;
3436
-
3437
- declare const inputs_getModelInputSnippet: typeof getModelInputSnippet;
3438
- declare namespace inputs {
3439
- export {
3440
- inputs_getModelInputSnippet as getModelInputSnippet,
3441
- };
3442
- }
3443
-
3444
- declare const snippetBasic$2: (model: ModelDataMinimal, accessToken: string) => string;
3445
- declare const snippetZeroShotClassification$2: (model: ModelDataMinimal, accessToken: string) => string;
3446
- declare const snippetFile$2: (model: ModelDataMinimal, accessToken: string) => string;
3447
- declare const curlSnippets: Partial<Record<PipelineType, (model: ModelDataMinimal, accessToken: string) => string>>;
3448
- declare function getCurlInferenceSnippet(model: ModelDataMinimal, accessToken: string): string;
3449
- declare function hasCurlInferenceSnippet(model: Pick<ModelDataMinimal, "pipeline_tag">): boolean;
3450
-
3451
- declare const curl_curlSnippets: typeof curlSnippets;
3452
- declare const curl_getCurlInferenceSnippet: typeof getCurlInferenceSnippet;
3453
- declare const curl_hasCurlInferenceSnippet: typeof hasCurlInferenceSnippet;
3454
- declare namespace curl {
3455
- export {
3456
- curl_curlSnippets as curlSnippets,
3457
- curl_getCurlInferenceSnippet as getCurlInferenceSnippet,
3458
- curl_hasCurlInferenceSnippet as hasCurlInferenceSnippet,
3459
- snippetBasic$2 as snippetBasic,
3460
- snippetFile$2 as snippetFile,
3461
- snippetZeroShotClassification$2 as snippetZeroShotClassification,
3462
- };
3463
- }
3464
-
3465
- declare const snippetZeroShotClassification$1: (model: ModelDataMinimal) => string;
3466
- declare const snippetZeroShotImageClassification: (model: ModelDataMinimal) => string;
3467
- declare const snippetBasic$1: (model: ModelDataMinimal) => string;
3468
- declare const snippetFile$1: (model: ModelDataMinimal) => string;
3469
- declare const snippetTextToImage$1: (model: ModelDataMinimal) => string;
3470
- declare const snippetTabular: (model: ModelDataMinimal) => string;
3471
- declare const snippetTextToAudio$1: (model: ModelDataMinimal) => string;
3472
- declare const snippetDocumentQuestionAnswering: (model: ModelDataMinimal) => string;
3473
- declare const pythonSnippets: Partial<Record<PipelineType, (model: ModelDataMinimal) => string>>;
3474
- declare function getPythonInferenceSnippet(model: ModelDataMinimal, accessToken: string): string;
3475
- declare function hasPythonInferenceSnippet(model: ModelDataMinimal): boolean;
3476
-
3477
- declare const python_getPythonInferenceSnippet: typeof getPythonInferenceSnippet;
3478
- declare const python_hasPythonInferenceSnippet: typeof hasPythonInferenceSnippet;
3479
- declare const python_pythonSnippets: typeof pythonSnippets;
3480
- declare const python_snippetDocumentQuestionAnswering: typeof snippetDocumentQuestionAnswering;
3481
- declare const python_snippetTabular: typeof snippetTabular;
3482
- declare const python_snippetZeroShotImageClassification: typeof snippetZeroShotImageClassification;
3483
- declare namespace python {
3484
- export {
3485
- python_getPythonInferenceSnippet as getPythonInferenceSnippet,
3486
- python_hasPythonInferenceSnippet as hasPythonInferenceSnippet,
3487
- python_pythonSnippets as pythonSnippets,
3488
- snippetBasic$1 as snippetBasic,
3489
- python_snippetDocumentQuestionAnswering as snippetDocumentQuestionAnswering,
3490
- snippetFile$1 as snippetFile,
3491
- python_snippetTabular as snippetTabular,
3492
- snippetTextToAudio$1 as snippetTextToAudio,
3493
- snippetTextToImage$1 as snippetTextToImage,
3494
- snippetZeroShotClassification$1 as snippetZeroShotClassification,
3495
- python_snippetZeroShotImageClassification as snippetZeroShotImageClassification,
3496
- };
3497
- }
3498
-
3499
- declare const snippetBasic: (model: ModelDataMinimal, accessToken: string) => string;
3500
- declare const snippetZeroShotClassification: (model: ModelDataMinimal, accessToken: string) => string;
3501
- declare const snippetTextToImage: (model: ModelDataMinimal, accessToken: string) => string;
3502
- declare const snippetTextToAudio: (model: ModelDataMinimal, accessToken: string) => string;
3503
- declare const snippetFile: (model: ModelDataMinimal, accessToken: string) => string;
3504
- declare const jsSnippets: Partial<Record<PipelineType, (model: ModelDataMinimal, accessToken: string) => string>>;
3505
- declare function getJsInferenceSnippet(model: ModelDataMinimal, accessToken: string): string;
3506
- declare function hasJsInferenceSnippet(model: ModelDataMinimal): boolean;
3507
-
3508
- declare const js_getJsInferenceSnippet: typeof getJsInferenceSnippet;
3509
- declare const js_hasJsInferenceSnippet: typeof hasJsInferenceSnippet;
3510
- declare const js_jsSnippets: typeof jsSnippets;
3511
- declare const js_snippetBasic: typeof snippetBasic;
3512
- declare const js_snippetFile: typeof snippetFile;
3513
- declare const js_snippetTextToAudio: typeof snippetTextToAudio;
3514
- declare const js_snippetTextToImage: typeof snippetTextToImage;
3515
- declare const js_snippetZeroShotClassification: typeof snippetZeroShotClassification;
3516
- declare namespace js {
3517
- export {
3518
- js_getJsInferenceSnippet as getJsInferenceSnippet,
3519
- js_hasJsInferenceSnippet as hasJsInferenceSnippet,
3520
- js_jsSnippets as jsSnippets,
3521
- js_snippetBasic as snippetBasic,
3522
- js_snippetFile as snippetFile,
3523
- js_snippetTextToAudio as snippetTextToAudio,
3524
- js_snippetTextToImage as snippetTextToImage,
3525
- js_snippetZeroShotClassification as snippetZeroShotClassification,
3526
- };
3527
- }
3528
-
3529
- declare const index_curl: typeof curl;
3530
- declare const index_inputs: typeof inputs;
3531
- declare const index_js: typeof js;
3532
- declare const index_python: typeof python;
3533
- declare namespace index {
3534
- export {
3535
- index_curl as curl,
3536
- index_inputs as inputs,
3537
- index_js as js,
3538
- index_python as python,
3539
- };
3540
- }
3541
-
3542
- 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 };