Buckets:

rtrm's picture
|
download
raw
256 kB
# models
Definitions of all models available in Transformers.js.
**Example:** Load and run an `AutoModel`.
```javascript
import { AutoModel, AutoTokenizer } from '@huggingface/transformers';
let tokenizer = await AutoTokenizer.from_pretrained('Xenova/bert-base-uncased');
let model = await AutoModel.from_pretrained('Xenova/bert-base-uncased');
let inputs = await tokenizer('I love transformers!');
let { logits } = await model(inputs);
// Tensor {
// data: Float32Array(183132) [-7.117443084716797, -7.107812881469727, -7.092104911804199, ...]
// dims: (3) [1, 6, 30522],
// type: "float32",
// size: 183132,
// }
```
We also provide other `AutoModel`s (listed below), which you can use in the same way as the Python library. For example:
**Example:** Load and run an `AutoModelForSeq2SeqLM`.
```javascript
import { AutoModelForSeq2SeqLM, AutoTokenizer } from '@huggingface/transformers';
let tokenizer = await AutoTokenizer.from_pretrained('Xenova/t5-small');
let model = await AutoModelForSeq2SeqLM.from_pretrained('Xenova/t5-small');
let { input_ids } = await tokenizer('translate English to German: I love transformers!');
let outputs = await model.generate(input_ids);
let decoded = tokenizer.decode(outputs[0], { skip_special_tokens: true });
// 'Ich liebe Transformatoren!'
```
* [models](#module_models)
* _static_
* [.PreTrainedModel](#module_models.PreTrainedModel)
* [`new PreTrainedModel(config, sessions, configs)`](#new_module_models.PreTrainedModel_new)
* _instance_
* [`.custom_config`](#module_models.PreTrainedModel+custom_config) : <code>*</code>
* [`.generation_config`](#module_models.PreTrainedModel+generation_config) ⇒ <code>GenerationConfig</code> | <code>null</code>
* [`.dispose()`](#module_models.PreTrainedModel+dispose) ⇒ <code>Promise.&lt;Array&lt;unknown&gt;&gt;</code>
* [`._call(model_inputs)`](#module_models.PreTrainedModel+_call) ⇒ <code>Promise.&lt;Object&gt;</code>
* [`.forward(model_inputs)`](#module_models.PreTrainedModel+forward) ⇒ <code>Promise.&lt;Object&gt;</code>
* [`._prepare_generation_config(generation_config, kwargs)`](#module_models.PreTrainedModel+_prepare_generation_config) ⇒ <code>GenerationConfig</code>
* [`._get_stopping_criteria(generation_config, [stopping_criteria])`](#module_models.PreTrainedModel+_get_stopping_criteria)
* [`._validate_model_class()`](#module_models.PreTrainedModel+_validate_model_class)
* [`._update_model_kwargs_for_generation(inputs)`](#module_models.PreTrainedModel+_update_model_kwargs_for_generation) ⇒ <code>Object</code>
* [`._prepare_model_inputs(params)`](#module_models.PreTrainedModel+_prepare_model_inputs) ⇒ <code>Object</code>
* [`._prepare_decoder_input_ids_for_generation(param0)`](#module_models.PreTrainedModel+_prepare_decoder_input_ids_for_generation)
* [`.generate(options)`](#module_models.PreTrainedModel+generate) ⇒ <code>Promise.&lt;(ModelOutput|Tensor)&gt;</code>
* [`.getPastKeyValues(decoderResults, pastKeyValues)`](#module_models.PreTrainedModel+getPastKeyValues) ⇒ <code>Object</code>
* [`.getAttentions(model_output)`](#module_models.PreTrainedModel+getAttentions) ⇒ <code>*</code>
* [`.addPastKeyValues(decoderFeeds, pastKeyValues)`](#module_models.PreTrainedModel+addPastKeyValues)
* _static_
* [`.from_pretrained(pretrained_model_name_or_path, options)`](#module_models.PreTrainedModel.from_pretrained) ⇒ <code>Promise.&lt;PreTrainedModel&gt;</code>
* [.BaseModelOutput](#module_models.BaseModelOutput)
* [`new BaseModelOutput(output)`](#new_module_models.BaseModelOutput_new)
* [.BertForMaskedLM](#module_models.BertForMaskedLM)
* [`._call(model_inputs)`](#module_models.BertForMaskedLM+_call) ⇒ <code>Promise.&lt;MaskedLMOutput&gt;</code>
* [.BertForSequenceClassification](#module_models.BertForSequenceClassification)
* [`._call(model_inputs)`](#module_models.BertForSequenceClassification+_call) ⇒ <code>Promise.&lt;SequenceClassifierOutput&gt;</code>
* [.BertForTokenClassification](#module_models.BertForTokenClassification)
* [`._call(model_inputs)`](#module_models.BertForTokenClassification+_call) ⇒ <code>Promise.&lt;TokenClassifierOutput&gt;</code>
* [.BertForQuestionAnswering](#module_models.BertForQuestionAnswering)
* [`._call(model_inputs)`](#module_models.BertForQuestionAnswering+_call) ⇒ <code>Promise.&lt;QuestionAnsweringModelOutput&gt;</code>
* [.RoFormerModel](#module_models.RoFormerModel)
* [.RoFormerForMaskedLM](#module_models.RoFormerForMaskedLM)
* [`._call(model_inputs)`](#module_models.RoFormerForMaskedLM+_call) ⇒ <code>Promise.&lt;MaskedLMOutput&gt;</code>
* [.RoFormerForSequenceClassification](#module_models.RoFormerForSequenceClassification)
* [`._call(model_inputs)`](#module_models.RoFormerForSequenceClassification+_call) ⇒ <code>Promise.&lt;SequenceClassifierOutput&gt;</code>
* [.RoFormerForTokenClassification](#module_models.RoFormerForTokenClassification)
* [`._call(model_inputs)`](#module_models.RoFormerForTokenClassification+_call) ⇒ <code>Promise.&lt;TokenClassifierOutput&gt;</code>
* [.RoFormerForQuestionAnswering](#module_models.RoFormerForQuestionAnswering)
* [`._call(model_inputs)`](#module_models.RoFormerForQuestionAnswering+_call) ⇒ <code>Promise.&lt;QuestionAnsweringModelOutput&gt;</code>
* [.ConvBertModel](#module_models.ConvBertModel)
* [.ConvBertForMaskedLM](#module_models.ConvBertForMaskedLM)
* [`._call(model_inputs)`](#module_models.ConvBertForMaskedLM+_call) ⇒ <code>Promise.&lt;MaskedLMOutput&gt;</code>
* [.ConvBertForSequenceClassification](#module_models.ConvBertForSequenceClassification)
* [`._call(model_inputs)`](#module_models.ConvBertForSequenceClassification+_call) ⇒ <code>Promise.&lt;SequenceClassifierOutput&gt;</code>
* [.ConvBertForTokenClassification](#module_models.ConvBertForTokenClassification)
* [`._call(model_inputs)`](#module_models.ConvBertForTokenClassification+_call) ⇒ <code>Promise.&lt;TokenClassifierOutput&gt;</code>
* [.ConvBertForQuestionAnswering](#module_models.ConvBertForQuestionAnswering)
* [`._call(model_inputs)`](#module_models.ConvBertForQuestionAnswering+_call) ⇒ <code>Promise.&lt;QuestionAnsweringModelOutput&gt;</code>
* [.ElectraModel](#module_models.ElectraModel)
* [.ElectraForMaskedLM](#module_models.ElectraForMaskedLM)
* [`._call(model_inputs)`](#module_models.ElectraForMaskedLM+_call) ⇒ <code>Promise.&lt;MaskedLMOutput&gt;</code>
* [.ElectraForSequenceClassification](#module_models.ElectraForSequenceClassification)
* [`._call(model_inputs)`](#module_models.ElectraForSequenceClassification+_call) ⇒ <code>Promise.&lt;SequenceClassifierOutput&gt;</code>
* [.ElectraForTokenClassification](#module_models.ElectraForTokenClassification)
* [`._call(model_inputs)`](#module_models.ElectraForTokenClassification+_call) ⇒ <code>Promise.&lt;TokenClassifierOutput&gt;</code>
* [.ElectraForQuestionAnswering](#module_models.ElectraForQuestionAnswering)
* [`._call(model_inputs)`](#module_models.ElectraForQuestionAnswering+_call) ⇒ <code>Promise.&lt;QuestionAnsweringModelOutput&gt;</code>
* [.CamembertModel](#module_models.CamembertModel)
* [.CamembertForMaskedLM](#module_models.CamembertForMaskedLM)
* [`._call(model_inputs)`](#module_models.CamembertForMaskedLM+_call) ⇒ <code>Promise.&lt;MaskedLMOutput&gt;</code>
* [.CamembertForSequenceClassification](#module_models.CamembertForSequenceClassification)
* [`._call(model_inputs)`](#module_models.CamembertForSequenceClassification+_call) ⇒ <code>Promise.&lt;SequenceClassifierOutput&gt;</code>
* [.CamembertForTokenClassification](#module_models.CamembertForTokenClassification)
* [`._call(model_inputs)`](#module_models.CamembertForTokenClassification+_call) ⇒ <code>Promise.&lt;TokenClassifierOutput&gt;</code>
* [.CamembertForQuestionAnswering](#module_models.CamembertForQuestionAnswering)
* [`._call(model_inputs)`](#module_models.CamembertForQuestionAnswering+_call) ⇒ <code>Promise.&lt;QuestionAnsweringModelOutput&gt;</code>
* [.DebertaModel](#module_models.DebertaModel)
* [.DebertaForMaskedLM](#module_models.DebertaForMaskedLM)
* [`._call(model_inputs)`](#module_models.DebertaForMaskedLM+_call) ⇒ <code>Promise.&lt;MaskedLMOutput&gt;</code>
* [.DebertaForSequenceClassification](#module_models.DebertaForSequenceClassification)
* [`._call(model_inputs)`](#module_models.DebertaForSequenceClassification+_call) ⇒ <code>Promise.&lt;SequenceClassifierOutput&gt;</code>
* [.DebertaForTokenClassification](#module_models.DebertaForTokenClassification)
* [`._call(model_inputs)`](#module_models.DebertaForTokenClassification+_call) ⇒ <code>Promise.&lt;TokenClassifierOutput&gt;</code>
* [.DebertaForQuestionAnswering](#module_models.DebertaForQuestionAnswering)
* [`._call(model_inputs)`](#module_models.DebertaForQuestionAnswering+_call) ⇒ <code>Promise.&lt;QuestionAnsweringModelOutput&gt;</code>
* [.DebertaV2Model](#module_models.DebertaV2Model)
* [.DebertaV2ForMaskedLM](#module_models.DebertaV2ForMaskedLM)
* [`._call(model_inputs)`](#module_models.DebertaV2ForMaskedLM+_call) ⇒ <code>Promise.&lt;MaskedLMOutput&gt;</code>
* [.DebertaV2ForSequenceClassification](#module_models.DebertaV2ForSequenceClassification)
* [`._call(model_inputs)`](#module_models.DebertaV2ForSequenceClassification+_call) ⇒ <code>Promise.&lt;SequenceClassifierOutput&gt;</code>
* [.DebertaV2ForTokenClassification](#module_models.DebertaV2ForTokenClassification)
* [`._call(model_inputs)`](#module_models.DebertaV2ForTokenClassification+_call) ⇒ <code>Promise.&lt;TokenClassifierOutput&gt;</code>
* [.DebertaV2ForQuestionAnswering](#module_models.DebertaV2ForQuestionAnswering)
* [`._call(model_inputs)`](#module_models.DebertaV2ForQuestionAnswering+_call) ⇒ <code>Promise.&lt;QuestionAnsweringModelOutput&gt;</code>
* [.DistilBertForSequenceClassification](#module_models.DistilBertForSequenceClassification)
* [`._call(model_inputs)`](#module_models.DistilBertForSequenceClassification+_call) ⇒ <code>Promise.&lt;SequenceClassifierOutput&gt;</code>
* [.DistilBertForTokenClassification](#module_models.DistilBertForTokenClassification)
* [`._call(model_inputs)`](#module_models.DistilBertForTokenClassification+_call) ⇒ <code>Promise.&lt;TokenClassifierOutput&gt;</code>
* [.DistilBertForQuestionAnswering](#module_models.DistilBertForQuestionAnswering)
* [`._call(model_inputs)`](#module_models.DistilBertForQuestionAnswering+_call) ⇒ <code>Promise.&lt;QuestionAnsweringModelOutput&gt;</code>
* [.DistilBertForMaskedLM](#module_models.DistilBertForMaskedLM)
* [`._call(model_inputs)`](#module_models.DistilBertForMaskedLM+_call) ⇒ <code>Promise.&lt;MaskedLMOutput&gt;</code>
* [.EsmModel](#module_models.EsmModel)
* [.EsmForMaskedLM](#module_models.EsmForMaskedLM)
* [`._call(model_inputs)`](#module_models.EsmForMaskedLM+_call) ⇒ <code>Promise.&lt;MaskedLMOutput&gt;</code>
* [.EsmForSequenceClassification](#module_models.EsmForSequenceClassification)
* [`._call(model_inputs)`](#module_models.EsmForSequenceClassification+_call) ⇒ <code>Promise.&lt;SequenceClassifierOutput&gt;</code>
* [.EsmForTokenClassification](#module_models.EsmForTokenClassification)
* [`._call(model_inputs)`](#module_models.EsmForTokenClassification+_call) ⇒ <code>Promise.&lt;TokenClassifierOutput&gt;</code>
* [.MobileBertForMaskedLM](#module_models.MobileBertForMaskedLM)
* [`._call(model_inputs)`](#module_models.MobileBertForMaskedLM+_call) ⇒ <code>Promise.&lt;MaskedLMOutput&gt;</code>
* [.MobileBertForSequenceClassification](#module_models.MobileBertForSequenceClassification)
* [`._call(model_inputs)`](#module_models.MobileBertForSequenceClassification+_call) ⇒ <code>Promise.&lt;SequenceClassifierOutput&gt;</code>
* [.MobileBertForQuestionAnswering](#module_models.MobileBertForQuestionAnswering)
* [`._call(model_inputs)`](#module_models.MobileBertForQuestionAnswering+_call) ⇒ <code>Promise.&lt;QuestionAnsweringModelOutput&gt;</code>
* [.MPNetModel](#module_models.MPNetModel)
* [.MPNetForMaskedLM](#module_models.MPNetForMaskedLM)
* [`._call(model_inputs)`](#module_models.MPNetForMaskedLM+_call) ⇒ <code>Promise.&lt;MaskedLMOutput&gt;</code>
* [.MPNetForSequenceClassification](#module_models.MPNetForSequenceClassification)
* [`._call(model_inputs)`](#module_models.MPNetForSequenceClassification+_call) ⇒ <code>Promise.&lt;SequenceClassifierOutput&gt;</code>
* [.MPNetForTokenClassification](#module_models.MPNetForTokenClassification)
* [`._call(model_inputs)`](#module_models.MPNetForTokenClassification+_call) ⇒ <code>Promise.&lt;TokenClassifierOutput&gt;</code>
* [.MPNetForQuestionAnswering](#module_models.MPNetForQuestionAnswering)
* [`._call(model_inputs)`](#module_models.MPNetForQuestionAnswering+_call) ⇒ <code>Promise.&lt;QuestionAnsweringModelOutput&gt;</code>
* [.T5ForConditionalGeneration](#module_models.T5ForConditionalGeneration)
* [.LongT5PreTrainedModel](#module_models.LongT5PreTrainedModel)
* [.LongT5Model](#module_models.LongT5Model)
* [.LongT5ForConditionalGeneration](#module_models.LongT5ForConditionalGeneration)
* [.MT5ForConditionalGeneration](#module_models.MT5ForConditionalGeneration)
* [.BartModel](#module_models.BartModel)
* [.BartForConditionalGeneration](#module_models.BartForConditionalGeneration)
* [.BartForSequenceClassification](#module_models.BartForSequenceClassification)
* [`._call(model_inputs)`](#module_models.BartForSequenceClassification+_call) ⇒ <code>Promise.&lt;SequenceClassifierOutput&gt;</code>
* [.MBartModel](#module_models.MBartModel)
* [.MBartForConditionalGeneration](#module_models.MBartForConditionalGeneration)
* [.MBartForSequenceClassification](#module_models.MBartForSequenceClassification)
* [`._call(model_inputs)`](#module_models.MBartForSequenceClassification+_call) ⇒ <code>Promise.&lt;SequenceClassifierOutput&gt;</code>
* [.BlenderbotModel](#module_models.BlenderbotModel)
* [.BlenderbotForConditionalGeneration](#module_models.BlenderbotForConditionalGeneration)
* [.BlenderbotSmallModel](#module_models.BlenderbotSmallModel)
* [.BlenderbotSmallForConditionalGeneration](#module_models.BlenderbotSmallForConditionalGeneration)
* [.RobertaForMaskedLM](#module_models.RobertaForMaskedLM)
* [`._call(model_inputs)`](#module_models.RobertaForMaskedLM+_call) ⇒ <code>Promise.&lt;MaskedLMOutput&gt;</code>
* [.RobertaForSequenceClassification](#module_models.RobertaForSequenceClassification)
* [`._call(model_inputs)`](#module_models.RobertaForSequenceClassification+_call) ⇒ <code>Promise.&lt;SequenceClassifierOutput&gt;</code>
* [.RobertaForTokenClassification](#module_models.RobertaForTokenClassification)
* [`._call(model_inputs)`](#module_models.RobertaForTokenClassification+_call) ⇒ <code>Promise.&lt;TokenClassifierOutput&gt;</code>
* [.RobertaForQuestionAnswering](#module_models.RobertaForQuestionAnswering)
* [`._call(model_inputs)`](#module_models.RobertaForQuestionAnswering+_call) ⇒ <code>Promise.&lt;QuestionAnsweringModelOutput&gt;</code>
* [.XLMPreTrainedModel](#module_models.XLMPreTrainedModel)
* [.XLMModel](#module_models.XLMModel)
* [.XLMWithLMHeadModel](#module_models.XLMWithLMHeadModel)
* [`._call(model_inputs)`](#module_models.XLMWithLMHeadModel+_call) ⇒ <code>Promise.&lt;MaskedLMOutput&gt;</code>
* [.XLMForSequenceClassification](#module_models.XLMForSequenceClassification)
* [`._call(model_inputs)`](#module_models.XLMForSequenceClassification+_call) ⇒ <code>Promise.&lt;SequenceClassifierOutput&gt;</code>
* [.XLMForTokenClassification](#module_models.XLMForTokenClassification)
* [`._call(model_inputs)`](#module_models.XLMForTokenClassification+_call) ⇒ <code>Promise.&lt;TokenClassifierOutput&gt;</code>
* [.XLMForQuestionAnswering](#module_models.XLMForQuestionAnswering)
* [`._call(model_inputs)`](#module_models.XLMForQuestionAnswering+_call) ⇒ <code>Promise.&lt;QuestionAnsweringModelOutput&gt;</code>
* [.XLMRobertaForMaskedLM](#module_models.XLMRobertaForMaskedLM)
* [`._call(model_inputs)`](#module_models.XLMRobertaForMaskedLM+_call) ⇒ <code>Promise.&lt;MaskedLMOutput&gt;</code>
* [.XLMRobertaForSequenceClassification](#module_models.XLMRobertaForSequenceClassification)
* [`._call(model_inputs)`](#module_models.XLMRobertaForSequenceClassification+_call) ⇒ <code>Promise.&lt;SequenceClassifierOutput&gt;</code>
* [.XLMRobertaForTokenClassification](#module_models.XLMRobertaForTokenClassification)
* [`._call(model_inputs)`](#module_models.XLMRobertaForTokenClassification+_call) ⇒ <code>Promise.&lt;TokenClassifierOutput&gt;</code>
* [.XLMRobertaForQuestionAnswering](#module_models.XLMRobertaForQuestionAnswering)
* [`._call(model_inputs)`](#module_models.XLMRobertaForQuestionAnswering+_call) ⇒ <code>Promise.&lt;QuestionAnsweringModelOutput&gt;</code>
* [.ASTModel](#module_models.ASTModel)
* [.ASTForAudioClassification](#module_models.ASTForAudioClassification)
* [.WhisperModel](#module_models.WhisperModel)
* [.WhisperForConditionalGeneration](#module_models.WhisperForConditionalGeneration)
* [`._retrieve_init_tokens(generation_config)`](#module_models.WhisperForConditionalGeneration+_retrieve_init_tokens)
* [`.generate(options)`](#module_models.WhisperForConditionalGeneration+generate) ⇒ <code>Promise.&lt;(ModelOutput|Tensor)&gt;</code>
* [`._extract_token_timestamps(generate_outputs, alignment_heads, [num_frames], [time_precision])`](#module_models.WhisperForConditionalGeneration+_extract_token_timestamps) ⇒ [<code>Tensor</code>](#Tensor)
* [.MoonshineModel](#module_models.MoonshineModel)
* [.VisionEncoderDecoderModel](#module_models.VisionEncoderDecoderModel)
* [.LlavaForConditionalGeneration](#module_models.LlavaForConditionalGeneration)
* [.Idefics3ForConditionalGeneration](#module_models.Idefics3ForConditionalGeneration)
* [.SmolVLMForConditionalGeneration](#module_models.SmolVLMForConditionalGeneration)
* [.CLIPModel](#module_models.CLIPModel)
* [.CLIPTextModel](#module_models.CLIPTextModel)
* [`.from_pretrained()`](#module_models.CLIPTextModel.from_pretrained) : <code>*</code>
* [.CLIPTextModelWithProjection](#module_models.CLIPTextModelWithProjection)
* [`.from_pretrained()`](#module_models.CLIPTextModelWithProjection.from_pretrained) : <code>*</code>
* [.CLIPVisionModel](#module_models.CLIPVisionModel)
* [`.from_pretrained()`](#module_models.CLIPVisionModel.from_pretrained) : <code>*</code>
* [.CLIPVisionModelWithProjection](#module_models.CLIPVisionModelWithProjection)
* [`.from_pretrained()`](#module_models.CLIPVisionModelWithProjection.from_pretrained) : <code>*</code>
* [.SiglipModel](#module_models.SiglipModel)
* [.SiglipTextModel](#module_models.SiglipTextModel)
* [`.from_pretrained()`](#module_models.SiglipTextModel.from_pretrained) : <code>*</code>
* [.SiglipVisionModel](#module_models.SiglipVisionModel)
* [`.from_pretrained()`](#module_models.SiglipVisionModel.from_pretrained) : <code>*</code>
* [.CLIPSegForImageSegmentation](#module_models.CLIPSegForImageSegmentation)
* [.GPT2LMHeadModel](#module_models.GPT2LMHeadModel)
* [.JAISModel](#module_models.JAISModel)
* [.JAISLMHeadModel](#module_models.JAISLMHeadModel)
* [.CodeGenModel](#module_models.CodeGenModel)
* [.CodeGenForCausalLM](#module_models.CodeGenForCausalLM)
* [.LlamaPreTrainedModel](#module_models.LlamaPreTrainedModel)
* [.LlamaModel](#module_models.LlamaModel)
* [.CoherePreTrainedModel](#module_models.CoherePreTrainedModel)
* [.GemmaPreTrainedModel](#module_models.GemmaPreTrainedModel)
* [.GemmaModel](#module_models.GemmaModel)
* [.Gemma2PreTrainedModel](#module_models.Gemma2PreTrainedModel)
* [.Gemma2Model](#module_models.Gemma2Model)
* [.Gemma3PreTrainedModel](#module_models.Gemma3PreTrainedModel)
* [.Gemma3Model](#module_models.Gemma3Model)
* [.Qwen2PreTrainedModel](#module_models.Qwen2PreTrainedModel)
* [.Qwen2Model](#module_models.Qwen2Model)
* [.Qwen3PreTrainedModel](#module_models.Qwen3PreTrainedModel)
* [.Qwen3Model](#module_models.Qwen3Model)
* [.PhiModel](#module_models.PhiModel)
* [.Phi3Model](#module_models.Phi3Model)
* [.BloomPreTrainedModel](#module_models.BloomPreTrainedModel)
* [.BloomModel](#module_models.BloomModel)
* [.BloomForCausalLM](#module_models.BloomForCausalLM)
* [.MptModel](#module_models.MptModel)
* [.MptForCausalLM](#module_models.MptForCausalLM)
* [.OPTModel](#module_models.OPTModel)
* [.OPTForCausalLM](#module_models.OPTForCausalLM)
* [.VitPoseForPoseEstimation](#module_models.VitPoseForPoseEstimation)
* [.VitMatteForImageMatting](#module_models.VitMatteForImageMatting)
* [`._call(model_inputs)`](#module_models.VitMatteForImageMatting+_call)
* [.DetrObjectDetectionOutput](#module_models.DetrObjectDetectionOutput)
* [`new DetrObjectDetectionOutput(output)`](#new_module_models.DetrObjectDetectionOutput_new)
* [.DetrSegmentationOutput](#module_models.DetrSegmentationOutput)
* [`new DetrSegmentationOutput(output)`](#new_module_models.DetrSegmentationOutput_new)
* [.RTDetrObjectDetectionOutput](#module_models.RTDetrObjectDetectionOutput)
* [`new RTDetrObjectDetectionOutput(output)`](#new_module_models.RTDetrObjectDetectionOutput_new)
* [.TableTransformerModel](#module_models.TableTransformerModel)
* [.TableTransformerForObjectDetection](#module_models.TableTransformerForObjectDetection)
* [`._call(model_inputs)`](#module_models.TableTransformerForObjectDetection+_call)
* [.ResNetPreTrainedModel](#module_models.ResNetPreTrainedModel)
* [.ResNetModel](#module_models.ResNetModel)
* [.ResNetForImageClassification](#module_models.ResNetForImageClassification)
* [`._call(model_inputs)`](#module_models.ResNetForImageClassification+_call)
* [.Swin2SRModel](#module_models.Swin2SRModel)
* [.Swin2SRForImageSuperResolution](#module_models.Swin2SRForImageSuperResolution)
* [.DPTModel](#module_models.DPTModel)
* [.DPTForDepthEstimation](#module_models.DPTForDepthEstimation)
* [.DepthAnythingForDepthEstimation](#module_models.DepthAnythingForDepthEstimation)
* [.GLPNModel](#module_models.GLPNModel)
* [.GLPNForDepthEstimation](#module_models.GLPNForDepthEstimation)
* [.DonutSwinModel](#module_models.DonutSwinModel)
* [.ConvNextModel](#module_models.ConvNextModel)
* [.ConvNextForImageClassification](#module_models.ConvNextForImageClassification)
* [`._call(model_inputs)`](#module_models.ConvNextForImageClassification+_call)
* [.ConvNextV2Model](#module_models.ConvNextV2Model)
* [.ConvNextV2ForImageClassification](#module_models.ConvNextV2ForImageClassification)
* [`._call(model_inputs)`](#module_models.ConvNextV2ForImageClassification+_call)
* [.Dinov2Model](#module_models.Dinov2Model)
* [.Dinov2ForImageClassification](#module_models.Dinov2ForImageClassification)
* [`._call(model_inputs)`](#module_models.Dinov2ForImageClassification+_call)
* [.Dinov2WithRegistersModel](#module_models.Dinov2WithRegistersModel)
* [.Dinov2WithRegistersForImageClassification](#module_models.Dinov2WithRegistersForImageClassification)
* [`._call(model_inputs)`](#module_models.Dinov2WithRegistersForImageClassification+_call)
* [.YolosObjectDetectionOutput](#module_models.YolosObjectDetectionOutput)
* [`new YolosObjectDetectionOutput(output)`](#new_module_models.YolosObjectDetectionOutput_new)
* [.SamModel](#module_models.SamModel)
* [`.get_image_embeddings(model_inputs)`](#module_models.SamModel+get_image_embeddings) ⇒ <code>Promise.&lt;{image_embeddings: Tensor, image_positional_embeddings: Tensor}&gt;</code>
* [`.forward(model_inputs)`](#module_models.SamModel+forward) ⇒ <code>Promise.&lt;Object&gt;</code>
* [`._call(model_inputs)`](#module_models.SamModel+_call) ⇒ <code>Promise.&lt;SamImageSegmentationOutput&gt;</code>
* [.SamImageSegmentationOutput](#module_models.SamImageSegmentationOutput)
* [`new SamImageSegmentationOutput(output)`](#new_module_models.SamImageSegmentationOutput_new)
* [.Wav2Vec2Model](#module_models.Wav2Vec2Model)
* [.Wav2Vec2ForAudioFrameClassification](#module_models.Wav2Vec2ForAudioFrameClassification)
* [`._call(model_inputs)`](#module_models.Wav2Vec2ForAudioFrameClassification+_call) ⇒ <code>Promise.&lt;TokenClassifierOutput&gt;</code>
* [.PyAnnoteModel](#module_models.PyAnnoteModel)
* [.PyAnnoteForAudioFrameClassification](#module_models.PyAnnoteForAudioFrameClassification)
* [`._call(model_inputs)`](#module_models.PyAnnoteForAudioFrameClassification+_call) ⇒ <code>Promise.&lt;TokenClassifierOutput&gt;</code>
* [.UniSpeechModel](#module_models.UniSpeechModel)
* [.UniSpeechForCTC](#module_models.UniSpeechForCTC)
* [`._call(model_inputs)`](#module_models.UniSpeechForCTC+_call)
* [.UniSpeechForSequenceClassification](#module_models.UniSpeechForSequenceClassification)
* [`._call(model_inputs)`](#module_models.UniSpeechForSequenceClassification+_call) ⇒ <code>Promise.&lt;SequenceClassifierOutput&gt;</code>
* [.UniSpeechSatModel](#module_models.UniSpeechSatModel)
* [.UniSpeechSatForCTC](#module_models.UniSpeechSatForCTC)
* [`._call(model_inputs)`](#module_models.UniSpeechSatForCTC+_call)
* [.UniSpeechSatForSequenceClassification](#module_models.UniSpeechSatForSequenceClassification)
* [`._call(model_inputs)`](#module_models.UniSpeechSatForSequenceClassification+_call) ⇒ <code>Promise.&lt;SequenceClassifierOutput&gt;</code>
* [.UniSpeechSatForAudioFrameClassification](#module_models.UniSpeechSatForAudioFrameClassification)
* [`._call(model_inputs)`](#module_models.UniSpeechSatForAudioFrameClassification+_call) ⇒ <code>Promise.&lt;TokenClassifierOutput&gt;</code>
* [.Wav2Vec2BertModel](#module_models.Wav2Vec2BertModel)
* [.Wav2Vec2BertForCTC](#module_models.Wav2Vec2BertForCTC)
* [`._call(model_inputs)`](#module_models.Wav2Vec2BertForCTC+_call)
* [.Wav2Vec2BertForSequenceClassification](#module_models.Wav2Vec2BertForSequenceClassification)
* [`._call(model_inputs)`](#module_models.Wav2Vec2BertForSequenceClassification+_call) ⇒ <code>Promise.&lt;SequenceClassifierOutput&gt;</code>
* [.HubertModel](#module_models.HubertModel)
* [.HubertForCTC](#module_models.HubertForCTC)
* [`._call(model_inputs)`](#module_models.HubertForCTC+_call)
* [.HubertForSequenceClassification](#module_models.HubertForSequenceClassification)
* [`._call(model_inputs)`](#module_models.HubertForSequenceClassification+_call) ⇒ <code>Promise.&lt;SequenceClassifierOutput&gt;</code>
* [.WavLMPreTrainedModel](#module_models.WavLMPreTrainedModel)
* [.WavLMModel](#module_models.WavLMModel)
* [.WavLMForCTC](#module_models.WavLMForCTC)
* [`._call(model_inputs)`](#module_models.WavLMForCTC+_call)
* [.WavLMForSequenceClassification](#module_models.WavLMForSequenceClassification)
* [`._call(model_inputs)`](#module_models.WavLMForSequenceClassification+_call) ⇒ <code>Promise.&lt;SequenceClassifierOutput&gt;</code>
* [.WavLMForXVector](#module_models.WavLMForXVector)
* [`._call(model_inputs)`](#module_models.WavLMForXVector+_call) ⇒ <code>Promise.&lt;XVectorOutput&gt;</code>
* [.WavLMForAudioFrameClassification](#module_models.WavLMForAudioFrameClassification)
* [`._call(model_inputs)`](#module_models.WavLMForAudioFrameClassification+_call) ⇒ <code>Promise.&lt;TokenClassifierOutput&gt;</code>
* [.SpeechT5PreTrainedModel](#module_models.SpeechT5PreTrainedModel)
* [.SpeechT5Model](#module_models.SpeechT5Model)
* [.SpeechT5ForSpeechToText](#module_models.SpeechT5ForSpeechToText)
* [.SpeechT5ForTextToSpeech](#module_models.SpeechT5ForTextToSpeech)
* [`.generate_speech(input_values, speaker_embeddings, options)`](#module_models.SpeechT5ForTextToSpeech+generate_speech) ⇒ <code>Promise.&lt;SpeechOutput&gt;</code>
* [.SpeechT5HifiGan](#module_models.SpeechT5HifiGan)
* [.TrOCRForCausalLM](#module_models.TrOCRForCausalLM)
* [.MistralPreTrainedModel](#module_models.MistralPreTrainedModel)
* [.Starcoder2PreTrainedModel](#module_models.Starcoder2PreTrainedModel)
* [.FalconPreTrainedModel](#module_models.FalconPreTrainedModel)
* [.ClapTextModelWithProjection](#module_models.ClapTextModelWithProjection)
* [`.from_pretrained()`](#module_models.ClapTextModelWithProjection.from_pretrained) : <code>*</code>
* [.ClapAudioModelWithProjection](#module_models.ClapAudioModelWithProjection)
* [`.from_pretrained()`](#module_models.ClapAudioModelWithProjection.from_pretrained) : <code>*</code>
* [.VitsModel](#module_models.VitsModel)
* [`._call(model_inputs)`](#module_models.VitsModel+_call) ⇒ <code>Promise.&lt;VitsModelOutput&gt;</code>
* [.SegformerModel](#module_models.SegformerModel)
* [.SegformerForImageClassification](#module_models.SegformerForImageClassification)
* [.SegformerForSemanticSegmentation](#module_models.SegformerForSemanticSegmentation)
* [.StableLmModel](#module_models.StableLmModel)
* [.StableLmForCausalLM](#module_models.StableLmForCausalLM)
* [.EfficientNetModel](#module_models.EfficientNetModel)
* [.EfficientNetForImageClassification](#module_models.EfficientNetForImageClassification)
* [`._call(model_inputs)`](#module_models.EfficientNetForImageClassification+_call)
* [.MusicgenModel](#module_models.MusicgenModel)
* [.MusicgenForCausalLM](#module_models.MusicgenForCausalLM)
* [.MusicgenForConditionalGeneration](#module_models.MusicgenForConditionalGeneration)
* [`._apply_and_filter_by_delay_pattern_mask(outputs)`](#module_models.MusicgenForConditionalGeneration+_apply_and_filter_by_delay_pattern_mask) ⇒ [<code>Tensor</code>](#Tensor)
* [`.generate(options)`](#module_models.MusicgenForConditionalGeneration+generate) ⇒ <code>Promise.&lt;(ModelOutput|Tensor)&gt;</code>
* [.MobileNetV1Model](#module_models.MobileNetV1Model)
* [.MobileNetV1ForImageClassification](#module_models.MobileNetV1ForImageClassification)
* [`._call(model_inputs)`](#module_models.MobileNetV1ForImageClassification+_call)
* [.MobileNetV2Model](#module_models.MobileNetV2Model)
* [.MobileNetV2ForImageClassification](#module_models.MobileNetV2ForImageClassification)
* [`._call(model_inputs)`](#module_models.MobileNetV2ForImageClassification+_call)
* [.MobileNetV3Model](#module_models.MobileNetV3Model)
* [.MobileNetV3ForImageClassification](#module_models.MobileNetV3ForImageClassification)
* [`._call(model_inputs)`](#module_models.MobileNetV3ForImageClassification+_call)
* [.MobileNetV4Model](#module_models.MobileNetV4Model)
* [.MobileNetV4ForImageClassification](#module_models.MobileNetV4ForImageClassification)
* [`._call(model_inputs)`](#module_models.MobileNetV4ForImageClassification+_call)
* [.DecisionTransformerModel](#module_models.DecisionTransformerModel)
* [.MultiModalityCausalLM](#module_models.MultiModalityCausalLM)
* [`new MultiModalityCausalLM(...args)`](#new_module_models.MultiModalityCausalLM_new)
* [`.generate(options)`](#module_models.MultiModalityCausalLM+generate)
* [`.generate_images(options)`](#module_models.MultiModalityCausalLM+generate_images)
* [.MgpstrForSceneTextRecognition](#module_models.MgpstrForSceneTextRecognition)
* [`._call(model_inputs)`](#module_models.MgpstrForSceneTextRecognition+_call)
* [.PatchTSTModel](#module_models.PatchTSTModel)
* [.PatchTSTForPrediction](#module_models.PatchTSTForPrediction)
* [.PatchTSMixerModel](#module_models.PatchTSMixerModel)
* [.PatchTSMixerForPrediction](#module_models.PatchTSMixerForPrediction)
* [.MimiEncoderOutput](#module_models.MimiEncoderOutput)
* [`new MimiEncoderOutput(output)`](#new_module_models.MimiEncoderOutput_new)
* [.MimiDecoderOutput](#module_models.MimiDecoderOutput)
* [`new MimiDecoderOutput(output)`](#new_module_models.MimiDecoderOutput_new)
* [.MimiModel](#module_models.MimiModel)
* [`.encode(inputs)`](#module_models.MimiModel+encode) ⇒ <code>Promise.&lt;MimiEncoderOutput&gt;</code>
* [`.decode(inputs)`](#module_models.MimiModel+decode) ⇒ <code>Promise.&lt;MimiDecoderOutput&gt;</code>
* [.DacEncoderOutput](#module_models.DacEncoderOutput)
* [`new DacEncoderOutput(output)`](#new_module_models.DacEncoderOutput_new)
* [.DacDecoderOutput](#module_models.DacDecoderOutput)
* [`new DacDecoderOutput(output)`](#new_module_models.DacDecoderOutput_new)
* [.DacModel](#module_models.DacModel)
* [`.encode(inputs)`](#module_models.DacModel+encode) ⇒ <code>Promise.&lt;DacEncoderOutput&gt;</code>
* [`.decode(inputs)`](#module_models.DacModel+decode) ⇒ <code>Promise.&lt;DacDecoderOutput&gt;</code>
* [.SnacModel](#module_models.SnacModel)
* [`.encode(inputs)`](#module_models.SnacModel+encode) ⇒ <code>Promise.&lt;Record&lt;string, Tensor&gt;&gt;</code>
* [`.decode(inputs)`](#module_models.SnacModel+decode) ⇒ <code>Promise.&lt;{audio_values: Tensor}&gt;</code>
* [.PretrainedMixin](#module_models.PretrainedMixin)
* _instance_
* [`.MODEL_CLASS_MAPPINGS`](#module_models.PretrainedMixin+MODEL_CLASS_MAPPINGS) : <code>*</code>
* [`.BASE_IF_FAIL`](#module_models.PretrainedMixin+BASE_IF_FAIL)
* _static_
* [`.from_pretrained()`](#module_models.PretrainedMixin.from_pretrained) : <code>*</code>
* [.AutoModel](#module_models.AutoModel)
* [`new AutoModel()`](#new_module_models.AutoModel_new)
* [`.MODEL_CLASS_MAPPINGS`](#module_models.AutoModel+MODEL_CLASS_MAPPINGS) : <code>*</code>
* [.AutoModelForSequenceClassification](#module_models.AutoModelForSequenceClassification)
* [`new AutoModelForSequenceClassification()`](#new_module_models.AutoModelForSequenceClassification_new)
* [.AutoModelForTokenClassification](#module_models.AutoModelForTokenClassification)
* [`new AutoModelForTokenClassification()`](#new_module_models.AutoModelForTokenClassification_new)
* [.AutoModelForSeq2SeqLM](#module_models.AutoModelForSeq2SeqLM)
* [`new AutoModelForSeq2SeqLM()`](#new_module_models.AutoModelForSeq2SeqLM_new)
* [.AutoModelForSpeechSeq2Seq](#module_models.AutoModelForSpeechSeq2Seq)
* [`new AutoModelForSpeechSeq2Seq()`](#new_module_models.AutoModelForSpeechSeq2Seq_new)
* [.AutoModelForTextToSpectrogram](#module_models.AutoModelForTextToSpectrogram)
* [`new AutoModelForTextToSpectrogram()`](#new_module_models.AutoModelForTextToSpectrogram_new)
* [.AutoModelForTextToWaveform](#module_models.AutoModelForTextToWaveform)
* [`new AutoModelForTextToWaveform()`](#new_module_models.AutoModelForTextToWaveform_new)
* [.AutoModelForCausalLM](#module_models.AutoModelForCausalLM)
* [`new AutoModelForCausalLM()`](#new_module_models.AutoModelForCausalLM_new)
* [.AutoModelForMaskedLM](#module_models.AutoModelForMaskedLM)
* [`new AutoModelForMaskedLM()`](#new_module_models.AutoModelForMaskedLM_new)
* [.AutoModelForQuestionAnswering](#module_models.AutoModelForQuestionAnswering)
* [`new AutoModelForQuestionAnswering()`](#new_module_models.AutoModelForQuestionAnswering_new)
* [.AutoModelForVision2Seq](#module_models.AutoModelForVision2Seq)
* [`new AutoModelForVision2Seq()`](#new_module_models.AutoModelForVision2Seq_new)
* [.AutoModelForImageClassification](#module_models.AutoModelForImageClassification)
* [`new AutoModelForImageClassification()`](#new_module_models.AutoModelForImageClassification_new)
* [.AutoModelForImageSegmentation](#module_models.AutoModelForImageSegmentation)
* [`new AutoModelForImageSegmentation()`](#new_module_models.AutoModelForImageSegmentation_new)
* [.AutoModelForSemanticSegmentation](#module_models.AutoModelForSemanticSegmentation)
* [`new AutoModelForSemanticSegmentation()`](#new_module_models.AutoModelForSemanticSegmentation_new)
* [.AutoModelForUniversalSegmentation](#module_models.AutoModelForUniversalSegmentation)
* [`new AutoModelForUniversalSegmentation()`](#new_module_models.AutoModelForUniversalSegmentation_new)
* [.AutoModelForObjectDetection](#module_models.AutoModelForObjectDetection)
* [`new AutoModelForObjectDetection()`](#new_module_models.AutoModelForObjectDetection_new)
* [.AutoModelForMaskGeneration](#module_models.AutoModelForMaskGeneration)
* [`new AutoModelForMaskGeneration()`](#new_module_models.AutoModelForMaskGeneration_new)
* [.Seq2SeqLMOutput](#module_models.Seq2SeqLMOutput)
* [`new Seq2SeqLMOutput(output)`](#new_module_models.Seq2SeqLMOutput_new)
* [.SequenceClassifierOutput](#module_models.SequenceClassifierOutput)
* [`new SequenceClassifierOutput(output)`](#new_module_models.SequenceClassifierOutput_new)
* [.XVectorOutput](#module_models.XVectorOutput)
* [`new XVectorOutput(output)`](#new_module_models.XVectorOutput_new)
* [.TokenClassifierOutput](#module_models.TokenClassifierOutput)
* [`new TokenClassifierOutput(output)`](#new_module_models.TokenClassifierOutput_new)
* [.MaskedLMOutput](#module_models.MaskedLMOutput)
* [`new MaskedLMOutput(output)`](#new_module_models.MaskedLMOutput_new)
* [.QuestionAnsweringModelOutput](#module_models.QuestionAnsweringModelOutput)
* [`new QuestionAnsweringModelOutput(output)`](#new_module_models.QuestionAnsweringModelOutput_new)
* [.CausalLMOutput](#module_models.CausalLMOutput)
* [`new CausalLMOutput(output)`](#new_module_models.CausalLMOutput_new)
* [.CausalLMOutputWithPast](#module_models.CausalLMOutputWithPast)
* [`new CausalLMOutputWithPast(output)`](#new_module_models.CausalLMOutputWithPast_new)
* [.ImageMattingOutput](#module_models.ImageMattingOutput)
* [`new ImageMattingOutput(output)`](#new_module_models.ImageMattingOutput_new)
* [.VitsModelOutput](#module_models.VitsModelOutput)
* [`new VitsModelOutput(output)`](#new_module_models.VitsModelOutput_new)
* _inner_
* [`~cumsum_masked_fill(attention_mask)`](#module_models..cumsum_masked_fill) ⇒ <code>Object</code>
* [`~createPositionIds()`](#module_models..createPositionIds)
* [`~SamModelInputs`](#module_models..SamModelInputs) : <code>Object</code>
* [`~SpeechOutput`](#module_models..SpeechOutput) : <code>Object</code>
* * *
<a id="module_models.PreTrainedModel" class="group"></a>
## models.PreTrainedModel
A base class for pre-trained models that provides the model configuration and an ONNX session.
**Kind**: static class of [<code>models</code>](#module_models)
* [.PreTrainedModel](#module_models.PreTrainedModel)
* [`new PreTrainedModel(config, sessions, configs)`](#new_module_models.PreTrainedModel_new)
* _instance_
* [`.custom_config`](#module_models.PreTrainedModel+custom_config) : <code>*</code>
* [`.generation_config`](#module_models.PreTrainedModel+generation_config) ⇒ <code>GenerationConfig</code> | <code>null</code>
* [`.dispose()`](#module_models.PreTrainedModel+dispose) ⇒ <code>Promise.&lt;Array&lt;unknown&gt;&gt;</code>
* [`._call(model_inputs)`](#module_models.PreTrainedModel+_call) ⇒ <code>Promise.&lt;Object&gt;</code>
* [`.forward(model_inputs)`](#module_models.PreTrainedModel+forward) ⇒ <code>Promise.&lt;Object&gt;</code>
* [`._prepare_generation_config(generation_config, kwargs)`](#module_models.PreTrainedModel+_prepare_generation_config) ⇒ <code>GenerationConfig</code>
* [`._get_stopping_criteria(generation_config, [stopping_criteria])`](#module_models.PreTrainedModel+_get_stopping_criteria)
* [`._validate_model_class()`](#module_models.PreTrainedModel+_validate_model_class)
* [`._update_model_kwargs_for_generation(inputs)`](#module_models.PreTrainedModel+_update_model_kwargs_for_generation) ⇒ <code>Object</code>
* [`._prepare_model_inputs(params)`](#module_models.PreTrainedModel+_prepare_model_inputs) ⇒ <code>Object</code>
* [`._prepare_decoder_input_ids_for_generation(param0)`](#module_models.PreTrainedModel+_prepare_decoder_input_ids_for_generation)
* [`.generate(options)`](#module_models.PreTrainedModel+generate) ⇒ <code>Promise.&lt;(ModelOutput|Tensor)&gt;</code>
* [`.getPastKeyValues(decoderResults, pastKeyValues)`](#module_models.PreTrainedModel+getPastKeyValues) ⇒ <code>Object</code>
* [`.getAttentions(model_output)`](#module_models.PreTrainedModel+getAttentions) ⇒ <code>*</code>
* [`.addPastKeyValues(decoderFeeds, pastKeyValues)`](#module_models.PreTrainedModel+addPastKeyValues)
* _static_
* [`.from_pretrained(pretrained_model_name_or_path, options)`](#module_models.PreTrainedModel.from_pretrained) ⇒ <code>Promise.&lt;PreTrainedModel&gt;</code>
* * *
<a id="new_module_models.PreTrainedModel_new" class="group"></a>
### `new PreTrainedModel(config, sessions, configs)`
Creates a new instance of the `PreTrainedModel` class.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>config</td><td><code>*</code></td><td><p>The model configuration.</p>
</td>
</tr><tr>
<td>sessions</td><td><code>Record.&lt;string, any&gt;</code></td><td><p>The inference sessions for the model.</p>
</td>
</tr><tr>
<td>configs</td><td><code>Record.&lt;string, Object&gt;</code></td><td><p>Additional configuration files (e.g., generation_config.json).</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.PreTrainedModel+custom_config" class="group"></a>
### `preTrainedModel.custom_config` : <code>*</code>
**Kind**: instance property of [<code>PreTrainedModel</code>](#module_models.PreTrainedModel)
* * *
<a id="module_models.PreTrainedModel+generation_config" class="group"></a>
### `preTrainedModel.generation_config` ⇒ <code>GenerationConfig</code> | <code>null</code>
Get the model's generation config, if it exists.
**Kind**: instance property of [<code>PreTrainedModel</code>](#module_models.PreTrainedModel)
**Returns**: <code>GenerationConfig</code> | <code>null</code> - The model's generation config if it exists, otherwise `null`.
* * *
<a id="module_models.PreTrainedModel+dispose" class="group"></a>
### `preTrainedModel.dispose()` ⇒ <code>Promise.&lt;Array&lt;unknown&gt;&gt;</code>
Disposes of all the ONNX sessions that were created during inference.
**Kind**: instance method of [<code>PreTrainedModel</code>](#module_models.PreTrainedModel)
**Returns**: <code>Promise.&lt;Array&lt;unknown&gt;&gt;</code> - An array of promises, one for each ONNX session that is being disposed.
**Todo**
- Use https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry
* * *
<a id="module_models.PreTrainedModel+_call" class="group"></a>
### `preTrainedModel._call(model_inputs)` ⇒ <code>Promise.&lt;Object&gt;</code>
Runs the model with the provided inputs
**Kind**: instance method of [<code>PreTrainedModel</code>](#module_models.PreTrainedModel)
**Returns**: <code>Promise.&lt;Object&gt;</code> - Object containing output tensors
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>Object containing input tensors</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.PreTrainedModel+forward" class="group"></a>
### `preTrainedModel.forward(model_inputs)` ⇒ <code>Promise.&lt;Object&gt;</code>
Forward method for a pretrained model. If not overridden by a subclass, the correct forward method
will be chosen based on the model type.
**Kind**: instance method of [<code>PreTrainedModel</code>](#module_models.PreTrainedModel)
**Returns**: <code>Promise.&lt;Object&gt;</code> - The output data from the model in the format specified in the ONNX model.
**Throws**:
- <code>Error</code> This method must be implemented in subclasses.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The input data to the model in the format specified in the ONNX model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.PreTrainedModel+_prepare_generation_config" class="group"></a>
### `preTrainedModel._prepare_generation_config(generation_config, kwargs)` ⇒ <code>GenerationConfig</code>
This function merges multiple generation configs together to form a final generation config to be used by the model for text generation.
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.
**Kind**: instance method of [<code>PreTrainedModel</code>](#module_models.PreTrainedModel)
**Returns**: <code>GenerationConfig</code> - The final generation config object to be used by the model for text generation.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>generation_config</td><td><code>GenerationConfig</code> | <code>null</code></td><td><p>A <code>GenerationConfig</code> object containing generation parameters.</p>
</td>
</tr><tr>
<td>kwargs</td><td><code>Object</code></td><td><p>Additional generation parameters to be used in place of those in the <code>generation_config</code> object.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.PreTrainedModel+_get_stopping_criteria" class="group"></a>
### `preTrainedModel._get_stopping_criteria(generation_config, [stopping_criteria])`
**Kind**: instance method of [<code>PreTrainedModel</code>](#module_models.PreTrainedModel)
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Default</th>
</tr>
</thead>
<tbody>
<tr>
<td>generation_config</td><td><code>GenerationConfig</code></td><td></td>
</tr><tr>
<td>[stopping_criteria]</td><td><code>StoppingCriteriaList</code></td><td><code></code></td>
</tr> </tbody>
</table>
* * *
<a id="module_models.PreTrainedModel+_validate_model_class" class="group"></a>
### `preTrainedModel._validate_model_class()`
Confirms that the model class is compatible with generation.
If not, raises an exception that points to the right class to use.
**Kind**: instance method of [<code>PreTrainedModel</code>](#module_models.PreTrainedModel)
* * *
<a id="module_models.PreTrainedModel+_update_model_kwargs_for_generation" class="group"></a>
### `preTrainedModel._update_model_kwargs_for_generation(inputs)` ⇒ <code>Object</code>
**Kind**: instance method of [<code>PreTrainedModel</code>](#module_models.PreTrainedModel)
**Returns**: <code>Object</code> - The updated model inputs for the next generation iteration.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th>
</tr>
</thead>
<tbody>
<tr>
<td>inputs</td><td><code>Object</code></td>
</tr><tr>
<td>inputs.generated_input_ids</td><td><code>Array.&lt;Array&lt;bigint&gt;&gt;</code></td>
</tr><tr>
<td>inputs.outputs</td><td><code>Object</code></td>
</tr><tr>
<td>inputs.model_inputs</td><td><code>Object</code></td>
</tr><tr>
<td>inputs.is_encoder_decoder</td><td><code>boolean</code></td>
</tr> </tbody>
</table>
* * *
<a id="module_models.PreTrainedModel+_prepare_model_inputs" class="group"></a>
### `preTrainedModel._prepare_model_inputs(params)` ⇒ <code>Object</code>
This function extracts the model-specific `inputs` for generation.
**Kind**: instance method of [<code>PreTrainedModel</code>](#module_models.PreTrainedModel)
**Returns**: <code>Object</code> - The model-specific inputs for generation.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Default</th>
</tr>
</thead>
<tbody>
<tr>
<td>params</td><td><code>Object</code></td><td></td>
</tr><tr>
<td>[params.inputs]</td><td><code><a href="#Tensor">Tensor</a></code></td><td><code></code></td>
</tr><tr>
<td>[params.bos_token_id]</td><td><code>number</code></td><td><code></code></td>
</tr><tr>
<td>[params.model_kwargs]</td><td><code>Record.&lt;string, (Tensor|Array&lt;number&gt;)&gt;</code></td><td></td>
</tr> </tbody>
</table>
* * *
<a id="module_models.PreTrainedModel+_prepare_decoder_input_ids_for_generation" class="group"></a>
### `preTrainedModel._prepare_decoder_input_ids_for_generation(param0)`
Prepares `decoder_input_ids` for generation with encoder-decoder models
**Kind**: instance method of [<code>PreTrainedModel</code>](#module_models.PreTrainedModel)
<table>
<thead>
<tr>
<th>Param</th><th>Type</th>
</tr>
</thead>
<tbody>
<tr>
<td>param0</td><td><code>*</code></td>
</tr> </tbody>
</table>
* * *
<a id="module_models.PreTrainedModel+generate" class="group"></a>
### `preTrainedModel.generate(options)` ⇒ <code>Promise.&lt;(ModelOutput|Tensor)&gt;</code>
Generates sequences of token ids for models with a language modeling head.
**Kind**: instance method of [<code>PreTrainedModel</code>](#module_models.PreTrainedModel)
**Returns**: <code>Promise.&lt;(ModelOutput|Tensor)&gt;</code> - The output of the model, which can contain the generated token ids, attentions, and scores.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th>
</tr>
</thead>
<tbody>
<tr>
<td>options</td><td><code>*</code></td>
</tr> </tbody>
</table>
* * *
<a id="module_models.PreTrainedModel+getPastKeyValues" class="group"></a>
### `preTrainedModel.getPastKeyValues(decoderResults, pastKeyValues)` ⇒ <code>Object</code>
Returns an object containing past key values from the given decoder results object.
**Kind**: instance method of [<code>PreTrainedModel</code>](#module_models.PreTrainedModel)
**Returns**: <code>Object</code> - An object containing past key values.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>decoderResults</td><td><code>Object</code></td><td><p>The decoder results object.</p>
</td>
</tr><tr>
<td>pastKeyValues</td><td><code>Object</code></td><td><p>The previous past key values.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.PreTrainedModel+getAttentions" class="group"></a>
### `preTrainedModel.getAttentions(model_output)` ⇒ <code>*</code>
Returns an object containing attentions from the given model output object.
**Kind**: instance method of [<code>PreTrainedModel</code>](#module_models.PreTrainedModel)
**Returns**: <code>*</code> - An object containing attentions.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_output</td><td><code>Object</code></td><td><p>The output of the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.PreTrainedModel+addPastKeyValues" class="group"></a>
### `preTrainedModel.addPastKeyValues(decoderFeeds, pastKeyValues)`
Adds past key values to the decoder feeds object. If pastKeyValues is null, creates new tensors for past key values.
**Kind**: instance method of [<code>PreTrainedModel</code>](#module_models.PreTrainedModel)
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>decoderFeeds</td><td><code>Object</code></td><td><p>The decoder feeds object to add past key values to.</p>
</td>
</tr><tr>
<td>pastKeyValues</td><td><code>Object</code></td><td><p>An object containing past key values.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.PreTrainedModel.from_pretrained" class="group"></a>
### `PreTrainedModel.from_pretrained(pretrained_model_name_or_path, options)` ⇒ <code>Promise.&lt;PreTrainedModel&gt;</code>
Instantiate one of the model classes of the library from a pretrained model.
The model class to instantiate is selected based on the `model_type` property of the config object
(either passed as an argument or loaded from `pretrained_model_name_or_path` if possible)
**Kind**: static method of [<code>PreTrainedModel</code>](#module_models.PreTrainedModel)
**Returns**: <code>Promise.&lt;PreTrainedModel&gt;</code> - A new instance of the `PreTrainedModel` class.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>pretrained_model_name_or_path</td><td><code>string</code></td><td><p>The name or path of the pretrained model. Can be either:</p>
<ul>
<li>A string, the <em>model id</em> of a pretrained model hosted inside a model repo on huggingface.co.
Valid model ids can be located at the root-level, like <code>bert-base-uncased</code>, or namespaced under a
user or organization name, like <code>dbmdz/bert-base-german-cased</code>.</li>
<li>A path to a <em>directory</em> containing model weights, e.g., <code>./my_model_directory/</code>.</li>
</ul>
</td>
</tr><tr>
<td>options</td><td><code>*</code></td><td><p>Additional options for loading the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.BaseModelOutput" class="group"></a>
## models.BaseModelOutput
Base class for model's outputs, with potential hidden states and attentions.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="new_module_models.BaseModelOutput_new" class="group"></a>
### `new BaseModelOutput(output)`
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>output</td><td><code>Object</code></td><td><p>The output of the model.</p>
</td>
</tr><tr>
<td>output.last_hidden_state</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>Sequence of hidden-states at the output of the last layer of the model.</p>
</td>
</tr><tr>
<td>[output.hidden_states]</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</td>
</tr><tr>
<td>[output.attentions]</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention heads.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.BertForMaskedLM" class="group"></a>
## models.BertForMaskedLM
BertForMaskedLM is a class representing a BERT model for masked language modeling.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.BertForMaskedLM+_call" class="group"></a>
### `bertForMaskedLM._call(model_inputs)` ⇒ <code>Promise.&lt;MaskedLMOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>BertForMaskedLM</code>](#module_models.BertForMaskedLM)
**Returns**: <code>Promise.&lt;MaskedLMOutput&gt;</code> - An object containing the model's output logits for masked language modeling.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.BertForSequenceClassification" class="group"></a>
## models.BertForSequenceClassification
BertForSequenceClassification is a class representing a BERT model for sequence classification.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.BertForSequenceClassification+_call" class="group"></a>
### `bertForSequenceClassification._call(model_inputs)` ⇒ <code>Promise.&lt;SequenceClassifierOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>BertForSequenceClassification</code>](#module_models.BertForSequenceClassification)
**Returns**: <code>Promise.&lt;SequenceClassifierOutput&gt;</code> - An object containing the model's output logits for sequence classification.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.BertForTokenClassification" class="group"></a>
## models.BertForTokenClassification
BertForTokenClassification is a class representing a BERT model for token classification.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.BertForTokenClassification+_call" class="group"></a>
### `bertForTokenClassification._call(model_inputs)` ⇒ <code>Promise.&lt;TokenClassifierOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>BertForTokenClassification</code>](#module_models.BertForTokenClassification)
**Returns**: <code>Promise.&lt;TokenClassifierOutput&gt;</code> - An object containing the model's output logits for token classification.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.BertForQuestionAnswering" class="group"></a>
## models.BertForQuestionAnswering
BertForQuestionAnswering is a class representing a BERT model for question answering.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.BertForQuestionAnswering+_call" class="group"></a>
### `bertForQuestionAnswering._call(model_inputs)` ⇒ <code>Promise.&lt;QuestionAnsweringModelOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>BertForQuestionAnswering</code>](#module_models.BertForQuestionAnswering)
**Returns**: <code>Promise.&lt;QuestionAnsweringModelOutput&gt;</code> - An object containing the model's output logits for question answering.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.RoFormerModel" class="group"></a>
## models.RoFormerModel
The bare RoFormer Model transformer outputting raw hidden-states without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.RoFormerForMaskedLM" class="group"></a>
## models.RoFormerForMaskedLM
RoFormer Model with a `language modeling` head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.RoFormerForMaskedLM+_call" class="group"></a>
### `roFormerForMaskedLM._call(model_inputs)` ⇒ <code>Promise.&lt;MaskedLMOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>RoFormerForMaskedLM</code>](#module_models.RoFormerForMaskedLM)
**Returns**: <code>Promise.&lt;MaskedLMOutput&gt;</code> - An object containing the model's output logits for masked language modeling.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.RoFormerForSequenceClassification" class="group"></a>
## models.RoFormerForSequenceClassification
RoFormer Model transformer with a sequence classification/regression head on top (a linear layer on top of the pooled output)
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.RoFormerForSequenceClassification+_call" class="group"></a>
### `roFormerForSequenceClassification._call(model_inputs)` ⇒ <code>Promise.&lt;SequenceClassifierOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>RoFormerForSequenceClassification</code>](#module_models.RoFormerForSequenceClassification)
**Returns**: <code>Promise.&lt;SequenceClassifierOutput&gt;</code> - An object containing the model's output logits for sequence classification.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.RoFormerForTokenClassification" class="group"></a>
## models.RoFormerForTokenClassification
RoFormer 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.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.RoFormerForTokenClassification+_call" class="group"></a>
### `roFormerForTokenClassification._call(model_inputs)` ⇒ <code>Promise.&lt;TokenClassifierOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>RoFormerForTokenClassification</code>](#module_models.RoFormerForTokenClassification)
**Returns**: <code>Promise.&lt;TokenClassifierOutput&gt;</code> - An object containing the model's output logits for token classification.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.RoFormerForQuestionAnswering" class="group"></a>
## models.RoFormerForQuestionAnswering
RoFormer Model with a span classification head on top for extractive question-answering tasks like SQuAD
(a linear layers on top of the hidden-states output to compute `span start logits` and `span end logits`).
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.RoFormerForQuestionAnswering+_call" class="group"></a>
### `roFormerForQuestionAnswering._call(model_inputs)` ⇒ <code>Promise.&lt;QuestionAnsweringModelOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>RoFormerForQuestionAnswering</code>](#module_models.RoFormerForQuestionAnswering)
**Returns**: <code>Promise.&lt;QuestionAnsweringModelOutput&gt;</code> - An object containing the model's output logits for question answering.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.ConvBertModel" class="group"></a>
## models.ConvBertModel
The bare ConvBERT Model transformer outputting raw hidden-states without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.ConvBertForMaskedLM" class="group"></a>
## models.ConvBertForMaskedLM
ConvBERT Model with a language modeling head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.ConvBertForMaskedLM+_call" class="group"></a>
### `convBertForMaskedLM._call(model_inputs)` ⇒ <code>Promise.&lt;MaskedLMOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>ConvBertForMaskedLM</code>](#module_models.ConvBertForMaskedLM)
**Returns**: <code>Promise.&lt;MaskedLMOutput&gt;</code> - An object containing the model's output logits for masked language modeling.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.ConvBertForSequenceClassification" class="group"></a>
## models.ConvBertForSequenceClassification
ConvBERT Model transformer with a sequence classification/regression head on top (a linear layer on top of the pooled output)
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.ConvBertForSequenceClassification+_call" class="group"></a>
### `convBertForSequenceClassification._call(model_inputs)` ⇒ <code>Promise.&lt;SequenceClassifierOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>ConvBertForSequenceClassification</code>](#module_models.ConvBertForSequenceClassification)
**Returns**: <code>Promise.&lt;SequenceClassifierOutput&gt;</code> - An object containing the model's output logits for sequence classification.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.ConvBertForTokenClassification" class="group"></a>
## models.ConvBertForTokenClassification
ConvBERT 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.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.ConvBertForTokenClassification+_call" class="group"></a>
### `convBertForTokenClassification._call(model_inputs)` ⇒ <code>Promise.&lt;TokenClassifierOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>ConvBertForTokenClassification</code>](#module_models.ConvBertForTokenClassification)
**Returns**: <code>Promise.&lt;TokenClassifierOutput&gt;</code> - An object containing the model's output logits for token classification.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.ConvBertForQuestionAnswering" class="group"></a>
## models.ConvBertForQuestionAnswering
ConvBERT Model with a span classification head on top for extractive question-answering tasks like SQuAD
(a linear layers on top of the hidden-states output to compute `span start logits` and `span end logits`)
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.ConvBertForQuestionAnswering+_call" class="group"></a>
### `convBertForQuestionAnswering._call(model_inputs)` ⇒ <code>Promise.&lt;QuestionAnsweringModelOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>ConvBertForQuestionAnswering</code>](#module_models.ConvBertForQuestionAnswering)
**Returns**: <code>Promise.&lt;QuestionAnsweringModelOutput&gt;</code> - An object containing the model's output logits for question answering.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.ElectraModel" class="group"></a>
## models.ElectraModel
The bare Electra Model transformer outputting raw hidden-states without any specific head on top.
Identical to the BERT model except that it uses an additional linear layer between the embedding
layer and the encoder if the hidden size and embedding size are different.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.ElectraForMaskedLM" class="group"></a>
## models.ElectraForMaskedLM
Electra model with a language modeling head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.ElectraForMaskedLM+_call" class="group"></a>
### `electraForMaskedLM._call(model_inputs)` ⇒ <code>Promise.&lt;MaskedLMOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>ElectraForMaskedLM</code>](#module_models.ElectraForMaskedLM)
**Returns**: <code>Promise.&lt;MaskedLMOutput&gt;</code> - An object containing the model's output logits for masked language modeling.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.ElectraForSequenceClassification" class="group"></a>
## models.ElectraForSequenceClassification
ELECTRA Model transformer with a sequence classification/regression head on top (a linear layer on top of the pooled output)
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.ElectraForSequenceClassification+_call" class="group"></a>
### `electraForSequenceClassification._call(model_inputs)` ⇒ <code>Promise.&lt;SequenceClassifierOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>ElectraForSequenceClassification</code>](#module_models.ElectraForSequenceClassification)
**Returns**: <code>Promise.&lt;SequenceClassifierOutput&gt;</code> - An object containing the model's output logits for sequence classification.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.ElectraForTokenClassification" class="group"></a>
## models.ElectraForTokenClassification
Electra model with a token classification head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.ElectraForTokenClassification+_call" class="group"></a>
### `electraForTokenClassification._call(model_inputs)` ⇒ <code>Promise.&lt;TokenClassifierOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>ElectraForTokenClassification</code>](#module_models.ElectraForTokenClassification)
**Returns**: <code>Promise.&lt;TokenClassifierOutput&gt;</code> - An object containing the model's output logits for token classification.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.ElectraForQuestionAnswering" class="group"></a>
## models.ElectraForQuestionAnswering
LECTRA Model with a span classification head on top for extractive question-answering tasks like SQuAD
(a linear layers on top of the hidden-states output to compute `span start logits` and `span end logits`).
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.ElectraForQuestionAnswering+_call" class="group"></a>
### `electraForQuestionAnswering._call(model_inputs)` ⇒ <code>Promise.&lt;QuestionAnsweringModelOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>ElectraForQuestionAnswering</code>](#module_models.ElectraForQuestionAnswering)
**Returns**: <code>Promise.&lt;QuestionAnsweringModelOutput&gt;</code> - An object containing the model's output logits for question answering.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.CamembertModel" class="group"></a>
## models.CamembertModel
The bare CamemBERT Model transformer outputting raw hidden-states without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.CamembertForMaskedLM" class="group"></a>
## models.CamembertForMaskedLM
CamemBERT Model with a `language modeling` head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.CamembertForMaskedLM+_call" class="group"></a>
### `camembertForMaskedLM._call(model_inputs)` ⇒ <code>Promise.&lt;MaskedLMOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>CamembertForMaskedLM</code>](#module_models.CamembertForMaskedLM)
**Returns**: <code>Promise.&lt;MaskedLMOutput&gt;</code> - An object containing the model's output logits for masked language modeling.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.CamembertForSequenceClassification" class="group"></a>
## models.CamembertForSequenceClassification
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.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.CamembertForSequenceClassification+_call" class="group"></a>
### `camembertForSequenceClassification._call(model_inputs)` ⇒ <code>Promise.&lt;SequenceClassifierOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>CamembertForSequenceClassification</code>](#module_models.CamembertForSequenceClassification)
**Returns**: <code>Promise.&lt;SequenceClassifierOutput&gt;</code> - An object containing the model's output logits for sequence classification.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.CamembertForTokenClassification" class="group"></a>
## models.CamembertForTokenClassification
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.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.CamembertForTokenClassification+_call" class="group"></a>
### `camembertForTokenClassification._call(model_inputs)` ⇒ <code>Promise.&lt;TokenClassifierOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>CamembertForTokenClassification</code>](#module_models.CamembertForTokenClassification)
**Returns**: <code>Promise.&lt;TokenClassifierOutput&gt;</code> - An object containing the model's output logits for token classification.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.CamembertForQuestionAnswering" class="group"></a>
## models.CamembertForQuestionAnswering
CamemBERT Model with a span classification head on top for extractive question-answering tasks
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.CamembertForQuestionAnswering+_call" class="group"></a>
### `camembertForQuestionAnswering._call(model_inputs)` ⇒ <code>Promise.&lt;QuestionAnsweringModelOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>CamembertForQuestionAnswering</code>](#module_models.CamembertForQuestionAnswering)
**Returns**: <code>Promise.&lt;QuestionAnsweringModelOutput&gt;</code> - An object containing the model's output logits for question answering.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.DebertaModel" class="group"></a>
## models.DebertaModel
The bare DeBERTa Model transformer outputting raw hidden-states without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.DebertaForMaskedLM" class="group"></a>
## models.DebertaForMaskedLM
DeBERTa Model with a `language modeling` head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.DebertaForMaskedLM+_call" class="group"></a>
### `debertaForMaskedLM._call(model_inputs)` ⇒ <code>Promise.&lt;MaskedLMOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>DebertaForMaskedLM</code>](#module_models.DebertaForMaskedLM)
**Returns**: <code>Promise.&lt;MaskedLMOutput&gt;</code> - An object containing the model's output logits for masked language modeling.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.DebertaForSequenceClassification" class="group"></a>
## models.DebertaForSequenceClassification
DeBERTa Model transformer with a sequence classification/regression head on top (a linear layer on top of the pooled output)
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.DebertaForSequenceClassification+_call" class="group"></a>
### `debertaForSequenceClassification._call(model_inputs)` ⇒ <code>Promise.&lt;SequenceClassifierOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>DebertaForSequenceClassification</code>](#module_models.DebertaForSequenceClassification)
**Returns**: <code>Promise.&lt;SequenceClassifierOutput&gt;</code> - An object containing the model's output logits for sequence classification.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.DebertaForTokenClassification" class="group"></a>
## models.DebertaForTokenClassification
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.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.DebertaForTokenClassification+_call" class="group"></a>
### `debertaForTokenClassification._call(model_inputs)` ⇒ <code>Promise.&lt;TokenClassifierOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>DebertaForTokenClassification</code>](#module_models.DebertaForTokenClassification)
**Returns**: <code>Promise.&lt;TokenClassifierOutput&gt;</code> - An object containing the model's output logits for token classification.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.DebertaForQuestionAnswering" class="group"></a>
## models.DebertaForQuestionAnswering
DeBERTa Model with a span classification head on top for extractive question-answering tasks like SQuAD (a linear
layers on top of the hidden-states output to compute `span start logits` and `span end logits`).
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.DebertaForQuestionAnswering+_call" class="group"></a>
### `debertaForQuestionAnswering._call(model_inputs)` ⇒ <code>Promise.&lt;QuestionAnsweringModelOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>DebertaForQuestionAnswering</code>](#module_models.DebertaForQuestionAnswering)
**Returns**: <code>Promise.&lt;QuestionAnsweringModelOutput&gt;</code> - An object containing the model's output logits for question answering.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.DebertaV2Model" class="group"></a>
## models.DebertaV2Model
The bare DeBERTa-V2 Model transformer outputting raw hidden-states without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.DebertaV2ForMaskedLM" class="group"></a>
## models.DebertaV2ForMaskedLM
DeBERTa-V2 Model with a `language modeling` head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.DebertaV2ForMaskedLM+_call" class="group"></a>
### `debertaV2ForMaskedLM._call(model_inputs)` ⇒ <code>Promise.&lt;MaskedLMOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>DebertaV2ForMaskedLM</code>](#module_models.DebertaV2ForMaskedLM)
**Returns**: <code>Promise.&lt;MaskedLMOutput&gt;</code> - An object containing the model's output logits for masked language modeling.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.DebertaV2ForSequenceClassification" class="group"></a>
## models.DebertaV2ForSequenceClassification
DeBERTa-V2 Model transformer with a sequence classification/regression head on top (a linear layer on top of the pooled output)
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.DebertaV2ForSequenceClassification+_call" class="group"></a>
### `debertaV2ForSequenceClassification._call(model_inputs)` ⇒ <code>Promise.&lt;SequenceClassifierOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>DebertaV2ForSequenceClassification</code>](#module_models.DebertaV2ForSequenceClassification)
**Returns**: <code>Promise.&lt;SequenceClassifierOutput&gt;</code> - An object containing the model's output logits for sequence classification.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.DebertaV2ForTokenClassification" class="group"></a>
## models.DebertaV2ForTokenClassification
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.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.DebertaV2ForTokenClassification+_call" class="group"></a>
### `debertaV2ForTokenClassification._call(model_inputs)` ⇒ <code>Promise.&lt;TokenClassifierOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>DebertaV2ForTokenClassification</code>](#module_models.DebertaV2ForTokenClassification)
**Returns**: <code>Promise.&lt;TokenClassifierOutput&gt;</code> - An object containing the model's output logits for token classification.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.DebertaV2ForQuestionAnswering" class="group"></a>
## models.DebertaV2ForQuestionAnswering
DeBERTa-V2 Model with a span classification head on top for extractive question-answering tasks like SQuAD (a linear
layers on top of the hidden-states output to compute `span start logits` and `span end logits`).
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.DebertaV2ForQuestionAnswering+_call" class="group"></a>
### `debertaV2ForQuestionAnswering._call(model_inputs)` ⇒ <code>Promise.&lt;QuestionAnsweringModelOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>DebertaV2ForQuestionAnswering</code>](#module_models.DebertaV2ForQuestionAnswering)
**Returns**: <code>Promise.&lt;QuestionAnsweringModelOutput&gt;</code> - An object containing the model's output logits for question answering.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.DistilBertForSequenceClassification" class="group"></a>
## models.DistilBertForSequenceClassification
DistilBertForSequenceClassification is a class representing a DistilBERT model for sequence classification.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.DistilBertForSequenceClassification+_call" class="group"></a>
### `distilBertForSequenceClassification._call(model_inputs)` ⇒ <code>Promise.&lt;SequenceClassifierOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>DistilBertForSequenceClassification</code>](#module_models.DistilBertForSequenceClassification)
**Returns**: <code>Promise.&lt;SequenceClassifierOutput&gt;</code> - An object containing the model's output logits for sequence classification.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.DistilBertForTokenClassification" class="group"></a>
## models.DistilBertForTokenClassification
DistilBertForTokenClassification is a class representing a DistilBERT model for token classification.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.DistilBertForTokenClassification+_call" class="group"></a>
### `distilBertForTokenClassification._call(model_inputs)` ⇒ <code>Promise.&lt;TokenClassifierOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>DistilBertForTokenClassification</code>](#module_models.DistilBertForTokenClassification)
**Returns**: <code>Promise.&lt;TokenClassifierOutput&gt;</code> - An object containing the model's output logits for token classification.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.DistilBertForQuestionAnswering" class="group"></a>
## models.DistilBertForQuestionAnswering
DistilBertForQuestionAnswering is a class representing a DistilBERT model for question answering.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.DistilBertForQuestionAnswering+_call" class="group"></a>
### `distilBertForQuestionAnswering._call(model_inputs)` ⇒ <code>Promise.&lt;QuestionAnsweringModelOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>DistilBertForQuestionAnswering</code>](#module_models.DistilBertForQuestionAnswering)
**Returns**: <code>Promise.&lt;QuestionAnsweringModelOutput&gt;</code> - An object containing the model's output logits for question answering.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.DistilBertForMaskedLM" class="group"></a>
## models.DistilBertForMaskedLM
DistilBertForMaskedLM is a class representing a DistilBERT model for masking task.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.DistilBertForMaskedLM+_call" class="group"></a>
### `distilBertForMaskedLM._call(model_inputs)` ⇒ <code>Promise.&lt;MaskedLMOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>DistilBertForMaskedLM</code>](#module_models.DistilBertForMaskedLM)
**Returns**: <code>Promise.&lt;MaskedLMOutput&gt;</code> - returned object
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.EsmModel" class="group"></a>
## models.EsmModel
The bare ESM Model transformer outputting raw hidden-states without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.EsmForMaskedLM" class="group"></a>
## models.EsmForMaskedLM
ESM Model with a `language modeling` head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.EsmForMaskedLM+_call" class="group"></a>
### `esmForMaskedLM._call(model_inputs)` ⇒ <code>Promise.&lt;MaskedLMOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>EsmForMaskedLM</code>](#module_models.EsmForMaskedLM)
**Returns**: <code>Promise.&lt;MaskedLMOutput&gt;</code> - An object containing the model's output logits for masked language modeling.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.EsmForSequenceClassification" class="group"></a>
## models.EsmForSequenceClassification
ESM Model transformer with a sequence classification/regression head on top (a linear layer on top of the pooled output)
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.EsmForSequenceClassification+_call" class="group"></a>
### `esmForSequenceClassification._call(model_inputs)` ⇒ <code>Promise.&lt;SequenceClassifierOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>EsmForSequenceClassification</code>](#module_models.EsmForSequenceClassification)
**Returns**: <code>Promise.&lt;SequenceClassifierOutput&gt;</code> - An object containing the model's output logits for sequence classification.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.EsmForTokenClassification" class="group"></a>
## models.EsmForTokenClassification
ESM 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.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.EsmForTokenClassification+_call" class="group"></a>
### `esmForTokenClassification._call(model_inputs)` ⇒ <code>Promise.&lt;TokenClassifierOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>EsmForTokenClassification</code>](#module_models.EsmForTokenClassification)
**Returns**: <code>Promise.&lt;TokenClassifierOutput&gt;</code> - An object containing the model's output logits for token classification.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.MobileBertForMaskedLM" class="group"></a>
## models.MobileBertForMaskedLM
MobileBertForMaskedLM is a class representing a MobileBERT model for masking task.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.MobileBertForMaskedLM+_call" class="group"></a>
### `mobileBertForMaskedLM._call(model_inputs)` ⇒ <code>Promise.&lt;MaskedLMOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>MobileBertForMaskedLM</code>](#module_models.MobileBertForMaskedLM)
**Returns**: <code>Promise.&lt;MaskedLMOutput&gt;</code> - returned object
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.MobileBertForSequenceClassification" class="group"></a>
## models.MobileBertForSequenceClassification
MobileBert Model transformer with a sequence classification/regression head on top (a linear layer on top of the pooled output)
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.MobileBertForSequenceClassification+_call" class="group"></a>
### `mobileBertForSequenceClassification._call(model_inputs)` ⇒ <code>Promise.&lt;SequenceClassifierOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>MobileBertForSequenceClassification</code>](#module_models.MobileBertForSequenceClassification)
**Returns**: <code>Promise.&lt;SequenceClassifierOutput&gt;</code> - returned object
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.MobileBertForQuestionAnswering" class="group"></a>
## models.MobileBertForQuestionAnswering
MobileBert Model with a span classification head on top for extractive question-answering tasks
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.MobileBertForQuestionAnswering+_call" class="group"></a>
### `mobileBertForQuestionAnswering._call(model_inputs)` ⇒ <code>Promise.&lt;QuestionAnsweringModelOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>MobileBertForQuestionAnswering</code>](#module_models.MobileBertForQuestionAnswering)
**Returns**: <code>Promise.&lt;QuestionAnsweringModelOutput&gt;</code> - returned object
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.MPNetModel" class="group"></a>
## models.MPNetModel
The bare MPNet Model transformer outputting raw hidden-states without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.MPNetForMaskedLM" class="group"></a>
## models.MPNetForMaskedLM
MPNetForMaskedLM is a class representing a MPNet model for masked language modeling.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.MPNetForMaskedLM+_call" class="group"></a>
### `mpNetForMaskedLM._call(model_inputs)` ⇒ <code>Promise.&lt;MaskedLMOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>MPNetForMaskedLM</code>](#module_models.MPNetForMaskedLM)
**Returns**: <code>Promise.&lt;MaskedLMOutput&gt;</code> - An object containing the model's output logits for masked language modeling.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.MPNetForSequenceClassification" class="group"></a>
## models.MPNetForSequenceClassification
MPNetForSequenceClassification is a class representing a MPNet model for sequence classification.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.MPNetForSequenceClassification+_call" class="group"></a>
### `mpNetForSequenceClassification._call(model_inputs)` ⇒ <code>Promise.&lt;SequenceClassifierOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>MPNetForSequenceClassification</code>](#module_models.MPNetForSequenceClassification)
**Returns**: <code>Promise.&lt;SequenceClassifierOutput&gt;</code> - An object containing the model's output logits for sequence classification.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.MPNetForTokenClassification" class="group"></a>
## models.MPNetForTokenClassification
MPNetForTokenClassification is a class representing a MPNet model for token classification.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.MPNetForTokenClassification+_call" class="group"></a>
### `mpNetForTokenClassification._call(model_inputs)` ⇒ <code>Promise.&lt;TokenClassifierOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>MPNetForTokenClassification</code>](#module_models.MPNetForTokenClassification)
**Returns**: <code>Promise.&lt;TokenClassifierOutput&gt;</code> - An object containing the model's output logits for token classification.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.MPNetForQuestionAnswering" class="group"></a>
## models.MPNetForQuestionAnswering
MPNetForQuestionAnswering is a class representing a MPNet model for question answering.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.MPNetForQuestionAnswering+_call" class="group"></a>
### `mpNetForQuestionAnswering._call(model_inputs)` ⇒ <code>Promise.&lt;QuestionAnsweringModelOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>MPNetForQuestionAnswering</code>](#module_models.MPNetForQuestionAnswering)
**Returns**: <code>Promise.&lt;QuestionAnsweringModelOutput&gt;</code> - An object containing the model's output logits for question answering.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.T5ForConditionalGeneration" class="group"></a>
## models.T5ForConditionalGeneration
T5Model is a class representing a T5 model for conditional generation.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.LongT5PreTrainedModel" class="group"></a>
## models.LongT5PreTrainedModel
An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained models.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.LongT5Model" class="group"></a>
## models.LongT5Model
The bare LONGT5 Model transformer outputting raw hidden-states without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.LongT5ForConditionalGeneration" class="group"></a>
## models.LongT5ForConditionalGeneration
LONGT5 Model with a `language modeling` head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.MT5ForConditionalGeneration" class="group"></a>
## models.MT5ForConditionalGeneration
A class representing a conditional sequence-to-sequence model based on the MT5 architecture.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.BartModel" class="group"></a>
## models.BartModel
The bare BART Model outputting raw hidden-states without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.BartForConditionalGeneration" class="group"></a>
## models.BartForConditionalGeneration
The BART Model with a language modeling head. Can be used for summarization.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.BartForSequenceClassification" class="group"></a>
## models.BartForSequenceClassification
Bart model with a sequence classification/head on top (a linear layer on top of the pooled output)
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.BartForSequenceClassification+_call" class="group"></a>
### `bartForSequenceClassification._call(model_inputs)` ⇒ <code>Promise.&lt;SequenceClassifierOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>BartForSequenceClassification</code>](#module_models.BartForSequenceClassification)
**Returns**: <code>Promise.&lt;SequenceClassifierOutput&gt;</code> - An object containing the model's output logits for sequence classification.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.MBartModel" class="group"></a>
## models.MBartModel
The bare MBART Model outputting raw hidden-states without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.MBartForConditionalGeneration" class="group"></a>
## models.MBartForConditionalGeneration
The MBART Model with a language modeling head. Can be used for summarization, after fine-tuning the pretrained models.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.MBartForSequenceClassification" class="group"></a>
## models.MBartForSequenceClassification
MBart model with a sequence classification/head on top (a linear layer on top of the pooled output).
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.MBartForSequenceClassification+_call" class="group"></a>
### `mBartForSequenceClassification._call(model_inputs)` ⇒ <code>Promise.&lt;SequenceClassifierOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>MBartForSequenceClassification</code>](#module_models.MBartForSequenceClassification)
**Returns**: <code>Promise.&lt;SequenceClassifierOutput&gt;</code> - An object containing the model's output logits for sequence classification.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.BlenderbotModel" class="group"></a>
## models.BlenderbotModel
The bare Blenderbot Model outputting raw hidden-states without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.BlenderbotForConditionalGeneration" class="group"></a>
## models.BlenderbotForConditionalGeneration
The Blenderbot Model with a language modeling head. Can be used for summarization.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.BlenderbotSmallModel" class="group"></a>
## models.BlenderbotSmallModel
The bare BlenderbotSmall Model outputting raw hidden-states without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.BlenderbotSmallForConditionalGeneration" class="group"></a>
## models.BlenderbotSmallForConditionalGeneration
The BlenderbotSmall Model with a language modeling head. Can be used for summarization.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.RobertaForMaskedLM" class="group"></a>
## models.RobertaForMaskedLM
RobertaForMaskedLM class for performing masked language modeling on Roberta models.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.RobertaForMaskedLM+_call" class="group"></a>
### `robertaForMaskedLM._call(model_inputs)` ⇒ <code>Promise.&lt;MaskedLMOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>RobertaForMaskedLM</code>](#module_models.RobertaForMaskedLM)
**Returns**: <code>Promise.&lt;MaskedLMOutput&gt;</code> - returned object
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.RobertaForSequenceClassification" class="group"></a>
## models.RobertaForSequenceClassification
RobertaForSequenceClassification class for performing sequence classification on Roberta models.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.RobertaForSequenceClassification+_call" class="group"></a>
### `robertaForSequenceClassification._call(model_inputs)` ⇒ <code>Promise.&lt;SequenceClassifierOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>RobertaForSequenceClassification</code>](#module_models.RobertaForSequenceClassification)
**Returns**: <code>Promise.&lt;SequenceClassifierOutput&gt;</code> - returned object
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.RobertaForTokenClassification" class="group"></a>
## models.RobertaForTokenClassification
RobertaForTokenClassification class for performing token classification on Roberta models.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.RobertaForTokenClassification+_call" class="group"></a>
### `robertaForTokenClassification._call(model_inputs)` ⇒ <code>Promise.&lt;TokenClassifierOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>RobertaForTokenClassification</code>](#module_models.RobertaForTokenClassification)
**Returns**: <code>Promise.&lt;TokenClassifierOutput&gt;</code> - An object containing the model's output logits for token classification.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.RobertaForQuestionAnswering" class="group"></a>
## models.RobertaForQuestionAnswering
RobertaForQuestionAnswering class for performing question answering on Roberta models.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.RobertaForQuestionAnswering+_call" class="group"></a>
### `robertaForQuestionAnswering._call(model_inputs)` ⇒ <code>Promise.&lt;QuestionAnsweringModelOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>RobertaForQuestionAnswering</code>](#module_models.RobertaForQuestionAnswering)
**Returns**: <code>Promise.&lt;QuestionAnsweringModelOutput&gt;</code> - returned object
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.XLMPreTrainedModel" class="group"></a>
## models.XLMPreTrainedModel
An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained models.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.XLMModel" class="group"></a>
## models.XLMModel
The bare XLM Model transformer outputting raw hidden-states without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.XLMWithLMHeadModel" class="group"></a>
## models.XLMWithLMHeadModel
The XLM Model transformer with a language modeling head on top (linear layer with weights tied to the input embeddings).
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.XLMWithLMHeadModel+_call" class="group"></a>
### `xlmWithLMHeadModel._call(model_inputs)` ⇒ <code>Promise.&lt;MaskedLMOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>XLMWithLMHeadModel</code>](#module_models.XLMWithLMHeadModel)
**Returns**: <code>Promise.&lt;MaskedLMOutput&gt;</code> - returned object
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.XLMForSequenceClassification" class="group"></a>
## models.XLMForSequenceClassification
XLM Model with a sequence classification/regression head on top (a linear layer on top of the pooled output)
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.XLMForSequenceClassification+_call" class="group"></a>
### `xlmForSequenceClassification._call(model_inputs)` ⇒ <code>Promise.&lt;SequenceClassifierOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>XLMForSequenceClassification</code>](#module_models.XLMForSequenceClassification)
**Returns**: <code>Promise.&lt;SequenceClassifierOutput&gt;</code> - returned object
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.XLMForTokenClassification" class="group"></a>
## models.XLMForTokenClassification
XLM Model with a token classification head on top (a linear layer on top of the hidden-states output)
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.XLMForTokenClassification+_call" class="group"></a>
### `xlmForTokenClassification._call(model_inputs)` ⇒ <code>Promise.&lt;TokenClassifierOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>XLMForTokenClassification</code>](#module_models.XLMForTokenClassification)
**Returns**: <code>Promise.&lt;TokenClassifierOutput&gt;</code> - An object containing the model's output logits for token classification.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.XLMForQuestionAnswering" class="group"></a>
## models.XLMForQuestionAnswering
XLM Model with a span classification head on top for extractive question-answering tasks
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.XLMForQuestionAnswering+_call" class="group"></a>
### `xlmForQuestionAnswering._call(model_inputs)` ⇒ <code>Promise.&lt;QuestionAnsweringModelOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>XLMForQuestionAnswering</code>](#module_models.XLMForQuestionAnswering)
**Returns**: <code>Promise.&lt;QuestionAnsweringModelOutput&gt;</code> - returned object
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.XLMRobertaForMaskedLM" class="group"></a>
## models.XLMRobertaForMaskedLM
XLMRobertaForMaskedLM class for performing masked language modeling on XLMRoberta models.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.XLMRobertaForMaskedLM+_call" class="group"></a>
### `xlmRobertaForMaskedLM._call(model_inputs)` ⇒ <code>Promise.&lt;MaskedLMOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>XLMRobertaForMaskedLM</code>](#module_models.XLMRobertaForMaskedLM)
**Returns**: <code>Promise.&lt;MaskedLMOutput&gt;</code> - returned object
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.XLMRobertaForSequenceClassification" class="group"></a>
## models.XLMRobertaForSequenceClassification
XLMRobertaForSequenceClassification class for performing sequence classification on XLMRoberta models.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.XLMRobertaForSequenceClassification+_call" class="group"></a>
### `xlmRobertaForSequenceClassification._call(model_inputs)` ⇒ <code>Promise.&lt;SequenceClassifierOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>XLMRobertaForSequenceClassification</code>](#module_models.XLMRobertaForSequenceClassification)
**Returns**: <code>Promise.&lt;SequenceClassifierOutput&gt;</code> - returned object
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.XLMRobertaForTokenClassification" class="group"></a>
## models.XLMRobertaForTokenClassification
XLMRobertaForTokenClassification class for performing token classification on XLMRoberta models.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.XLMRobertaForTokenClassification+_call" class="group"></a>
### `xlmRobertaForTokenClassification._call(model_inputs)` ⇒ <code>Promise.&lt;TokenClassifierOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>XLMRobertaForTokenClassification</code>](#module_models.XLMRobertaForTokenClassification)
**Returns**: <code>Promise.&lt;TokenClassifierOutput&gt;</code> - An object containing the model's output logits for token classification.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.XLMRobertaForQuestionAnswering" class="group"></a>
## models.XLMRobertaForQuestionAnswering
XLMRobertaForQuestionAnswering class for performing question answering on XLMRoberta models.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.XLMRobertaForQuestionAnswering+_call" class="group"></a>
### `xlmRobertaForQuestionAnswering._call(model_inputs)` ⇒ <code>Promise.&lt;QuestionAnsweringModelOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>XLMRobertaForQuestionAnswering</code>](#module_models.XLMRobertaForQuestionAnswering)
**Returns**: <code>Promise.&lt;QuestionAnsweringModelOutput&gt;</code> - returned object
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.ASTModel" class="group"></a>
## models.ASTModel
The bare AST Model transformer outputting raw hidden-states without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.ASTForAudioClassification" class="group"></a>
## models.ASTForAudioClassification
Audio Spectrogram Transformer model with an audio classification head on top
(a linear layer on top of the pooled output) e.g. for datasets like AudioSet, Speech Commands v2.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.WhisperModel" class="group"></a>
## models.WhisperModel
WhisperModel class for training Whisper models without a language model head.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.WhisperForConditionalGeneration" class="group"></a>
## models.WhisperForConditionalGeneration
WhisperForConditionalGeneration class for generating conditional outputs from Whisper models.
**Kind**: static class of [<code>models</code>](#module_models)
* [.WhisperForConditionalGeneration](#module_models.WhisperForConditionalGeneration)
* [`._retrieve_init_tokens(generation_config)`](#module_models.WhisperForConditionalGeneration+_retrieve_init_tokens)
* [`.generate(options)`](#module_models.WhisperForConditionalGeneration+generate) ⇒ <code>Promise.&lt;(ModelOutput|Tensor)&gt;</code>
* [`._extract_token_timestamps(generate_outputs, alignment_heads, [num_frames], [time_precision])`](#module_models.WhisperForConditionalGeneration+_extract_token_timestamps) ⇒ [<code>Tensor</code>](#Tensor)
* * *
<a id="module_models.WhisperForConditionalGeneration+_retrieve_init_tokens" class="group"></a>
### `whisperForConditionalGeneration._retrieve_init_tokens(generation_config)`
**Kind**: instance method of [<code>WhisperForConditionalGeneration</code>](#module_models.WhisperForConditionalGeneration)
<table>
<thead>
<tr>
<th>Param</th><th>Type</th>
</tr>
</thead>
<tbody>
<tr>
<td>generation_config</td><td><code>WhisperGenerationConfig</code></td>
</tr> </tbody>
</table>
* * *
<a id="module_models.WhisperForConditionalGeneration+generate" class="group"></a>
### `whisperForConditionalGeneration.generate(options)` ⇒ <code>Promise.&lt;(ModelOutput|Tensor)&gt;</code>
Transcribes or translates log-mel input features to a sequence of auto-regressively generated token ids.
**Kind**: instance method of [<code>WhisperForConditionalGeneration</code>](#module_models.WhisperForConditionalGeneration)
**Returns**: <code>Promise.&lt;(ModelOutput|Tensor)&gt;</code> - The output of the model, which can contain the generated token ids, attentions, and scores.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th>
</tr>
</thead>
<tbody>
<tr>
<td>options</td><td><code>*</code></td>
</tr> </tbody>
</table>
* * *
<a id="module_models.WhisperForConditionalGeneration+_extract_token_timestamps" class="group"></a>
### `whisperForConditionalGeneration._extract_token_timestamps(generate_outputs, alignment_heads, [num_frames], [time_precision])` ⇒ [<code>Tensor</code>](#Tensor)
Calculates token-level timestamps using the encoder-decoder cross-attentions and
dynamic time-warping (DTW) to map each output token to a position in the input audio.
If `num_frames` is specified, the encoder-decoder cross-attentions will be cropped before applying DTW.
**Kind**: instance method of [<code>WhisperForConditionalGeneration</code>](#module_models.WhisperForConditionalGeneration)
**Returns**: [<code>Tensor</code>](#Tensor) - tensor containing the timestamps in seconds for each predicted token
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Default</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>generate_outputs</td><td><code>Object</code></td><td></td><td><p>Outputs generated by the model</p>
</td>
</tr><tr>
<td>generate_outputs.cross_attentions</td><td><code>Array.&lt;Array&lt;Tensor&gt;&gt;</code></td><td></td><td><p>The cross attentions output by the model</p>
</td>
</tr><tr>
<td>generate_outputs.sequences</td><td><code><a href="#Tensor">Tensor</a></code></td><td></td><td><p>The sequences output by the model</p>
</td>
</tr><tr>
<td>alignment_heads</td><td><code>Array.&lt;Array&lt;number&gt;&gt;</code></td><td></td><td><p>Alignment heads of the model</p>
</td>
</tr><tr>
<td>[num_frames]</td><td><code>number</code></td><td><code></code></td><td><p>Number of frames in the input audio.</p>
</td>
</tr><tr>
<td>[time_precision]</td><td><code>number</code></td><td><code>0.02</code></td><td><p>Precision of the timestamps in seconds</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.MoonshineModel" class="group"></a>
## models.MoonshineModel
MoonshineModel class for training Moonshine models without a language model head.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.VisionEncoderDecoderModel" class="group"></a>
## models.VisionEncoderDecoderModel
Vision Encoder-Decoder model based on OpenAI's GPT architecture for image captioning and other vision tasks
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.LlavaForConditionalGeneration" class="group"></a>
## models.LlavaForConditionalGeneration
The LLAVA model which consists of a vision backbone and a language model.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.Idefics3ForConditionalGeneration" class="group"></a>
## models.Idefics3ForConditionalGeneration
The Idefics3 model which consists of a vision backbone and a language model.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.SmolVLMForConditionalGeneration" class="group"></a>
## models.SmolVLMForConditionalGeneration
The SmolVLM Model with a language modeling head.
It is made up a SigLIP vision encoder, with a language modeling head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.CLIPModel" class="group"></a>
## models.CLIPModel
CLIP Text and Vision Model with a projection layers on top
**Example:** Perform zero-shot image classification with a `CLIPModel`.
```javascript
import { AutoTokenizer, AutoProcessor, CLIPModel, RawImage } from '@huggingface/transformers';
// Load tokenizer, processor, and model
let tokenizer = await AutoTokenizer.from_pretrained('Xenova/clip-vit-base-patch16');
let processor = await AutoProcessor.from_pretrained('Xenova/clip-vit-base-patch16');
let model = await CLIPModel.from_pretrained('Xenova/clip-vit-base-patch16');
// Run tokenization
let texts = ['a photo of a car', 'a photo of a football match']
let text_inputs = tokenizer(texts, { padding: true, truncation: true });
// Read image and run processor
let image = await RawImage.read('https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/football-match.jpg');
let image_inputs = await processor(image);
// Run model with both text and pixel inputs
let output = await model({ ...text_inputs, ...image_inputs });
// {
// logits_per_image: Tensor {
// dims: [ 1, 2 ],
// data: Float32Array(2) [ 18.579734802246094, 24.31830596923828 ],
// },
// logits_per_text: Tensor {
// dims: [ 2, 1 ],
// data: Float32Array(2) [ 18.579734802246094, 24.31830596923828 ],
// },
// text_embeds: Tensor {
// dims: [ 2, 512 ],
// data: Float32Array(1024) [ ... ],
// },
// image_embeds: Tensor {
// dims: [ 1, 512 ],
// data: Float32Array(512) [ ... ],
// }
// }
```
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.CLIPTextModel" class="group"></a>
## models.CLIPTextModel
The text model from CLIP without any head or projection on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.CLIPTextModel.from_pretrained" class="group"></a>
### `CLIPTextModel.from_pretrained()` : <code>*</code>
**Kind**: static method of [<code>CLIPTextModel</code>](#module_models.CLIPTextModel)
* * *
<a id="module_models.CLIPTextModelWithProjection" class="group"></a>
## models.CLIPTextModelWithProjection
CLIP Text Model with a projection layer on top (a linear layer on top of the pooled output)
**Example:** Compute text embeddings with `CLIPTextModelWithProjection`.
```javascript
import { AutoTokenizer, CLIPTextModelWithProjection } from '@huggingface/transformers';
// Load tokenizer and text model
const tokenizer = await AutoTokenizer.from_pretrained('Xenova/clip-vit-base-patch16');
const text_model = await CLIPTextModelWithProjection.from_pretrained('Xenova/clip-vit-base-patch16');
// Run tokenization
let texts = ['a photo of a car', 'a photo of a football match'];
let text_inputs = tokenizer(texts, { padding: true, truncation: true });
// Compute embeddings
const { text_embeds } = await text_model(text_inputs);
// Tensor {
// dims: [ 2, 512 ],
// type: 'float32',
// data: Float32Array(1024) [ ... ],
// size: 1024
// }
```
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.CLIPTextModelWithProjection.from_pretrained" class="group"></a>
### `CLIPTextModelWithProjection.from_pretrained()` : <code>*</code>
**Kind**: static method of [<code>CLIPTextModelWithProjection</code>](#module_models.CLIPTextModelWithProjection)
* * *
<a id="module_models.CLIPVisionModel" class="group"></a>
## models.CLIPVisionModel
The vision model from CLIP without any head or projection on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.CLIPVisionModel.from_pretrained" class="group"></a>
### `CLIPVisionModel.from_pretrained()` : <code>*</code>
**Kind**: static method of [<code>CLIPVisionModel</code>](#module_models.CLIPVisionModel)
* * *
<a id="module_models.CLIPVisionModelWithProjection" class="group"></a>
## models.CLIPVisionModelWithProjection
CLIP Vision Model with a projection layer on top (a linear layer on top of the pooled output)
**Example:** Compute vision embeddings with `CLIPVisionModelWithProjection`.
```javascript
import { AutoProcessor, CLIPVisionModelWithProjection, RawImage} from '@huggingface/transformers';
// Load processor and vision model
const processor = await AutoProcessor.from_pretrained('Xenova/clip-vit-base-patch16');
const vision_model = await CLIPVisionModelWithProjection.from_pretrained('Xenova/clip-vit-base-patch16');
// Read image and run processor
let image = await RawImage.read('https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/football-match.jpg');
let image_inputs = await processor(image);
// Compute embeddings
const { image_embeds } = await vision_model(image_inputs);
// Tensor {
// dims: [ 1, 512 ],
// type: 'float32',
// data: Float32Array(512) [ ... ],
// size: 512
// }
```
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.CLIPVisionModelWithProjection.from_pretrained" class="group"></a>
### `CLIPVisionModelWithProjection.from_pretrained()` : <code>*</code>
**Kind**: static method of [<code>CLIPVisionModelWithProjection</code>](#module_models.CLIPVisionModelWithProjection)
* * *
<a id="module_models.SiglipModel" class="group"></a>
## models.SiglipModel
SigLIP Text and Vision Model with a projection layers on top
**Example:** Perform zero-shot image classification with a `SiglipModel`.
```javascript
import { AutoTokenizer, AutoProcessor, SiglipModel, RawImage } from '@huggingface/transformers';
// Load tokenizer, processor, and model
const tokenizer = await AutoTokenizer.from_pretrained('Xenova/siglip-base-patch16-224');
const processor = await AutoProcessor.from_pretrained('Xenova/siglip-base-patch16-224');
const model = await SiglipModel.from_pretrained('Xenova/siglip-base-patch16-224');
// Run tokenization
const texts = ['a photo of 2 cats', 'a photo of 2 dogs'];
const text_inputs = tokenizer(texts, { padding: 'max_length', truncation: true });
// Read image and run processor
const image = await RawImage.read('http://images.cocodataset.org/val2017/000000039769.jpg');
const image_inputs = await processor(image);
// Run model with both text and pixel inputs
const output = await model({ ...text_inputs, ...image_inputs });
// {
// logits_per_image: Tensor {
// dims: [ 1, 2 ],
// data: Float32Array(2) [ -1.6019744873046875, -10.720091819763184 ],
// },
// logits_per_text: Tensor {
// dims: [ 2, 1 ],
// data: Float32Array(2) [ -1.6019744873046875, -10.720091819763184 ],
// },
// text_embeds: Tensor {
// dims: [ 2, 768 ],
// data: Float32Array(1536) [ ... ],
// },
// image_embeds: Tensor {
// dims: [ 1, 768 ],
// data: Float32Array(768) [ ... ],
// }
// }
```
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.SiglipTextModel" class="group"></a>
## models.SiglipTextModel
The text model from SigLIP without any head or projection on top.
**Example:** Compute text embeddings with `SiglipTextModel`.
```javascript
import { AutoTokenizer, SiglipTextModel } from '@huggingface/transformers';
// Load tokenizer and text model
const tokenizer = await AutoTokenizer.from_pretrained('Xenova/siglip-base-patch16-224');
const text_model = await SiglipTextModel.from_pretrained('Xenova/siglip-base-patch16-224');
// Run tokenization
const texts = ['a photo of 2 cats', 'a photo of 2 dogs'];
const text_inputs = tokenizer(texts, { padding: 'max_length', truncation: true });
// Compute embeddings
const { pooler_output } = await text_model(text_inputs);
// Tensor {
// dims: [ 2, 768 ],
// type: 'float32',
// data: Float32Array(1536) [ ... ],
// size: 1536
// }
```
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.SiglipTextModel.from_pretrained" class="group"></a>
### `SiglipTextModel.from_pretrained()` : <code>*</code>
**Kind**: static method of [<code>SiglipTextModel</code>](#module_models.SiglipTextModel)
* * *
<a id="module_models.SiglipVisionModel" class="group"></a>
## models.SiglipVisionModel
The vision model from SigLIP without any head or projection on top.
**Example:** Compute vision embeddings with `SiglipVisionModel`.
```javascript
import { AutoProcessor, SiglipVisionModel, RawImage} from '@huggingface/transformers';
// Load processor and vision model
const processor = await AutoProcessor.from_pretrained('Xenova/siglip-base-patch16-224');
const vision_model = await SiglipVisionModel.from_pretrained('Xenova/siglip-base-patch16-224');
// Read image and run processor
const image = await RawImage.read('https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/football-match.jpg');
const image_inputs = await processor(image);
// Compute embeddings
const { pooler_output } = await vision_model(image_inputs);
// Tensor {
// dims: [ 1, 768 ],
// type: 'float32',
// data: Float32Array(768) [ ... ],
// size: 768
// }
```
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.SiglipVisionModel.from_pretrained" class="group"></a>
### `SiglipVisionModel.from_pretrained()` : <code>*</code>
**Kind**: static method of [<code>SiglipVisionModel</code>](#module_models.SiglipVisionModel)
* * *
<a id="module_models.CLIPSegForImageSegmentation" class="group"></a>
## models.CLIPSegForImageSegmentation
CLIPSeg model with a Transformer-based decoder on top for zero-shot and one-shot image segmentation.
**Example:** Perform zero-shot image segmentation with a `CLIPSegForImageSegmentation` model.
```javascript
import { AutoTokenizer, AutoProcessor, CLIPSegForImageSegmentation, RawImage } from '@huggingface/transformers';
// Load tokenizer, processor, and model
const tokenizer = await AutoTokenizer.from_pretrained('Xenova/clipseg-rd64-refined');
const processor = await AutoProcessor.from_pretrained('Xenova/clipseg-rd64-refined');
const model = await CLIPSegForImageSegmentation.from_pretrained('Xenova/clipseg-rd64-refined');
// Run tokenization
const texts = ['a glass', 'something to fill', 'wood', 'a jar'];
const text_inputs = tokenizer(texts, { padding: true, truncation: true });
// Read image and run processor
const image = await RawImage.read('https://github.com/timojl/clipseg/blob/master/example_image.jpg?raw=true');
const image_inputs = await processor(image);
// Run model with both text and pixel inputs
const { logits } = await model({ ...text_inputs, ...image_inputs });
// logits: Tensor {
// dims: [4, 352, 352],
// type: 'float32',
// data: Float32Array(495616) [ ... ],
// size: 495616
// }
```
You can visualize the predictions as follows:
```javascript
const preds = logits
.unsqueeze_(1)
.sigmoid_()
.mul_(255)
.round_()
.to('uint8');
for (let i = 0; i < preds.dims[0]; ++i) {
const img = RawImage.fromTensor(preds[i]);
img.save(`prediction_${i}.png`);
}
```
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.GPT2LMHeadModel" class="group"></a>
## models.GPT2LMHeadModel
GPT-2 language model head on top of the GPT-2 base model. This model is suitable for text generation tasks.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.JAISModel" class="group"></a>
## models.JAISModel
The bare JAIS Model transformer outputting raw hidden-states without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.JAISLMHeadModel" class="group"></a>
## models.JAISLMHeadModel
The JAIS Model transformer with a language modeling head on top (linear layer with weights tied to the input embeddings).
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.CodeGenModel" class="group"></a>
## models.CodeGenModel
CodeGenModel is a class representing a code generation model without a language model head.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.CodeGenForCausalLM" class="group"></a>
## models.CodeGenForCausalLM
CodeGenForCausalLM is a class that represents a code generation model based on the GPT-2 architecture. It extends the `CodeGenPreTrainedModel` class.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.LlamaPreTrainedModel" class="group"></a>
## models.LlamaPreTrainedModel
The bare LLama Model outputting raw hidden-states without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.LlamaModel" class="group"></a>
## models.LlamaModel
The bare LLaMA Model outputting raw hidden-states without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.CoherePreTrainedModel" class="group"></a>
## models.CoherePreTrainedModel
The bare Cohere Model outputting raw hidden-states without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.GemmaPreTrainedModel" class="group"></a>
## models.GemmaPreTrainedModel
The bare Gemma Model outputting raw hidden-states without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.GemmaModel" class="group"></a>
## models.GemmaModel
The bare Gemma Model outputting raw hidden-states without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.Gemma2PreTrainedModel" class="group"></a>
## models.Gemma2PreTrainedModel
The bare Gemma2 Model outputting raw hidden-states without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.Gemma2Model" class="group"></a>
## models.Gemma2Model
The bare Gemma2 Model outputting raw hidden-states without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.Gemma3PreTrainedModel" class="group"></a>
## models.Gemma3PreTrainedModel
The bare Gemma3 Model outputting raw hidden-states without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.Gemma3Model" class="group"></a>
## models.Gemma3Model
The bare Gemma3 Model outputting raw hidden-states without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.Qwen2PreTrainedModel" class="group"></a>
## models.Qwen2PreTrainedModel
The bare Qwen2 Model outputting raw hidden-states without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.Qwen2Model" class="group"></a>
## models.Qwen2Model
The bare Qwen2 Model outputting raw hidden-states without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.Qwen3PreTrainedModel" class="group"></a>
## models.Qwen3PreTrainedModel
The bare Qwen3 Model outputting raw hidden-states without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.Qwen3Model" class="group"></a>
## models.Qwen3Model
The bare Qwen3 Model outputting raw hidden-states without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.PhiModel" class="group"></a>
## models.PhiModel
The bare Phi Model outputting raw hidden-states without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.Phi3Model" class="group"></a>
## models.Phi3Model
The bare Phi3 Model outputting raw hidden-states without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.BloomPreTrainedModel" class="group"></a>
## models.BloomPreTrainedModel
The Bloom Model transformer with a language modeling head on top (linear layer with weights tied to the input embeddings).
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.BloomModel" class="group"></a>
## models.BloomModel
The bare Bloom Model transformer outputting raw hidden-states without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.BloomForCausalLM" class="group"></a>
## models.BloomForCausalLM
The Bloom Model transformer with a language modeling head on top (linear layer with weights tied to the input embeddings).
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.MptModel" class="group"></a>
## models.MptModel
The bare Mpt Model transformer outputting raw hidden-states without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.MptForCausalLM" class="group"></a>
## models.MptForCausalLM
The MPT Model transformer with a language modeling head on top (linear layer with weights tied to the input embeddings).
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.OPTModel" class="group"></a>
## models.OPTModel
The bare OPT Model outputting raw hidden-states without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.OPTForCausalLM" class="group"></a>
## models.OPTForCausalLM
The OPT Model transformer with a language modeling head on top (linear layer with weights tied to the input embeddings).
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.VitPoseForPoseEstimation" class="group"></a>
## models.VitPoseForPoseEstimation
The VitPose model with a pose estimation head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.VitMatteForImageMatting" class="group"></a>
## models.VitMatteForImageMatting
ViTMatte framework leveraging any vision backbone e.g. for ADE20k, CityScapes.
**Example:** Perform image matting with a `VitMatteForImageMatting` model.
```javascript
import { AutoProcessor, VitMatteForImageMatting, RawImage } from '@huggingface/transformers';
// Load processor and model
const processor = await AutoProcessor.from_pretrained('Xenova/vitmatte-small-distinctions-646');
const model = await VitMatteForImageMatting.from_pretrained('Xenova/vitmatte-small-distinctions-646');
// Load image and trimap
const image = await RawImage.fromURL('https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/vitmatte_image.png');
const trimap = await RawImage.fromURL('https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/vitmatte_trimap.png');
// Prepare image + trimap for the model
const inputs = await processor(image, trimap);
// Predict alpha matte
const { alphas } = await model(inputs);
// Tensor {
// dims: [ 1, 1, 640, 960 ],
// type: 'float32',
// size: 614400,
// data: Float32Array(614400) [ 0.9894027709960938, 0.9970508813858032, ... ]
// }
```
You can visualize the alpha matte as follows:
```javascript
import { Tensor, cat } from '@huggingface/transformers';
// Visualize predicted alpha matte
const imageTensor = image.toTensor();
// Convert float (0-1) alpha matte to uint8 (0-255)
const alphaChannel = alphas
.squeeze(0)
.mul_(255)
.clamp_(0, 255)
.round_()
.to('uint8');
// Concatenate original image with predicted alpha
const imageData = cat([imageTensor, alphaChannel], 0);
// Save output image
const outputImage = RawImage.fromTensor(imageData);
outputImage.save('output.png');
```
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.VitMatteForImageMatting+_call" class="group"></a>
### `vitMatteForImageMatting._call(model_inputs)`
**Kind**: instance method of [<code>VitMatteForImageMatting</code>](#module_models.VitMatteForImageMatting)
<table>
<thead>
<tr>
<th>Param</th><th>Type</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>any</code></td>
</tr> </tbody>
</table>
* * *
<a id="module_models.DetrObjectDetectionOutput" class="group"></a>
## models.DetrObjectDetectionOutput
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="new_module_models.DetrObjectDetectionOutput_new" class="group"></a>
### `new DetrObjectDetectionOutput(output)`
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>output</td><td><code>Object</code></td><td><p>The output of the model.</p>
</td>
</tr><tr>
<td>output.logits</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>Classification logits (including no-object) for all queries.</p>
</td>
</tr><tr>
<td>output.pred_boxes</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>Normalized boxes coordinates for all queries, represented as (center_x, center_y, width, height).
These values are normalized in [0, 1], relative to the size of each individual image in the batch (disregarding possible padding).</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.DetrSegmentationOutput" class="group"></a>
## models.DetrSegmentationOutput
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="new_module_models.DetrSegmentationOutput_new" class="group"></a>
### `new DetrSegmentationOutput(output)`
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>output</td><td><code>Object</code></td><td><p>The output of the model.</p>
</td>
</tr><tr>
<td>output.logits</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>The output logits of the model.</p>
</td>
</tr><tr>
<td>output.pred_boxes</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>Predicted boxes.</p>
</td>
</tr><tr>
<td>output.pred_masks</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>Predicted masks.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.RTDetrObjectDetectionOutput" class="group"></a>
## models.RTDetrObjectDetectionOutput
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="new_module_models.RTDetrObjectDetectionOutput_new" class="group"></a>
### `new RTDetrObjectDetectionOutput(output)`
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>output</td><td><code>Object</code></td><td><p>The output of the model.</p>
</td>
</tr><tr>
<td>output.logits</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>Classification logits (including no-object) for all queries.</p>
</td>
</tr><tr>
<td>output.pred_boxes</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>Normalized boxes coordinates for all queries, represented as (center_x, center_y, width, height).
These values are normalized in [0, 1], relative to the size of each individual image in the batch (disregarding possible padding).</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.TableTransformerModel" class="group"></a>
## models.TableTransformerModel
The bare Table Transformer Model (consisting of a backbone and encoder-decoder Transformer)
outputting raw hidden-states without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.TableTransformerForObjectDetection" class="group"></a>
## models.TableTransformerForObjectDetection
Table Transformer Model (consisting of a backbone and encoder-decoder Transformer)
with object detection heads on top, for tasks such as COCO detection.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.TableTransformerForObjectDetection+_call" class="group"></a>
### `tableTransformerForObjectDetection._call(model_inputs)`
**Kind**: instance method of [<code>TableTransformerForObjectDetection</code>](#module_models.TableTransformerForObjectDetection)
<table>
<thead>
<tr>
<th>Param</th><th>Type</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>any</code></td>
</tr> </tbody>
</table>
* * *
<a id="module_models.ResNetPreTrainedModel" class="group"></a>
## models.ResNetPreTrainedModel
An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained models.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.ResNetModel" class="group"></a>
## models.ResNetModel
The bare ResNet model outputting raw features without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.ResNetForImageClassification" class="group"></a>
## models.ResNetForImageClassification
ResNet Model with an image classification head on top (a linear layer on top of the pooled features), e.g. for ImageNet.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.ResNetForImageClassification+_call" class="group"></a>
### `resNetForImageClassification._call(model_inputs)`
**Kind**: instance method of [<code>ResNetForImageClassification</code>](#module_models.ResNetForImageClassification)
<table>
<thead>
<tr>
<th>Param</th><th>Type</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>any</code></td>
</tr> </tbody>
</table>
* * *
<a id="module_models.Swin2SRModel" class="group"></a>
## models.Swin2SRModel
The bare Swin2SR Model transformer outputting raw hidden-states without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.Swin2SRForImageSuperResolution" class="group"></a>
## models.Swin2SRForImageSuperResolution
Swin2SR Model transformer with an upsampler head on top for image super resolution and restoration.
**Example:** Super-resolution w/ `Xenova/swin2SR-classical-sr-x2-64`.
```javascript
import { AutoProcessor, Swin2SRForImageSuperResolution, RawImage } from '@huggingface/transformers';
// Load processor and model
const model_id = 'Xenova/swin2SR-classical-sr-x2-64';
const processor = await AutoProcessor.from_pretrained(model_id);
const model = await Swin2SRForImageSuperResolution.from_pretrained(model_id);
// Prepare model inputs
const url = 'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/butterfly.jpg';
const image = await RawImage.fromURL(url);
const inputs = await processor(image);
// Run model
const outputs = await model(inputs);
// Convert Tensor to RawImage
const output = outputs.reconstruction.squeeze().clamp_(0, 1).mul_(255).round_().to('uint8');
const outputImage = RawImage.fromTensor(output);
// RawImage {
// data: Uint8Array(786432) [ 41, 31, 24, ... ],
// width: 512,
// height: 512,
// channels: 3
// }
```
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.DPTModel" class="group"></a>
## models.DPTModel
The bare DPT Model transformer outputting raw hidden-states without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.DPTForDepthEstimation" class="group"></a>
## models.DPTForDepthEstimation
DPT Model with a depth estimation head on top (consisting of 3 convolutional layers) e.g. for KITTI, NYUv2.
**Example:** Depth estimation w/ `Xenova/dpt-hybrid-midas`.
```javascript
import { DPTForDepthEstimation, AutoProcessor, RawImage, interpolate_4d } from '@huggingface/transformers';
// Load model and processor
const model_id = 'Xenova/dpt-hybrid-midas';
const model = await DPTForDepthEstimation.from_pretrained(model_id);
const processor = await AutoProcessor.from_pretrained(model_id);
// Load image from URL
const url = 'http://images.cocodataset.org/val2017/000000039769.jpg';
const image = await RawImage.read(url);
// Prepare image for the model
const inputs = await processor(image);
// Run model
const { predicted_depth } = await model(inputs);
// Interpolate to original size
const prediction = (await interpolate_4d(predicted_depth.unsqueeze(1), {
size: image.size.reverse(),
mode: 'bilinear',
})).squeeze(1);
// Visualize the prediction
const min = prediction.min().item();
const max = prediction.max().item();
const formatted = prediction.sub_(min).div_(max - min).mul_(255).to('uint8');
const depth = RawImage.fromTensor(formatted);
// RawImage {
// data: Uint8Array(307200) [ 85, 85, 84, ... ],
// width: 640,
// height: 480,
// channels: 1
// }
```
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.DepthAnythingForDepthEstimation" class="group"></a>
## models.DepthAnythingForDepthEstimation
Depth Anything Model with a depth estimation head on top (consisting of 3 convolutional layers) e.g. for KITTI, NYUv2.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.GLPNModel" class="group"></a>
## models.GLPNModel
The bare GLPN encoder (Mix-Transformer) outputting raw hidden-states without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.GLPNForDepthEstimation" class="group"></a>
## models.GLPNForDepthEstimation
import { GLPNForDepthEstimation, AutoProcessor, RawImage, interpolate_4d } from '@huggingface/transformers';
// Load model and processor
const model_id = 'Xenova/glpn-kitti';
const model = await GLPNForDepthEstimation.from_pretrained(model_id);
const processor = await AutoProcessor.from_pretrained(model_id);
// Load image from URL
const url = 'http://images.cocodataset.org/val2017/000000039769.jpg';
const image = await RawImage.read(url);
// Prepare image for the model
const inputs = await processor(image);
// Run model
const { predicted_depth } = await model(inputs);
// Interpolate to original size
const prediction = (await interpolate_4d(predicted_depth.unsqueeze(1), {
size: image.size.reverse(),
mode: 'bilinear',
})).squeeze(1);
// Visualize the prediction
const min = prediction.min().item();
const max = prediction.max().item();
const formatted = prediction.sub_(min).div_(max - min).mul_(255).to('uint8');
const depth = RawImage.fromTensor(formatted);
// RawImage {
// data: Uint8Array(307200) [ 85, 85, 84, ... ],
// width: 640,
// height: 480,
// channels: 1
// }
```
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.DonutSwinModel" class="group"></a>
## models.DonutSwinModel
The bare Donut Swin Model transformer outputting raw hidden-states without any specific head on top.
**Example:** Step-by-step Document Parsing.
```javascript
import { AutoProcessor, AutoTokenizer, AutoModelForVision2Seq, RawImage } from '@huggingface/transformers';
// Choose model to use
const model_id = 'Xenova/donut-base-finetuned-cord-v2';
// Prepare image inputs
const processor = await AutoProcessor.from_pretrained(model_id);
const url = 'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/receipt.png';
const image = await RawImage.read(url);
const image_inputs = await processor(image);
// Prepare decoder inputs
const tokenizer = await AutoTokenizer.from_pretrained(model_id);
const task_prompt = '<s_cord-v2>';
const decoder_input_ids = tokenizer(task_prompt, {
add_special_tokens: false,
}).input_ids;
// Create the model
const model = await AutoModelForVision2Seq.from_pretrained(model_id);
// Run inference
const output = await model.generate(image_inputs.pixel_values, {
decoder_input_ids,
max_length: model.config.decoder.max_position_embeddings,
});
// Decode output
const decoded = tokenizer.batch_decode(output)[0];
// <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>
```
**Example:** Step-by-step Document Visual Question Answering (DocVQA)
```javascript
import { AutoProcessor, AutoTokenizer, AutoModelForVision2Seq, RawImage } from '@huggingface/transformers';
// Choose model to use
const model_id = 'Xenova/donut-base-finetuned-docvqa';
// Prepare image inputs
const processor = await AutoProcessor.from_pretrained(model_id);
const url = 'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/invoice.png';
const image = await RawImage.read(url);
const image_inputs = await processor(image);
// Prepare decoder inputs
const tokenizer = await AutoTokenizer.from_pretrained(model_id);
const question = 'What is the invoice number?';
const task_prompt = `<s_docvqa><s_question>${question}</s_question><s_answer>`;
const decoder_input_ids = tokenizer(task_prompt, {
add_special_tokens: false,
}).input_ids;
// Create the model
const model = await AutoModelForVision2Seq.from_pretrained(model_id);
// Run inference
const output = await model.generate(image_inputs.pixel_values, {
decoder_input_ids,
max_length: model.config.decoder.max_position_embeddings,
});
// Decode output
const decoded = tokenizer.batch_decode(output)[0];
// <s_docvqa><s_question> What is the invoice number?</s_question><s_answer> us-001</s_answer></s>
```
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.ConvNextModel" class="group"></a>
## models.ConvNextModel
The bare ConvNext model outputting raw features without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.ConvNextForImageClassification" class="group"></a>
## models.ConvNextForImageClassification
ConvNext Model with an image classification head on top (a linear layer on top of the pooled features), e.g. for ImageNet.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.ConvNextForImageClassification+_call" class="group"></a>
### `convNextForImageClassification._call(model_inputs)`
**Kind**: instance method of [<code>ConvNextForImageClassification</code>](#module_models.ConvNextForImageClassification)
<table>
<thead>
<tr>
<th>Param</th><th>Type</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>any</code></td>
</tr> </tbody>
</table>
* * *
<a id="module_models.ConvNextV2Model" class="group"></a>
## models.ConvNextV2Model
The bare ConvNextV2 model outputting raw features without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.ConvNextV2ForImageClassification" class="group"></a>
## models.ConvNextV2ForImageClassification
ConvNextV2 Model with an image classification head on top (a linear layer on top of the pooled features), e.g. for ImageNet.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.ConvNextV2ForImageClassification+_call" class="group"></a>
### `convNextV2ForImageClassification._call(model_inputs)`
**Kind**: instance method of [<code>ConvNextV2ForImageClassification</code>](#module_models.ConvNextV2ForImageClassification)
<table>
<thead>
<tr>
<th>Param</th><th>Type</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>any</code></td>
</tr> </tbody>
</table>
* * *
<a id="module_models.Dinov2Model" class="group"></a>
## models.Dinov2Model
The bare DINOv2 Model transformer outputting raw hidden-states without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.Dinov2ForImageClassification" class="group"></a>
## models.Dinov2ForImageClassification
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.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.Dinov2ForImageClassification+_call" class="group"></a>
### `dinov2ForImageClassification._call(model_inputs)`
**Kind**: instance method of [<code>Dinov2ForImageClassification</code>](#module_models.Dinov2ForImageClassification)
<table>
<thead>
<tr>
<th>Param</th><th>Type</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>any</code></td>
</tr> </tbody>
</table>
* * *
<a id="module_models.Dinov2WithRegistersModel" class="group"></a>
## models.Dinov2WithRegistersModel
The bare Dinov2WithRegisters Model transformer outputting raw hidden-states without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.Dinov2WithRegistersForImageClassification" class="group"></a>
## models.Dinov2WithRegistersForImageClassification
Dinov2WithRegisters 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.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.Dinov2WithRegistersForImageClassification+_call" class="group"></a>
### `dinov2WithRegistersForImageClassification._call(model_inputs)`
**Kind**: instance method of [<code>Dinov2WithRegistersForImageClassification</code>](#module_models.Dinov2WithRegistersForImageClassification)
<table>
<thead>
<tr>
<th>Param</th><th>Type</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>any</code></td>
</tr> </tbody>
</table>
* * *
<a id="module_models.YolosObjectDetectionOutput" class="group"></a>
## models.YolosObjectDetectionOutput
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="new_module_models.YolosObjectDetectionOutput_new" class="group"></a>
### `new YolosObjectDetectionOutput(output)`
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>output</td><td><code>Object</code></td><td><p>The output of the model.</p>
</td>
</tr><tr>
<td>output.logits</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>Classification logits (including no-object) for all queries.</p>
</td>
</tr><tr>
<td>output.pred_boxes</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>Normalized boxes coordinates for all queries, represented as (center_x, center_y, width, height).
These values are normalized in [0, 1], relative to the size of each individual image in the batch (disregarding possible padding).</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.SamModel" class="group"></a>
## models.SamModel
Segment Anything Model (SAM) for generating segmentation masks, given an input image
and optional 2D location and bounding boxes.
**Example:** Perform mask generation w/ `Xenova/sam-vit-base`.
```javascript
import { SamModel, AutoProcessor, RawImage } from '@huggingface/transformers';
const model = await SamModel.from_pretrained('Xenova/sam-vit-base');
const processor = await AutoProcessor.from_pretrained('Xenova/sam-vit-base');
const img_url = 'https://huggingface.co/ybelkada/segment-anything/resolve/main/assets/car.png';
const raw_image = await RawImage.read(img_url);
const input_points = [[[450, 600]]] // 2D localization of a window
const inputs = await processor(raw_image, { input_points });
const outputs = await model(inputs);
const masks = await processor.post_process_masks(outputs.pred_masks, inputs.original_sizes, inputs.reshaped_input_sizes);
// [
// Tensor {
// dims: [ 1, 3, 1764, 2646 ],
// type: 'bool',
// data: Uint8Array(14002632) [ ... ],
// size: 14002632
// }
// ]
const scores = outputs.iou_scores;
// Tensor {
// dims: [ 1, 1, 3 ],
// type: 'float32',
// data: Float32Array(3) [
// 0.8892380595207214,
// 0.9311248064041138,
// 0.983696699142456
// ],
// size: 3
// }
```
**Kind**: static class of [<code>models</code>](#module_models)
* [.SamModel](#module_models.SamModel)
* [`.get_image_embeddings(model_inputs)`](#module_models.SamModel+get_image_embeddings) ⇒ <code>Promise.&lt;{image_embeddings: Tensor, image_positional_embeddings: Tensor}&gt;</code>
* [`.forward(model_inputs)`](#module_models.SamModel+forward) ⇒ <code>Promise.&lt;Object&gt;</code>
* [`._call(model_inputs)`](#module_models.SamModel+_call) ⇒ <code>Promise.&lt;SamImageSegmentationOutput&gt;</code>
* * *
<a id="module_models.SamModel+get_image_embeddings" class="group"></a>
### `samModel.get_image_embeddings(model_inputs)` ⇒ <code>Promise.&lt;{image_embeddings: Tensor, image_positional_embeddings: Tensor}&gt;</code>
Compute image embeddings and positional image embeddings, given the pixel values of an image.
**Kind**: instance method of [<code>SamModel</code>](#module_models.SamModel)
**Returns**: <code>Promise.&lt;{image_embeddings: Tensor, image_positional_embeddings: Tensor}&gt;</code> - The image embeddings and positional image embeddings.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>Object containing the model inputs.</p>
</td>
</tr><tr>
<td>model_inputs.pixel_values</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>Pixel values obtained using a <code>SamProcessor</code>.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.SamModel+forward" class="group"></a>
### `samModel.forward(model_inputs)` ⇒ <code>Promise.&lt;Object&gt;</code>
**Kind**: instance method of [<code>SamModel</code>](#module_models.SamModel)
**Returns**: <code>Promise.&lt;Object&gt;</code> - The output of the model.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>SamModelInputs</code></td><td><p>Object containing the model inputs.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.SamModel+_call" class="group"></a>
### `samModel._call(model_inputs)` ⇒ <code>Promise.&lt;SamImageSegmentationOutput&gt;</code>
Runs the model with the provided inputs
**Kind**: instance method of [<code>SamModel</code>](#module_models.SamModel)
**Returns**: <code>Promise.&lt;SamImageSegmentationOutput&gt;</code> - Object containing segmentation outputs
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>Model inputs</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.SamImageSegmentationOutput" class="group"></a>
## models.SamImageSegmentationOutput
Base class for Segment-Anything model's output.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="new_module_models.SamImageSegmentationOutput_new" class="group"></a>
### `new SamImageSegmentationOutput(output)`
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>output</td><td><code>Object</code></td><td><p>The output of the model.</p>
</td>
</tr><tr>
<td>output.iou_scores</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>The output logits of the model.</p>
</td>
</tr><tr>
<td>output.pred_masks</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>Predicted boxes.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.Wav2Vec2Model" class="group"></a>
## models.Wav2Vec2Model
The bare Wav2Vec2 Model transformer outputting raw hidden-states without any specific head on top.
**Example:** Load and run a `Wav2Vec2Model` for feature extraction.
```javascript
import { AutoProcessor, AutoModel, read_audio } from '@huggingface/transformers';
// Read and preprocess audio
const processor = await AutoProcessor.from_pretrained('Xenova/mms-300m');
const audio = await read_audio('https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/mlk.flac', 16000);
const inputs = await processor(audio);
// Run model with inputs
const model = await AutoModel.from_pretrained('Xenova/mms-300m');
const output = await model(inputs);
// {
// last_hidden_state: Tensor {
// dims: [ 1, 1144, 1024 ],
// type: 'float32',
// data: Float32Array(1171456) [ ... ],
// size: 1171456
// }
// }
```
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.Wav2Vec2ForAudioFrameClassification" class="group"></a>
## models.Wav2Vec2ForAudioFrameClassification
Wav2Vec2 Model with a frame classification head on top for tasks like Speaker Diarization.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.Wav2Vec2ForAudioFrameClassification+_call" class="group"></a>
### `wav2Vec2ForAudioFrameClassification._call(model_inputs)` ⇒ <code>Promise.&lt;TokenClassifierOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>Wav2Vec2ForAudioFrameClassification</code>](#module_models.Wav2Vec2ForAudioFrameClassification)
**Returns**: <code>Promise.&lt;TokenClassifierOutput&gt;</code> - An object containing the model's output logits for sequence classification.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.PyAnnoteModel" class="group"></a>
## models.PyAnnoteModel
The bare PyAnnote Model transformer outputting raw hidden-states without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.PyAnnoteForAudioFrameClassification" class="group"></a>
## models.PyAnnoteForAudioFrameClassification
PyAnnote Model with a frame classification head on top for tasks like Speaker Diarization.
**Example:** Load and run a `PyAnnoteForAudioFrameClassification` for speaker diarization.
```javascript
import { AutoProcessor, AutoModelForAudioFrameClassification, read_audio } from '@huggingface/transformers';
// Load model and processor
const model_id = 'onnx-community/pyannote-segmentation-3.0';
const model = await AutoModelForAudioFrameClassification.from_pretrained(model_id);
const processor = await AutoProcessor.from_pretrained(model_id);
// Read and preprocess audio
const url = 'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/mlk.wav';
const audio = await read_audio(url, processor.feature_extractor.config.sampling_rate);
const inputs = await processor(audio);
// Run model with inputs
const { logits } = await model(inputs);
// {
// logits: Tensor {
// dims: [ 1, 767, 7 ], // [batch_size, num_frames, num_classes]
// type: 'float32',
// data: Float32Array(5369) [ ... ],
// size: 5369
// }
// }
const result = processor.post_process_speaker_diarization(logits, audio.length);
// [
// [
// { id: 0, start: 0, end: 1.0512535626298245, confidence: 0.8220156481664611 },
// { id: 2, start: 1.0512535626298245, end: 2.3398869619825127, confidence: 0.9008811707860472 },
// ...
// ]
// ]
// Display result
console.table(result[0], ['start', 'end', 'id', 'confidence']);
// ┌─────────┬────────────────────┬────────────────────┬────┬─────────────────────┐
// │ (index) │ start │ end │ id │ confidence │
// ├─────────┼────────────────────┼────────────────────┼────┼─────────────────────┤
// │ 0 │ 0 │ 1.0512535626298245 │ 0 │ 0.8220156481664611 │
// │ 1 │ 1.0512535626298245 │ 2.3398869619825127 │ 2 │ 0.9008811707860472 │
// │ 2 │ 2.3398869619825127 │ 3.5946089560890773 │ 0 │ 0.7521651315796233 │
// │ 3 │ 3.5946089560890773 │ 4.578039708226655 │ 2 │ 0.8491978128022479 │
// │ 4 │ 4.578039708226655 │ 4.594995410849717 │ 0 │ 0.2935352600416393 │
// │ 5 │ 4.594995410849717 │ 6.121008646925269 │ 3 │ 0.6788051309866024 │
// │ 6 │ 6.121008646925269 │ 6.256654267909762 │ 0 │ 0.37125512393851134 │
// │ 7 │ 6.256654267909762 │ 8.630452635138397 │ 2 │ 0.7467035186353542 │
// │ 8 │ 8.630452635138397 │ 10.088643060721703 │ 0 │ 0.7689364814666032 │
// │ 9 │ 10.088643060721703 │ 12.58113134631177 │ 2 │ 0.9123324509131324 │
// │ 10 │ 12.58113134631177 │ 13.005023911888312 │ 0 │ 0.4828358177572041 │
// └─────────┴────────────────────┴────────────────────┴────┴─────────────────────┘
```
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.PyAnnoteForAudioFrameClassification+_call" class="group"></a>
### `pyAnnoteForAudioFrameClassification._call(model_inputs)` ⇒ <code>Promise.&lt;TokenClassifierOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>PyAnnoteForAudioFrameClassification</code>](#module_models.PyAnnoteForAudioFrameClassification)
**Returns**: <code>Promise.&lt;TokenClassifierOutput&gt;</code> - An object containing the model's output logits for sequence classification.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.UniSpeechModel" class="group"></a>
## models.UniSpeechModel
The bare UniSpeech Model transformer outputting raw hidden-states without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.UniSpeechForCTC" class="group"></a>
## models.UniSpeechForCTC
UniSpeech Model with a `language modeling` head on top for Connectionist Temporal Classification (CTC).
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.UniSpeechForCTC+_call" class="group"></a>
### `uniSpeechForCTC._call(model_inputs)`
**Kind**: instance method of [<code>UniSpeechForCTC</code>](#module_models.UniSpeechForCTC)
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td></td>
</tr><tr>
<td>model_inputs.input_values</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>Float values of input raw speech waveform.</p>
</td>
</tr><tr>
<td>model_inputs.attention_mask</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>Mask to avoid performing convolution and attention on padding token indices. Mask values selected in [0, 1]</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.UniSpeechForSequenceClassification" class="group"></a>
## models.UniSpeechForSequenceClassification
UniSpeech Model with a sequence classification head on top (a linear layer over the pooled output).
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.UniSpeechForSequenceClassification+_call" class="group"></a>
### `uniSpeechForSequenceClassification._call(model_inputs)` ⇒ <code>Promise.&lt;SequenceClassifierOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>UniSpeechForSequenceClassification</code>](#module_models.UniSpeechForSequenceClassification)
**Returns**: <code>Promise.&lt;SequenceClassifierOutput&gt;</code> - An object containing the model's output logits for sequence classification.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.UniSpeechSatModel" class="group"></a>
## models.UniSpeechSatModel
The bare UniSpeechSat Model transformer outputting raw hidden-states without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.UniSpeechSatForCTC" class="group"></a>
## models.UniSpeechSatForCTC
UniSpeechSat Model with a `language modeling` head on top for Connectionist Temporal Classification (CTC).
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.UniSpeechSatForCTC+_call" class="group"></a>
### `uniSpeechSatForCTC._call(model_inputs)`
**Kind**: instance method of [<code>UniSpeechSatForCTC</code>](#module_models.UniSpeechSatForCTC)
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td></td>
</tr><tr>
<td>model_inputs.input_values</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>Float values of input raw speech waveform.</p>
</td>
</tr><tr>
<td>model_inputs.attention_mask</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>Mask to avoid performing convolution and attention on padding token indices. Mask values selected in [0, 1]</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.UniSpeechSatForSequenceClassification" class="group"></a>
## models.UniSpeechSatForSequenceClassification
UniSpeechSat Model with a sequence classification head on top (a linear layer over the pooled output).
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.UniSpeechSatForSequenceClassification+_call" class="group"></a>
### `uniSpeechSatForSequenceClassification._call(model_inputs)` ⇒ <code>Promise.&lt;SequenceClassifierOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>UniSpeechSatForSequenceClassification</code>](#module_models.UniSpeechSatForSequenceClassification)
**Returns**: <code>Promise.&lt;SequenceClassifierOutput&gt;</code> - An object containing the model's output logits for sequence classification.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.UniSpeechSatForAudioFrameClassification" class="group"></a>
## models.UniSpeechSatForAudioFrameClassification
UniSpeechSat Model with a frame classification head on top for tasks like Speaker Diarization.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.UniSpeechSatForAudioFrameClassification+_call" class="group"></a>
### `uniSpeechSatForAudioFrameClassification._call(model_inputs)` ⇒ <code>Promise.&lt;TokenClassifierOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>UniSpeechSatForAudioFrameClassification</code>](#module_models.UniSpeechSatForAudioFrameClassification)
**Returns**: <code>Promise.&lt;TokenClassifierOutput&gt;</code> - An object containing the model's output logits for sequence classification.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.Wav2Vec2BertModel" class="group"></a>
## models.Wav2Vec2BertModel
The bare Wav2Vec2Bert Model transformer outputting raw hidden-states without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.Wav2Vec2BertForCTC" class="group"></a>
## models.Wav2Vec2BertForCTC
Wav2Vec2Bert Model with a `language modeling` head on top for Connectionist Temporal Classification (CTC).
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.Wav2Vec2BertForCTC+_call" class="group"></a>
### `wav2Vec2BertForCTC._call(model_inputs)`
**Kind**: instance method of [<code>Wav2Vec2BertForCTC</code>](#module_models.Wav2Vec2BertForCTC)
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td></td>
</tr><tr>
<td>model_inputs.input_features</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>Float values of input mel-spectrogram.</p>
</td>
</tr><tr>
<td>model_inputs.attention_mask</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>Mask to avoid performing convolution and attention on padding token indices. Mask values selected in [0, 1]</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.Wav2Vec2BertForSequenceClassification" class="group"></a>
## models.Wav2Vec2BertForSequenceClassification
Wav2Vec2Bert Model with a sequence classification head on top (a linear layer over the pooled output).
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.Wav2Vec2BertForSequenceClassification+_call" class="group"></a>
### `wav2Vec2BertForSequenceClassification._call(model_inputs)` ⇒ <code>Promise.&lt;SequenceClassifierOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>Wav2Vec2BertForSequenceClassification</code>](#module_models.Wav2Vec2BertForSequenceClassification)
**Returns**: <code>Promise.&lt;SequenceClassifierOutput&gt;</code> - An object containing the model's output logits for sequence classification.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.HubertModel" class="group"></a>
## models.HubertModel
The bare Hubert Model transformer outputting raw hidden-states without any specific head on top.
**Example:** Load and run a `HubertModel` for feature extraction.
```javascript
import { AutoProcessor, AutoModel, read_audio } from '@huggingface/transformers';
// Read and preprocess audio
const processor = await AutoProcessor.from_pretrained('Xenova/hubert-base-ls960');
const audio = await read_audio('https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/jfk.wav', 16000);
const inputs = await processor(audio);
// Load and run model with inputs
const model = await AutoModel.from_pretrained('Xenova/hubert-base-ls960');
const output = await model(inputs);
// {
// last_hidden_state: Tensor {
// dims: [ 1, 549, 768 ],
// type: 'float32',
// data: Float32Array(421632) [0.0682469978928566, 0.08104046434164047, -0.4975186586380005, ...],
// size: 421632
// }
// }
```
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.HubertForCTC" class="group"></a>
## models.HubertForCTC
Hubert Model with a `language modeling` head on top for Connectionist Temporal Classification (CTC).
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.HubertForCTC+_call" class="group"></a>
### `hubertForCTC._call(model_inputs)`
**Kind**: instance method of [<code>HubertForCTC</code>](#module_models.HubertForCTC)
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td></td>
</tr><tr>
<td>model_inputs.input_values</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>Float values of input raw speech waveform.</p>
</td>
</tr><tr>
<td>model_inputs.attention_mask</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>Mask to avoid performing convolution and attention on padding token indices. Mask values selected in [0, 1]</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.HubertForSequenceClassification" class="group"></a>
## models.HubertForSequenceClassification
Hubert Model with a sequence classification head on top (a linear layer over the pooled output) for tasks like SUPERB Keyword Spotting.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.HubertForSequenceClassification+_call" class="group"></a>
### `hubertForSequenceClassification._call(model_inputs)` ⇒ <code>Promise.&lt;SequenceClassifierOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>HubertForSequenceClassification</code>](#module_models.HubertForSequenceClassification)
**Returns**: <code>Promise.&lt;SequenceClassifierOutput&gt;</code> - An object containing the model's output logits for sequence classification.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.WavLMPreTrainedModel" class="group"></a>
## models.WavLMPreTrainedModel
An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained models.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.WavLMModel" class="group"></a>
## models.WavLMModel
The bare WavLM Model transformer outputting raw hidden-states without any specific head on top.
**Example:** Load and run a `WavLMModel` for feature extraction.
```javascript
import { AutoProcessor, AutoModel, read_audio } from '@huggingface/transformers';
// Read and preprocess audio
const processor = await AutoProcessor.from_pretrained('Xenova/wavlm-base');
const audio = await read_audio('https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/jfk.wav', 16000);
const inputs = await processor(audio);
// Run model with inputs
const model = await AutoModel.from_pretrained('Xenova/wavlm-base');
const output = await model(inputs);
// {
// last_hidden_state: Tensor {
// dims: [ 1, 549, 768 ],
// type: 'float32',
// data: Float32Array(421632) [-0.349443256855011, -0.39341306686401367, 0.022836603224277496, ...],
// size: 421632
// }
// }
```
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.WavLMForCTC" class="group"></a>
## models.WavLMForCTC
WavLM Model with a `language modeling` head on top for Connectionist Temporal Classification (CTC).
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.WavLMForCTC+_call" class="group"></a>
### `wavLMForCTC._call(model_inputs)`
**Kind**: instance method of [<code>WavLMForCTC</code>](#module_models.WavLMForCTC)
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td></td>
</tr><tr>
<td>model_inputs.input_values</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>Float values of input raw speech waveform.</p>
</td>
</tr><tr>
<td>model_inputs.attention_mask</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>Mask to avoid performing convolution and attention on padding token indices. Mask values selected in [0, 1]</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.WavLMForSequenceClassification" class="group"></a>
## models.WavLMForSequenceClassification
WavLM Model with a sequence classification head on top (a linear layer over the pooled output).
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.WavLMForSequenceClassification+_call" class="group"></a>
### `wavLMForSequenceClassification._call(model_inputs)` ⇒ <code>Promise.&lt;SequenceClassifierOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>WavLMForSequenceClassification</code>](#module_models.WavLMForSequenceClassification)
**Returns**: <code>Promise.&lt;SequenceClassifierOutput&gt;</code> - An object containing the model's output logits for sequence classification.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.WavLMForXVector" class="group"></a>
## models.WavLMForXVector
WavLM Model with an XVector feature extraction head on top for tasks like Speaker Verification.
**Example:** Extract speaker embeddings with `WavLMForXVector`.
```javascript
import { AutoProcessor, AutoModel, read_audio } from '@huggingface/transformers';
// Read and preprocess audio
const processor = await AutoProcessor.from_pretrained('Xenova/wavlm-base-plus-sv');
const url = 'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/jfk.wav';
const audio = await read_audio(url, 16000);
const inputs = await processor(audio);
// Run model with inputs
const model = await AutoModel.from_pretrained('Xenova/wavlm-base-plus-sv');
const outputs = await model(inputs);
// {
// logits: Tensor {
// dims: [ 1, 512 ],
// type: 'float32',
// data: Float32Array(512) [0.5847219228744507, ...],
// size: 512
// },
// embeddings: Tensor {
// dims: [ 1, 512 ],
// type: 'float32',
// data: Float32Array(512) [-0.09079201519489288, ...],
// size: 512
// }
// }
```
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.WavLMForXVector+_call" class="group"></a>
### `wavLMForXVector._call(model_inputs)` ⇒ <code>Promise.&lt;XVectorOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>WavLMForXVector</code>](#module_models.WavLMForXVector)
**Returns**: <code>Promise.&lt;XVectorOutput&gt;</code> - An object containing the model's output logits and speaker embeddings.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.WavLMForAudioFrameClassification" class="group"></a>
## models.WavLMForAudioFrameClassification
WavLM Model with a frame classification head on top for tasks like Speaker Diarization.
**Example:** Perform speaker diarization with `WavLMForAudioFrameClassification`.
```javascript
import { AutoProcessor, AutoModelForAudioFrameClassification, read_audio } from '@huggingface/transformers';
// Read and preprocess audio
const processor = await AutoProcessor.from_pretrained('Xenova/wavlm-base-plus-sd');
const url = 'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/jfk.wav';
const audio = await read_audio(url, 16000);
const inputs = await processor(audio);
// Run model with inputs
const model = await AutoModelForAudioFrameClassification.from_pretrained('Xenova/wavlm-base-plus-sd');
const { logits } = await model(inputs);
// {
// logits: Tensor {
// dims: [ 1, 549, 2 ], // [batch_size, num_frames, num_speakers]
// type: 'float32',
// data: Float32Array(1098) [-3.5301010608673096, ...],
// size: 1098
// }
// }
const labels = logits[0].sigmoid().tolist().map(
frames => frames.map(speaker => speaker > 0.5 ? 1 : 0)
);
console.log(labels); // labels is a one-hot array of shape (num_frames, num_speakers)
// [
// [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0],
// [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0],
// [0, 0], [0, 1], [0, 1], [0, 1], [0, 1], [0, 1],
// ...
// ]
```
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.WavLMForAudioFrameClassification+_call" class="group"></a>
### `wavLMForAudioFrameClassification._call(model_inputs)` ⇒ <code>Promise.&lt;TokenClassifierOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>WavLMForAudioFrameClassification</code>](#module_models.WavLMForAudioFrameClassification)
**Returns**: <code>Promise.&lt;TokenClassifierOutput&gt;</code> - An object containing the model's output logits for sequence classification.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.SpeechT5PreTrainedModel" class="group"></a>
## models.SpeechT5PreTrainedModel
An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained models.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.SpeechT5Model" class="group"></a>
## models.SpeechT5Model
The bare SpeechT5 Encoder-Decoder Model outputting raw hidden-states without any specific pre- or post-nets.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.SpeechT5ForSpeechToText" class="group"></a>
## models.SpeechT5ForSpeechToText
SpeechT5 Model with a speech encoder and a text decoder.
**Example:** Generate speech from text with `SpeechT5ForSpeechToText`.
```javascript
import { AutoTokenizer, AutoProcessor, SpeechT5ForTextToSpeech, SpeechT5HifiGan, Tensor } from '@huggingface/transformers';
// Load the tokenizer and processor
const tokenizer = await AutoTokenizer.from_pretrained('Xenova/speecht5_tts');
const processor = await AutoProcessor.from_pretrained('Xenova/speecht5_tts');
// Load the models
// NOTE: We use the full-precision versions as they are more accurate
const model = await SpeechT5ForTextToSpeech.from_pretrained('Xenova/speecht5_tts', { dtype: 'fp32' });
const vocoder = await SpeechT5HifiGan.from_pretrained('Xenova/speecht5_hifigan', { dtype: 'fp32' });
// Load speaker embeddings from URL
const speaker_embeddings_data = new Float32Array(
await (await fetch('https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/speaker_embeddings.bin')).arrayBuffer()
);
const speaker_embeddings = new Tensor(
'float32',
speaker_embeddings_data,
[1, speaker_embeddings_data.length]
)
// Run tokenization
const { input_ids } = tokenizer('Hello, my dog is cute');
// Generate waveform
const { waveform } = await model.generate_speech(input_ids, speaker_embeddings, { vocoder });
console.log(waveform)
// Tensor {
// dims: [ 26112 ],
// type: 'float32',
// size: 26112,
// data: Float32Array(26112) [ -0.00043630177970044315, -0.00018082228780258447, ... ],
// }
```
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.SpeechT5ForTextToSpeech" class="group"></a>
## models.SpeechT5ForTextToSpeech
SpeechT5 Model with a text encoder and a speech decoder.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.SpeechT5ForTextToSpeech+generate_speech" class="group"></a>
### `speechT5ForTextToSpeech.generate_speech(input_values, speaker_embeddings, options)` ⇒ <code>Promise.&lt;SpeechOutput&gt;</code>
Converts a sequence of input tokens into a sequence of mel spectrograms, which are subsequently turned into a speech waveform using a vocoder.
**Kind**: instance method of [<code>SpeechT5ForTextToSpeech</code>](#module_models.SpeechT5ForTextToSpeech)
**Returns**: <code>Promise.&lt;SpeechOutput&gt;</code> - A promise which resolves to an object containing the spectrogram, waveform, and cross-attention tensors.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Default</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>input_values</td><td><code><a href="#Tensor">Tensor</a></code></td><td></td><td><p>Indices of input sequence tokens in the vocabulary.</p>
</td>
</tr><tr>
<td>speaker_embeddings</td><td><code><a href="#Tensor">Tensor</a></code></td><td></td><td><p>Tensor containing the speaker embeddings.</p>
</td>
</tr><tr>
<td>options</td><td><code>Object</code></td><td></td><td><p>Optional parameters for generating speech.</p>
</td>
</tr><tr>
<td>[options.threshold]</td><td><code>number</code></td><td><code>0.5</code></td><td><p>The generated sequence ends when the predicted stop token probability exceeds this value.</p>
</td>
</tr><tr>
<td>[options.minlenratio]</td><td><code>number</code></td><td><code>0.0</code></td><td><p>Used to calculate the minimum required length for the output sequence.</p>
</td>
</tr><tr>
<td>[options.maxlenratio]</td><td><code>number</code></td><td><code>20.0</code></td><td><p>Used to calculate the maximum allowed length for the output sequence.</p>
</td>
</tr><tr>
<td>[options.vocoder]</td><td><code>Object</code></td><td><code></code></td><td><p>The vocoder that converts the mel spectrogram into a speech waveform. If <code>null</code>, the output is the mel spectrogram.</p>
</td>
</tr><tr>
<td>[options.output_cross_attentions]</td><td><code>boolean</code></td><td><code>false</code></td><td><p>Whether or not to return the attentions tensors of the decoder&#39;s cross-attention layers.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.SpeechT5HifiGan" class="group"></a>
## models.SpeechT5HifiGan
HiFi-GAN vocoder.
See [SpeechT5ForSpeechToText](./models#module_models.SpeechT5ForSpeechToText) for example usage.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.TrOCRForCausalLM" class="group"></a>
## models.TrOCRForCausalLM
The TrOCR Decoder with a language modeling head.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.MistralPreTrainedModel" class="group"></a>
## models.MistralPreTrainedModel
The bare Mistral Model outputting raw hidden-states without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.Starcoder2PreTrainedModel" class="group"></a>
## models.Starcoder2PreTrainedModel
The bare Starcoder2 Model outputting raw hidden-states without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.FalconPreTrainedModel" class="group"></a>
## models.FalconPreTrainedModel
The bare Falcon Model outputting raw hidden-states without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.ClapTextModelWithProjection" class="group"></a>
## models.ClapTextModelWithProjection
CLAP Text Model with a projection layer on top (a linear layer on top of the pooled output).
**Example:** Compute text embeddings with `ClapTextModelWithProjection`.
```javascript
import { AutoTokenizer, ClapTextModelWithProjection } from '@huggingface/transformers';
// Load tokenizer and text model
const tokenizer = await AutoTokenizer.from_pretrained('Xenova/clap-htsat-unfused');
const text_model = await ClapTextModelWithProjection.from_pretrained('Xenova/clap-htsat-unfused');
// Run tokenization
const texts = ['a sound of a cat', 'a sound of a dog'];
const text_inputs = tokenizer(texts, { padding: true, truncation: true });
// Compute embeddings
const { text_embeds } = await text_model(text_inputs);
// Tensor {
// dims: [ 2, 512 ],
// type: 'float32',
// data: Float32Array(1024) [ ... ],
// size: 1024
// }
```
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.ClapTextModelWithProjection.from_pretrained" class="group"></a>
### `ClapTextModelWithProjection.from_pretrained()` : <code>*</code>
**Kind**: static method of [<code>ClapTextModelWithProjection</code>](#module_models.ClapTextModelWithProjection)
* * *
<a id="module_models.ClapAudioModelWithProjection" class="group"></a>
## models.ClapAudioModelWithProjection
CLAP Audio Model with a projection layer on top (a linear layer on top of the pooled output).
**Example:** Compute audio embeddings with `ClapAudioModelWithProjection`.
```javascript
import { AutoProcessor, ClapAudioModelWithProjection, read_audio } from '@huggingface/transformers';
// Load processor and audio model
const processor = await AutoProcessor.from_pretrained('Xenova/clap-htsat-unfused');
const audio_model = await ClapAudioModelWithProjection.from_pretrained('Xenova/clap-htsat-unfused');
// Read audio and run processor
const audio = await read_audio('https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/cat_meow.wav');
const audio_inputs = await processor(audio);
// Compute embeddings
const { audio_embeds } = await audio_model(audio_inputs);
// Tensor {
// dims: [ 1, 512 ],
// type: 'float32',
// data: Float32Array(512) [ ... ],
// size: 512
// }
```
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.ClapAudioModelWithProjection.from_pretrained" class="group"></a>
### `ClapAudioModelWithProjection.from_pretrained()` : <code>*</code>
**Kind**: static method of [<code>ClapAudioModelWithProjection</code>](#module_models.ClapAudioModelWithProjection)
* * *
<a id="module_models.VitsModel" class="group"></a>
## models.VitsModel
The complete VITS model, for text-to-speech synthesis.
**Example:** Generate speech from text with `VitsModel`.
```javascript
import { AutoTokenizer, VitsModel } from '@huggingface/transformers';
// Load the tokenizer and model
const tokenizer = await AutoTokenizer.from_pretrained('Xenova/mms-tts-eng');
const model = await VitsModel.from_pretrained('Xenova/mms-tts-eng');
// Run tokenization
const inputs = tokenizer('I love transformers');
// Generate waveform
const { waveform } = await model(inputs);
// Tensor {
// dims: [ 1, 35328 ],
// type: 'float32',
// data: Float32Array(35328) [ ... ],
// size: 35328,
// }
```
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.VitsModel+_call" class="group"></a>
### `vitsModel._call(model_inputs)` ⇒ <code>Promise.&lt;VitsModelOutput&gt;</code>
Calls the model on new inputs.
**Kind**: instance method of [<code>VitsModel</code>](#module_models.VitsModel)
**Returns**: <code>Promise.&lt;VitsModelOutput&gt;</code> - The outputs for the VITS model.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>Object</code></td><td><p>The inputs to the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.SegformerModel" class="group"></a>
## models.SegformerModel
The bare SegFormer encoder (Mix-Transformer) outputting raw hidden-states without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.SegformerForImageClassification" class="group"></a>
## models.SegformerForImageClassification
SegFormer Model transformer with an image classification head on top (a linear layer on top of the final hidden states) e.g. for ImageNet.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.SegformerForSemanticSegmentation" class="group"></a>
## models.SegformerForSemanticSegmentation
SegFormer Model transformer with an all-MLP decode head on top e.g. for ADE20k, CityScapes.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.StableLmModel" class="group"></a>
## models.StableLmModel
The bare StableLm Model transformer outputting raw hidden-states without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.StableLmForCausalLM" class="group"></a>
## models.StableLmForCausalLM
StableLm Model with a `language modeling` head on top for Causal Language Modeling (with past).
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.EfficientNetModel" class="group"></a>
## models.EfficientNetModel
The bare EfficientNet model outputting raw features without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.EfficientNetForImageClassification" class="group"></a>
## models.EfficientNetForImageClassification
EfficientNet Model with an image classification head on top (a linear layer on top of the pooled features).
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.EfficientNetForImageClassification+_call" class="group"></a>
### `efficientNetForImageClassification._call(model_inputs)`
**Kind**: instance method of [<code>EfficientNetForImageClassification</code>](#module_models.EfficientNetForImageClassification)
<table>
<thead>
<tr>
<th>Param</th><th>Type</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>any</code></td>
</tr> </tbody>
</table>
* * *
<a id="module_models.MusicgenModel" class="group"></a>
## models.MusicgenModel
The bare Musicgen decoder model outputting raw hidden-states without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.MusicgenForCausalLM" class="group"></a>
## models.MusicgenForCausalLM
The MusicGen decoder model with a language modelling head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.MusicgenForConditionalGeneration" class="group"></a>
## models.MusicgenForConditionalGeneration
The composite MusicGen model with a text encoder, audio encoder and Musicgen decoder,
for music generation tasks with one or both of text and audio prompts.
**Example:** Generate music from text with `Xenova/musicgen-small`.
```javascript
import { AutoTokenizer, MusicgenForConditionalGeneration } from '@huggingface/transformers';
// Load tokenizer and model
const tokenizer = await AutoTokenizer.from_pretrained('Xenova/musicgen-small');
const model = await MusicgenForConditionalGeneration.from_pretrained(
'Xenova/musicgen-small', { dtype: 'fp32' }
);
// Prepare text input
const prompt = '80s pop track with bassy drums and synth';
const inputs = tokenizer(prompt);
// Generate audio
const audio_values = await model.generate({
...inputs,
max_new_tokens: 512,
do_sample: true,
guidance_scale: 3,
});
// (Optional) Write the output to a WAV file
import wavefile from 'wavefile';
import fs from 'fs';
const wav = new wavefile.WaveFile();
wav.fromScratch(1, model.config.audio_encoder.sampling_rate, '32f', audio_values.data);
fs.writeFileSync('musicgen_out.wav', wav.toBuffer());
```
**Kind**: static class of [<code>models</code>](#module_models)
* [.MusicgenForConditionalGeneration](#module_models.MusicgenForConditionalGeneration)
* [`._apply_and_filter_by_delay_pattern_mask(outputs)`](#module_models.MusicgenForConditionalGeneration+_apply_and_filter_by_delay_pattern_mask) ⇒ [<code>Tensor</code>](#Tensor)
* [`.generate(options)`](#module_models.MusicgenForConditionalGeneration+generate) ⇒ <code>Promise.&lt;(ModelOutput|Tensor)&gt;</code>
* * *
<a id="module_models.MusicgenForConditionalGeneration+_apply_and_filter_by_delay_pattern_mask" class="group"></a>
### `musicgenForConditionalGeneration._apply_and_filter_by_delay_pattern_mask(outputs)` ⇒ [<code>Tensor</code>](#Tensor)
Apply the pattern mask to the final ids,
then revert the pattern delay mask by filtering the pad token id in a single step.
**Kind**: instance method of [<code>MusicgenForConditionalGeneration</code>](#module_models.MusicgenForConditionalGeneration)
**Returns**: [<code>Tensor</code>](#Tensor) - The filtered output tensor.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>outputs</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>The output tensor from the model.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.MusicgenForConditionalGeneration+generate" class="group"></a>
### `musicgenForConditionalGeneration.generate(options)` ⇒ <code>Promise.&lt;(ModelOutput|Tensor)&gt;</code>
Generates sequences of token ids for models with a language modeling head.
**Kind**: instance method of [<code>MusicgenForConditionalGeneration</code>](#module_models.MusicgenForConditionalGeneration)
**Returns**: <code>Promise.&lt;(ModelOutput|Tensor)&gt;</code> - The output of the model, which can contain the generated token ids, attentions, and scores.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th>
</tr>
</thead>
<tbody>
<tr>
<td>options</td><td><code>*</code></td>
</tr> </tbody>
</table>
* * *
<a id="module_models.MobileNetV1Model" class="group"></a>
## models.MobileNetV1Model
The bare MobileNetV1 model outputting raw hidden-states without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.MobileNetV1ForImageClassification" class="group"></a>
## models.MobileNetV1ForImageClassification
MobileNetV1 model with an image classification head on top (a linear layer on top of the pooled features),
e.g. for ImageNet.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.MobileNetV1ForImageClassification+_call" class="group"></a>
### `mobileNetV1ForImageClassification._call(model_inputs)`
**Kind**: instance method of [<code>MobileNetV1ForImageClassification</code>](#module_models.MobileNetV1ForImageClassification)
<table>
<thead>
<tr>
<th>Param</th><th>Type</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>any</code></td>
</tr> </tbody>
</table>
* * *
<a id="module_models.MobileNetV2Model" class="group"></a>
## models.MobileNetV2Model
The bare MobileNetV2 model outputting raw hidden-states without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.MobileNetV2ForImageClassification" class="group"></a>
## models.MobileNetV2ForImageClassification
MobileNetV2 model with an image classification head on top (a linear layer on top of the pooled features),
e.g. for ImageNet.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.MobileNetV2ForImageClassification+_call" class="group"></a>
### `mobileNetV2ForImageClassification._call(model_inputs)`
**Kind**: instance method of [<code>MobileNetV2ForImageClassification</code>](#module_models.MobileNetV2ForImageClassification)
<table>
<thead>
<tr>
<th>Param</th><th>Type</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>any</code></td>
</tr> </tbody>
</table>
* * *
<a id="module_models.MobileNetV3Model" class="group"></a>
## models.MobileNetV3Model
The bare MobileNetV3 model outputting raw hidden-states without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.MobileNetV3ForImageClassification" class="group"></a>
## models.MobileNetV3ForImageClassification
MobileNetV3 model with an image classification head on top (a linear layer on top of the pooled features),
e.g. for ImageNet.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.MobileNetV3ForImageClassification+_call" class="group"></a>
### `mobileNetV3ForImageClassification._call(model_inputs)`
**Kind**: instance method of [<code>MobileNetV3ForImageClassification</code>](#module_models.MobileNetV3ForImageClassification)
<table>
<thead>
<tr>
<th>Param</th><th>Type</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>any</code></td>
</tr> </tbody>
</table>
* * *
<a id="module_models.MobileNetV4Model" class="group"></a>
## models.MobileNetV4Model
The bare MobileNetV4 model outputting raw hidden-states without any specific head on top.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.MobileNetV4ForImageClassification" class="group"></a>
## models.MobileNetV4ForImageClassification
MobileNetV4 model with an image classification head on top (a linear layer on top of the pooled features),
e.g. for ImageNet.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.MobileNetV4ForImageClassification+_call" class="group"></a>
### `mobileNetV4ForImageClassification._call(model_inputs)`
**Kind**: instance method of [<code>MobileNetV4ForImageClassification</code>](#module_models.MobileNetV4ForImageClassification)
<table>
<thead>
<tr>
<th>Param</th><th>Type</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>any</code></td>
</tr> </tbody>
</table>
* * *
<a id="module_models.DecisionTransformerModel" class="group"></a>
## models.DecisionTransformerModel
The model builds upon the GPT2 architecture to perform autoregressive prediction of actions in an offline RL setting.
Refer to the paper for more details: https://huggingface.co/papers/2106.01345
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.MultiModalityCausalLM" class="group"></a>
## models.MultiModalityCausalLM
**Kind**: static class of [<code>models</code>](#module_models)
* [.MultiModalityCausalLM](#module_models.MultiModalityCausalLM)
* [`new MultiModalityCausalLM(...args)`](#new_module_models.MultiModalityCausalLM_new)
* [`.generate(options)`](#module_models.MultiModalityCausalLM+generate)
* [`.generate_images(options)`](#module_models.MultiModalityCausalLM+generate_images)
* * *
<a id="new_module_models.MultiModalityCausalLM_new" class="group"></a>
### `new MultiModalityCausalLM(...args)`
<table>
<thead>
<tr>
<th>Param</th><th>Type</th>
</tr>
</thead>
<tbody>
<tr>
<td>...args</td><td><code>*</code></td>
</tr> </tbody>
</table>
* * *
<a id="module_models.MultiModalityCausalLM+generate" class="group"></a>
### `multiModalityCausalLM.generate(options)`
**Kind**: instance method of [<code>MultiModalityCausalLM</code>](#module_models.MultiModalityCausalLM)
<table>
<thead>
<tr>
<th>Param</th><th>Type</th>
</tr>
</thead>
<tbody>
<tr>
<td>options</td><td><code>*</code></td>
</tr> </tbody>
</table>
* * *
<a id="module_models.MultiModalityCausalLM+generate_images" class="group"></a>
### `multiModalityCausalLM.generate_images(options)`
**Kind**: instance method of [<code>MultiModalityCausalLM</code>](#module_models.MultiModalityCausalLM)
<table>
<thead>
<tr>
<th>Param</th><th>Type</th>
</tr>
</thead>
<tbody>
<tr>
<td>options</td><td><code>*</code></td>
</tr> </tbody>
</table>
* * *
<a id="module_models.MgpstrForSceneTextRecognition" class="group"></a>
## models.MgpstrForSceneTextRecognition
MGP-STR Model transformer with three classification heads on top
(three A^3 modules and three linear layer on top of the transformer encoder output) for scene text recognition (STR).
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.MgpstrForSceneTextRecognition+_call" class="group"></a>
### `mgpstrForSceneTextRecognition._call(model_inputs)`
**Kind**: instance method of [<code>MgpstrForSceneTextRecognition</code>](#module_models.MgpstrForSceneTextRecognition)
<table>
<thead>
<tr>
<th>Param</th><th>Type</th>
</tr>
</thead>
<tbody>
<tr>
<td>model_inputs</td><td><code>any</code></td>
</tr> </tbody>
</table>
* * *
<a id="module_models.PatchTSTModel" class="group"></a>
## models.PatchTSTModel
The bare PatchTST Model outputting raw hidden-states without any specific head.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.PatchTSTForPrediction" class="group"></a>
## models.PatchTSTForPrediction
The PatchTST for prediction model.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.PatchTSMixerModel" class="group"></a>
## models.PatchTSMixerModel
The bare PatchTSMixer Model outputting raw hidden-states without any specific head.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.PatchTSMixerForPrediction" class="group"></a>
## models.PatchTSMixerForPrediction
The PatchTSMixer for prediction model.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="module_models.MimiEncoderOutput" class="group"></a>
## models.MimiEncoderOutput
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="new_module_models.MimiEncoderOutput_new" class="group"></a>
### `new MimiEncoderOutput(output)`
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>output</td><td><code>Object</code></td><td><p>The output of the model.</p>
</td>
</tr><tr>
<td>output.audio_codes</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>Discrete code embeddings, of shape <code>(batch_size, num_quantizers, codes_length)</code>.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.MimiDecoderOutput" class="group"></a>
## models.MimiDecoderOutput
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="new_module_models.MimiDecoderOutput_new" class="group"></a>
### `new MimiDecoderOutput(output)`
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>output</td><td><code>Object</code></td><td><p>The output of the model.</p>
</td>
</tr><tr>
<td>output.audio_values</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>Decoded audio values, of shape <code>(batch_size, num_channels, sequence_length)</code>.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.MimiModel" class="group"></a>
## models.MimiModel
The Mimi neural audio codec model.
**Kind**: static class of [<code>models</code>](#module_models)
* [.MimiModel](#module_models.MimiModel)
* [`.encode(inputs)`](#module_models.MimiModel+encode) ⇒ <code>Promise.&lt;MimiEncoderOutput&gt;</code>
* [`.decode(inputs)`](#module_models.MimiModel+decode) ⇒ <code>Promise.&lt;MimiDecoderOutput&gt;</code>
* * *
<a id="module_models.MimiModel+encode" class="group"></a>
### `mimiModel.encode(inputs)` ⇒ <code>Promise.&lt;MimiEncoderOutput&gt;</code>
Encodes the input audio waveform into discrete codes.
**Kind**: instance method of [<code>MimiModel</code>](#module_models.MimiModel)
**Returns**: <code>Promise.&lt;MimiEncoderOutput&gt;</code> - The output tensor of shape `(batch_size, num_codebooks, sequence_length)`.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>inputs</td><td><code>Object</code></td><td><p>Model inputs</p>
</td>
</tr><tr>
<td>[inputs.input_values]</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>Float values of the input audio waveform, of shape <code>(batch_size, channels, sequence_length)</code>).</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.MimiModel+decode" class="group"></a>
### `mimiModel.decode(inputs)` ⇒ <code>Promise.&lt;MimiDecoderOutput&gt;</code>
Decodes the given frames into an output audio waveform.
**Kind**: instance method of [<code>MimiModel</code>](#module_models.MimiModel)
**Returns**: <code>Promise.&lt;MimiDecoderOutput&gt;</code> - The output tensor of shape `(batch_size, num_channels, sequence_length)`.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>inputs</td><td><code>MimiEncoderOutput</code></td><td><p>The encoded audio codes.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.DacEncoderOutput" class="group"></a>
## models.DacEncoderOutput
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="new_module_models.DacEncoderOutput_new" class="group"></a>
### `new DacEncoderOutput(output)`
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>output</td><td><code>Object</code></td><td><p>The output of the model.</p>
</td>
</tr><tr>
<td>output.audio_codes</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>Discrete code embeddings, of shape <code>(batch_size, num_quantizers, codes_length)</code>.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.DacDecoderOutput" class="group"></a>
## models.DacDecoderOutput
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="new_module_models.DacDecoderOutput_new" class="group"></a>
### `new DacDecoderOutput(output)`
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>output</td><td><code>Object</code></td><td><p>The output of the model.</p>
</td>
</tr><tr>
<td>output.audio_values</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>Decoded audio values, of shape <code>(batch_size, num_channels, sequence_length)</code>.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.DacModel" class="group"></a>
## models.DacModel
The DAC (Descript Audio Codec) model.
**Kind**: static class of [<code>models</code>](#module_models)
* [.DacModel](#module_models.DacModel)
* [`.encode(inputs)`](#module_models.DacModel+encode) ⇒ <code>Promise.&lt;DacEncoderOutput&gt;</code>
* [`.decode(inputs)`](#module_models.DacModel+decode) ⇒ <code>Promise.&lt;DacDecoderOutput&gt;</code>
* * *
<a id="module_models.DacModel+encode" class="group"></a>
### `dacModel.encode(inputs)` ⇒ <code>Promise.&lt;DacEncoderOutput&gt;</code>
Encodes the input audio waveform into discrete codes.
**Kind**: instance method of [<code>DacModel</code>](#module_models.DacModel)
**Returns**: <code>Promise.&lt;DacEncoderOutput&gt;</code> - The output tensor of shape `(batch_size, num_codebooks, sequence_length)`.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>inputs</td><td><code>Object</code></td><td><p>Model inputs</p>
</td>
</tr><tr>
<td>[inputs.input_values]</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>Float values of the input audio waveform, of shape <code>(batch_size, channels, sequence_length)</code>).</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.DacModel+decode" class="group"></a>
### `dacModel.decode(inputs)` ⇒ <code>Promise.&lt;DacDecoderOutput&gt;</code>
Decodes the given frames into an output audio waveform.
**Kind**: instance method of [<code>DacModel</code>](#module_models.DacModel)
**Returns**: <code>Promise.&lt;DacDecoderOutput&gt;</code> - The output tensor of shape `(batch_size, num_channels, sequence_length)`.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>inputs</td><td><code>DacEncoderOutput</code></td><td><p>The encoded audio codes.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.SnacModel" class="group"></a>
## models.SnacModel
The SNAC (Multi-Scale Neural Audio Codec) model.
**Kind**: static class of [<code>models</code>](#module_models)
* [.SnacModel](#module_models.SnacModel)
* [`.encode(inputs)`](#module_models.SnacModel+encode) ⇒ <code>Promise.&lt;Record&lt;string, Tensor&gt;&gt;</code>
* [`.decode(inputs)`](#module_models.SnacModel+decode) ⇒ <code>Promise.&lt;{audio_values: Tensor}&gt;</code>
* * *
<a id="module_models.SnacModel+encode" class="group"></a>
### `snacModel.encode(inputs)` ⇒ <code>Promise.&lt;Record&lt;string, Tensor&gt;&gt;</code>
Encodes the input audio waveform into discrete codes.
**Kind**: instance method of [<code>SnacModel</code>](#module_models.SnacModel)
**Returns**: <code>Promise.&lt;Record&lt;string, Tensor&gt;&gt;</code> - The output tensors of shape `(batch_size, num_codebooks, sequence_length)`.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>inputs</td><td><code>Object</code></td><td><p>Model inputs</p>
</td>
</tr><tr>
<td>[inputs.input_values]</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>Float values of the input audio waveform, of shape <code>(batch_size, channels, sequence_length)</code>).</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.SnacModel+decode" class="group"></a>
### `snacModel.decode(inputs)` ⇒ <code>Promise.&lt;{audio_values: Tensor}&gt;</code>
Decodes the given frames into an output audio waveform.
**Kind**: instance method of [<code>SnacModel</code>](#module_models.SnacModel)
**Returns**: <code>Promise.&lt;{audio_values: Tensor}&gt;</code> - The output tensor of shape `(batch_size, num_channels, sequence_length)`.
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>inputs</td><td><code>Record.&lt;string, Tensor&gt;</code></td><td><p>The encoded audio codes.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.PretrainedMixin" class="group"></a>
## models.PretrainedMixin
Base class of all AutoModels. Contains the `from_pretrained` function
which is used to instantiate pretrained models.
**Kind**: static class of [<code>models</code>](#module_models)
* [.PretrainedMixin](#module_models.PretrainedMixin)
* _instance_
* [`.MODEL_CLASS_MAPPINGS`](#module_models.PretrainedMixin+MODEL_CLASS_MAPPINGS) : <code>*</code>
* [`.BASE_IF_FAIL`](#module_models.PretrainedMixin+BASE_IF_FAIL)
* _static_
* [`.from_pretrained()`](#module_models.PretrainedMixin.from_pretrained) : <code>*</code>
* * *
<a id="module_models.PretrainedMixin+MODEL_CLASS_MAPPINGS" class="group"></a>
### `pretrainedMixin.MODEL_CLASS_MAPPINGS` : <code>*</code>
Mapping from model type to model class.
**Kind**: instance property of [<code>PretrainedMixin</code>](#module_models.PretrainedMixin)
* * *
<a id="module_models.PretrainedMixin+BASE_IF_FAIL" class="group"></a>
### `pretrainedMixin.BASE_IF_FAIL`
Whether to attempt to instantiate the base class (`PretrainedModel`) if
the model type is not found in the mapping.
**Kind**: instance property of [<code>PretrainedMixin</code>](#module_models.PretrainedMixin)
* * *
<a id="module_models.PretrainedMixin.from_pretrained" class="group"></a>
### `PretrainedMixin.from_pretrained()` : <code>*</code>
**Kind**: static method of [<code>PretrainedMixin</code>](#module_models.PretrainedMixin)
* * *
<a id="module_models.AutoModel" class="group"></a>
## models.AutoModel
Helper class which is used to instantiate pretrained models with the `from_pretrained` function.
The chosen model class is determined by the type specified in the model config.
**Kind**: static class of [<code>models</code>](#module_models)
* [.AutoModel](#module_models.AutoModel)
* [`new AutoModel()`](#new_module_models.AutoModel_new)
* [`.MODEL_CLASS_MAPPINGS`](#module_models.AutoModel+MODEL_CLASS_MAPPINGS) : <code>*</code>
* * *
<a id="new_module_models.AutoModel_new" class="group"></a>
### `new AutoModel()`
**Example**
```js
let model = await AutoModel.from_pretrained('Xenova/bert-base-uncased');
```
* * *
<a id="module_models.AutoModel+MODEL_CLASS_MAPPINGS" class="group"></a>
### `autoModel.MODEL_CLASS_MAPPINGS` : <code>*</code>
**Kind**: instance property of [<code>AutoModel</code>](#module_models.AutoModel)
* * *
<a id="module_models.AutoModelForSequenceClassification" class="group"></a>
## models.AutoModelForSequenceClassification
Helper class which is used to instantiate pretrained sequence classification models with the `from_pretrained` function.
The chosen model class is determined by the type specified in the model config.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="new_module_models.AutoModelForSequenceClassification_new" class="group"></a>
### `new AutoModelForSequenceClassification()`
**Example**
```js
let model = await AutoModelForSequenceClassification.from_pretrained('Xenova/distilbert-base-uncased-finetuned-sst-2-english');
```
* * *
<a id="module_models.AutoModelForTokenClassification" class="group"></a>
## models.AutoModelForTokenClassification
Helper class which is used to instantiate pretrained token classification models with the `from_pretrained` function.
The chosen model class is determined by the type specified in the model config.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="new_module_models.AutoModelForTokenClassification_new" class="group"></a>
### `new AutoModelForTokenClassification()`
**Example**
```js
let model = await AutoModelForTokenClassification.from_pretrained('Xenova/distilbert-base-multilingual-cased-ner-hrl');
```
* * *
<a id="module_models.AutoModelForSeq2SeqLM" class="group"></a>
## models.AutoModelForSeq2SeqLM
Helper class which is used to instantiate pretrained sequence-to-sequence models with the `from_pretrained` function.
The chosen model class is determined by the type specified in the model config.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="new_module_models.AutoModelForSeq2SeqLM_new" class="group"></a>
### `new AutoModelForSeq2SeqLM()`
**Example**
```js
let model = await AutoModelForSeq2SeqLM.from_pretrained('Xenova/t5-small');
```
* * *
<a id="module_models.AutoModelForSpeechSeq2Seq" class="group"></a>
## models.AutoModelForSpeechSeq2Seq
Helper class which is used to instantiate pretrained sequence-to-sequence speech-to-text models with the `from_pretrained` function.
The chosen model class is determined by the type specified in the model config.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="new_module_models.AutoModelForSpeechSeq2Seq_new" class="group"></a>
### `new AutoModelForSpeechSeq2Seq()`
**Example**
```js
let model = await AutoModelForSpeechSeq2Seq.from_pretrained('openai/whisper-tiny.en');
```
* * *
<a id="module_models.AutoModelForTextToSpectrogram" class="group"></a>
## models.AutoModelForTextToSpectrogram
Helper class which is used to instantiate pretrained sequence-to-sequence text-to-spectrogram models with the `from_pretrained` function.
The chosen model class is determined by the type specified in the model config.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="new_module_models.AutoModelForTextToSpectrogram_new" class="group"></a>
### `new AutoModelForTextToSpectrogram()`
**Example**
```js
let model = await AutoModelForTextToSpectrogram.from_pretrained('microsoft/speecht5_tts');
```
* * *
<a id="module_models.AutoModelForTextToWaveform" class="group"></a>
## models.AutoModelForTextToWaveform
Helper class which is used to instantiate pretrained text-to-waveform models with the `from_pretrained` function.
The chosen model class is determined by the type specified in the model config.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="new_module_models.AutoModelForTextToWaveform_new" class="group"></a>
### `new AutoModelForTextToWaveform()`
**Example**
```js
let model = await AutoModelForTextToSpectrogram.from_pretrained('facebook/mms-tts-eng');
```
* * *
<a id="module_models.AutoModelForCausalLM" class="group"></a>
## models.AutoModelForCausalLM
Helper class which is used to instantiate pretrained causal language models with the `from_pretrained` function.
The chosen model class is determined by the type specified in the model config.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="new_module_models.AutoModelForCausalLM_new" class="group"></a>
### `new AutoModelForCausalLM()`
**Example**
```js
let model = await AutoModelForCausalLM.from_pretrained('Xenova/gpt2');
```
* * *
<a id="module_models.AutoModelForMaskedLM" class="group"></a>
## models.AutoModelForMaskedLM
Helper class which is used to instantiate pretrained masked language models with the `from_pretrained` function.
The chosen model class is determined by the type specified in the model config.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="new_module_models.AutoModelForMaskedLM_new" class="group"></a>
### `new AutoModelForMaskedLM()`
**Example**
```js
let model = await AutoModelForMaskedLM.from_pretrained('Xenova/bert-base-uncased');
```
* * *
<a id="module_models.AutoModelForQuestionAnswering" class="group"></a>
## models.AutoModelForQuestionAnswering
Helper class which is used to instantiate pretrained question answering models with the `from_pretrained` function.
The chosen model class is determined by the type specified in the model config.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="new_module_models.AutoModelForQuestionAnswering_new" class="group"></a>
### `new AutoModelForQuestionAnswering()`
**Example**
```js
let model = await AutoModelForQuestionAnswering.from_pretrained('Xenova/distilbert-base-cased-distilled-squad');
```
* * *
<a id="module_models.AutoModelForVision2Seq" class="group"></a>
## models.AutoModelForVision2Seq
Helper class which is used to instantiate pretrained vision-to-sequence models with the `from_pretrained` function.
The chosen model class is determined by the type specified in the model config.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="new_module_models.AutoModelForVision2Seq_new" class="group"></a>
### `new AutoModelForVision2Seq()`
**Example**
```js
let model = await AutoModelForVision2Seq.from_pretrained('Xenova/vit-gpt2-image-captioning');
```
* * *
<a id="module_models.AutoModelForImageClassification" class="group"></a>
## models.AutoModelForImageClassification
Helper class which is used to instantiate pretrained image classification models with the `from_pretrained` function.
The chosen model class is determined by the type specified in the model config.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="new_module_models.AutoModelForImageClassification_new" class="group"></a>
### `new AutoModelForImageClassification()`
**Example**
```js
let model = await AutoModelForImageClassification.from_pretrained('Xenova/vit-base-patch16-224');
```
* * *
<a id="module_models.AutoModelForImageSegmentation" class="group"></a>
## models.AutoModelForImageSegmentation
Helper class which is used to instantiate pretrained image segmentation models with the `from_pretrained` function.
The chosen model class is determined by the type specified in the model config.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="new_module_models.AutoModelForImageSegmentation_new" class="group"></a>
### `new AutoModelForImageSegmentation()`
**Example**
```js
let model = await AutoModelForImageSegmentation.from_pretrained('Xenova/detr-resnet-50-panoptic');
```
* * *
<a id="module_models.AutoModelForSemanticSegmentation" class="group"></a>
## models.AutoModelForSemanticSegmentation
Helper class which is used to instantiate pretrained image segmentation models with the `from_pretrained` function.
The chosen model class is determined by the type specified in the model config.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="new_module_models.AutoModelForSemanticSegmentation_new" class="group"></a>
### `new AutoModelForSemanticSegmentation()`
**Example**
```js
let model = await AutoModelForSemanticSegmentation.from_pretrained('nvidia/segformer-b3-finetuned-cityscapes-1024-1024');
```
* * *
<a id="module_models.AutoModelForUniversalSegmentation" class="group"></a>
## models.AutoModelForUniversalSegmentation
Helper class which is used to instantiate pretrained universal image segmentation models with the `from_pretrained` function.
The chosen model class is determined by the type specified in the model config.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="new_module_models.AutoModelForUniversalSegmentation_new" class="group"></a>
### `new AutoModelForUniversalSegmentation()`
**Example**
```js
let model = await AutoModelForUniversalSegmentation.from_pretrained('hf-internal-testing/tiny-random-MaskFormerForInstanceSegmentation');
```
* * *
<a id="module_models.AutoModelForObjectDetection" class="group"></a>
## models.AutoModelForObjectDetection
Helper class which is used to instantiate pretrained object detection models with the `from_pretrained` function.
The chosen model class is determined by the type specified in the model config.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="new_module_models.AutoModelForObjectDetection_new" class="group"></a>
### `new AutoModelForObjectDetection()`
**Example**
```js
let model = await AutoModelForObjectDetection.from_pretrained('Xenova/detr-resnet-50');
```
* * *
<a id="module_models.AutoModelForMaskGeneration" class="group"></a>
## models.AutoModelForMaskGeneration
Helper class which is used to instantiate pretrained mask generation models with the `from_pretrained` function.
The chosen model class is determined by the type specified in the model config.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="new_module_models.AutoModelForMaskGeneration_new" class="group"></a>
### `new AutoModelForMaskGeneration()`
**Example**
```js
let model = await AutoModelForMaskGeneration.from_pretrained('Xenova/sam-vit-base');
```
* * *
<a id="module_models.Seq2SeqLMOutput" class="group"></a>
## models.Seq2SeqLMOutput
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="new_module_models.Seq2SeqLMOutput_new" class="group"></a>
### `new Seq2SeqLMOutput(output)`
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>output</td><td><code>Object</code></td><td><p>The output of the model.</p>
</td>
</tr><tr>
<td>output.logits</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>The output logits of the model.</p>
</td>
</tr><tr>
<td>output.past_key_values</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>An tensor of key/value pairs that represent the previous state of the model.</p>
</td>
</tr><tr>
<td>output.encoder_outputs</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>The output of the encoder in a sequence-to-sequence model.</p>
</td>
</tr><tr>
<td>[output.decoder_attentions]</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>Attentions weights of the decoder, after the attention softmax, used to compute the weighted average in the self-attention heads.</p>
</td>
</tr><tr>
<td>[output.cross_attentions]</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>Attentions weights of the decoder&#39;s cross-attention layer, after the attention softmax, used to compute the weighted average in the cross-attention heads.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.SequenceClassifierOutput" class="group"></a>
## models.SequenceClassifierOutput
Base class for outputs of sentence classification models.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="new_module_models.SequenceClassifierOutput_new" class="group"></a>
### `new SequenceClassifierOutput(output)`
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>output</td><td><code>Object</code></td><td><p>The output of the model.</p>
</td>
</tr><tr>
<td>output.logits</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>classification (or regression if config.num_labels==1) scores (before SoftMax).</p>
</td>
</tr><tr>
<td>[output.attentions]</td><td><code>Record.&lt;string, Tensor&gt;</code></td><td><p>Object of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.
Attentions weights after the attention softmax, used to compute the weighted average in the self-attention heads.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.XVectorOutput" class="group"></a>
## models.XVectorOutput
Base class for outputs of XVector models.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="new_module_models.XVectorOutput_new" class="group"></a>
### `new XVectorOutput(output)`
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>output</td><td><code>Object</code></td><td><p>The output of the model.</p>
</td>
</tr><tr>
<td>output.logits</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>Classification hidden states before AMSoftmax, of shape <code>(batch_size, config.xvector_output_dim)</code>.</p>
</td>
</tr><tr>
<td>output.embeddings</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>Utterance embeddings used for vector similarity-based retrieval, of shape <code>(batch_size, config.xvector_output_dim)</code>.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.TokenClassifierOutput" class="group"></a>
## models.TokenClassifierOutput
Base class for outputs of token classification models.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="new_module_models.TokenClassifierOutput_new" class="group"></a>
### `new TokenClassifierOutput(output)`
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>output</td><td><code>Object</code></td><td><p>The output of the model.</p>
</td>
</tr><tr>
<td>output.logits</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>Classification scores (before SoftMax).</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.MaskedLMOutput" class="group"></a>
## models.MaskedLMOutput
Base class for masked language models outputs.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="new_module_models.MaskedLMOutput_new" class="group"></a>
### `new MaskedLMOutput(output)`
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>output</td><td><code>Object</code></td><td><p>The output of the model.</p>
</td>
</tr><tr>
<td>output.logits</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.QuestionAnsweringModelOutput" class="group"></a>
## models.QuestionAnsweringModelOutput
Base class for outputs of question answering models.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="new_module_models.QuestionAnsweringModelOutput_new" class="group"></a>
### `new QuestionAnsweringModelOutput(output)`
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>output</td><td><code>Object</code></td><td><p>The output of the model.</p>
</td>
</tr><tr>
<td>output.start_logits</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>Span-start scores (before SoftMax).</p>
</td>
</tr><tr>
<td>output.end_logits</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>Span-end scores (before SoftMax).</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.CausalLMOutput" class="group"></a>
## models.CausalLMOutput
Base class for causal language model (or autoregressive) outputs.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="new_module_models.CausalLMOutput_new" class="group"></a>
### `new CausalLMOutput(output)`
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>output</td><td><code>Object</code></td><td><p>The output of the model.</p>
</td>
</tr><tr>
<td>output.logits</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>Prediction scores of the language modeling head (scores for each vocabulary token before softmax).</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.CausalLMOutputWithPast" class="group"></a>
## models.CausalLMOutputWithPast
Base class for causal language model (or autoregressive) outputs.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="new_module_models.CausalLMOutputWithPast_new" class="group"></a>
### `new CausalLMOutputWithPast(output)`
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>output</td><td><code>Object</code></td><td><p>The output of the model.</p>
</td>
</tr><tr>
<td>output.logits</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>Prediction scores of the language modeling head (scores for each vocabulary token before softmax).</p>
</td>
</tr><tr>
<td>output.past_key_values</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>Contains pre-computed hidden-states (key and values in the self-attention blocks)
that can be used (see <code>past_key_values</code> input) to speed up sequential decoding.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.ImageMattingOutput" class="group"></a>
## models.ImageMattingOutput
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="new_module_models.ImageMattingOutput_new" class="group"></a>
### `new ImageMattingOutput(output)`
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>output</td><td><code>Object</code></td><td><p>The output of the model.</p>
</td>
</tr><tr>
<td>output.alphas</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>Estimated alpha values, of shape <code>(batch_size, num_channels, height, width)</code>.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models.VitsModelOutput" class="group"></a>
## models.VitsModelOutput
Describes the outputs for the VITS model.
**Kind**: static class of [<code>models</code>](#module_models)
* * *
<a id="new_module_models.VitsModelOutput_new" class="group"></a>
### `new VitsModelOutput(output)`
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>output</td><td><code>Object</code></td><td><p>The output of the model.</p>
</td>
</tr><tr>
<td>output.waveform</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>The final audio waveform predicted by the model, of shape <code>(batch_size, sequence_length)</code>.</p>
</td>
</tr><tr>
<td>output.spectrogram</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>The log-mel spectrogram predicted at the output of the flow model.
This spectrogram is passed to the Hi-Fi GAN decoder model to obtain the final audio waveform.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models..cumsum_masked_fill" class="group"></a>
## `models~cumsum_masked_fill(attention_mask)` ⇒ <code>Object</code>
Helper function to perform the following:
```python
x = attention_mask.long().cumsum(-1) - 1
x.masked_fill_(attention_mask == 0, 1)
```
**Kind**: inner method of [<code>models</code>](#module_models)
<table>
<thead>
<tr>
<th>Param</th><th>Type</th>
</tr>
</thead>
<tbody>
<tr>
<td>attention_mask</td><td><code><a href="#Tensor">Tensor</a></code></td>
</tr> </tbody>
</table>
* * *
<a id="module_models..createPositionIds" class="group"></a>
## `models~createPositionIds()`
If the model supports providing position_ids, we create position_ids on the fly for batch generation,
by computing the cumulative sum of the attention mask along the sequence length dimension.
Equivalent to:
```python
position_ids = attention_mask.long().cumsum(-1) - 1
position_ids.masked_fill_(attention_mask == 0, 1)
if past_key_values:
position_ids = position_ids[:, -input_ids.shape[1] :]
```
**Kind**: inner method of [<code>models</code>](#module_models)
* * *
<a id="module_models..SamModelInputs" class="group"></a>
## `models~SamModelInputs` : <code>Object</code>
Object containing the model inputs.
**Kind**: inner typedef of [<code>models</code>](#module_models)
**Properties**
<table>
<thead>
<tr>
<th>Name</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>pixel_values</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>Pixel values as a Tensor with shape <code>(batch_size, num_channels, height, width)</code>.
These can be obtained using a <code>SamProcessor</code>.</p>
</td>
</tr><tr>
<td>[input_points]</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>Input 2D spatial points with shape <code>(batch_size, num_points, 2)</code>.
This is used by the prompt encoder to encode the prompt.</p>
</td>
</tr><tr>
<td>[input_labels]</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>Input labels for the points, as a Tensor of shape <code>(batch_size, point_batch_size, num_points)</code>.
This is used by the prompt encoder to encode the prompt. There are 4 types of labels:</p>
<ul>
<li><code>1</code>: the point is a point that contains the object of interest</li>
<li><code>0</code>: the point is a point that does not contain the object of interest</li>
<li><code>-1</code>: the point corresponds to the background</li>
<li><code>-10</code>: the point is a padding point, thus should be ignored by the prompt encoder</li>
</ul>
</td>
</tr><tr>
<td>[input_boxes]</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>Input bounding boxes with shape <code>(batch_size, num_boxes, 4)</code>.</p>
</td>
</tr><tr>
<td>[image_embeddings]</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>Image embeddings used by the mask decoder.</p>
</td>
</tr><tr>
<td>[image_positional_embeddings]</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>Image positional embeddings used by the mask decoder.</p>
</td>
</tr> </tbody>
</table>
* * *
<a id="module_models..SpeechOutput" class="group"></a>
## `models~SpeechOutput` : <code>Object</code>
**Kind**: inner typedef of [<code>models</code>](#module_models)
**Properties**
<table>
<thead>
<tr>
<th>Name</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>[spectrogram]</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>The predicted log-mel spectrogram of shape
<code>(output_sequence_length, config.num_mel_bins)</code>. Returned when no <code>vocoder</code> is provided</p>
</td>
</tr><tr>
<td>[waveform]</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>The predicted waveform of shape <code>(num_frames,)</code>. Returned when a <code>vocoder</code> is provided.</p>
</td>
</tr><tr>
<td>[cross_attentions]</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>The outputs of the decoder&#39;s cross-attention layers of shape
<code>(config.decoder_layers, config.decoder_attention_heads, output_sequence_length, input_sequence_length)</code>. returned when <code>output_cross_attentions</code> is <code>true</code>.</p>
</td>
</tr> </tbody>
</table>
* * *
<EditOnGithub source="https://github.com/huggingface/transformers.js/blob/main/docs/source/api/models.md" />

Xet Storage Details

Size:
256 kB
·
Xet hash:
5ba4d7500d25f4075716810f3d193eca68962b63fff359428c3a1f4f9abda565

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.