@ohos-ports/sillytavern-transformers 2.17.2-beta.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 (59) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +361 -0
  3. package/dist/ort-wasm-simd-threaded.wasm +0 -0
  4. package/dist/ort-wasm-simd.wasm +0 -0
  5. package/dist/ort-wasm-threaded.wasm +0 -0
  6. package/dist/ort-wasm.wasm +0 -0
  7. package/dist/transformers.js +26758 -0
  8. package/dist/transformers.js.map +1 -0
  9. package/dist/transformers.min.js +107 -0
  10. package/dist/transformers.min.js.map +1 -0
  11. package/package.json +85 -0
  12. package/src/backends/onnx.js +50 -0
  13. package/src/configs.js +107 -0
  14. package/src/env.js +128 -0
  15. package/src/models.js +6267 -0
  16. package/src/pipelines.js +3287 -0
  17. package/src/processors.js +2248 -0
  18. package/src/tokenizers.js +4479 -0
  19. package/src/transformers.js +24 -0
  20. package/src/utils/audio.js +672 -0
  21. package/src/utils/core.js +175 -0
  22. package/src/utils/data-structures.js +415 -0
  23. package/src/utils/generation.js +873 -0
  24. package/src/utils/hub.js +658 -0
  25. package/src/utils/image.js +731 -0
  26. package/src/utils/maths.js +985 -0
  27. package/src/utils/tensor.js +1250 -0
  28. package/types/backends/onnx.d.ts +5 -0
  29. package/types/backends/onnx.d.ts.map +1 -0
  30. package/types/configs.d.ts +43 -0
  31. package/types/configs.d.ts.map +1 -0
  32. package/types/env.d.ts +28 -0
  33. package/types/env.d.ts.map +1 -0
  34. package/types/models.d.ts +3661 -0
  35. package/types/models.d.ts.map +1 -0
  36. package/types/pipelines.d.ts +2427 -0
  37. package/types/pipelines.d.ts.map +1 -0
  38. package/types/processors.d.ts +769 -0
  39. package/types/processors.d.ts.map +1 -0
  40. package/types/tokenizers.d.ts +932 -0
  41. package/types/tokenizers.d.ts.map +1 -0
  42. package/types/transformers.d.ts +11 -0
  43. package/types/transformers.d.ts.map +1 -0
  44. package/types/utils/audio.d.ts +121 -0
  45. package/types/utils/audio.d.ts.map +1 -0
  46. package/types/utils/core.d.ts +99 -0
  47. package/types/utils/core.d.ts.map +1 -0
  48. package/types/utils/data-structures.d.ts +224 -0
  49. package/types/utils/data-structures.d.ts.map +1 -0
  50. package/types/utils/generation.d.ts +593 -0
  51. package/types/utils/generation.d.ts.map +1 -0
  52. package/types/utils/hub.d.ts +154 -0
  53. package/types/utils/hub.d.ts.map +1 -0
  54. package/types/utils/image.d.ts +113 -0
  55. package/types/utils/image.d.ts.map +1 -0
  56. package/types/utils/maths.d.ts +280 -0
  57. package/types/utils/maths.d.ts.map +1 -0
  58. package/types/utils/tensor.d.ts +318 -0
  59. package/types/utils/tensor.d.ts.map +1 -0
