1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8138],{7359:(e,s,t)=>{t.d(s,{$Ld:()=>ap,$Mx:()=>tj,$P2:()=>tf,$TP:()=>iM,$o$:()=>nx,$ph:()=>ag,A4X:()=>al,AVh:()=>iA,Aib:()=>eo,AyL:()=>as,BRf:()=>ia,Bl1:()=>t6,C2_:()=>no,CAk:()=>sz,CBj:()=>eN,CF0:()=>es,C_m:()=>eV,Cb2:()=>s2,CbL:()=>nS,Ccq:()=>j,Ct0:()=>ak,D$4:()=>eX,DDe:()=>tQ,DIv:()=>B,DbD:()=>s8,Dji:()=>tX,Dki:()=>nd,E6D:()=>aA,E9I:()=>T,EAC:()=>sG,EKW:()=>tW,ELH:()=>eJ,EPI:()=>t5,E_G:()=>sZ,Eh_:()=>n9,F05:()=>st,F75:()=>tN,FEt:()=>an,FIB:()=>sH,FJW:()=>iS,FSH:()=>Q,Fbv:()=>tH,FmT:()=>nI,FoX:()=>nc,FqW:()=>s5,FuQ:()=>s0,Fzc:()=>t2,G2X:()=>eK,G3L:()=>nq,GEu:()=>sV,GNt:()=>nR,GXK:()=>sb,Giz:()=>t9,HMe:()=>iv,HT0:()=>nE,HaQ:()=>tJ,Hff:()=>af,Hi6:()=>eZ,Hvf:()=>sc,I04:()=>aL,IVZ:()=>aw,IWp:()=>tG,IeB:()=>nb,Ilc:()=>eM,Ilk:()=>z,IrO:()=>sm,IzE:()=>n$,JFO:()=>tZ,JGb:()=>sd,JP3:()=>iu,J_N:()=>eD,KJ:()=>ab,KcC:()=>e8,Kul:()=>ni,L1Z:()=>tm,L3d:()=>eu,LGm:()=>tb,LJl:()=>tS,LN6:()=>at,LdY:()=>ec,LlQ:()=>nv,LqK:()=>e6,MH$:()=>sn,MOY:()=>ii,MRG:()=>sI,MRX:()=>E,MYn:()=>tY,MgS:()=>sw,Mjg:()=>eO,Mt5:()=>si,N2L:()=>sY,NDb:()=>eS,NJd:()=>ng,NlK:()=>eG,Nmr:()=>ex,Nyc:()=>et,O0k:()=>sD,OBR:()=>nM,OK_:()=>sL,OOL:()=>e$,P3b:()=>tw,PBg:()=>sJ,PRX:()=>aM,PV9:()=>s6,P_g:()=>n0,Paj:()=>V,Pgx:()=>sr,Plw:()=>ik,Pqo:()=>aa,PyP:()=>iN,Pyv:()=>n7,Pzh:()=>sM,QGw:()=>eT,QJ0:()=>sA,QNG:()=>iF,QRP:()=>ej,Qs9:()=>ey,RIx:()=>sp,RWH:()=>eR,Rcj:()=>e5,RvM:()=>tr,S7g:()=>er,S9m:()=>ei,SIh:()=>aq,SNK:()=>ar,SPn:()=>J,SX4:()=>tt,Shx:()=>tn,Sm3:()=>su,SzV:()=>ee,TUv:()=>it,Tc6:()=>O,Tk_:()=>tL,TrS:()=>ns,U14:()=>aS,UNt:()=>so,URg:()=>nL,UX7:()=>s$,U_I:()=>nT,UaF:()=>aP,UqB:()=>nX,V2z:()=>tu,V9g:()=>ir,VD9:()=>tk,VG4:()=>ne,VT:()=>nN,VkI:()=>tp,Vkl:()=>iE,Vnd:()=>sy,VoY:()=>G,Vx0:()=>Z,W5i:()=>nQ,W6E:()=>il,W7k:()=>nB,WIq:()=>nU,WJS:()=>tz,X0l:()=>tl,X6D:()=>aB,XBq:()=>s3,XWm:()=>sU,XfN:()=>eh,Xi0:()=>$,Xrw:()=>nA,Xsl:()=>R,Xvs:()=>te,Xyp:()=>n8,Y2A:()=>P,YHO:()=>nl,YR3:()=>sa,YVy:()=>eL,YZs:()=>sl,Yd3:()=>ip,YjU:()=>aC,YqH:()=>iT,YyD:()=>nG,Z0G:()=>iP,Z83:()=>sW,Z9R:()=>tI,ZGD:()=>tT,ZIt:()=>io,ZM0:()=>tU,Zip:()=>e_,_Dc:()=>sv,_TZ:()=>ix,_yz:()=>ep,aGV:()=>nV,aHU:()=>sN,aLA:()=>aI,aN4:()=>nw,adp:()=>ts,ag_:()=>ae,ajg:()=>nC,b9b:()=>t3,bFh:()=>s7,bGU:()=>nK,bOZ:()=>ta,bZR:()=>nD,bmk:()=>D,bpB:()=>sf,c$o:()=>nr,c93:()=>na,cD:()=>sS,cR9:()=>sX,cXP:()=>t4,cl7:()=>n2,cpF:()=>eb,crA:()=>nt,crd:()=>
1eH,ct5:()=>nY,czX:()=>sT,d7$:()=>sF,d8n:()=>t8,dAU:()=>e3,dBN:()=>aF,dMI:()=>nj,db0:()=>i_,dg9:()=>tg,diq:()=>ah,dp7:()=>nW,dt5:()=>iL,eQ7:()=>ac,eu8:()=>W,f7H:()=>td,fCQ:()=>nm,fGl:()=>nZ,fX1:()=>nP,fjb:()=>am,fl$:()=>t7,fqH:()=>ai,g$7:()=>av,gEj:()=>ea,gJd:()=>sR,gSt:()=>sE,gqD:()=>ig,gqe:()=>n3,gxi:()=>tC,h0m:()=>el,hFk:()=>to,hNN:()=>tE,h_s:()=>tF,hbt:()=>se,hf2:()=>iB,i3J:()=>nO,iGD:()=>eB,iKv:()=>e0,j2j:()=>nh,j6y:()=>e2,j7p:()=>s4,j9c:()=>tK,jJ4:()=>X,jQR:()=>is,jWM:()=>tc,jZD:()=>t_,jZx:()=>tM,j_7:()=>e1,jbx:()=>th,jlM:()=>tV,jt4:()=>nu,kPE:()=>e9,klo:()=>sC,l2J:()=>s9,lHM:()=>sQ,lX9:()=>q,lf8:()=>nf,lr8:()=>ek,ltw:()=>nz,m1H:()=>tq,m68:()=>iy,mjH:()=>nF,mp$:()=>iD,muz:()=>aT,mvc:()=>tP,nD1:()=>eP,nDC:()=>eq,nII:()=>ny,nR6:()=>au,nuw:()=>ib,o2t:()=>N,o57:()=>sB,oJL:()=>ao,oKc:()=>t$,oO_:()=>n1,oZ3:()=>ay,oaf:()=>tR,pBZ:()=>tB,pHg:()=>np,pJ8:()=>sq,pSU:()=>eA,pW7:()=>ew,qBz:()=>tD,qCM:()=>iw,qLW:()=>sO,qQb:()=>n4,qWZ:()=>ax,qcZ:()=>nn,qtL:()=>iI,qvY:()=>eQ,rKH:()=>ie,rSR:()=>I,rZ_:()=>ty,rb:()=>eW,riX:()=>ti,s8j:()=>nk,sKA:()=>iq,sbd:()=>sx,sns:()=>Y,t8g:()=>eI,tAq:()=>s1,tDL:()=>s_,tKX:()=>sg,tU7:()=>tO,tUF:()=>sK,tm_:()=>e4,uA4:()=>a_,uKS:()=>ad,uwI:()=>eC,v11:()=>sk,vGK:()=>sP,vTA:()=>ih,vTy:()=>ef,vZB:()=>eE,vdi:()=>n_,vf1:()=>t1,vgU:()=>tA,vh2:()=>en,vnq:()=>n5,vqx:()=>ss,w0O:()=>iC,w4W:()=>em,wXv:()=>e7,wZy:()=>sh,wc1:()=>ed,wju:()=>ic,wrZ:()=>im,x5Z:()=>nJ,xI8:()=>nH,xNh:()=>eg,xbg:()=>t0,xfe:()=>ez,xpG:()=>eF,y5s:()=>H,yGT:()=>id,y_I:()=>K,yaC:()=>sj,yuQ:()=>ev,z1x:()=>U,z45:()=>eU,zEN:()=>tv,zPm:()=>tx,zml:()=>eY,zys:()=>n6});
1var n=t(89148),a=t(33560),i=t(29010),o=t(25861),r=t(76874),l=t(95714),c=t(36747);let{InferenceSession:d,Tensor:_,env:u}=l.M,h=new Map,m=new Map,p=new Map;async function g(e,s,t){let n=`onnx/${s}${t.quantized?"_quantized":""}.onnx`,a=await (0,i.Yw)(e,n,!0,t);try{return await d.create(a,{executionProviders:l.t})}catch(e){if(1===l.t.length&&"wasm"===l.t[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 f(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.qY)){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.qY(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 w(e,s){let t=e.config.pad_token_id??null,n=e.config.eos_token_id??null;(0,a.k1)(n)&&(n=[n]);let i=-1!==s.indexOf(t),o=null===n||!n.includes(t);if(!i||!o)return(0,r.oC)(s);{let e=BigInt64Array.from(s.data.map(e=>e!=t));return new r.qY("int64",e,s.dims)}}function x(e,s,t){if(!e.inputNames.includes("position_ids"))return;let n=new BigInt64Array(s.attention_mask.data.length);for(let e=0;
1e<s.attention_mask.dims[0];++e){let t=e*s.attention_mask.dims[1],a=BigInt(0);for(let e=0;e<s.attention_mask.dims[1];++e){let i=t+e;0n===s.attention_mask.data[i]?n[i]=BigInt(1):(n[i]=a,a+=s.attention_mask.data[i])}}s.position_ids=new r.qY("int64",n,s.attention_mask.dims),t&&(s.position_ids=s.position_ids.slice(null,-1).unsqueeze_(-1))}function y(e){return new r.qY("bool",[e],[1])}async function M(e,s){let{encoder_outputs:t,past_key_values:n}=s;t||(t=(await S(e,s)).last_hidden_state);let a={input_ids:s.decoder_input_ids,encoder_hidden_states:t},i=!!n;e.decoder_merged_session.inputNames.includes("use_cache_branch")&&(a.use_cache_branch=y(i)),e.decoder_merged_session.inputNames.includes("encoder_attention_mask")&&(a.encoder_attention_mask=s.attention_mask),x(e.decoder_merged_session,a,i),e.addPastKeyValues(a,n);let o=await f(e.decoder_merged_session,a);return new iL({logits:o.logits,past_key_values:n=e.getPastKeyValues(o,n),encoder_outputs:t,...e.getAttentions(o)})}function k(e,s,t,n){let a=[],i=0,o=e.requires_attention_mask??!0,l=t.decoder_input_ids??t.decoder_start_token_id??t.bos_token_id??t.eos_token_id;for(let t of(l instanceof r.qY?l=l.tolist().flat():Array.isArray(l)||(l=[l]),s)){t.dims=[1,...t.dims];let s={inputs:t,encoder_outputs:null,prev_model_outputs:null,output_token_ids:l,done:!1,score:0,id:i++};o&&(s.attention_mask=w(e,t)),a.push(s)}return a}async function b(e,s){let t=e.main_input_name,n=s.output_token_ids;s.prev_model_outputs&&(n=n.slice(-1));let a={[t]:s.inputs,decoder_input_ids:function(e){if(e instanceof r.qY)return e;if(0===e.length)throw Error("items must be non-empty");if(!Array.isArray(e[0]))return new r.qY("int64",BigInt64Array.from(e.map(e=>BigInt(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.qY("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 v(e,s){e.output_token_ids=[...e.output_token_ids,s]}async function S(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.qY("int64",new BigInt64Array(t.input_ids.data.length),t.input_ids.dims)),await f(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??w(e,t)},o=!!n;e.session.inputNames.includes("use_cache_branch")&&(i.use_cache_branch=y(o)),x(e.session,i,o),e.addPastKeyValues(i,n);let r=await f(e.session,i);return{logits:r.logits,past_key_values:n=e.getPastKeyValues(r,n)}}function C(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=w(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.qY("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 A(e,s){e.output_token_ids=[...e.output_token_ids,s],e.model_input_ids=new r.qY("int64",[BigInt(s)],[1,1])}class P extends a.bV{main_input_name="input_ids";constructor(e,s){super(),this.config=e,this.session=s;const t=p.get(this.constructor),n=h.get(t);this.can_generate=!1,this._runBeam=null,this._getStartBeams=null,this._updateBeam=null,this._forward=null,4===n?(this.can_generate=!0,this._runBeam=L,this._getStartBeams=C,this._updateBeam=A,this._forward=F):2===n||3===n?(this.can_generate=!0,this._runBeam=b,this._getStartBeams=k,this._updateBeam=v,this._forward=M):this._forward=S}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=p.get(this),m=h.get(u);return 4===m?d=await Promise.all([n.E.from_pretrained(e,_),g(e,_.model_file_name??"decoder_model_merged",_),(0,i.wc)(e,"generation_config.json",!1,_)]):2===m||3===m?d=await Promise.all([n.E.from_pretrained(e,_),g(e,"encoder_model",_),g(e,"decoder_model_merged",_),(0,i.wc)(e,"generation_config.json",!1,_)]):5===m?d=await Promise.all([n.E.from_pretrained(e,_),g(e,"vision_encoder",_),g(e,"prompt_encoder_mask_decoder",_)]):1===m?d=await Promise.all([n.E.from_pretrained(e,_),g(e,"encoder_model",_),g(e,"decoder_model_merged",_)]):(0!==m&&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.E.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.VT;if(null!==e.repetition_penalty&&1!==e.repetition_penalty&&n.push(new o.hK(e.repetition_penalty)),null!==e.no_repeat_ngram_size&&e.no_repeat_ngram_size>0&&n.push(new o.Y8(e.no_repeat_ngram_size)),null!==e.bad_words_ids&&n.push(new o.SP(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.pe(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.z_(s,e.min_new_tokens,e.eos_token_id)),null!==e.forced_bos_token_id&&n.push(new o.zM(e.forced_bos_token_id)),null!==e.forced_eos_token_id&&n.push(new o.uB(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.S3(e.begin_suppress_tokens,t))}return null!==e.forced_decoder_ids&&n.push(new o.kU(e.forced_decoder_ids)),null!==t&&n.extend(t),n}_get_generation_config(e){let s=new o.Fq(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=p.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=a$.get(t)??aY.get(t)??aG.get(t)??aX.get(t);throw n&&(s+=` Please use the following class instead: '${n[0]}'`),Error(s)}if(!(e instanceof r.qY)&&!(0,a.iu)(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.qY?e.dims.at(-1):e.length))throw Error("Mu
1st supply a non-empty array of input token ids.");s=this._get_generation_config(s),t=t??new o.VT,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.LC.getSampler(s),h=this.getStartBeams(e,s,c,n);for(;h.some(e=>!e.done)&&c<d;){let e=[];for(let n of h){if(n.done){e.push(n);continue}if(_&&n.output_token_ids.length>=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),g=e=>m.map(t=>s.num_return_sequences>1?t.slice(0,s.num_return_sequences).map(s=>s[e]):[t[0][e]]).flat(),f=g("output_token_ids");return s.return_dict_in_generate?{sequences:f,decoder_attentions:g("decoder_attentions"),cross_attentions:g("cross_attentions")}:f}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<this.num_decoder_layers;++n)e[`past_key_values.${n}.encoder.key`]=new r.qY("float32",[],s),e[`past_key_values.${n}.encoder.value`]=new r.qY("float32",[],s),e[`past_key_values.${n}.decoder.key`]=new r.qY("float32",[],t),e[`past_key_values.${n}.decoder.value`]=new r.qY("float32",[],t)}else if("falcon"===this.config.model_type){let s=[+this.num_heads,0,this.dim_kv];for(let t=0;t<this.num_layers;++t)e[`past_key_values.${t}.key`]=new r.qY("float32",[],s),e[`past_key_values.${t}.value`]=new r.qY("float32",[],s)}else if(this.config.multi_query){let s=[+this.num_heads,0,2*this.dim_kv];for(let t=0;t<this.num_layers;++t)e[`past_key_values.${t}.key_value`]=new r.qY("float32",[],s)}else if("bloom"===this.config.model_type){let s=[+this.num_heads,this.dim_kv,0],t=[+this.num_heads,0,this.dim_kv];for(let n=0;n<this.num_layers;++n)e[`past_key_values.${n}.key`]=new r.qY("float32",[],s),e[`past_key_values.${n}.value`]=new r.qY("float32",[],t)}else{let s=[1,this.num_heads,0,this.dim_kv];for(let t=0;t<this.num_layers;++t)e[`past_key_values.${t}.key`]=new r.qY("float32",[],s),e[`past_key_values.${t}.value`]=new r.qY("float32",[],s)}}getStartBeams(e,s,t,n){return this._getStartBeams(this,e,s,t,n)}async runBeam(e){return await this._runBeam(this,e)}updateBeam(e,s){return this._updateBeam(e,s)}}class q{}class T extends q{constructor({last_hidden_state:e,hidden_states:s=null,attentions:t=null}){super(),this.last_hidden_state=e,this.hidden_states=s,this.attentions=t}}class B extends P{}class I extends B{}class D extends B{async _call(e){return new iT(await super._call(e))}}class E extends B{async _call(e){return new iA(await super._call(e))}}class N extends B{async _call(e){return new iq(await super._call(e))}}class G extends B{async _call(e){return new iB(await super._call(e))}}class O extends P{}class V extends O{}class j extends P{}class z extends j{}class Y extends j{async _call(e){return new iT(await super._call(e))}}class $ extends j{async _call(e){return new iA(await super._call(e))}}class R extends j{async _call(e){return new iq(await super._call(e))}}class W extends j{async _call(e){return new iB(await super._call(e))}}class X extends P{}class Q extends X{}class U extends X{async _call(e){return new iT(await super._call(e))}}class H extends X{async _call(e){return new iA(await super._call(e))}}class K extends X{async _call(e){return new iq(await super._call(e))}}class Z extends X{async _call(e){return new iB(await super._call(e))}}class J extends P{}class ee extends J{}class es extends J{async _call(e){return new iT(await super._call(e))}}class et extends J{async _call(e){return new iA(await super._call(e))}}class en extends J{async _call(e){return new iq(await super._call(e))}}class ea extends J{async _call(e){return new iB(await super._call(e))}}class ei extends P{}class eo extends ei{}class er extends ei{async _call(e){return new iT(await super._call(e))}}class el extends ei{async _call(e){return new iA(await super._call(e))}}class ec extends ei{async _call(e){return new iq(await super._call(e))}}class ed extends ei{async _call(e){return new iB(await super._call(e))}}class e_ extends P{}class eu extends e_{}class eh extends e_{async _call(e){return new iT(await super._call(e))}}class em extends e_{async _call(e){return new iA(await super._call(e))}}class ep extends e_{async _call(e){return new iq(await super._call(e))}}class eg extends e_{async _call(e){return new iB(await super._call(e))}}class ef extends P{}class ew extends ef{}class ex extends ef{async _call(e){return new iT(await super._call(e))}}class ey extends ef{async _call(e){return new iA(await super._call(e))}}class eM extends ef{async _call(e){return new iq(await super._call(e))}}class ek extends ef{async _call(e){return new iB(await super._call(e))}}class eb extends P{}class ev extends eb{}class eS extends eb{async _call(e){return new iA(await super._call(e))}}class eF extends eb{async _call(e){return new iq(await super._call(e))}}class eC extends eb{async _call(e){return new iB(await super._call(e))}}class eL extends eb{async _call(e){return new iT(await super._call(e))}}class eA extends P{}class eP extends eA{}class eq extends eA{async _call(e){return new iT(await super._call(e))}}class eT extends eA{async _call(e){return new iA(await super._call(e))}}class eB extends eA{async _call(e){return new iq(await super._call(e))}}class eI extends P{}class eD extends eI{}class eE extends eI{async _call(e){return new iT(await super._call(e))}}class eN extends eI{async _call(e){return new iA(await super._call(e))}}class eG extends eI{async _call(e){return new iB(await super._call(e))}}class eO extends P{}class eV extends eO{}class ej extends eO{async _call(e){return new iT(await super._call(e))}}class ez extends eO{async _call(e){return new iA(await super._call(e))}}class eY extends eO{async _call(e){return new iq(await super._call(e))}}class e$ extends eO{async _call(e){return new iB(await super._call(e))}}class eR extends P{}class eW extends eR{}class eX extends eR{async _call(e){return new iT(await super._call(e))}}class eQ extends eR{async _call(e){return new iA(await super._call(e))}}class eU extends eR{async _call(e){return new iB(await super._call(e))}}class eH extends P{}class eK extends eH{}class eZ extends eH{async _call(e){return new iA(await super._call(e))}}class eJ extends eH{async _call(e){return new iB(await super._call(e))}}class e0 extends eH{async _call(e){return new iT(await super._call(e))}}class e2 extends P{}class e1 extends e2{}class e3 extends e2{constructor(e,s,t,n){super(e,s),this.decoder_merged_session=t,this.generation_config=n,this.num_decoder_layers=this.config.num_decoder_layers,this.num_decoder_heads=this.config.num_heads,this.decoder_dim_kv=this.config.d_kv,this.num_encoder_layers=this.config.num_layers,this.num_encoder_heads=this.config.num_heads,this.encoder_dim_kv=this.config.d_kv}}class e4 extends P{}class e5 extends e4{}class e6 extends e4{constructor(e,s,t,n){super(e,s),this.decoder_merged_session=t,this.generation_config=n,this.num_decoder_layers=this.config.num_decoder_layers,this.num_decoder_heads=this.config.num_heads,this.decoder_dim_kv=this.config.d_kv,this.num_encoder_layers=this.config.num_layers,this.num_encoder_heads=this.config.num_heads,this.encoder_dim_kv=this.config.d_kv}}class e7 extends P{}class e8 extends e7{}class e9 extends e7{constructor(e,s,t,n){super(e,s),this.decoder_merged_session=t,this.generation_config=n,this.num_decoder_layers=this.config.num_decoder_layers,this.num_decoder_heads=this.config.num_heads,this.decoder_dim_kv=this.config.d_kv,this.num_encoder_layers=this.config.num_layers,this.num_encoder_heads=this.config.num_heads,this.encoder_dim_kv=this.config.d_kv}}class se extends P{}class ss extends se{}class st extends se{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 sn extends se{async _call(e){return new iA(await super._call(e))}}class sa extends P{}class si extends sa{}class so extends sa{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 sr extends sa{async _call(e){return new iA(await super._call(e))}}class sl extends sa{constructor(e,s,t){super(e,s),this.generation_config=t,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 sc extends P{}class sd extends sc{}class s_ extends sc{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 su extends P{}class sh extends su{}class sm extends su{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 sp extends P{}class sg extends sp{}class sf extends sp{async _call(e){return new iT(await super._call(e))}}class sw extends sp{async _call(e){return new iA(await super._call(e))}}class sx extends sp{async _call(e){return new iq(await super._call(e))}}class sy extends sp{async _call(e){return new iB(await super._call(e))}}class sM extends P{}class sk extends sM{}class sb extends sM{async _call(e){return new iT(await super._call(e))}}class sv extends sM{async _call(e){return new iA(await super._call(e))}}class sS extends sM{async _call(e){return new iq(await super._call(e))}}class sF extends sM{async _call(e){return new iB(await super._call(e))}}class sC extends P{}class sL extends sC{}class sA extends sC{async _call(e){return new iT(await super._call(e))}}class sP extends sC{async _call(e){return new iA(await super._call(e))}}class sq extends sC{async _call(e){return new iq(await super._call(e))}}class sT extends sC{async _call(e){return new iB(await super._call(e))}}class sB extends P{}class sI extends sB{}class sD extends sB{}class sE extends P{}class sN extends sE{}class sG extends sE{requires_attention_mask=!1;main_input_name="input_features";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}async generate(e,s=null,t=null){if(s=this._get_generation_config(s),s.return_timestamps??=!1,s.return_timestamps&&(t=[new o.Fg(s)]),s.return_token_timestamps&&(s.output_attentions=!0,s.return_dict_in_generate=!0,"translate"===s.task&&console.warn("Token-level timestamps may not be reliable for task 'translate'."),!s.alignment_heads))throw Error("Model generation config has no `alignment_heads`, token-level timestamps not available. See https://gist.github.com/hollance/42e32852f24243b748ae6bc1f985b13a on how to add this property to the generation config.");let n=await super.generate(e,s,t);return s.return_token_timestamps&&s.alignment_heads&&(n.token_timestamps=this._extract_token_timestamps(n,s.alignment_heads,s.num_frames)),n}_extract_token_timestamps(e,s,t=null,n=.02){if(!e.cross_attentions)throw Error("Model outputs must contain cross attentions to extract timestamps. This is most likely because the model was not exported with `output_attentions=True`.");let i=this.config.median_filter_width;void 0===i&&(console.warn("Model config has no `median_filter_width`, using default value of 7."),i=7);let o=e.cross_attentions.map(e=>{let n=Array.from({length:this.config.decoder_layers},(s,t)=>(0,r.$q)(e.map(e=>e[t]),2)),a=(0,r.t$)(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.cQ)(a,-2,0,!0),d=a.clone();for(let e=0;e<d.dims[0];++e){let s=d[e];for(let t=0;
1t<s.dims[0];++t){let n=s[t],a=o[e][t][0],r=l[e][t][0];for(let e=0;e<n.dims[0];++e){let s=n[e];for(let e=0;e<s.data.length;++e)s.data[e]=(s.data[e]-r.data[e])/a.data[e];s.data.set((0,c.medianFilter)(s.data,i))}}}return(0,r.i2)(d,1)}),l=[e.sequences.length,e.sequences[0].length],d=new r.qY("float32",new Float32Array(l[0]*l[1]),l);for(let e=0;e<l[0];++e){let s=o[e].neg().squeeze_(0),[t,i]=(0,r.$y)(s),l=Array.from({length:t.length-1},(e,s)=>t[s+1]-t[s]),c=(0,a.TR)([1],l).map(e=>!!e),_=[];for(let e=0;e<c.length;++e)c[e]&&_.push(i[e]*n);d[e].data.set(_,1)}return d}}class sO extends P{main_input_name="pixel_values";constructor(e,s,t,n){super(e,s),this.decoder_merged_session=t,this.generation_config=n;const a=this.config.encoder,i=this.config.decoder,o=a.model_type;(aD.get(o)??aE.get(o))||console.warn(`Model type for encoder '${o}' not found, assuming encoder-only architecture. Please report this at https://github.com/xenova/transformers.js/issues/new/choose.`);const r=a$.get(i.model_type);if(!r)throw Error(`Unable to construct \`VisionEncoderDecoder\` due to unsupported decoder: "${this.config.decoder.model_type}"`);const l=new r[1](i,t,n);this.add_encoder_pkv="num_decoder_layers"in l,this.add_encoder_pkv?(this.num_decoder_layers=l.num_decoder_layers,this.num_decoder_heads=l.num_decoder_heads,this.decoder_dim_kv=l.decoder_dim_kv,this.num_encoder_layers=l.num_encoder_layers,this.num_encoder_heads=l.num_encoder_heads,this.encoder_dim_kv=l.encoder_dim_kv):(this.num_layers=l.num_layers,this.num_heads=l.num_heads,this.dim_kv=l.dim_kv)}}class sV extends P{}class sj extends sV{}class sz extends sV{static async from_pretrained(e,s={}){return s.model_file_name??="text_model",super.from_pretrained(e,s)}}class sY extends sV{static async from_pretrained(e,s={}){return s.model_file_name??="vision_model",super.from_pretrained(e,s)}}class s$ extends P{}class sR extends s${}class sW extends s${static async from_pretrained(e,s={}){return s.model_file_name??="text_model",super.from_pretrained(e,s)}}class sX extends sV{static async from_pretrained(e,s={}){return s.model_file_name??="vision_model",super.from_pretrained(e,s)}}class sQ extends P{}class sU extends sQ{}class sH extends P{}class sK extends sH{}class sZ extends sH{}class sJ extends P{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.n_head,this.num_layers=this.config.n_layer,this.dim_kv=this.config.n_embd/this.num_heads}}class s0 extends sJ{}class s2 extends sJ{}class s1 extends P{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_heads,this.num_layers=this.config.num_layers,this.dim_kv=this.config.hidden_size/this.num_heads}}class s3 extends s1{}class s4 extends s1{}class s5 extends P{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.num_heads}}class s6 extends s5{}class s7 extends s5{}class s8 extends P{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.n_head,this.num_layers=this.config.n_layer,this.dim_kv=this.config.n_embd/this.num_heads}}class s9 extends s8{}class te extends s8{}class ts extends P{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.n_head,this.num_layers=this.config.n_layer,this.dim_kv=this.config.n_embd/this.num_heads}}class tt extends ts{}class tn extends ts{}class ta extends P{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.n_head,this.num_layers=this.config.n_layer,this.dim_kv=this.config.n_embd/this.num_heads}}class ti extends ta{}class to extends ta{}class tr extends P{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.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 tl extends tr{}class tc extends tr{}class td extends P{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.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 t_ extends td{}class tu extends td{}class th extends P{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.num_heads}}class tm extends th{}class tp extends th{}class tg extends P{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.n_head,this.num_layers=this.config.n_layer,this.dim_kv=this.config.hidden_size/this.num_heads}}class tf extends tg{}class tw extends tg{}class tx extends P{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.n_heads,this.num_layers=this.config.n_layers,this.dim_kv=this.config.d_model/this.num_heads}}class ty extends tx{}class tM extends tx{}class tk extends P{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.num_heads}}class tb extends tk{}class tv extends tk{}class tS extends P{}class tF extends tS{}class tC extends tS{async _call(e){return new iA(await super._call(e))}}class tL extends P{}class tA extends tL{}class tP extends tL{async _call(e){return new iA(await super._call(e))}}class tq extends P{}class tT extends tq{async _call(e){return new iE(await super._call(e))}}class tB extends P{}class tI extends tB{}class tD extends tB{async _call(e){return new iA(await super._call(e))}}class tE extends P{}class tN extends tE{}class tG extends tE{async _call(e){return new iA(await super._call(e))}}class tO extends P{}class tV extends tO{}class tj extends tO{}class tz extends P{}class tY extends tz{}class t$ extends tz{}class tR extends P{}class tW extends tR{}class tX extends tR{async _call(e){return new iA(await super._call(e))}}class tQ extends P{}class tU extends tQ{}class tH extends tQ{async _call(e){return new tZ(await super._call(e))}}class tK extends tQ{async _call(e){return new tJ(await super._call(e))}}class tZ extends q{constructor({logits:e,pred_boxes:s}){super(),this.logits=e,this.pred_boxes=s}}class tJ extends q{constructor({logits:e,pred_boxes:s,pred_masks:t}){super(),this.logits=e,this.pred_boxes=s,this.pred_masks=t}}class t0 extends P{}class t2 extends t0{}class t1 extends t0{async _call(e){return new t3(await super._call(e))}}class t3 extends tZ{}class t4 extends P{}class t5 extends t4{}class t6 extends t4{async _call(e){return new iA(await super._call(e))}}class t7 extends P{}class t8 extends t7{}class t9 extends t7{async _call(e){return new iA(await super._call(e))}}class ne extends P{}class ns extends ne{}class nt extends ne{async _call(e){return new iA(await super._call(e))}}class nn extends P{}class na extends nn{}class ni extends nn{}class no extends P{}class nr extends no{}class nl extends no{}class nc extends P{}class nd extends nc{}class n_ extends P{}class nu extends n_{}class nh extends n_{}class nm extends P{}class np extends nm{}class ng extends P{}class nf extends ng{}class nw extends ng{async _call(e){return new iA(await super._call(e))}}class nx extends P{}class ny extends nx{}class nM extends nx{async _call(e){return new iA(await super._call(e))}}class nk extends P{}class nb extends nk{}class nv extends nk{async _call(e){return new iA(await super._call(e))}}class nS extends P{}class nF extends nS{}class nC extends nS{async _call(e){return new nL(await super._call(e))}}class nL extends q{constructor({logits:e,pred_boxes:s}){super(),this.logits=e,this.pred_boxes=s}}class nA extends P{}class nP extends nA{constructor(e,s,t){super(e,s),this.prompt_encoder_mask_decoder=t}async get_image_embeddings({pixel_values:e}){return await S(this,{pixel_values:e})}async forward(e){if(e.image_embeddings&&e.image_positional_embeddings||(e={...e,...await this.get_image_embeddings(e)}),!e.input_labels){let s=e.input_points.dims.slice(0,-1),t=s.reduce((e,s)=>e*s,1);e.input_labels=new r.qY("int64",new BigInt64Array(t).fill(1n),s)}return await f(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 nq(await super._call(e))}}class nq extends q{constructor({iou_scores:e,pred_masks:s}){super(),this.iou_scores=e,this.pred_masks=s}}class nT extends P{}class nB extends nT{}class nI extends nT{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 nD extends P{}class nE extends nD{}class nN extends nD{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 nG extends P{}class nO extends nG{}class nV extends nG{async _call(e){return new iI(await super._call(e))}}class nj extends nG{async _call(e){return new iA(await super._call(e))}}class nz extends nG{async _call(e){return new iq(await super._call(e))}}class nY extends P{}class n$ extends nY{}class nR extends nY{async _call(e){return new iI(await super._call(e))}}class nW extends nY{async _call(e){return new iA(await super._call(e))}}class nX extends P{}class nQ extends nX{}class nU extends nX{async _call(e){return new iI(await super._call(e))}}class nH extends nX{async _call(e){return new iA(await super._call(e))}}class nK extends nX{async _call(e){return new iq(await super._call(e))}}class nZ extends P{}class nJ extends nZ{}class n0 extends nZ{async _call(e){return new iI(await super._call(e))}}class n2 extends nZ{async _call(e){return new iA(await super._call(e))}}class n1 extends P{}class n3 extends nG{}class n4 extends nG{async _call(e){return new iI(await super._call(e))}}class n5 extends nG{async _call(e){return new iA(await super._call(e))}}class n6 extends P{}class n7 extends n6{}class n8 extends n6{async _call(e){return new iI(await super._call(e))}}class n9 extends n6{async _call(e){return new iA(await super._call(e))}}class ae extends n6{async _call(e){return new iP(await super._call(e))}}class as extends n6{async _call(e){return new iq(await super._call(e))}}class at extends P{}class an extends at{}class aa extends at{}class ai extends at{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 S(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,g=0;for(;;){++g;let e={use_cache_branch:y(!!p),output_sequence:p?p.output_sequence_out:new r.qY("float32",new Float32Array(u),[1,1,u]),encoder_attention_mask:l,speaker_embeddings:s,encoder_hidden_states:o};this.addPastKeyValues(e,m),p=await f(this.decoder_merged_session,e),m=this.getPastKeyValues(p,m);let{prob:n,spectrum:a}=p;if(h.push(a),g>=_&&(Array.from(n.data).filter(e=>e>=t).length>0||g>=d))break}
vendor: 4,885 bytes, line 1
1let w=(0,r.$q)(h),{waveform:x}=await f(i.session,{spectrogram:w});return{spectrogram:w,waveform:x}}}class ao extends P{main_input_name="spectrogram"}class ar extends P{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 al extends ar{}class ac extends P{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 ad extends ac{}class a_ extends ac{}class au extends P{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 ah extends au{}class am extends au{}class ap extends P{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 ag extends ap{}class af extends ap{}class aw extends P{}class ax extends aw{}class ay extends aw{static async from_pretrained(e,s={}){return s.model_file_name??="text_model",super.from_pretrained(e,s)}}class aM extends aw{static async from_pretrained(e,s={}){return s.model_file_name??="audio_model",super.from_pretrained(e,s)}}class ak extends P{}class ab extends ak{async _call(e){return new iN(await super._call(e))}}class av extends P{}class aS extends av{}class aF extends av{}class aC extends av{}class aL extends P{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.num_heads}}class aA extends aL{}class aP extends aL{}class aq extends P{}class aT extends aq{}class aB extends aq{async _call(e){return new iA(await super._call(e))}}class aI{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.E.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 P.from_pretrained(e,c);throw Error(`Unsupported model type: ${a.model_type}`)}}let aD=new Map([["bert",["BertModel",I]],["nomic_bert",["NomicBertModel",V]],["roformer",["RoFormerModel",z]],["electra",["ElectraModel",ee]],["esm",["EsmModel",eP]],["convbert",["ConvBertModel",Q]],["camembert",["CamembertModel",eo]],["deberta",["DebertaModel",eu]],["deberta-v2",["DebertaV2Model",ew]],["mpnet",["MPNetModel",eV]],["albert",["AlbertModel",eK]],["distilbert",["DistilBertModel",ev]],["roberta",["RobertaModel",sg]],["xlm",["XLMModel",sk]],["xlm-roberta",["XLMRobertaModel",sL]],["clap",["ClapModel",ax]],["clip",["CLIPModel",sj]],["clipseg",["CLIPSegModel",sK]],["chinese_clip",["ChineseCLIPModel",sU]],["siglip",["SiglipModel",sR]],["mobilebert",["MobileBertModel",eD]],["squeezebert",["SqueezeBertModel",eW]],["wav2vec2",["Wav2Vec2Model",nO]],["wav2vec2-bert",["Wav2Vec2BertModel",nJ]],["unispeech",["UniSpeechModel",n$]],["unispeech-sat",["UniSpeechSatModel",nQ]],["hubert",["HubertModel",n3]],["wavlm",["WavLMModel",n7]],["audio-spectrogram-transformer",["ASTModel",sI]],["vits",["VitsModel",ab]],["detr",["DetrModel",tU]],["table-transformer",["TableTransformerModel",t2]],["vit",["ViTModel",tF]],["fastvit",["FastViTModel",tA]],["mobilevit",["MobileViTModel",tI]],["mobilevitv2",["MobileViTV2Model",tN]],["owlvit",["OwlViTModel",tV]],["owlv2",["Owlv2Model",tY]],["beit",["BeitModel",tW]],["deit",["DeiTModel",t5]],["convnext",["ConvNextModel",nf]],["convnextv2",["ConvNextV2Model",ny]],["dinov2",["Dinov2Model",nb]],["resnet",["ResNetModel",t8]],["swin",["SwinModel",ns]],["swin2sr",["Swin2SRModel",na]],["donut-swin",["DonutSwinModel",np]],["yolos",["YolosModel",nF]],["dpt",["DPTModel",nr]],["glpn",["GLPN
1Model",nu]],["hifigan",["SpeechT5HifiGan",ao]],["efficientnet",["EfficientNetModel",aT]]]),aE=new Map([["t5",["T5Model",e1]],["longt5",["LongT5Model",e5]],["mt5",["MT5Model",e8]],["bart",["BartModel",ss]],["mbart",["MBartModel",si]],["marian",["MarianModel",nB]],["whisper",["WhisperModel",sN]],["m2m_100",["M2M100Model",nE]],["blenderbot",["BlenderbotModel",sd]],["blenderbot-small",["BlenderbotSmallModel",sh]]]),aN=new Map([["bloom",["BloomModel",tf]],["gpt2",["GPT2Model",s0]],["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",ad]],["starcoder2",["Starcoder2Model",ah]],["falcon",["FalconModel",ag]]]),aG=new Map([["speecht5",["SpeechT5ForSpeechToText",aa]],["whisper",["WhisperForConditionalGeneration",sG]]]),aO=new Map([["speecht5",["SpeechT5ForTextToSpeech",ai]]]),aV=new Map([["vits",["VitsModel",ab]]]),aj=new Map([["bert",["BertForSequenceClassification",E]],["roformer",["RoFormerForSequenceClassification",$]],["electra",["ElectraForSequenceClassification",et]],["esm",["EsmForSequenceClassification",eT]],["convbert",["ConvBertForSequenceClassification",H]],["camembert",["CamembertForSequenceClassification",el]],["deberta",["DebertaForSequenceClassification",em]],["deberta-v2",["DebertaV2ForSequenceClassification",ey]],["mpnet",["MPNetForSequenceClassification",ez]],["albert",["AlbertForSequenceClassification",eZ]],["distilbert",["DistilBertForSequenceClassification",eS]],["roberta",["RobertaForSequenceClassification",sw]],["xlm",["XLMForSequenceClassification",sv]],["xlm-roberta",["XLMRobertaForSequenceClassification",sP]],["bart",["BartForSequenceClassification",sn]],["mbart",["MBartForSequenceClassification",sr]],["mobilebert",["MobileBertForSequenceClassification",eN]],["squeezebert",["SqueezeBertForSequenceClassification",eQ]]]),az=new Map([["bert",["BertForTokenClassification",N]],["roformer",["RoFormerForTokenClassification",R]],["electra",["ElectraForTokenClassification",en]],["esm",["EsmForTokenClassification",eB]],["convbert",["ConvBertForTokenClassification",K]],["camembert",["CamembertForTokenClassification",ec]],["deberta",["DebertaForTokenClassification",ep]],["deberta-v2",["DebertaV2ForTokenClassification",eM]],["mpnet",["MPNetForTokenClassification",eY]],["distilbert",["DistilBertForTokenClassification",eF]],["roberta",["RobertaForTokenClassification",sx]],["xlm",["XLMForTokenClassification",sS]],["xlm-roberta",["XLMRobertaForTokenClassification",sq]]]),aY=new Map([["t5",["T5ForConditionalGeneration",e3]],["longt5",["LongT5ForConditionalGeneration",e6]],["mt5",["MT5ForConditionalGeneration",e9]],["bart",["BartForConditionalGeneration",st]],["mbart",["MBartForConditionalGeneration",so]],["marian",["MarianMTModel",nI]],["m2m_100",["M2M100ForConditionalGeneration",nN]],["blenderbot",["BlenderbotForConditionalGeneration",s_]],["blenderbot-small",["BlenderbotSmallForConditionalGeneration",sm]]]),a$=new Map([["bloom",["BloomForCausalLM",tw]],["gpt2",["GPT2LMHeadModel",s2]],["gptj",["GPTJForCausalLM",te]],["gpt_bigcode",["GPTBigCodeForCausalLM",tn]],["gpt_neo",["GPTNeoForCausalLM",s4]],["gpt_neox",["GPTNeoXForCausalLM",s7]],["codegen",["CodeGenForCausalLM",to]],["llama",["LlamaForCausalLM",tc]],["qwen2",["Qwen2ForCausalLM",tu]],["phi",["PhiForCausalLM",tp]],["mpt",["MptForCausalLM",tM]],["opt",["OPTForCausalLM",tv]],["mbart",["MBartForCausalLM",sl]],["mistral",["MistralForCausalLM",a_]],["starcoder2",["Starcoder2ForCausalLM",am]],["falcon",["FalconForCausalLM",af]],["trocr",["TrOCRForCausalLM",al]],["stablelm",["StableLmForCausalLM",aP]]]),aR=new Map([["bert",["BertForMaskedLM",D]],["roformer",["RoFormerForMaskedLM",Y]],["electra",["ElectraForMaskedLM",es]],["esm",["EsmForMaskedLM",eq]],["convbert",["ConvBertForMaskedLM",U]],["camembert",["CamembertForMaskedLM",er]],["deberta",["DebertaForMaskedLM",eh]],["deberta-v2",["DebertaV2ForMaskedLM",ex]],["mpnet",["MPNetForMaskedLM",ej]],["albert",["AlbertForMaskedLM",e0]],["distilbert",["DistilBertForMaskedLM",eL]],["roberta",["RobertaF
1orMaskedLM",sf]],["xlm",["XLMWithLMHeadModel",sb]],["xlm-roberta",["XLMRobertaForMaskedLM",sA]],["mobilebert",["MobileBertForMaskedLM",eE]],["squeezebert",["SqueezeBertForMaskedLM",eX]]]),aW=new Map([["bert",["BertForQuestionAnswering",G]],["roformer",["RoFormerForQuestionAnswering",W]],["electra",["ElectraForQuestionAnswering",ea]],["convbert",["ConvBertForQuestionAnswering",Z]],["camembert",["CamembertForQuestionAnswering",ed]],["deberta",["DebertaForQuestionAnswering",eg]],["deberta-v2",["DebertaV2ForQuestionAnswering",ek]],["mpnet",["MPNetForQuestionAnswering",e$]],["albert",["AlbertForQuestionAnswering",eJ]],["distilbert",["DistilBertForQuestionAnswering",eC]],["roberta",["RobertaForQuestionAnswering",sy]],["xlm",["XLMForQuestionAnswering",sF]],["xlm-roberta",["XLMRobertaForQuestionAnswering",sT]],["mobilebert",["MobileBertForQuestionAnswering",eG]],["squeezebert",["SqueezeBertForQuestionAnswering",eU]]]),aX=new Map([["vision-encoder-decoder",["VisionEncoderDecoderModel",sO]]]),aQ=new Map([["vision-encoder-decoder",["VisionEncoderDecoderModel",sO]]]),aU=new Map([["vit",["ViTForImageClassification",tC]],["fastvit",["FastViTForImageClassification",tP]],["mobilevit",["MobileViTForImageClassification",tD]],["mobilevitv2",["MobileViTV2ForImageClassification",tG]],["beit",["BeitForImageClassification",tX]],["deit",["DeiTForImageClassification",t6]],["convnext",["ConvNextForImageClassification",nw]],["convnextv2",["ConvNextV2ForImageClassification",nM]],["dinov2",["Dinov2ForImageClassification",nv]],["resnet",["ResNetForImageClassification",t9]],["swin",["SwinForImageClassification",nt]],["segformer",["SegformerForImageClassification",aF]],["efficientnet",["EfficientNetForImageClassification",aB]]]),aH=new Map([["detr",["DetrForObjectDetection",tH]],["table-transformer",["TableTransformerForObjectDetection",t1]],["yolos",["YolosForObjectDetection",nC]]]),aK=new Map([["owlvit",["OwlViTForObjectDetection",tj]],["owlv2",["Owlv2ForObjectDetection",t$]]]),aZ=new Map([["detr",["DetrForSegmentation",tK]],["clipseg",["CLIPSegForImageSegmentation",sZ]]]),aJ=new Map([["segformer",["SegformerForSemanticSegmentation",aC]]]),a0=new Map([["sam",["SamModel",nP]]]),a2=new Map([["wav2vec2",["Wav2Vec2ForCTC",nV]],["wav2vec2-bert",["Wav2Vec2BertForCTC",n0]],["unispeech",["UniSpeechForCTC",nR]],["unispeech-sat",["UniSpeechSatForCTC",nU]],["wavlm",["WavLMForCTC",n8]],["hubert",["HubertForCTC",n4]]]),a1=new Map([["wav2vec2",["Wav2Vec2ForSequenceClassification",nj]],["wav2vec2-bert",["Wav2Vec2BertForSequenceClassification",n2]],["unispeech",["UniSpeechForSequenceClassification",nW]],["unispeech-sat",["UniSpeechSatForSequenceClassification",nH]],["wavlm",["WavLMForSequenceClassification",n9]],["hubert",["HubertForSequenceClassification",n5]],["audio-spectrogram-transformer",["ASTForAudioClassification",sD]]]),a3=new Map([["wavlm",["WavLMForXVector",ae]]]),a4=new Map([["unispeech-sat",["UniSpeechSatForAudioFrameClassification",nK]],["wavlm",["WavLMForAudioFrameClassification",as]],["wav2vec2",["Wav2Vec2ForAudioFrameClassification",nz]]]),a5=new Map([["vitmatte",["VitMatteForImageMatting",tT]]]),a6=new Map([["swin2sr",["Swin2SRForImageSuperResolution",ni]]]),a7=new Map([["dpt",["DPTForDepthEstimation",nl]],["depth_anything",["DepthAnythingForDepthEstimation",nd]],["glpn",["GLPNForDepthEstimation",nh]]]),a8=new Map([["clip",["CLIPVisionModelWithProjection",sY]],["siglip",["SiglipVisionModel",sX]]]),a9=[[aD,0],[aE,1],[aN,4],[aj,0],[az,0],[aY,2],[aG,2],[a$,4],[aR,0],[aW,0],[aX,3],[aU,0],[aZ,0],[aJ,0],[a5,0],[a6,0],[a7,0],[aH,0],[aK,0],[a0,5],[a2,0],[a1,0],[aO,2],[aV,0],[a3,0],[a4,0],[a8,0]];for(let[e,s]of a9)for(let[t,n]of e.values())h.set(t,s),p.set(n,t),m.set(t,n);for(let[e,s,t]of[["CLIPTextModelWithProjection",sz,0],["SiglipTextModel",sW,0],["ClapTextModelWithProjection",ay,0],["ClapAudioModelWithProjection",aM,0]])h.set(e,t),p.set(s,e),m.set(e,s);class ie extends aI{static MODEL_CLASS_MAPPINGS=a9.map(e=>e[0]);static BASE_IF_FAIL=!0}class is extends aI{static MODEL_CLASS_MAPPINGS=[aj]}class it extends aI{static MODEL_CLASS_MAPPINGS=[az]}class ia extends aI{static MODEL_CLASS_MAPPINGS=[aY]}class ii extends aI{static MODEL_CLASS_MAPPINGS=[aG]}class io extends aI{static MODEL_CLASS_MAPPINGS=[aO]}class ir extends aI{static MODEL_CLASS_MAPPINGS=[aV]}class il extends aI{static MODEL_CLASS_MAPPINGS=[a$]}class ic extends aI{static MODEL_CLASS_MAPPINGS=[aR]}
1class id extends aI{static MODEL_CLASS_MAPPINGS=[aW]}class i_ extends aI{static MODEL_CLASS_MAPPINGS=[aX]}class iu extends aI{static MODEL_CLASS_MAPPINGS=[aU]}class ih extends aI{static MODEL_CLASS_MAPPINGS=[aZ]}class im extends aI{static MODEL_CLASS_MAPPINGS=[aJ]}class ip extends aI{static MODEL_CLASS_MAPPINGS=[aH]}class ig extends aI{static MODEL_CLASS_MAPPINGS=[aK]}class iw extends aI{static MODEL_CLASS_MAPPINGS=[a0]}class ix extends aI{static MODEL_CLASS_MAPPINGS=[a2]}class iy extends aI{static MODEL_CLASS_MAPPINGS=[a1]}class iM extends aI{static MODEL_CLASS_MAPPINGS=[a3]}class ik extends aI{static MODEL_CLASS_MAPPINGS=[a4]}class ib extends aI{static MODEL_CLASS_MAPPINGS=[aQ]}class iv extends aI{static MODEL_CLASS_MAPPINGS=[a5]}class iS extends aI{static MODEL_CLASS_MAPPINGS=[a6]}class iF extends aI{static MODEL_CLASS_MAPPINGS=[a7]}class iC extends aI{static MODEL_CLASS_MAPPINGS=[a8]}class iL extends q{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 iA extends q{constructor({logits:e}){super(),this.logits=e}}class iP extends q{constructor({logits:e,embeddings:s}){super(),this.logits=e,this.embeddings=s}}class iq extends q{constructor({logits:e}){super(),this.logits=e}}class iT extends q{constructor({logits:e}){super(),this.logits=e}}class iB extends q{constructor({start_logits:e,end_logits:s}){super(),this.start_logits=e,this.end_logits=s}}class iI extends q{constructor({logits:e}){super(),this.logits=e}}class iD extends q{constructor({logits:e,past_key_values:s}){super(),this.logits=e,this.past_key_values=s}}class iE extends q{constructor({alphas:e}){super(),this.alphas=e}}class iN extends q{constructor({waveform:e,spectrogram:s}){super(),this.waveform=e,this.spectrogram=s}}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.