"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[132],{5227:function(e,s,t){t.d(s,{$Bv:function(){return aR},$Sz:function(){return aE},DcG:function(){return aU},ENH:function(){return aX},En$:function(){return aj},Hqk:function(){return aN},K2m:function(){return aK},Kf0:function(){return aT},LdW:function(){return aQ},OjJ:function(){return aO},S2d:function(){return aH},U$$:function(){return a$},Zn:function(){return aW},hY6:function(){return aJ},hZO:function(){return aD},lbf:function(){return aI},o$X:function(){return aB},t78:function(){return aG},tLj:function(){return az},wiU:function(){return aV},z6E:function(){return aq}});var n=t(3785),a=t(8375),i=t(8577),o=t(3848),r=t(5118),l=t(222),c=t(1008);let{InferenceSession:d,Tensor:_,env:u}=l.ONNX,h={EncoderOnly:0,EncoderDecoder:1,Seq2Seq:2,Vision2Seq:3,DecoderOnly:4,MaskGeneration:5},m=new Map,p=new Map,f=new Map;async function g(e,s,t){let n=`onnx/${s}${t.quantized?"_quantized":""}.onnx`,a=await (0,i.st)(e,n,!0,t);try{return await d.create(a,{executionProviders:l.p})}catch(e){if(1===l.p.length&&"wasm"===l.p[0])throw e;return console.warn(e),console.warn("Something went wrong during model construction (most likely a missing operation). Using `wasm` as a fallback. "),await d.create(a,{executionProviders:["wasm"]})}}async function w(e,s){let t=function(e,s){let t=Object.create(null),n=[];for(let a of e.inputNames){let e=s[a];if(!(e instanceof r.es)){n.push(a);continue}t[a]=u.wasm.proxy?e.clone():e}if(n.length>0)throw Error(`An error occurred during model execution: "Missing the following inputs: ${n.join(", ")}.`);let a=Object.keys(s).length,i=e.inputNames.length;if(a>i){let t=Object.keys(s).filter(s=>!e.inputNames.includes(s));console.warn(`WARNING: Too many inputs were provided (${a} > ${i}). The following inputs will be ignored: "${t.join(", ")}".`)}return t}(e,s);try{let s=await e.run(t);return s=function e(s){for(let t in s)s[t]instanceof _?s[t]=new r.es(s[t]):"object"==typeof s[t]&&e(s[t]);return s}(s)}catch(e){throw console.error(`An error occurred during model execution: "${e}".`),console.error("Inputs given to model:",t),e}}function x(e,s){let t=e.config.pad_token_id??null,n=e.config.eos_token_id??null;(0,a.Wy)(n)&&(n=[n]);let i=-1!==s.indexOf(t),o=null===n||!n.includes(t);if(!i||!o)return(0,r.r6)(s);{let e=BigInt64Array.from(s.data.map(e=>e!=t));return new r.es("int64",e,s.dims)}}function y(e,s,t){if(!e.inputNames.includes("position_ids"))return;let n=new BigInt64Array(s.attention_mask.data.length);for(let e=0;eBigInt(e))),[1,e.length]);if(e.some(s=>s.length!==e[0].length))throw Error("Unable to create tensor, you should probably activate truncation and/or padding with 'padding=True' and/or 'truncation=True' to have batched tensors with the same length.");return new r.es("int64",BigInt64Array.from(e.flat().map(e=>BigInt(e))),[e.length,e[0].length])}(n),encoder_outputs:s.encoder_outputs,past_key_values:s.prev_model_outputs?.past_key_values};s.attention_mask&&(a.attention_mask=s.attention_mask);let i=await e.forward(a);return s.prev_model_outputs=i,s.encoder_outputs=i.encoder_outputs,i}function S(e,s){e.output_token_ids=[...e.output_token_ids,s]}async function C(e,s){let t=Object.create(null);for(let n of e.session.inputNames)t[n]=s[n];return e.session.inputNames.includes("token_type_ids")&&!t.token_type_ids&&(t.token_type_ids=new r.es("int64",new BigInt64Array(t.input_ids.data.length),t.input_ids.dims)),await w(e.session,t)}async function F(e,s){let{input_ids:t,past_key_values:n,attention_mask:a}=s,i={input_ids:t,attention_mask:a??x(e,t)},o=!!n;e.session.inputNames.includes("use_cache_branch")&&(i.use_cache_branch=M(o)),y(e.session,i,o),e.addPastKeyValues(i,n);let r=await w(e.session,i);return{logits:r.logits,past_key_values:n=e.getPastKeyValues(r,n)}}function A(e,s,t,n,a){let i=[],o=0;for(let t of s){let s,r=t.tolist().map(Number);t.dims=[1,...t.dims],a?(s=a[o]).dims=[1,...s.dims]:s=x(e,t);let l={input:t,model_input_ids:t,attention_mask:s,prev_model_outputs:null,output_token_ids:r,num_output_tokens:n,done:!1,score:0,id:o++};i.push(l)}return i}async function L(e,s){let t=new BigInt64Array(s.output_token_ids.length).fill(1n),n={input_ids:s.model_input_ids,attention_mask:new r.es("int64",t,[1,t.length]),past_key_values:s.prev_model_outputs?.past_key_values},a=await e.forward(n);return s.prev_model_outputs=a,a}function P(e,s){e.output_token_ids=[...e.output_token_ids,s],e.model_input_ids=new r.es("int64",[BigInt(s)],[1,1])}class E extends a.Ag{main_input_name="input_ids";constructor(e,s){super(),this.config=e,this.session=s;let t=f.get(this.constructor),n=m.get(t);this.can_generate=!1,this._runBeam=null,this._getStartBeams=null,this._updateBeam=null,this._forward=null,n===h.DecoderOnly?(this.can_generate=!0,this._runBeam=L,this._getStartBeams=A,this._updateBeam=P,this._forward=F):n===h.Seq2Seq||n===h.Vision2Seq?(this.can_generate=!0,this._runBeam=v,this._getStartBeams=b,this._updateBeam=S,this._forward=k):(h.EncoderDecoder,this._forward=C)}async dispose(){let e=[];for(let s of Object.keys(this)){let t=this[s];t instanceof d&&e.push(t.handler.dispose())}return await Promise.all(e)}static async from_pretrained(e,{quantized:s=!0,progress_callback:t=null,config:a=null,cache_dir:o=null,local_files_only:r=!1,revision:l="main",model_file_name:c=null}={}){let d,_={quantized:s,progress_callback:t,config:a,cache_dir:o,local_files_only:r,revision:l,model_file_name:c},u=f.get(this),p=m.get(u);return p===h.DecoderOnly?d=await Promise.all([n.z.from_pretrained(e,_),g(e,_.model_file_name??"decoder_model_merged",_),(0,i.yM)(e,"generation_config.json",!1,_)]):p===h.Seq2Seq||p===h.Vision2Seq?d=await Promise.all([n.z.from_pretrained(e,_),g(e,"encoder_model",_),g(e,"decoder_model_merged",_),(0,i.yM)(e,"generation_config.json",!1,_)]):p===h.MaskGeneration?d=await Promise.all([n.z.from_pretrained(e,_),g(e,"vision_encoder",_),g(e,"prompt_encoder_mask_decoder",_)]):p===h.EncoderDecoder?d=await Promise.all([n.z.from_pretrained(e,_),g(e,"encoder_model",_),g(e,"decoder_model_merged",_)]):(p!==h.EncoderOnly&&console.warn(`Model type for '${u??a?.model_type}' not found, assuming encoder-only architecture. Please report this at https://github.com/xenova/transformers.js/issues/new/choose.`),d=await Promise.all([n.z.from_pretrained(e,_),g(e,_.model_file_name??"model",_)])),new this(...d)}async _call(e){return await this.forward(e)}async forward(e){return await this._forward(this,e)}_get_logits_processor(e,s,t=null){let n=new o.Jm;if(null!==e.repetition_penalty&&1!==e.repetition_penalty&&n.push(new o.Jj(e.repetition_penalty)),null!==e.no_repeat_ngram_size&&e.no_repeat_ngram_size>0&&n.push(new o.jF(e.no_repeat_ngram_size)),null!==e.bad_words_ids&&n.push(new o.AE(e.bad_words_ids,e.eos_token_id)),null!==e.min_length&&null!==e.eos_token_id&&e.min_length>0&&n.push(new o.ez(e.min_length,e.eos_token_id)),null!==e.min_new_tokens&&null!==e.eos_token_id&&e.min_new_tokens>0&&n.push(new o.CJ(s,e.min_new_tokens,e.eos_token_id)),null!==e.forced_bos_token_id&&n.push(new o.C9(e.forced_bos_token_id)),null!==e.forced_eos_token_id&&n.push(new o.dZ(e.max_length,e.forced_eos_token_id)),null!==e.begin_suppress_tokens){let t=s>1||null===e.forced_bos_token_id?s:s+1;null!==e.forced_decoder_ids&&(t+=e.forced_decoder_ids[e.forced_decoder_ids.length-1][0]),n.push(new o.GU(e.begin_suppress_tokens,t))}return null!==e.forced_decoder_ids&&n.push(new o.E(e.forced_decoder_ids)),null!==t&&n.extend(t),n}_get_generation_config(e){let s=new o.aP(this.config);return"generation_config"in this&&Object.assign(s,this.generation_config),null!==e&&Object.assign(s,e),s}async generate(e,s=null,t=null,{inputs_attention_mask:n=null}={}){let i;if(!this.can_generate){let e=f.get(this.constructor),s=`The current model class (${e}) is not compatible with \`.generate()\`, as it doesn't have a language model head.`,t=this.config.model_type,n=am.get(t)??ah.get(t)??al.get(t)??ag.get(t);throw n&&(s+=` Please use the following class instead: '${n[0]}'`),Error(s)}if(!(e instanceof r.es)&&!(0,a.fU)(e)&&!Array.isArray(e))throw Error(`\`inputs\` must be a Tensor, TypedArray, or Array, but is "${e.constructor.name}".`);if(this.config.is_encoder_decoder)i=0;else if(0===(i=e instanceof r.es?e.dims.at(-1):e.length))throw Error("Must supply a non-empty array of input token ids.");s=this._get_generation_config(s),t=t??new o.Jm,t=this._get_logits_processor(s,i,t);let l=s.eos_token_id;null===l||Array.isArray(l)||(l=[l]);let c=1,d=1+(s.max_new_tokens??1/0),_=Number.isInteger(s.max_length)&&(s.max_new_tokens??null)===null,u=o.Z4.getSampler(s),h=this.getStartBeams(e,s,c,n);for(;h.some(e=>!e.done)&&c=s.max_length){n.done=!0,e.push(n);continue}let a=await this.runBeam(n);s.output_attentions&&this.addAttentionsToBeam(n,a),s.output_scores;let i=a.logits.slice(null,-1,null);for(let[s,a]of(t(n.output_token_ids,i),u(i))){let t={...n};this.updateBeam(t,s),t.score+=a,l&&l.includes(s)&&(t.done=!0),e.push(t)}}++c,h=(e=this.groupBeams(e).map(e=>e.sort((e,s)=>s.score-e.score).slice(0,s.num_beams))).flat(),s.callback_function&&s.callback_function(h)}let m=this.groupBeams(h),p=e=>m.map(t=>s.num_return_sequences>1?t.slice(0,s.num_return_sequences).map(s=>s[e]):[t[0][e]]).flat(),g=p("output_token_ids");return s.return_dict_in_generate?{sequences:g,decoder_attentions:p("decoder_attentions"),cross_attentions:p("cross_attentions")}:g}addAttentionsToBeam(e,s){if(this.config.is_encoder_decoder){if(!s.cross_attentions||0===s.cross_attentions.length)throw Error("`output_attentions` is true, but the model did not produce cross-attentions. This is most likely because the model was not exported with `output_attentions=True`.");e.cross_attentions||(e.cross_attentions=[]),e.cross_attentions.push(s.cross_attentions)}if(!s.decoder_attentions||0===s.decoder_attentions.length)throw Error("`output_attentions` is true, but the model did not produce decoder-attentions. This is most likely because the model was not exported with `output_attentions=True`.");e.decoder_attentions||(e.decoder_attentions=[]),e.decoder_attentions.push(s.decoder_attentions)}groupBeams(e){let s=Object.create(null);for(let t of e)void 0===s[t.id]?s[t.id]=[t]:s[t.id].push(t);return Object.values(s)}getPastKeyValues(e,s){let t=Object.create(null);for(let n in e)if(n.startsWith("present")){let a=n.replace("present","past_key_values");s&&n.includes("encoder")?t[a]=s[a]:t[a]=e[n]}return t}getAttentions(e){let s=Object.create(null);for(let t of["cross_attentions","decoder_attentions"]){let n=[];for(let s in e)s.startsWith(t)&&(n[s.split(".").pop()]=e[s]);s[t]=n}return s}addPastKeyValues(e,s){if(s)Object.assign(e,s);else if(this.config.is_encoder_decoder&&(this.add_encoder_pkv??!0)){let s=[1,this.num_encoder_heads,0,this.encoder_dim_kv],t=[1,this.num_decoder_heads,0,this.decoder_dim_kv];for(let n=0;n{let n=Array.from({length:this.config.decoder_layers},(s,t)=>(0,r.d3)(e.map(e=>e[t]),2)),a=(0,r.kn)(s.map(([e,s])=>t?n[e].slice(null,s,null,[0,t]):n[e].slice(null,s)));a=a.transpose(1,0,2,3);let[o,l]=(0,r.f3)(a,-2,0,!0),d=a.clone();for(let e=0;et[s+1]-t[s]),c=(0,a.eG)([1],l).map(e=>!!e),_=[];for(let e=0;ee*s,1);e.input_labels=new r.es("int64",new BigInt64Array(t).fill(1n),s)}return await w(this.prompt_encoder_mask_decoder,{input_points:e.input_points,input_labels:e.input_labels,image_embeddings:e.image_embeddings,image_positional_embeddings:e.image_positional_embeddings})}async _call(e){return new nS(await super._call(e))}}class nS extends B{constructor({iou_scores:e,pred_masks:s}){super(),this.iou_scores=e,this.pred_masks=s}}class nC extends E{}class nF extends nC{}class nA extends nC{constructor(e,s,t,n){super(e,s),this.decoder_merged_session=t,this.generation_config=n,this.num_decoder_layers=this.config.decoder_layers,this.num_decoder_heads=this.config.decoder_attention_heads,this.decoder_dim_kv=this.config.d_model/this.num_decoder_heads,this.num_encoder_layers=this.config.encoder_layers,this.num_encoder_heads=this.config.encoder_attention_heads,this.encoder_dim_kv=this.config.d_model/this.num_encoder_heads}}class nL extends E{}class nP extends nL{}class nE extends nL{constructor(e,s,t,n){super(e,s),this.decoder_merged_session=t,this.generation_config=n,this.num_decoder_layers=this.config.decoder_layers,this.num_decoder_heads=this.config.decoder_attention_heads,this.decoder_dim_kv=this.config.d_model/this.num_decoder_heads,this.num_encoder_layers=this.config.encoder_layers,this.num_encoder_heads=this.config.encoder_attention_heads,this.encoder_dim_kv=this.config.d_model/this.num_encoder_heads}}class nB extends E{}class nO extends nB{}class nT extends nB{async _call(e){return new a3(await super._call(e))}}class nD extends nB{async _call(e){return new aY(await super._call(e))}}class nI extends E{}class nq extends nI{}class nN extends nI{async _call(e){return new a3(await super._call(e))}}class nG extends nI{async _call(e){return new aY(await super._call(e))}}class nV extends nB{}class nz extends nB{async _call(e){return new a3(await super._call(e))}}class nj extends nB{async _call(e){return new aY(await super._call(e))}}class n$ extends E{}class nR extends n${}class nW extends n${async _call(e){return new a3(await super._call(e))}}class nQ extends n${async _call(e){return new aY(await super._call(e))}}class nX extends E{}class nK extends nX{}class nU extends nX{constructor(e,s,t,n){super(e,s),this.decoder_merged_session=t,this.generation_config=n,this.num_decoder_layers=this.config.decoder_layers,this.num_decoder_heads=this.config.decoder_attention_heads,this.decoder_dim_kv=this.config.hidden_size/this.num_decoder_heads,this.num_encoder_layers=this.config.encoder_layers,this.num_encoder_heads=this.config.encoder_attention_heads,this.encoder_dim_kv=this.config.hidden_size/this.num_encoder_heads}async generate_speech(e,s,{threshold:t=.5,minlenratio:n=0,maxlenratio:a=20,vocoder:i=null}={}){let{encoder_outputs:o,encoder_attention_mask:l}=await C(this,{input_ids:e}),c=o.dims[1]/this.config.reduction_factor,d=Math.floor(c*a),_=Math.floor(c*n),u=this.config.num_mel_bins,h=[],m=null,p=null,f=0;for(;;){++f;let e={use_cache_branch:M(!!p),output_sequence:p?p.output_sequence_out:new r.es("float32",new Float32Array(u),[1,1,u]),encoder_attention_mask:l,speaker_embeddings:s,encoder_hidden_states:o};this.addPastKeyValues(e,m),p=await w(this.decoder_merged_session,e),m=this.getPastKeyValues(p,m);let{prob:n,spectrum:a}=p;if(h.push(a),f>=_&&(Array.from(n.data).filter(e=>e>=t).length>0||f>=d))break}let g=(0,r.d3)(h),{waveform:x}=await w(i.session,{spectrogram:g});return{spectrogram:g,waveform:x}}}class nH extends E{main_input_name="spectrogram"}class nJ extends E{constructor(e,s,t){super(e,s),this.generation_config=t,this.config.pad_token_id=this.config.eos_token_id,this.num_encoder_layers=this.num_decoder_layers=this.config.decoder_layers,this.num_encoder_heads=this.num_decoder_heads=this.config.decoder_attention_heads,this.encoder_dim_kv=this.decoder_dim_kv=this.config.d_model/this.num_decoder_heads}}class nZ extends nJ{}class nY extends E{constructor(e,s,t){super(e,s),this.generation_config=t,this.config.pad_token_id=this.config.eos_token_id,this.num_heads=this.config.num_key_value_heads,this.num_layers=this.config.num_hidden_layers,this.dim_kv=this.config.hidden_size/this.config.num_attention_heads}}class n2 extends nY{}class n0 extends nY{}class n1 extends E{constructor(e,s,t){super(e,s),this.generation_config=t,this.config.pad_token_id=this.config.eos_token_id,this.num_heads=this.config.num_attention_heads,this.num_layers=this.config.num_hidden_layers,this.dim_kv=this.config.hidden_size/this.config.num_attention_heads}}class n3 extends n1{}class n5 extends n1{}class n4 extends E{}class n6 extends n4{}class n8 extends n4{static async from_pretrained(e,s={}){return s.model_file_name??="text_model",super.from_pretrained(e,s)}}class n7 extends n4{static async from_pretrained(e,s={}){return s.model_file_name??="audio_model",super.from_pretrained(e,s)}}class n9 extends E{}class ae extends n9{async _call(e){return new a4(await super._call(e))}}class as extends E{}class at extends as{}class an extends as{}class aa{static MODEL_CLASS_MAPPINGS=null;static BASE_IF_FAIL=!1;static async from_pretrained(e,{quantized:s=!0,progress_callback:t=null,config:a=null,cache_dir:i=null,local_files_only:o=!1,revision:r="main",model_file_name:l=null}={}){let c={quantized:s,progress_callback:t,config:a,cache_dir:i,local_files_only:o,revision:r,model_file_name:l};if(a=await n.z.from_pretrained(e,c),c.config||(c.config=a),!this.MODEL_CLASS_MAPPINGS)throw Error("`MODEL_CLASS_MAPPINGS` not implemented for this type of `AutoClass`: "+this.name);for(let s of this.MODEL_CLASS_MAPPINGS){let t=s.get(a.model_type);if(t)return await t[1].from_pretrained(e,c)}if(this.BASE_IF_FAIL)return console.warn(`Unknown model class "${a.model_type}", attempting to construct from base class.`),await E.from_pretrained(e,c);throw Error(`Unsupported model type: ${a.model_type}`)}}let ai=new Map([["bert",["BertModel",T]],["nomic_bert",["NomicBertModel",V]],["roformer",["RoFormerModel",j]],["electra",["ElectraModel",ee]],["esm",["EsmModel",eP]],["convbert",["ConvBertModel",K]],["camembert",["CamembertModel",eo]],["deberta",["DebertaModel",eu]],["deberta-v2",["DebertaV2Model",ew]],["mpnet",["MPNetModel",eV]],["albert",["AlbertModel",eJ]],["distilbert",["DistilBertModel",ev]],["roberta",["RobertaModel",sf]],["xlm",["XLMModel",sk]],["xlm-roberta",["XLMRobertaModel",sA]],["clap",["ClapModel",n6]],["clip",["CLIPModel",sz]],["clipseg",["CLIPSegModel",sJ]],["chinese_clip",["ChineseCLIPModel",sU]],["siglip",["SiglipModel",sW]],["mobilebert",["MobileBertModel",eD]],["squeezebert",["SqueezeBertModel",eQ]],["wav2vec2",["Wav2Vec2Model",nO]],["wav2vec2-bert",["Wav2Vec2BertModel",nq]],["hubert",["HubertModel",nV]],["wavlm",["WavLMModel",nR]],["audio-spectrogram-transformer",["ASTModel",sT]],["vits",["VitsModel",ae]],["detr",["DetrModel",t$]],["table-transformer",["TableTransformerModel",tU]],["vit",["ViTModel",tC]],["mobilevit",["MobileViTModel",tE]],["owlvit",["OwlViTModel",tT]],["owlv2",["Owlv2Model",tq]],["beit",["BeitModel",tV]],["deit",["DeiTModel",tY]],["convnext",["ConvNextModel",n_]],["convnextv2",["ConvNextV2Model",nm]],["dinov2",["Dinov2Model",ng]],["resnet",["ResNetModel",t1]],["swin",["SwinModel",t4]],["swin2sr",["Swin2SRModel",t7]],["donut-swin",["DonutSwinModel",nc]],["yolos",["YolosModel",ny]],["dpt",["DPTModel",ns]],["glpn",["GLPNModel",no]],["hifigan",["SpeechT5HifiGan",nH]]]),ao=new Map([["t5",["T5Model",e1]],["longt5",["LongT5Model",e4]],["mt5",["MT5Model",e7]],["bart",["BartModel",ss]],["mbart",["MBartModel",si]],["marian",["MarianModel",nF]],["whisper",["WhisperModel",sq]],["m2m_100",["M2M100Model",nP]],["blenderbot",["BlenderbotModel",sd]],["blenderbot-small",["BlenderbotSmallModel",sh]]]),ar=new Map([["bloom",["BloomModel",tg]],["gpt2",["GPT2Model",s2]],["gptj",["GPTJModel",s9]],["gpt_bigcode",["GPTBigCodeModel",tt]],["gpt_neo",["GPTNeoModel",s3]],["gpt_neox",["GPTNeoXModel",s6]],["codegen",["CodeGenModel",ti]],["llama",["LlamaModel",tl]],["qwen2",["Qwen2Model",t_]],["phi",["PhiModel",tm]],["mpt",["MptModel",ty]],["opt",["OPTModel",tb]],["mistral",["MistralModel",n2]],["falcon",["FalconModel",n3]]]),al=new Map([["speecht5",["SpeechT5ForSpeechToText",nK]],["whisper",["WhisperForConditionalGeneration",sN]]]),ac=new Map([["speecht5",["SpeechT5ForTextToSpeech",nU]]]),ad=new Map([["vits",["VitsModel",ae]]]),a_=new Map([["bert",["BertForSequenceClassification",I]],["roformer",["RoFormerForSequenceClassification",R]],["electra",["ElectraForSequenceClassification",et]],["esm",["EsmForSequenceClassification",eB]],["convbert",["ConvBertForSequenceClassification",H]],["camembert",["CamembertForSequenceClassification",el]],["deberta",["DebertaForSequenceClassification",em]],["deberta-v2",["DebertaV2ForSequenceClassification",ey]],["mpnet",["MPNetForSequenceClassification",ej]],["albert",["AlbertForSequenceClassification",eZ]],["distilbert",["DistilBertForSequenceClassification",eS]],["roberta",["RobertaForSequenceClassification",sw]],["xlm",["XLMForSequenceClassification",sv]],["xlm-roberta",["XLMRobertaForSequenceClassification",sP]],["bart",["BartForSequenceClassification",sn]],["mbart",["MBartForSequenceClassification",sr]],["mobilebert",["MobileBertForSequenceClassification",eq]],["squeezebert",["SqueezeBertForSequenceClassification",eK]]]),au=new Map([["bert",["BertForTokenClassification",q]],["roformer",["RoFormerForTokenClassification",W]],["electra",["ElectraForTokenClassification",en]],["esm",["EsmForTokenClassification",eO]],["convbert",["ConvBertForTokenClassification",J]],["camembert",["CamembertForTokenClassification",ec]],["deberta",["DebertaForTokenClassification",ep]],["deberta-v2",["DebertaV2ForTokenClassification",eM]],["mpnet",["MPNetForTokenClassification",e$]],["distilbert",["DistilBertForTokenClassification",eC]],["roberta",["RobertaForTokenClassification",sx]],["xlm",["XLMForTokenClassification",sS]],["xlm-roberta",["XLMRobertaForTokenClassification",sE]]]),ah=new Map([["t5",["T5ForConditionalGeneration",e3]],["longt5",["LongT5ForConditionalGeneration",e6]],["mt5",["MT5ForConditionalGeneration",e9]],["bart",["BartForConditionalGeneration",st]],["mbart",["MBartForConditionalGeneration",so]],["marian",["MarianMTModel",nA]],["m2m_100",["M2M100ForConditionalGeneration",nE]],["blenderbot",["BlenderbotForConditionalGeneration",s_]],["blenderbot-small",["BlenderbotSmallForConditionalGeneration",sm]]]),am=new Map([["bloom",["BloomForCausalLM",tw]],["gpt2",["GPT2LMHeadModel",s0]],["gptj",["GPTJForCausalLM",te]],["gpt_bigcode",["GPTBigCodeForCausalLM",tn]],["gpt_neo",["GPTNeoForCausalLM",s5]],["gpt_neox",["GPTNeoXForCausalLM",s8]],["codegen",["CodeGenForCausalLM",to]],["llama",["LlamaForCausalLM",tc]],["qwen2",["Qwen2ForCausalLM",tu]],["phi",["PhiForCausalLM",tp]],["mpt",["MptForCausalLM",tM]],["opt",["OPTForCausalLM",tv]],["mbart",["MBartForCausalLM",sl]],["mistral",["MistralForCausalLM",n0]],["falcon",["FalconForCausalLM",n5]],["trocr",["TrOCRForCausalLM",nZ]]]),ap=new Map([["bert",["BertForMaskedLM",D]],["roformer",["RoFormerForMaskedLM",$]],["electra",["ElectraForMaskedLM",es]],["esm",["EsmForMaskedLM",eE]],["convbert",["ConvBertForMaskedLM",U]],["camembert",["CamembertForMaskedLM",er]],["deberta",["DebertaForMaskedLM",eh]],["deberta-v2",["DebertaV2ForMaskedLM",ex]],["mpnet",["MPNetForMaskedLM",ez]],["albert",["AlbertForMaskedLM",e2]],["distilbert",["DistilBertForMaskedLM",eA]],["roberta",["RobertaForMaskedLM",sg]],["xlm",["XLMWithLMHeadModel",sb]],["xlm-roberta",["XLMRobertaForMaskedLM",sL]],["mobilebert",["MobileBertForMaskedLM",eI]],["squeezebert",["SqueezeBertForMaskedLM",eX]]]),af=new Map([["bert",["BertForQuestionAnswering",N]],["roformer",["RoFormerForQuestionAnswering",Q]],["electra",["ElectraForQuestionAnswering",ea]],["convbert",["ConvBertForQuestionAnswering",Z]],["camembert",["CamembertForQuestionAnswering",ed]],["deberta",["DebertaForQuestionAnswering",ef]],["deberta-v2",["DebertaV2ForQuestionAnswering",ek]],["mpnet",["MPNetForQuestionAnswering",eR]],["albert",["AlbertForQuestionAnswering",eY]],["distilbert",["DistilBertForQuestionAnswering",eF]],["roberta",["RobertaForQuestionAnswering",sy]],["xlm",["XLMForQuestionAnswering",sC]],["xlm-roberta",["XLMRobertaForQuestionAnswering",sB]],["mobilebert",["MobileBertForQuestionAnswering",eN]],["squeezebert",["SqueezeBertForQuestionAnswering",eU]]]),ag=new Map([["vision-encoder-decoder",["VisionEncoderDecoderModel",sG]]]),aw=new Map([["vision-encoder-decoder",["VisionEncoderDecoderModel",sG]]]),ax=new Map([["vit",["ViTForImageClassification",tF]],["mobilevit",["MobileViTForImageClassification",tB]],["beit",["BeitForImageClassification",tz]],["deit",["DeiTForImageClassification",t2]],["convnext",["ConvNextForImageClassification",nu]],["convnextv2",["ConvNextV2ForImageClassification",np]],["dinov2",["Dinov2ForImageClassification",nw]],["resnet",["ResNetForImageClassification",t3]],["swin",["SwinForImageClassification",t6]],["segformer",["SegformerForImageClassification",at]]]),ay=new Map([["detr",["DetrForObjectDetection",tR]],["table-transformer",["TableTransformerForObjectDetection",tH]],["yolos",["YolosForObjectDetection",nM]]]),aM=new Map([["owlvit",["OwlViTForObjectDetection",tD]],["owlv2",["Owlv2ForObjectDetection",tN]]]),ak=new Map([["detr",["DetrForSegmentation",tW]],["clipseg",["CLIPSegForImageSegmentation",sZ]]]),ab=new Map([["segformer",["SegformerForSemanticSegmentation",an]]]),av=new Map([["sam",["SamModel",nv]]]),aS=new Map([["wav2vec2",["Wav2Vec2ForCTC",nT]],["wav2vec2-bert",["Wav2Vec2BertForCTC",nN]],["wavlm",["WavLMForCTC",nW]],["hubert",["HubertForCTC",nz]]]),aC=new Map([["wav2vec2",["Wav2Vec2ForSequenceClassification",nD]],["wav2vec2-bert",["Wav2Vec2BertForSequenceClassification",nG]],["wavlm",["WavLMForSequenceClassification",nQ]],["hubert",["HubertForSequenceClassification",nj]],["audio-spectrogram-transformer",["ASTForAudioClassification",sD]]]),aF=new Map([["vitmatte",["VitMatteForImageMatting",tL]]]),aA=new Map([["swin2sr",["Swin2SRForImageSuperResolution",t9]]]),aL=new Map([["dpt",["DPTForDepthEstimation",nt]],["depth_anything",["DepthAnythingForDepthEstimation",na]],["glpn",["GLPNForDepthEstimation",nr]]]),aP=[[ai,h.EncoderOnly],[ao,h.EncoderDecoder],[ar,h.DecoderOnly],[a_,h.EncoderOnly],[au,h.EncoderOnly],[ah,h.Seq2Seq],[al,h.Seq2Seq],[am,h.DecoderOnly],[ap,h.EncoderOnly],[af,h.EncoderOnly],[ag,h.Vision2Seq],[ax,h.EncoderOnly],[ak,h.EncoderOnly],[ab,h.EncoderOnly],[aF,h.EncoderOnly],[aA,h.EncoderOnly],[aL,h.EncoderOnly],[ay,h.EncoderOnly],[aM,h.EncoderOnly],[av,h.MaskGeneration],[aS,h.EncoderOnly],[aC,h.EncoderOnly],[ac,h.Seq2Seq],[ad,h.EncoderOnly]];for(let[e,s]of aP)for(let[t,n]of e.values())m.set(t,s),f.set(n,t),p.set(t,n);for(let[e,s,t]of[["CLIPTextModelWithProjection",sj,h.EncoderOnly],["CLIPVisionModelWithProjection",s$,h.EncoderOnly],["SiglipTextModel",sQ,h.EncoderOnly],["SiglipVisionModel",sX,h.EncoderOnly],["ClapTextModelWithProjection",n8,h.EncoderOnly],["ClapAudioModelWithProjection",n7,h.EncoderOnly]])m.set(e,t),f.set(s,e),p.set(e,s);class aE extends aa{static MODEL_CLASS_MAPPINGS=aP.map(e=>e[0]);static BASE_IF_FAIL=!0}class aB extends aa{static MODEL_CLASS_MAPPINGS=[a_]}class aO extends aa{static MODEL_CLASS_MAPPINGS=[au]}class aT extends aa{static MODEL_CLASS_MAPPINGS=[ah]}class aD extends aa{static MODEL_CLASS_MAPPINGS=[al]}class aI extends aa{static MODEL_CLASS_MAPPINGS=[ac]}class aq extends aa{static MODEL_CLASS_MAPPINGS=[ad]}class aN extends aa{static MODEL_CLASS_MAPPINGS=[am]}class aG extends aa{static MODEL_CLASS_MAPPINGS=[ap]}class aV extends aa{static MODEL_CLASS_MAPPINGS=[af]}class az extends aa{static MODEL_CLASS_MAPPINGS=[ag]}class aj extends aa{static MODEL_CLASS_MAPPINGS=[ax]}class a$ extends aa{static MODEL_CLASS_MAPPINGS=[ak]}class aR extends aa{static MODEL_CLASS_MAPPINGS=[ab]}class aW extends aa{static MODEL_CLASS_MAPPINGS=[ay]}class aQ extends aa{static MODEL_CLASS_MAPPINGS=[aM]}class aX extends aa{static MODEL_CLASS_MAPPINGS=[aS]}class aK extends aa{static MODEL_CLASS_MAPPINGS=[aC]}class aU extends aa{static MODEL_CLASS_MAPPINGS=[aw]}class aH extends aa{static MODEL_CLASS_MAPPINGS=[aA]}class aJ extends aa{static MODEL_CLASS_MAPPINGS=[aL]}class aZ extends B{constructor({logits:e,past_key_values:s,encoder_outputs:t,decoder_attentions:n=null,cross_attentions:a=null}){super(),this.logits=e,this.past_key_values=s,this.encoder_outputs=t,this.decoder_attentions=n,this.cross_attentions=a}}class aY extends B{constructor({logits:e}){super(),this.logits=e}}class a2 extends B{constructor({logits:e}){super(),this.logits=e}}class a0 extends B{constructor({logits:e}){super(),this.logits=e}}class a1 extends B{constructor({start_logits:e,end_logits:s}){super(),this.start_logits=e,this.end_logits=s}}class a3 extends B{constructor({logits:e}){super(),this.logits=e}}class a5 extends B{constructor({alphas:e}){super(),this.alphas=e}}class a4 extends B{constructor({waveform:e,spectrogram:s}){super(),this.waveform=e,this.spectrogram=s}}}}]);