@@ -0,0 +1,3661 @@
1
+ declare const PreTrainedModel_base: new () => {
2
+ (...args: any[]): any;
3
+ _call(...args: any[]): any;
4
+ };
5
+ /**
6
+ * A base class for pre-trained models that provides the model configuration and an ONNX session.
7
+ */
8
+ export class PreTrainedModel extends PreTrainedModel_base {
9
+ /**
10
+ * Instantiate one of the model classes of the library from a pretrained model.
11
+ *
12
+ * The model class to instantiate is selected based on the `model_type` property of the config object
13
+ * (either passed as an argument or loaded from `pretrained_model_name_or_path` if possible)
14
+ *
15
+ * @param {string} pretrained_model_name_or_path The name or path of the pretrained model. Can be either:
16
+ * - A string, the *model id* of a pretrained model hosted inside a model repo on huggingface.co.
17
+ * Valid model ids can be located at the root-level, like `bert-base-uncased`, or namespaced under a
18
+ * user or organization name, like `dbmdz/bert-base-german-cased`.
19
+ * - A path to a *directory* containing model weights, e.g., `./my_model_directory/`.
20
+ * @param {import('./utils/hub.js').PretrainedOptions} options Additional options for loading the model.
21
+ *
22
+ * @returns {Promise<PreTrainedModel>} A new instance of the `PreTrainedModel` class.
23
+ */
24
+ static from_pretrained(pretrained_model_name_or_path: string, { quantized, progress_callback, config, cache_dir, local_files_only, revision, model_file_name, }?: import('./utils/hub.js').PretrainedOptions): Promise<PreTrainedModel>;
25
+ /**
26
+ * Creates a new instance of the `PreTrainedModel` class.
27
+ * @param {Object} config The model configuration.
28
+ * @param {any} session session for the model.
29
+ */
30
+ constructor(config: any, session: any);
31
+ main_input_name: string;
32
+ config: any;
33
+ session: any;
34
+ can_generate: boolean;
35
+ _runBeam: typeof decoderRunBeam;
36
+ _getStartBeams: typeof decoderStartBeams;
37
+ _updateBeam: typeof decoderUpdatebeam;
38
+ _forward: typeof encoderForward;
39
+ /**
40
+ * Disposes of all the ONNX sessions that were created during inference.
41
+ * @returns {Promise<unknown[]>} An array of promises, one for each ONNX session that is being disposed.
42
+ * @todo Use https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry
43
+ */
44
+ dispose(): Promise<unknown[]>;
45
+ /**
46
+ * Runs the model with the provided inputs
47
+ * @param {Object} model_inputs Object containing input tensors
48
+ * @returns {Promise<Object>} Object containing output tensors
49
+ */
50
+ _call(model_inputs: any): Promise<any>;
51
+ /**
52
+ * Forward method for a pretrained model. If not overridden by a subclass, the correct forward method
53
+ * will be chosen based on the model type.
54
+ * @param {Object} model_inputs The input data to the model in the format specified in the ONNX model.
55
+ * @returns {Promise<Object>} The output data from the model in the format specified in the ONNX model.
56
+ * @throws {Error} This method must be implemented in subclasses.
57
+ */
58
+ forward(model_inputs: any): Promise<any>;
59
+ /**
60
+ * @param {import('./utils/generation.js').GenerationConfigType} generation_config
61
+ * @param {number} input_ids_seq_length The starting sequence length for the input ids.
62
+ * @returns {LogitsProcessorList}
63
+ * @private
64
+ */
65
+ private _get_logits_processor;
66
+ /**
67
+ * This function merges multiple generation configs together to form a final generation config to be used by the model for text generation.
68
+ * It first creates an empty `GenerationConfig` object, then it applies the model's own `generation_config` property to it. Finally, if a `generation_config` object was passed in the arguments, it overwrites the corresponding properties in the final config with those of the passed config object.
69
+ * @param {import('./utils/generation.js').GenerationConfigType} generation_config A `GenerationConfig` object containing generation parameters.
70
+ * @returns {import('./utils/generation.js').GenerationConfigType} The final generation config object to be used by the model for text generation.
71
+ */
72
+ _get_generation_config(generation_config: import('./utils/generation.js').GenerationConfigType): import('./utils/generation.js').GenerationConfigType;
73
+ /**
74
+ * @typedef {import('./utils/maths.js').TypedArray} TypedArray
75
+ */
76
+ /**
77
+ * @typedef {{ sequences: Tensor, decoder_attentions: Tensor, cross_attentions: Tensor }} EncoderDecoderOutput
78
+ * @typedef {Object} DecoderOutput
79
+ *
80
+ * Generates text based on the given inputs and generation configuration using the model.
81
+ * @param {Tensor|Array|TypedArray} inputs An array of input token IDs.
82
+ * @param {Object|GenerationConfig|null} generation_config The generation configuration to use. If null, default configuration will be used.
83
+ * @param {Object|null} logits_processor An optional logits processor to use. If null, a new LogitsProcessorList instance will be created.
84
+ * @param {Object} options options
85
+ * @param {Object} [options.inputs_attention_mask=null] An optional attention mask for the inputs.
86
+ * @returns {Promise<number[][]|EncoderDecoderOutput|DecoderOutput>} An array of generated output sequences, where each sequence is an array of token IDs.
87
+ * @throws {Error} Throws an error if the inputs array is empty.
88
+ */
89
+ generate(inputs: any[] | import("./transformers.js").TypedArray | Tensor, generation_config?: any | (new (kwargs?: import("./utils/generation.js").GenerationConfigType) => import("./utils/generation.js").GenerationConfigType) | null, logits_processor?: any | null, { inputs_attention_mask }?: {
90
+ inputs_attention_mask?: any;
91
+ }): Promise<any>;
92
+ /**
93
+ * Helper function to add attentions to beam
94
+ * @param {Object} beam
95
+ * @param {Object} output
96
+ * @private
97
+ */
98
+ private addAttentionsToBeam;
99
+ /**
100
+ * Groups an array of beam objects by their ids.
101
+ *
102
+ * @param {Array} beams The array of beam objects to group.
103
+ * @returns {Array} An array of arrays, where each inner array contains beam objects with the same id.
104
+ */
105
+ groupBeams(beams: any[]): any[];
106
+ /**
107
+ * Returns an object containing past key values from the given decoder results object.
108
+ *
109
+ * @param {Object} decoderResults The decoder results object.
110
+ * @param {Object} pastKeyValues The previous past key values.
111
+ * @returns {Object} An object containing past key values.
112
+ */
113
+ getPastKeyValues(decoderResults: any, pastKeyValues: any): any;
114
+ /**
115
+ * Returns an object containing attentions from the given decoder results object.
116
+ *
117
+ * @param {Object} decoderResults The decoder results object.
118
+ * @returns {Object} An object containing attentions.
119
+ */
120
+ getAttentions(decoderResults: any): any;
121
+ /**
122
+ * Adds past key values to the decoder feeds object. If pastKeyValues is null, creates new tensors for past key values.
123
+ *
124
+ * @param {Object} decoderFeeds The decoder feeds object to add past key values to.
125
+ * @param {Object} pastKeyValues An object containing past key values.
126
+ */
127
+ addPastKeyValues(decoderFeeds: any, pastKeyValues: any): void;
128
+ /**
129
+ * Initializes and returns the beam for text generation task
130
+ * @param {Tensor} inputTokenIds The input token ids.
131
+ * @param {Object} generation_config The generation config.
132
+ * @param {number} numOutputTokens The number of tokens to be generated.
133
+ * @param {Tensor} inputs_attention_mask Optional input attention mask.
134
+ * @returns {any} A Beam object representing the initialized beam.
135
+ * @private
136
+ */
137
+ private getStartBeams;
138
+ /**
139
+ * Runs a single step of the beam search generation algorithm.
140
+ * @param {any} beam The current beam being generated.
141
+ * @returns {Promise<any>} The updated beam after a single generation step.
142
+ * @private
143
+ */
144
+ private runBeam;
145
+ /**
146
+ * Update a beam with a new token ID.
147
+ * @param {Object} beam The beam to update.
148
+ * @param {number} newTokenId The new token ID to add to the beam's output.
149
+ * @private
150
+ */
151
+ private updateBeam;
152
+ }
153
+ export class ModelOutput {
154
+ }
155
+ /**
156
+ * Base class for model's outputs, with potential hidden states and attentions.
157
+ */
158
+ export class BaseModelOutput extends ModelOutput {
159
+ /**
160
+ * @param {Object} output The output of the model.
161
+ * @param {Tensor} output.last_hidden_state Sequence of hidden-states at the output of the last layer of the model.
162
+ * @param {Tensor} [output.hidden_states] Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.
163
+ * @param {Tensor} [output.attentions] Attentions weights after the attention softmax, used to compute the weighted average in the self-attention heads.
164
+ */
165
+ constructor({ last_hidden_state, hidden_states, attentions }: {
166
+ last_hidden_state: Tensor;
167
+ hidden_states?: Tensor;
168
+ attentions?: Tensor;
169
+ });
170
+ last_hidden_state: Tensor;
171
+ hidden_states: Tensor;
172
+ attentions: Tensor;
173
+ }
174
+ export class BertPreTrainedModel extends PreTrainedModel {
175
+ }
176
+ export class BertModel extends BertPreTrainedModel {
177
+ }
178
+ /**
179
+ * BertForMaskedLM is a class representing a BERT model for masked language modeling.
180
+ */
181
+ export class BertForMaskedLM extends BertPreTrainedModel {
182
+ /**
183
+ * Calls the model on new inputs.
184
+ *
185
+ * @param {Object} model_inputs The inputs to the model.
186
+ * @returns {Promise<MaskedLMOutput>} An object containing the model's output logits for masked language modeling.
187
+ */
188
+ _call(model_inputs: any): Promise<MaskedLMOutput>;
189
+ }
190
+ /**
191
+ * BertForSequenceClassification is a class representing a BERT model for sequence classification.
192
+ */
193
+ export class BertForSequenceClassification extends BertPreTrainedModel {
194
+ /**
195
+ * Calls the model on new inputs.
196
+ *
197
+ * @param {Object} model_inputs The inputs to the model.
198
+ * @returns {Promise<SequenceClassifierOutput>} An object containing the model's output logits for sequence classification.
199
+ */
200
+ _call(model_inputs: any): Promise<SequenceClassifierOutput>;
201
+ }
202
+ /**
203
+ * BertForTokenClassification is a class representing a BERT model for token classification.
204
+ */
205
+ export class BertForTokenClassification extends BertPreTrainedModel {
206
+ /**
207
+ * Calls the model on new inputs.
208
+ *
209
+ * @param {Object} model_inputs The inputs to the model.
210
+ * @returns {Promise<TokenClassifierOutput>} An object containing the model's output logits for token classification.
211
+ */
212
+ _call(model_inputs: any): Promise<TokenClassifierOutput>;
213
+ }
214
+ /**
215
+ * BertForQuestionAnswering is a class representing a BERT model for question answering.
216
+ */
217
+ export class BertForQuestionAnswering extends BertPreTrainedModel {
218
+ /**
219
+ * Calls the model on new inputs.
220
+ *
221
+ * @param {Object} model_inputs The inputs to the model.
222
+ * @returns {Promise<QuestionAnsweringModelOutput>} An object containing the model's output logits for question answering.
223
+ */
224
+ _call(model_inputs: any): Promise<QuestionAnsweringModelOutput>;
225
+ }
226
+ export class NomicBertPreTrainedModel extends PreTrainedModel {
227
+ }
228
+ export class NomicBertModel extends NomicBertPreTrainedModel {
229
+ }
230
+ export class RoFormerPreTrainedModel extends PreTrainedModel {
231
+ }
232
+ /**
233
+ * The bare RoFormer Model transformer outputting raw hidden-states without any specific head on top.
234
+ */
235
+ export class RoFormerModel extends RoFormerPreTrainedModel {
236
+ }
237
+ /**
238
+ * RoFormer Model with a `language modeling` head on top.
239
+ */
240
+ export class RoFormerForMaskedLM extends RoFormerPreTrainedModel {
241
+ /**
242
+ * Calls the model on new inputs.
243
+ *
244
+ * @param {Object} model_inputs The inputs to the model.
245
+ * @returns {Promise<MaskedLMOutput>} An object containing the model's output logits for masked language modeling.
246
+ */
247
+ _call(model_inputs: any): Promise<MaskedLMOutput>;
248
+ }
249
+ /**
250
+ * RoFormer Model transformer with a sequence classification/regression head on top (a linear layer on top of the pooled output)
251
+ */
252
+ export class RoFormerForSequenceClassification extends RoFormerPreTrainedModel {
253
+ /**
254
+ * Calls the model on new inputs.
255
+ *
256
+ * @param {Object} model_inputs The inputs to the model.
257
+ * @returns {Promise<SequenceClassifierOutput>} An object containing the model's output logits for sequence classification.
258
+ */
259
+ _call(model_inputs: any): Promise<SequenceClassifierOutput>;
260
+ }
261
+ /**
262
+ * RoFormer Model with a token classification head on top (a linear layer on top of the hidden-states output)
263
+ * e.g. for Named-Entity-Recognition (NER) tasks.
264
+ */
265
+ export class RoFormerForTokenClassification extends RoFormerPreTrainedModel {
266
+ /**
267
+ * Calls the model on new inputs.
268
+ *
269
+ * @param {Object} model_inputs The inputs to the model.
270
+ * @returns {Promise<TokenClassifierOutput>} An object containing the model's output logits for token classification.
271
+ */
272
+ _call(model_inputs: any): Promise<TokenClassifierOutput>;
273
+ }
274
+ /**
275
+ * RoFormer Model with a span classification head on top for extractive question-answering tasks like SQuAD
276
+ * (a linear layers on top of the hidden-states output to compute `span start logits` and `span end logits`).
277
+ */
278
+ export class RoFormerForQuestionAnswering extends RoFormerPreTrainedModel {
279
+ /**
280
+ * Calls the model on new inputs.
281
+ *
282
+ * @param {Object} model_inputs The inputs to the model.
283
+ * @returns {Promise<QuestionAnsweringModelOutput>} An object containing the model's output logits for question answering.
284
+ */
285
+ _call(model_inputs: any): Promise<QuestionAnsweringModelOutput>;
286
+ }
287
+ export class ConvBertPreTrainedModel extends PreTrainedModel {
288
+ }
289
+ /**
290
+ * The bare ConvBERT Model transformer outputting raw hidden-states without any specific head on top.
291
+ */
292
+ export class ConvBertModel extends ConvBertPreTrainedModel {
293
+ }
294
+ /**
295
+ * ConvBERT Model with a language modeling head on top.
296
+ */
297
+ export class ConvBertForMaskedLM extends ConvBertPreTrainedModel {
298
+ /**
299
+ * Calls the model on new inputs.
300
+ *
301
+ * @param {Object} model_inputs The inputs to the model.
302
+ * @returns {Promise<MaskedLMOutput>} An object containing the model's output logits for masked language modeling.
303
+ */
304
+ _call(model_inputs: any): Promise<MaskedLMOutput>;
305
+ }
306
+ /**
307
+ * ConvBERT Model transformer with a sequence classification/regression head on top (a linear layer on top of the pooled output)
308
+ */
309
+ export class ConvBertForSequenceClassification extends ConvBertPreTrainedModel {
310
+ /**
311
+ * Calls the model on new inputs.
312
+ *
313
+ * @param {Object} model_inputs The inputs to the model.
314
+ * @returns {Promise<SequenceClassifierOutput>} An object containing the model's output logits for sequence classification.
315
+ */
316
+ _call(model_inputs: any): Promise<SequenceClassifierOutput>;
317
+ }
318
+ /**
319
+ * ConvBERT Model with a token classification head on top (a linear layer on top of the hidden-states output)
320
+ * e.g. for Named-Entity-Recognition (NER) tasks.
321
+ */
322
+ export class ConvBertForTokenClassification extends ConvBertPreTrainedModel {
323
+ /**
324
+ * Calls the model on new inputs.
325
+ *
326
+ * @param {Object} model_inputs The inputs to the model.
327
+ * @returns {Promise<TokenClassifierOutput>} An object containing the model's output logits for token classification.
328
+ */
329
+ _call(model_inputs: any): Promise<TokenClassifierOutput>;
330
+ }
331
+ /**
332
+ * ConvBERT Model with a span classification head on top for extractive question-answering tasks like SQuAD
333
+ * (a linear layers on top of the hidden-states output to compute `span start logits` and `span end logits`)
334
+ */
335
+ export class ConvBertForQuestionAnswering extends ConvBertPreTrainedModel {
336
+ /**
337
+ * Calls the model on new inputs.
338
+ *
339
+ * @param {Object} model_inputs The inputs to the model.
340
+ * @returns {Promise<QuestionAnsweringModelOutput>} An object containing the model's output logits for question answering.
341
+ */
342
+ _call(model_inputs: any): Promise<QuestionAnsweringModelOutput>;
343
+ }
344
+ export class ElectraPreTrainedModel extends PreTrainedModel {
345
+ }
346
+ /**
347
+ * The bare Electra Model transformer outputting raw hidden-states without any specific head on top.
348
+ * Identical to the BERT model except that it uses an additional linear layer between the embedding
349
+ * layer and the encoder if the hidden size and embedding size are different.
350
+ */
351
+ export class ElectraModel extends ElectraPreTrainedModel {
352
+ }
353
+ /**
354
+ * Electra model with a language modeling head on top.
355
+ */
356
+ export class ElectraForMaskedLM extends ElectraPreTrainedModel {
357
+ /**
358
+ * Calls the model on new inputs.
359
+ *
360
+ * @param {Object} model_inputs The inputs to the model.
361
+ * @returns {Promise<MaskedLMOutput>} An object containing the model's output logits for masked language modeling.
362
+ */
363
+ _call(model_inputs: any): Promise<MaskedLMOutput>;
364
+ }
365
+ /**
366
+ * ELECTRA Model transformer with a sequence classification/regression head on top (a linear layer on top of the pooled output)
367
+ */
368
+ export class ElectraForSequenceClassification extends ElectraPreTrainedModel {
369
+ /**
370
+ * Calls the model on new inputs.
371
+ *
372
+ * @param {Object} model_inputs The inputs to the model.
373
+ * @returns {Promise<SequenceClassifierOutput>} An object containing the model's output logits for sequence classification.
374
+ */
375
+ _call(model_inputs: any): Promise<SequenceClassifierOutput>;
376
+ }
377
+ /**
378
+ * Electra model with a token classification head on top.
379
+ */
380
+ export class ElectraForTokenClassification extends ElectraPreTrainedModel {
381
+ /**
382
+ * Calls the model on new inputs.
383
+ *
384
+ * @param {Object} model_inputs The inputs to the model.
385
+ * @returns {Promise<TokenClassifierOutput>} An object containing the model's output logits for token classification.
386
+ */
387
+ _call(model_inputs: any): Promise<TokenClassifierOutput>;
388
+ }
389
+ /**
390
+ * LECTRA Model with a span classification head on top for extractive question-answering tasks like SQuAD
391
+ * (a linear layers on top of the hidden-states output to compute `span start logits` and `span end logits`).
392
+ */
393
+ export class ElectraForQuestionAnswering extends ElectraPreTrainedModel {
394
+ /**
395
+ * Calls the model on new inputs.
396
+ *
397
+ * @param {Object} model_inputs The inputs to the model.
398
+ * @returns {Promise<QuestionAnsweringModelOutput>} An object containing the model's output logits for question answering.
399
+ */
400
+ _call(model_inputs: any): Promise<QuestionAnsweringModelOutput>;
401
+ }
402
+ export class CamembertPreTrainedModel extends PreTrainedModel {
403
+ }
404
+ /**
405
+ * The bare CamemBERT Model transformer outputting raw hidden-states without any specific head on top.
406
+ */
407
+ export class CamembertModel extends CamembertPreTrainedModel {
408
+ }
409
+ /**
410
+ * CamemBERT Model with a `language modeling` head on top.
411
+ */
412
+ export class CamembertForMaskedLM extends CamembertPreTrainedModel {
413
+ /**
414
+ * Calls the model on new inputs.
415
+ *
416
+ * @param {Object} model_inputs The inputs to the model.
417
+ * @returns {Promise<MaskedLMOutput>} An object containing the model's output logits for masked language modeling.
418
+ */
419
+ _call(model_inputs: any): Promise<MaskedLMOutput>;
420
+ }
421
+ /**
422
+ * CamemBERT Model transformer with a sequence classification/regression head on top (a linear layer on top of the pooled output) e.g. for GLUE tasks.
423
+ */
424
+ export class CamembertForSequenceClassification extends CamembertPreTrainedModel {
425
+ /**
426
+ * Calls the model on new inputs.
427
+ *
428
+ * @param {Object} model_inputs The inputs to the model.
429
+ * @returns {Promise<SequenceClassifierOutput>} An object containing the model's output logits for sequence classification.
430
+ */
431
+ _call(model_inputs: any): Promise<SequenceClassifierOutput>;
432
+ }
433
+ /**
434
+ * CamemBERT Model with a token classification head on top (a linear layer on top of the hidden-states output) e.g. for Named-Entity-Recognition (NER) tasks.
435
+ */
436
+ export class CamembertForTokenClassification extends CamembertPreTrainedModel {
437
+ /**
438
+ * Calls the model on new inputs.
439
+ *
440
+ * @param {Object} model_inputs The inputs to the model.
441
+ * @returns {Promise<TokenClassifierOutput>} An object containing the model's output logits for token classification.
442
+ */
443
+ _call(model_inputs: any): Promise<TokenClassifierOutput>;
444
+ }
445
+ /**
446
+ * CamemBERT Model with a span classification head on top for extractive question-answering tasks
447
+ */
448
+ export class CamembertForQuestionAnswering extends CamembertPreTrainedModel {
449
+ /**
450
+ * Calls the model on new inputs.
451
+ *
452
+ * @param {Object} model_inputs The inputs to the model.
453
+ * @returns {Promise<QuestionAnsweringModelOutput>} An object containing the model's output logits for question answering.
454
+ */
455
+ _call(model_inputs: any): Promise<QuestionAnsweringModelOutput>;
456
+ }
457
+ export class DebertaPreTrainedModel extends PreTrainedModel {
458
+ }
459
+ /**
460
+ * The bare DeBERTa Model transformer outputting raw hidden-states without any specific head on top.
461
+ */
462
+ export class DebertaModel extends DebertaPreTrainedModel {
463
+ }
464
+ /**
465
+ * DeBERTa Model with a `language modeling` head on top.
466
+ */
467
+ export class DebertaForMaskedLM extends DebertaPreTrainedModel {
468
+ /**
469
+ * Calls the model on new inputs.
470
+ *
471
+ * @param {Object} model_inputs The inputs to the model.
472
+ * @returns {Promise<MaskedLMOutput>} An object containing the model's output logits for masked language modeling.
473
+ */
474
+ _call(model_inputs: any): Promise<MaskedLMOutput>;
475
+ }
476
+ /**
477
+ * DeBERTa Model transformer with a sequence classification/regression head on top (a linear layer on top of the pooled output)
478
+ */
479
+ export class DebertaForSequenceClassification extends DebertaPreTrainedModel {
480
+ /**
481
+ * Calls the model on new inputs.
482
+ *
483
+ * @param {Object} model_inputs The inputs to the model.
484
+ * @returns {Promise<SequenceClassifierOutput>} An object containing the model's output logits for sequence classification.
485
+ */
486
+ _call(model_inputs: any): Promise<SequenceClassifierOutput>;
487
+ }
488
+ /**
489
+ * DeBERTa Model with a token classification head on top (a linear layer on top of the hidden-states output) e.g. for Named-Entity-Recognition (NER) tasks.
490
+ */
491
+ export class DebertaForTokenClassification extends DebertaPreTrainedModel {
492
+ /**
493
+ * Calls the model on new inputs.
494
+ *
495
+ * @param {Object} model_inputs The inputs to the model.
496
+ * @returns {Promise<TokenClassifierOutput>} An object containing the model's output logits for token classification.
497
+ */
498
+ _call(model_inputs: any): Promise<TokenClassifierOutput>;
499
+ }
500
+ /**
501
+ * DeBERTa Model with a span classification head on top for extractive question-answering tasks like SQuAD (a linear
502
+ * layers on top of the hidden-states output to compute `span start logits` and `span end logits`).
503
+ */
504
+ export class DebertaForQuestionAnswering extends DebertaPreTrainedModel {
505
+ /**
506
+ * Calls the model on new inputs.
507
+ *
508
+ * @param {Object} model_inputs The inputs to the model.
509
+ * @returns {Promise<QuestionAnsweringModelOutput>} An object containing the model's output logits for question answering.
510
+ */
511
+ _call(model_inputs: any): Promise<QuestionAnsweringModelOutput>;
512
+ }
513
+ export class DebertaV2PreTrainedModel extends PreTrainedModel {
514
+ }
515
+ /**
516
+ * The bare DeBERTa-V2 Model transformer outputting raw hidden-states without any specific head on top.
517
+ */
518
+ export class DebertaV2Model extends DebertaV2PreTrainedModel {
519
+ }
520
+ /**
521
+ * DeBERTa-V2 Model with a `language modeling` head on top.
522
+ */
523
+ export class DebertaV2ForMaskedLM extends DebertaV2PreTrainedModel {
524
+ /**
525
+ * Calls the model on new inputs.
526
+ *
527
+ * @param {Object} model_inputs The inputs to the model.
528
+ * @returns {Promise<MaskedLMOutput>} An object containing the model's output logits for masked language modeling.
529
+ */
530
+ _call(model_inputs: any): Promise<MaskedLMOutput>;
531
+ }
532
+ /**
533
+ * DeBERTa-V2 Model transformer with a sequence classification/regression head on top (a linear layer on top of the pooled output)
534
+ */
535
+ export class DebertaV2ForSequenceClassification extends DebertaV2PreTrainedModel {
536
+ /**
537
+ * Calls the model on new inputs.
538
+ *
539
+ * @param {Object} model_inputs The inputs to the model.
540
+ * @returns {Promise<SequenceClassifierOutput>} An object containing the model's output logits for sequence classification.
541
+ */
542
+ _call(model_inputs: any): Promise<SequenceClassifierOutput>;
543
+ }
544
+ /**
545
+ * DeBERTa-V2 Model with a token classification head on top (a linear layer on top of the hidden-states output) e.g. for Named-Entity-Recognition (NER) tasks.
546
+ */
547
+ export class DebertaV2ForTokenClassification extends DebertaV2PreTrainedModel {
548
+ /**
549
+ * Calls the model on new inputs.
550
+ *
551
+ * @param {Object} model_inputs The inputs to the model.
552
+ * @returns {Promise<TokenClassifierOutput>} An object containing the model's output logits for token classification.
553
+ */
554
+ _call(model_inputs: any): Promise<TokenClassifierOutput>;
555
+ }
556
+ /**
557
+ * DeBERTa-V2 Model with a span classification head on top for extractive question-answering tasks like SQuAD (a linear
558
+ * layers on top of the hidden-states output to compute `span start logits` and `span end logits`).
559
+ */
560
+ export class DebertaV2ForQuestionAnswering extends DebertaV2PreTrainedModel {
561
+ /**
562
+ * Calls the model on new inputs.
563
+ *
564
+ * @param {Object} model_inputs The inputs to the model.
565
+ * @returns {Promise<QuestionAnsweringModelOutput>} An object containing the model's output logits for question answering.
566
+ */
567
+ _call(model_inputs: any): Promise<QuestionAnsweringModelOutput>;
568
+ }
569
+ export class DistilBertPreTrainedModel extends PreTrainedModel {
570
+ }
571
+ export class DistilBertModel extends DistilBertPreTrainedModel {
572
+ }
573
+ /**
574
+ * DistilBertForSequenceClassification is a class representing a DistilBERT model for sequence classification.
575
+ */
576
+ export class DistilBertForSequenceClassification extends DistilBertPreTrainedModel {
577
+ /**
578
+ * Calls the model on new inputs.
579
+ *
580
+ * @param {Object} model_inputs The inputs to the model.
581
+ * @returns {Promise<SequenceClassifierOutput>} An object containing the model's output logits for sequence classification.
582
+ */
583
+ _call(model_inputs: any): Promise<SequenceClassifierOutput>;
584
+ }
585
+ /**
586
+ * DistilBertForTokenClassification is a class representing a DistilBERT model for token classification.
587
+ */
588
+ export class DistilBertForTokenClassification extends DistilBertPreTrainedModel {
589
+ /**
590
+ * Calls the model on new inputs.
591
+ *
592
+ * @param {Object} model_inputs The inputs to the model.
593
+ * @returns {Promise<TokenClassifierOutput>} An object containing the model's output logits for token classification.
594
+ */
595
+ _call(model_inputs: any): Promise<TokenClassifierOutput>;
596
+ }
597
+ /**
598
+ * DistilBertForQuestionAnswering is a class representing a DistilBERT model for question answering.
599
+ */
600
+ export class DistilBertForQuestionAnswering extends DistilBertPreTrainedModel {
601
+ /**
602
+ * Calls the model on new inputs.
603
+ *
604
+ * @param {Object} model_inputs The inputs to the model.
605
+ * @returns {Promise<QuestionAnsweringModelOutput>} An object containing the model's output logits for question answering.
606
+ */
607
+ _call(model_inputs: any): Promise<QuestionAnsweringModelOutput>;
608
+ }
609
+ /**
610
+ * DistilBertForMaskedLM is a class representing a DistilBERT model for masking task.
611
+ */
612
+ export class DistilBertForMaskedLM extends DistilBertPreTrainedModel {
613
+ /**
614
+ * Calls the model on new inputs.
615
+ *
616
+ * @param {Object} model_inputs The inputs to the model.
617
+ * @returns {Promise<MaskedLMOutput>} returned object
618
+ */
619
+ _call(model_inputs: any): Promise<MaskedLMOutput>;
620
+ }
621
+ export class EsmPreTrainedModel extends PreTrainedModel {
622
+ }
623
+ /**
624
+ * The bare ESM Model transformer outputting raw hidden-states without any specific head on top.
625
+ */
626
+ export class EsmModel extends EsmPreTrainedModel {
627
+ }
628
+ /**
629
+ * ESM Model with a `language modeling` head on top.
630
+ */
631
+ export class EsmForMaskedLM extends EsmPreTrainedModel {
632
+ /**
633
+ * Calls the model on new inputs.
634
+ *
635
+ * @param {Object} model_inputs The inputs to the model.
636
+ * @returns {Promise<MaskedLMOutput>} An object containing the model's output logits for masked language modeling.
637
+ */
638
+ _call(model_inputs: any): Promise<MaskedLMOutput>;
639
+ }
640
+ /**
641
+ * ESM Model transformer with a sequence classification/regression head on top (a linear layer on top of the pooled output)
642
+ */
643
+ export class EsmForSequenceClassification extends EsmPreTrainedModel {
644
+ /**
645
+ * Calls the model on new inputs.
646
+ *
647
+ * @param {Object} model_inputs The inputs to the model.
648
+ * @returns {Promise<SequenceClassifierOutput>} An object containing the model's output logits for sequence classification.
649
+ */
650
+ _call(model_inputs: any): Promise<SequenceClassifierOutput>;
651
+ }
652
+ /**
653
+ * ESM Model with a token classification head on top (a linear layer on top of the hidden-states output)
654
+ * e.g. for Named-Entity-Recognition (NER) tasks.
655
+ */
656
+ export class EsmForTokenClassification extends EsmPreTrainedModel {
657
+ /**
658
+ * Calls the model on new inputs.
659
+ *
660
+ * @param {Object} model_inputs The inputs to the model.
661
+ * @returns {Promise<TokenClassifierOutput>} An object containing the model's output logits for token classification.
662
+ */
663
+ _call(model_inputs: any): Promise<TokenClassifierOutput>;
664
+ }
665
+ export class MobileBertPreTrainedModel extends PreTrainedModel {
666
+ }
667
+ export class MobileBertModel extends MobileBertPreTrainedModel {
668
+ }
669
+ /**
670
+ * MobileBertForMaskedLM is a class representing a MobileBERT model for masking task.
671
+ */
672
+ export class MobileBertForMaskedLM extends MobileBertPreTrainedModel {
673
+ /**
674
+ * Calls the model on new inputs.
675
+ *
676
+ * @param {Object} model_inputs The inputs to the model.
677
+ * @returns {Promise<MaskedLMOutput>} returned object
678
+ */
679
+ _call(model_inputs: any): Promise<MaskedLMOutput>;
680
+ }
681
+ /**
682
+ * MobileBert Model transformer with a sequence classification/regression head on top (a linear layer on top of the pooled output)
683
+ */
684
+ export class MobileBertForSequenceClassification extends MobileBertPreTrainedModel {
685
+ /**
686
+ * Calls the model on new inputs.
687
+ *
688
+ * @param {Object} model_inputs The inputs to the model.
689
+ * @returns {Promise<SequenceClassifierOutput>} returned object
690
+ */
691
+ _call(model_inputs: any): Promise<SequenceClassifierOutput>;
692
+ }
693
+ /**
694
+ * MobileBert Model with a span classification head on top for extractive question-answering tasks
695
+ */
696
+ export class MobileBertForQuestionAnswering extends MobileBertPreTrainedModel {
697
+ /**
698
+ * Calls the model on new inputs.
699
+ *
700
+ * @param {Object} model_inputs The inputs to the model.
701
+ * @returns {Promise<QuestionAnsweringModelOutput>} returned object
702
+ */
703
+ _call(model_inputs: any): Promise<QuestionAnsweringModelOutput>;
704
+ }
705
+ export class MPNetPreTrainedModel extends PreTrainedModel {
706
+ }
707
+ /**
708
+ * The bare MPNet Model transformer outputting raw hidden-states without any specific head on top.
709
+ */
710
+ export class MPNetModel extends MPNetPreTrainedModel {
711
+ }
712
+ /**
713
+ * MPNetForMaskedLM is a class representing a MPNet model for masked language modeling.
714
+ */
715
+ export class MPNetForMaskedLM extends MPNetPreTrainedModel {
716
+ /**
717
+ * Calls the model on new inputs.
718
+ *
719
+ * @param {Object} model_inputs The inputs to the model.
720
+ * @returns {Promise<MaskedLMOutput>} An object containing the model's output logits for masked language modeling.
721
+ */
722
+ _call(model_inputs: any): Promise<MaskedLMOutput>;
723
+ }
724
+ /**
725
+ * MPNetForSequenceClassification is a class representing a MPNet model for sequence classification.
726
+ */
727
+ export class MPNetForSequenceClassification extends MPNetPreTrainedModel {
728
+ /**
729
+ * Calls the model on new inputs.
730
+ *
731
+ * @param {Object} model_inputs The inputs to the model.
732
+ * @returns {Promise<SequenceClassifierOutput>} An object containing the model's output logits for sequence classification.
733
+ */
734
+ _call(model_inputs: any): Promise<SequenceClassifierOutput>;
735
+ }
736
+ /**
737
+ * MPNetForTokenClassification is a class representing a MPNet model for token classification.
738
+ */
739
+ export class MPNetForTokenClassification extends MPNetPreTrainedModel {
740
+ /**
741
+ * Calls the model on new inputs.
742
+ *
743
+ * @param {Object} model_inputs The inputs to the model.
744
+ * @returns {Promise<TokenClassifierOutput>} An object containing the model's output logits for token classification.
745
+ */
746
+ _call(model_inputs: any): Promise<TokenClassifierOutput>;
747
+ }
748
+ /**
749
+ * MPNetForQuestionAnswering is a class representing a MPNet model for question answering.
750
+ */
751
+ export class MPNetForQuestionAnswering extends MPNetPreTrainedModel {
752
+ /**
753
+ * Calls the model on new inputs.
754
+ *
755
+ * @param {Object} model_inputs The inputs to the model.
756
+ * @returns {Promise<QuestionAnsweringModelOutput>} An object containing the model's output logits for question answering.
757
+ */
758
+ _call(model_inputs: any): Promise<QuestionAnsweringModelOutput>;
759
+ }
760
+ export class SqueezeBertPreTrainedModel extends PreTrainedModel {
761
+ }
762
+ export class SqueezeBertModel extends SqueezeBertPreTrainedModel {
763
+ }
764
+ export class SqueezeBertForMaskedLM extends SqueezeBertPreTrainedModel {
765
+ /**
766
+ * Calls the model on new inputs.
767
+ *
768
+ * @param {Object} model_inputs The inputs to the model.
769
+ * @returns {Promise<MaskedLMOutput>} returned object
770
+ */
771
+ _call(model_inputs: any): Promise<MaskedLMOutput>;
772
+ }
773
+ export class SqueezeBertForSequenceClassification extends SqueezeBertPreTrainedModel {
774
+ /**
775
+ * Calls the model on new inputs.
776
+ *
777
+ * @param {Object} model_inputs The inputs to the model.
778
+ * @returns {Promise<SequenceClassifierOutput>} returned object
779
+ */
780
+ _call(model_inputs: any): Promise<SequenceClassifierOutput>;
781
+ }
782
+ export class SqueezeBertForQuestionAnswering extends SqueezeBertPreTrainedModel {
783
+ /**
784
+ * Calls the model on new inputs.
785
+ *
786
+ * @param {Object} model_inputs The inputs to the model.
787
+ * @returns {Promise<QuestionAnsweringModelOutput>} returned object
788
+ */
789
+ _call(model_inputs: any): Promise<QuestionAnsweringModelOutput>;
790
+ }
791
+ export class AlbertPreTrainedModel extends PreTrainedModel {
792
+ }
793
+ export class AlbertModel extends AlbertPreTrainedModel {
794
+ }
795
+ export class AlbertForSequenceClassification extends AlbertPreTrainedModel {
796
+ /**
797
+ * Calls the model on new inputs.
798
+ *
799
+ * @param {Object} model_inputs The inputs to the model.
800
+ * @returns {Promise<SequenceClassifierOutput>} returned object
801
+ */
802
+ _call(model_inputs: any): Promise<SequenceClassifierOutput>;
803
+ }
804
+ export class AlbertForQuestionAnswering extends AlbertPreTrainedModel {
805
+ /**
806
+ * Calls the model on new inputs.
807
+ *
808
+ * @param {Object} model_inputs The inputs to the model.
809
+ * @returns {Promise<QuestionAnsweringModelOutput>} returned object
810
+ */
811
+ _call(model_inputs: any): Promise<QuestionAnsweringModelOutput>;
812
+ }
813
+ export class AlbertForMaskedLM extends AlbertPreTrainedModel {
814
+ /**
815
+ * Calls the model on new inputs.
816
+ *
817
+ * @param {Object} model_inputs The inputs to the model.
818
+ * @returns {Promise<MaskedLMOutput>} returned object
819
+ */
820
+ _call(model_inputs: any): Promise<MaskedLMOutput>;
821
+ }
822
+ export class T5PreTrainedModel extends PreTrainedModel {
823
+ }
824
+ export class T5Model extends T5PreTrainedModel {
825
+ }
826
+ /**
827
+ * T5Model is a class representing a T5 model for conditional generation.
828
+ */
829
+ export class T5ForConditionalGeneration extends T5PreTrainedModel {
830
+ /**
831
+ * Creates a new instance of the `T5ForConditionalGeneration` class.
832
+ * @param {Object} config The model configuration.
833
+ * @param {any} session session for the model.
834
+ * @param {any} decoder_merged_session session for the decoder.
835
+ * @param {GenerationConfig} generation_config The generation configuration.
836
+ */
837
+ constructor(config: any, session: any, decoder_merged_session: any, generation_config: new (kwargs?: import("./utils/generation.js").GenerationConfigType) => import("./utils/generation.js").GenerationConfigType);
838
+ decoder_merged_session: any;
839
+ generation_config: new (kwargs?: import("./utils/generation.js").GenerationConfigType) => import("./utils/generation.js").GenerationConfigType;
840
+ num_decoder_layers: any;
841
+ num_decoder_heads: any;
842
+ decoder_dim_kv: any;
843
+ num_encoder_layers: any;
844
+ num_encoder_heads: any;
845
+ encoder_dim_kv: any;
846
+ }
847
+ /**
848
+ * An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained models.
849
+ */
850
+ export class LongT5PreTrainedModel extends PreTrainedModel {
851
+ }
852
+ /**
853
+ * The bare LONGT5 Model transformer outputting raw hidden-states without any specific head on top.
854
+ */
855
+ export class LongT5Model extends LongT5PreTrainedModel {
856
+ }
857
+ /**
858
+ * LONGT5 Model with a `language modeling` head on top.
859
+ */
860
+ export class LongT5ForConditionalGeneration extends LongT5PreTrainedModel {
861
+ /**
862
+ * Creates a new instance of the `LongT5ForConditionalGeneration` class.
863
+ * @param {Object} config The model configuration.
864
+ * @param {any} session session for the model.
865
+ * @param {any} decoder_merged_session session for the decoder.
866
+ * @param {GenerationConfig} generation_config The generation configuration.
867
+ */
868
+ constructor(config: any, session: any, decoder_merged_session: any, generation_config: new (kwargs?: import("./utils/generation.js").GenerationConfigType) => import("./utils/generation.js").GenerationConfigType);
869
+ decoder_merged_session: any;
870
+ generation_config: new (kwargs?: import("./utils/generation.js").GenerationConfigType) => import("./utils/generation.js").GenerationConfigType;
871
+ num_decoder_layers: any;
872
+ num_decoder_heads: any;
873
+ decoder_dim_kv: any;
874
+ num_encoder_layers: any;
875
+ num_encoder_heads: any;
876
+ encoder_dim_kv: any;
877
+ }
878
+ export class MT5PreTrainedModel extends PreTrainedModel {
879
+ }
880
+ export class MT5Model extends MT5PreTrainedModel {
881
+ }
882
+ /**
883
+ * A class representing a conditional sequence-to-sequence model based on the MT5 architecture.
884
+ */
885
+ export class MT5ForConditionalGeneration extends MT5PreTrainedModel {
886
+ /**
887
+ * Creates a new instance of the `MT5ForConditionalGeneration` class.
888
+ * @param {any} config The model configuration.
889
+ * @param {any} session The ONNX session containing the encoder weights.
890
+ * @param {any} decoder_merged_session The ONNX session containing the merged decoder weights.
891
+ * @param {GenerationConfig} generation_config The generation configuration.
892
+ */
893
+ constructor(config: any, session: any, decoder_merged_session: any, generation_config: new (kwargs?: import("./utils/generation.js").GenerationConfigType) => import("./utils/generation.js").GenerationConfigType);
894
+ decoder_merged_session: any;
895
+ generation_config: new (kwargs?: import("./utils/generation.js").GenerationConfigType) => import("./utils/generation.js").GenerationConfigType;
896
+ num_decoder_layers: any;
897
+ num_decoder_heads: any;
898
+ decoder_dim_kv: any;
899
+ num_encoder_layers: any;
900
+ num_encoder_heads: any;
901
+ encoder_dim_kv: any;
902
+ }
903
+ export class BartPretrainedModel extends PreTrainedModel {
904
+ }
905
+ /**
906
+ * The bare BART Model outputting raw hidden-states without any specific head on top.
907
+ */
908
+ export class BartModel extends BartPretrainedModel {
909
+ }
910
+ /**
911
+ * The BART Model with a language modeling head. Can be used for summarization.
912
+ */
913
+ export class BartForConditionalGeneration extends BartPretrainedModel {
914
+ /**
915
+ * Creates a new instance of the `BartForConditionalGeneration` class.
916
+ * @param {Object} config The configuration object for the Bart model.
917
+ * @param {Object} session The ONNX session used to execute the model.
918
+ * @param {Object} decoder_merged_session The ONNX session used to execute the decoder.
919
+ * @param {Object} generation_config The generation configuration object.
920
+ */
921
+ constructor(config: any, session: any, decoder_merged_session: any, generation_config: any);
922
+ decoder_merged_session: any;
923
+ generation_config: any;
924
+ num_decoder_layers: any;
925
+ num_decoder_heads: any;
926
+ decoder_dim_kv: number;
927
+ num_encoder_layers: any;
928
+ num_encoder_heads: any;
929
+ encoder_dim_kv: number;
930
+ }
931
+ /**
932
+ * Bart model with a sequence classification/head on top (a linear layer on top of the pooled output)
933
+ */
934
+ export class BartForSequenceClassification extends BartPretrainedModel {
935
+ /**
936
+ * Calls the model on new inputs.
937
+ *
938
+ * @param {Object} model_inputs The inputs to the model.
939
+ * @returns {Promise<SequenceClassifierOutput>} An object containing the model's output logits for sequence classification.
940
+ */
941
+ _call(model_inputs: any): Promise<SequenceClassifierOutput>;
942
+ }
943
+ export class MBartPreTrainedModel extends PreTrainedModel {
944
+ }
945
+ /**
946
+ * The bare MBART Model outputting raw hidden-states without any specific head on top.
947
+ */
948
+ export class MBartModel extends MBartPreTrainedModel {
949
+ }
950
+ /**
951
+ * The MBART Model with a language modeling head. Can be used for summarization, after fine-tuning the pretrained models.
952
+ */
953
+ export class MBartForConditionalGeneration extends MBartPreTrainedModel {
954
+ /**
955
+ * Creates a new instance of the `MBartForConditionalGeneration` class.
956
+ * @param {Object} config The configuration object for the Bart model.
957
+ * @param {Object} session The ONNX session used to execute the model.
958
+ * @param {Object} decoder_merged_session The ONNX session used to execute the decoder.
959
+ * @param {Object} generation_config The generation configuration object.
960
+ */
961
+ constructor(config: any, session: any, decoder_merged_session: any, generation_config: any);
962
+ decoder_merged_session: any;
963
+ generation_config: any;
964
+ num_decoder_layers: any;
965
+ num_decoder_heads: any;
966
+ decoder_dim_kv: number;
967
+ num_encoder_layers: any;
968
+ num_encoder_heads: any;
969
+ encoder_dim_kv: number;
970
+ }
971
+ /**
972
+ * MBart model with a sequence classification/head on top (a linear layer on top of the pooled output).
973
+ */
974
+ export class MBartForSequenceClassification extends MBartPreTrainedModel {
975
+ /**
976
+ * Calls the model on new inputs.
977
+ *
978
+ * @param {Object} model_inputs The inputs to the model.
979
+ * @returns {Promise<SequenceClassifierOutput>} An object containing the model's output logits for sequence classification.
980
+ */
981
+ _call(model_inputs: any): Promise<SequenceClassifierOutput>;
982
+ }
983
+ export class MBartForCausalLM extends MBartPreTrainedModel {
984
+ /**
985
+ * Creates a new instance of the `MBartForCausalLM` class.
986
+ * @param {Object} config Configuration object for the model.
987
+ * @param {Object} decoder_merged_session ONNX Session object for the decoder.
988
+ * @param {Object} generation_config Configuration object for the generation process.
989
+ */
990
+ constructor(config: any, decoder_merged_session: any, generation_config: any);
991
+ generation_config: any;
992
+ num_decoder_layers: any;
993
+ num_decoder_heads: any;
994
+ decoder_dim_kv: number;
995
+ num_encoder_layers: any;
996
+ num_encoder_heads: any;
997
+ encoder_dim_kv: number;
998
+ }
999
+ export class BlenderbotPreTrainedModel extends PreTrainedModel {
1000
+ }
1001
+ /**
1002
+ * The bare Blenderbot Model outputting raw hidden-states without any specific head on top.
1003
+ */
1004
+ export class BlenderbotModel extends BlenderbotPreTrainedModel {
1005
+ }
1006
+ /**
1007
+ * The Blenderbot Model with a language modeling head. Can be used for summarization.
1008
+ */
1009
+ export class BlenderbotForConditionalGeneration extends BlenderbotPreTrainedModel {
1010
+ /**
1011
+ * Creates a new instance of the `BlenderbotForConditionalGeneration` class.
1012
+ * @param {any} config The model configuration.
1013
+ * @param {any} session The ONNX session containing the encoder weights.
1014
+ * @param {any} decoder_merged_session The ONNX session containing the merged decoder weights.
1015
+ * @param {GenerationConfig} generation_config The generation configuration.
1016
+ */
1017
+ constructor(config: any, session: any, decoder_merged_session: any, generation_config: new (kwargs?: import("./utils/generation.js").GenerationConfigType) => import("./utils/generation.js").GenerationConfigType);
1018
+ decoder_merged_session: any;
1019
+ generation_config: new (kwargs?: import("./utils/generation.js").GenerationConfigType) => import("./utils/generation.js").GenerationConfigType;
1020
+ num_decoder_layers: any;
1021
+ num_decoder_heads: any;
1022
+ decoder_dim_kv: number;
1023
+ num_encoder_layers: any;
1024
+ num_encoder_heads: any;
1025
+ encoder_dim_kv: number;
1026
+ }
1027
+ export class BlenderbotSmallPreTrainedModel extends PreTrainedModel {
1028
+ }
1029
+ /**
1030
+ * The bare BlenderbotSmall Model outputting raw hidden-states without any specific head on top.
1031
+ */
1032
+ export class BlenderbotSmallModel extends BlenderbotSmallPreTrainedModel {
1033
+ }
1034
+ /**
1035
+ * The BlenderbotSmall Model with a language modeling head. Can be used for summarization.
1036
+ */
1037
+ export class BlenderbotSmallForConditionalGeneration extends BlenderbotSmallPreTrainedModel {
1038
+ /**
1039
+ * Creates a new instance of the `BlenderbotForConditionalGeneration` class.
1040
+ * @param {any} config The model configuration.
1041
+ * @param {any} session The ONNX session containing the encoder weights.
1042
+ * @param {any} decoder_merged_session The ONNX session containing the merged decoder weights.
1043
+ * @param {GenerationConfig} generation_config The generation configuration.
1044
+ */
1045
+ constructor(config: any, session: any, decoder_merged_session: any, generation_config: new (kwargs?: import("./utils/generation.js").GenerationConfigType) => import("./utils/generation.js").GenerationConfigType);
1046
+ decoder_merged_session: any;
1047
+ generation_config: new (kwargs?: import("./utils/generation.js").GenerationConfigType) => import("./utils/generation.js").GenerationConfigType;
1048
+ num_decoder_layers: any;
1049
+ num_decoder_heads: any;
1050
+ decoder_dim_kv: number;
1051
+ num_encoder_layers: any;
1052
+ num_encoder_heads: any;
1053
+ encoder_dim_kv: number;
1054
+ }
1055
+ export class RobertaPreTrainedModel extends PreTrainedModel {
1056
+ }
1057
+ export class RobertaModel extends RobertaPreTrainedModel {
1058
+ }
1059
+ /**
1060
+ * RobertaForMaskedLM class for performing masked language modeling on Roberta models.
1061
+ */
1062
+ export class RobertaForMaskedLM extends RobertaPreTrainedModel {
1063
+ /**
1064
+ * Calls the model on new inputs.
1065
+ *
1066
+ * @param {Object} model_inputs The inputs to the model.
1067
+ * @returns {Promise<MaskedLMOutput>} returned object
1068
+ */
1069
+ _call(model_inputs: any): Promise<MaskedLMOutput>;
1070
+ }
1071
+ /**
1072
+ * RobertaForSequenceClassification class for performing sequence classification on Roberta models.
1073
+ */
1074
+ export class RobertaForSequenceClassification extends RobertaPreTrainedModel {
1075
+ /**
1076
+ * Calls the model on new inputs.
1077
+ *
1078
+ * @param {Object} model_inputs The inputs to the model.
1079
+ * @returns {Promise<SequenceClassifierOutput>} returned object
1080
+ */
1081
+ _call(model_inputs: any): Promise<SequenceClassifierOutput>;
1082
+ }
1083
+ /**
1084
+ * RobertaForTokenClassification class for performing token classification on Roberta models.
1085
+ */
1086
+ export class RobertaForTokenClassification extends RobertaPreTrainedModel {
1087
+ /**
1088
+ * Calls the model on new inputs.
1089
+ *
1090
+ * @param {Object} model_inputs The inputs to the model.
1091
+ * @returns {Promise<TokenClassifierOutput>} An object containing the model's output logits for token classification.
1092
+ */
1093
+ _call(model_inputs: any): Promise<TokenClassifierOutput>;
1094
+ }
1095
+ /**
1096
+ * RobertaForQuestionAnswering class for performing question answering on Roberta models.
1097
+ */
1098
+ export class RobertaForQuestionAnswering extends RobertaPreTrainedModel {
1099
+ /**
1100
+ * Calls the model on new inputs.
1101
+ *
1102
+ * @param {Object} model_inputs The inputs to the model.
1103
+ * @returns {Promise<QuestionAnsweringModelOutput>} returned object
1104
+ */
1105
+ _call(model_inputs: any): Promise<QuestionAnsweringModelOutput>;
1106
+ }
1107
+ /**
1108
+ * An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained models.
1109
+ */
1110
+ export class XLMPreTrainedModel extends PreTrainedModel {
1111
+ }
1112
+ /**
1113
+ * The bare XLM Model transformer outputting raw hidden-states without any specific head on top.
1114
+ */
1115
+ export class XLMModel extends XLMPreTrainedModel {
1116
+ }
1117
+ /**
1118
+ * The XLM Model transformer with a language modeling head on top (linear layer with weights tied to the input embeddings).
1119
+ */
1120
+ export class XLMWithLMHeadModel extends XLMPreTrainedModel {
1121
+ /**
1122
+ * Calls the model on new inputs.
1123
+ *
1124
+ * @param {Object} model_inputs The inputs to the model.
1125
+ * @returns {Promise<MaskedLMOutput>} returned object
1126
+ */
1127
+ _call(model_inputs: any): Promise<MaskedLMOutput>;
1128
+ }
1129
+ /**
1130
+ * XLM Model with a sequence classification/regression head on top (a linear layer on top of the pooled output)
1131
+ */
1132
+ export class XLMForSequenceClassification extends XLMPreTrainedModel {
1133
+ /**
1134
+ * Calls the model on new inputs.
1135
+ *
1136
+ * @param {Object} model_inputs The inputs to the model.
1137
+ * @returns {Promise<SequenceClassifierOutput>} returned object
1138
+ */
1139
+ _call(model_inputs: any): Promise<SequenceClassifierOutput>;
1140
+ }
1141
+ /**
1142
+ * XLM Model with a token classification head on top (a linear layer on top of the hidden-states output)
1143
+ */
1144
+ export class XLMForTokenClassification extends XLMPreTrainedModel {
1145
+ /**
1146
+ * Calls the model on new inputs.
1147
+ *
1148
+ * @param {Object} model_inputs The inputs to the model.
1149
+ * @returns {Promise<TokenClassifierOutput>} An object containing the model's output logits for token classification.
1150
+ */
1151
+ _call(model_inputs: any): Promise<TokenClassifierOutput>;
1152
+ }
1153
+ /**
1154
+ * XLM Model with a span classification head on top for extractive question-answering tasks
1155
+ */
1156
+ export class XLMForQuestionAnswering extends XLMPreTrainedModel {
1157
+ /**
1158
+ * Calls the model on new inputs.
1159
+ *
1160
+ * @param {Object} model_inputs The inputs to the model.
1161
+ * @returns {Promise<QuestionAnsweringModelOutput>} returned object
1162
+ */
1163
+ _call(model_inputs: any): Promise<QuestionAnsweringModelOutput>;
1164
+ }
1165
+ export class XLMRobertaPreTrainedModel extends PreTrainedModel {
1166
+ }
1167
+ export class XLMRobertaModel extends XLMRobertaPreTrainedModel {
1168
+ }
1169
+ /**
1170
+ * XLMRobertaForMaskedLM class for performing masked language modeling on XLMRoberta models.
1171
+ */
1172
+ export class XLMRobertaForMaskedLM extends XLMRobertaPreTrainedModel {
1173
+ /**
1174
+ * Calls the model on new inputs.
1175
+ *
1176
+ * @param {Object} model_inputs The inputs to the model.
1177
+ * @returns {Promise<MaskedLMOutput>} returned object
1178
+ */
1179
+ _call(model_inputs: any): Promise<MaskedLMOutput>;
1180
+ }
1181
+ /**
1182
+ * XLMRobertaForSequenceClassification class for performing sequence classification on XLMRoberta models.
1183
+ */
1184
+ export class XLMRobertaForSequenceClassification extends XLMRobertaPreTrainedModel {
1185
+ /**
1186
+ * Calls the model on new inputs.
1187
+ *
1188
+ * @param {Object} model_inputs The inputs to the model.
1189
+ * @returns {Promise<SequenceClassifierOutput>} returned object
1190
+ */
1191
+ _call(model_inputs: any): Promise<SequenceClassifierOutput>;
1192
+ }
1193
+ /**
1194
+ * XLMRobertaForTokenClassification class for performing token classification on XLMRoberta models.
1195
+ */
1196
+ export class XLMRobertaForTokenClassification extends XLMRobertaPreTrainedModel {
1197
+ /**
1198
+ * Calls the model on new inputs.
1199
+ *
1200
+ * @param {Object} model_inputs The inputs to the model.
1201
+ * @returns {Promise<TokenClassifierOutput>} An object containing the model's output logits for token classification.
1202
+ */
1203
+ _call(model_inputs: any): Promise<TokenClassifierOutput>;
1204
+ }
1205
+ /**
1206
+ * XLMRobertaForQuestionAnswering class for performing question answering on XLMRoberta models.
1207
+ */
1208
+ export class XLMRobertaForQuestionAnswering extends XLMRobertaPreTrainedModel {
1209
+ /**
1210
+ * Calls the model on new inputs.
1211
+ *
1212
+ * @param {Object} model_inputs The inputs to the model.
1213
+ * @returns {Promise<QuestionAnsweringModelOutput>} returned object
1214
+ */
1215
+ _call(model_inputs: any): Promise<QuestionAnsweringModelOutput>;
1216
+ }
1217
+ export class ASTPreTrainedModel extends PreTrainedModel {
1218
+ }
1219
+ /**
1220
+ * The bare AST Model transformer outputting raw hidden-states without any specific head on top.
1221
+ */
1222
+ export class ASTModel extends ASTPreTrainedModel {
1223
+ }
1224
+ /**
1225
+ * Audio Spectrogram Transformer model with an audio classification head on top
1226
+ * (a linear layer on top of the pooled output) e.g. for datasets like AudioSet, Speech Commands v2.
1227
+ */
1228
+ export class ASTForAudioClassification extends ASTPreTrainedModel {
1229
+ }
1230
+ export class WhisperPreTrainedModel extends PreTrainedModel {
1231
+ }
1232
+ /**
1233
+ * WhisperModel class for training Whisper models without a language model head.
1234
+ */
1235
+ export class WhisperModel extends WhisperPreTrainedModel {
1236
+ }
1237
+ /**
1238
+ * WhisperForConditionalGeneration class for generating conditional outputs from Whisper models.
1239
+ */
1240
+ export class WhisperForConditionalGeneration extends WhisperPreTrainedModel {
1241
+ /**
1242
+ * Creates a new instance of the `WhisperForConditionalGeneration` class.
1243
+ * @param {Object} config Configuration object for the model.
1244
+ * @param {Object} session ONNX Session object for the model.
1245
+ * @param {Object} decoder_merged_session ONNX Session object for the decoder.
1246
+ * @param {Object} generation_config Configuration object for the generation process.
1247
+ */
1248
+ constructor(config: any, session: any, decoder_merged_session: any, generation_config: any);
1249
+ requires_attention_mask: boolean;
1250
+ decoder_merged_session: any;
1251
+ generation_config: any;
1252
+ num_decoder_layers: any;
1253
+ num_decoder_heads: any;
1254
+ decoder_dim_kv: number;
1255
+ num_encoder_layers: any;
1256
+ num_encoder_heads: any;
1257
+ encoder_dim_kv: number;
1258
+ /**
1259
+ * @typedef {Object} WhisperGenerationConfig
1260
+ * @extends GenerationConfig
1261
+ * @property {boolean} [return_timestamps=null] Whether to return the timestamps with the text. This enables the `WhisperTimestampsLogitsProcessor`.
1262
+ * @property {boolean} [return_token_timestamps=null] Whether to return token-level timestamps
1263
+ * with the text. This can be used with or without the `return_timestamps` option. To get word-level
1264
+ * timestamps, use the tokenizer to group the tokens into words.
1265
+ * @property {number} [num_frames=null] The number of audio frames available in this chunk. This is only used generating word-level timestamps.
1266
+ */
1267
+ /**
1268
+ * Generates outputs based on input and generation configuration.
1269
+ * @param {Object} inputs Input data for the model.
1270
+ * @param {WhisperGenerationConfig} generation_config Configuration object for the generation process.
1271
+ * @param {Object} logits_processor Optional logits processor object.
1272
+ * @returns {Promise<Object>} Promise object represents the generated outputs.
1273
+ */
1274
+ generate(inputs: any, generation_config?: any, logits_processor?: any): Promise<any>;
1275
+ /**
1276
+ * Calculates token-level timestamps using the encoder-decoder cross-attentions and
1277
+ * dynamic time-warping (DTW) to map each output token to a position in the input audio.
1278
+ * @param {Object} generate_outputs Outputs generated by the model
1279
+ * @param {Tensor[][][]} generate_outputs.cross_attentions The cross attentions output by the model
1280
+ * @param {Tensor[][][]} generate_outputs.decoder_attentions The decoder attentions output by the model
1281
+ * @param {number[][]} generate_outputs.sequences The sequences output by the model
1282
+ * @param {number[][]} alignment_heads Alignment heads of the model
1283
+ * @param {number} [num_frames=null] Number of frames in the input audio.
1284
+ * @param {number} [time_precision=0.02] Precision of the timestamps in seconds
1285
+ * @returns {Tensor} tensor containing the timestamps in seconds for each predicted token
1286
+ */
1287
+ _extract_token_timestamps(generate_outputs: {
1288
+ cross_attentions: Tensor[][][];
1289
+ decoder_attentions: Tensor[][][];
1290
+ sequences: number[][];
1291
+ }, alignment_heads: number[][], num_frames?: number, time_precision?: number): Tensor;
1292
+ }
1293
+ /**
1294
+ * Vision Encoder-Decoder model based on OpenAI's GPT architecture for image captioning and other vision tasks
1295
+ */
1296
+ export class VisionEncoderDecoderModel extends PreTrainedModel {
1297
+ /**
1298
+ * Creates a new instance of the `VisionEncoderDecoderModel` class.
1299
+ * @param {Object} config The configuration object specifying the hyperparameters and other model settings.
1300
+ * @param {Object} session The ONNX session containing the encoder model.
1301
+ * @param {any} decoder_merged_session The ONNX session containing the merged decoder model.
1302
+ * @param {Object} generation_config Configuration object for the generation process.
1303
+ */
1304
+ constructor(config: any, session: any, decoder_merged_session: any, generation_config: any);
1305
+ decoder_merged_session: any;
1306
+ generation_config: any;
1307
+ add_encoder_pkv: boolean;
1308
+ num_decoder_layers: any;
1309
+ num_decoder_heads: any;
1310
+ decoder_dim_kv: any;
1311
+ num_encoder_layers: any;
1312
+ num_encoder_heads: any;
1313
+ encoder_dim_kv: any;
1314
+ num_layers: any;
1315
+ num_heads: any;
1316
+ dim_kv: any;
1317
+ }
1318
+ export class CLIPPreTrainedModel extends PreTrainedModel {
1319
+ }
1320
+ /**
1321
+ * CLIP Text and Vision Model with a projection layers on top
1322
+ *
1323
+ * **Example:** Perform zero-shot image classification with a `CLIPModel`.
1324
+ *
1325
+ * ```javascript
1326
+ * import { AutoTokenizer, AutoProcessor, CLIPModel, RawImage } from '@xenova/transformers';
1327
+ *
1328
+ * // Load tokenizer, processor, and model
1329
+ * let tokenizer = await AutoTokenizer.from_pretrained('Xenova/clip-vit-base-patch16');
1330
+ * let processor = await AutoProcessor.from_pretrained('Xenova/clip-vit-base-patch16');
1331
+ * let model = await CLIPModel.from_pretrained('Xenova/clip-vit-base-patch16');
1332
+ *
1333
+ * // Run tokenization
1334
+ * let texts = ['a photo of a car', 'a photo of a football match']
1335
+ * let text_inputs = tokenizer(texts, { padding: true, truncation: true });
1336
+ *
1337
+ * // Read image and run processor
1338
+ * let image = await RawImage.read('https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/football-match.jpg');
1339
+ * let image_inputs = await processor(image);
1340
+ *
1341
+ * // Run model with both text and pixel inputs
1342
+ * let output = await model({ ...text_inputs, ...image_inputs });
1343
+ * // {
1344
+ * // logits_per_image: Tensor {
1345
+ * // dims: [ 1, 2 ],
1346
+ * // data: Float32Array(2) [ 18.579734802246094, 24.31830596923828 ],
1347
+ * // },
1348
+ * // logits_per_text: Tensor {
1349
+ * // dims: [ 2, 1 ],
1350
+ * // data: Float32Array(2) [ 18.579734802246094, 24.31830596923828 ],
1351
+ * // },
1352
+ * // text_embeds: Tensor {
1353
+ * // dims: [ 2, 512 ],
1354
+ * // data: Float32Array(1024) [ ... ],
1355
+ * // },
1356
+ * // image_embeds: Tensor {
1357
+ * // dims: [ 1, 512 ],
1358
+ * // data: Float32Array(512) [ ... ],
1359
+ * // }
1360
+ * // }
1361
+ * ```
1362
+ */
1363
+ export class CLIPModel extends CLIPPreTrainedModel {
1364
+ }
1365
+ /**
1366
+ * CLIP Text Model with a projection layer on top (a linear layer on top of the pooled output)
1367
+ *
1368
+ * **Example:** Compute text embeddings with `CLIPTextModelWithProjection`.
1369
+ *
1370
+ * ```javascript
1371
+ * import { AutoTokenizer, CLIPTextModelWithProjection } from '@xenova/transformers';
1372
+ *
1373
+ * // Load tokenizer and text model
1374
+ * const tokenizer = await AutoTokenizer.from_pretrained('Xenova/clip-vit-base-patch16');
1375
+ * const text_model = await CLIPTextModelWithProjection.from_pretrained('Xenova/clip-vit-base-patch16');
1376
+ *
1377
+ * // Run tokenization
1378
+ * let texts = ['a photo of a car', 'a photo of a football match'];
1379
+ * let text_inputs = tokenizer(texts, { padding: true, truncation: true });
1380
+ *
1381
+ * // Compute embeddings
1382
+ * const { text_embeds } = await text_model(text_inputs);
1383
+ * // Tensor {
1384
+ * // dims: [ 2, 512 ],
1385
+ * // type: 'float32',
1386
+ * // data: Float32Array(1024) [ ... ],
1387
+ * // size: 1024
1388
+ * // }
1389
+ * ```
1390
+ */
1391
+ export class CLIPTextModelWithProjection extends CLIPPreTrainedModel {
1392
+ }
1393
+ /**
1394
+ * CLIP Vision Model with a projection layer on top (a linear layer on top of the pooled output)
1395
+ *
1396
+ * **Example:** Compute vision embeddings with `CLIPVisionModelWithProjection`.
1397
+ *
1398
+ * ```javascript
1399
+ * import { AutoProcessor, CLIPVisionModelWithProjection, RawImage} from '@xenova/transformers';
1400
+ *
1401
+ * // Load processor and vision model
1402
+ * const processor = await AutoProcessor.from_pretrained('Xenova/clip-vit-base-patch16');
1403
+ * const vision_model = await CLIPVisionModelWithProjection.from_pretrained('Xenova/clip-vit-base-patch16');
1404
+ *
1405
+ * // Read image and run processor
1406
+ * let image = await RawImage.read('https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/football-match.jpg');
1407
+ * let image_inputs = await processor(image);
1408
+ *
1409
+ * // Compute embeddings
1410
+ * const { image_embeds } = await vision_model(image_inputs);
1411
+ * // Tensor {
1412
+ * // dims: [ 1, 512 ],
1413
+ * // type: 'float32',
1414
+ * // data: Float32Array(512) [ ... ],
1415
+ * // size: 512
1416
+ * // }
1417
+ * ```
1418
+ */
1419
+ export class CLIPVisionModelWithProjection extends CLIPPreTrainedModel {
1420
+ }
1421
+ export class SiglipPreTrainedModel extends PreTrainedModel {
1422
+ }
1423
+ /**
1424
+ * SigLIP Text and Vision Model with a projection layers on top
1425
+ *
1426
+ * **Example:** Perform zero-shot image classification with a `SiglipModel`.
1427
+ *
1428
+ * ```javascript
1429
+ * import { AutoTokenizer, AutoProcessor, SiglipModel, RawImage } from '@xenova/transformers';
1430
+ *
1431
+ * // Load tokenizer, processor, and model
1432
+ * const tokenizer = await AutoTokenizer.from_pretrained('Xenova/siglip-base-patch16-224');
1433
+ * const processor = await AutoProcessor.from_pretrained('Xenova/siglip-base-patch16-224');
1434
+ * const model = await SiglipModel.from_pretrained('Xenova/siglip-base-patch16-224');
1435
+ *
1436
+ * // Run tokenization
1437
+ * const texts = ['a photo of 2 cats', 'a photo of 2 dogs'];
1438
+ * const text_inputs = tokenizer(texts, { padding: 'max_length', truncation: true });
1439
+ *
1440
+ * // Read image and run processor
1441
+ * const image = await RawImage.read('http://images.cocodataset.org/val2017/000000039769.jpg');
1442
+ * const image_inputs = await processor(image);
1443
+ *
1444
+ * // Run model with both text and pixel inputs
1445
+ * const output = await model({ ...text_inputs, ...image_inputs });
1446
+ * // {
1447
+ * // logits_per_image: Tensor {
1448
+ * // dims: [ 1, 2 ],
1449
+ * // data: Float32Array(2) [ -1.6019744873046875, -10.720091819763184 ],
1450
+ * // },
1451
+ * // logits_per_text: Tensor {
1452
+ * // dims: [ 2, 1 ],
1453
+ * // data: Float32Array(2) [ -1.6019744873046875, -10.720091819763184 ],
1454
+ * // },
1455
+ * // text_embeds: Tensor {
1456
+ * // dims: [ 2, 768 ],
1457
+ * // data: Float32Array(1536) [ ... ],
1458
+ * // },
1459
+ * // image_embeds: Tensor {
1460
+ * // dims: [ 1, 768 ],
1461
+ * // data: Float32Array(768) [ ... ],
1462
+ * // }
1463
+ * // }
1464
+ * ```
1465
+ */
1466
+ export class SiglipModel extends SiglipPreTrainedModel {
1467
+ }
1468
+ /**
1469
+ * The text model from SigLIP without any head or projection on top.
1470
+ *
1471
+ * **Example:** Compute text embeddings with `SiglipTextModel`.
1472
+ *
1473
+ * ```javascript
1474
+ * import { AutoTokenizer, SiglipTextModel } from '@xenova/transformers';
1475
+ *
1476
+ * // Load tokenizer and text model
1477
+ * const tokenizer = await AutoTokenizer.from_pretrained('Xenova/siglip-base-patch16-224');
1478
+ * const text_model = await SiglipTextModel.from_pretrained('Xenova/siglip-base-patch16-224');
1479
+ *
1480
+ * // Run tokenization
1481
+ * const texts = ['a photo of 2 cats', 'a photo of 2 dogs'];
1482
+ * const text_inputs = tokenizer(texts, { padding: 'max_length', truncation: true });
1483
+ *
1484
+ * // Compute embeddings
1485
+ * const { pooler_output } = await text_model(text_inputs);
1486
+ * // Tensor {
1487
+ * // dims: [ 2, 768 ],
1488
+ * // type: 'float32',
1489
+ * // data: Float32Array(1536) [ ... ],
1490
+ * // size: 1536
1491
+ * // }
1492
+ * ```
1493
+ */
1494
+ export class SiglipTextModel extends SiglipPreTrainedModel {
1495
+ }
1496
+ /**
1497
+ * The vision model from SigLIP without any head or projection on top.
1498
+ *
1499
+ * **Example:** Compute vision embeddings with `SiglipVisionModel`.
1500
+ *
1501
+ * ```javascript
1502
+ * import { AutoProcessor, SiglipVisionModel, RawImage} from '@xenova/transformers';
1503
+ *
1504
+ * // Load processor and vision model
1505
+ * const processor = await AutoProcessor.from_pretrained('Xenova/siglip-base-patch16-224');
1506
+ * const vision_model = await SiglipVisionModel.from_pretrained('Xenova/siglip-base-patch16-224');
1507
+ *
1508
+ * // Read image and run processor
1509
+ * const image = await RawImage.read('https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/football-match.jpg');
1510
+ * const image_inputs = await processor(image);
1511
+ *
1512
+ * // Compute embeddings
1513
+ * const { pooler_output } = await vision_model(image_inputs);
1514
+ * // Tensor {
1515
+ * // dims: [ 1, 768 ],
1516
+ * // type: 'float32',
1517
+ * // data: Float32Array(768) [ ... ],
1518
+ * // size: 768
1519
+ * // }
1520
+ * ```
1521
+ */
1522
+ export class SiglipVisionModel extends CLIPPreTrainedModel {
1523
+ }
1524
+ export class ChineseCLIPPreTrainedModel extends PreTrainedModel {
1525
+ }
1526
+ export class ChineseCLIPModel extends ChineseCLIPPreTrainedModel {
1527
+ }
1528
+ export class CLIPSegPreTrainedModel extends PreTrainedModel {
1529
+ }
1530
+ export class CLIPSegModel extends CLIPSegPreTrainedModel {
1531
+ }
1532
+ /**
1533
+ * CLIPSeg model with a Transformer-based decoder on top for zero-shot and one-shot image segmentation.
1534
+ *
1535
+ * **Example:** Perform zero-shot image segmentation with a `CLIPSegForImageSegmentation` model.
1536
+ *
1537
+ * ```javascript
1538
+ * import { AutoTokenizer, AutoProcessor, CLIPSegForImageSegmentation, RawImage } from '@xenova/transformers';
1539
+ *
1540
+ * // Load tokenizer, processor, and model
1541
+ * const tokenizer = await AutoTokenizer.from_pretrained('Xenova/clipseg-rd64-refined');
1542
+ * const processor = await AutoProcessor.from_pretrained('Xenova/clipseg-rd64-refined');
1543
+ * const model = await CLIPSegForImageSegmentation.from_pretrained('Xenova/clipseg-rd64-refined');
1544
+ *
1545
+ * // Run tokenization
1546
+ * const texts = ['a glass', 'something to fill', 'wood', 'a jar'];
1547
+ * const text_inputs = tokenizer(texts, { padding: true, truncation: true });
1548
+ *
1549
+ * // Read image and run processor
1550
+ * const image = await RawImage.read('https://github.com/timojl/clipseg/blob/master/example_image.jpg?raw=true');
1551
+ * const image_inputs = await processor(image);
1552
+ *
1553
+ * // Run model with both text and pixel inputs
1554
+ * const { logits } = await model({ ...text_inputs, ...image_inputs });
1555
+ * // logits: Tensor {
1556
+ * // dims: [4, 352, 352],
1557
+ * // type: 'float32',
1558
+ * // data: Float32Array(495616) [ ... ],
1559
+ * // size: 495616
1560
+ * // }
1561
+ * ```
1562
+ *
1563
+ * You can visualize the predictions as follows:
1564
+ * ```javascript
1565
+ * const preds = logits
1566
+ * .unsqueeze_(1)
1567
+ * .sigmoid_()
1568
+ * .mul_(255)
1569
+ * .round_()
1570
+ * .to('uint8');
1571
+ *
1572
+ * for (let i = 0; i < preds.dims[0]; ++i) {
1573
+ * const img = RawImage.fromTensor(preds[i]);
1574
+ * img.save(`prediction_${i}.png`);
1575
+ * }
1576
+ * ```
1577
+ */
1578
+ export class CLIPSegForImageSegmentation extends CLIPSegPreTrainedModel {
1579
+ }
1580
+ export class GPT2PreTrainedModel extends PreTrainedModel {
1581
+ /**
1582
+ * Creates a new instance of the `GPT2PreTrainedModel` class.
1583
+ * @param {Object} config The configuration of the model.
1584
+ * @param {any} session The ONNX session containing the model weights.
1585
+ * @param {GenerationConfig} generation_config The generation configuration.
1586
+ */
1587
+ constructor(config: any, session: any, generation_config: new (kwargs?: import("./utils/generation.js").GenerationConfigType) => import("./utils/generation.js").GenerationConfigType);
1588
+ generation_config: new (kwargs?: import("./utils/generation.js").GenerationConfigType) => import("./utils/generation.js").GenerationConfigType;
1589
+ num_heads: any;
1590
+ num_layers: any;
1591
+ dim_kv: number;
1592
+ }
1593
+ export class GPT2Model extends GPT2PreTrainedModel {
1594
+ }
1595
+ /**
1596
+ * GPT-2 language model head on top of the GPT-2 base model. This model is suitable for text generation tasks.
1597
+ */
1598
+ export class GPT2LMHeadModel extends GPT2PreTrainedModel {
1599
+ }
1600
+ export class GPTNeoPreTrainedModel extends PreTrainedModel {
1601
+ /**
1602
+ * Creates a new instance of the `GPTNeoPreTrainedModel` class.
1603
+ * @param {Object} config The configuration of the model.
1604
+ * @param {any} session The ONNX session containing the model weights.
1605
+ * @param {GenerationConfig} generation_config The generation configuration.
1606
+ */
1607
+ constructor(config: any, session: any, generation_config: new (kwargs?: import("./utils/generation.js").GenerationConfigType) => import("./utils/generation.js").GenerationConfigType);
1608
+ generation_config: new (kwargs?: import("./utils/generation.js").GenerationConfigType) => import("./utils/generation.js").GenerationConfigType;
1609
+ num_heads: any;
1610
+ num_layers: any;
1611
+ dim_kv: number;
1612
+ }
1613
+ export class GPTNeoModel extends GPTNeoPreTrainedModel {
1614
+ }
1615
+ export class GPTNeoForCausalLM extends GPTNeoPreTrainedModel {
1616
+ }
1617
+ export class GPTNeoXPreTrainedModel extends PreTrainedModel {
1618
+ /**
1619
+ * Creates a new instance of the `GPTNeoXPreTrainedModel` class.
1620
+ * @param {Object} config The configuration of the model.
1621
+ * @param {any} session The ONNX session containing the model weights.
1622
+ * @param {GenerationConfig} generation_config The generation configuration.
1623
+ */
1624
+ constructor(config: any, session: any, generation_config: new (kwargs?: import("./utils/generation.js").GenerationConfigType) => import("./utils/generation.js").GenerationConfigType);
1625
+ generation_config: new (kwargs?: import("./utils/generation.js").GenerationConfigType) => import("./utils/generation.js").GenerationConfigType;
1626
+ num_heads: any;
1627
+ num_layers: any;
1628
+ dim_kv: number;
1629
+ }
1630
+ export class GPTNeoXModel extends GPTNeoXPreTrainedModel {
1631
+ }
1632
+ export class GPTNeoXForCausalLM extends GPTNeoXPreTrainedModel {
1633
+ }
1634
+ export class GPTJPreTrainedModel extends PreTrainedModel {
1635
+ /**
1636
+ * Creates a new instance of the `GPTJPreTrainedModel` class.
1637
+ * @param {Object} config The configuration of the model.
1638
+ * @param {any} session The ONNX session containing the model weights.
1639
+ * @param {GenerationConfig} generation_config The generation configuration.
1640
+ */
1641
+ constructor(config: any, session: any, generation_config: new (kwargs?: import("./utils/generation.js").GenerationConfigType) => import("./utils/generation.js").GenerationConfigType);
1642
+ generation_config: new (kwargs?: import("./utils/generation.js").GenerationConfigType) => import("./utils/generation.js").GenerationConfigType;
1643
+ num_heads: any;
1644
+ num_layers: any;
1645
+ dim_kv: number;
1646
+ }
1647
+ export class GPTJModel extends GPTJPreTrainedModel {
1648
+ }
1649
+ export class GPTJForCausalLM extends GPTJPreTrainedModel {
1650
+ }
1651
+ export class GPTBigCodePreTrainedModel extends PreTrainedModel {
1652
+ /**
1653
+ * Creates a new instance of the `GPTBigCodePreTrainedModel` class.
1654
+ * @param {Object} config The configuration of the model.
1655
+ * @param {any} session The ONNX session containing the model weights.
1656
+ * @param {GenerationConfig} generation_config The generation configuration.
1657
+ */
1658
+ constructor(config: any, session: any, generation_config: new (kwargs?: import("./utils/generation.js").GenerationConfigType) => import("./utils/generation.js").GenerationConfigType);
1659
+ generation_config: new (kwargs?: import("./utils/generation.js").GenerationConfigType) => import("./utils/generation.js").GenerationConfigType;
1660
+ num_heads: any;
1661
+ num_layers: any;
1662
+ dim_kv: number;
1663
+ }
1664
+ export class GPTBigCodeModel extends GPTBigCodePreTrainedModel {
1665
+ }
1666
+ export class GPTBigCodeForCausalLM extends GPTBigCodePreTrainedModel {
1667
+ }
1668
+ export class CodeGenPreTrainedModel extends PreTrainedModel {
1669
+ /**
1670
+ * Creates a new instance of the `CodeGenPreTrainedModel` class.
1671
+ * @param {Object} config The model configuration object.
1672
+ * @param {Object} session The ONNX session object.
1673
+ * @param {GenerationConfig} generation_config The generation configuration.
1674
+ */
1675
+ constructor(config: any, session: any, generation_config: new (kwargs?: import("./utils/generation.js").GenerationConfigType) => import("./utils/generation.js").GenerationConfigType);
1676
+ generation_config: new (kwargs?: import("./utils/generation.js").GenerationConfigType) => import("./utils/generation.js").GenerationConfigType;
1677
+ num_heads: any;
1678
+ num_layers: any;
1679
+ dim_kv: number;
1680
+ }
1681
+ /**
1682
+ * CodeGenModel is a class representing a code generation model without a language model head.
1683
+ */
1684
+ export class CodeGenModel extends CodeGenPreTrainedModel {
1685
+ }
1686
+ /**
1687
+ * CodeGenForCausalLM is a class that represents a code generation model based on the GPT-2 architecture. It extends the `CodeGenPreTrainedModel` class.
1688
+ */
1689
+ export class CodeGenForCausalLM extends CodeGenPreTrainedModel {
1690
+ }
1691
+ /**
1692
+ * The bare LLama Model outputting raw hidden-states without any specific head on top.
1693
+ */
1694
+ export class LlamaPreTrainedModel extends PreTrainedModel {
1695
+ /**
1696
+ * Creates a new instance of the `LlamaPreTrainedModel` class.
1697
+ * @param {Object} config The model configuration object.
1698
+ * @param {Object} session The ONNX session object.
1699
+ * @param {GenerationConfig} generation_config The generation configuration.
1700
+ */
1701
+ constructor(config: any, session: any, generation_config: new (kwargs?: import("./utils/generation.js").GenerationConfigType) => import("./utils/generation.js").GenerationConfigType);
1702
+ generation_config: new (kwargs?: import("./utils/generation.js").GenerationConfigType) => import("./utils/generation.js").GenerationConfigType;
1703
+ num_heads: any;
1704
+ num_layers: any;
1705
+ dim_kv: number;
1706
+ }
1707
+ /**
1708
+ * The bare LLaMA Model outputting raw hidden-states without any specific head on top.
1709
+ */
1710
+ export class LlamaModel extends LlamaPreTrainedModel {
1711
+ }
1712
+ export class LlamaForCausalLM extends LlamaPreTrainedModel {
1713
+ }
1714
+ /**
1715
+ * The bare Qwen2 Model outputting raw hidden-states without any specific head on top.
1716
+ */
1717
+ export class Qwen2PreTrainedModel extends PreTrainedModel {
1718
+ /**
1719
+ * Creates a new instance of the `Qwen2PreTrainedModel` class.
1720
+ * @param {Object} config The model configuration object.
1721
+ * @param {Object} session The ONNX session object.
1722
+ * @param {GenerationConfig} generation_config The generation configuration.
1723
+ */
1724
+ constructor(config: any, session: any, generation_config: new (kwargs?: import("./utils/generation.js").GenerationConfigType) => import("./utils/generation.js").GenerationConfigType);
1725
+ generation_config: new (kwargs?: import("./utils/generation.js").GenerationConfigType) => import("./utils/generation.js").GenerationConfigType;
1726
+ num_heads: any;
1727
+ num_layers: any;
1728
+ dim_kv: number;
1729
+ }
1730
+ /**
1731
+ * The bare Qwen2 Model outputting raw hidden-states without any specific head on top.
1732
+ */
1733
+ export class Qwen2Model extends Qwen2PreTrainedModel {
1734
+ }
1735
+ export class Qwen2ForCausalLM extends Qwen2PreTrainedModel {
1736
+ }
1737
+ export class PhiPreTrainedModel extends PreTrainedModel {
1738
+ /**
1739
+ * Creates a new instance of the `PhiPreTrainedModel` class.
1740
+ * @param {Object} config The model configuration object.
1741
+ * @param {Object} session The ONNX session object.
1742
+ * @param {GenerationConfig} generation_config The generation configuration.
1743
+ */
1744
+ constructor(config: any, session: any, generation_config: new (kwargs?: import("./utils/generation.js").GenerationConfigType) => import("./utils/generation.js").GenerationConfigType);
1745
+ generation_config: new (kwargs?: import("./utils/generation.js").GenerationConfigType) => import("./utils/generation.js").GenerationConfigType;
1746
+ num_heads: any;
1747
+ num_layers: any;
1748
+ dim_kv: number;
1749
+ }
1750
+ /**
1751
+ * The bare Phi Model outputting raw hidden-states without any specific head on top.
1752
+ */
1753
+ export class PhiModel extends PhiPreTrainedModel {
1754
+ }
1755
+ export class PhiForCausalLM extends PhiPreTrainedModel {
1756
+ }
1757
+ /**
1758
+ * The Bloom Model transformer with a language modeling head on top (linear layer with weights tied to the input embeddings).
1759
+ */
1760
+ export class BloomPreTrainedModel extends PreTrainedModel {
1761
+ /**
1762
+ * Creates a new instance of the `BloomPreTrainedModel` class.
1763
+ * @param {Object} config The configuration of the model.
1764
+ * @param {any} session The ONNX session containing the model weights.
1765
+ * @param {GenerationConfig} generation_config The generation configuration.
1766
+ */
1767
+ constructor(config: any, session: any, generation_config: new (kwargs?: import("./utils/generation.js").GenerationConfigType) => import("./utils/generation.js").GenerationConfigType);
1768
+ generation_config: new (kwargs?: import("./utils/generation.js").GenerationConfigType) => import("./utils/generation.js").GenerationConfigType;
1769
+ num_heads: any;
1770
+ num_layers: any;
1771
+ dim_kv: number;
1772
+ }
1773
+ /**
1774
+ * The bare Bloom Model transformer outputting raw hidden-states without any specific head on top.
1775
+ */
1776
+ export class BloomModel extends BloomPreTrainedModel {
1777
+ }
1778
+ /**
1779
+ * The Bloom Model transformer with a language modeling head on top (linear layer with weights tied to the input embeddings).
1780
+ */
1781
+ export class BloomForCausalLM extends BloomPreTrainedModel {
1782
+ }
1783
+ export class MptPreTrainedModel extends PreTrainedModel {
1784
+ /**
1785
+ * Creates a new instance of the `MptPreTrainedModel` class.
1786
+ * @param {Object} config The model configuration object.
1787
+ * @param {Object} session The ONNX session object.
1788
+ * @param {GenerationConfig} generation_config The generation configuration.
1789
+ */
1790
+ constructor(config: any, session: any, generation_config: new (kwargs?: import("./utils/generation.js").GenerationConfigType) => import("./utils/generation.js").GenerationConfigType);
1791
+ generation_config: new (kwargs?: import("./utils/generation.js").GenerationConfigType) => import("./utils/generation.js").GenerationConfigType;
1792
+ num_heads: any;
1793
+ num_layers: any;
1794
+ dim_kv: number;
1795
+ }
1796
+ /**
1797
+ * The bare Mpt Model transformer outputting raw hidden-states without any specific head on top.
1798
+ */
1799
+ export class MptModel extends MptPreTrainedModel {
1800
+ }
1801
+ /**
1802
+ * The MPT Model transformer with a language modeling head on top (linear layer with weights tied to the input embeddings).
1803
+ */
1804
+ export class MptForCausalLM extends MptPreTrainedModel {
1805
+ }
1806
+ export class OPTPreTrainedModel extends PreTrainedModel {
1807
+ /**
1808
+ * Creates a new instance of the `OPTPreTrainedModel` class.
1809
+ * @param {Object} config The model configuration object.
1810
+ * @param {Object} session The ONNX session object.
1811
+ * @param {GenerationConfig} generation_config The generation configuration.
1812
+ */
1813
+ constructor(config: any, session: any, generation_config: new (kwargs?: import("./utils/generation.js").GenerationConfigType) => import("./utils/generation.js").GenerationConfigType);
1814
+ generation_config: new (kwargs?: import("./utils/generation.js").GenerationConfigType) => import("./utils/generation.js").GenerationConfigType;
1815
+ num_heads: any;
1816
+ num_layers: any;
1817
+ dim_kv: number;
1818
+ }
1819
+ /**
1820
+ * The bare OPT Model outputting raw hidden-states without any specific head on top.
1821
+ */
1822
+ export class OPTModel extends OPTPreTrainedModel {
1823
+ }
1824
+ /**
1825
+ * The OPT Model transformer with a language modeling head on top (linear layer with weights tied to the input embeddings).
1826
+ */
1827
+ export class OPTForCausalLM extends OPTPreTrainedModel {
1828
+ }
1829
+ export class ViTPreTrainedModel extends PreTrainedModel {
1830
+ }
1831
+ export class ViTModel extends ViTPreTrainedModel {
1832
+ }
1833
+ export class ViTForImageClassification extends ViTPreTrainedModel {
1834
+ /**
1835
+ * @param {any} model_inputs
1836
+ */
1837
+ _call(model_inputs: any): Promise<SequenceClassifierOutput>;
1838
+ }
1839
+ export class FastViTPreTrainedModel extends PreTrainedModel {
1840
+ }
1841
+ export class FastViTModel extends FastViTPreTrainedModel {
1842
+ }
1843
+ export class FastViTForImageClassification extends FastViTPreTrainedModel {
1844
+ /**
1845
+ * @param {any} model_inputs
1846
+ */
1847
+ _call(model_inputs: any): Promise<SequenceClassifierOutput>;
1848
+ }
1849
+ export class VitMattePreTrainedModel extends PreTrainedModel {
1850
+ }
1851
+ /**
1852
+ * ViTMatte framework leveraging any vision backbone e.g. for ADE20k, CityScapes.
1853
+ *
1854
+ * **Example:** Perform image matting with a `VitMatteForImageMatting` model.
1855
+ * ```javascript
1856
+ * import { AutoProcessor, VitMatteForImageMatting, RawImage } from '@xenova/transformers';
1857
+ *
1858
+ * // Load processor and model
1859
+ * const processor = await AutoProcessor.from_pretrained('Xenova/vitmatte-small-distinctions-646');
1860
+ * const model = await VitMatteForImageMatting.from_pretrained('Xenova/vitmatte-small-distinctions-646');
1861
+ *
1862
+ * // Load image and trimap
1863
+ * const image = await RawImage.fromURL('https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/vitmatte_image.png');
1864
+ * const trimap = await RawImage.fromURL('https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/vitmatte_trimap.png');
1865
+ *
1866
+ * // Prepare image + trimap for the model
1867
+ * const inputs = await processor(image, trimap);
1868
+ *
1869
+ * // Predict alpha matte
1870
+ * const { alphas } = await model(inputs);
1871
+ * // Tensor {
1872
+ * // dims: [ 1, 1, 640, 960 ],
1873
+ * // type: 'float32',
1874
+ * // size: 614400,
1875
+ * // data: Float32Array(614400) [ 0.9894027709960938, 0.9970508813858032, ... ]
1876
+ * // }
1877
+ * ```
1878
+ *
1879
+ * You can visualize the alpha matte as follows:
1880
+ * ```javascript
1881
+ * import { Tensor, cat } from '@xenova/transformers';
1882
+ *
1883
+ * // Visualize predicted alpha matte
1884
+ * const imageTensor = image.toTensor();
1885
+ *
1886
+ * // Convert float (0-1) alpha matte to uint8 (0-255)
1887
+ * const alphaChannel = alphas
1888
+ * .squeeze(0)
1889
+ * .mul_(255)
1890
+ * .clamp_(0, 255)
1891
+ * .round_()
1892
+ * .to('uint8');
1893
+ *
1894
+ * // Concatenate original image with predicted alpha
1895
+ * const imageData = cat([imageTensor, alphaChannel], 0);
1896
+ *
1897
+ * // Save output image
1898
+ * const outputImage = RawImage.fromTensor(imageData);
1899
+ * outputImage.save('output.png');
1900
+ * ```
1901
+ */
1902
+ export class VitMatteForImageMatting extends VitMattePreTrainedModel {
1903
+ /**
1904
+ * @param {any} model_inputs
1905
+ */
1906
+ _call(model_inputs: any): Promise<ImageMattingOutput>;
1907
+ }
1908
+ export class MobileViTPreTrainedModel extends PreTrainedModel {
1909
+ }
1910
+ export class MobileViTModel extends MobileViTPreTrainedModel {
1911
+ }
1912
+ export class MobileViTForImageClassification extends MobileViTPreTrainedModel {
1913
+ /**
1914
+ * @param {any} model_inputs
1915
+ */
1916
+ _call(model_inputs: any): Promise<SequenceClassifierOutput>;
1917
+ }
1918
+ export class MobileViTV2PreTrainedModel extends PreTrainedModel {
1919
+ }
1920
+ export class MobileViTV2Model extends MobileViTV2PreTrainedModel {
1921
+ }
1922
+ export class MobileViTV2ForImageClassification extends MobileViTV2PreTrainedModel {
1923
+ /**
1924
+ * @param {any} model_inputs
1925
+ */
1926
+ _call(model_inputs: any): Promise<SequenceClassifierOutput>;
1927
+ }
1928
+ export class OwlViTPreTrainedModel extends PreTrainedModel {
1929
+ }
1930
+ export class OwlViTModel extends OwlViTPreTrainedModel {
1931
+ }
1932
+ export class OwlViTForObjectDetection extends OwlViTPreTrainedModel {
1933
+ }
1934
+ export class Owlv2PreTrainedModel extends PreTrainedModel {
1935
+ }
1936
+ export class Owlv2Model extends Owlv2PreTrainedModel {
1937
+ }
1938
+ export class Owlv2ForObjectDetection extends Owlv2PreTrainedModel {
1939
+ }
1940
+ export class BeitPreTrainedModel extends PreTrainedModel {
1941
+ }
1942
+ export class BeitModel extends BeitPreTrainedModel {
1943
+ }
1944
+ export class BeitForImageClassification extends BeitPreTrainedModel {
1945
+ /**
1946
+ * @param {any} model_inputs
1947
+ */
1948
+ _call(model_inputs: any): Promise<SequenceClassifierOutput>;
1949
+ }
1950
+ export class DetrPreTrainedModel extends PreTrainedModel {
1951
+ }
1952
+ export class DetrModel extends DetrPreTrainedModel {
1953
+ }
1954
+ export class DetrForObjectDetection extends DetrPreTrainedModel {
1955
+ /**
1956
+ * @param {any} model_inputs
1957
+ */
1958
+ _call(model_inputs: any): Promise<DetrObjectDetectionOutput>;
1959
+ }
1960
+ export class DetrForSegmentation extends DetrPreTrainedModel {
1961
+ /**
1962
+ * Runs the model with the provided inputs
1963
+ * @param {Object} model_inputs Model inputs
1964
+ * @returns {Promise<DetrSegmentationOutput>} Object containing segmentation outputs
1965
+ */
1966
+ _call(model_inputs: any): Promise<DetrSegmentationOutput>;
1967
+ }
1968
+ export class DetrObjectDetectionOutput extends ModelOutput {
1969
+ /**
1970
+ * @param {Object} output The output of the model.
1971
+ * @param {Tensor} output.logits Classification logits (including no-object) for all queries.
1972
+ * @param {Tensor} output.pred_boxes Normalized boxes coordinates for all queries, represented as (center_x, center_y, width, height).
1973
+ * These values are normalized in [0, 1], relative to the size of each individual image in the batch (disregarding possible padding).
1974
+ */
1975
+ constructor({ logits, pred_boxes }: {
1976
+ logits: Tensor;
1977
+ pred_boxes: Tensor;
1978
+ });
1979
+ logits: Tensor;
1980
+ pred_boxes: Tensor;
1981
+ }
1982
+ export class DetrSegmentationOutput extends ModelOutput {
1983
+ /**
1984
+ * @param {Object} output The output of the model.
1985
+ * @param {Tensor} output.logits The output logits of the model.
1986
+ * @param {Tensor} output.pred_boxes Predicted boxes.
1987
+ * @param {Tensor} output.pred_masks Predicted masks.
1988
+ */
1989
+ constructor({ logits, pred_boxes, pred_masks }: {
1990
+ logits: Tensor;
1991
+ pred_boxes: Tensor;
1992
+ pred_masks: Tensor;
1993
+ });
1994
+ logits: Tensor;
1995
+ pred_boxes: Tensor;
1996
+ pred_masks: Tensor;
1997
+ }
1998
+ export class TableTransformerPreTrainedModel extends PreTrainedModel {
1999
+ }
2000
+ /**
2001
+ * The bare Table Transformer Model (consisting of a backbone and encoder-decoder Transformer)
2002
+ * outputting raw hidden-states without any specific head on top.
2003
+ */
2004
+ export class TableTransformerModel extends TableTransformerPreTrainedModel {
2005
+ }
2006
+ /**
2007
+ * Table Transformer Model (consisting of a backbone and encoder-decoder Transformer)
2008
+ * with object detection heads on top, for tasks such as COCO detection.
2009
+ */
2010
+ export class TableTransformerForObjectDetection extends TableTransformerPreTrainedModel {
2011
+ /**
2012
+ * @param {any} model_inputs
2013
+ */
2014
+ _call(model_inputs: any): Promise<TableTransformerObjectDetectionOutput>;
2015
+ }
2016
+ export class TableTransformerObjectDetectionOutput extends DetrObjectDetectionOutput {
2017
+ }
2018
+ export class DeiTPreTrainedModel extends PreTrainedModel {
2019
+ }
2020
+ export class DeiTModel extends DeiTPreTrainedModel {
2021
+ }
2022
+ export class DeiTForImageClassification extends DeiTPreTrainedModel {
2023
+ /**
2024
+ * @param {any} model_inputs
2025
+ */
2026
+ _call(model_inputs: any): Promise<SequenceClassifierOutput>;
2027
+ }
2028
+ /**
2029
+ * An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained models.
2030
+ */
2031
+ export class ResNetPreTrainedModel extends PreTrainedModel {
2032
+ }
2033
+ /**
2034
+ * The bare ResNet model outputting raw features without any specific head on top.
2035
+ */
2036
+ export class ResNetModel extends ResNetPreTrainedModel {
2037
+ }
2038
+ /**
2039
+ * ResNet Model with an image classification head on top (a linear layer on top of the pooled features), e.g. for ImageNet.
2040
+ */
2041
+ export class ResNetForImageClassification extends ResNetPreTrainedModel {
2042
+ /**
2043
+ * @param {any} model_inputs
2044
+ */
2045
+ _call(model_inputs: any): Promise<SequenceClassifierOutput>;
2046
+ }
2047
+ export class SwinPreTrainedModel extends PreTrainedModel {
2048
+ }
2049
+ export class SwinModel extends SwinPreTrainedModel {
2050
+ }
2051
+ export class SwinForImageClassification extends SwinPreTrainedModel {
2052
+ /**
2053
+ * @param {any} model_inputs
2054
+ */
2055
+ _call(model_inputs: any): Promise<SequenceClassifierOutput>;
2056
+ }
2057
+ export class Swin2SRPreTrainedModel extends PreTrainedModel {
2058
+ }
2059
+ /**
2060
+ * The bare Swin2SR Model transformer outputting raw hidden-states without any specific head on top.
2061
+ */
2062
+ export class Swin2SRModel extends Swin2SRPreTrainedModel {
2063
+ }
2064
+ /**
2065
+ * Swin2SR Model transformer with an upsampler head on top for image super resolution and restoration.
2066
+ *
2067
+ * **Example:** Super-resolution w/ `Xenova/swin2SR-classical-sr-x2-64`.
2068
+ *
2069
+ * ```javascript
2070
+ * import { AutoProcessor, Swin2SRForImageSuperResolution, RawImage } from '@xenova/transformers';
2071
+ *
2072
+ * // Load processor and model
2073
+ * const model_id = 'Xenova/swin2SR-classical-sr-x2-64';
2074
+ * const processor = await AutoProcessor.from_pretrained(model_id);
2075
+ * const model = await Swin2SRForImageSuperResolution.from_pretrained(model_id);
2076
+ *
2077
+ * // Prepare model inputs
2078
+ * const url = 'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/butterfly.jpg';
2079
+ * const image = await RawImage.fromURL(url);
2080
+ * const inputs = await processor(image);
2081
+ *
2082
+ * // Run model
2083
+ * const outputs = await model(inputs);
2084
+ *
2085
+ * // Convert Tensor to RawImage
2086
+ * const output = outputs.reconstruction.squeeze().clamp_(0, 1).mul_(255).round_().to('uint8');
2087
+ * const outputImage = RawImage.fromTensor(output);
2088
+ * // RawImage {
2089
+ * // data: Uint8Array(786432) [ 41, 31, 24, ... ],
2090
+ * // width: 512,
2091
+ * // height: 512,
2092
+ * // channels: 3
2093
+ * // }
2094
+ * ```
2095
+ */
2096
+ export class Swin2SRForImageSuperResolution extends Swin2SRPreTrainedModel {
2097
+ }
2098
+ export class DPTPreTrainedModel extends PreTrainedModel {
2099
+ }
2100
+ /**
2101
+ * The bare DPT Model transformer outputting raw hidden-states without any specific head on top.
2102
+ */
2103
+ export class DPTModel extends DPTPreTrainedModel {
2104
+ }
2105
+ /**
2106
+ * DPT Model with a depth estimation head on top (consisting of 3 convolutional layers) e.g. for KITTI, NYUv2.
2107
+ *
2108
+ * **Example:** Depth estimation w/ `Xenova/dpt-hybrid-midas`.
2109
+ * ```javascript
2110
+ * import { DPTForDepthEstimation, AutoProcessor, RawImage, interpolate, max } from '@xenova/transformers';
2111
+ *
2112
+ * // Load model and processor
2113
+ * const model_id = 'Xenova/dpt-hybrid-midas';
2114
+ * const model = await DPTForDepthEstimation.from_pretrained(model_id);
2115
+ * const processor = await AutoProcessor.from_pretrained(model_id);
2116
+ *
2117
+ * // Load image from URL
2118
+ * const url = 'http://images.cocodataset.org/val2017/000000039769.jpg';
2119
+ * const image = await RawImage.fromURL(url);
2120
+ *
2121
+ * // Prepare image for the model
2122
+ * const inputs = await processor(image);
2123
+ *
2124
+ * // Run model
2125
+ * const { predicted_depth } = await model(inputs);
2126
+ *
2127
+ * // Interpolate to original size
2128
+ * const prediction = interpolate(predicted_depth, image.size.reverse(), 'bilinear', false);
2129
+ *
2130
+ * // Visualize the prediction
2131
+ * const formatted = prediction.mul_(255 / max(prediction.data)[0]).to('uint8');
2132
+ * const depth = RawImage.fromTensor(formatted);
2133
+ * // RawImage {
2134
+ * // data: Uint8Array(307200) [ 85, 85, 84, ... ],
2135
+ * // width: 640,
2136
+ * // height: 480,
2137
+ * // channels: 1
2138
+ * // }
2139
+ * ```
2140
+ */
2141
+ export class DPTForDepthEstimation extends DPTPreTrainedModel {
2142
+ }
2143
+ export class DepthAnythingPreTrainedModel extends PreTrainedModel {
2144
+ }
2145
+ /**
2146
+ * Depth Anything Model with a depth estimation head on top (consisting of 3 convolutional layers) e.g. for KITTI, NYUv2.
2147
+ */
2148
+ export class DepthAnythingForDepthEstimation extends DepthAnythingPreTrainedModel {
2149
+ }
2150
+ export class GLPNPreTrainedModel extends PreTrainedModel {
2151
+ }
2152
+ /**
2153
+ * The bare GLPN encoder (Mix-Transformer) outputting raw hidden-states without any specific head on top.
2154
+ */
2155
+ export class GLPNModel extends GLPNPreTrainedModel {
2156
+ }
2157
+ /**
2158
+ * GLPN Model transformer with a lightweight depth estimation head on top e.g. for KITTI, NYUv2.
2159
+ *
2160
+ * **Example:** Depth estimation w/ `Xenova/glpn-kitti`.
2161
+ * ```javascript
2162
+ * import { GLPNForDepthEstimation, AutoProcessor, RawImage, interpolate, max } from '@xenova/transformers';
2163
+ *
2164
+ * // Load model and processor
2165
+ * const model_id = 'Xenova/glpn-kitti';
2166
+ * const model = await GLPNForDepthEstimation.from_pretrained(model_id);
2167
+ * const processor = await AutoProcessor.from_pretrained(model_id);
2168
+ *
2169
+ * // Load image from URL
2170
+ * const url = 'http://images.cocodataset.org/val2017/000000039769.jpg';
2171
+ * const image = await RawImage.fromURL(url);
2172
+ *
2173
+ * // Prepare image for the model
2174
+ * const inputs = await processor(image);
2175
+ *
2176
+ * // Run model
2177
+ * const { predicted_depth } = await model(inputs);
2178
+ *
2179
+ * // Interpolate to original size
2180
+ * const prediction = interpolate(predicted_depth, image.size.reverse(), 'bilinear', false);
2181
+ *
2182
+ * // Visualize the prediction
2183
+ * const formatted = prediction.mul_(255 / max(prediction.data)[0]).to('uint8');
2184
+ * const depth = RawImage.fromTensor(formatted);
2185
+ * // RawImage {
2186
+ * // data: Uint8Array(307200) [ 207, 169, 154, ... ],
2187
+ * // width: 640,
2188
+ * // height: 480,
2189
+ * // channels: 1
2190
+ * // }
2191
+ * ```
2192
+ */
2193
+ export class GLPNForDepthEstimation extends GLPNPreTrainedModel {
2194
+ }
2195
+ export class DonutSwinPreTrainedModel extends PreTrainedModel {
2196
+ }
2197
+ /**
2198
+ * The bare Donut Swin Model transformer outputting raw hidden-states without any specific head on top.
2199
+ *
2200
+ * **Example:** Step-by-step Document Parsing.
2201
+ *
2202
+ * ```javascript
2203
+ * import { AutoProcessor, AutoTokenizer, AutoModelForVision2Seq, RawImage } from '@xenova/transformers';
2204
+ *
2205
+ * // Choose model to use
2206
+ * const model_id = 'Xenova/donut-base-finetuned-cord-v2';
2207
+ *
2208
+ * // Prepare image inputs
2209
+ * const processor = await AutoProcessor.from_pretrained(model_id);
2210
+ * const url = 'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/receipt.png';
2211
+ * const image = await RawImage.read(url);
2212
+ * const image_inputs = await processor(image);
2213
+ *
2214
+ * // Prepare decoder inputs
2215
+ * const tokenizer = await AutoTokenizer.from_pretrained(model_id);
2216
+ * const task_prompt = '<s_cord-v2>';
2217
+ * const decoder_input_ids = tokenizer(task_prompt, {
2218
+ * add_special_tokens: false,
2219
+ * }).input_ids;
2220
+ *
2221
+ * // Create the model
2222
+ * const model = await AutoModelForVision2Seq.from_pretrained(model_id);
2223
+ *
2224
+ * // Run inference
2225
+ * const output = await model.generate(image_inputs.pixel_values, {
2226
+ * decoder_input_ids,
2227
+ * max_length: model.config.decoder.max_position_embeddings,
2228
+ * });
2229
+ *
2230
+ * // Decode output
2231
+ * const decoded = tokenizer.batch_decode(output)[0];
2232
+ * // <s_cord-v2><s_menu><s_nm> CINNAMON SUGAR</s_nm><s_unitprice> 17,000</s_unitprice><s_cnt> 1 x</s_cnt><s_price> 17,000</s_price></s_menu><s_sub_total><s_subtotal_price> 17,000</s_subtotal_price></s_sub_total><s_total><s_total_price> 17,000</s_total_price><s_cashprice> 20,000</s_cashprice><s_changeprice> 3,000</s_changeprice></s_total></s>
2233
+ * ```
2234
+ *
2235
+ * **Example:** Step-by-step Document Visual Question Answering (DocVQA)
2236
+ *
2237
+ * ```javascript
2238
+ * import { AutoProcessor, AutoTokenizer, AutoModelForVision2Seq, RawImage } from '@xenova/transformers';
2239
+ *
2240
+ * // Choose model to use
2241
+ * const model_id = 'Xenova/donut-base-finetuned-docvqa';
2242
+ *
2243
+ * // Prepare image inputs
2244
+ * const processor = await AutoProcessor.from_pretrained(model_id);
2245
+ * const url = 'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/invoice.png';
2246
+ * const image = await RawImage.read(url);
2247
+ * const image_inputs = await processor(image);
2248
+ *
2249
+ * // Prepare decoder inputs
2250
+ * const tokenizer = await AutoTokenizer.from_pretrained(model_id);
2251
+ * const question = 'What is the invoice number?';
2252
+ * const task_prompt = `<s_docvqa><s_question>${question}</s_question><s_answer>`;
2253
+ * const decoder_input_ids = tokenizer(task_prompt, {
2254
+ * add_special_tokens: false,
2255
+ * }).input_ids;
2256
+ *
2257
+ * // Create the model
2258
+ * const model = await AutoModelForVision2Seq.from_pretrained(model_id);
2259
+ *
2260
+ * // Run inference
2261
+ * const output = await model.generate(image_inputs.pixel_values, {
2262
+ * decoder_input_ids,
2263
+ * max_length: model.config.decoder.max_position_embeddings,
2264
+ * });
2265
+ *
2266
+ * // Decode output
2267
+ * const decoded = tokenizer.batch_decode(output)[0];
2268
+ * // <s_docvqa><s_question> What is the invoice number?</s_question><s_answer> us-001</s_answer></s>
2269
+ * ```
2270
+ */
2271
+ export class DonutSwinModel extends DonutSwinPreTrainedModel {
2272
+ }
2273
+ export class ConvNextPreTrainedModel extends PreTrainedModel {
2274
+ }
2275
+ /**
2276
+ * The bare ConvNext model outputting raw features without any specific head on top.
2277
+ */
2278
+ export class ConvNextModel extends ConvNextPreTrainedModel {
2279
+ }
2280
+ /**
2281
+ * ConvNext Model with an image classification head on top (a linear layer on top of the pooled features), e.g. for ImageNet.
2282
+ */
2283
+ export class ConvNextForImageClassification extends ConvNextPreTrainedModel {
2284
+ /**
2285
+ * @param {any} model_inputs
2286
+ */
2287
+ _call(model_inputs: any): Promise<SequenceClassifierOutput>;
2288
+ }
2289
+ export class ConvNextV2PreTrainedModel extends PreTrainedModel {
2290
+ }
2291
+ /**
2292
+ * The bare ConvNextV2 model outputting raw features without any specific head on top.
2293
+ */
2294
+ export class ConvNextV2Model extends ConvNextV2PreTrainedModel {
2295
+ }
2296
+ /**
2297
+ * ConvNextV2 Model with an image classification head on top (a linear layer on top of the pooled features), e.g. for ImageNet.
2298
+ */
2299
+ export class ConvNextV2ForImageClassification extends ConvNextV2PreTrainedModel {
2300
+ /**
2301
+ * @param {any} model_inputs
2302
+ */
2303
+ _call(model_inputs: any): Promise<SequenceClassifierOutput>;
2304
+ }
2305
+ export class Dinov2PreTrainedModel extends PreTrainedModel {
2306
+ }
2307
+ /**
2308
+ * The bare DINOv2 Model transformer outputting raw hidden-states without any specific head on top.
2309
+ */
2310
+ export class Dinov2Model extends Dinov2PreTrainedModel {
2311
+ }
2312
+ /**
2313
+ * Dinov2 Model transformer with an image classification head on top (a linear layer on top of the final hidden state of the [CLS] token) e.g. for ImageNet.
2314
+ */
2315
+ export class Dinov2ForImageClassification extends Dinov2PreTrainedModel {
2316
+ /**
2317
+ * @param {any} model_inputs
2318
+ */
2319
+ _call(model_inputs: any): Promise<SequenceClassifierOutput>;
2320
+ }
2321
+ export class YolosPreTrainedModel extends PreTrainedModel {
2322
+ }
2323
+ export class YolosModel extends YolosPreTrainedModel {
2324
+ }
2325
+ export class YolosForObjectDetection extends YolosPreTrainedModel {
2326
+ /**
2327
+ * @param {any} model_inputs
2328
+ */
2329
+ _call(model_inputs: any): Promise<YolosObjectDetectionOutput>;
2330
+ }
2331
+ export class YolosObjectDetectionOutput extends ModelOutput {
2332
+ /**
2333
+ * @param {Object} output The output of the model.
2334
+ * @param {Tensor} output.logits Classification logits (including no-object) for all queries.
2335
+ * @param {Tensor} output.pred_boxes Normalized boxes coordinates for all queries, represented as (center_x, center_y, width, height).
2336
+ * These values are normalized in [0, 1], relative to the size of each individual image in the batch (disregarding possible padding).
2337
+ */
2338
+ constructor({ logits, pred_boxes }: {
2339
+ logits: Tensor;
2340
+ pred_boxes: Tensor;
2341
+ });
2342
+ logits: Tensor;
2343
+ pred_boxes: Tensor;
2344
+ }
2345
+ export class SamPreTrainedModel extends PreTrainedModel {
2346
+ }
2347
+ /**
2348
+ * Segment Anything Model (SAM) for generating segmentation masks, given an input image
2349
+ * and optional 2D location and bounding boxes.
2350
+ *
2351
+ * **Example:** Perform mask generation w/ `Xenova/sam-vit-base`.
2352
+ * ```javascript
2353
+ * import { SamModel, AutoProcessor, RawImage } from '@xenova/transformers';
2354
+ *
2355
+ * const model = await SamModel.from_pretrained('Xenova/sam-vit-base');
2356
+ * const processor = await AutoProcessor.from_pretrained('Xenova/sam-vit-base');
2357
+ *
2358
+ * const img_url = 'https://huggingface.co/ybelkada/segment-anything/resolve/main/assets/car.png';
2359
+ * const raw_image = await RawImage.read(img_url);
2360
+ * const input_points = [[[450, 600]]] // 2D localization of a window
2361
+ *
2362
+ * const inputs = await processor(raw_image, input_points);
2363
+ * const outputs = await model(inputs);
2364
+ *
2365
+ * const masks = await processor.post_process_masks(outputs.pred_masks, inputs.original_sizes, inputs.reshaped_input_sizes);
2366
+ * // [
2367
+ * // Tensor {
2368
+ * // dims: [ 1, 3, 1764, 2646 ],
2369
+ * // type: 'bool',
2370
+ * // data: Uint8Array(14002632) [ ... ],
2371
+ * // size: 14002632
2372
+ * // }
2373
+ * // ]
2374
+ * const scores = outputs.iou_scores;
2375
+ * // Tensor {
2376
+ * // dims: [ 1, 1, 3 ],
2377
+ * // type: 'float32',
2378
+ * // data: Float32Array(3) [
2379
+ * // 0.8892380595207214,
2380
+ * // 0.9311248064041138,
2381
+ * // 0.983696699142456
2382
+ * // ],
2383
+ * // size: 3
2384
+ * // }
2385
+ * ```
2386
+ */
2387
+ export class SamModel extends SamPreTrainedModel {
2388
+ /**
2389
+ * Creates a new instance of the `SamModel` class.
2390
+ * @param {Object} config The configuration object specifying the hyperparameters and other model settings.
2391
+ * @param {Object} vision_encoder The ONNX session containing the vision encoder model.
2392
+ * @param {any} prompt_encoder_mask_decoder The ONNX session containing the prompt encoder and mask decoder model.
2393
+ */
2394
+ constructor(config: any, vision_encoder: any, prompt_encoder_mask_decoder: any);
2395
+ prompt_encoder_mask_decoder: any;
2396
+ /**
2397
+ * Compute image embeddings and positional image embeddings, given the pixel values of an image.
2398
+ * @param {Object} model_inputs Object containing the model inputs.
2399
+ * @param {Tensor} model_inputs.pixel_values Pixel values obtained using a `SamProcessor`.
2400
+ * @returns {Promise<{ image_embeddings: Tensor, image_positional_embeddings: Tensor }>} The image embeddings and positional image embeddings.
2401
+ */
2402
+ get_image_embeddings({ pixel_values }: {
2403
+ pixel_values: Tensor;
2404
+ }): Promise<{
2405
+ image_embeddings: Tensor;
2406
+ image_positional_embeddings: Tensor;
2407
+ }>;
2408
+ /**
2409
+ * @typedef {Object} SamModelInputs Object containing the model inputs.
2410
+ * @property {Tensor} pixel_values Pixel values as a Tensor with shape `(batch_size, num_channels, height, width)`.
2411
+ * These can be obtained using a `SamProcessor`.
2412
+ * @property {Tensor} input_points Input 2D spatial points with shape `(batch_size, num_points, 2)`.
2413
+ * This is used by the prompt encoder to encode the prompt.
2414
+ * @property {Tensor} [input_labels] Input labels for the points, as a Tensor of shape `(batch_size, point_batch_size, num_points)`.
2415
+ * This is used by the prompt encoder to encode the prompt. There are 4 types of labels:
2416
+ * - `1`: the point is a point that contains the object of interest
2417
+ * - `0`: the point is a point that does not contain the object of interest
2418
+ * - `-1`: the point corresponds to the background
2419
+ * - `-10`: the point is a padding point, thus should be ignored by the prompt encoder
2420
+ * @property {Tensor} [image_embeddings] Image embeddings used by the mask decoder.
2421
+ * @property {Tensor} [image_positional_embeddings] Image positional embeddings used by the mask decoder.
2422
+ */
2423
+ /**
2424
+ * @param {SamModelInputs} model_inputs Object containing the model inputs.
2425
+ * @returns {Promise<Object>} The output of the model.
2426
+ */
2427
+ forward(model_inputs: {
2428
+ /**
2429
+ * Pixel values as a Tensor with shape `(batch_size, num_channels, height, width)`.
2430
+ * These can be obtained using a `SamProcessor`.
2431
+ */
2432
+ pixel_values: Tensor;
2433
+ /**
2434
+ * Input 2D spatial points with shape `(batch_size, num_points, 2)`.
2435
+ * This is used by the prompt encoder to encode the prompt.
2436
+ */
2437
+ input_points: Tensor;
2438
+ /**
2439
+ * Input labels for the points, as a Tensor of shape `(batch_size, point_batch_size, num_points)`.
2440
+ * This is used by the prompt encoder to encode the prompt. There are 4 types of labels:
2441
+ * - `1`: the point is a point that contains the object of interest
2442
+ * - `0`: the point is a point that does not contain the object of interest
2443
+ * - `-1`: the point corresponds to the background
2444
+ * - `-10`: the point is a padding point, thus should be ignored by the prompt encoder
2445
+ */
2446
+ input_labels?: Tensor;
2447
+ /**
2448
+ * Image embeddings used by the mask decoder.
2449
+ */
2450
+ image_embeddings?: Tensor;
2451
+ /**
2452
+ * Image positional embeddings used by the mask decoder.
2453
+ */
2454
+ image_positional_embeddings?: Tensor;
2455
+ }): Promise<any>;
2456
+ /**
2457
+ * Runs the model with the provided inputs
2458
+ * @param {Object} model_inputs Model inputs
2459
+ * @returns {Promise<SamImageSegmentationOutput>} Object containing segmentation outputs
2460
+ */
2461
+ _call(model_inputs: any): Promise<SamImageSegmentationOutput>;
2462
+ }
2463
+ /**
2464
+ * Base class for Segment-Anything model's output.
2465
+ */
2466
+ export class SamImageSegmentationOutput extends ModelOutput {
2467
+ /**
2468
+ * @param {Object} output The output of the model.
2469
+ * @param {Tensor} output.iou_scores The output logits of the model.
2470
+ * @param {Tensor} output.pred_masks Predicted boxes.
2471
+ */
2472
+ constructor({ iou_scores, pred_masks }: {
2473
+ iou_scores: Tensor;
2474
+ pred_masks: Tensor;
2475
+ });
2476
+ iou_scores: Tensor;
2477
+ pred_masks: Tensor;
2478
+ }
2479
+ export class MarianPreTrainedModel extends PreTrainedModel {
2480
+ }
2481
+ export class MarianModel extends MarianPreTrainedModel {
2482
+ }
2483
+ export class MarianMTModel extends MarianPreTrainedModel {
2484
+ /**
2485
+ * Creates a new instance of the `MarianMTModel` class.
2486
+ * @param {Object} config The model configuration object.
2487
+ * @param {Object} session The ONNX session object.
2488
+ * @param {any} decoder_merged_session
2489
+ * @param {any} generation_config
2490
+ */
2491
+ constructor(config: any, session: any, decoder_merged_session: any, generation_config: any);
2492
+ decoder_merged_session: any;
2493
+ generation_config: any;
2494
+ num_decoder_layers: any;
2495
+ num_decoder_heads: any;
2496
+ decoder_dim_kv: number;
2497
+ num_encoder_layers: any;
2498
+ num_encoder_heads: any;
2499
+ encoder_dim_kv: number;
2500
+ }
2501
+ export class M2M100PreTrainedModel extends PreTrainedModel {
2502
+ }
2503
+ export class M2M100Model extends M2M100PreTrainedModel {
2504
+ }
2505
+ export class M2M100ForConditionalGeneration extends M2M100PreTrainedModel {
2506
+ /**
2507
+ * Creates a new instance of the `M2M100ForConditionalGeneration` class.
2508
+ * @param {Object} config The model configuration object.
2509
+ * @param {Object} session The ONNX session object.
2510
+ * @param {any} decoder_merged_session
2511
+ * @param {any} generation_config
2512
+ */
2513
+ constructor(config: any, session: any, decoder_merged_session: any, generation_config: any);
2514
+ decoder_merged_session: any;
2515
+ generation_config: any;
2516
+ num_decoder_layers: any;
2517
+ num_decoder_heads: any;
2518
+ decoder_dim_kv: number;
2519
+ num_encoder_layers: any;
2520
+ num_encoder_heads: any;
2521
+ encoder_dim_kv: number;
2522
+ }
2523
+ export class Wav2Vec2PreTrainedModel extends PreTrainedModel {
2524
+ }
2525
+ /**
2526
+ * The bare Wav2Vec2 Model transformer outputting raw hidden-states without any specific head on top.
2527
+ *
2528
+ * **Example:** Load and run a `Wav2Vec2Model` for feature extraction.
2529
+ *
2530
+ * ```javascript
2531
+ * import { AutoProcessor, AutoModel, read_audio } from '@xenova/transformers';
2532
+ *
2533
+ * // Read and preprocess audio
2534
+ * const processor = await AutoProcessor.from_pretrained('Xenova/mms-300m');
2535
+ * const audio = await read_audio('https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/mlk.flac', 16000);
2536
+ * const inputs = await processor(audio);
2537
+ *
2538
+ * // Run model with inputs
2539
+ * const model = await AutoModel.from_pretrained('Xenova/mms-300m');
2540
+ * const output = await model(inputs);
2541
+ * // {
2542
+ * // last_hidden_state: Tensor {
2543
+ * // dims: [ 1, 1144, 1024 ],
2544
+ * // type: 'float32',
2545
+ * // data: Float32Array(1171456) [ ... ],
2546
+ * // size: 1171456
2547
+ * // }
2548
+ * // }
2549
+ * ```
2550
+ */
2551
+ export class Wav2Vec2Model extends Wav2Vec2PreTrainedModel {
2552
+ }
2553
+ export class Wav2Vec2ForCTC extends Wav2Vec2PreTrainedModel {
2554
+ /**
2555
+ * @param {Object} model_inputs
2556
+ * @param {Tensor} model_inputs.input_values Float values of input raw speech waveform.
2557
+ * @param {Tensor} model_inputs.attention_mask Mask to avoid performing convolution and attention on padding token indices. Mask values selected in [0, 1]
2558
+ */
2559
+ _call(model_inputs: {
2560
+ input_values: Tensor;
2561
+ attention_mask: Tensor;
2562
+ }): Promise<CausalLMOutput>;
2563
+ }
2564
+ export class Wav2Vec2ForSequenceClassification extends Wav2Vec2PreTrainedModel {
2565
+ /**
2566
+ * Calls the model on new inputs.
2567
+ * @param {Object} model_inputs The inputs to the model.
2568
+ * @returns {Promise<SequenceClassifierOutput>} An object containing the model's output logits for sequence classification.
2569
+ */
2570
+ _call(model_inputs: any): Promise<SequenceClassifierOutput>;
2571
+ }
2572
+ /**
2573
+ * Wav2Vec2 Model with a frame classification head on top for tasks like Speaker Diarization.
2574
+ */
2575
+ export class Wav2Vec2ForAudioFrameClassification extends Wav2Vec2PreTrainedModel {
2576
+ /**
2577
+ * Calls the model on new inputs.
2578
+ * @param {Object} model_inputs The inputs to the model.
2579
+ * @returns {Promise<TokenClassifierOutput>} An object containing the model's output logits for sequence classification.
2580
+ */
2581
+ _call(model_inputs: any): Promise<TokenClassifierOutput>;
2582
+ }
2583
+ export class UniSpeechPreTrainedModel extends PreTrainedModel {
2584
+ }
2585
+ /**
2586
+ * The bare UniSpeech Model transformer outputting raw hidden-states without any specific head on top.
2587
+ */
2588
+ export class UniSpeechModel extends UniSpeechPreTrainedModel {
2589
+ }
2590
+ /**
2591
+ * UniSpeech Model with a `language modeling` head on top for Connectionist Temporal Classification (CTC).
2592
+ */
2593
+ export class UniSpeechForCTC extends UniSpeechPreTrainedModel {
2594
+ /**
2595
+ * @param {Object} model_inputs
2596
+ * @param {Tensor} model_inputs.input_values Float values of input raw speech waveform.
2597
+ * @param {Tensor} model_inputs.attention_mask Mask to avoid performing convolution and attention on padding token indices. Mask values selected in [0, 1]
2598
+ */
2599
+ _call(model_inputs: {
2600
+ input_values: Tensor;
2601
+ attention_mask: Tensor;
2602
+ }): Promise<CausalLMOutput>;
2603
+ }
2604
+ /**
2605
+ * UniSpeech Model with a sequence classification head on top (a linear layer over the pooled output).
2606
+ */
2607
+ export class UniSpeechForSequenceClassification extends UniSpeechPreTrainedModel {
2608
+ /**
2609
+ * Calls the model on new inputs.
2610
+ * @param {Object} model_inputs The inputs to the model.
2611
+ * @returns {Promise<SequenceClassifierOutput>} An object containing the model's output logits for sequence classification.
2612
+ */
2613
+ _call(model_inputs: any): Promise<SequenceClassifierOutput>;
2614
+ }
2615
+ export class UniSpeechSatPreTrainedModel extends PreTrainedModel {
2616
+ }
2617
+ /**
2618
+ * The bare UniSpeechSat Model transformer outputting raw hidden-states without any specific head on top.
2619
+ */
2620
+ export class UniSpeechSatModel extends UniSpeechSatPreTrainedModel {
2621
+ }
2622
+ /**
2623
+ * UniSpeechSat Model with a `language modeling` head on top for Connectionist Temporal Classification (CTC).
2624
+ */
2625
+ export class UniSpeechSatForCTC extends UniSpeechSatPreTrainedModel {
2626
+ /**
2627
+ * @param {Object} model_inputs
2628
+ * @param {Tensor} model_inputs.input_values Float values of input raw speech waveform.
2629
+ * @param {Tensor} model_inputs.attention_mask Mask to avoid performing convolution and attention on padding token indices. Mask values selected in [0, 1]
2630
+ */
2631
+ _call(model_inputs: {
2632
+ input_values: Tensor;
2633
+ attention_mask: Tensor;
2634
+ }): Promise<CausalLMOutput>;
2635
+ }
2636
+ /**
2637
+ * UniSpeechSat Model with a sequence classification head on top (a linear layer over the pooled output).
2638
+ */
2639
+ export class UniSpeechSatForSequenceClassification extends UniSpeechSatPreTrainedModel {
2640
+ /**
2641
+ * Calls the model on new inputs.
2642
+ * @param {Object} model_inputs The inputs to the model.
2643
+ * @returns {Promise<SequenceClassifierOutput>} An object containing the model's output logits for sequence classification.
2644
+ */
2645
+ _call(model_inputs: any): Promise<SequenceClassifierOutput>;
2646
+ }
2647
+ /**
2648
+ * UniSpeechSat Model with a frame classification head on top for tasks like Speaker Diarization.
2649
+ */
2650
+ export class UniSpeechSatForAudioFrameClassification extends UniSpeechSatPreTrainedModel {
2651
+ /**
2652
+ * Calls the model on new inputs.
2653
+ * @param {Object} model_inputs The inputs to the model.
2654
+ * @returns {Promise<TokenClassifierOutput>} An object containing the model's output logits for sequence classification.
2655
+ */
2656
+ _call(model_inputs: any): Promise<TokenClassifierOutput>;
2657
+ }
2658
+ export class Wav2Vec2BertPreTrainedModel extends PreTrainedModel {
2659
+ }
2660
+ /**
2661
+ * The bare Wav2Vec2Bert Model transformer outputting raw hidden-states without any specific head on top.
2662
+ */
2663
+ export class Wav2Vec2BertModel extends Wav2Vec2BertPreTrainedModel {
2664
+ }
2665
+ /**
2666
+ * Wav2Vec2Bert Model with a `language modeling` head on top for Connectionist Temporal Classification (CTC).
2667
+ */
2668
+ export class Wav2Vec2BertForCTC extends Wav2Vec2BertPreTrainedModel {
2669
+ /**
2670
+ * @param {Object} model_inputs
2671
+ * @param {Tensor} model_inputs.input_features Float values of input mel-spectrogram.
2672
+ * @param {Tensor} model_inputs.attention_mask Mask to avoid performing convolution and attention on padding token indices. Mask values selected in [0, 1]
2673
+ */
2674
+ _call(model_inputs: {
2675
+ input_features: Tensor;
2676
+ attention_mask: Tensor;
2677
+ }): Promise<CausalLMOutput>;
2678
+ }
2679
+ /**
2680
+ * Wav2Vec2Bert Model with a sequence classification head on top (a linear layer over the pooled output).
2681
+ */
2682
+ export class Wav2Vec2BertForSequenceClassification extends Wav2Vec2BertPreTrainedModel {
2683
+ /**
2684
+ * Calls the model on new inputs.
2685
+ * @param {Object} model_inputs The inputs to the model.
2686
+ * @returns {Promise<SequenceClassifierOutput>} An object containing the model's output logits for sequence classification.
2687
+ */
2688
+ _call(model_inputs: any): Promise<SequenceClassifierOutput>;
2689
+ }
2690
+ export class HubertPreTrainedModel extends PreTrainedModel {
2691
+ }
2692
+ /**
2693
+ * The bare Hubert Model transformer outputting raw hidden-states without any specific head on top.
2694
+ *
2695
+ * **Example:** Load and run a `HubertModel` for feature extraction.
2696
+ *
2697
+ * ```javascript
2698
+ * import { AutoProcessor, AutoModel, read_audio } from '@xenova/transformers';
2699
+ *
2700
+ * // Read and preprocess audio
2701
+ * const processor = await AutoProcessor.from_pretrained('Xenova/hubert-base-ls960');
2702
+ * const audio = await read_audio('https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/jfk.wav', 16000);
2703
+ * const inputs = await processor(audio);
2704
+ *
2705
+ * // Load and run model with inputs
2706
+ * const model = await AutoModel.from_pretrained('Xenova/hubert-base-ls960');
2707
+ * const output = await model(inputs);
2708
+ * // {
2709
+ * // last_hidden_state: Tensor {
2710
+ * // dims: [ 1, 549, 768 ],
2711
+ * // type: 'float32',
2712
+ * // data: Float32Array(421632) [0.0682469978928566, 0.08104046434164047, -0.4975186586380005, ...],
2713
+ * // size: 421632
2714
+ * // }
2715
+ * // }
2716
+ * ```
2717
+ */
2718
+ export class HubertModel extends Wav2Vec2PreTrainedModel {
2719
+ }
2720
+ /**
2721
+ * Hubert Model with a `language modeling` head on top for Connectionist Temporal Classification (CTC).
2722
+ */
2723
+ export class HubertForCTC extends Wav2Vec2PreTrainedModel {
2724
+ /**
2725
+ * @param {Object} model_inputs
2726
+ * @param {Tensor} model_inputs.input_values Float values of input raw speech waveform.
2727
+ * @param {Tensor} model_inputs.attention_mask Mask to avoid performing convolution and attention on padding token indices. Mask values selected in [0, 1]
2728
+ */
2729
+ _call(model_inputs: {
2730
+ input_values: Tensor;
2731
+ attention_mask: Tensor;
2732
+ }): Promise<CausalLMOutput>;
2733
+ }
2734
+ /**
2735
+ * Hubert Model with a sequence classification head on top (a linear layer over the pooled output) for tasks like SUPERB Keyword Spotting.
2736
+ */
2737
+ export class HubertForSequenceClassification extends Wav2Vec2PreTrainedModel {
2738
+ /**
2739
+ * Calls the model on new inputs.
2740
+ * @param {Object} model_inputs The inputs to the model.
2741
+ * @returns {Promise<SequenceClassifierOutput>} An object containing the model's output logits for sequence classification.
2742
+ */
2743
+ _call(model_inputs: any): Promise<SequenceClassifierOutput>;
2744
+ }
2745
+ /**
2746
+ * An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained models.
2747
+ */
2748
+ export class WavLMPreTrainedModel extends PreTrainedModel {
2749
+ }
2750
+ /**
2751
+ * The bare WavLM Model transformer outputting raw hidden-states without any specific head on top.
2752
+ *
2753
+ * **Example:** Load and run a `WavLMModel` for feature extraction.
2754
+ *
2755
+ * ```javascript
2756
+ * import { AutoProcessor, AutoModel, read_audio } from '@xenova/transformers';
2757
+ *
2758
+ * // Read and preprocess audio
2759
+ * const processor = await AutoProcessor.from_pretrained('Xenova/wavlm-base');
2760
+ * const audio = await read_audio('https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/jfk.wav', 16000);
2761
+ * const inputs = await processor(audio);
2762
+ *
2763
+ * // Run model with inputs
2764
+ * const model = await AutoModel.from_pretrained('Xenova/wavlm-base');
2765
+ * const output = await model(inputs);
2766
+ * // {
2767
+ * // last_hidden_state: Tensor {
2768
+ * // dims: [ 1, 549, 768 ],
2769
+ * // type: 'float32',
2770
+ * // data: Float32Array(421632) [-0.349443256855011, -0.39341306686401367, 0.022836603224277496, ...],
2771
+ * // size: 421632
2772
+ * // }
2773
+ * // }
2774
+ * ```
2775
+ */
2776
+ export class WavLMModel extends WavLMPreTrainedModel {
2777
+ }
2778
+ /**
2779
+ * WavLM Model with a `language modeling` head on top for Connectionist Temporal Classification (CTC).
2780
+ */
2781
+ export class WavLMForCTC extends WavLMPreTrainedModel {
2782
+ /**
2783
+ * @param {Object} model_inputs
2784
+ * @param {Tensor} model_inputs.input_values Float values of input raw speech waveform.
2785
+ * @param {Tensor} model_inputs.attention_mask Mask to avoid performing convolution and attention on padding token indices. Mask values selected in [0, 1]
2786
+ */
2787
+ _call(model_inputs: {
2788
+ input_values: Tensor;
2789
+ attention_mask: Tensor;
2790
+ }): Promise<CausalLMOutput>;
2791
+ }
2792
+ /**
2793
+ * WavLM Model with a sequence classification head on top (a linear layer over the pooled output).
2794
+ */
2795
+ export class WavLMForSequenceClassification extends WavLMPreTrainedModel {
2796
+ /**
2797
+ * Calls the model on new inputs.
2798
+ * @param {Object} model_inputs The inputs to the model.
2799
+ * @returns {Promise<SequenceClassifierOutput>} An object containing the model's output logits for sequence classification.
2800
+ */
2801
+ _call(model_inputs: any): Promise<SequenceClassifierOutput>;
2802
+ }
2803
+ /**
2804
+ * WavLM Model with an XVector feature extraction head on top for tasks like Speaker Verification.
2805
+ *
2806
+ * **Example:** Extract speaker embeddings with `WavLMForXVector`.
2807
+ * ```javascript
2808
+ * import { AutoProcessor, AutoModel, read_audio } from '@xenova/transformers';
2809
+ *
2810
+ * // Read and preprocess audio
2811
+ * const processor = await AutoProcessor.from_pretrained('Xenova/wavlm-base-plus-sv');
2812
+ * const url = 'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/jfk.wav';
2813
+ * const audio = await read_audio(url, 16000);
2814
+ * const inputs = await processor(audio);
2815
+ *
2816
+ * // Run model with inputs
2817
+ * const model = await AutoModel.from_pretrained('Xenova/wavlm-base-plus-sv');
2818
+ * const outputs = await model(inputs);
2819
+ * // {
2820
+ * // logits: Tensor {
2821
+ * // dims: [ 1, 512 ],
2822
+ * // type: 'float32',
2823
+ * // data: Float32Array(512) [0.5847219228744507, ...],
2824
+ * // size: 512
2825
+ * // },
2826
+ * // embeddings: Tensor {
2827
+ * // dims: [ 1, 512 ],
2828
+ * // type: 'float32',
2829
+ * // data: Float32Array(512) [-0.09079201519489288, ...],
2830
+ * // size: 512
2831
+ * // }
2832
+ * // }
2833
+ * ```
2834
+ */
2835
+ export class WavLMForXVector extends WavLMPreTrainedModel {
2836
+ /**
2837
+ * Calls the model on new inputs.
2838
+ * @param {Object} model_inputs The inputs to the model.
2839
+ * @returns {Promise<XVectorOutput>} An object containing the model's output logits and speaker embeddings.
2840
+ */
2841
+ _call(model_inputs: any): Promise<XVectorOutput>;
2842
+ }
2843
+ /**
2844
+ * WavLM Model with a frame classification head on top for tasks like Speaker Diarization.
2845
+ *
2846
+ * **Example:** Perform speaker diarization with `WavLMForAudioFrameClassification`.
2847
+ * ```javascript
2848
+ * import { AutoProcessor, AutoModelForAudioFrameClassification, read_audio } from '@xenova/transformers';
2849
+ *
2850
+ * // Read and preprocess audio
2851
+ * const processor = await AutoProcessor.from_pretrained('Xenova/wavlm-base-plus-sd');
2852
+ * const url = 'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/jfk.wav';
2853
+ * const audio = await read_audio(url, 16000);
2854
+ * const inputs = await processor(audio);
2855
+ *
2856
+ * // Run model with inputs
2857
+ * const model = await AutoModelForAudioFrameClassification.from_pretrained('Xenova/wavlm-base-plus-sd');
2858
+ * const { logits } = await model(inputs);
2859
+ * // {
2860
+ * // logits: Tensor {
2861
+ * // dims: [ 1, 549, 2 ], // [batch_size, num_frames, num_speakers]
2862
+ * // type: 'float32',
2863
+ * // data: Float32Array(1098) [-3.5301010608673096, ...],
2864
+ * // size: 1098
2865
+ * // }
2866
+ * // }
2867
+ *
2868
+ * const labels = logits[0].sigmoid().tolist().map(
2869
+ * frames => frames.map(speaker => speaker > 0.5 ? 1 : 0)
2870
+ * );
2871
+ * console.log(labels); // labels is a one-hot array of shape (num_frames, num_speakers)
2872
+ * // [
2873
+ * // [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0],
2874
+ * // [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0],
2875
+ * // [0, 0], [0, 1], [0, 1], [0, 1], [0, 1], [0, 1],
2876
+ * // ...
2877
+ * // ]
2878
+ * ```
2879
+ */
2880
+ export class WavLMForAudioFrameClassification extends WavLMPreTrainedModel {
2881
+ /**
2882
+ * Calls the model on new inputs.
2883
+ * @param {Object} model_inputs The inputs to the model.
2884
+ * @returns {Promise<TokenClassifierOutput>} An object containing the model's output logits for sequence classification.
2885
+ */
2886
+ _call(model_inputs: any): Promise<TokenClassifierOutput>;
2887
+ }
2888
+ /**
2889
+ * An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained models.
2890
+ */
2891
+ export class SpeechT5PreTrainedModel extends PreTrainedModel {
2892
+ }
2893
+ /**
2894
+ * The bare SpeechT5 Encoder-Decoder Model outputting raw hidden-states without any specific pre- or post-nets.
2895
+ */
2896
+ export class SpeechT5Model extends SpeechT5PreTrainedModel {
2897
+ }
2898
+ /**
2899
+ * SpeechT5 Model with a speech encoder and a text decoder.
2900
+ *
2901
+ * **Example:** Generate speech from text with `SpeechT5ForSpeechToText`.
2902
+ * ```javascript
2903
+ * import { AutoTokenizer, AutoProcessor, SpeechT5ForTextToSpeech, SpeechT5HifiGan, Tensor } from '@xenova/transformers';
2904
+ *
2905
+ * // Load the tokenizer and processor
2906
+ * const tokenizer = await AutoTokenizer.from_pretrained('Xenova/speecht5_tts');
2907
+ * const processor = await AutoProcessor.from_pretrained('Xenova/speecht5_tts');
2908
+ *
2909
+ * // Load the models
2910
+ * // NOTE: We use the unquantized versions as they are more accurate
2911
+ * const model = await SpeechT5ForTextToSpeech.from_pretrained('Xenova/speecht5_tts', { quantized: false });
2912
+ * const vocoder = await SpeechT5HifiGan.from_pretrained('Xenova/speecht5_hifigan', { quantized: false });
2913
+ *
2914
+ * // Load speaker embeddings from URL
2915
+ * const speaker_embeddings_data = new Float32Array(
2916
+ * await (await fetch('https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/speaker_embeddings.bin')).arrayBuffer()
2917
+ * );
2918
+ * const speaker_embeddings = new Tensor(
2919
+ * 'float32',
2920
+ * speaker_embeddings_data,
2921
+ * [1, speaker_embeddings_data.length]
2922
+ * )
2923
+ *
2924
+ * // Run tokenization
2925
+ * const { input_ids } = tokenizer('Hello, my dog is cute');
2926
+ *
2927
+ * // Generate waveform
2928
+ * const { waveform } = await model.generate_speech(input_ids, speaker_embeddings, { vocoder });
2929
+ * console.log(waveform)
2930
+ * // Tensor {
2931
+ * // dims: [ 26112 ],
2932
+ * // type: 'float32',
2933
+ * // size: 26112,
2934
+ * // data: Float32Array(26112) [ -0.00043630177970044315, -0.00018082228780258447, ... ],
2935
+ * // }
2936
+ * ```
2937
+ */
2938
+ export class SpeechT5ForSpeechToText extends SpeechT5PreTrainedModel {
2939
+ }
2940
+ /**
2941
+ * SpeechT5 Model with a text encoder and a speech decoder.
2942
+ */
2943
+ export class SpeechT5ForTextToSpeech extends SpeechT5PreTrainedModel {
2944
+ /**
2945
+ * Creates a new instance of the `SpeechT5ForTextToSpeech` class.
2946
+ * @param {Object} config The model configuration.
2947
+ * @param {any} session session for the model.
2948
+ * @param {any} decoder_merged_session session for the decoder.
2949
+ * @param {GenerationConfig} generation_config The generation configuration.
2950
+ */
2951
+ constructor(config: any, session: any, decoder_merged_session: any, generation_config: new (kwargs?: import("./utils/generation.js").GenerationConfigType) => import("./utils/generation.js").GenerationConfigType);
2952
+ decoder_merged_session: any;
2953
+ generation_config: new (kwargs?: import("./utils/generation.js").GenerationConfigType) => import("./utils/generation.js").GenerationConfigType;
2954
+ num_decoder_layers: any;
2955
+ num_decoder_heads: any;
2956
+ decoder_dim_kv: number;
2957
+ num_encoder_layers: any;
2958
+ num_encoder_heads: any;
2959
+ encoder_dim_kv: number;
2960
+ /**
2961
+ * @typedef {Object} SpeechOutput
2962
+ * @property {Tensor} [spectrogram] The predicted log-mel spectrogram of shape
2963
+ * `(output_sequence_length, config.num_mel_bins)`. Returned when no `vocoder` is provided
2964
+ * @property {Tensor} [waveform] The predicted waveform of shape `(num_frames,)`. Returned when a `vocoder` is provided.
2965
+ * @property {Tensor} [cross_attentions] The outputs of the decoder's cross-attention layers of shape
2966
+ * `(config.decoder_layers, config.decoder_attention_heads, output_sequence_length, input_sequence_length)`. returned when `output_cross_attentions` is `true`.
2967
+ */
2968
+ /**
2969
+ * Converts a sequence of input tokens into a sequence of mel spectrograms, which are subsequently turned into a speech waveform using a vocoder.
2970
+ * @param {Tensor} input_values Indices of input sequence tokens in the vocabulary.
2971
+ * @param {Tensor} speaker_embeddings Tensor containing the speaker embeddings.
2972
+ * @param {Object} options Optional parameters for generating speech.
2973
+ * @param {number} [options.threshold=0.5] The generated sequence ends when the predicted stop token probability exceeds this value.
2974
+ * @param {number} [options.minlenratio=0.0] Used to calculate the minimum required length for the output sequence.
2975
+ * @param {number} [options.maxlenratio=20.0] Used to calculate the maximum allowed length for the output sequence.
2976
+ * @param {Object} [options.vocoder=null] The vocoder that converts the mel spectrogram into a speech waveform. If `null`, the output is the mel spectrogram.
2977
+ * @param {boolean} [options.output_cross_attentions=false] Whether or not to return the attentions tensors of the decoder's cross-attention layers.
2978
+ * @returns {Promise<SpeechOutput>} A promise which resolves to an object containing the spectrogram, waveform, and cross-attention tensors.
2979
+ */
2980
+ generate_speech(input_values: Tensor, speaker_embeddings: Tensor, { threshold, minlenratio, maxlenratio, vocoder, }?: {
2981
+ threshold?: number;
2982
+ minlenratio?: number;
2983
+ maxlenratio?: number;
2984
+ vocoder?: any;
2985
+ output_cross_attentions?: boolean;
2986
+ }): Promise<{
2987
+ /**
2988
+ * The predicted log-mel spectrogram of shape
2989
+ * `(output_sequence_length, config.num_mel_bins)`. Returned when no `vocoder` is provided
2990
+ */
2991
+ spectrogram?: Tensor;
2992
+ /**
2993
+ * The predicted waveform of shape `(num_frames,)`. Returned when a `vocoder` is provided.
2994
+ */
2995
+ waveform?: Tensor;
2996
+ /**
2997
+ * The outputs of the decoder's cross-attention layers of shape
2998
+ * `(config.decoder_layers, config.decoder_attention_heads, output_sequence_length, input_sequence_length)`. returned when `output_cross_attentions` is `true`.
2999
+ */
3000
+ cross_attentions?: Tensor;
3001
+ }>;
3002
+ }
3003
+ /**
3004
+ * HiFi-GAN vocoder.
3005
+ *
3006
+ * See [SpeechT5ForSpeechToText](./models#module_models.SpeechT5ForSpeechToText) for example usage.
3007
+ */
3008
+ export class SpeechT5HifiGan extends PreTrainedModel {
3009
+ }
3010
+ export class TrOCRPreTrainedModel extends PreTrainedModel {
3011
+ /**
3012
+ * Creates a new instance of the `TrOCRPreTrainedModel` class.
3013
+ * @param {Object} config The configuration of the model.
3014
+ * @param {any} session The ONNX session containing the model weights.
3015
+ * @param {GenerationConfig} generation_config The generation configuration.
3016
+ */
3017
+ constructor(config: any, session: any, generation_config: new (kwargs?: import("./utils/generation.js").GenerationConfigType) => import("./utils/generation.js").GenerationConfigType);
3018
+ generation_config: new (kwargs?: import("./utils/generation.js").GenerationConfigType) => import("./utils/generation.js").GenerationConfigType;
3019
+ num_encoder_layers: any;
3020
+ num_decoder_layers: any;
3021
+ num_encoder_heads: any;
3022
+ num_decoder_heads: any;
3023
+ encoder_dim_kv: number;
3024
+ decoder_dim_kv: number;
3025
+ }
3026
+ /**
3027
+ * The TrOCR Decoder with a language modeling head.
3028
+ */
3029
+ export class TrOCRForCausalLM extends TrOCRPreTrainedModel {
3030
+ }
3031
+ /**
3032
+ * The bare Mistral Model outputting raw hidden-states without any specific head on top.
3033
+ */
3034
+ export class MistralPreTrainedModel extends PreTrainedModel {
3035
+ /**
3036
+ * Creates a new instance of the `MistralPreTrainedModel` class.
3037
+ * @param {Object} config The configuration of the model.
3038
+ * @param {any} session The ONNX session containing the model weights.
3039
+ * @param {GenerationConfig} generation_config The generation configuration.
3040
+ */
3041
+ constructor(config: any, session: any, generation_config: new (kwargs?: import("./utils/generation.js").GenerationConfigType) => import("./utils/generation.js").GenerationConfigType);
3042
+ generation_config: new (kwargs?: import("./utils/generation.js").GenerationConfigType) => import("./utils/generation.js").GenerationConfigType;
3043
+ num_heads: any;
3044
+ num_layers: any;
3045
+ dim_kv: number;
3046
+ }
3047
+ export class MistralModel extends MistralPreTrainedModel {
3048
+ }
3049
+ export class MistralForCausalLM extends MistralPreTrainedModel {
3050
+ }
3051
+ /**
3052
+ * The bare Starcoder2 Model outputting raw hidden-states without any specific head on top.
3053
+ */
3054
+ export class Starcoder2PreTrainedModel extends PreTrainedModel {
3055
+ /**
3056
+ * Creates a new instance of the `Starcoder2PreTrainedModel` class.
3057
+ * @param {Object} config The configuration of the model.
3058
+ * @param {any} session The ONNX session containing the model weights.
3059
+ * @param {GenerationConfig} generation_config The generation configuration.
3060
+ */
3061
+ constructor(config: any, session: any, generation_config: new (kwargs?: import("./utils/generation.js").GenerationConfigType) => import("./utils/generation.js").GenerationConfigType);
3062
+ generation_config: new (kwargs?: import("./utils/generation.js").GenerationConfigType) => import("./utils/generation.js").GenerationConfigType;
3063
+ num_heads: any;
3064
+ num_layers: any;
3065
+ dim_kv: number;
3066
+ }
3067
+ export class Starcoder2Model extends Starcoder2PreTrainedModel {
3068
+ }
3069
+ export class Starcoder2ForCausalLM extends Starcoder2PreTrainedModel {
3070
+ }
3071
+ /**
3072
+ * The bare Falcon Model outputting raw hidden-states without any specific head on top.
3073
+ */
3074
+ export class FalconPreTrainedModel extends PreTrainedModel {
3075
+ /**
3076
+ * Creates a new instance of the `FalconPreTrainedModel` class.
3077
+ * @param {Object} config The configuration of the model.
3078
+ * @param {any} session The ONNX session containing the model weights.
3079
+ * @param {GenerationConfig} generation_config The generation configuration.
3080
+ */
3081
+ constructor(config: any, session: any, generation_config: new (kwargs?: import("./utils/generation.js").GenerationConfigType) => import("./utils/generation.js").GenerationConfigType);
3082
+ generation_config: new (kwargs?: import("./utils/generation.js").GenerationConfigType) => import("./utils/generation.js").GenerationConfigType;
3083
+ num_heads: any;
3084
+ num_layers: any;
3085
+ dim_kv: number;
3086
+ }
3087
+ export class FalconModel extends FalconPreTrainedModel {
3088
+ }
3089
+ export class FalconForCausalLM extends FalconPreTrainedModel {
3090
+ }
3091
+ export class ClapPreTrainedModel extends PreTrainedModel {
3092
+ }
3093
+ export class ClapModel extends ClapPreTrainedModel {
3094
+ }
3095
+ /**
3096
+ * CLAP Text Model with a projection layer on top (a linear layer on top of the pooled output).
3097
+ *
3098
+ * **Example:** Compute text embeddings with `ClapTextModelWithProjection`.
3099
+ *
3100
+ * ```javascript
3101
+ * import { AutoTokenizer, ClapTextModelWithProjection } from '@xenova/transformers';
3102
+ *
3103
+ * // Load tokenizer and text model
3104
+ * const tokenizer = await AutoTokenizer.from_pretrained('Xenova/clap-htsat-unfused');
3105
+ * const text_model = await ClapTextModelWithProjection.from_pretrained('Xenova/clap-htsat-unfused');
3106
+ *
3107
+ * // Run tokenization
3108
+ * const texts = ['a sound of a cat', 'a sound of a dog'];
3109
+ * const text_inputs = tokenizer(texts, { padding: true, truncation: true });
3110
+ *
3111
+ * // Compute embeddings
3112
+ * const { text_embeds } = await text_model(text_inputs);
3113
+ * // Tensor {
3114
+ * // dims: [ 2, 512 ],
3115
+ * // type: 'float32',
3116
+ * // data: Float32Array(1024) [ ... ],
3117
+ * // size: 1024
3118
+ * // }
3119
+ * ```
3120
+ */
3121
+ export class ClapTextModelWithProjection extends ClapPreTrainedModel {
3122
+ }
3123
+ /**
3124
+ * CLAP Audio Model with a projection layer on top (a linear layer on top of the pooled output).
3125
+ *
3126
+ * **Example:** Compute audio embeddings with `ClapAudioModelWithProjection`.
3127
+ *
3128
+ * ```javascript
3129
+ * import { AutoProcessor, ClapAudioModelWithProjection, read_audio } from '@xenova/transformers';
3130
+ *
3131
+ * // Load processor and audio model
3132
+ * const processor = await AutoProcessor.from_pretrained('Xenova/clap-htsat-unfused');
3133
+ * const audio_model = await ClapAudioModelWithProjection.from_pretrained('Xenova/clap-htsat-unfused');
3134
+ *
3135
+ * // Read audio and run processor
3136
+ * const audio = await read_audio('https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/cat_meow.wav');
3137
+ * const audio_inputs = await processor(audio);
3138
+ *
3139
+ * // Compute embeddings
3140
+ * const { audio_embeds } = await audio_model(audio_inputs);
3141
+ * // Tensor {
3142
+ * // dims: [ 1, 512 ],
3143
+ * // type: 'float32',
3144
+ * // data: Float32Array(512) [ ... ],
3145
+ * // size: 512
3146
+ * // }
3147
+ * ```
3148
+ */
3149
+ export class ClapAudioModelWithProjection extends ClapPreTrainedModel {
3150
+ }
3151
+ export class VitsPreTrainedModel extends PreTrainedModel {
3152
+ }
3153
+ /**
3154
+ * The complete VITS model, for text-to-speech synthesis.
3155
+ *
3156
+ * **Example:** Generate speech from text with `VitsModel`.
3157
+ * ```javascript
3158
+ * import { AutoTokenizer, VitsModel } from '@xenova/transformers';
3159
+ *
3160
+ * // Load the tokenizer and model
3161
+ * const tokenizer = await AutoTokenizer.from_pretrained('Xenova/mms-tts-eng');
3162
+ * const model = await VitsModel.from_pretrained('Xenova/mms-tts-eng');
3163
+ *
3164
+ * // Run tokenization
3165
+ * const inputs = tokenizer('I love transformers');
3166
+ *
3167
+ * // Generate waveform
3168
+ * const { waveform } = await model(inputs);
3169
+ * // Tensor {
3170
+ * // dims: [ 1, 35328 ],
3171
+ * // type: 'float32',
3172
+ * // data: Float32Array(35328) [ ... ],
3173
+ * // size: 35328,
3174
+ * // }
3175
+ * ```
3176
+ */
3177
+ export class VitsModel extends VitsPreTrainedModel {
3178
+ /**
3179
+ * Calls the model on new inputs.
3180
+ * @param {Object} model_inputs The inputs to the model.
3181
+ * @returns {Promise<VitsModelOutput>} The outputs for the VITS model.
3182
+ */
3183
+ _call(model_inputs: any): Promise<VitsModelOutput>;
3184
+ }
3185
+ export class SegformerPreTrainedModel extends PreTrainedModel {
3186
+ }
3187
+ /**
3188
+ * The bare SegFormer encoder (Mix-Transformer) outputting raw hidden-states without any specific head on top.
3189
+ */
3190
+ export class SegformerModel extends SegformerPreTrainedModel {
3191
+ }
3192
+ /**
3193
+ * SegFormer Model transformer with an image classification head on top (a linear layer on top of the final hidden states) e.g. for ImageNet.
3194
+ */
3195
+ export class SegformerForImageClassification extends SegformerPreTrainedModel {
3196
+ }
3197
+ /**
3198
+ * SegFormer Model transformer with an all-MLP decode head on top e.g. for ADE20k, CityScapes.
3199
+ */
3200
+ export class SegformerForSemanticSegmentation extends SegformerPreTrainedModel {
3201
+ }
3202
+ export class StableLmPreTrainedModel extends PreTrainedModel {
3203
+ /**
3204
+ * Creates a new instance of the `StableLmPreTrainedModel` class.
3205
+ * @param {Object} config The configuration of the model.
3206
+ * @param {any} session The ONNX session containing the model weights.
3207
+ * @param {GenerationConfig} generation_config The generation configuration.
3208
+ */
3209
+ constructor(config: any, session: any, generation_config: new (kwargs?: import("./utils/generation.js").GenerationConfigType) => import("./utils/generation.js").GenerationConfigType);
3210
+ generation_config: new (kwargs?: import("./utils/generation.js").GenerationConfigType) => import("./utils/generation.js").GenerationConfigType;
3211
+ num_heads: any;
3212
+ num_layers: any;
3213
+ dim_kv: number;
3214
+ }
3215
+ /**
3216
+ * The bare StableLm Model transformer outputting raw hidden-states without any specific head on top.
3217
+ */
3218
+ export class StableLmModel extends StableLmPreTrainedModel {
3219
+ }
3220
+ /**
3221
+ * StableLm Model with a `language modeling` head on top for Causal Language Modeling (with past).
3222
+ */
3223
+ export class StableLmForCausalLM extends StableLmPreTrainedModel {
3224
+ }
3225
+ export class EfficientNetPreTrainedModel extends PreTrainedModel {
3226
+ }
3227
+ /**
3228
+ * The bare EfficientNet model outputting raw features without any specific head on top.
3229
+ */
3230
+ export class EfficientNetModel extends EfficientNetPreTrainedModel {
3231
+ }
3232
+ /**
3233
+ * EfficientNet Model with an image classification head on top (a linear layer on top of the pooled features).
3234
+ */
3235
+ export class EfficientNetForImageClassification extends EfficientNetPreTrainedModel {
3236
+ /**
3237
+ * @param {any} model_inputs
3238
+ */
3239
+ _call(model_inputs: any): Promise<SequenceClassifierOutput>;
3240
+ }
3241
+ /**
3242
+ * Base class of all AutoModels. Contains the `from_pretrained` function
3243
+ * which is used to instantiate pretrained models.
3244
+ */
3245
+ export class PretrainedMixin {
3246
+ /**
3247
+ * Mapping from model type to model class.
3248
+ * @type {Map<string, Object>[]}
3249
+ */
3250
+ static MODEL_CLASS_MAPPINGS: Map<string, any>[];
3251
+ /**
3252
+ * Whether to attempt to instantiate the base class (`PretrainedModel`) if
3253
+ * the model type is not found in the mapping.
3254
+ */
3255
+ static BASE_IF_FAIL: boolean;
3256
+ /**
3257
+ * Instantiate one of the model classes of the library from a pretrained model.
3258
+ *
3259
+ * The model class to instantiate is selected based on the `model_type` property of the config object
3260
+ * (either passed as an argument or loaded from `pretrained_model_name_or_path` if possible)
3261
+ *
3262
+ * @param {string} pretrained_model_name_or_path The name or path of the pretrained model. Can be either:
3263
+ * - A string, the *model id* of a pretrained model hosted inside a model repo on huggingface.co.
3264
+ * Valid model ids can be located at the root-level, like `bert-base-uncased`, or namespaced under a
3265
+ * user or organization name, like `dbmdz/bert-base-german-cased`.
3266
+ * - A path to a *directory* containing model weights, e.g., `./my_model_directory/`.
3267
+ * @param {import('./utils/hub.js').PretrainedOptions} options Additional options for loading the model.
3268
+ *
3269
+ * @returns {Promise<PreTrainedModel>} A new instance of the `PreTrainedModel` class.
3270
+ */
3271
+ static from_pretrained(pretrained_model_name_or_path: string, { quantized, progress_callback, config, cache_dir, local_files_only, revision, model_file_name, }?: import("./utils/hub.js").PretrainedOptions): Promise<PreTrainedModel>;
3272
+ }
3273
+ /**
3274
+ * Helper class which is used to instantiate pretrained models with the `from_pretrained` function.
3275
+ * The chosen model class is determined by the type specified in the model config.
3276
+ *
3277
+ * @example
3278
+ * let model = await AutoModel.from_pretrained('bert-base-uncased');
3279
+ */
3280
+ export class AutoModel extends PretrainedMixin {
3281
+ }
3282
+ /**
3283
+ * Helper class which is used to instantiate pretrained sequence classification models with the `from_pretrained` function.
3284
+ * The chosen model class is determined by the type specified in the model config.
3285
+ *
3286
+ * @example
3287
+ * let model = await AutoModelForSequenceClassification.from_pretrained('distilbert-base-uncased-finetuned-sst-2-english');
3288
+ */
3289
+ export class AutoModelForSequenceClassification extends PretrainedMixin {
3290
+ static MODEL_CLASS_MAPPINGS: Map<string, (string | typeof BertForSequenceClassification)[]>[];
3291
+ }
3292
+ /**
3293
+ * Helper class which is used to instantiate pretrained token classification models with the `from_pretrained` function.
3294
+ * The chosen model class is determined by the type specified in the model config.
3295
+ *
3296
+ * @example
3297
+ * let model = await AutoModelForTokenClassification.from_pretrained('Davlan/distilbert-base-multilingual-cased-ner-hrl');
3298
+ */
3299
+ export class AutoModelForTokenClassification extends PretrainedMixin {
3300
+ static MODEL_CLASS_MAPPINGS: Map<string, (string | typeof BertForTokenClassification)[]>[];
3301
+ }
3302
+ /**
3303
+ * Helper class which is used to instantiate pretrained sequence-to-sequence models with the `from_pretrained` function.
3304
+ * The chosen model class is determined by the type specified in the model config.
3305
+ *
3306
+ * @example
3307
+ * let model = await AutoModelForSeq2SeqLM.from_pretrained('t5-small');
3308
+ */
3309
+ export class AutoModelForSeq2SeqLM extends PretrainedMixin {
3310
+ static MODEL_CLASS_MAPPINGS: Map<string, (string | typeof T5ForConditionalGeneration)[] | (string | typeof BartForConditionalGeneration)[]>[];
3311
+ }
3312
+ /**
3313
+ * Helper class which is used to instantiate pretrained sequence-to-sequence speech-to-text models with the `from_pretrained` function.
3314
+ * The chosen model class is determined by the type specified in the model config.
3315
+ *
3316
+ * @example
3317
+ * let model = await AutoModelForSpeechSeq2Seq.from_pretrained('openai/whisper-tiny.en');
3318
+ */
3319
+ export class AutoModelForSpeechSeq2Seq extends PretrainedMixin {
3320
+ static MODEL_CLASS_MAPPINGS: Map<string, (string | typeof SpeechT5ForSpeechToText)[] | (string | typeof WhisperForConditionalGeneration)[]>[];
3321
+ }
3322
+ /**
3323
+ * Helper class which is used to instantiate pretrained sequence-to-sequence text-to-spectrogram models with the `from_pretrained` function.
3324
+ * The chosen model class is determined by the type specified in the model config.
3325
+ *
3326
+ * @example
3327
+ * let model = await AutoModelForTextToSpectrogram.from_pretrained('microsoft/speecht5_tts');
3328
+ */
3329
+ export class AutoModelForTextToSpectrogram extends PretrainedMixin {
3330
+ static MODEL_CLASS_MAPPINGS: Map<string, (string | typeof SpeechT5ForTextToSpeech)[]>[];
3331
+ }
3332
+ /**
3333
+ * Helper class which is used to instantiate pretrained text-to-waveform models with the `from_pretrained` function.
3334
+ * The chosen model class is determined by the type specified in the model config.
3335
+ *
3336
+ * @example
3337
+ * let model = await AutoModelForTextToSpectrogram.from_pretrained('facebook/mms-tts-eng');
3338
+ */
3339
+ export class AutoModelForTextToWaveform extends PretrainedMixin {
3340
+ static MODEL_CLASS_MAPPINGS: Map<string, (string | typeof VitsModel)[]>[];
3341
+ }
3342
+ /**
3343
+ * Helper class which is used to instantiate pretrained causal language models with the `from_pretrained` function.
3344
+ * The chosen model class is determined by the type specified in the model config.
3345
+ *
3346
+ * @example
3347
+ * let model = await AutoModelForCausalLM.from_pretrained('gpt2');
3348
+ */
3349
+ export class AutoModelForCausalLM extends PretrainedMixin {
3350
+ static MODEL_CLASS_MAPPINGS: Map<string, (string | typeof BloomForCausalLM)[] | (string | typeof MBartForCausalLM)[]>[];
3351
+ }
3352
+ /**
3353
+ * Helper class which is used to instantiate pretrained masked language models with the `from_pretrained` function.
3354
+ * The chosen model class is determined by the type specified in the model config.
3355
+ *
3356
+ * @example
3357
+ * let model = await AutoModelForMaskedLM.from_pretrained('bert-base-uncased');
3358
+ */
3359
+ export class AutoModelForMaskedLM extends PretrainedMixin {
3360
+ static MODEL_CLASS_MAPPINGS: Map<string, (string | typeof BertForMaskedLM)[]>[];
3361
+ }
3362
+ /**
3363
+ * Helper class which is used to instantiate pretrained question answering models with the `from_pretrained` function.
3364
+ * The chosen model class is determined by the type specified in the model config.
3365
+ *
3366
+ * @example
3367
+ * let model = await AutoModelForQuestionAnswering.from_pretrained('distilbert-base-cased-distilled-squad');
3368
+ */
3369
+ export class AutoModelForQuestionAnswering extends PretrainedMixin {
3370
+ static MODEL_CLASS_MAPPINGS: Map<string, (string | typeof BertForQuestionAnswering)[]>[];
3371
+ }
3372
+ /**
3373
+ * Helper class which is used to instantiate pretrained vision-to-sequence models with the `from_pretrained` function.
3374
+ * The chosen model class is determined by the type specified in the model config.
3375
+ *
3376
+ * @example
3377
+ * let model = await AutoModelForVision2Seq.from_pretrained('nlpconnect/vit-gpt2-image-captioning');
3378
+ */
3379
+ export class AutoModelForVision2Seq extends PretrainedMixin {
3380
+ static MODEL_CLASS_MAPPINGS: Map<string, (string | typeof VisionEncoderDecoderModel)[]>[];
3381
+ }
3382
+ /**
3383
+ * Helper class which is used to instantiate pretrained image classification models with the `from_pretrained` function.
3384
+ * The chosen model class is determined by the type specified in the model config.
3385
+ *
3386
+ * @example
3387
+ * let model = await AutoModelForImageClassification.from_pretrained('google/vit-base-patch16-224');
3388
+ */
3389
+ export class AutoModelForImageClassification extends PretrainedMixin {
3390
+ static MODEL_CLASS_MAPPINGS: Map<string, (string | typeof SegformerForImageClassification)[]>[];
3391
+ }
3392
+ /**
3393
+ * Helper class which is used to instantiate pretrained image segmentation models with the `from_pretrained` function.
3394
+ * The chosen model class is determined by the type specified in the model config.
3395
+ *
3396
+ * @example
3397
+ * let model = await AutoModelForImageSegmentation.from_pretrained('facebook/detr-resnet-50-panoptic');
3398
+ */
3399
+ export class AutoModelForImageSegmentation extends PretrainedMixin {
3400
+ static MODEL_CLASS_MAPPINGS: Map<string, (string | typeof CLIPSegForImageSegmentation)[]>[];
3401
+ }
3402
+ /**
3403
+ * Helper class which is used to instantiate pretrained image segmentation models with the `from_pretrained` function.
3404
+ * The chosen model class is determined by the type specified in the model config.
3405
+ *
3406
+ * @example
3407
+ * let model = await AutoModelForSemanticSegmentation.from_pretrained('nvidia/segformer-b3-finetuned-cityscapes-1024-1024');
3408
+ */
3409
+ export class AutoModelForSemanticSegmentation extends PretrainedMixin {
3410
+ static MODEL_CLASS_MAPPINGS: Map<string, (string | typeof SegformerForSemanticSegmentation)[]>[];
3411
+ }
3412
+ /**
3413
+ * Helper class which is used to instantiate pretrained object detection models with the `from_pretrained` function.
3414
+ * The chosen model class is determined by the type specified in the model config.
3415
+ *
3416
+ * @example
3417
+ * let model = await AutoModelForObjectDetection.from_pretrained('facebook/detr-resnet-50');
3418
+ */
3419
+ export class AutoModelForObjectDetection extends PretrainedMixin {
3420
+ static MODEL_CLASS_MAPPINGS: Map<string, (string | typeof DetrForObjectDetection)[]>[];
3421
+ }
3422
+ export class AutoModelForZeroShotObjectDetection extends PretrainedMixin {
3423
+ static MODEL_CLASS_MAPPINGS: Map<string, (string | typeof OwlViTForObjectDetection)[]>[];
3424
+ }
3425
+ /**
3426
+ * Helper class which is used to instantiate pretrained mask generation models with the `from_pretrained` function.
3427
+ * The chosen model class is determined by the type specified in the model config.
3428
+ *
3429
+ * @example
3430
+ * let model = await AutoModelForMaskGeneration.from_pretrained('Xenova/sam-vit-base');
3431
+ */
3432
+ export class AutoModelForMaskGeneration extends PretrainedMixin {
3433
+ static MODEL_CLASS_MAPPINGS: Map<string, (string | typeof SamModel)[]>[];
3434
+ }
3435
+ export class AutoModelForCTC extends PretrainedMixin {
3436
+ static MODEL_CLASS_MAPPINGS: Map<string, (string | typeof Wav2Vec2ForCTC)[] | (string | typeof Wav2Vec2BertForCTC)[]>[];
3437
+ }
3438
+ export class AutoModelForAudioClassification extends PretrainedMixin {
3439
+ static MODEL_CLASS_MAPPINGS: Map<string, (string | typeof ASTForAudioClassification)[]>[];
3440
+ }
3441
+ export class AutoModelForXVector extends PretrainedMixin {
3442
+ static MODEL_CLASS_MAPPINGS: Map<string, (string | typeof WavLMForXVector)[]>[];
3443
+ }
3444
+ export class AutoModelForAudioFrameClassification extends PretrainedMixin {
3445
+ static MODEL_CLASS_MAPPINGS: Map<string, (string | typeof UniSpeechSatForAudioFrameClassification)[]>[];
3446
+ }
3447
+ export class AutoModelForDocumentQuestionAnswering extends PretrainedMixin {
3448
+ static MODEL_CLASS_MAPPINGS: Map<string, (string | typeof VisionEncoderDecoderModel)[]>[];
3449
+ }
3450
+ export class AutoModelForImageMatting extends PretrainedMixin {
3451
+ static MODEL_CLASS_MAPPINGS: Map<string, (string | typeof VitMatteForImageMatting)[]>[];
3452
+ }
3453
+ export class AutoModelForImageToImage extends PretrainedMixin {
3454
+ static MODEL_CLASS_MAPPINGS: Map<string, (string | typeof Swin2SRForImageSuperResolution)[]>[];
3455
+ }
3456
+ export class AutoModelForDepthEstimation extends PretrainedMixin {
3457
+ static MODEL_CLASS_MAPPINGS: Map<string, (string | typeof DPTForDepthEstimation)[]>[];
3458
+ }
3459
+ export class AutoModelForImageFeatureExtraction extends PretrainedMixin {
3460
+ static MODEL_CLASS_MAPPINGS: Map<string, (string | typeof CLIPVisionModelWithProjection)[]>[];
3461
+ }
3462
+ export class Seq2SeqLMOutput extends ModelOutput {
3463
+ /**
3464
+ * @param {Object} output The output of the model.
3465
+ * @param {Tensor} output.logits The output logits of the model.
3466
+ * @param {Tensor} output.past_key_values An tensor of key/value pairs that represent the previous state of the model.
3467
+ * @param {Tensor} output.encoder_outputs The output of the encoder in a sequence-to-sequence model.
3468
+ * @param {Tensor} [output.decoder_attentions] Attentions weights of the decoder, after the attention softmax, used to compute the weighted average in the self-attention heads.
3469
+ * @param {Tensor} [output.cross_attentions] Attentions weights of the decoder's cross-attention layer, after the attention softmax, used to compute the weighted average in the cross-attention heads.
3470
+ */
3471
+ constructor({ logits, past_key_values, encoder_outputs, decoder_attentions, cross_attentions }: {
3472
+ logits: Tensor;
3473
+ past_key_values: Tensor;
3474
+ encoder_outputs: Tensor;
3475
+ decoder_attentions?: Tensor;
3476
+ cross_attentions?: Tensor;
3477
+ });
3478
+ logits: Tensor;
3479
+ past_key_values: Tensor;
3480
+ encoder_outputs: Tensor;
3481
+ decoder_attentions: Tensor;
3482
+ cross_attentions: Tensor;
3483
+ }
3484
+ /**
3485
+ * Base class for outputs of sentence classification models.
3486
+ */
3487
+ export class SequenceClassifierOutput extends ModelOutput {
3488
+ /**
3489
+ * @param {Object} output The output of the model.
3490
+ * @param {Tensor} output.logits classification (or regression if config.num_labels==1) scores (before SoftMax).
3491
+ */
3492
+ constructor({ logits }: {
3493
+ logits: Tensor;
3494
+ });
3495
+ logits: Tensor;
3496
+ }
3497
+ /**
3498
+ * Base class for outputs of XVector models.
3499
+ */
3500
+ export class XVectorOutput extends ModelOutput {
3501
+ /**
3502
+ * @param {Object} output The output of the model.
3503
+ * @param {Tensor} output.logits Classification hidden states before AMSoftmax, of shape `(batch_size, config.xvector_output_dim)`.
3504
+ * @param {Tensor} output.embeddings Utterance embeddings used for vector similarity-based retrieval, of shape `(batch_size, config.xvector_output_dim)`.
3505
+ */
3506
+ constructor({ logits, embeddings }: {
3507
+ logits: Tensor;
3508
+ embeddings: Tensor;
3509
+ });
3510
+ logits: Tensor;
3511
+ embeddings: Tensor;
3512
+ }
3513
+ /**
3514
+ * Base class for outputs of token classification models.
3515
+ */
3516
+ export class TokenClassifierOutput extends ModelOutput {
3517
+ /**
3518
+ * @param {Object} output The output of the model.
3519
+ * @param {Tensor} output.logits Classification scores (before SoftMax).
3520
+ */
3521
+ constructor({ logits }: {
3522
+ logits: Tensor;
3523
+ });
3524
+ logits: Tensor;
3525
+ }
3526
+ /**
3527
+ * Base class for masked language models outputs.
3528
+ */
3529
+ export class MaskedLMOutput extends ModelOutput {
3530
+ /**
3531
+ * @param {Object} output The output of the model.
3532
+ * @param {Tensor} output.logits Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).
3533
+ */
3534
+ constructor({ logits }: {
3535
+ logits: Tensor;
3536
+ });
3537
+ logits: Tensor;
3538
+ }
3539
+ /**
3540
+ * Base class for outputs of question answering models.
3541
+ */
3542
+ export class QuestionAnsweringModelOutput extends ModelOutput {
3543
+ /**
3544
+ * @param {Object} output The output of the model.
3545
+ * @param {Tensor} output.start_logits Span-start scores (before SoftMax).
3546
+ * @param {Tensor} output.end_logits Span-end scores (before SoftMax).
3547
+ */
3548
+ constructor({ start_logits, end_logits }: {
3549
+ start_logits: Tensor;
3550
+ end_logits: Tensor;
3551
+ });
3552
+ start_logits: Tensor;
3553
+ end_logits: Tensor;
3554
+ }
3555
+ /**
3556
+ * Base class for causal language model (or autoregressive) outputs.
3557
+ */
3558
+ export class CausalLMOutput extends ModelOutput {
3559
+ /**
3560
+ * @param {Object} output The output of the model.
3561
+ * @param {Tensor} output.logits Prediction scores of the language modeling head (scores for each vocabulary token before softmax).
3562
+ */
3563
+ constructor({ logits }: {
3564
+ logits: Tensor;
3565
+ });
3566
+ logits: Tensor;
3567
+ }
3568
+ /**
3569
+ * Base class for causal language model (or autoregressive) outputs.
3570
+ */
3571
+ export class CausalLMOutputWithPast extends ModelOutput {
3572
+ /**
3573
+ * @param {Object} output The output of the model.
3574
+ * @param {Tensor} output.logits Prediction scores of the language modeling head (scores for each vocabulary token before softmax).
3575
+ * @param {Tensor} output.past_key_values Contains pre-computed hidden-states (key and values in the self-attention blocks)
3576
+ * that can be used (see `past_key_values` input) to speed up sequential decoding.
3577
+ */
3578
+ constructor({ logits, past_key_values }: {
3579
+ logits: Tensor;
3580
+ past_key_values: Tensor;
3581
+ });
3582
+ logits: Tensor;
3583
+ past_key_values: Tensor;
3584
+ }
3585
+ export class ImageMattingOutput extends ModelOutput {
3586
+ /**
3587
+ * @param {Object} output The output of the model.
3588
+ * @param {Tensor} output.alphas Estimated alpha values, of shape `(batch_size, num_channels, height, width)`.
3589
+ */
3590
+ constructor({ alphas }: {
3591
+ alphas: Tensor;
3592
+ });
3593
+ alphas: Tensor;
3594
+ }
3595
+ /**
3596
+ * Describes the outputs for the VITS model.
3597
+ */
3598
+ export class VitsModelOutput extends ModelOutput {
3599
+ /**
3600
+ * @param {Object} output The output of the model.
3601
+ * @param {Tensor} output.waveform The final audio waveform predicted by the model, of shape `(batch_size, sequence_length)`.
3602
+ * @param {Tensor} output.spectrogram The log-mel spectrogram predicted at the output of the flow model.
3603
+ * This spectrogram is passed to the Hi-Fi GAN decoder model to obtain the final audio waveform.
3604
+ */
3605
+ constructor({ waveform, spectrogram }: {
3606
+ waveform: Tensor;
3607
+ spectrogram: Tensor;
3608
+ });
3609
+ waveform: Tensor;
3610
+ spectrogram: Tensor;
3611
+ }
3612
+ export type InferenceSession = import('onnxruntime-web').InferenceSession;
3613
+ /**
3614
+ * Runs a single step of the text generation process for a given beam.
3615
+ *
3616
+ * @param {Object} self The decoder object.
3617
+ * @param {Object} beam The beam to run.
3618
+ * @param {Tensor} beam.input The input tensor.
3619
+ * @param {Tensor} beam.model_input_ids The input ids to the model.
3620
+ * @param {Tensor} beam.attention_mask The attention mask.
3621
+ * @param {Object} beam.prev_model_outputs The past key values.
3622
+ * @param {number[]} beam.output_token_ids The output token ids.
3623
+ * @returns {Promise<Object>} The output of the generation step.
3624
+ * @private
3625
+ */
3626
+ declare function decoderRunBeam(self: any, beam: {
3627
+ input: Tensor;
3628
+ model_input_ids: Tensor;
3629
+ attention_mask: Tensor;
3630
+ prev_model_outputs: any;
3631
+ output_token_ids: number[];
3632
+ }): Promise<any>;
3633
+ /**
3634
+ * Starts the generation of text by initializing the beams for the given input token IDs.
3635
+ * @param {Object} self The text generation model object.
3636
+ * @param {Tensor} inputTokenIds An tensor of input token IDs to generate text from.
3637
+ * @param {Object} generation_config The generation config.
3638
+ * @param {number} numOutputTokens The maximum number of tokens to generate for each beam.
3639
+ * @param {Tensor} [inputs_attention_mask] The attention mask tensor for the input token IDs.
3640
+ * @returns {Object[]} An array of beams initialized with the given inputs and parameters.
3641
+ * @private
3642
+ */
3643
+ declare function decoderStartBeams(self: any, inputTokenIds: Tensor, generation_config: any, numOutputTokens: number, inputs_attention_mask?: Tensor): any[];
3644
+ /**
3645
+ * Update a beam with a new token ID.
3646
+ * @param {Object} beam The beam to update.
3647
+ * @param {number} newTokenId The new token ID to add to the beam's output.
3648
+ * @private
3649
+ */
3650
+ declare function decoderUpdatebeam(beam: any, newTokenId: number): void;
3651
+ /**
3652
+ * Forward pass of an encoder model.
3653
+ * @param {Object} self The encoder model.
3654
+ * @param {Object} model_inputs The input data to be used for the forward pass.
3655
+ * @returns {Promise<Object>} Promise that resolves with an object containing the model's outputs.
3656
+ * @private
3657
+ */
3658
+ declare function encoderForward(self: any, model_inputs: any): Promise<any>;
3659
+ import { Tensor } from './utils/tensor.js';
3660
+ export {};
3661
+ //# sourceMappingURL=models.d.ts.map