@huggingface/transformers 3.4.0 → 3.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -2
- package/dist/transformers.js +315 -152
- package/dist/transformers.js.map +1 -1
- package/dist/transformers.min.js +1 -1
- package/dist/transformers.min.js.map +1 -1
- package/dist/transformers.node.cjs +303 -151
- package/dist/transformers.node.cjs.map +1 -1
- package/dist/transformers.node.min.cjs +1 -1
- package/dist/transformers.node.min.cjs.map +1 -1
- package/dist/transformers.node.min.mjs +1 -1
- package/dist/transformers.node.min.mjs.map +1 -1
- package/dist/transformers.node.mjs +315 -152
- package/dist/transformers.node.mjs.map +1 -1
- package/dist/transformers.web.js +315 -152
- package/dist/transformers.web.js.map +1 -1
- package/dist/transformers.web.min.js +1 -1
- package/dist/transformers.web.min.js.map +1 -1
- package/package.json +1 -1
- package/src/configs.js +2 -0
- package/src/env.js +1 -1
- package/src/models/feature_extractors.js +1 -0
- package/src/models/snac/feature_extraction_snac.js +3 -0
- package/src/models.js +90 -2
- package/src/pipelines.js +140 -135
- package/src/utils/image.js +9 -1
- package/src/utils/tensor.js +6 -2
- package/types/configs.d.ts.map +1 -1
- package/types/models/feature_extractors.d.ts +1 -0
- package/types/models/snac/feature_extraction_snac.d.ts +4 -0
- package/types/models/snac/feature_extraction_snac.d.ts.map +1 -0
- package/types/models.d.ts +48 -0
- package/types/models.d.ts.map +1 -1
- package/types/pipelines.d.ts +2 -2
- package/types/pipelines.d.ts.map +1 -1
- package/types/tsconfig.tsbuildinfo +1 -1
- package/types/utils/image.d.ts +2 -2
- package/types/utils/image.d.ts.map +1 -1
- package/types/utils/tensor.d.ts.map +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import*as e from"fs";import*as t from"onnxruntime-common";import*as s from"onnxruntime-node";import*as o from"path";import*as r from"sharp";import*as n from"url";var a,i,l={fs:t=>{t.exports=e},"onnxruntime-common":e=>{e.exports=t},"onnxruntime-node":e=>{e.exports=s},path:e=>{e.exports=o},sharp:e=>{e.exports=r},url:e=>{e.exports=n},"?8b6b":()=>{},"./node_modules/@huggingface/jinja/dist/index.js":(e,t,s)=>{s.r(t),s.d(t,{Environment:()=>Y,Interpreter:()=>K,Template:()=>te,parse:()=>j,tokenize:()=>d});var o=Object.freeze({Text:"Text",NumericLiteral:"NumericLiteral",BooleanLiteral:"BooleanLiteral",NullLiteral:"NullLiteral",StringLiteral:"StringLiteral",Identifier:"Identifier",Equals:"Equals",OpenParen:"OpenParen",CloseParen:"CloseParen",OpenStatement:"OpenStatement",CloseStatement:"CloseStatement",OpenExpression:"OpenExpression",CloseExpression:"CloseExpression",OpenSquareBracket:"OpenSquareBracket",CloseSquareBracket:"CloseSquareBracket",OpenCurlyBracket:"OpenCurlyBracket",CloseCurlyBracket:"CloseCurlyBracket",Comma:"Comma",Dot:"Dot",Colon:"Colon",Pipe:"Pipe",CallOperator:"CallOperator",AdditiveBinaryOperator:"AdditiveBinaryOperator",MultiplicativeBinaryOperator:"MultiplicativeBinaryOperator",ComparisonBinaryOperator:"ComparisonBinaryOperator",UnaryOperator:"UnaryOperator",Set:"Set",If:"If",For:"For",In:"In",Is:"Is",NotIn:"NotIn",Else:"Else",EndIf:"EndIf",ElseIf:"ElseIf",EndFor:"EndFor",And:"And",Or:"Or",Not:"UnaryOperator",Macro:"Macro",EndMacro:"EndMacro"}),r=Object.freeze({set:o.Set,for:o.For,in:o.In,is:o.Is,if:o.If,else:o.Else,endif:o.EndIf,elif:o.ElseIf,endfor:o.EndFor,and:o.And,or:o.Or,not:o.Not,"not in":o.NotIn,macro:o.Macro,endmacro:o.EndMacro,true:o.BooleanLiteral,false:o.BooleanLiteral,none:o.NullLiteral,True:o.BooleanLiteral,False:o.BooleanLiteral,None:o.NullLiteral}),n=class{constructor(e,t){this.value=e,this.type=t}};function a(e){return/\w/.test(e)}function i(e){return/[0-9]/.test(e)}var l=[["{%",o.OpenStatement],["%}",o.CloseStatement],["{{",o.OpenExpression],["}}",o.CloseExpression],["(",o.OpenParen],[")",o.CloseParen],["{",o.OpenCurlyBracket],["}",o.CloseCurlyBracket],["[",o.OpenSquareBracket],["]",o.CloseSquareBracket],[",",o.Comma],[".",o.Dot],[":",o.Colon],["|",o.Pipe],["<=",o.ComparisonBinaryOperator],[">=",o.ComparisonBinaryOperator],["==",o.ComparisonBinaryOperator],["!=",o.ComparisonBinaryOperator],["<",o.ComparisonBinaryOperator],[">",o.ComparisonBinaryOperator],["+",o.AdditiveBinaryOperator],["-",o.AdditiveBinaryOperator],["*",o.MultiplicativeBinaryOperator],["/",o.MultiplicativeBinaryOperator],["%",o.MultiplicativeBinaryOperator],["=",o.Equals]],c=new Map([["n","\n"],["t","\t"],["r","\r"],["b","\b"],["f","\f"],["v","\v"],["'","'"],['"','"'],["\\","\\"]]);function d(e,t={}){const s=[],d=function(e,t={}){return e.endsWith("\n")&&(e=e.slice(0,-1)),e=e.replace(/{#.*?#}/gs,"{##}"),t.lstrip_blocks&&(e=e.replace(/^[ \t]*({[#%])/gm,"$1")),t.trim_blocks&&(e=e.replace(/([#%]})\n/g,"$1")),e.replace(/{##}/g,"").replace(/-%}\s*/g,"%}").replace(/\s*{%-/g,"{%").replace(/-}}\s*/g,"}}").replace(/\s*{{-/g,"{{")}(e,t);let u=0;const _=e=>{let t="";for(;e(d[u]);)if("\\"!==d[u]){if(t+=d[u++],u>=d.length)throw new SyntaxError("Unexpected end of input")}else{if(++u,u>=d.length)throw new SyntaxError("Unexpected end of input");const e=d[u++],s=c.get(e);if(void 0===s)throw new SyntaxError(`Unexpected escaped character: ${e}`);t+=s}return t};e:for(;u<d.length;){const e=s.at(-1)?.type;if(void 0===e||e===o.CloseStatement||e===o.CloseExpression){let e="";for(;u<d.length&&("{"!==d[u]||"%"!==d[u+1]&&"{"!==d[u+1]);)e+=d[u++];if(e.length>0){s.push(new n(e,o.Text));continue}}_((e=>/\s/.test(e)));const t=d[u];if("-"===t||"+"===t){const e=s.at(-1)?.type;if(e===o.Text||void 0===e)throw new SyntaxError(`Unexpected character: ${t}`);switch(e){case o.Identifier:case o.NumericLiteral:case o.BooleanLiteral:case o.NullLiteral:case o.StringLiteral:case o.CloseParen:case o.CloseSquareBracket:break;default:{++u;const e=_(i);s.push(new n(`${t}${e}`,e.length>0?o.NumericLiteral:o.UnaryOperator));continue}}}for(const[e,t]of l){if(d.slice(u,u+e.length)===e){s.push(new n(e,t)),u+=e.length;continue e}}if("'"!==t&&'"'!==t)if(i(t)){const e=_(i);s.push(new n(e,o.NumericLiteral))}else{if(!a(t))throw new SyntaxError(`Unexpected character: ${t}`);{const e=_(a),t=Object.hasOwn(r,e)?r[e]:o.Identifier;t===o.In&&s.at(-1)?.type===o.Not?(s.pop(),s.push(new n("not in",o.NotIn))):s.push(new n(e,t))}}else{++u;const e=_((e=>e!==t));s.push(new n(e,o.StringLiteral)),++u}}return s}var u=class{type="Statement"},_=class extends u{constructor(e){super(),this.body=e}type="Program"},p=class extends u{constructor(e,t,s){super(),this.test=e,this.body=t,this.alternate=s}type="If"},m=class extends u{constructor(e,t,s,o){super(),this.loopvar=e,this.iterable=t,this.body=s,this.defaultBlock=o}type="For"},h=class extends u{constructor(e,t){super(),this.assignee=e,this.value=t}type="Set"},g=class extends u{constructor(e,t,s){super(),this.name=e,this.args=t,this.body=s}type="Macro"},f=class extends u{type="Expression"},M=class extends f{constructor(e,t,s){super(),this.object=e,this.property=t,this.computed=s}type="MemberExpression"},w=class extends f{constructor(e,t){super(),this.callee=e,this.args=t}type="CallExpression"},T=class extends f{constructor(e){super(),this.value=e}type="Identifier"},b=class extends f{constructor(e){super(),this.value=e}type="Literal"},x=class extends b{type="NumericLiteral"},P=class extends b{type="StringLiteral"},k=class extends b{type="BooleanLiteral"},F=class extends b{type="NullLiteral"},y=class extends b{type="ArrayLiteral"},v=class extends b{type="TupleLiteral"},C=class extends b{type="ObjectLiteral"},S=class extends f{constructor(e,t,s){super(),this.operator=e,this.left=t,this.right=s}type="BinaryExpression"},A=class extends f{constructor(e,t){super(),this.operand=e,this.filter=t}type="FilterExpression"},E=class extends f{constructor(e,t){super(),this.iterable=e,this.test=t}type="SelectExpression"},L=class extends f{constructor(e,t,s){super(),this.operand=e,this.negate=t,this.test=s}type="TestExpression"},I=class extends f{constructor(e,t){super(),this.operator=e,this.argument=t}type="UnaryExpression"},z=class extends f{constructor(e=void 0,t=void 0,s=void 0){super(),this.start=e,this.stop=t,this.step=s}type="SliceExpression"},V=class extends f{constructor(e,t){super(),this.key=e,this.value=t}type="KeywordArgumentExpression"};function j(e){const t=new _([]);let s=0;function r(t,o){const r=e[s++];if(!r||r.type!==t)throw new Error(`Parser Error: ${o}. ${r.type} !== ${t}.`);return r}function n(){switch(e[s].type){case o.Text:return new P(r(o.Text,"Expected text token").value);case o.OpenStatement:return function(){let t;switch(r(o.OpenStatement,"Expected opening statement token"),e[s].type){case o.Set:++s,t=l(),r(o.CloseStatement,"Expected closing statement token");break;case o.If:++s,t=c(),r(o.OpenStatement,"Expected {% token"),r(o.EndIf,"Expected endif token"),r(o.CloseStatement,"Expected %} token");break;case o.Macro:++s,t=function(){const e=W();if("Identifier"!==e.type)throw new SyntaxError("Expected identifier following macro statement");const t=O();r(o.CloseStatement,"Expected closing statement token");const s=[];for(;a(o.OpenStatement,o.EndMacro);)s.push(n());return new g(e,t,s)}(),r(o.OpenStatement,"Expected {% token"),r(o.EndMacro,"Expected endmacro token"),r(o.CloseStatement,"Expected %} token");break;case o.For:++s,t=function(){const e=d(!0);if(!(e instanceof T||e instanceof v))throw new SyntaxError(`Expected identifier/tuple for the loop variable, got ${e.type} instead`);r(o.In,"Expected `in` keyword following loop variable");const t=u();r(o.CloseStatement,"Expected closing statement token");const l=[];for(;a(o.OpenStatement,o.EndFor)&&a(o.OpenStatement,o.Else);)l.push(n());const c=[];if(i(o.OpenStatement,o.Else))for(++s,++s,r(o.CloseStatement,"Expected closing statement token");a(o.OpenStatement,o.EndFor);)c.push(n());return new m(e,t,l,c)}(),r(o.OpenStatement,"Expected {% token"),r(o.EndFor,"Expected endfor token"),r(o.CloseStatement,"Expected %} token");break;default:throw new SyntaxError(`Unknown statement type: ${e[s].type}`)}return t}();case o.OpenExpression:return function(){r(o.OpenExpression,"Expected opening expression token");const e=u();return r(o.CloseExpression,"Expected closing expression token"),e}();default:throw new SyntaxError(`Unexpected token type: ${e[s].type}`)}}function a(...t){return s+t.length<=e.length&&t.some(((t,o)=>t!==e[s+o].type))}function i(...t){return s+t.length<=e.length&&t.every(((t,o)=>t===e[s+o].type))}function l(){const e=u();if(i(o.Equals)){++s;const t=l();return new h(e,t)}return e}function c(){const t=u();r(o.CloseStatement,"Expected closing statement token");const a=[],l=[];for(;e[s]?.type!==o.OpenStatement||e[s+1]?.type!==o.ElseIf&&e[s+1]?.type!==o.Else&&e[s+1]?.type!==o.EndIf;)a.push(n());if(e[s]?.type===o.OpenStatement&&e[s+1]?.type!==o.EndIf)if(++s,i(o.ElseIf))r(o.ElseIf,"Expected elseif token"),l.push(c());else for(r(o.Else,"Expected else token"),r(o.CloseStatement,"Expected closing statement token");e[s]?.type!==o.OpenStatement||e[s+1]?.type!==o.EndIf;)l.push(n());return new p(t,a,l)}function d(e=!1){const t=e?W:u,r=[t()],n=i(o.Comma);for(;n&&(++s,r.push(t()),i(o.Comma)););return n?new v(r):r[0]}function u(){return function(){const e=f();if(i(o.If)){++s;const t=f();if(i(o.Else)){++s;const o=f();return new p(t,[e],[o])}return new E(e,t)}return e}()}function f(){let t=b();for(;i(o.Or);){const o=e[s];++s;const r=b();t=new S(o,t,r)}return t}function b(){let t=j();for(;i(o.And);){const o=e[s];++s;const r=j();t=new S(o,t,r)}return t}function j(){let t;for(;i(o.Not);){const o=e[s];++s;const r=j();t=new I(o,r)}return t??function(){let t=N();for(;i(o.ComparisonBinaryOperator)||i(o.In)||i(o.NotIn);){const o=e[s];++s;const r=N();t=new S(o,t,r)}return t}()}function N(){let t=R();for(;i(o.AdditiveBinaryOperator);){const o=e[s];++s;const r=R();t=new S(o,t,r)}return t}function D(e){let t=new w(e,O());return t=G(t),i(o.OpenParen)&&(t=D(t)),t}function O(){r(o.OpenParen,"Expected opening parenthesis for arguments list");const e=function(){const e=[];for(;!i(o.CloseParen);){let t=u();if(i(o.Equals)){if(++s,!(t instanceof T))throw new SyntaxError("Expected identifier for keyword argument");const e=u();t=new V(t,e)}e.push(t),i(o.Comma)&&++s}return e}();return r(o.CloseParen,"Expected closing parenthesis for arguments list"),e}function B(){const e=[];let t=!1;for(;!i(o.CloseSquareBracket);)i(o.Colon)?(e.push(void 0),++s,t=!0):(e.push(u()),i(o.Colon)&&(++s,t=!0));if(0===e.length)throw new SyntaxError("Expected at least one argument for member/slice expression");if(t){if(e.length>3)throw new SyntaxError("Expected 0-3 arguments for slice expression");return new z(...e)}return e[0]}function G(t){for(;i(o.Dot)||i(o.OpenSquareBracket);){const n=e[s];let a;++s;const i=n.type!==o.Dot;if(i)a=B(),r(o.CloseSquareBracket,"Expected closing square bracket");else if(a=W(),"Identifier"!==a.type)throw new SyntaxError("Expected identifier following dot operator");t=new M(t,a,i)}return t}function R(){let t=q();for(;i(o.MultiplicativeBinaryOperator);){const o=e[s];++s;const r=q();t=new S(o,t,r)}return t}function q(){let e=function(){let e=function(){const e=G(W());return i(o.OpenParen)?D(e):e}();for(;i(o.Pipe);){++s;let t=W();if(!(t instanceof T))throw new SyntaxError("Expected identifier for the filter");i(o.OpenParen)&&(t=D(t)),e=new A(e,t)}return e}();for(;i(o.Is);){++s;const t=i(o.Not);t&&++s;let r=W();if(r instanceof k?r=new T(r.value.toString()):r instanceof F&&(r=new T("none")),!(r instanceof T))throw new SyntaxError("Expected identifier for the test");e=new L(e,t,r)}return e}function W(){const t=e[s];switch(t.type){case o.NumericLiteral:return++s,new x(Number(t.value));case o.StringLiteral:return++s,new P(t.value);case o.BooleanLiteral:return++s,new k("true"===t.value.toLowerCase());case o.NullLiteral:return++s,new F(null);case o.Identifier:return++s,new T(t.value);case o.OpenParen:{++s;const t=d();if(e[s].type!==o.CloseParen)throw new SyntaxError(`Expected closing parenthesis, got ${e[s].type} instead`);return++s,t}case o.OpenSquareBracket:{++s;const e=[];for(;!i(o.CloseSquareBracket);)e.push(u()),i(o.Comma)&&++s;return++s,new y(e)}case o.OpenCurlyBracket:{++s;const e=new Map;for(;!i(o.CloseCurlyBracket);){const t=u();r(o.Colon,"Expected colon between key and value in object literal");const n=u();e.set(t,n),i(o.Comma)&&++s}return++s,new C(e)}default:throw new SyntaxError(`Unexpected token: ${t.type}`)}}for(;s<e.length;)t.body.push(n());return t}function N(e,t,s=1){void 0===t&&(t=e,e=0);const o=[];for(let r=e;r<t;r+=s)o.push(r);return o}function D(e,t,s,o=1){const r=Math.sign(o);r>=0?(t=(t??=0)<0?Math.max(e.length+t,0):Math.min(t,e.length),s=(s??=e.length)<0?Math.max(e.length+s,0):Math.min(s,e.length)):(t=(t??=e.length-1)<0?Math.max(e.length+t,-1):Math.min(t,e.length-1),s=(s??=-1)<-1?Math.max(e.length+s,-1):Math.min(s,e.length-1));const n=[];for(let a=t;r*a<r*s;a+=o)n.push(e[a]);return n}function O(e){return e.replace(/\b\w/g,(e=>e.toUpperCase()))}var B=class{type="RuntimeValue";value;builtins=new Map;constructor(e=void 0){this.value=e}__bool__(){return new q(!!this.value)}},G=class extends B{type="NumericValue"},R=class extends B{type="StringValue";builtins=new Map([["upper",new Q((()=>new R(this.value.toUpperCase())))],["lower",new Q((()=>new R(this.value.toLowerCase())))],["strip",new Q((()=>new R(this.value.trim())))],["title",new Q((()=>new R(O(this.value))))],["length",new G(this.value.length)],["rstrip",new Q((()=>new R(this.value.trimEnd())))],["lstrip",new Q((()=>new R(this.value.trimStart())))],["split",new Q((e=>{const t=e[0]??new H;if(!(t instanceof R||t instanceof H))throw new Error("sep argument must be a string or null");const s=e[1]??new G(-1);if(!(s instanceof G))throw new Error("maxsplit argument must be a number");let o=[];if(t instanceof H){const e=this.value.trimStart();for(const{0:t,index:r}of e.matchAll(/\S+/g)){if(-1!==s.value&&o.length>=s.value&&void 0!==r){o.push(t+e.slice(r+t.length));break}o.push(t)}}else{if(""===t.value)throw new Error("empty separator");o=this.value.split(t.value),-1!==s.value&&o.length>s.value&&o.push(o.splice(s.value).join(t.value))}return new U(o.map((e=>new R(e))))}))]])},q=class extends B{type="BooleanValue"},W=class extends B{type="ObjectValue";__bool__(){return new q(this.value.size>0)}builtins=new Map([["get",new Q((([e,t])=>{if(!(e instanceof R))throw new Error(`Object key must be a string: got ${e.type}`);return this.value.get(e.value)??t??new H}))],["items",new Q((()=>new U(Array.from(this.value.entries()).map((([e,t])=>new U([new R(e),t]))))))]])},$=class extends W{type="KeywordArgumentsValue"},U=class extends B{type="ArrayValue";builtins=new Map([["length",new G(this.value.length)]]);__bool__(){return new q(this.value.length>0)}},X=class extends U{type="TupleValue"},Q=class extends B{type="FunctionValue"},H=class extends B{type="NullValue"},J=class extends B{type="UndefinedValue"},Y=class{constructor(e){this.parent=e}variables=new Map([["namespace",new Q((e=>{if(0===e.length)return new W(new Map);if(1!==e.length||!(e[0]instanceof W))throw new Error("`namespace` expects either zero arguments or a single object argument");return e[0]}))]]);tests=new Map([["boolean",e=>"BooleanValue"===e.type],["callable",e=>e instanceof Q],["odd",e=>{if("NumericValue"!==e.type)throw new Error(`Cannot apply test "odd" to type: ${e.type}`);return e.value%2!=0}],["even",e=>{if("NumericValue"!==e.type)throw new Error(`Cannot apply test "even" to type: ${e.type}`);return e.value%2==0}],["false",e=>"BooleanValue"===e.type&&!e.value],["true",e=>"BooleanValue"===e.type&&e.value],["none",e=>"NullValue"===e.type],["string",e=>"StringValue"===e.type],["number",e=>"NumericValue"===e.type],["integer",e=>"NumericValue"===e.type&&Number.isInteger(e.value)],["iterable",e=>"ArrayValue"===e.type||"StringValue"===e.type],["mapping",e=>"ObjectValue"===e.type],["lower",e=>{const t=e.value;return"StringValue"===e.type&&t===t.toLowerCase()}],["upper",e=>{const t=e.value;return"StringValue"===e.type&&t===t.toUpperCase()}],["none",e=>"NullValue"===e.type],["defined",e=>"UndefinedValue"!==e.type],["undefined",e=>"UndefinedValue"===e.type],["equalto",(e,t)=>e.value===t.value],["eq",(e,t)=>e.value===t.value]]);set(e,t){return this.declareVariable(e,Z(t))}declareVariable(e,t){if(this.variables.has(e))throw new SyntaxError(`Variable already declared: ${e}`);return this.variables.set(e,t),t}setVariable(e,t){return this.variables.set(e,t),t}resolve(e){if(this.variables.has(e))return this;if(this.parent)return this.parent.resolve(e);throw new Error(`Unknown variable: ${e}`)}lookupVariable(e){try{return this.resolve(e).variables.get(e)??new J}catch{return new J}}},K=class{global;constructor(e){this.global=e??new Y}run(e){return this.evaluate(e,this.global)}evaluateBinaryExpression(e,t){const s=this.evaluate(e.left,t);switch(e.operator.value){case"and":return s.__bool__().value?this.evaluate(e.right,t):s;case"or":return s.__bool__().value?s:this.evaluate(e.right,t)}const o=this.evaluate(e.right,t);switch(e.operator.value){case"==":return new q(s.value==o.value);case"!=":return new q(s.value!=o.value)}if(s instanceof J||o instanceof J)throw new Error("Cannot perform operation on undefined values");if(s instanceof H||o instanceof H)throw new Error("Cannot perform operation on null values");if(s instanceof G&&o instanceof G)switch(e.operator.value){case"+":return new G(s.value+o.value);case"-":return new G(s.value-o.value);case"*":return new G(s.value*o.value);case"/":return new G(s.value/o.value);case"%":return new G(s.value%o.value);case"<":return new q(s.value<o.value);case">":return new q(s.value>o.value);case">=":return new q(s.value>=o.value);case"<=":return new q(s.value<=o.value)}else if(s instanceof U&&o instanceof U){if("+"===e.operator.value)return new U(s.value.concat(o.value))}else if(o instanceof U){const t=void 0!==o.value.find((e=>e.value===s.value));switch(e.operator.value){case"in":return new q(t);case"not in":return new q(!t)}}if((s instanceof R||o instanceof R)&&"+"===e.operator.value)return new R(s.value.toString()+o.value.toString());if(s instanceof R&&o instanceof R)switch(e.operator.value){case"in":return new q(o.value.includes(s.value));case"not in":return new q(!o.value.includes(s.value))}if(s instanceof R&&o instanceof W)switch(e.operator.value){case"in":return new q(o.value.has(s.value));case"not in":return new q(!o.value.has(s.value))}throw new SyntaxError(`Unknown operator "${e.operator.value}" between ${s.type} and ${o.type}`)}evaluateArguments(e,t){const s=[],o=new Map;for(const r of e)if("KeywordArgumentExpression"===r.type){const e=r;o.set(e.key.value,this.evaluate(e.value,t))}else{if(o.size>0)throw new Error("Positional arguments must come before keyword arguments");s.push(this.evaluate(r,t))}return[s,o]}evaluateFilterExpression(e,t){const s=this.evaluate(e.operand,t);if("Identifier"===e.filter.type){const t=e.filter;if("tojson"===t.value)return new R(ee(s));if(s instanceof U)switch(t.value){case"list":return s;case"first":return s.value[0];case"last":return s.value[s.value.length-1];case"length":return new G(s.value.length);case"reverse":return new U(s.value.reverse());case"sort":return new U(s.value.sort(((e,t)=>{if(e.type!==t.type)throw new Error(`Cannot compare different types: ${e.type} and ${t.type}`);switch(e.type){case"NumericValue":return e.value-t.value;case"StringValue":return e.value.localeCompare(t.value);default:throw new Error(`Cannot compare type: ${e.type}`)}})));case"join":return new R(s.value.map((e=>e.value)).join(""));default:throw new Error(`Unknown ArrayValue filter: ${t.value}`)}else if(s instanceof R)switch(t.value){case"length":return new G(s.value.length);case"upper":return new R(s.value.toUpperCase());case"lower":return new R(s.value.toLowerCase());case"title":return new R(O(s.value));case"capitalize":return new R(s.value.charAt(0).toUpperCase()+s.value.slice(1));case"trim":return new R(s.value.trim());case"indent":return new R(s.value.split("\n").map(((e,t)=>0===t||0===e.length?e:" "+e)).join("\n"));case"join":case"string":return s;default:throw new Error(`Unknown StringValue filter: ${t.value}`)}else{if(s instanceof G){if("abs"===t.value)return new G(Math.abs(s.value));throw new Error(`Unknown NumericValue filter: ${t.value}`)}if(s instanceof W)switch(t.value){case"items":return new U(Array.from(s.value.entries()).map((([e,t])=>new U([new R(e),t]))));case"length":return new G(s.value.size);default:throw new Error(`Unknown ObjectValue filter: ${t.value}`)}}throw new Error(`Cannot apply filter "${t.value}" to type: ${s.type}`)}if("CallExpression"===e.filter.type){const o=e.filter;if("Identifier"!==o.callee.type)throw new Error(`Unknown filter: ${o.callee.type}`);const r=o.callee.value;if("tojson"===r){const[,e]=this.evaluateArguments(o.args,t),r=e.get("indent")??new H;if(!(r instanceof G||r instanceof H))throw new Error("If set, indent must be a number");return new R(ee(s,r.value))}if("join"===r){let e;if(s instanceof R)e=Array.from(s.value);else{if(!(s instanceof U))throw new Error(`Cannot apply filter "${r}" to type: ${s.type}`);e=s.value.map((e=>e.value))}const[n,a]=this.evaluateArguments(o.args,t),i=n.at(0)??a.get("separator")??new R("");if(!(i instanceof R))throw new Error("separator must be a string");return new R(e.join(i.value))}if(s instanceof U){switch(r){case"selectattr":case"rejectattr":{const e="selectattr"===r;if(s.value.some((e=>!(e instanceof W))))throw new Error(`\`${r}\` can only be applied to array of objects`);if(o.args.some((e=>"StringLiteral"!==e.type)))throw new Error(`arguments of \`${r}\` must be strings`);const[n,a,i]=o.args.map((e=>this.evaluate(e,t)));let l;if(a){const e=t.tests.get(a.value);if(!e)throw new Error(`Unknown test: ${a.value}`);l=e}else l=(...e)=>e[0].__bool__().value;const c=s.value.filter((t=>{const s=t.value.get(n.value),o=!!s&&l(s,i);return e?o:!o}));return new U(c)}case"map":{const[,e]=this.evaluateArguments(o.args,t);if(e.has("attribute")){const t=e.get("attribute");if(!(t instanceof R))throw new Error("attribute must be a string");const o=e.get("default"),r=s.value.map((e=>{if(!(e instanceof W))throw new Error("items in map must be an object");return e.value.get(t.value)??o??new J}));return new U(r)}throw new Error("`map` expressions without `attribute` set are not currently supported.")}}throw new Error(`Unknown ArrayValue filter: ${r}`)}if(s instanceof R){if("indent"===r){const[e,r]=this.evaluateArguments(o.args,t),n=e.at(0)??r.get("width")??new G(4);if(!(n instanceof G))throw new Error("width must be a number");const a=e.at(1)??r.get("first")??new q(!1),i=e.at(2)??r.get("blank")??new q(!1),l=s.value.split("\n"),c=" ".repeat(n.value),d=l.map(((e,t)=>!a.value&&0===t||!i.value&&0===e.length?e:c+e));return new R(d.join("\n"))}throw new Error(`Unknown StringValue filter: ${r}`)}throw new Error(`Cannot apply filter "${r}" to type: ${s.type}`)}throw new Error(`Unknown filter: ${e.filter.type}`)}evaluateTestExpression(e,t){const s=this.evaluate(e.operand,t),o=t.tests.get(e.test.value);if(!o)throw new Error(`Unknown test: ${e.test.value}`);const r=o(s);return new q(e.negate?!r:r)}evaluateUnaryExpression(e,t){const s=this.evaluate(e.argument,t);if("not"===e.operator.value)return new q(!s.value);throw new SyntaxError(`Unknown operator: ${e.operator.value}`)}evalProgram(e,t){return this.evaluateBlock(e.body,t)}evaluateBlock(e,t){let s="";for(const o of e){const e=this.evaluate(o,t);"NullValue"!==e.type&&"UndefinedValue"!==e.type&&(s+=e.value)}return new R(s)}evaluateIdentifier(e,t){return t.lookupVariable(e.value)}evaluateCallExpression(e,t){const[s,o]=this.evaluateArguments(e.args,t);o.size>0&&s.push(new $(o));const r=this.evaluate(e.callee,t);if("FunctionValue"!==r.type)throw new Error(`Cannot call something that is not a function: got ${r.type}`);return r.value(s,t)}evaluateSliceExpression(e,t,s){if(!(e instanceof U||e instanceof R))throw new Error("Slice object must be an array or string");const o=this.evaluate(t.start,s),r=this.evaluate(t.stop,s),n=this.evaluate(t.step,s);if(!(o instanceof G||o instanceof J))throw new Error("Slice start must be numeric or undefined");if(!(r instanceof G||r instanceof J))throw new Error("Slice stop must be numeric or undefined");if(!(n instanceof G||n instanceof J))throw new Error("Slice step must be numeric or undefined");return e instanceof U?new U(D(e.value,o.value,r.value,n.value)):new R(D(Array.from(e.value),o.value,r.value,n.value).join(""))}evaluateMemberExpression(e,t){const s=this.evaluate(e.object,t);let o,r;if(e.computed){if("SliceExpression"===e.property.type)return this.evaluateSliceExpression(s,e.property,t);o=this.evaluate(e.property,t)}else o=new R(e.property.value);if(s instanceof W){if(!(o instanceof R))throw new Error(`Cannot access property with non-string: got ${o.type}`);r=s.value.get(o.value)??s.builtins.get(o.value)}else if(s instanceof U||s instanceof R)if(o instanceof G)r=s.value.at(o.value),s instanceof R&&(r=new R(s.value.at(o.value)));else{if(!(o instanceof R))throw new Error(`Cannot access property with non-string/non-number: got ${o.type}`);r=s.builtins.get(o.value)}else{if(!(o instanceof R))throw new Error(`Cannot access property with non-string: got ${o.type}`);r=s.builtins.get(o.value)}return r instanceof B?r:new J}evaluateSet(e,t){const s=this.evaluate(e.value,t);if("Identifier"===e.assignee.type){const o=e.assignee.value;t.setVariable(o,s)}else{if("MemberExpression"!==e.assignee.type)throw new Error(`Invalid LHS inside assignment expression: ${JSON.stringify(e.assignee)}`);{const o=e.assignee,r=this.evaluate(o.object,t);if(!(r instanceof W))throw new Error("Cannot assign to member of non-object");if("Identifier"!==o.property.type)throw new Error("Cannot assign to member with non-identifier property");r.value.set(o.property.value,s)}}return new H}evaluateIf(e,t){const s=this.evaluate(e.test,t);return this.evaluateBlock(s.__bool__().value?e.body:e.alternate,t)}evaluateFor(e,t){const s=new Y(t);let o,r;if("SelectExpression"===e.iterable.type){const t=e.iterable;r=this.evaluate(t.iterable,s),o=t.test}else r=this.evaluate(e.iterable,s);if(!(r instanceof U))throw new Error(`Expected iterable type in for loop: got ${r.type}`);const n=[],a=[];for(let t=0;t<r.value.length;++t){const i=new Y(s),l=r.value[t];let c;if("Identifier"===e.loopvar.type)c=t=>t.setVariable(e.loopvar.value,l);else{if("TupleLiteral"!==e.loopvar.type)throw new Error(`Invalid loop variable(s): ${e.loopvar.type}`);{const t=e.loopvar;if("ArrayValue"!==l.type)throw new Error(`Cannot unpack non-iterable type: ${l.type}`);const s=l;if(t.value.length!==s.value.length)throw new Error(`Too ${t.value.length>s.value.length?"few":"many"} items to unpack`);c=e=>{for(let o=0;o<t.value.length;++o){if("Identifier"!==t.value[o].type)throw new Error(`Cannot unpack non-identifier type: ${t.value[o].type}`);e.setVariable(t.value[o].value,s.value[o])}}}}if(o){c(i);if(!this.evaluate(o,i).__bool__().value)continue}n.push(l),a.push(c)}let i="",l=!0;for(let t=0;t<n.length;++t){const o=new Map([["index",new G(t+1)],["index0",new G(t)],["revindex",new G(n.length-t)],["revindex0",new G(n.length-t-1)],["first",new q(0===t)],["last",new q(t===n.length-1)],["length",new G(n.length)],["previtem",t>0?n[t-1]:new J],["nextitem",t<n.length-1?n[t+1]:new J]]);s.setVariable("loop",new W(o)),a[t](s);i+=this.evaluateBlock(e.body,s).value,l=!1}if(l){i+=this.evaluateBlock(e.defaultBlock,s).value}return new R(i)}evaluateMacro(e,t){return t.setVariable(e.name.value,new Q(((t,s)=>{const o=new Y(s);let r;t=t.slice(),"KeywordArgumentsValue"===t.at(-1)?.type&&(r=t.pop());for(let s=0;s<e.args.length;++s){const n=e.args[s],a=t[s];if("Identifier"===n.type){const e=n;if(!a)throw new Error(`Missing positional argument: ${e.value}`);o.setVariable(e.value,a)}else{if("KeywordArgumentExpression"!==n.type)throw new Error(`Unknown argument type: ${n.type}`);{const e=n,t=a??r?.value.get(e.key.value)??this.evaluate(e.value,o);o.setVariable(e.key.value,t)}}}return this.evaluateBlock(e.body,o)}))),new H}evaluate(e,t){if(void 0===e)return new J;switch(e.type){case"Program":return this.evalProgram(e,t);case"Set":return this.evaluateSet(e,t);case"If":return this.evaluateIf(e,t);case"For":return this.evaluateFor(e,t);case"Macro":return this.evaluateMacro(e,t);case"NumericLiteral":return new G(Number(e.value));case"StringLiteral":return new R(e.value);case"BooleanLiteral":return new q(e.value);case"NullLiteral":return new H(e.value);case"ArrayLiteral":return new U(e.value.map((e=>this.evaluate(e,t))));case"TupleLiteral":return new X(e.value.map((e=>this.evaluate(e,t))));case"ObjectLiteral":{const s=new Map;for(const[o,r]of e.value){const e=this.evaluate(o,t);if(!(e instanceof R))throw new Error(`Object keys must be strings: got ${e.type}`);s.set(e.value,this.evaluate(r,t))}return new W(s)}case"Identifier":return this.evaluateIdentifier(e,t);case"CallExpression":return this.evaluateCallExpression(e,t);case"MemberExpression":return this.evaluateMemberExpression(e,t);case"UnaryExpression":return this.evaluateUnaryExpression(e,t);case"BinaryExpression":return this.evaluateBinaryExpression(e,t);case"FilterExpression":return this.evaluateFilterExpression(e,t);case"TestExpression":return this.evaluateTestExpression(e,t);default:throw new SyntaxError(`Unknown node type: ${e.type}`)}}};function Z(e){switch(typeof e){case"number":return new G(e);case"string":return new R(e);case"boolean":return new q(e);case"undefined":return new J;case"object":return null===e?new H:Array.isArray(e)?new U(e.map(Z)):new W(new Map(Object.entries(e).map((([e,t])=>[e,Z(t)]))));case"function":return new Q(((t,s)=>Z(e(...t.map((e=>e.value)))??null)));default:throw new Error(`Cannot convert to runtime value: ${e}`)}}function ee(e,t,s){const o=s??0;switch(e.type){case"NullValue":case"UndefinedValue":return"null";case"NumericValue":case"StringValue":case"BooleanValue":return JSON.stringify(e.value);case"ArrayValue":case"ObjectValue":{const s=t?" ".repeat(t):"",r="\n"+s.repeat(o),n=r+s;if("ArrayValue"===e.type){const s=e.value.map((e=>ee(e,t,o+1)));return t?`[${n}${s.join(`,${n}`)}${r}]`:`[${s.join(", ")}]`}{const s=Array.from(e.value.entries()).map((([e,s])=>{const r=`"${e}": ${ee(s,t,o+1)}`;return t?`${n}${r}`:r}));return t?`{${s.join(",")}${r}}`:`{${s.join(", ")}}`}}default:throw new Error(`Cannot convert to JSON: ${e.type}`)}}var te=class{parsed;constructor(e){const t=d(e,{lstrip_blocks:!0,trim_blocks:!0});this.parsed=j(t)}render(e){const t=new Y;if(t.set("false",!1),t.set("true",!0),t.set("raise_exception",(e=>{throw new Error(e)})),t.set("range",N),e)for(const[s,o]of Object.entries(e))t.set(s,o);return new K(t).run(this.parsed).value}}},"./src/backends/onnx.js":(e,t,s)=>{var o;s.r(t),s.d(t,{Tensor:()=>i.Tensor,createInferenceSession:()=>g,deviceToExecutionProviders:()=>m,isONNXProxy:()=>w,isONNXTensor:()=>f});var r=s("./src/env.js"),n=s("onnxruntime-node"),a=s("?8b6b"),i=s("onnxruntime-common");const l=Object.freeze({auto:null,gpu:null,cpu:"cpu",wasm:"wasm",webgpu:"webgpu",cuda:"cuda",dml:"dml",webnn:{name:"webnn",deviceType:"cpu"},"webnn-npu":{name:"webnn",deviceType:"npu"},"webnn-gpu":{name:"webnn",deviceType:"gpu"},"webnn-cpu":{name:"webnn",deviceType:"cpu"}}),c=[];let d,u;const _=Symbol.for("onnxruntime");if(_ in globalThis)u=globalThis[_];else if(r.apis.IS_NODE_ENV){switch(u=n.default??n,process.platform){case"win32":c.push("dml");break;case"linux":"x64"===process.arch&&c.push("cuda")}c.push("cpu"),d=["cpu"]}else u=o||(o=s.t(a,2)),r.apis.IS_WEBNN_AVAILABLE&&c.push("webnn-npu","webnn-gpu","webnn-cpu","webnn"),r.apis.IS_WEBGPU_AVAILABLE&&c.push("webgpu"),c.push("wasm"),d=["wasm"];const p=u.InferenceSession;function m(e=null){if(!e)return d;switch(e){case"auto":return c;case"gpu":return c.filter((e=>["webgpu","cuda","dml","webnn-gpu"].includes(e)))}if(c.includes(e))return[l[e]??e];throw new Error(`Unsupported device: "${e}". Should be one of: ${c.join(", ")}.`)}let h=null;async function g(e,t,s){h&&await h;const o=p.create(e,t);h??=o;const r=await o;return r.config=s,r}function f(e){return e instanceof u.Tensor}const M=u?.env;function w(){return M?.wasm?.proxy}M?.wasm&&("undefined"!=typeof ServiceWorkerGlobalScope&&self instanceof ServiceWorkerGlobalScope||M.wasm.wasmPaths||(M.wasm.wasmPaths=`https://cdn.jsdelivr.net/npm/@huggingface/transformers@${r.env.version}/dist/`),M.wasm.proxy=!1),M?.webgpu&&(M.webgpu.powerPreference="high-performance"),r.env.backends.onnx=M},"./src/base/feature_extraction_utils.js":(e,t,s)=>{s.r(t),s.d(t,{FeatureExtractor:()=>a,validate_audio_inputs:()=>i});var o=s("./src/utils/constants.js"),r=s("./src/utils/generic.js"),n=s("./src/utils/hub.js");class a extends r.Callable{constructor(e){super(),this.config=e}static async from_pretrained(e,t){return new this(await(0,n.getModelJSON)(e,o.FEATURE_EXTRACTOR_NAME,!0,t))}}function i(e,t){if(!(e instanceof Float32Array||e instanceof Float64Array))throw new Error(`${t} expects input to be a Float32Array or a Float64Array, but got ${e?.constructor?.name??typeof e} instead. If using the feature extractor directly, remember to use \`read_audio(url, sampling_rate)\` to obtain the raw audio data of the file/url.`)}},"./src/base/image_processors_utils.js":(e,t,s)=>{s.r(t),s.d(t,{ImageProcessor:()=>w,center_to_corners_format:()=>u,post_process_instance_segmentation:()=>M,post_process_object_detection:()=>_,post_process_panoptic_segmentation:()=>f,post_process_semantic_segmentation:()=>p});var o=s("./src/utils/generic.js"),r=s("./src/utils/tensor.js"),n=s("./src/utils/maths.js"),a=(s("./src/utils/image.js"),s("./src/utils/core.js")),i=s("./src/utils/hub.js"),l=s("./src/utils/constants.js");function c(e,t,s=0,o=null){const r=e/t;let a=(0,n.bankers_round)(r)*t;return null!==o&&a>o&&(a=Math.floor(r)*t),a<s&&(a=Math.ceil(r)*t),a}function d([e,t],s){return[Math.max(Math.floor(e/s),1)*s,Math.max(Math.floor(t/s),1)*s]}function u([e,t,s,o]){return[e-s/2,t-o/2,e+s/2,t+o/2]}function _(e,t=.5,s=null,o=!1){const r=e.logits,a=e.pred_boxes,[i,l,c]=r.dims;if(null!==s&&s.length!==i)throw Error("Make sure that you pass in as many target sizes as the batch dimension of the logits");let d=[];for(let e=0;e<i;++e){let i=null!==s?s[e]:null,_={boxes:[],classes:[],scores:[]},p=r[e],m=a[e];for(let e=0;e<l;++e){let s,r=p[e],a=[];if(o){s=r.sigmoid().data;for(let e=0;e<s.length;++e)s[e]>t&&a.push(e)}else{let e=(0,n.max)(r.data)[1];if(e===c-1)continue;if(s=(0,n.softmax)(r.data),s[e]<t)continue;a.push(e)}for(const t of a){let o=m[e].data;o=u(o),null!==i&&(o=o.map(((e,t)=>e*i[(t+1)%2]))),_.boxes.push(o),_.classes.push(t),_.scores.push(s[t])}}d.push(_)}return d}function p(e,t=null){const s=e.logits,o=s.dims[0];if(null!==t&&t.length!==o)throw Error("Make sure that you pass in as many target sizes as the batch dimension of the logits");const n=[];for(let e=0;e<o;++e){const o=null!==t?t[e]:null;let a=s[e];null!==o&&(a=(0,r.interpolate)(a,o,"bilinear",!1));const[i,l]=o??a.dims.slice(-2),c=new r.Tensor("int32",new Int32Array(i*l),[i,l]),d=a[0].data,u=c.data;for(let e=1;e<a.dims[0];++e){const t=a[e].data;for(let s=0;s<t.length;++s)t[s]>d[s]&&(d[s]=t[s],u[s]=e)}const _=new Array(a.dims[0]);for(let e=0;e<u.length;++e){const t=u[e];_[t]=t}const p=_.filter((e=>void 0!==e));n.push({segmentation:c,labels:p})}return n}function m(e,t,s,o){const r=[],a=[],i=[];for(let l=0;l<e.dims[0];++l){const c=e[l],d=t[l],u=(0,n.max)(c.data)[1];if(u===o)continue;const _=(0,n.softmax)(c.data)[u];_>s&&(r.push(d),a.push(_),i.push(u))}return[r,a,i]}function h(e,t,s,o=.5,r=.8){const n=[];let a=0,i=0;const l=t[s].data;for(let t=0;t<e.length;++t)e[t]===s&&(n.push(t),++a),l[t]>=o&&++i;let c=a>0&&i>0;if(c){c=a/i>r}return[c,n]}function g(e,t,s,o,n,a=null,i=null){const[l,c]=i??e[0].dims,d=new r.Tensor("int32",new Int32Array(l*c),[l,c]),u=[];if(null!==i)for(let t=0;t<e.length;++t)e[t]=(0,r.interpolate)(e[t],i,"bilinear",!1);const _=new Int32Array(e[0].data.length),p=new Float32Array(e[0].data.length);for(let s=0;s<e.length;++s){let o=t[s];const r=e[s].data;for(let e=0;e<r.length;++e)r[e]*=o,r[e]>p[e]&&(_[e]=s,p[e]=r[e])}let m=0;const g=d.data;for(let r=0;r<s.length;++r){const a=s[r],[i,l]=h(_,e,r,o,n);if(i){++m;for(const e of l)g[e]=m;u.push({id:m,label_id:a,score:t[r]})}}return[d,u]}function f(e,t=.5,s=.5,o=.8,n=null,a=null){null===n&&(console.warn("`label_ids_to_fuse` unset. No instance will be fused."),n=new Set);const i=e.class_queries_logits??e.logits,l=(e.masks_queries_logits??e.pred_masks).sigmoid();let[c,d,u]=i.dims;if(u-=1,null!==a&&a.length!==c)throw Error("Make sure that you pass in as many target sizes as the batch dimension of the logits");let _=[];for(let e=0;e<c;++e){let c=null!==a?a[e]:null,d=i[e],p=l[e],[h,f,M]=m(d,p,t,u);if(0===M.length){let[e,t]=c??p.dims.slice(-2),s=new r.Tensor("int32",new Int32Array(e*t).fill(-1),[e,t]);_.push({segmentation:s,segments_info:[]});continue}let[w,T]=g(h,f,M,s,o,n,c);_.push({segmentation:w,segments_info:T})}return _}function M(e,t=.5,s=null){throw new Error("`post_process_instance_segmentation` is not yet implemented.")}class w extends o.Callable{constructor(e){super(),this.image_mean=e.image_mean??e.mean,this.image_std=e.image_std??e.std,this.resample=e.resample??2,this.do_rescale=e.do_rescale??!0,this.rescale_factor=e.rescale_factor??1/255,this.do_normalize=e.do_normalize,this.do_thumbnail=e.do_thumbnail,this.size=e.size??e.image_size,this.do_resize=e.do_resize??void 0!==this.size,this.size_divisibility=e.size_divisibility??e.size_divisor,this.do_center_crop=e.do_center_crop,this.crop_size=e.crop_size,this.do_convert_rgb=e.do_convert_rgb??!0,this.do_crop_margin=e.do_crop_margin,this.pad_size=e.pad_size,this.do_pad=e.do_pad,this.do_pad&&!this.pad_size&&this.size&&void 0!==this.size.width&&void 0!==this.size.height&&(this.pad_size=this.size),this.do_flip_channel_order=e.do_flip_channel_order??!1,this.config=e}async thumbnail(e,t,s=2){const o=e.height,r=e.width,n=t.height,a=t.width;let i=Math.min(o,n),l=Math.min(r,a);return i===o&&l===r?e:(o>r?l=Math.floor(r*i/o):r>o&&(i=Math.floor(o*l/r)),await e.resize(l,i,{resample:s}))}async crop_margin(e,t=200){const s=e.clone().grayscale(),o=(0,n.min)(s.data)[0],r=(0,n.max)(s.data)[0]-o;if(0===r)return e;const a=t/255;let i=s.width,l=s.height,c=0,d=0;const u=s.data;for(let e=0;e<s.height;++e){const t=e*s.width;for(let n=0;n<s.width;++n)(u[t+n]-o)/r<a&&(i=Math.min(i,n),l=Math.min(l,e),c=Math.max(c,n),d=Math.max(d,e))}return e=await e.crop([i,l,c,d])}pad_image(e,t,s,{mode:o="constant",center:r=!1,constant_values:n=0}={}){const[i,l,c]=t;let d,u;if("number"==typeof s?(d=s,u=s):"square"===s?d=u=Math.max(i,l):(d=s.width,u=s.height),d!==l||u!==i){const s=new Float32Array(d*u*c);if(Array.isArray(n))for(let e=0;e<s.length;++e)s[e]=n[e%c];else 0!==n&&s.fill(n);const[_,p]=r?[Math.floor((d-l)/2),Math.floor((u-i)/2)]:[0,0];for(let t=0;t<i;++t){const o=(t+p)*d,r=t*l;for(let t=0;t<l;++t){const n=(o+t+_)*c,a=(r+t)*c;for(let t=0;t<c;++t)s[n+t]=e[a+t]}}if("symmetric"===o){if(r)throw new Error("`center` padding is not supported when `mode` is set to `symmetric`.");const t=i-1,o=l-1;for(let r=0;r<u;++r){const n=r*d,u=(0,a.calculateReflectOffset)(r,t)*l;for(let t=0;t<d;++t){if(r<i&&t<l)continue;const d=(n+t)*c,_=(u+(0,a.calculateReflectOffset)(t,o))*c;for(let t=0;t<c;++t)s[d+t]=e[_+t]}}}e=s,t=[u,d,c]}return[e,t]}rescale(e){for(let t=0;t<e.length;++t)e[t]=this.rescale_factor*e[t]}get_resize_output_image_size(e,t){const[s,o]=e.size;let r,n;if(this.do_thumbnail){const{height:e,width:s}=t;r=Math.min(e,s)}else Number.isInteger(t)?(r=t,n=this.config.max_size??r):void 0!==t&&(r=t.shortest_edge,n=t.longest_edge);if(void 0!==r||void 0!==n){const e=void 0===r?1:Math.max(r/s,r/o),t=s*e,a=o*e,i=void 0===n?1:Math.min(n/t,n/a);let l=Math.floor(Number((t*i).toFixed(2))),c=Math.floor(Number((a*i).toFixed(2)));return void 0!==this.size_divisibility&&([l,c]=d([l,c],this.size_divisibility)),[l,c]}if(void 0!==t&&void 0!==t.width&&void 0!==t.height){let e=t.width,r=t.height;if(this.config.keep_aspect_ratio&&this.config.ensure_multiple_of){let t=r/o,n=e/s;Math.abs(1-n)<Math.abs(1-t)?t=n:n=t,r=c(t*o,this.config.ensure_multiple_of),e=c(n*s,this.config.ensure_multiple_of)}return[e,r]}if(void 0!==this.size_divisibility)return d([s,o],this.size_divisibility);if(void 0!==t.min_pixels&&void 0!==t.max_pixels){const{min_pixels:e,max_pixels:r}=t;return function(e,t,s=28,o=3136,r=1003520){if(e<s||t<s)throw new Error(`height:${e} or width:${t} must be larger than factor:${s}`);if(Math.max(e,t)/Math.min(e,t)>200)throw new Error("absolute aspect ratio must be smaller than 200, got "+Math.max(e,t)/Math.min(e,t));let n=Math.round(e/s)*s,a=Math.round(t/s)*s;if(n*a>r){const o=Math.sqrt(e*t/r);n=Math.floor(e/o/s)*s,a=Math.floor(t/o/s)*s}else if(n*a<o){const r=Math.sqrt(o/(e*t));n=Math.ceil(e*r/s)*s,a=Math.ceil(t*r/s)*s}return[n,a]}(o,s,this.config.patch_size*this.config.merge_size,e,r)}throw new Error(`Could not resize image due to unsupported \`this.size\` option in config: ${JSON.stringify(t)}`)}async resize(e){const[t,s]=this.get_resize_output_image_size(e,this.size);return await e.resize(t,s,{resample:this.resample})}async preprocess(e,{do_normalize:t=null,do_pad:s=null,do_convert_rgb:o=null,do_convert_grayscale:n=null,do_flip_channel_order:a=null}={}){this.do_crop_margin&&(e=await this.crop_margin(e));const[i,l]=e.size;if(o??this.do_convert_rgb?e=e.rgb():n&&(e=e.grayscale()),this.do_resize&&(e=await this.resize(e)),this.do_thumbnail&&(e=await this.thumbnail(e,this.size,this.resample)),this.do_center_crop){let t,s;Number.isInteger(this.crop_size)?(t=this.crop_size,s=this.crop_size):(t=this.crop_size.width,s=this.crop_size.height),e=await e.center_crop(t,s)}const c=[e.height,e.width];let u=Float32Array.from(e.data),_=[e.height,e.width,e.channels];if(this.do_rescale&&this.rescale(u),t??this.do_normalize){let t=this.image_mean;Array.isArray(this.image_mean)||(t=new Array(e.channels).fill(t));let s=this.image_std;if(Array.isArray(this.image_std)||(s=new Array(e.channels).fill(t)),t.length!==e.channels||s.length!==e.channels)throw new Error(`When set to arrays, the length of \`image_mean\` (${t.length}) and \`image_std\` (${s.length}) must match the number of channels in the image (${e.channels}).`);for(let o=0;o<u.length;o+=e.channels)for(let r=0;r<e.channels;++r)u[o+r]=(u[o+r]-t[r])/s[r]}if(s??this.do_pad)if(this.pad_size){const t=this.pad_image(u,[e.height,e.width,e.channels],this.pad_size);[u,_]=t}else if(this.size_divisibility){const[e,t]=d([_[1],_[0]],this.size_divisibility);[u,_]=this.pad_image(u,_,{width:e,height:t})}if(a??this.do_flip_channel_order){if(3!==_[2])throw new Error("Flipping channel order is only supported for RGB images.");for(let e=0;e<u.length;e+=3){const t=u[e];u[e]=u[e+2],u[e+2]=t}}return{original_size:[l,i],reshaped_input_size:c,pixel_values:new r.Tensor("float32",u,_).permute(2,0,1)}}async _call(e,...t){Array.isArray(e)||(e=[e]);const s=await Promise.all(e.map((e=>this.preprocess(e))));return{pixel_values:(0,r.stack)(s.map((e=>e.pixel_values)),0),original_sizes:s.map((e=>e.original_size)),reshaped_input_sizes:s.map((e=>e.reshaped_input_size))}}static async from_pretrained(e,t){return new this(await(0,i.getModelJSON)(e,l.IMAGE_PROCESSOR_NAME,!0,t))}}},"./src/base/processing_utils.js":(e,t,s)=>{s.r(t),s.d(t,{Processor:()=>a});var o=s("./src/utils/constants.js"),r=s("./src/utils/generic.js"),n=s("./src/utils/hub.js");class a extends r.Callable{static classes=["image_processor_class","tokenizer_class","feature_extractor_class"];static uses_processor_config=!1;constructor(e,t){super(),this.config=e,this.components=t}get image_processor(){return this.components.image_processor}get tokenizer(){return this.components.tokenizer}get feature_extractor(){return this.components.feature_extractor}apply_chat_template(e,t={}){if(!this.tokenizer)throw new Error("Unable to apply chat template without a tokenizer.");return this.tokenizer.apply_chat_template(e,{tokenize:!1,...t})}batch_decode(...e){if(!this.tokenizer)throw new Error("Unable to decode without a tokenizer.");return this.tokenizer.batch_decode(...e)}decode(...e){if(!this.tokenizer)throw new Error("Unable to decode without a tokenizer.");return this.tokenizer.decode(...e)}async _call(e,...t){for(const s of[this.image_processor,this.feature_extractor,this.tokenizer])if(s)return s(e,...t);throw new Error("No image processor, feature extractor, or tokenizer found.")}static async from_pretrained(e,t){const[s,r]=await Promise.all([this.uses_processor_config?(0,n.getModelJSON)(e,o.PROCESSOR_NAME,!0,t):{},Promise.all(this.classes.filter((e=>e in this)).map((async s=>{const o=await this[s].from_pretrained(e,t);return[s.replace(/_class$/,""),o]}))).then(Object.fromEntries)]);return new this(s,r)}}},"./src/configs.js":(e,t,s)=>{s.r(t),s.d(t,{AutoConfig:()=>l,PretrainedConfig:()=>i,getKeyValueShapes:()=>a});var o=s("./src/utils/core.js"),r=s("./src/utils/hub.js");function n(e){const t={};let s={};switch(e.model_type){case"llava":case"paligemma":case"florence2":case"llava_onevision":case"idefics3":case"ultravox":case"smolvlm":s=n(e.text_config);break;case"moondream1":s=n(e.phi_config);break;case"musicgen":s=n(e.decoder);break;case"multi_modality":s=n(e.language_config);break;case"gpt2":case"gptj":case"jais":case"codegen":case"gpt_bigcode":t.num_heads="n_head",t.num_layers="n_layer",t.hidden_size="n_embd";break;case"gpt_neox":case"stablelm":case"opt":case"falcon":t.num_heads="num_attention_heads",t.num_layers="num_hidden_layers",t.hidden_size="hidden_size";break;case"llama":case"olmo":case"olmo2":case"mobilellm":case"granite":case"cohere":case"mistral":case"starcoder2":case"qwen2":case"qwen2_vl":case"phi":case"phi3":case"phi3_v":t.num_heads="num_key_value_heads",t.num_layers="num_hidden_layers",t.hidden_size="hidden_size",t.num_attention_heads="num_attention_heads";break;case"gemma":case"gemma2":case"glm":case"helium":t.num_heads="num_key_value_heads",t.num_layers="num_hidden_layers",t.dim_kv="head_dim";break;case"openelm":t.num_heads="num_kv_heads",t.num_layers="num_transformer_layers",t.dim_kv="head_dim";break;case"gpt_neo":case"donut-swin":t.num_heads="num_heads",t.num_layers="num_layers",t.hidden_size="hidden_size";break;case"bloom":t.num_heads="n_head",t.num_layers="n_layer",t.hidden_size="hidden_size";break;case"mpt":t.num_heads="n_heads",t.num_layers="n_layers",t.hidden_size="d_model";break;case"exaone":t.num_heads="num_key_value_heads",t.num_layers="num_layers",t.dim_kv="head_dim",t.num_attention_heads="num_attention_heads";break;case"t5":case"mt5":case"longt5":t.num_decoder_layers="num_decoder_layers",t.num_decoder_heads="num_heads",t.decoder_dim_kv="d_kv",t.num_encoder_layers="num_layers",t.num_encoder_heads="num_heads",t.encoder_dim_kv="d_kv";break;case"bart":case"mbart":case"marian":case"whisper":case"lite-whisper":case"m2m_100":case"blenderbot":case"blenderbot-small":case"florence2_language":t.num_decoder_layers="decoder_layers",t.num_decoder_heads="decoder_attention_heads",t.decoder_hidden_size="d_model",t.num_encoder_layers="encoder_layers",t.num_encoder_heads="encoder_attention_heads",t.encoder_hidden_size="d_model";break;case"speecht5":t.num_decoder_layers="decoder_layers",t.num_decoder_heads="decoder_attention_heads",t.decoder_hidden_size="hidden_size",t.num_encoder_layers="encoder_layers",t.num_encoder_heads="encoder_attention_heads",t.encoder_hidden_size="hidden_size";break;case"trocr":t.num_encoder_layers=t.num_decoder_layers="decoder_layers",t.num_encoder_heads=t.num_decoder_heads="decoder_attention_heads",t.encoder_hidden_size=t.decoder_hidden_size="d_model";break;case"musicgen_decoder":t.num_encoder_layers=t.num_decoder_layers="num_hidden_layers",t.num_encoder_heads=t.num_decoder_heads="num_attention_heads",t.encoder_hidden_size=t.decoder_hidden_size="hidden_size";break;case"moonshine":t.num_decoder_layers="decoder_num_hidden_layers",t.num_decoder_heads="decoder_num_key_value_heads",t.num_encoder_layers="encoder_num_hidden_layers",t.num_encoder_heads="encoder_num_key_value_heads",t.encoder_hidden_size=t.decoder_hidden_size="hidden_size";break;case"vision-encoder-decoder":const r=n(e.decoder),a="num_decoder_layers"in r,i=(0,o.pick)(e,["model_type","is_encoder_decoder"]);return a?(i.num_decoder_layers=r.num_decoder_layers,i.num_decoder_heads=r.num_decoder_heads,i.decoder_hidden_size=r.decoder_hidden_size,i.num_encoder_layers=r.num_encoder_layers,i.num_encoder_heads=r.num_encoder_heads,i.encoder_hidden_size=r.encoder_hidden_size):(i.num_layers=r.num_layers,i.num_heads=r.num_heads,i.hidden_size=r.hidden_size),i}const r={...s,...(0,o.pick)(e,["model_type","multi_query","is_encoder_decoder"])};for(const s in t)r[s]=e[t[s]];return r}function a(e,{prefix:t="past_key_values",batch_size:s=1}={}){const o={},r=e.normalized_config;if(r.is_encoder_decoder&&"num_encoder_heads"in r&&"num_decoder_heads"in r){const e=r.encoder_dim_kv??r.encoder_hidden_size/r.num_encoder_heads,n=r.decoder_dim_kv??r.decoder_hidden_size/r.num_decoder_heads,a=[s,r.num_encoder_heads,0,e],i=[s,r.num_decoder_heads,0,n];for(let e=0;e<r.num_decoder_layers;++e)o[`${t}.${e}.encoder.key`]=a,o[`${t}.${e}.encoder.value`]=a,o[`${t}.${e}.decoder.key`]=i,o[`${t}.${e}.decoder.value`]=i}else{const e=r.num_heads,n=r.num_layers,a=r.dim_kv??r.hidden_size/(r.num_attention_heads??e);if("falcon"===r.model_type){const r=[s*e,0,a];for(let e=0;e<n;++e)o[`${t}.${e}.key`]=r,o[`${t}.${e}.value`]=r}else if(r.multi_query){const r=[s*e,0,2*a];for(let e=0;e<n;++e)o[`${t}.${e}.key_value`]=r}else if("bloom"===r.model_type){const r=[s*e,a,0],i=[s*e,0,a];for(let e=0;e<n;++e)o[`${t}.${e}.key`]=r,o[`${t}.${e}.value`]=i}else if("openelm"===r.model_type)for(let r=0;r<n;++r){const n=[s,e[r],0,a];o[`${t}.${r}.key`]=n,o[`${t}.${r}.value`]=n}else{const r=[s,e,0,a];for(let e=0;e<n;++e)o[`${t}.${e}.key`]=r,o[`${t}.${e}.value`]=r}}return o}class i{model_type=null;is_encoder_decoder=!1;max_position_embeddings;"transformers.js_config";constructor(e){Object.assign(this,e),this.normalized_config=n(this)}static async from_pretrained(e,{progress_callback:t=null,config:s=null,cache_dir:o=null,local_files_only:n=!1,revision:a="main"}={}){!s||s instanceof i||(s=new i(s));const l=s??await async function(e,t){return await(0,r.getModelJSON)(e,"config.json",!0,t)}(e,{progress_callback:t,config:s,cache_dir:o,local_files_only:n,revision:a});return new this(l)}}class l{static async from_pretrained(...e){return i.from_pretrained(...e)}}},"./src/env.js":(e,t,s)=>{s.r(t),s.d(t,{apis:()=>h,env:()=>T});var o=s("fs"),r=s("path"),n=s("url");const a="undefined"!=typeof window&&void 0!==window.document,i="undefined"!=typeof self&&"DedicatedWorkerGlobalScope"===self.constructor?.name,l="undefined"!=typeof self&&"caches"in self,c="undefined"!=typeof navigator&&"gpu"in navigator,d="undefined"!=typeof navigator&&"ml"in navigator,u="undefined"!=typeof process,_=u&&"node"===process?.release?.name,p=!b(o.default),m=!b(r.default),h=Object.freeze({IS_BROWSER_ENV:a,IS_WEBWORKER_ENV:i,IS_WEB_CACHE_AVAILABLE:l,IS_WEBGPU_AVAILABLE:c,IS_WEBNN_AVAILABLE:d,IS_PROCESS_AVAILABLE:u,IS_NODE_ENV:_,IS_FS_AVAILABLE:p,IS_PATH_AVAILABLE:m}),g=p&&m;let f="./";if(g){const e=Object(import.meta).url;e?f=r.default.dirname(r.default.dirname(n.default.fileURLToPath(e))):"undefined"!=typeof __dirname&&(f=r.default.dirname(__dirname))}const M=g?r.default.join(f,"/.cache/"):null,w="/models/",T={version:"3.4.0",backends:{onnx:{}},allowRemoteModels:!0,remoteHost:"https://huggingface.co/",remotePathTemplate:"{model}/resolve/{revision}/",allowLocalModels:!(a||i),localModelPath:g?r.default.join(f,w):w,useFS:p,useBrowserCache:l,useFSCache:p,cacheDir:M,useCustomCache:!1,customCache:null};function b(e){return 0===Object.keys(e).length}},"./src/generation/configuration_utils.js":(e,t,s)=>{s.r(t),s.d(t,{GenerationConfig:()=>r});var o=s("./src/utils/core.js");class r{max_length=20;max_new_tokens=null;min_length=0;min_new_tokens=null;early_stopping=!1;max_time=null;do_sample=!1;num_beams=1;num_beam_groups=1;penalty_alpha=null;use_cache=!0;temperature=1;top_k=50;top_p=1;typical_p=1;epsilon_cutoff=0;eta_cutoff=0;diversity_penalty=0;repetition_penalty=1;encoder_repetition_penalty=1;length_penalty=1;no_repeat_ngram_size=0;bad_words_ids=null;force_words_ids=null;renormalize_logits=!1;constraints=null;forced_bos_token_id=null;forced_eos_token_id=null;remove_invalid_values=!1;exponential_decay_length_penalty=null;suppress_tokens=null;streamer=null;begin_suppress_tokens=null;forced_decoder_ids=null;guidance_scale=null;num_return_sequences=1;output_attentions=!1;output_hidden_states=!1;output_scores=!1;return_dict_in_generate=!1;pad_token_id=null;bos_token_id=null;eos_token_id=null;encoder_no_repeat_ngram_size=0;decoder_start_token_id=null;generation_kwargs={};constructor(e){Object.assign(this,(0,o.pick)(e,Object.getOwnPropertyNames(this)))}}},"./src/generation/logits_process.js":(e,t,s)=>{s.r(t),s.d(t,{ClassifierFreeGuidanceLogitsProcessor:()=>f,ForcedBOSTokenLogitsProcessor:()=>l,ForcedEOSTokenLogitsProcessor:()=>c,LogitsProcessor:()=>n,LogitsProcessorList:()=>i,LogitsWarper:()=>a,MinLengthLogitsProcessor:()=>m,MinNewTokensLengthLogitsProcessor:()=>h,NoBadWordsLogitsProcessor:()=>g,NoRepeatNGramLogitsProcessor:()=>_,RepetitionPenaltyLogitsProcessor:()=>p,SuppressTokensAtBeginLogitsProcessor:()=>d,TemperatureLogitsWarper:()=>M,TopKLogitsWarper:()=>T,TopPLogitsWarper:()=>w,WhisperTimeStampLogitsProcessor:()=>u});var o=s("./src/utils/generic.js"),r=(s("./src/utils/tensor.js"),s("./src/utils/maths.js"));class n extends o.Callable{_call(e,t){throw Error("`_call` should be implemented in a subclass")}}class a extends o.Callable{_call(e,t){throw Error("`_call` should be implemented in a subclass")}}class i extends o.Callable{constructor(){super(),this.processors=[]}push(e){this.processors.push(e)}extend(e){this.processors.push(...e)}_call(e,t){let s=t;for(const t of this.processors)s=t(e,s);return s}[Symbol.iterator](){return this.processors.values()}}class l extends n{constructor(e){super(),this.bos_token_id=e}_call(e,t){for(let s=0;s<e.length;++s)if(1===e[s].length){const e=t[s].data;e.fill(-1/0),e[this.bos_token_id]=0}return t}}class c extends n{constructor(e,t){super(),this.max_length=e,this.eos_token_id=Array.isArray(t)?t:[t]}_call(e,t){for(let s=0;s<e.length;++s)if(e[s].length===this.max_length-1){const e=t[s].data;e.fill(-1/0);for(const t of this.eos_token_id)e[t]=0}return t}}class d extends n{constructor(e,t){super(),this.begin_suppress_tokens=e,this.begin_index=t}_call(e,t){for(let s=0;s<e.length;++s)if(e[s].length===this.begin_index){const e=t[s].data;for(const t of this.begin_suppress_tokens)e[t]=-1/0}return t}}class u extends n{constructor(e,t){super(),this.eos_token_id=Array.isArray(e.eos_token_id)?e.eos_token_id[0]:e.eos_token_id,this.no_timestamps_token_id=e.no_timestamps_token_id,this.timestamp_begin=this.no_timestamps_token_id+1,this.begin_index=t.length,t.at(-1)===this.no_timestamps_token_id&&(this.begin_index-=1),this.max_initial_timestamp_index=e.max_initial_timestamp_index}_call(e,t){for(let s=0;s<e.length;++s){const o=t[s].data;if(o[this.no_timestamps_token_id]=-1/0,e[s].length===this.begin_index-1){o.fill(-1/0),o[this.timestamp_begin]=0;continue}const n=e[s].slice(this.begin_index),a=n.length>=1&&n[n.length-1]>=this.timestamp_begin,i=n.length<2||n[n.length-2]>=this.timestamp_begin;if(a&&(i?o.subarray(this.timestamp_begin).fill(-1/0):o.subarray(0,this.eos_token_id).fill(-1/0)),e[s].length===this.begin_index&&null!==this.max_initial_timestamp_index){const e=this.timestamp_begin+this.max_initial_timestamp_index;o.subarray(e+1).fill(-1/0)}const l=(0,r.log_softmax)(o);Math.log(l.subarray(this.timestamp_begin).map(Math.exp).reduce(((e,t)=>e+t)))>(0,r.max)(l.subarray(0,this.timestamp_begin))[0]&&o.subarray(0,this.timestamp_begin).fill(-1/0)}return t}}class _ extends n{constructor(e){super(),this.no_repeat_ngram_size=e}getNgrams(e){const t=e.length,s=[];for(let o=0;o<t+1-this.no_repeat_ngram_size;++o){const t=[];for(let s=0;s<this.no_repeat_ngram_size;++s)t.push(e[o+s]);s.push(t.map(Number))}const o=new Map;for(const e of s){const t=e.slice(0,e.length-1),s=JSON.stringify(t),r=o.get(s)??[];r.push(e[e.length-1]),o.set(s,r)}return o}getGeneratedNgrams(e,t){const s=t.slice(t.length+1-this.no_repeat_ngram_size,t.length);return e.get(JSON.stringify(s.map(Number)))??[]}calcBannedNgramTokens(e){const t=[];if(e.length+1<this.no_repeat_ngram_size)return t;{const t=this.getNgrams(e);return this.getGeneratedNgrams(t,e)}}_call(e,t){for(let s=0;s<e.length;++s){const o=t[s].data,r=this.calcBannedNgramTokens(e[s]);for(const e of r)o[e]=-1/0}return t}}class p extends n{constructor(e){super(),this.penalty=e}_call(e,t){for(let s=0;s<e.length;++s){const o=t[s].data;for(const t of new Set(e[s])){const e=Number(t);o[e]<0?o[e]*=this.penalty:o[e]/=this.penalty}}return t}}class m extends n{constructor(e,t){super(),this.min_length=e,this.eos_token_id=Array.isArray(t)?t:[t]}_call(e,t){for(let s=0;s<e.length;++s)if(e[s].length<this.min_length){const e=t[s].data;for(const t of this.eos_token_id)e[t]=-1/0}return t}}class h extends n{constructor(e,t,s){super(),this.prompt_length_to_skip=e,this.min_new_tokens=t,this.eos_token_id=Array.isArray(s)?s:[s]}_call(e,t){for(let s=0;s<e.length;++s){if(e[s].length-this.prompt_length_to_skip<this.min_new_tokens){const e=t[s].data;for(const t of this.eos_token_id)e[t]=-1/0}}return t}}class g extends n{constructor(e,t){super(),this.bad_words_ids=e,this.eos_token_id=Array.isArray(t)?t:[t]}_call(e,t){for(let s=0;s<e.length;++s){const o=t[s].data,r=e[s];for(const e of this.bad_words_ids){let t=!0;for(let s=1;s<=e.length-1&&e.length<r.length;++s)if(e.at(-s-1)!=r.at(-s)){t=!1;break}t&&(o[e.at(-1)]=-1/0)}}return t}}class f extends n{constructor(e){if(super(),e<=1)throw new Error(`Require guidance scale >1 to use the classifier free guidance processor, got guidance scale ${e}.`);this.guidance_scale=e}_call(e,t){if(t.dims[0]!==2*e.length)throw new Error(`Logits should have twice the batch size of the input ids, the first half of batches corresponding to the conditional inputs, and the second half of batches corresponding to the unconditional inputs. Got batch size ${t.dims[0]} for the logits and ${e.length} for the input ids.`);const s=e.length,o=t.slice([0,s],null),r=t.slice([s,t.dims[0]],null);for(let e=0;e<r.data.length;++e)r.data[e]+=(o.data[e]-r.data[e])*this.guidance_scale;return r}}class M extends a{constructor(e){if(super(),"number"!=typeof e||e<=0){let t=`\`temperature\` (=${e}) must be a strictly positive float, otherwise your next token scores will be invalid.`;0===e&&(t+=" If you're looking for greedy decoding strategies, set `do_sample=false`.")}this.temperature=e}_call(e,t){const s=t.data;for(let e=0;e<s.length;++e)s[e]/=this.temperature;return t}}class w extends a{constructor(e,{filter_value:t=-1/0,min_tokens_to_keep:s=1}={}){if(super(),e<0||e>1)throw new Error(`\`top_p\` must be a float > 0 and < 1, but is ${e}`);if(!Number.isInteger(s)||s<1)throw new Error(`\`min_tokens_to_keep\` must be a positive integer, but is ${s}`);this.top_p=e,this.filter_value=t,this.min_tokens_to_keep=s}}class T extends a{constructor(e,{filter_value:t=-1/0,min_tokens_to_keep:s=1}={}){if(super(),!Number.isInteger(e)||e<0)throw new Error(`\`top_k\` must be a positive integer, but is ${e}`);this.top_k=Math.max(e,s),this.filter_value=t}}},"./src/generation/logits_sampler.js":(e,t,s)=>{s.r(t),s.d(t,{LogitsSampler:()=>a});var o=s("./src/utils/generic.js"),r=s("./src/utils/tensor.js"),n=s("./src/utils/maths.js");s("./src/generation/configuration_utils.js");class a extends o.Callable{constructor(e){super(),this.generation_config=e}async _call(e){return this.sample(e)}async sample(e){throw Error("sample should be implemented in subclasses.")}getLogits(e,t){let s=e.dims.at(-1),o=e.data;if(-1===t)o=o.slice(-s);else{let e=t*s;o=o.slice(e,e+s)}return o}randomSelect(e){let t=0;for(let s=0;s<e.length;++s)t+=e[s];let s=Math.random()*t;for(let t=0;t<e.length;++t)if(s-=e[t],s<=0)return t;return 0}static getSampler(e){if(e.do_sample)return new l(e);if(e.num_beams>1)return new c(e);if(e.num_return_sequences>1)throw Error(`num_return_sequences has to be 1 when doing greedy search, but is ${e.num_return_sequences}.`);return new i(e)}}class i extends a{async sample(e){const t=(0,n.max)(e.data)[1];return[[BigInt(t),0]]}}class l extends a{async sample(e){let t=e.dims.at(-1);this.generation_config.top_k>0&&(t=Math.min(this.generation_config.top_k,t));const[s,o]=await(0,r.topk)(e,t),a=(0,n.softmax)(s.data);return Array.from({length:this.generation_config.num_beams},(()=>{const e=this.randomSelect(a);return[o.data[e],Math.log(a[e])]}))}}class c extends a{async sample(e){let t=e.dims.at(-1);this.generation_config.top_k>0&&(t=Math.min(this.generation_config.top_k,t));const[s,o]=await(0,r.topk)(e,t),a=(0,n.softmax)(s.data);return Array.from({length:this.generation_config.num_beams},((e,t)=>[o.data[t],Math.log(a[t])]))}}},"./src/generation/stopping_criteria.js":(e,t,s)=>{s.r(t),s.d(t,{EosTokenCriteria:()=>i,InterruptableStoppingCriteria:()=>l,MaxLengthCriteria:()=>a,StoppingCriteria:()=>r,StoppingCriteriaList:()=>n});var o=s("./src/utils/generic.js");class r extends o.Callable{_call(e,t){throw Error("StoppingCriteria needs to be subclassed")}}class n extends o.Callable{constructor(){super(),this.criteria=[]}push(e){this.criteria.push(e)}extend(e){e instanceof n?e=e.criteria:e instanceof r&&(e=[e]),this.criteria.push(...e)}_call(e,t){const s=new Array(e.length).fill(!1);for(const o of this.criteria){const r=o(e,t);for(let e=0;e<s.length;++e)s[e]||=r[e]}return s}[Symbol.iterator](){return this.criteria.values()}}class a extends r{constructor(e,t=null){super(),this.max_length=e,this.max_position_embeddings=t}_call(e){return e.map((e=>e.length>=this.max_length))}}class i extends r{constructor(e){super(),Array.isArray(e)||(e=[e]),this.eos_token_id=e}_call(e,t){return e.map((e=>{const t=e.at(-1);return this.eos_token_id.some((e=>t==e))}))}}class l extends r{constructor(){super(),this.interrupted=!1}interrupt(){this.interrupted=!0}reset(){this.interrupted=!1}_call(e,t){return new Array(e.length).fill(this.interrupted)}}},"./src/generation/streamers.js":(e,t,s)=>{s.r(t),s.d(t,{BaseStreamer:()=>a,TextStreamer:()=>l,WhisperTextStreamer:()=>c});var o=s("./src/utils/core.js"),r=s("./src/tokenizers.js"),n=s("./src/env.js");class a{put(e){throw Error("Not implemented")}end(){throw Error("Not implemented")}}const i=n.apis.IS_PROCESS_AVAILABLE?e=>process.stdout.write(e):e=>console.log(e);class l extends a{constructor(e,{skip_prompt:t=!1,callback_function:s=null,token_callback_function:o=null,skip_special_tokens:r=!0,decode_kwargs:n={},...a}={}){super(),this.tokenizer=e,this.skip_prompt=t,this.callback_function=s??i,this.token_callback_function=o,this.decode_kwargs={skip_special_tokens:r,...n,...a},this.token_cache=[],this.print_len=0,this.next_tokens_are_prompt=!0}put(e){if(e.length>1)throw Error("TextStreamer only supports batch size of 1");const t=this.next_tokens_are_prompt;if(t&&(this.next_tokens_are_prompt=!1,this.skip_prompt))return;const s=e[0];this.token_callback_function?.(s),this.token_cache=(0,o.mergeArrays)(this.token_cache,s);const n=this.tokenizer.decode(this.token_cache,this.decode_kwargs);let a;t||n.endsWith("\n")?(a=n.slice(this.print_len),this.token_cache=[],this.print_len=0):n.length>0&&(0,r.is_chinese_char)(n.charCodeAt(n.length-1))?(a=n.slice(this.print_len),this.print_len+=a.length):(a=n.slice(this.print_len,n.lastIndexOf(" ")+1),this.print_len+=a.length),this.on_finalized_text(a,!1)}end(){let e;if(this.token_cache.length>0){e=this.tokenizer.decode(this.token_cache,this.decode_kwargs).slice(this.print_len),this.token_cache=[],this.print_len=0}else e="";this.next_tokens_are_prompt=!0,this.on_finalized_text(e,!0)}on_finalized_text(e,t){e.length>0&&this.callback_function?.(e),t&&this.callback_function===i&&n.apis.IS_PROCESS_AVAILABLE&&this.callback_function?.("\n")}}class c extends l{constructor(e,{skip_prompt:t=!1,callback_function:s=null,token_callback_function:o=null,on_chunk_start:r=null,on_chunk_end:n=null,on_finalize:a=null,time_precision:i=.02,skip_special_tokens:l=!0,decode_kwargs:c={}}={}){super(e,{skip_prompt:t,skip_special_tokens:l,callback_function:s,token_callback_function:o,decode_kwargs:c}),this.timestamp_begin=e.timestamp_begin,this.on_chunk_start=r,this.on_chunk_end=n,this.on_finalize=a,this.time_precision=i,this.waiting_for_timestamp=!1}put(e){if(e.length>1)throw Error("WhisperTextStreamer only supports batch size of 1");const t=e[0];if(1===t.length){const s=Number(t[0])-this.timestamp_begin;if(s>=0){const t=s*this.time_precision;this.waiting_for_timestamp?this.on_chunk_end?.(t):this.on_chunk_start?.(t),this.waiting_for_timestamp=!this.waiting_for_timestamp,e=[[]]}}return super.put(e)}end(){super.end(),this.on_finalize?.()}}},"./src/models.js":(e,t,s)=>{s.r(t),s.d(t,{ASTForAudioClassification:()=>bs,ASTModel:()=>Ts,ASTPreTrainedModel:()=>ws,AlbertForMaskedLM:()=>At,AlbertForQuestionAnswering:()=>St,AlbertForSequenceClassification:()=>Ct,AlbertModel:()=>vt,AlbertPreTrainedModel:()=>yt,AutoModel:()=>Ec,AutoModelForAudioClassification:()=>Jc,AutoModelForAudioFrameClassification:()=>Kc,AutoModelForAudioTextToText:()=>id,AutoModelForCTC:()=>Hc,AutoModelForCausalLM:()=>Dc,AutoModelForDepthEstimation:()=>sd,AutoModelForDocumentQuestionAnswering:()=>Zc,AutoModelForImageClassification:()=>Rc,AutoModelForImageFeatureExtraction:()=>nd,AutoModelForImageMatting:()=>ed,AutoModelForImageSegmentation:()=>qc,AutoModelForImageTextToText:()=>ad,AutoModelForImageToImage:()=>td,AutoModelForMaskGeneration:()=>Qc,AutoModelForMaskedLM:()=>Oc,AutoModelForNormalEstimation:()=>od,AutoModelForObjectDetection:()=>Uc,AutoModelForPoseEstimation:()=>rd,AutoModelForQuestionAnswering:()=>Bc,AutoModelForSemanticSegmentation:()=>Wc,AutoModelForSeq2SeqLM:()=>zc,AutoModelForSequenceClassification:()=>Lc,AutoModelForSpeechSeq2Seq:()=>Vc,AutoModelForTextToSpectrogram:()=>jc,AutoModelForTextToWaveform:()=>Nc,AutoModelForTokenClassification:()=>Ic,AutoModelForUniversalSegmentation:()=>$c,AutoModelForVision2Seq:()=>Gc,AutoModelForXVector:()=>Yc,AutoModelForZeroShotObjectDetection:()=>Xc,BartForConditionalGeneration:()=>Rt,BartForSequenceClassification:()=>qt,BartModel:()=>Gt,BartPretrainedModel:()=>Bt,BaseModelOutput:()=>oe,BeitForImageClassification:()=>gn,BeitModel:()=>hn,BeitPreTrainedModel:()=>mn,BertForMaskedLM:()=>ae,BertForQuestionAnswering:()=>ce,BertForSequenceClassification:()=>ie,BertForTokenClassification:()=>le,BertModel:()=>ne,BertPreTrainedModel:()=>re,BlenderbotForConditionalGeneration:()=>Yt,BlenderbotModel:()=>Jt,BlenderbotPreTrainedModel:()=>Ht,BlenderbotSmallForConditionalGeneration:()=>es,BlenderbotSmallModel:()=>Zt,BlenderbotSmallPreTrainedModel:()=>Kt,BloomForCausalLM:()=>Fr,BloomModel:()=>kr,BloomPreTrainedModel:()=>Pr,CLIPModel:()=>Ws,CLIPPreTrainedModel:()=>qs,CLIPSegForImageSegmentation:()=>io,CLIPSegModel:()=>ao,CLIPSegPreTrainedModel:()=>no,CLIPTextModel:()=>$s,CLIPTextModelWithProjection:()=>Us,CLIPVisionModel:()=>Xs,CLIPVisionModelWithProjection:()=>Qs,CamembertForMaskedLM:()=>Ne,CamembertForQuestionAnswering:()=>Be,CamembertForSequenceClassification:()=>De,CamembertForTokenClassification:()=>Oe,CamembertModel:()=>je,CamembertPreTrainedModel:()=>Ve,CausalLMOutput:()=>md,CausalLMOutputWithPast:()=>hd,ChineseCLIPModel:()=>eo,ChineseCLIPPreTrainedModel:()=>Zs,ClapAudioModelWithProjection:()=>Oi,ClapModel:()=>Ni,ClapPreTrainedModel:()=>ji,ClapTextModelWithProjection:()=>Di,CodeGenForCausalLM:()=>So,CodeGenModel:()=>Co,CodeGenPreTrainedModel:()=>vo,CohereForCausalLM:()=>sr,CohereModel:()=>tr,CoherePreTrainedModel:()=>er,ConvBertForMaskedLM:()=>Fe,ConvBertForQuestionAnswering:()=>Ce,ConvBertForSequenceClassification:()=>ye,ConvBertForTokenClassification:()=>ve,ConvBertModel:()=>ke,ConvBertPreTrainedModel:()=>Pe,ConvNextForImageClassification:()=>ma,ConvNextModel:()=>pa,ConvNextPreTrainedModel:()=>_a,ConvNextV2ForImageClassification:()=>fa,ConvNextV2Model:()=>ga,ConvNextV2PreTrainedModel:()=>ha,DPTForDepthEstimation:()=>Hn,DPTModel:()=>Qn,DPTPreTrainedModel:()=>Xn,DacDecoderModel:()=>Wl,DacDecoderOutput:()=>Gl,DacEncoderModel:()=>ql,DacEncoderOutput:()=>Bl,DacModel:()=>Rl,DacPreTrainedModel:()=>Ol,DebertaForMaskedLM:()=>qe,DebertaForQuestionAnswering:()=>Ue,DebertaForSequenceClassification:()=>We,DebertaForTokenClassification:()=>$e,DebertaModel:()=>Re,DebertaPreTrainedModel:()=>Ge,DebertaV2ForMaskedLM:()=>He,DebertaV2ForQuestionAnswering:()=>Ke,DebertaV2ForSequenceClassification:()=>Je,DebertaV2ForTokenClassification:()=>Ye,DebertaV2Model:()=>Qe,DebertaV2PreTrainedModel:()=>Xe,DecisionTransformerModel:()=>wl,DecisionTransformerPreTrainedModel:()=>Ml,DeiTForImageClassification:()=>In,DeiTModel:()=>Ln,DeiTPreTrainedModel:()=>En,DepthAnythingForDepthEstimation:()=>Yn,DepthAnythingPreTrainedModel:()=>Jn,DepthProForDepthEstimation:()=>oa,DepthProPreTrainedModel:()=>sa,DetrForObjectDetection:()=>wn,DetrForSegmentation:()=>Tn,DetrModel:()=>Mn,DetrObjectDetectionOutput:()=>bn,DetrPreTrainedModel:()=>fn,DetrSegmentationOutput:()=>xn,Dinov2ForImageClassification:()=>Ta,Dinov2Model:()=>wa,Dinov2PreTrainedModel:()=>Ma,Dinov2WithRegistersForImageClassification:()=>Pa,Dinov2WithRegistersModel:()=>xa,Dinov2WithRegistersPreTrainedModel:()=>ba,DistilBertForMaskedLM:()=>rt,DistilBertForQuestionAnswering:()=>ot,DistilBertForSequenceClassification:()=>tt,DistilBertForTokenClassification:()=>st,DistilBertModel:()=>et,DistilBertPreTrainedModel:()=>Ze,DonutSwinModel:()=>ua,DonutSwinPreTrainedModel:()=>da,EfficientNetForImageClassification:()=>Yi,EfficientNetModel:()=>Ji,EfficientNetPreTrainedModel:()=>Hi,ElectraForMaskedLM:()=>Ee,ElectraForQuestionAnswering:()=>ze,ElectraForSequenceClassification:()=>Le,ElectraForTokenClassification:()=>Ie,ElectraModel:()=>Ae,ElectraPreTrainedModel:()=>Se,EsmForMaskedLM:()=>it,EsmForSequenceClassification:()=>lt,EsmForTokenClassification:()=>ct,EsmModel:()=>at,EsmPreTrainedModel:()=>nt,ExaoneForCausalLM:()=>Go,ExaoneModel:()=>Bo,ExaonePreTrainedModel:()=>Oo,FalconForCausalLM:()=>Vi,FalconModel:()=>zi,FalconPreTrainedModel:()=>Ii,FastViTForImageClassification:()=>Kr,FastViTModel:()=>Yr,FastViTPreTrainedModel:()=>Jr,Florence2ForConditionalGeneration:()=>Vs,Florence2PreTrainedModel:()=>zs,GLPNForDepthEstimation:()=>ca,GLPNModel:()=>la,GLPNPreTrainedModel:()=>ia,GPT2LMHeadModel:()=>uo,GPT2Model:()=>co,GPT2PreTrainedModel:()=>lo,GPTBigCodeForCausalLM:()=>yo,GPTBigCodeModel:()=>Fo,GPTBigCodePreTrainedModel:()=>ko,GPTJForCausalLM:()=>Po,GPTJModel:()=>xo,GPTJPreTrainedModel:()=>bo,GPTNeoForCausalLM:()=>fo,GPTNeoModel:()=>go,GPTNeoPreTrainedModel:()=>ho,GPTNeoXForCausalLM:()=>To,GPTNeoXModel:()=>wo,GPTNeoXPreTrainedModel:()=>Mo,Gemma2ForCausalLM:()=>lr,Gemma2Model:()=>ir,Gemma2PreTrainedModel:()=>ar,GemmaForCausalLM:()=>nr,GemmaModel:()=>rr,GemmaPreTrainedModel:()=>or,GlmForCausalLM:()=>Do,GlmModel:()=>No,GlmPreTrainedModel:()=>jo,GraniteForCausalLM:()=>Zo,GraniteModel:()=>Ko,GranitePreTrainedModel:()=>Yo,GroundingDinoForObjectDetection:()=>Fa,GroundingDinoPreTrainedModel:()=>ka,GroupViTModel:()=>Hr,GroupViTPreTrainedModel:()=>Qr,HeliumForCausalLM:()=>Vo,HeliumModel:()=>zo,HeliumPreTrainedModel:()=>Io,HieraForImageClassification:()=>jn,HieraModel:()=>Vn,HieraPreTrainedModel:()=>zn,HubertForCTC:()=>di,HubertForSequenceClassification:()=>ui,HubertModel:()=>ci,HubertPreTrainedModel:()=>li,IJepaForImageClassification:()=>Nr,IJepaModel:()=>jr,IJepaPreTrainedModel:()=>Vr,Idefics3ForConditionalGeneration:()=>Os,Idefics3PreTrainedModel:()=>Ds,ImageMattingOutput:()=>gd,JAISLMHeadModel:()=>mo,JAISModel:()=>po,JAISPreTrainedModel:()=>_o,JinaCLIPModel:()=>so,JinaCLIPPreTrainedModel:()=>to,JinaCLIPTextModel:()=>oo,JinaCLIPVisionModel:()=>ro,LiteWhisperForConditionalGeneration:()=>Fs,LlamaForCausalLM:()=>Lo,LlamaModel:()=>Eo,LlamaPreTrainedModel:()=>Ao,LlavaForConditionalGeneration:()=>Es,LlavaOnevisionForConditionalGeneration:()=>Ls,LlavaPreTrainedModel:()=>As,LongT5ForConditionalGeneration:()=>jt,LongT5Model:()=>Vt,LongT5PreTrainedModel:()=>zt,M2M100ForConditionalGeneration:()=>Da,M2M100Model:()=>Na,M2M100PreTrainedModel:()=>ja,MBartForCausalLM:()=>Qt,MBartForConditionalGeneration:()=>Ut,MBartForSequenceClassification:()=>Xt,MBartModel:()=>$t,MBartPreTrainedModel:()=>Wt,MPNetForMaskedLM:()=>ft,MPNetForQuestionAnswering:()=>Tt,MPNetForSequenceClassification:()=>Mt,MPNetForTokenClassification:()=>wt,MPNetModel:()=>gt,MPNetPreTrainedModel:()=>ht,MT5ForConditionalGeneration:()=>Ot,MT5Model:()=>Dt,MT5PreTrainedModel:()=>Nt,MarianMTModel:()=>Va,MarianModel:()=>za,MarianPreTrainedModel:()=>Ia,MaskFormerForInstanceSegmentation:()=>aa,MaskFormerModel:()=>na,MaskFormerPreTrainedModel:()=>ra,MaskedLMOutput:()=>_d,MgpstrForSceneTextRecognition:()=>kl,MgpstrModelOutput:()=>xl,MgpstrPreTrainedModel:()=>Pl,MimiDecoderModel:()=>Dl,MimiDecoderOutput:()=>Vl,MimiEncoderModel:()=>Nl,MimiEncoderOutput:()=>zl,MimiModel:()=>jl,MimiPreTrainedModel:()=>Il,MistralForCausalLM:()=>Si,MistralModel:()=>Ci,MistralPreTrainedModel:()=>vi,MobileBertForMaskedLM:()=>_t,MobileBertForQuestionAnswering:()=>mt,MobileBertForSequenceClassification:()=>pt,MobileBertModel:()=>ut,MobileBertPreTrainedModel:()=>dt,MobileLLMForCausalLM:()=>Wo,MobileLLMModel:()=>qo,MobileLLMPreTrainedModel:()=>Ro,MobileNetV1ForImageClassification:()=>rl,MobileNetV1ForSemanticSegmentation:()=>nl,MobileNetV1Model:()=>ol,MobileNetV1PreTrainedModel:()=>sl,MobileNetV2ForImageClassification:()=>ll,MobileNetV2ForSemanticSegmentation:()=>cl,MobileNetV2Model:()=>il,MobileNetV2PreTrainedModel:()=>al,MobileNetV3ForImageClassification:()=>_l,MobileNetV3ForSemanticSegmentation:()=>pl,MobileNetV3Model:()=>ul,MobileNetV3PreTrainedModel:()=>dl,MobileNetV4ForImageClassification:()=>gl,MobileNetV4ForSemanticSegmentation:()=>fl,MobileNetV4Model:()=>hl,MobileNetV4PreTrainedModel:()=>ml,MobileViTForImageClassification:()=>on,MobileViTModel:()=>sn,MobileViTPreTrainedModel:()=>tn,MobileViTV2ForImageClassification:()=>an,MobileViTV2Model:()=>nn,MobileViTV2PreTrainedModel:()=>rn,ModelOutput:()=>se,ModernBertForMaskedLM:()=>_e,ModernBertForSequenceClassification:()=>pe,ModernBertForTokenClassification:()=>me,ModernBertModel:()=>ue,ModernBertPreTrainedModel:()=>de,Moondream1ForConditionalGeneration:()=>Is,MoonshineForConditionalGeneration:()=>Cs,MoonshineModel:()=>vs,MoonshinePreTrainedModel:()=>ys,MptForCausalLM:()=>Cr,MptModel:()=>vr,MptPreTrainedModel:()=>yr,MultiModalityCausalLM:()=>bl,MultiModalityPreTrainedModel:()=>Tl,MusicgenForCausalLM:()=>el,MusicgenForConditionalGeneration:()=>tl,MusicgenModel:()=>Zi,MusicgenPreTrainedModel:()=>Ki,NomicBertModel:()=>ge,NomicBertPreTrainedModel:()=>he,OPTForCausalLM:()=>Er,OPTModel:()=>Ar,OPTPreTrainedModel:()=>Sr,Olmo2ForCausalLM:()=>Jo,Olmo2Model:()=>Ho,Olmo2PreTrainedModel:()=>Qo,OlmoForCausalLM:()=>Xo,OlmoModel:()=>Uo,OlmoPreTrainedModel:()=>$o,OpenELMForCausalLM:()=>ur,OpenELMModel:()=>dr,OpenELMPreTrainedModel:()=>cr,OwlViTForObjectDetection:()=>dn,OwlViTModel:()=>cn,OwlViTPreTrainedModel:()=>ln,Owlv2ForObjectDetection:()=>pn,Owlv2Model:()=>_n,Owlv2PreTrainedModel:()=>un,PaliGemmaForConditionalGeneration:()=>Ns,PaliGemmaPreTrainedModel:()=>js,PatchTSMixerForPrediction:()=>Al,PatchTSMixerModel:()=>Sl,PatchTSMixerPreTrainedModel:()=>Cl,PatchTSTForPrediction:()=>vl,PatchTSTModel:()=>yl,PatchTSTPreTrainedModel:()=>Fl,Phi3ForCausalLM:()=>xr,Phi3Model:()=>br,Phi3PreTrainedModel:()=>Tr,Phi3VForCausalLM:()=>Rs,Phi3VPreTrainedModel:()=>Gs,PhiForCausalLM:()=>wr,PhiModel:()=>Mr,PhiPreTrainedModel:()=>fr,PreTrainedModel:()=>te,PretrainedMixin:()=>$l,PvtForImageClassification:()=>Rr,PvtModel:()=>Gr,PvtPreTrainedModel:()=>Br,PyAnnoteForAudioFrameClassification:()=>Ua,PyAnnoteModel:()=>$a,PyAnnotePreTrainedModel:()=>Wa,QuestionAnsweringModelOutput:()=>pd,Qwen2ForCausalLM:()=>mr,Qwen2Model:()=>pr,Qwen2PreTrainedModel:()=>_r,Qwen2VLForConditionalGeneration:()=>gr,Qwen2VLPreTrainedModel:()=>hr,RTDetrForObjectDetection:()=>Fn,RTDetrModel:()=>kn,RTDetrObjectDetectionOutput:()=>yn,RTDetrPreTrainedModel:()=>Pn,ResNetForImageClassification:()=>On,ResNetModel:()=>Dn,ResNetPreTrainedModel:()=>Nn,RoFormerForMaskedLM:()=>we,RoFormerForQuestionAnswering:()=>xe,RoFormerForSequenceClassification:()=>Te,RoFormerForTokenClassification:()=>be,RoFormerModel:()=>Me,RoFormerPreTrainedModel:()=>fe,RobertaForMaskedLM:()=>os,RobertaForQuestionAnswering:()=>as,RobertaForSequenceClassification:()=>rs,RobertaForTokenClassification:()=>ns,RobertaModel:()=>ss,RobertaPreTrainedModel:()=>ts,SamImageSegmentationOutput:()=>La,SamModel:()=>Ea,SamPreTrainedModel:()=>Aa,SapiensForDepthEstimation:()=>ea,SapiensForNormalEstimation:()=>ta,SapiensForSemanticSegmentation:()=>Zn,SapiensPreTrainedModel:()=>Kn,SegformerForImageClassification:()=>Wi,SegformerForSemanticSegmentation:()=>$i,SegformerModel:()=>qi,SegformerPreTrainedModel:()=>Ri,Seq2SeqLMOutput:()=>ld,SequenceClassifierOutput:()=>cd,SiglipModel:()=>Js,SiglipPreTrainedModel:()=>Hs,SiglipTextModel:()=>Ys,SiglipVisionModel:()=>Ks,SmolVLMForConditionalGeneration:()=>Bs,SpeechT5ForSpeechToText:()=>xi,SpeechT5ForTextToSpeech:()=>Pi,SpeechT5HifiGan:()=>ki,SpeechT5Model:()=>bi,SpeechT5PreTrainedModel:()=>Ti,SqueezeBertForMaskedLM:()=>Pt,SqueezeBertForQuestionAnswering:()=>Ft,SqueezeBertForSequenceClassification:()=>kt,SqueezeBertModel:()=>xt,SqueezeBertPreTrainedModel:()=>bt,StableLmForCausalLM:()=>Qi,StableLmModel:()=>Xi,StableLmPreTrainedModel:()=>Ui,Starcoder2ForCausalLM:()=>Li,Starcoder2Model:()=>Ei,Starcoder2PreTrainedModel:()=>Ai,StyleTextToSpeech2Model:()=>wi,StyleTextToSpeech2PreTrainedModel:()=>Mi,Swin2SRForImageSuperResolution:()=>Un,Swin2SRModel:()=>$n,Swin2SRPreTrainedModel:()=>Wn,SwinForImageClassification:()=>Rn,SwinForSemanticSegmentation:()=>qn,SwinModel:()=>Gn,SwinPreTrainedModel:()=>Bn,T5ForConditionalGeneration:()=>It,T5Model:()=>Lt,T5PreTrainedModel:()=>Et,TableTransformerForObjectDetection:()=>Sn,TableTransformerModel:()=>Cn,TableTransformerObjectDetectionOutput:()=>An,TableTransformerPreTrainedModel:()=>vn,TokenClassifierOutput:()=>ud,TrOCRForCausalLM:()=>yi,TrOCRPreTrainedModel:()=>Fi,UltravoxModel:()=>Ll,UltravoxPreTrainedModel:()=>El,UniSpeechForCTC:()=>Ya,UniSpeechForSequenceClassification:()=>Ka,UniSpeechModel:()=>Ja,UniSpeechPreTrainedModel:()=>Ha,UniSpeechSatForAudioFrameClassification:()=>oi,UniSpeechSatForCTC:()=>ti,UniSpeechSatForSequenceClassification:()=>si,UniSpeechSatModel:()=>ei,UniSpeechSatPreTrainedModel:()=>Za,ViTForImageClassification:()=>zr,ViTMAEModel:()=>Wr,ViTMAEPreTrainedModel:()=>qr,ViTMSNForImageClassification:()=>Xr,ViTMSNModel:()=>Ur,ViTMSNPreTrainedModel:()=>$r,ViTModel:()=>Ir,ViTPreTrainedModel:()=>Lr,VisionEncoderDecoderModel:()=>Ss,VitMatteForImageMatting:()=>en,VitMattePreTrainedModel:()=>Zr,VitPoseForPoseEstimation:()=>Or,VitPosePreTrainedModel:()=>Dr,VitsModel:()=>Gi,VitsModelOutput:()=>fd,VitsPreTrainedModel:()=>Bi,Wav2Vec2BertForCTC:()=>ai,Wav2Vec2BertForSequenceClassification:()=>ii,Wav2Vec2BertModel:()=>ni,Wav2Vec2BertPreTrainedModel:()=>ri,Wav2Vec2ForAudioFrameClassification:()=>qa,Wav2Vec2ForCTC:()=>Ga,Wav2Vec2ForSequenceClassification:()=>Ra,Wav2Vec2Model:()=>Ba,Wav2Vec2PreTrainedModel:()=>Oa,WavLMForAudioFrameClassification:()=>fi,WavLMForCTC:()=>mi,WavLMForSequenceClassification:()=>hi,WavLMForXVector:()=>gi,WavLMModel:()=>pi,WavLMPreTrainedModel:()=>_i,WeSpeakerResNetModel:()=>Qa,WeSpeakerResNetPreTrainedModel:()=>Xa,WhisperForConditionalGeneration:()=>ks,WhisperModel:()=>Ps,WhisperPreTrainedModel:()=>xs,XLMForQuestionAnswering:()=>_s,XLMForSequenceClassification:()=>ds,XLMForTokenClassification:()=>us,XLMModel:()=>ls,XLMPreTrainedModel:()=>is,XLMRobertaForMaskedLM:()=>hs,XLMRobertaForQuestionAnswering:()=>Ms,XLMRobertaForSequenceClassification:()=>gs,XLMRobertaForTokenClassification:()=>fs,XLMRobertaModel:()=>ms,XLMRobertaPreTrainedModel:()=>ps,XLMWithLMHeadModel:()=>cs,XVectorOutput:()=>dd,YolosForObjectDetection:()=>Ca,YolosModel:()=>va,YolosObjectDetectionOutput:()=>Sa,YolosPreTrainedModel:()=>ya});var o=s("./src/configs.js"),r=s("./src/backends/onnx.js"),n=s("./src/utils/dtypes.js"),a=s("./src/utils/generic.js"),i=s("./src/utils/core.js"),l=s("./src/utils/hub.js"),c=s("./src/utils/constants.js"),d=s("./src/generation/logits_process.js"),u=s("./src/generation/configuration_utils.js"),_=s("./src/utils/tensor.js"),p=s("./src/utils/image.js"),m=s("./src/utils/maths.js"),h=s("./src/generation/stopping_criteria.js"),g=s("./src/generation/logits_sampler.js"),f=s("./src/env.js"),M=s("./src/models/whisper/generation_whisper.js"),w=s("./src/models/whisper/common_whisper.js");const T=0,b=1,x=2,P=3,k=4,F=5,y=6,v=7,C=8,S=9,A=10,E=11,L=new Map,I=new Map,z=new Map;async function V(e,t,s){return Object.fromEntries(await Promise.all(Object.keys(t).map((async a=>{const{buffer_or_path:i,session_options:c,session_config:d}=await async function(e,t,s){const a=s.config?.["transformers.js_config"]??{};let i=s.device??a.device;i&&"string"!=typeof i&&(i.hasOwnProperty(t)?i=i[t]:(console.warn(`device not specified for "${t}". Using the default device.`),i=null));const c=i??(f.apis.IS_NODE_ENV?"cpu":"wasm"),d=(0,r.deviceToExecutionProviders)(c);let u=s.dtype??a.dtype;if("string"!=typeof u&&(u&&u.hasOwnProperty(t)?u=u[t]:(u=n.DEFAULT_DEVICE_DTYPE_MAPPING[c]??n.DATA_TYPES.fp32,console.warn(`dtype not specified for "${t}". Using the default dtype (${u}) for this device (${c}).`))),u===n.DATA_TYPES.auto){let e=a.dtype;"string"!=typeof e&&(e=e[t]),u=e&&e!==n.DATA_TYPES.auto&&n.DATA_TYPES.hasOwnProperty(e)?e:n.DEFAULT_DEVICE_DTYPE_MAPPING[c]??n.DATA_TYPES.fp32}const _=u;if(!n.DEFAULT_DTYPE_SUFFIX_MAPPING.hasOwnProperty(_))throw new Error(`Invalid dtype: ${_}. Should be one of: ${Object.keys(n.DATA_TYPES).join(", ")}`);if(_===n.DATA_TYPES.fp16&&"webgpu"===c&&!await(0,n.isWebGpuFp16Supported)())throw new Error(`The device (${c}) does not support fp16.`);const p=a.kv_cache_dtype?"string"==typeof a.kv_cache_dtype?a.kv_cache_dtype:a.kv_cache_dtype[_]??"float32":void 0;if(p&&!["float32","float16"].includes(p))throw new Error(`Invalid kv_cache_dtype: ${p}. Should be one of: float32, float16`);const m={dtype:_,kv_cache_dtype:p},h=`${t}${n.DEFAULT_DTYPE_SUFFIX_MAPPING[_]}.onnx`,g=`${s.subfolder??""}/${h}`,M={...s.session_options};M.executionProviders??=d;const w=a.free_dimension_overrides;w?M.freeDimensionOverrides??=w:c.startsWith("webnn")&&!M.freeDimensionOverrides&&console.warn('WebNN does not currently support dynamic shapes and requires `free_dimension_overrides` to be set in config.json as a field within "transformers.js_config". When `free_dimension_overrides` is not set, you may experience significant performance degradation.');const T=(0,l.getModelFile)(e,g,!0,s,f.apis.IS_NODE_ENV),b=s.use_external_data_format??a.use_external_data_format;let x=[];if(b){let o;o="object"==typeof b?b.hasOwnProperty(h)?b[h]:!!b.hasOwnProperty(t)&&b[t]:b;const r=+o;if(r>l.MAX_EXTERNAL_DATA_CHUNKS)throw new Error(`The number of external data chunks (${r}) exceeds the maximum allowed value (${l.MAX_EXTERNAL_DATA_CHUNKS}).`);for(let t=0;t<r;++t){const o=`${h}_data${0===t?"":"_"+t}`,r=`${s.subfolder??""}/${o}`;x.push(new Promise((async(t,n)=>{const a=await(0,l.getModelFile)(e,r,!0,s,f.apis.IS_NODE_ENV);t(a instanceof Uint8Array?{path:o,data:a}:o)})))}}else void 0!==M.externalData&&(x=M.externalData.map((async t=>{if("string"==typeof t.data){const o=await(0,l.getModelFile)(e,t.data,!0,s);return{...t,data:o}}return t})));if(x.length>0){const e=await Promise.all(x);f.apis.IS_NODE_ENV||(M.externalData=e)}if("webgpu"===c){const e=(0,o.getKeyValueShapes)(s.config,{prefix:"present"});if(Object.keys(e).length>0&&!(0,r.isONNXProxy)()){const t={};for(const s in e)t[s]="gpu-buffer";M.preferredOutputLocation=t}}return{buffer_or_path:await T,session_options:M,session_config:m}}(e,t[a],s);return[a,await(0,r.createInferenceSession)(i,c,d)]}))))}async function j(e,t,s){return Object.fromEntries(await Promise.all(Object.keys(t).map((async o=>[o,await(0,l.getModelJSON)(e,t[o],!1,s)]))))}async function N(e,t){const s=function(e,t){const s=Object.create(null),o=[];for(const n of e.inputNames){const e=t[n];e instanceof _.Tensor?s[n]=(0,r.isONNXProxy)()?e.clone():e:o.push(n)}if(o.length>0)throw new Error(`An error occurred during model execution: "Missing the following inputs: ${o.join(", ")}.`);const n=Object.keys(t).length,a=e.inputNames.length;if(n>a){let s=Object.keys(t).filter((t=>!e.inputNames.includes(t)));console.warn(`WARNING: Too many inputs were provided (${n} > ${a}). The following inputs will be ignored: "${s.join(", ")}".`)}return s}(e,t);try{const t=Object.fromEntries(Object.entries(s).map((([e,t])=>[e,t.ort_tensor])));let o=await e.run(t);return o=D(o),o}catch(e){const t=Object.fromEntries(Object.entries(s).map((([e,{type:t,dims:s,data:o}])=>[e,{type:t,dims:s,data:o}])));throw console.error(`An error occurred during model execution: "${e}".`),console.error("Inputs given to model:",t),e}}function D(e){for(let t in e)(0,r.isONNXTensor)(e[t])?e[t]=new _.Tensor(e[t]):"object"==typeof e[t]&&D(e[t]);return e}function O(e){if(e instanceof _.Tensor)return e;if(0===e.length)throw Error("items must be non-empty");if(Array.isArray(e[0])){if(e.some((t=>t.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 _.Tensor("int64",BigInt64Array.from(e.flat().map((e=>BigInt(e)))),[e.length,e[0].length])}return new _.Tensor("int64",BigInt64Array.from(e.map((e=>BigInt(e)))),[1,e.length])}function B(e){return new _.Tensor("bool",[e],[1])}async function G(e,t){let{encoder_outputs:s,input_ids:o,decoder_input_ids:r,...n}=t;if(!s){const o=(0,i.pick)(t,e.sessions.model.inputNames);s=(await R(e,o)).last_hidden_state}n.input_ids=r,n.encoder_hidden_states=s,e.sessions.decoder_model_merged.inputNames.includes("encoder_attention_mask")&&(n.encoder_attention_mask=t.attention_mask);return await W(e,n,!0)}async function R(e,t){const s=e.sessions.model,o=(0,i.pick)(t,s.inputNames);if(s.inputNames.includes("inputs_embeds")&&!o.inputs_embeds){if(!t.input_ids)throw new Error("Both `input_ids` and `inputs_embeds` are missing in the model inputs.");o.inputs_embeds=await e.encode_text({input_ids:t.input_ids})}if(s.inputNames.includes("token_type_ids")&&!o.token_type_ids){if(!o.input_ids)throw new Error("Both `input_ids` and `token_type_ids` are missing in the model inputs.");o.token_type_ids=(0,_.zeros_like)(o.input_ids)}if(s.inputNames.includes("pixel_mask")&&!o.pixel_mask){if(!o.pixel_values)throw new Error("Both `pixel_values` and `pixel_mask` are missing in the model inputs.");const e=o.pixel_values.dims;o.pixel_mask=(0,_.ones)([e[0],e[2],e[3]])}return await N(s,o)}async function q(e,t){const s=await e.encode(t);return await e.decode(s)}async function W(e,t,s=!1){const o=e.sessions[s?"decoder_model_merged":"model"],{past_key_values:r,...n}=t;if(o.inputNames.includes("use_cache_branch")&&(n.use_cache_branch=B(!!r)),o.inputNames.includes("position_ids")&&n.attention_mask&&!n.position_ids){const t="paligemma"===e.config.model_type?1:0;n.position_ids=function(e,t=null,s=0){const{input_ids:o,inputs_embeds:r,attention_mask:n}=e,{data:a,dims:i}=J(n,s);let l=new _.Tensor("int64",a,i);if(t){const e=-(o??r).dims.at(1);l=l.slice(null,[e,null])}return l}(n,r,t)}e.addPastKeyValues(n,r);const a=(0,i.pick)(n,o.inputNames);return await N(o,a)}function $({modality_token_id:e,inputs_embeds:t,modality_features:s,input_ids:o,attention_mask:r}){const n=o.tolist().map((t=>t.reduce(((t,s,o)=>(s==e&&t.push(o),t)),[]))),a=n.reduce(((e,t)=>e+t.length),0),i=s.dims[0];if(a!==i)throw new Error(`Number of tokens and features do not match: tokens: ${a}, features ${i}`);let l=0;for(let e=0;e<n.length;++e){const o=n[e],r=t[e];for(let e=0;e<o.length;++e)r[o[e]].data.set(s[l++].data)}return{inputs_embeds:t,attention_mask:r}}function U({image_token_id:e,inputs_embeds:t,image_features:s,input_ids:o,attention_mask:r}){return $({modality_token_id:e,inputs_embeds:t,modality_features:s,input_ids:o,attention_mask:r})}async function X(e,{encode_function:t,merge_function:s,modality_input_name:o,modality_output_name:r,input_ids:n=null,attention_mask:a=null,position_ids:i=null,inputs_embeds:l=null,past_key_values:c=null,generation_config:d=null,logits_processor:u=null,...p}){const m=p[o];if(!l)if(l=await e.encode_text({input_ids:n,...p}),m&&1!==n.dims[1]){const e=await t({[o]:m,...p});({inputs_embeds:l,attention_mask:a}=s({[r]:e,inputs_embeds:l,input_ids:n,attention_mask:a}))}else if(c&&m&&1===n.dims[1]){const e=n.dims[1],t=Object.values(c)[0].dims.at(-2);a=(0,_.cat)([(0,_.ones)([n.dims[0],t]),a.slice(null,[a.dims[1]-e,a.dims[1]])],1)}if(!i&&"qwen2_vl"===e.config.model_type){const{image_grid_thw:t,video_grid_thw:s}=p;[i]=e.get_rope_index(n,t,s,a)}return await W(e,{inputs_embeds:l,past_key_values:c,attention_mask:a,position_ids:i,generation_config:d,logits_processor:u},!0)}async function Q(e,t){return await X(e,{...t,modality_input_name:"audio_values",modality_output_name:"audio_features",encode_function:e.encode_audio.bind(e),merge_function:e._merge_input_ids_with_audio_features.bind(e)})}async function H(e,t){return await X(e,{...t,modality_input_name:"pixel_values",modality_output_name:"image_features",encode_function:e.encode_image.bind(e),merge_function:e._merge_input_ids_with_image_features.bind(e)})}function J(e,t=0){const[s,o]=e.dims,r=e.data,n=new BigInt64Array(r.length);for(let e=0;e<s;++e){const s=e*o;let a=BigInt(t);for(let e=0;e<o;++e){const t=s+e;0n===r[t]?n[t]=BigInt(1):(n[t]=a,a+=r[t])}}return{data:n,dims:e.dims}}function Y(e,t,s,o){if(s.past_key_values){const t=Object.values(s.past_key_values)[0].dims.at(-2),{input_ids:o,attention_mask:r}=s;if(r&&r.dims[1]>o.dims[1]);else if(t<o.dims[1])s.input_ids=o.slice(null,[t,null]);else if(null!=e.config.image_token_index&&o.data.some((t=>t==e.config.image_token_index))){const r=e.config.num_image_tokens;if(!r)throw new Error("`num_image_tokens` is missing in the model configuration.");const n=o.dims[1]-(t-r);s.input_ids=o.slice(null,[-n,null]),s.attention_mask=(0,_.ones)([1,t+n])}}return s}function K(e,t,s,o){return s.past_key_values&&(t=t.map((e=>[e.at(-1)]))),{...s,decoder_input_ids:O(t)}}function Z(e,...t){return e.config.is_encoder_decoder?K(e,...t):Y(e,...t)}function ee(e,t,s,o){const r=!!s.past_key_values;if(null!==o.guidance_scale&&o.guidance_scale>1&&(r?s.input_ids=(0,_.cat)([s.input_ids,s.input_ids],0):(s.input_ids=(0,_.cat)([s.input_ids,(0,_.full_like)(s.input_ids,BigInt(o.pad_token_id))],0),s.attention_mask=(0,_.cat)([s.attention_mask,(0,_.full_like)(s.attention_mask,0n)],0))),!r&&s.pixel_values||(s.pixel_values=(0,_.full)([0,0,3,384,384],1)),r){const e=0,t=1,o=e>0?1:0,r=1;s.images_seq_mask=new _.Tensor("bool",new Array(e+t).fill(!0).fill(!1,0,t),[r,e+t]),s.images_emb_mask=new _.Tensor("bool",new Array(e).fill(!!o),[r,1,e])}return s}class te extends a.Callable{main_input_name="input_ids";forward_params=["input_ids","attention_mask"];constructor(e,t,s){super(),this.config=e,this.sessions=t,this.configs=s;const o=z.get(this.constructor),r=L.get(o);switch(this.can_generate=!1,this._forward=null,this._prepare_inputs_for_generation=null,r){case k:this.can_generate=!0,this._forward=W,this._prepare_inputs_for_generation=Y;break;case x:case P:case v:this.can_generate=!0,this._forward=G,this._prepare_inputs_for_generation=K;break;case b:this._forward=G;break;case y:this.can_generate=!0,this._forward=H,this._prepare_inputs_for_generation=Z;break;case A:this.can_generate=!0,this._forward=Q,this._prepare_inputs_for_generation=Z;break;case S:this.can_generate=!0,this._prepare_inputs_for_generation=Z;break;case C:this.can_generate=!0,this._prepare_inputs_for_generation=ee;break;case E:this._forward=q;break;default:this._forward=R}this.can_generate&&this.forward_params.push("past_key_values"),this.custom_config=this.config["transformers.js_config"]??{}}async dispose(){const e=[];for(const t of Object.values(this.sessions))t?.handler?.dispose&&e.push(t.handler.dispose());return await Promise.all(e)}static async from_pretrained(e,{progress_callback:t=null,config:s=null,cache_dir:r=null,local_files_only:n=!1,revision:a="main",model_file_name:i=null,subfolder:l="onnx",device:d=null,dtype:u=null,use_external_data_format:_=null,session_options:p={}}={}){let m={progress_callback:t,config:s,cache_dir:r,local_files_only:n,revision:a,model_file_name:i,subfolder:l,device:d,dtype:u,use_external_data_format:_,session_options:p};const h=z.get(this),g=L.get(h);let f;if(s=m.config=await o.AutoConfig.from_pretrained(e,m),g===k)f=await Promise.all([V(e,{model:m.model_file_name??"model"},m),j(e,{generation_config:"generation_config.json"},m)]);else if(g===x||g===P)f=await Promise.all([V(e,{model:"encoder_model",decoder_model_merged:"decoder_model_merged"},m),j(e,{generation_config:"generation_config.json"},m)]);else if(g===F)f=await Promise.all([V(e,{model:"vision_encoder",prompt_encoder_mask_decoder:"prompt_encoder_mask_decoder"},m)]);else if(g===b)f=await Promise.all([V(e,{model:"encoder_model",decoder_model_merged:"decoder_model_merged"},m)]);else if(g===y){const t={embed_tokens:"embed_tokens",vision_encoder:"vision_encoder",decoder_model_merged:"decoder_model_merged"};s.is_encoder_decoder&&(t.model="encoder_model"),f=await Promise.all([V(e,t,m),j(e,{generation_config:"generation_config.json"},m)])}else if(g===A){const t={embed_tokens:"embed_tokens",audio_encoder:"audio_encoder",decoder_model_merged:"decoder_model_merged"};f=await Promise.all([V(e,t,m),j(e,{generation_config:"generation_config.json"},m)])}else if(g===v)f=await Promise.all([V(e,{model:"text_encoder",decoder_model_merged:"decoder_model_merged",encodec_decode:"encodec_decode"},m),j(e,{generation_config:"generation_config.json"},m)]);else if(g===C)f=await Promise.all([V(e,{prepare_inputs_embeds:"prepare_inputs_embeds",model:"language_model",lm_head:"lm_head",gen_head:"gen_head",gen_img_embeds:"gen_img_embeds",image_decode:"image_decode"},m),j(e,{generation_config:"generation_config.json"},m)]);else if(g===S)f=await Promise.all([V(e,{prepare_inputs_embeds:"prepare_inputs_embeds",model:"model",vision_encoder:"vision_encoder"},m),j(e,{generation_config:"generation_config.json"},m)]);else if(g===E)f=await Promise.all([V(e,{encoder_model:"encoder_model",decoder_model:"decoder_model"},m)]);else{if(g!==T){const e=h??s?.model_type;"custom"!==e&&console.warn(`Model type for '${e}' not found, assuming encoder-only architecture. Please report this at ${c.GITHUB_ISSUE_URL}.`)}f=await Promise.all([V(e,{model:m.model_file_name??"model"},m)])}return new this(s,...f)}async _call(e){return await this.forward(e)}async forward(e){return await this._forward(this,e)}get generation_config(){return this.configs?.generation_config??null}_get_logits_warper(e){const t=new d.LogitsProcessorList;return null!==e.temperature&&1!==e.temperature&&t.push(new d.TemperatureLogitsWarper(e.temperature)),null!==e.top_k&&0!==e.top_k&&t.push(new d.TopKLogitsWarper(e.top_k)),null!==e.top_p&&e.top_p<1&&t.push(new d.TopPLogitsWarper(e.top_p)),t}_get_logits_processor(e,t,s=null){const o=new d.LogitsProcessorList;if(null!==e.repetition_penalty&&1!==e.repetition_penalty&&o.push(new d.RepetitionPenaltyLogitsProcessor(e.repetition_penalty)),null!==e.no_repeat_ngram_size&&e.no_repeat_ngram_size>0&&o.push(new d.NoRepeatNGramLogitsProcessor(e.no_repeat_ngram_size)),null!==e.bad_words_ids&&o.push(new d.NoBadWordsLogitsProcessor(e.bad_words_ids,e.eos_token_id)),null!==e.min_length&&null!==e.eos_token_id&&e.min_length>0&&o.push(new d.MinLengthLogitsProcessor(e.min_length,e.eos_token_id)),null!==e.min_new_tokens&&null!==e.eos_token_id&&e.min_new_tokens>0&&o.push(new d.MinNewTokensLengthLogitsProcessor(t,e.min_new_tokens,e.eos_token_id)),null!==e.forced_bos_token_id&&o.push(new d.ForcedBOSTokenLogitsProcessor(e.forced_bos_token_id)),null!==e.forced_eos_token_id&&o.push(new d.ForcedEOSTokenLogitsProcessor(e.max_length,e.forced_eos_token_id)),null!==e.begin_suppress_tokens){const s=t>1||null===e.forced_bos_token_id?t:t+1;o.push(new d.SuppressTokensAtBeginLogitsProcessor(e.begin_suppress_tokens,s))}return null!==e.guidance_scale&&e.guidance_scale>1&&o.push(new d.ClassifierFreeGuidanceLogitsProcessor(e.guidance_scale)),null!==s&&o.extend(s),o}_prepare_generation_config(e,t,s=u.GenerationConfig){const o={...this.config};for(const e of["decoder","generator","text_config"])e in o&&Object.assign(o,o[e]);const r=new s(o);return Object.assign(r,this.generation_config??{}),e&&Object.assign(r,e),t&&Object.assign(r,(0,i.pick)(t,Object.getOwnPropertyNames(r))),r}_get_stopping_criteria(e,t=null){const s=new h.StoppingCriteriaList;return null!==e.max_length&&s.push(new h.MaxLengthCriteria(e.max_length,this.config.max_position_embeddings??null)),null!==e.eos_token_id&&s.push(new h.EosTokenCriteria(e.eos_token_id)),t&&s.extend(t),s}_validate_model_class(){if(!this.can_generate){const e=[sc,ac,tc,Jl],t=z.get(this.constructor),s=new Set,o=this.config.model_type;for(const t of e){const e=t.get(o);e&&s.add(e[0])}let r=`The current model class (${t}) is not compatible with \`.generate()\`, as it doesn't have a language model head.`;throw s.size>0&&(r+=` Please use the following class instead: ${[...s].join(", ")}`),Error(r)}}prepare_inputs_for_generation(...e){return this._prepare_inputs_for_generation(this,...e)}_update_model_kwargs_for_generation({generated_input_ids:e,outputs:t,model_inputs:s,is_encoder_decoder:o}){return s.past_key_values=this.getPastKeyValues(t,s.past_key_values),s.input_ids=new _.Tensor("int64",e.flat(),[e.length,1]),o||(s.attention_mask=(0,_.cat)([s.attention_mask,(0,_.ones)([s.attention_mask.dims[0],1])],1)),s.position_ids=null,s}_prepare_model_inputs({inputs:e,bos_token_id:t,model_kwargs:s}){const o=(0,i.pick)(s,this.forward_params),r=this.main_input_name;if(r in o){if(e)throw new Error("`inputs`: {inputs}` were passed alongside {input_name} which is not allowed. Make sure to either pass {inputs} or {input_name}=...")}else o[r]=e;return{inputs_tensor:o[r],model_inputs:o,model_input_name:r}}async _prepare_encoder_decoder_kwargs_for_generation({inputs_tensor:e,model_inputs:t,model_input_name:s,generation_config:o}){if(this.sessions.model.inputNames.includes("inputs_embeds")&&!t.inputs_embeds&&"_prepare_inputs_embeds"in this){const{input_ids:e,pixel_values:s,attention_mask:o,...r}=t,n=await this._prepare_inputs_embeds(t);t={...r,...(0,i.pick)(n,["inputs_embeds","attention_mask"])}}let{last_hidden_state:r}=await R(this,t);if(null!==o.guidance_scale&&o.guidance_scale>1)r=(0,_.cat)([r,(0,_.full_like)(r,0)],0),"attention_mask"in t&&(t.attention_mask=(0,_.cat)([t.attention_mask,(0,_.zeros_like)(t.attention_mask)],0));else if(t.decoder_input_ids){const e=O(t.decoder_input_ids).dims[0];if(e!==r.dims[0]){if(1!==r.dims[0])throw new Error(`The encoder outputs have a different batch size (${r.dims[0]}) than the decoder inputs (${e}).`);r=(0,_.cat)(Array.from({length:e},(()=>r)),0)}}return t.encoder_outputs=r,t}_prepare_decoder_input_ids_for_generation({batch_size:e,model_input_name:t,model_kwargs:s,decoder_start_token_id:o,bos_token_id:r,generation_config:n}){let{decoder_input_ids:a,...i}=s;if(!(a instanceof _.Tensor)){if(a)Array.isArray(a[0])||(a=Array.from({length:e},(()=>a)));else if(o??=r,"musicgen"===this.config.model_type)a=Array.from({length:e*this.config.decoder.num_codebooks},(()=>[o]));else if(Array.isArray(o)){if(o.length!==e)throw new Error(`\`decoder_start_token_id\` expcted to have length ${e} but got ${o.length}`);a=o}else a=Array.from({length:e},(()=>[o]));a=O(a)}return s.decoder_attention_mask=(0,_.ones_like)(a),{input_ids:a,model_inputs:i}}async generate({inputs:e=null,generation_config:t=null,logits_processor:s=null,stopping_criteria:o=null,streamer:r=null,...n}){this._validate_model_class(),t=this._prepare_generation_config(t,n);let{inputs_tensor:a,model_inputs:i,model_input_name:l}=this._prepare_model_inputs({inputs:e,model_kwargs:n});const c=this.config.is_encoder_decoder;let d;c&&("encoder_outputs"in i||(i=await this._prepare_encoder_decoder_kwargs_for_generation({inputs_tensor:a,model_inputs:i,model_input_name:l,generation_config:t}))),c?({input_ids:d,model_inputs:i}=this._prepare_decoder_input_ids_for_generation({batch_size:i[l].dims.at(0),model_input_name:l,model_kwargs:i,decoder_start_token_id:t.decoder_start_token_id,bos_token_id:t.bos_token_id,generation_config:t})):d=i[l];let u=d.dims.at(-1);null!==t.max_new_tokens&&(t.max_length=u+t.max_new_tokens);const p=this._get_logits_processor(t,u,s),m=this._get_stopping_criteria(t,o),h=i[l].dims.at(0),f=g.LogitsSampler.getSampler(t),M=new Array(h).fill(0),w=d.tolist();let T;r&&r.put(w);let b={};for(;;){if(i=this.prepare_inputs_for_generation(w,i,t),T=await this.forward(i),t.output_attentions&&t.return_dict_in_generate){const e=this.getAttentions(T);for(const t in e)t in b||(b[t]=[]),b[t].push(e[t])}const e=p(w,T.logits.slice(null,-1,null)),s=[];for(let t=0;t<e.dims.at(0);++t){const o=e[t],r=await f(o);for(const[e,o]of r){const r=BigInt(e);M[t]+=o,w[t].push(r),s.push([r]);break}}r&&r.put(s);if(m(w).every((e=>e)))break;i=this._update_model_kwargs_for_generation({generated_input_ids:s,outputs:T,model_inputs:i,is_encoder_decoder:c})}r&&r.end();const x=this.getPastKeyValues(T,i.past_key_values,!0),P=new _.Tensor("int64",w.flat(),[w.length,w[0].length]);if(t.return_dict_in_generate)return{sequences:P,past_key_values:x,...b};for(const e of Object.values(T))"gpu-buffer"===e.location&&e.dispose();return P}getPastKeyValues(e,t,s=!1){const o=Object.create(null);for(const r in e)if(r.startsWith("present")){const n=r.replace("present","past_key_values"),a=r.includes("encoder");if(o[n]=a&&t?t[n]:e[r],t&&(!a||s)){const e=t[n];"gpu-buffer"===e.location&&e.dispose()}}return o}getAttentions(e){const t={};for(const s of["cross_attentions","encoder_attentions","decoder_attentions"])for(const o in e)o.startsWith(s)&&(s in t||(t[s]=[]),t[s].push(e[o]));return t}addPastKeyValues(e,t){if(t)Object.assign(e,t);else{const t=this.sessions.decoder_model_merged??this.sessions.model,s=t?.config?.kv_cache_dtype??"float32",r="float16"===s?new _.DataTypeMap.float16:[],n=(e[this.main_input_name]??e.attention_mask)?.dims?.[0]??1,a=(0,o.getKeyValueShapes)(this.config,{batch_size:n});for(const t in a)e[t]=new _.Tensor(s,r,a[t])}}async encode_image({pixel_values:e}){const t=(await N(this.sessions.vision_encoder,{pixel_values:e})).image_features;return this.config.num_image_tokens||(console.warn(`The number of image tokens was not set in the model configuration. Setting it to the number of features detected by the vision encoder (${t.dims[1]}).`),this.config.num_image_tokens=t.dims[1]),t}async encode_text({input_ids:e}){return(await N(this.sessions.embed_tokens,{input_ids:e})).inputs_embeds}async encode_audio({audio_values:e}){return(await N(this.sessions.audio_encoder,{audio_values:e})).audio_features}}class se{}class oe extends se{constructor({last_hidden_state:e,hidden_states:t=null,attentions:s=null}){super(),this.last_hidden_state=e,this.hidden_states=t,this.attentions=s}}class re extends te{}class ne extends re{}class ae extends re{async _call(e){return new _d(await super._call(e))}}class ie extends re{async _call(e){return new cd(await super._call(e))}}class le extends re{async _call(e){return new ud(await super._call(e))}}class ce extends re{async _call(e){return new pd(await super._call(e))}}class de extends te{}class ue extends de{}class _e extends de{async _call(e){return new _d(await super._call(e))}}class pe extends de{async _call(e){return new cd(await super._call(e))}}class me extends de{async _call(e){return new ud(await super._call(e))}}class he extends te{}class ge extends he{}class fe extends te{}class Me extends fe{}class we extends fe{async _call(e){return new _d(await super._call(e))}}class Te extends fe{async _call(e){return new cd(await super._call(e))}}class be extends fe{async _call(e){return new ud(await super._call(e))}}class xe extends fe{async _call(e){return new pd(await super._call(e))}}class Pe extends te{}class ke extends Pe{}class Fe extends Pe{async _call(e){return new _d(await super._call(e))}}class ye extends Pe{async _call(e){return new cd(await super._call(e))}}class ve extends Pe{async _call(e){return new ud(await super._call(e))}}class Ce extends Pe{async _call(e){return new pd(await super._call(e))}}class Se extends te{}class Ae extends Se{}class Ee extends Se{async _call(e){return new _d(await super._call(e))}}class Le extends Se{async _call(e){return new cd(await super._call(e))}}class Ie extends Se{async _call(e){return new ud(await super._call(e))}}class ze extends Se{async _call(e){return new pd(await super._call(e))}}class Ve extends te{}class je extends Ve{}class Ne extends Ve{async _call(e){return new _d(await super._call(e))}}class De extends Ve{async _call(e){return new cd(await super._call(e))}}class Oe extends Ve{async _call(e){return new ud(await super._call(e))}}class Be extends Ve{async _call(e){return new pd(await super._call(e))}}class Ge extends te{}class Re extends Ge{}class qe extends Ge{async _call(e){return new _d(await super._call(e))}}class We extends Ge{async _call(e){return new cd(await super._call(e))}}class $e extends Ge{async _call(e){return new ud(await super._call(e))}}class Ue extends Ge{async _call(e){return new pd(await super._call(e))}}class Xe extends te{}class Qe extends Xe{}class He extends Xe{async _call(e){return new _d(await super._call(e))}}class Je extends Xe{async _call(e){return new cd(await super._call(e))}}class Ye extends Xe{async _call(e){return new ud(await super._call(e))}}class Ke extends Xe{async _call(e){return new pd(await super._call(e))}}class Ze extends te{}class et extends Ze{}class tt extends Ze{async _call(e){return new cd(await super._call(e))}}class st extends Ze{async _call(e){return new ud(await super._call(e))}}class ot extends Ze{async _call(e){return new pd(await super._call(e))}}class rt extends Ze{async _call(e){return new _d(await super._call(e))}}class nt extends te{}class at extends nt{}class it extends nt{async _call(e){return new _d(await super._call(e))}}class lt extends nt{async _call(e){return new cd(await super._call(e))}}class ct extends nt{async _call(e){return new ud(await super._call(e))}}class dt extends te{}class ut extends dt{}class _t extends dt{async _call(e){return new _d(await super._call(e))}}class pt extends dt{async _call(e){return new cd(await super._call(e))}}class mt extends dt{async _call(e){return new pd(await super._call(e))}}class ht extends te{}class gt extends ht{}class ft extends ht{async _call(e){return new _d(await super._call(e))}}class Mt extends ht{async _call(e){return new cd(await super._call(e))}}class wt extends ht{async _call(e){return new ud(await super._call(e))}}class Tt extends ht{async _call(e){return new pd(await super._call(e))}}class bt extends te{}class xt extends bt{}class Pt extends bt{async _call(e){return new _d(await super._call(e))}}class kt extends bt{async _call(e){return new cd(await super._call(e))}}class Ft extends bt{async _call(e){return new pd(await super._call(e))}}class yt extends te{}class vt extends yt{}class Ct extends yt{async _call(e){return new cd(await super._call(e))}}class St extends yt{async _call(e){return new pd(await super._call(e))}}class At extends yt{async _call(e){return new _d(await super._call(e))}}class Et extends te{forward_params=["input_ids","attention_mask","encoder_outputs","decoder_input_ids","decoder_attention_mask","past_key_values"]}class Lt extends Et{}class It extends Et{}class zt extends te{}class Vt extends zt{}class jt extends zt{}class Nt extends te{}class Dt extends Nt{}class Ot extends Nt{}class Bt extends te{}class Gt extends Bt{}class Rt extends Bt{}class qt extends Bt{async _call(e){return new cd(await super._call(e))}}class Wt extends te{}class $t extends Wt{}class Ut extends Wt{}class Xt extends Wt{async _call(e){return new cd(await super._call(e))}}class Qt extends Wt{}class Ht extends te{}class Jt extends Ht{}class Yt extends Ht{}class Kt extends te{}class Zt extends Kt{}class es extends Kt{}class ts extends te{}class ss extends ts{}class os extends ts{async _call(e){return new _d(await super._call(e))}}class rs extends ts{async _call(e){return new cd(await super._call(e))}}class ns extends ts{async _call(e){return new ud(await super._call(e))}}class as extends ts{async _call(e){return new pd(await super._call(e))}}class is extends te{}class ls extends is{}class cs extends is{async _call(e){return new _d(await super._call(e))}}class ds extends is{async _call(e){return new cd(await super._call(e))}}class us extends is{async _call(e){return new ud(await super._call(e))}}class _s extends is{async _call(e){return new pd(await super._call(e))}}class ps extends te{}class ms extends ps{}class hs extends ps{async _call(e){return new _d(await super._call(e))}}class gs extends ps{async _call(e){return new cd(await super._call(e))}}class fs extends ps{async _call(e){return new ud(await super._call(e))}}class Ms extends ps{async _call(e){return new pd(await super._call(e))}}class ws extends te{}class Ts extends ws{}class bs extends ws{}class xs extends te{requires_attention_mask=!1;main_input_name="input_features";forward_params=["input_features","attention_mask","decoder_input_ids","decoder_attention_mask","past_key_values"]}class Ps extends xs{}class ks extends xs{_prepare_generation_config(e,t){return super._prepare_generation_config(e,t,M.WhisperGenerationConfig)}_retrieve_init_tokens(e){const t=[e.decoder_start_token_id];let s=e.language;const o=e.task;if(e.is_multilingual){s||(console.warn("No language specified - defaulting to English (en)."),s="en");const r=`<|${(0,w.whisper_language_to_code)(s)}|>`;t.push(e.lang_to_id[r]),t.push(e.task_to_id[o??"transcribe"])}else if(s||o)throw new Error("Cannot specify `task` or `language` for an English-only model. If the model is intended to be multilingual, pass `is_multilingual=true` to generate, or update the generation config.");return!e.return_timestamps&&e.no_timestamps_token_id&&t.at(-1)!==e.no_timestamps_token_id?t.push(e.no_timestamps_token_id):e.return_timestamps&&t.at(-1)===e.no_timestamps_token_id&&(console.warn("<|notimestamps|> prompt token is removed from generation_config since `return_timestamps` is set to `true`."),t.pop()),t.filter((e=>null!=e))}async generate({inputs:e=null,generation_config:t=null,logits_processor:s=null,stopping_criteria:o=null,...r}){t=this._prepare_generation_config(t,r);const n=r.decoder_input_ids??this._retrieve_init_tokens(t);if(t.return_timestamps&&(s??=new d.LogitsProcessorList,s.push(new d.WhisperTimeStampLogitsProcessor(t,n))),t.begin_suppress_tokens&&(s??=new d.LogitsProcessorList,s.push(new d.SuppressTokensAtBeginLogitsProcessor(t.begin_suppress_tokens,n.length))),t.return_token_timestamps){if(!t.alignment_heads)throw new 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.");"translate"===t.task&&console.warn("Token-level timestamps may not be reliable for task 'translate'."),t.output_attentions=!0,t.return_dict_in_generate=!0}const a=await super.generate({inputs:e,generation_config:t,logits_processor:s,decoder_input_ids:n,...r});return t.return_token_timestamps&&(a.token_timestamps=this._extract_token_timestamps(a,t.alignment_heads,t.num_frames)),a}_extract_token_timestamps(e,t,s=null,o=.02){if(!e.cross_attentions)throw new Error("Model outputs must contain cross attentions to extract timestamps. This is most likely because the model was not exported with `output_attentions=True`.");null==s&&console.warn("`num_frames` has not been set, meaning the entire audio will be analyzed. This may lead to inaccurate token-level timestamps for short audios (< 30 seconds).");let r=this.config.median_filter_width;void 0===r&&(console.warn("Model config has no `median_filter_width`, using default value of 7."),r=7);const n=e.cross_attentions,a=Array.from({length:this.config.decoder_layers},((e,t)=>(0,_.cat)(n.map((e=>e[t])),2))),l=(0,_.stack)(t.map((([e,t])=>{if(e>=a.length)throw new Error(`Layer index ${e} is out of bounds for cross attentions (length ${a.length}).`);return s?a[e].slice(null,t,null,[0,s]):a[e].slice(null,t)}))).transpose(1,0,2,3),[c,d]=(0,_.std_mean)(l,-2,0,!0),u=l.clone();for(let e=0;e<u.dims[0];++e){const t=u[e];for(let s=0;s<t.dims[0];++s){const o=t[s],n=c[e][s][0].data,a=d[e][s][0].data;for(let e=0;e<o.dims[0];++e){let t=o[e].data;for(let e=0;e<t.length;++e)t[e]=(t[e]-a[e])/n[e];t.set((0,m.medianFilter)(t,r))}}}const p=[(0,_.mean)(u,1)],h=e.sequences.dims,g=new _.Tensor("float32",new Float32Array(h[0]*h[1]),h);for(let e=0;e<h[0];++e){const t=p[e].neg().squeeze_(0),[s,r]=(0,m.dynamic_time_warping)(t.tolist()),n=Array.from({length:s.length-1},((e,t)=>s[t+1]-s[t])),a=(0,i.mergeArrays)([1],n).map((e=>!!e)),l=[];for(let e=0;e<a.length;++e)a[e]&&l.push(r[e]*o);g[e].data.set(l,1)}return g}}class Fs extends ks{}class ys extends te{requires_attention_mask=!1;main_input_name="input_values";forward_params=["input_values","decoder_input_ids","past_key_values"]}class vs extends ys{}class Cs extends ys{}class Ss extends te{main_input_name="pixel_values";forward_params=["pixel_values","decoder_input_ids","encoder_hidden_states","past_key_values"]}class As extends te{forward_params=["input_ids","attention_mask","pixel_values","position_ids","past_key_values"]}class Es extends As{_merge_input_ids_with_image_features({inputs_embeds:e,image_features:t,input_ids:s,attention_mask:o}){const r=this.config.image_token_index,n=s.tolist().map((e=>e.findIndex((e=>e==r)))),a=n.every((e=>-1===e)),i=n.every((e=>-1!==e));if(!a&&!i)throw new Error("Every input should contain either 0 or 1 image token.");if(a)return{inputs_embeds:e,attention_mask:o};const l=[],c=[];for(let s=0;s<n.length;++s){const r=n[s],a=e[s],i=t[s],d=o[s];l.push((0,_.cat)([a.slice([0,r]),i,a.slice([r+1,a.dims[0]])],0)),c.push((0,_.cat)([d.slice([0,r]),(0,_.ones)([i.dims[0]]),d.slice([r+1,d.dims[0]])],0))}return{inputs_embeds:(0,_.stack)(l,0),attention_mask:(0,_.stack)(c,0)}}}class Ls extends Es{}class Is extends Es{}class zs extends te{forward_params=["input_ids","inputs_embeds","attention_mask","pixel_values","encoder_outputs","decoder_input_ids","decoder_inputs_embeds","decoder_attention_mask","past_key_values"];main_input_name="inputs_embeds"}class Vs extends zs{_merge_input_ids_with_image_features({inputs_embeds:e,image_features:t,input_ids:s,attention_mask:o}){return{inputs_embeds:(0,_.cat)([t,e],1),attention_mask:(0,_.cat)([(0,_.ones)(t.dims.slice(0,2)),o],1)}}async _prepare_inputs_embeds({input_ids:e,pixel_values:t,inputs_embeds:s,attention_mask:o}){if(!e&&!t)throw new Error("Either `input_ids` or `pixel_values` should be provided.");let r,n;return e&&(r=await this.encode_text({input_ids:e})),t&&(n=await this.encode_image({pixel_values:t})),r&&n?({inputs_embeds:s,attention_mask:o}=this._merge_input_ids_with_image_features({inputs_embeds:r,image_features:n,input_ids:e,attention_mask:o})):s=r||n,{inputs_embeds:s,attention_mask:o}}async forward({input_ids:e,pixel_values:t,attention_mask:s,decoder_input_ids:o,decoder_attention_mask:r,encoder_outputs:n,past_key_values:a,inputs_embeds:i,decoder_inputs_embeds:l}){if(i||({inputs_embeds:i,attention_mask:s}=await this._prepare_inputs_embeds({input_ids:e,pixel_values:t,inputs_embeds:i,attention_mask:s})),!n){let{last_hidden_state:e}=await R(this,{inputs_embeds:i,attention_mask:s});n=e}if(!l){if(!o)throw new Error("Either `decoder_input_ids` or `decoder_inputs_embeds` should be provided.");l=await this.encode_text({input_ids:o})}const c={inputs_embeds:l,attention_mask:r,encoder_attention_mask:s,encoder_hidden_states:n,past_key_values:a};return await W(this,c,!0)}}class js extends te{forward_params=["input_ids","attention_mask","pixel_values","position_ids","past_key_values"]}class Ns extends js{_merge_input_ids_with_image_features(e){const t=e.image_features.dims.at(-1),s=e.image_features.view(-1,t);return U({image_token_id:this.config.image_token_index,...e,image_features:s})}}class Ds extends te{forward_params=["input_ids","attention_mask","pixel_values","pixel_attention_mask","position_ids","past_key_values"]}class Os extends Ds{async encode_image({pixel_values:e,pixel_attention_mask:t}){return(await N(this.sessions.vision_encoder,{pixel_values:e,pixel_attention_mask:t})).image_features}_merge_input_ids_with_image_features(e){const t=e.image_features.dims.at(-1),s=e.image_features.view(-1,t);return U({image_token_id:this.config.image_token_id,...e,image_features:s})}}class Bs extends Os{}class Gs extends te{forward_params=["input_ids","inputs_embeds","attention_mask","position_ids","pixel_values","image_sizes","past_key_values"]}class Rs extends Gs{async forward({input_ids:e=null,attention_mask:t=null,pixel_values:s=null,image_sizes:o=null,position_ids:r=null,inputs_embeds:n=null,past_key_values:a=null,generation_config:i=null,logits_processor:l=null,...c}){if(!n){let t;if(s&&1!==e.dims[1]){if(!o)throw new Error("`image_sizes` must be provided when `pixel_values` is provided.");({image_features:t}=await N(this.sessions.vision_encoder,{pixel_values:s,image_sizes:o}))}else{const e=this.config.normalized_config.hidden_size;t=new _.Tensor("float32",[],[0,e])}({inputs_embeds:n}=await N(this.sessions.prepare_inputs_embeds,{input_ids:e,image_features:t}))}return await W(this,{inputs_embeds:n,past_key_values:a,attention_mask:t,position_ids:r,generation_config:i,logits_processor:l},!1)}}class qs extends te{}class Ws extends qs{}class $s extends qs{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"text_model"})}}class Us extends qs{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"text_model"})}}class Xs extends qs{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"vision_model"})}}class Qs extends qs{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"vision_model"})}}class Hs extends te{}class Js extends Hs{}class Ys extends Hs{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"text_model"})}}class Ks extends qs{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"vision_model"})}}class Zs extends te{}class eo extends Zs{}class to extends te{}class so extends to{async forward(e){const t=!e.input_ids,s=!e.pixel_values;if(t&&s)throw new Error("Either `input_ids` or `pixel_values` should be provided.");if(t&&(e.input_ids=(0,_.ones)([e.pixel_values.dims[0],1])),s){const{image_size:t}=this.config.vision_config;e.pixel_values=(0,_.full)([0,3,t,t],0)}const{text_embeddings:o,image_embeddings:r,l2norm_text_embeddings:n,l2norm_image_embeddings:a}=await super.forward(e),i={};return t||(i.text_embeddings=o,i.l2norm_text_embeddings=n),s||(i.image_embeddings=r,i.l2norm_image_embeddings=a),i}}class oo extends to{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"text_model"})}}class ro extends to{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"vision_model"})}}class no extends te{}class ao extends no{}class io extends no{}class lo extends te{}class co extends lo{}class uo extends lo{}class _o extends te{}class po extends _o{}class mo extends _o{}class ho extends te{}class go extends ho{}class fo extends ho{}class Mo extends te{}class wo extends Mo{}class To extends Mo{}class bo extends te{}class xo extends bo{}class Po extends bo{}class ko extends te{}class Fo extends ko{}class yo extends ko{}class vo extends te{}class Co extends vo{}class So extends vo{}class Ao extends te{}class Eo extends Ao{}class Lo extends Ao{}class Io extends te{}class zo extends Io{}class Vo extends Io{}class jo extends te{}class No extends jo{}class Do extends jo{}class Oo extends te{}class Bo extends Oo{}class Go extends Oo{}class Ro extends te{}class qo extends Ro{}class Wo extends Ro{}class $o extends te{}class Uo extends $o{}class Xo extends $o{}class Qo extends te{}class Ho extends Qo{}class Jo extends Qo{}class Yo extends te{}class Ko extends Yo{}class Zo extends Yo{}class er extends te{}class tr extends er{}class sr extends er{}class or extends te{}class rr extends or{}class nr extends or{}class ar extends te{}class ir extends ar{}class lr extends ar{}class cr extends te{}class dr extends cr{}class ur extends cr{}class _r extends te{}class pr extends _r{}class mr extends _r{}class hr extends te{forward_params=["input_ids","attention_mask","position_ids","past_key_values","pixel_values","image_grid_thw"]}class gr extends hr{get_rope_index(e,t,s,o){const{vision_config:r,image_token_id:n,video_token_id:a,vision_start_token_id:i}=this.config,l=r.spatial_merge_size??2,c=[];if(t||s){let r=e.tolist();o||(o=(0,_.ones_like)(e));const d=o.tolist(),u=Array.from({length:3},(t=>Array.from({length:e.dims[0]},(t=>Array.from({length:e.dims[1]},(e=>1)))))),p=t?t.tolist():[],h=s?s.tolist():[];let g=0,f=0;for(let e=0;e<r.length;++e){const t=r[e].filter(((t,s)=>1==d[e][s])),s=t.reduce(((e,t,s)=>(t==i&&e.push(s),e)),[]).map((e=>t[e+1])),o=s.filter((e=>e==n)).length,_=s.filter((e=>e==a)).length;let M=[],w=0,T=o,b=_;for(let e=0;e<s.length;++e){const e=t.findIndex(((e,t)=>t>w&&e==n)),s=t.findIndex(((e,t)=>t>w&&e==a)),o=T>0&&-1!==e?e:t.length+1,r=b>0&&-1!==s?s:t.length+1;let i,c,d,u;o<r?([c,d,u]=p[g],++g,--T,i=o):([c,d,u]=h[f],++f,--b,i=r);const[_,x,P]=[Number(c),Math.floor(Number(d)/l),Math.floor(Number(u)/l)],k=i-w,F=M.length>0?(0,m.max)(M.at(-1))[0]+1:0;M.push(Array.from({length:3*k},((e,t)=>F+t%k)));const y=k+F,v=_*x*P,C=Array.from({length:v},((e,t)=>y+Math.floor(t/(x*P)))),S=Array.from({length:v},((e,t)=>y+Math.floor(t/P)%x)),A=Array.from({length:v},((e,t)=>y+t%P));M.push([C,S,A].flat()),w=i+v}if(w<t.length){const e=M.length>0?(0,m.max)(M.at(-1))[0]+1:0,s=t.length-w;M.push(Array.from({length:3*s},((t,o)=>e+o%s)))}const x=M.reduce(((e,t)=>e+t.length),0),P=new Array(x);let k=0;for(let e=0;e<3;++e)for(let t=0;t<M.length;++t){const s=M[t],o=s.length/3;for(let t=e*o;t<(e+1)*o;++t)P[k++]=s[t]}let F=0;const y=d[e];for(let t=0;t<y.length;++t)if(1==y[t]){for(let s=0;s<3;++s)u[s][e][t]=P[s*x/3+F];++F}const v=(0,m.max)(P)[0];c.push(v+1-r[e].length)}return[new _.Tensor("int64",u.flat(1/0),[3,e.dims[0],e.dims[1]]),new _.Tensor("int64",c,[c.length,1])]}if(o){const{data:e,dims:t}=J(o),s=BigInt64Array.from({length:3*e.length},((t,s)=>e[s%e.length])),r=Array.from({length:t[0]},((s,o)=>(0,m.max)(e.subarray(t[1]*o,t[1]*(o+1)))[0]+1n+BigInt(t[1])));return[new _.Tensor("int64",s,[3,...t]),new _.Tensor("int64",r,[r.length,1])]}{const[t,s]=e.dims,o=BigInt64Array.from({length:3*t*s},((e,o)=>BigInt(Math.floor(o%s/t))));return[new _.Tensor("int64",o,[3,...e.dims]),(0,_.zeros)([t,1])]}}async encode_image({pixel_values:e,image_grid_thw:t}){return(await N(this.sessions.vision_encoder,{pixel_values:e,grid_thw:t})).image_features}_merge_input_ids_with_image_features(e){return U({image_token_id:this.config.image_token_id,...e})}prepare_inputs_for_generation(e,t,s){if(t.attention_mask&&!t.position_ids)if(t.past_key_values){t.pixel_values=null;const e=BigInt(Object.values(t.past_key_values)[0].dims.at(-2)),s=t.rope_deltas.map((t=>e+t));t.position_ids=(0,_.stack)([s,s,s],0)}else[t.position_ids,t.rope_deltas]=this.get_rope_index(t.input_ids,t.image_grid_thw,t.video_grid_thw,t.attention_mask);return t}}class fr extends te{}class Mr extends fr{}class wr extends fr{}class Tr extends te{}class br extends Tr{}class xr extends Tr{}class Pr extends te{}class kr extends Pr{}class Fr extends Pr{}class yr extends te{}class vr extends yr{}class Cr extends yr{}class Sr extends te{}class Ar extends Sr{}class Er extends Sr{}class Lr extends te{}class Ir extends Lr{}class zr extends Lr{async _call(e){return new cd(await super._call(e))}}class Vr extends te{}class jr extends Vr{}class Nr extends Vr{async _call(e){return new cd(await super._call(e))}}class Dr extends te{}class Or extends Dr{}class Br extends te{}class Gr extends Br{}class Rr extends Br{async _call(e){return new cd(await super._call(e))}}class qr extends te{}class Wr extends qr{}class $r extends te{}class Ur extends $r{}class Xr extends $r{async _call(e){return new cd(await super._call(e))}}class Qr extends te{}class Hr extends Qr{}class Jr extends te{}class Yr extends Jr{}class Kr extends Jr{async _call(e){return new cd(await super._call(e))}}class Zr extends te{}class en extends Zr{async _call(e){return new gd(await super._call(e))}}class tn extends te{}class sn extends tn{}class on extends tn{async _call(e){return new cd(await super._call(e))}}class rn extends te{}class nn extends rn{}class an extends rn{async _call(e){return new cd(await super._call(e))}}class ln extends te{}class cn extends ln{}class dn extends ln{}class un extends te{}class _n extends un{}class pn extends un{}class mn extends te{}class hn extends mn{}class gn extends mn{async _call(e){return new cd(await super._call(e))}}class fn extends te{}class Mn extends fn{}class wn extends fn{async _call(e){return new bn(await super._call(e))}}class Tn extends fn{async _call(e){return new xn(await super._call(e))}}class bn extends se{constructor({logits:e,pred_boxes:t}){super(),this.logits=e,this.pred_boxes=t}}class xn extends se{constructor({logits:e,pred_boxes:t,pred_masks:s}){super(),this.logits=e,this.pred_boxes=t,this.pred_masks=s}}class Pn extends te{}class kn extends Pn{}class Fn extends Pn{async _call(e){return new yn(await super._call(e))}}class yn extends se{constructor({logits:e,pred_boxes:t}){super(),this.logits=e,this.pred_boxes=t}}class vn extends te{}class Cn extends vn{}class Sn extends vn{async _call(e){return new An(await super._call(e))}}class An extends bn{}class En extends te{}class Ln extends En{}class In extends En{async _call(e){return new cd(await super._call(e))}}class zn extends te{}class Vn extends zn{}class jn extends zn{async _call(e){return new cd(await super._call(e))}}class Nn extends te{}class Dn extends Nn{}class On extends Nn{async _call(e){return new cd(await super._call(e))}}class Bn extends te{}class Gn extends Bn{}class Rn extends Bn{async _call(e){return new cd(await super._call(e))}}class qn extends Bn{}class Wn extends te{}class $n extends Wn{}class Un extends Wn{}class Xn extends te{}class Qn extends Xn{}class Hn extends Xn{}class Jn extends te{}class Yn extends Jn{}class Kn extends te{}class Zn extends Kn{}class ea extends Kn{}class ta extends Kn{}class sa extends te{}class oa extends sa{}class ra extends te{}class na extends ra{}class aa extends ra{}class ia extends te{}class la extends ia{}class ca extends ia{}class da extends te{}class ua extends da{}class _a extends te{}class pa extends _a{}class ma extends _a{async _call(e){return new cd(await super._call(e))}}class ha extends te{}class ga extends ha{}class fa extends ha{async _call(e){return new cd(await super._call(e))}}class Ma extends te{}class wa extends Ma{}class Ta extends Ma{async _call(e){return new cd(await super._call(e))}}class ba extends te{}class xa extends ba{}class Pa extends ba{async _call(e){return new cd(await super._call(e))}}class ka extends te{}class Fa extends ka{}class ya extends te{}class va extends ya{}class Ca extends ya{async _call(e){return new Sa(await super._call(e))}}class Sa extends se{constructor({logits:e,pred_boxes:t}){super(),this.logits=e,this.pred_boxes=t}}class Aa extends te{}class Ea extends Aa{async get_image_embeddings({pixel_values:e}){return await R(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&&e.input_points){const t=e.input_points.dims.slice(0,-1),s=t.reduce(((e,t)=>e*t),1);e.input_labels=new _.Tensor("int64",new BigInt64Array(s).fill(1n),t)}const t={image_embeddings:e.image_embeddings,image_positional_embeddings:e.image_positional_embeddings};return e.input_points&&(t.input_points=e.input_points),e.input_labels&&(t.input_labels=e.input_labels),e.input_boxes&&(t.input_boxes=e.input_boxes),await N(this.sessions.prompt_encoder_mask_decoder,t)}async _call(e){return new La(await super._call(e))}}class La extends se{constructor({iou_scores:e,pred_masks:t}){super(),this.iou_scores=e,this.pred_masks=t}}class Ia extends te{}class za extends Ia{}class Va extends Ia{}class ja extends te{}class Na extends ja{}class Da extends ja{}class Oa extends te{}class Ba extends Oa{}class Ga extends Oa{async _call(e){return new md(await super._call(e))}}class Ra extends Oa{async _call(e){return new cd(await super._call(e))}}class qa extends Oa{async _call(e){return new ud(await super._call(e))}}class Wa extends te{}class $a extends Wa{}class Ua extends Wa{async _call(e){return new ud(await super._call(e))}}class Xa extends te{}class Qa extends Xa{}class Ha extends te{}class Ja extends Ha{}class Ya extends Ha{async _call(e){return new md(await super._call(e))}}class Ka extends Ha{async _call(e){return new cd(await super._call(e))}}class Za extends te{}class ei extends Za{}class ti extends Za{async _call(e){return new md(await super._call(e))}}class si extends Za{async _call(e){return new cd(await super._call(e))}}class oi extends Za{async _call(e){return new ud(await super._call(e))}}class ri extends te{}class ni extends ri{}class ai extends ri{async _call(e){return new md(await super._call(e))}}class ii extends ri{async _call(e){return new cd(await super._call(e))}}class li extends te{}class ci extends Oa{}class di extends Oa{async _call(e){return new md(await super._call(e))}}class ui extends Oa{async _call(e){return new cd(await super._call(e))}}class _i extends te{}class pi extends _i{}class mi extends _i{async _call(e){return new md(await super._call(e))}}class hi extends _i{async _call(e){return new cd(await super._call(e))}}class gi extends _i{async _call(e){return new dd(await super._call(e))}}class fi extends _i{async _call(e){return new ud(await super._call(e))}}class Mi extends te{}class wi extends Mi{}class Ti extends te{}class bi extends Ti{}class xi extends Ti{}class Pi extends Ti{async generate_speech(e,t,{threshold:s=.5,minlenratio:o=0,maxlenratio:r=20,vocoder:n=null}={}){const a={input_ids:e},{encoder_outputs:i,encoder_attention_mask:l}=await R(this,a),c=i.dims[1]/this.config.reduction_factor,d=Math.floor(c*r),u=Math.floor(c*o),p=this.config.num_mel_bins;let m=[],h=null,g=null,f=0;for(;;){++f;const e=B(!!g);let o;o=g?g.output_sequence_out:new _.Tensor("float32",new Float32Array(p),[1,1,p]);let r={use_cache_branch:e,output_sequence:o,encoder_attention_mask:l,speaker_embeddings:t,encoder_hidden_states:i};this.addPastKeyValues(r,h),g=await N(this.sessions.decoder_model_merged,r),h=this.getPastKeyValues(g,h);const{prob:n,spectrum:a}=g;if(m.push(a),f>=u&&(Array.from(n.data).filter((e=>e>=s)).length>0||f>=d))break}const M=(0,_.cat)(m),{waveform:w}=await N(n.sessions.model,{spectrogram:M});return{spectrogram:M,waveform:w}}}class ki extends te{main_input_name="spectrogram"}class Fi extends te{}class yi extends Fi{}class vi extends te{}class Ci extends vi{}class Si extends vi{}class Ai extends te{}class Ei extends Ai{}class Li extends Ai{}class Ii extends te{}class zi extends Ii{}class Vi extends Ii{}class ji extends te{}class Ni extends ji{}class Di extends ji{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"text_model"})}}class Oi extends ji{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"audio_model"})}}class Bi extends te{}class Gi extends Bi{async _call(e){return new fd(await super._call(e))}}class Ri extends te{}class qi extends Ri{}class Wi extends Ri{}class $i extends Ri{}class Ui extends te{}class Xi extends Ui{}class Qi extends Ui{}class Hi extends te{}class Ji extends Hi{}class Yi extends Hi{async _call(e){return new cd(await super._call(e))}}class Ki extends te{}class Zi extends Ki{}class el extends Ki{}class tl extends te{forward_params=["input_ids","attention_mask","encoder_outputs","decoder_input_ids","decoder_attention_mask","past_key_values"];_apply_and_filter_by_delay_pattern_mask(e){const[t,s]=e.dims,o=this.config.decoder.num_codebooks,r=s-o;let n=0;for(let t=0;t<e.size;++t){if(e.data[t]===this.config.decoder.pad_token_id)continue;const a=t%s-Math.floor(t/s)%o;a>0&&a<=r&&(e.data[n++]=e.data[t])}const a=Math.floor(t/o),i=n/(a*o);return new _.Tensor(e.type,e.data.slice(0,n),[a,o,i])}prepare_inputs_for_generation(e,t,s){let o=structuredClone(e);for(let e=0;e<o.length;++e)for(let t=0;t<o[e].length;++t)e%this.config.decoder.num_codebooks>=t&&(o[e][t]=BigInt(this.config.decoder.pad_token_id));null!==s.guidance_scale&&s.guidance_scale>1&&(o=o.concat(o));return super.prepare_inputs_for_generation(o,t,s)}async generate(e){const t=await super.generate(e),s=this._apply_and_filter_by_delay_pattern_mask(t).unsqueeze_(0),{audio_values:o}=await N(this.sessions.encodec_decode,{audio_codes:s});return o}}class sl extends te{}class ol extends sl{}class rl extends sl{async _call(e){return new cd(await super._call(e))}}class nl extends sl{}class al extends te{}class il extends al{}class ll extends al{async _call(e){return new cd(await super._call(e))}}class cl extends al{}class dl extends te{}class ul extends dl{}class _l extends dl{async _call(e){return new cd(await super._call(e))}}class pl extends dl{}class ml extends te{}class hl extends ml{}class gl extends ml{async _call(e){return new cd(await super._call(e))}}class fl extends ml{}class Ml extends te{}class wl extends Ml{}class Tl extends te{}class bl extends Tl{forward_params=["input_ids","pixel_values","images_seq_mask","images_emb_mask","attention_mask","position_ids","past_key_values"];constructor(...e){super(...e),this._generation_mode="text"}async forward(e){const t=this._generation_mode??"text";let s;if("text"!==t&&e.past_key_values){const t=this.sessions.gen_img_embeds,o=(0,i.pick)({image_ids:e.input_ids},t.inputNames);s=await N(t,o)}else{const t=this.sessions.prepare_inputs_embeds,o=(0,i.pick)(e,t.inputNames);s=await N(t,o)}const o={...e,...s},r=await W(this,o),n=this.sessions["text"===t?"lm_head":"gen_head"];if(!n)throw new Error(`Unable to find "${n}" generation head`);const a=await N(n,(0,i.pick)(r,n.inputNames));return{...s,...r,...a}}async generate(e){return this._generation_mode="text",super.generate(e)}async generate_images(e){this._generation_mode="image";const t=(e.inputs??e[this.main_input_name]).dims[1],s=(await super.generate(e)).slice(null,[t,null]),o=this.sessions.image_decode,{decoded_image:r}=await N(o,{generated_tokens:s}),n=r.add_(1).mul_(127.5).clamp_(0,255).to("uint8"),a=[];for(const e of n){const t=p.RawImage.fromTensor(e);a.push(t)}return a}}class xl extends se{constructor({char_logits:e,bpe_logits:t,wp_logits:s}){super(),this.char_logits=e,this.bpe_logits=t,this.wp_logits=s}get logits(){return[this.char_logits,this.bpe_logits,this.wp_logits]}}class Pl extends te{}class kl extends Pl{async _call(e){return new xl(await super._call(e))}}class Fl extends te{}class yl extends Fl{}class vl extends Fl{}class Cl extends te{}class Sl extends Cl{}class Al extends Cl{}class El extends te{forward_params=["input_ids","attention_mask","position_ids","audio_values","past_key_values"]}class Ll extends El{_merge_input_ids_with_audio_features(e){const t=e.audio_features.dims.at(-1),s=e.audio_features.view(-1,t);return function({audio_token_id:e,inputs_embeds:t,audio_features:s,input_ids:o,attention_mask:r}){return $({modality_token_id:e,inputs_embeds:t,modality_features:s,input_ids:o,attention_mask:r})}({audio_token_id:this.config.ignore_index,...e,audio_features:s})}}class Il extends te{main_input_name="input_values";forward_params=["input_values"]}class zl extends se{constructor({audio_codes:e}){super(),this.audio_codes=e}}class Vl extends se{constructor({audio_values:e}){super(),this.audio_values=e}}class jl extends Il{async encode(e){return new zl(await N(this.sessions.encoder_model,e))}async decode(e){return new Vl(await N(this.sessions.decoder_model,e))}}class Nl extends Il{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"encoder_model"})}}class Dl extends Il{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"decoder_model"})}}class Ol extends te{main_input_name="input_values";forward_params=["input_values"]}class Bl extends se{constructor({audio_codes:e}){super(),this.audio_codes=e}}class Gl extends se{constructor({audio_values:e}){super(),this.audio_values=e}}class Rl extends Ol{async encode(e){return new Bl(await N(this.sessions.encoder_model,e))}async decode(e){return new Gl(await N(this.sessions.decoder_model,e))}}class ql extends Ol{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"encoder_model"})}}class Wl extends Ol{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"decoder_model"})}}class $l{static MODEL_CLASS_MAPPINGS=null;static BASE_IF_FAIL=!1;static async from_pretrained(e,{progress_callback:t=null,config:s=null,cache_dir:r=null,local_files_only:n=!1,revision:a="main",model_file_name:i=null,subfolder:l="onnx",device:c=null,dtype:d=null,use_external_data_format:u=null,session_options:_={}}={}){const p={progress_callback:t,config:s,cache_dir:r,local_files_only:n,revision:a,model_file_name:i,subfolder:l,device:c,dtype:d,use_external_data_format:u,session_options:_};if(p.config=await o.AutoConfig.from_pretrained(e,p),!this.MODEL_CLASS_MAPPINGS)throw new Error("`MODEL_CLASS_MAPPINGS` not implemented for this type of `AutoClass`: "+this.name);const m=p.config.model_type;for(const t of this.MODEL_CLASS_MAPPINGS){let s=t.get(m);if(!s){for(const e of t.values())if(e[0]===m){s=e;break}if(!s)continue}return await s[1].from_pretrained(e,p)}if(this.BASE_IF_FAIL)return Ac.has(m)||console.warn(`Unknown model class "${m}", attempting to construct from base class.`),await te.from_pretrained(e,p);throw Error(`Unsupported model type: ${m}`)}}const Ul=new Map([["bert",["BertModel",ne]],["modernbert",["ModernBertModel",ue]],["nomic_bert",["NomicBertModel",ge]],["roformer",["RoFormerModel",Me]],["electra",["ElectraModel",Ae]],["esm",["EsmModel",at]],["convbert",["ConvBertModel",ke]],["camembert",["CamembertModel",je]],["deberta",["DebertaModel",Re]],["deberta-v2",["DebertaV2Model",Qe]],["mpnet",["MPNetModel",gt]],["albert",["AlbertModel",vt]],["distilbert",["DistilBertModel",et]],["roberta",["RobertaModel",ss]],["xlm",["XLMModel",ls]],["xlm-roberta",["XLMRobertaModel",ms]],["clap",["ClapModel",Ni]],["clip",["CLIPModel",Ws]],["clipseg",["CLIPSegModel",ao]],["chinese_clip",["ChineseCLIPModel",eo]],["siglip",["SiglipModel",Js]],["jina_clip",["JinaCLIPModel",so]],["mobilebert",["MobileBertModel",ut]],["squeezebert",["SqueezeBertModel",xt]],["wav2vec2",["Wav2Vec2Model",Ba]],["wav2vec2-bert",["Wav2Vec2BertModel",ni]],["unispeech",["UniSpeechModel",Ja]],["unispeech-sat",["UniSpeechSatModel",ei]],["hubert",["HubertModel",ci]],["wavlm",["WavLMModel",pi]],["audio-spectrogram-transformer",["ASTModel",Ts]],["vits",["VitsModel",Gi]],["pyannote",["PyAnnoteModel",$a]],["wespeaker-resnet",["WeSpeakerResNetModel",Qa]],["detr",["DetrModel",Mn]],["rt_detr",["RTDetrModel",kn]],["table-transformer",["TableTransformerModel",Cn]],["vit",["ViTModel",Ir]],["ijepa",["IJepaModel",jr]],["pvt",["PvtModel",Gr]],["vit_msn",["ViTMSNModel",Ur]],["vit_mae",["ViTMAEModel",Wr]],["groupvit",["GroupViTModel",Hr]],["fastvit",["FastViTModel",Yr]],["mobilevit",["MobileViTModel",sn]],["mobilevitv2",["MobileViTV2Model",nn]],["owlvit",["OwlViTModel",cn]],["owlv2",["Owlv2Model",_n]],["beit",["BeitModel",hn]],["deit",["DeiTModel",Ln]],["hiera",["HieraModel",Vn]],["convnext",["ConvNextModel",pa]],["convnextv2",["ConvNextV2Model",ga]],["dinov2",["Dinov2Model",wa]],["dinov2_with_registers",["Dinov2WithRegistersModel",xa]],["resnet",["ResNetModel",Dn]],["swin",["SwinModel",Gn]],["swin2sr",["Swin2SRModel",$n]],["donut-swin",["DonutSwinModel",ua]],["yolos",["YolosModel",va]],["dpt",["DPTModel",Qn]],["glpn",["GLPNModel",la]],["hifigan",["SpeechT5HifiGan",ki]],["efficientnet",["EfficientNetModel",Ji]],["decision_transformer",["DecisionTransformerModel",wl]],["patchtst",["PatchTSTForPrediction",yl]],["patchtsmixer",["PatchTSMixerForPrediction",Sl]],["mobilenet_v1",["MobileNetV1Model",ol]],["mobilenet_v2",["MobileNetV2Model",il]],["mobilenet_v3",["MobileNetV3Model",ul]],["mobilenet_v4",["MobileNetV4Model",hl]],["maskformer",["MaskFormerModel",na]],["mgp-str",["MgpstrForSceneTextRecognition",kl]],["style_text_to_speech_2",["StyleTextToSpeech2Model",wi]]]),Xl=new Map([["t5",["T5Model",Lt]],["longt5",["LongT5Model",Vt]],["mt5",["MT5Model",Dt]],["bart",["BartModel",Gt]],["mbart",["MBartModel",$t]],["marian",["MarianModel",za]],["whisper",["WhisperModel",Ps]],["m2m_100",["M2M100Model",Na]],["blenderbot",["BlenderbotModel",Jt]],["blenderbot-small",["BlenderbotSmallModel",Zt]]]),Ql=new Map([["mimi",["MimiModel",jl]],["dac",["DacModel",Rl]]]),Hl=new Map([["bloom",["BloomModel",kr]],["jais",["JAISModel",po]],["gpt2",["GPT2Model",co]],["gptj",["GPTJModel",xo]],["gpt_bigcode",["GPTBigCodeModel",Fo]],["gpt_neo",["GPTNeoModel",go]],["gpt_neox",["GPTNeoXModel",wo]],["codegen",["CodeGenModel",Co]],["llama",["LlamaModel",Eo]],["exaone",["ExaoneModel",Bo]],["olmo",["OlmoModel",Uo]],["olmo2",["Olmo2Model",Ho]],["mobilellm",["MobileLLMModel",qo]],["granite",["GraniteModel",Ko]],["cohere",["CohereModel",tr]],["gemma",["GemmaModel",rr]],["gemma2",["Gemma2Model",ir]],["helium",["HeliumModel",zo]],["glm",["GlmModel",No]],["openelm",["OpenELMModel",dr]],["qwen2",["Qwen2Model",pr]],["phi",["PhiModel",Mr]],["phi3",["Phi3Model",br]],["mpt",["MptModel",vr]],["opt",["OPTModel",Ar]],["mistral",["MistralModel",Ci]],["starcoder2",["Starcoder2Model",Ei]],["falcon",["FalconModel",zi]],["stablelm",["StableLmModel",Xi]]]),Jl=new Map([["speecht5",["SpeechT5ForSpeechToText",xi]],["whisper",["WhisperForConditionalGeneration",ks]],["lite-whisper",["LiteWhisperForConditionalGeneration",Fs]],["moonshine",["MoonshineForConditionalGeneration",Cs]]]),Yl=new Map([["speecht5",["SpeechT5ForTextToSpeech",Pi]]]),Kl=new Map([["vits",["VitsModel",Gi]],["musicgen",["MusicgenForConditionalGeneration",tl]]]),Zl=new Map([["bert",["BertForSequenceClassification",ie]],["modernbert",["ModernBertForSequenceClassification",pe]],["roformer",["RoFormerForSequenceClassification",Te]],["electra",["ElectraForSequenceClassification",Le]],["esm",["EsmForSequenceClassification",lt]],["convbert",["ConvBertForSequenceClassification",ye]],["camembert",["CamembertForSequenceClassification",De]],["deberta",["DebertaForSequenceClassification",We]],["deberta-v2",["DebertaV2ForSequenceClassification",Je]],["mpnet",["MPNetForSequenceClassification",Mt]],["albert",["AlbertForSequenceClassification",Ct]],["distilbert",["DistilBertForSequenceClassification",tt]],["roberta",["RobertaForSequenceClassification",rs]],["xlm",["XLMForSequenceClassification",ds]],["xlm-roberta",["XLMRobertaForSequenceClassification",gs]],["bart",["BartForSequenceClassification",qt]],["mbart",["MBartForSequenceClassification",Xt]],["mobilebert",["MobileBertForSequenceClassification",pt]],["squeezebert",["SqueezeBertForSequenceClassification",kt]]]),ec=new Map([["bert",["BertForTokenClassification",le]],["modernbert",["ModernBertForTokenClassification",me]],["roformer",["RoFormerForTokenClassification",be]],["electra",["ElectraForTokenClassification",Ie]],["esm",["EsmForTokenClassification",ct]],["convbert",["ConvBertForTokenClassification",ve]],["camembert",["CamembertForTokenClassification",Oe]],["deberta",["DebertaForTokenClassification",$e]],["deberta-v2",["DebertaV2ForTokenClassification",Ye]],["mpnet",["MPNetForTokenClassification",wt]],["distilbert",["DistilBertForTokenClassification",st]],["roberta",["RobertaForTokenClassification",ns]],["xlm",["XLMForTokenClassification",us]],["xlm-roberta",["XLMRobertaForTokenClassification",fs]]]),tc=new Map([["t5",["T5ForConditionalGeneration",It]],["longt5",["LongT5ForConditionalGeneration",jt]],["mt5",["MT5ForConditionalGeneration",Ot]],["bart",["BartForConditionalGeneration",Rt]],["mbart",["MBartForConditionalGeneration",Ut]],["marian",["MarianMTModel",Va]],["m2m_100",["M2M100ForConditionalGeneration",Da]],["blenderbot",["BlenderbotForConditionalGeneration",Yt]],["blenderbot-small",["BlenderbotSmallForConditionalGeneration",es]]]),sc=new Map([["bloom",["BloomForCausalLM",Fr]],["gpt2",["GPT2LMHeadModel",uo]],["jais",["JAISLMHeadModel",mo]],["gptj",["GPTJForCausalLM",Po]],["gpt_bigcode",["GPTBigCodeForCausalLM",yo]],["gpt_neo",["GPTNeoForCausalLM",fo]],["gpt_neox",["GPTNeoXForCausalLM",To]],["codegen",["CodeGenForCausalLM",So]],["llama",["LlamaForCausalLM",Lo]],["exaone",["ExaoneForCausalLM",Go]],["olmo",["OlmoForCausalLM",Xo]],["olmo2",["Olmo2ForCausalLM",Jo]],["mobilellm",["MobileLLMForCausalLM",Wo]],["granite",["GraniteForCausalLM",Zo]],["cohere",["CohereForCausalLM",sr]],["gemma",["GemmaForCausalLM",nr]],["gemma2",["Gemma2ForCausalLM",lr]],["helium",["HeliumForCausalLM",Vo]],["glm",["GlmForCausalLM",Do]],["openelm",["OpenELMForCausalLM",ur]],["qwen2",["Qwen2ForCausalLM",mr]],["phi",["PhiForCausalLM",wr]],["phi3",["Phi3ForCausalLM",xr]],["mpt",["MptForCausalLM",Cr]],["opt",["OPTForCausalLM",Er]],["mbart",["MBartForCausalLM",Qt]],["mistral",["MistralForCausalLM",Si]],["starcoder2",["Starcoder2ForCausalLM",Li]],["falcon",["FalconForCausalLM",Vi]],["trocr",["TrOCRForCausalLM",yi]],["stablelm",["StableLmForCausalLM",Qi]],["phi3_v",["Phi3VForCausalLM",Rs]]]),oc=new Map([["multi_modality",["MultiModalityCausalLM",bl]]]),rc=new Map([["bert",["BertForMaskedLM",ae]],["modernbert",["ModernBertForMaskedLM",_e]],["roformer",["RoFormerForMaskedLM",we]],["electra",["ElectraForMaskedLM",Ee]],["esm",["EsmForMaskedLM",it]],["convbert",["ConvBertForMaskedLM",Fe]],["camembert",["CamembertForMaskedLM",Ne]],["deberta",["DebertaForMaskedLM",qe]],["deberta-v2",["DebertaV2ForMaskedLM",He]],["mpnet",["MPNetForMaskedLM",ft]],["albert",["AlbertForMaskedLM",At]],["distilbert",["DistilBertForMaskedLM",rt]],["roberta",["RobertaForMaskedLM",os]],["xlm",["XLMWithLMHeadModel",cs]],["xlm-roberta",["XLMRobertaForMaskedLM",hs]],["mobilebert",["MobileBertForMaskedLM",_t]],["squeezebert",["SqueezeBertForMaskedLM",Pt]]]),nc=new Map([["bert",["BertForQuestionAnswering",ce]],["roformer",["RoFormerForQuestionAnswering",xe]],["electra",["ElectraForQuestionAnswering",ze]],["convbert",["ConvBertForQuestionAnswering",Ce]],["camembert",["CamembertForQuestionAnswering",Be]],["deberta",["DebertaForQuestionAnswering",Ue]],["deberta-v2",["DebertaV2ForQuestionAnswering",Ke]],["mpnet",["MPNetForQuestionAnswering",Tt]],["albert",["AlbertForQuestionAnswering",St]],["distilbert",["DistilBertForQuestionAnswering",ot]],["roberta",["RobertaForQuestionAnswering",as]],["xlm",["XLMForQuestionAnswering",_s]],["xlm-roberta",["XLMRobertaForQuestionAnswering",Ms]],["mobilebert",["MobileBertForQuestionAnswering",mt]],["squeezebert",["SqueezeBertForQuestionAnswering",Ft]]]),ac=new Map([["vision-encoder-decoder",["VisionEncoderDecoderModel",Ss]],["idefics3",["Idefics3ForConditionalGeneration",Os]],["smolvlm",["SmolVLMForConditionalGeneration",Bs]]]),ic=new Map([["llava",["LlavaForConditionalGeneration",Es]],["llava_onevision",["LlavaOnevisionForConditionalGeneration",Ls]],["moondream1",["Moondream1ForConditionalGeneration",Is]],["florence2",["Florence2ForConditionalGeneration",Vs]],["qwen2-vl",["Qwen2VLForConditionalGeneration",gr]],["idefics3",["Idefics3ForConditionalGeneration",Os]],["smolvlm",["SmolVLMForConditionalGeneration",Bs]],["paligemma",["PaliGemmaForConditionalGeneration",Ns]]]),lc=new Map([["ultravox",["UltravoxModel",Ll]]]),cc=new Map([["vision-encoder-decoder",["VisionEncoderDecoderModel",Ss]]]),dc=new Map([["vit",["ViTForImageClassification",zr]],["ijepa",["IJepaForImageClassification",Nr]],["pvt",["PvtForImageClassification",Rr]],["vit_msn",["ViTMSNForImageClassification",Xr]],["fastvit",["FastViTForImageClassification",Kr]],["mobilevit",["MobileViTForImageClassification",on]],["mobilevitv2",["MobileViTV2ForImageClassification",an]],["beit",["BeitForImageClassification",gn]],["deit",["DeiTForImageClassification",In]],["hiera",["HieraForImageClassification",jn]],["convnext",["ConvNextForImageClassification",ma]],["convnextv2",["ConvNextV2ForImageClassification",fa]],["dinov2",["Dinov2ForImageClassification",Ta]],["dinov2_with_registers",["Dinov2WithRegistersForImageClassification",Pa]],["resnet",["ResNetForImageClassification",On]],["swin",["SwinForImageClassification",Rn]],["segformer",["SegformerForImageClassification",Wi]],["efficientnet",["EfficientNetForImageClassification",Yi]],["mobilenet_v1",["MobileNetV1ForImageClassification",rl]],["mobilenet_v2",["MobileNetV2ForImageClassification",ll]],["mobilenet_v3",["MobileNetV3ForImageClassification",_l]],["mobilenet_v4",["MobileNetV4ForImageClassification",gl]]]),uc=new Map([["detr",["DetrForObjectDetection",wn]],["rt_detr",["RTDetrForObjectDetection",Fn]],["table-transformer",["TableTransformerForObjectDetection",Sn]],["yolos",["YolosForObjectDetection",Ca]]]),_c=new Map([["owlvit",["OwlViTForObjectDetection",dn]],["owlv2",["Owlv2ForObjectDetection",pn]],["grounding-dino",["GroundingDinoForObjectDetection",Fa]]]),pc=new Map([["detr",["DetrForSegmentation",Tn]],["clipseg",["CLIPSegForImageSegmentation",io]]]),mc=new Map([["segformer",["SegformerForSemanticSegmentation",$i]],["sapiens",["SapiensForSemanticSegmentation",Zn]],["swin",["SwinForSemanticSegmentation",qn]],["mobilenet_v1",["MobileNetV1ForSemanticSegmentation",nl]],["mobilenet_v2",["MobileNetV2ForSemanticSegmentation",cl]],["mobilenet_v3",["MobileNetV3ForSemanticSegmentation",pl]],["mobilenet_v4",["MobileNetV4ForSemanticSegmentation",fl]]]),hc=new Map([["detr",["DetrForSegmentation",Tn]],["maskformer",["MaskFormerForInstanceSegmentation",aa]]]),gc=new Map([["sam",["SamModel",Ea]]]),fc=new Map([["wav2vec2",["Wav2Vec2ForCTC",Ga]],["wav2vec2-bert",["Wav2Vec2BertForCTC",ai]],["unispeech",["UniSpeechForCTC",Ya]],["unispeech-sat",["UniSpeechSatForCTC",ti]],["wavlm",["WavLMForCTC",mi]],["hubert",["HubertForCTC",di]]]),Mc=new Map([["wav2vec2",["Wav2Vec2ForSequenceClassification",Ra]],["wav2vec2-bert",["Wav2Vec2BertForSequenceClassification",ii]],["unispeech",["UniSpeechForSequenceClassification",Ka]],["unispeech-sat",["UniSpeechSatForSequenceClassification",si]],["wavlm",["WavLMForSequenceClassification",hi]],["hubert",["HubertForSequenceClassification",ui]],["audio-spectrogram-transformer",["ASTForAudioClassification",bs]]]),wc=new Map([["wavlm",["WavLMForXVector",gi]]]),Tc=new Map([["unispeech-sat",["UniSpeechSatForAudioFrameClassification",oi]],["wavlm",["WavLMForAudioFrameClassification",fi]],["wav2vec2",["Wav2Vec2ForAudioFrameClassification",qa]],["pyannote",["PyAnnoteForAudioFrameClassification",Ua]]]),bc=new Map([["vitmatte",["VitMatteForImageMatting",en]]]),xc=new Map([["patchtst",["PatchTSTForPrediction",vl]],["patchtsmixer",["PatchTSMixerForPrediction",Al]]]),Pc=new Map([["swin2sr",["Swin2SRForImageSuperResolution",Un]]]),kc=new Map([["dpt",["DPTForDepthEstimation",Hn]],["depth_anything",["DepthAnythingForDepthEstimation",Yn]],["glpn",["GLPNForDepthEstimation",ca]],["sapiens",["SapiensForDepthEstimation",ea]],["depth_pro",["DepthProForDepthEstimation",oa]]]),Fc=new Map([["sapiens",["SapiensForNormalEstimation",ta]]]),yc=new Map([["vitpose",["VitPoseForPoseEstimation",Or]]]),vc=new Map([["clip",["CLIPVisionModelWithProjection",Qs]],["siglip",["SiglipVisionModel",Ks]],["jina_clip",["JinaCLIPVisionModel",ro]]]),Cc=[[Ul,T],[Xl,b],[Hl,k],[Ql,E],[Zl,T],[ec,T],[tc,x],[Jl,x],[sc,k],[oc,C],[rc,T],[nc,T],[ac,P],[ic,y],[lc,A],[dc,T],[pc,T],[hc,T],[mc,T],[bc,T],[xc,T],[Pc,T],[kc,T],[Fc,T],[yc,T],[uc,T],[_c,T],[gc,F],[fc,T],[Mc,T],[Yl,x],[Kl,T],[wc,T],[Tc,T],[vc,T]];for(const[e,t]of Cc)for(const[s,o]of e.values())L.set(s,t),z.set(o,s),I.set(s,o);const Sc=[["MusicgenForConditionalGeneration",tl,v],["Phi3VForCausalLM",Rs,S],["CLIPTextModelWithProjection",Us,T],["SiglipTextModel",Ys,T],["JinaCLIPTextModel",oo,T],["ClapTextModelWithProjection",Di,T],["ClapAudioModelWithProjection",Oi,T],["DacEncoderModel",ql,T],["DacDecoderModel",Wl,T],["MimiEncoderModel",Nl,T],["MimiDecoderModel",Dl,T]];for(const[e,t,s]of Sc)L.set(e,s),z.set(t,e),I.set(e,t);const Ac=new Map([["modnet",pc],["birefnet",pc],["isnet",pc],["ben",pc]]);for(const[e,t]of Ac.entries())t.set(e,["PreTrainedModel",te]),L.set(e,T),z.set(te,e),I.set(e,te);class Ec extends $l{static MODEL_CLASS_MAPPINGS=Cc.map((e=>e[0]));static BASE_IF_FAIL=!0}class Lc extends $l{static MODEL_CLASS_MAPPINGS=[Zl]}class Ic extends $l{static MODEL_CLASS_MAPPINGS=[ec]}class zc extends $l{static MODEL_CLASS_MAPPINGS=[tc]}class Vc extends $l{static MODEL_CLASS_MAPPINGS=[Jl]}class jc extends $l{static MODEL_CLASS_MAPPINGS=[Yl]}class Nc extends $l{static MODEL_CLASS_MAPPINGS=[Kl]}class Dc extends $l{static MODEL_CLASS_MAPPINGS=[sc]}class Oc extends $l{static MODEL_CLASS_MAPPINGS=[rc]}class Bc extends $l{static MODEL_CLASS_MAPPINGS=[nc]}class Gc extends $l{static MODEL_CLASS_MAPPINGS=[ac]}class Rc extends $l{static MODEL_CLASS_MAPPINGS=[dc]}class qc extends $l{static MODEL_CLASS_MAPPINGS=[pc]}class Wc extends $l{static MODEL_CLASS_MAPPINGS=[mc]}class $c extends $l{static MODEL_CLASS_MAPPINGS=[hc]}class Uc extends $l{static MODEL_CLASS_MAPPINGS=[uc]}class Xc extends $l{static MODEL_CLASS_MAPPINGS=[_c]}class Qc extends $l{static MODEL_CLASS_MAPPINGS=[gc]}class Hc extends $l{static MODEL_CLASS_MAPPINGS=[fc]}class Jc extends $l{static MODEL_CLASS_MAPPINGS=[Mc]}class Yc extends $l{static MODEL_CLASS_MAPPINGS=[wc]}class Kc extends $l{static MODEL_CLASS_MAPPINGS=[Tc]}class Zc extends $l{static MODEL_CLASS_MAPPINGS=[cc]}class ed extends $l{static MODEL_CLASS_MAPPINGS=[bc]}class td extends $l{static MODEL_CLASS_MAPPINGS=[Pc]}class sd extends $l{static MODEL_CLASS_MAPPINGS=[kc]}class od extends $l{static MODEL_CLASS_MAPPINGS=[Fc]}class rd extends $l{static MODEL_CLASS_MAPPINGS=[yc]}class nd extends $l{static MODEL_CLASS_MAPPINGS=[vc]}class ad extends $l{static MODEL_CLASS_MAPPINGS=[ic]}class id extends $l{static MODEL_CLASS_MAPPINGS=[lc]}class ld extends se{constructor({logits:e,past_key_values:t,encoder_outputs:s,decoder_attentions:o=null,cross_attentions:r=null}){super(),this.logits=e,this.past_key_values=t,this.encoder_outputs=s,this.decoder_attentions=o,this.cross_attentions=r}}class cd extends se{constructor({logits:e,...t}){super(),this.logits=e;const s=Object.values(t);s.length>0&&(this.attentions=s)}}class dd extends se{constructor({logits:e,embeddings:t}){super(),this.logits=e,this.embeddings=t}}class ud extends se{constructor({logits:e}){super(),this.logits=e}}class _d extends se{constructor({logits:e}){super(),this.logits=e}}class pd extends se{constructor({start_logits:e,end_logits:t}){super(),this.start_logits=e,this.end_logits=t}}class md extends se{constructor({logits:e}){super(),this.logits=e}}class hd extends se{constructor({logits:e,past_key_values:t}){super(),this.logits=e,this.past_key_values=t}}class gd extends se{constructor({alphas:e}){super(),this.alphas=e}}class fd extends se{constructor({waveform:e,spectrogram:t}){super(),this.waveform=e,this.spectrogram=t}}},"./src/models/audio_spectrogram_transformer/feature_extraction_audio_spectrogram_transformer.js":(e,t,s)=>{s.r(t),s.d(t,{ASTFeatureExtractor:()=>n});var o=s("./src/base/feature_extraction_utils.js"),r=(s("./src/utils/tensor.js"),s("./src/utils/audio.js"));class n extends o.FeatureExtractor{constructor(e){super(e);const t=this.config.sampling_rate,s=(0,r.mel_filter_bank)(256,this.config.num_mel_bins,20,Math.floor(t/2),t,null,"kaldi",!0);for(let e=0;e<s.length;++e)s[e].push(0);this.mel_filters=s,this.window=(0,r.window_function)(400,"hann",{periodic:!1}),this.mean=this.config.mean,this.std=this.config.std}async _extract_fbank_features(e,t){return(0,r.spectrogram)(e,this.window,400,160,{fft_length:512,power:2,center:!1,preemphasis:.97,mel_filters:this.mel_filters,log_mel:"log",mel_floor:1.192092955078125e-7,remove_dc_offset:!0,max_num_frames:t,transpose:!0})}async _call(e){(0,o.validate_audio_inputs)(e,"ASTFeatureExtractor");const t=await this._extract_fbank_features(e,this.config.max_length);if(this.config.do_normalize){const e=2*this.std,s=t.data;for(let t=0;t<s.length;++t)s[t]=(s[t]-this.mean)/e}return{input_values:t.unsqueeze_(0)}}}},"./src/models/auto/feature_extraction_auto.js":(e,t,s)=>{s.r(t),s.d(t,{AutoFeatureExtractor:()=>a});var o=s("./src/utils/constants.js"),r=s("./src/utils/hub.js"),n=(s("./src/base/feature_extraction_utils.js"),s("./src/models/feature_extractors.js"));class a{static async from_pretrained(e,t={}){const s=await(0,r.getModelJSON)(e,o.FEATURE_EXTRACTOR_NAME,!0,t),a=s.feature_extractor_type,i=n[a];if(!i)throw new Error(`Unknown feature_extractor_type: '${a}'. Please report this at ${o.GITHUB_ISSUE_URL}.`);return new i(s)}}},"./src/models/auto/image_processing_auto.js":(e,t,s)=>{s.r(t),s.d(t,{AutoImageProcessor:()=>i});var o=s("./src/utils/constants.js"),r=s("./src/utils/hub.js"),n=s("./src/base/image_processors_utils.js"),a=s("./src/models/image_processors.js");class i{static async from_pretrained(e,t={}){const s=await(0,r.getModelJSON)(e,o.IMAGE_PROCESSOR_NAME,!0,t),i=s.image_processor_type??s.feature_extractor_type;let l=a[i];return l||(void 0!==i&&console.warn(`Image processor type '${i}' not found, assuming base ImageProcessor. Please report this at ${o.GITHUB_ISSUE_URL}.`),l=n.ImageProcessor),new l(s)}}},"./src/models/auto/processing_auto.js":(e,t,s)=>{s.r(t),s.d(t,{AutoProcessor:()=>c});var o=s("./src/utils/constants.js"),r=s("./src/utils/hub.js"),n=s("./src/base/processing_utils.js"),a=s("./src/models/processors.js"),i=s("./src/models/image_processors.js"),l=s("./src/models/feature_extractors.js");class c{static async from_pretrained(e,t={}){const s=await(0,r.getModelJSON)(e,o.IMAGE_PROCESSOR_NAME,!0,t),{image_processor_type:c,feature_extractor_type:d,processor_class:u}=s;if(u&&a[u])return a[u].from_pretrained(e,t);if(!c&&!d)throw new Error("No `image_processor_type` or `feature_extractor_type` found in the config.");const _={};if(c){const e=i[c];if(!e)throw new Error(`Unknown image_processor_type: '${c}'.`);_.image_processor=new e(s)}if(d){const e=i[d];if(e)_.image_processor=new e(s);else{const e=l[d];if(!e)throw new Error(`Unknown feature_extractor_type: '${d}'.`);_.feature_extractor=new e(s)}}return new n.Processor({},_)}}},"./src/models/beit/image_processing_beit.js":(e,t,s)=>{s.r(t),s.d(t,{BeitFeatureExtractor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{}},"./src/models/bit/image_processing_bit.js":(e,t,s)=>{s.r(t),s.d(t,{BitImageProcessor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{}},"./src/models/chinese_clip/image_processing_chinese_clip.js":(e,t,s)=>{s.r(t),s.d(t,{ChineseCLIPFeatureExtractor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{}},"./src/models/clap/feature_extraction_clap.js":(e,t,s)=>{s.r(t),s.d(t,{ClapFeatureExtractor:()=>n});var o=s("./src/base/feature_extraction_utils.js"),r=(s("./src/utils/tensor.js"),s("./src/utils/audio.js"));class n extends o.FeatureExtractor{constructor(e){super(e),this.mel_filters=(0,r.mel_filter_bank)(this.config.nb_frequency_bins,this.config.feature_size,this.config.frequency_min,this.config.frequency_max,this.config.sampling_rate,null,"htk"),this.mel_filters_slaney=(0,r.mel_filter_bank)(this.config.nb_frequency_bins,this.config.feature_size,this.config.frequency_min,this.config.frequency_max,this.config.sampling_rate,"slaney","slaney"),this.window=(0,r.window_function)(this.config.fft_window_size,"hann")}async _get_input_mel(e,t,s,o){let r,n=!1;const a=e.length-t;if(a>0){if("rand_trunc"!==s)throw new Error(`Truncation strategy "${s}" not implemented`);{n=!0;const s=Math.floor(Math.random()*(a+1));e=e.subarray(s,s+t),r=await this._extract_fbank_features(e,this.mel_filters_slaney,this.config.nb_max_samples)}}else{if(a<0){let s=new Float64Array(t);if(s.set(e),"repeat"===o)for(let o=e.length;o<t;o+=e.length)s.set(e.subarray(0,Math.min(e.length,t-o)),o);else if("repeatpad"===o)for(let t=e.length;t<-a;t+=e.length)s.set(e,t);e=s}if("fusion"===s)throw new Error(`Truncation strategy "${s}" not implemented`);r=await this._extract_fbank_features(e,this.mel_filters_slaney,this.config.nb_max_samples)}return r.unsqueeze_(0)}async _extract_fbank_features(e,t,s=null){return(0,r.spectrogram)(e,this.window,this.config.fft_window_size,this.config.hop_length,{power:2,mel_filters:t,log_mel:"dB",max_num_frames:s,do_pad:!1,transpose:!0})}async _call(e,{max_length:t=null}={}){(0,o.validate_audio_inputs)(e,"ClapFeatureExtractor");return{input_features:(await this._get_input_mel(e,t??this.config.nb_max_samples,this.config.truncation,this.config.padding)).unsqueeze_(0)}}}},"./src/models/clip/image_processing_clip.js":(e,t,s)=>{s.r(t),s.d(t,{CLIPFeatureExtractor:()=>n,CLIPImageProcessor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{}class n extends r{}},"./src/models/convnext/image_processing_convnext.js":(e,t,s)=>{s.r(t),s.d(t,{ConvNextFeatureExtractor:()=>n,ConvNextImageProcessor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{constructor(e){super(e),this.crop_pct=this.config.crop_pct??.875}async resize(e){const t=this.size?.shortest_edge;if(void 0===t)throw new Error("Size dictionary must contain 'shortest_edge' key.");if(t<384){const s=Math.floor(t/this.crop_pct),[o,r]=this.get_resize_output_image_size(e,{shortest_edge:s});e=await e.resize(o,r,{resample:this.resample}),e=await e.center_crop(t,t)}else e=await e.resize(t,t,{resample:this.resample});return e}}class n extends r{}},"./src/models/dac/feature_extraction_dac.js":(e,t,s)=>{s.r(t),s.d(t,{DacFeatureExtractor:()=>r});var o=s("./src/models/encodec/feature_extraction_encodec.js");class r extends o.EncodecFeatureExtractor{}},"./src/models/deit/image_processing_deit.js":(e,t,s)=>{s.r(t),s.d(t,{DeiTFeatureExtractor:()=>n,DeiTImageProcessor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{}class n extends r{}},"./src/models/detr/image_processing_detr.js":(e,t,s)=>{s.r(t),s.d(t,{DetrFeatureExtractor:()=>a,DetrImageProcessor:()=>n});var o=s("./src/base/image_processors_utils.js"),r=s("./src/utils/tensor.js");class n extends o.ImageProcessor{async _call(e){const t=await super._call(e),s=[t.pixel_values.dims[0],64,64],o=(0,r.full)(s,1n);return{...t,pixel_mask:o}}post_process_object_detection(...e){return(0,o.post_process_object_detection)(...e)}post_process_panoptic_segmentation(...e){return(0,o.post_process_panoptic_segmentation)(...e)}post_process_instance_segmentation(...e){return(0,o.post_process_instance_segmentation)(...e)}}class a extends n{}},"./src/models/donut/image_processing_donut.js":(e,t,s)=>{s.r(t),s.d(t,{DonutFeatureExtractor:()=>n,DonutImageProcessor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{pad_image(e,t,s,o={}){const[r,n,a]=t;let i=this.image_mean;Array.isArray(this.image_mean)||(i=new Array(a).fill(i));let l=this.image_std;Array.isArray(l)||(l=new Array(a).fill(i));const c=i.map(((e,t)=>-e/l[t]));return super.pad_image(e,t,s,{center:!0,constant_values:c,...o})}}class n extends r{}},"./src/models/dpt/image_processing_dpt.js":(e,t,s)=>{s.r(t),s.d(t,{DPTFeatureExtractor:()=>n,DPTImageProcessor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{}class n extends r{}},"./src/models/efficientnet/image_processing_efficientnet.js":(e,t,s)=>{s.r(t),s.d(t,{EfficientNetImageProcessor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{constructor(e){super(e),this.include_top=this.config.include_top??!0,this.include_top&&(this.image_std=this.image_std.map((e=>e*e)))}}},"./src/models/encodec/feature_extraction_encodec.js":(e,t,s)=>{s.r(t),s.d(t,{EncodecFeatureExtractor:()=>n});var o=s("./src/base/feature_extraction_utils.js"),r=s("./src/utils/tensor.js");class n extends o.FeatureExtractor{async _call(e){(0,o.validate_audio_inputs)(e,"EncodecFeatureExtractor"),e instanceof Float64Array&&(e=new Float32Array(e));const t=this.config.feature_size;if(e.length%t!=0)throw new Error(`The length of the audio data must be a multiple of the number of channels (${t}).`);const s=[1,t,e.length/t];return{input_values:new r.Tensor("float32",e,s)}}}},"./src/models/feature_extractors.js":(e,t,s)=>{s.r(t),s.d(t,{ASTFeatureExtractor:()=>o.ASTFeatureExtractor,ClapFeatureExtractor:()=>n.ClapFeatureExtractor,DacFeatureExtractor:()=>a.DacFeatureExtractor,EncodecFeatureExtractor:()=>r.EncodecFeatureExtractor,ImageFeatureExtractor:()=>m.ImageProcessor,MoonshineFeatureExtractor:()=>i.MoonshineFeatureExtractor,PyAnnoteFeatureExtractor:()=>l.PyAnnoteFeatureExtractor,SeamlessM4TFeatureExtractor:()=>c.SeamlessM4TFeatureExtractor,SpeechT5FeatureExtractor:()=>d.SpeechT5FeatureExtractor,Wav2Vec2FeatureExtractor:()=>u.Wav2Vec2FeatureExtractor,WeSpeakerFeatureExtractor:()=>_.WeSpeakerFeatureExtractor,WhisperFeatureExtractor:()=>p.WhisperFeatureExtractor});var o=s("./src/models/audio_spectrogram_transformer/feature_extraction_audio_spectrogram_transformer.js"),r=s("./src/models/encodec/feature_extraction_encodec.js"),n=s("./src/models/clap/feature_extraction_clap.js"),a=s("./src/models/dac/feature_extraction_dac.js"),i=s("./src/models/moonshine/feature_extraction_moonshine.js"),l=s("./src/models/pyannote/feature_extraction_pyannote.js"),c=s("./src/models/seamless_m4t/feature_extraction_seamless_m4t.js"),d=s("./src/models/speecht5/feature_extraction_speecht5.js"),u=s("./src/models/wav2vec2/feature_extraction_wav2vec2.js"),_=s("./src/models/wespeaker/feature_extraction_wespeaker.js"),p=s("./src/models/whisper/feature_extraction_whisper.js"),m=s("./src/base/image_processors_utils.js")},"./src/models/florence2/processing_florence2.js":(e,t,s)=>{s.r(t),s.d(t,{Florence2Processor:()=>a});var o=s("./src/base/processing_utils.js"),r=s("./src/models/auto/image_processing_auto.js"),n=s("./src/tokenizers.js");class a extends o.Processor{static tokenizer_class=n.AutoTokenizer;static image_processor_class=r.AutoImageProcessor;constructor(e,t){super(e,t);const{tasks_answer_post_processing_type:s,task_prompts_without_inputs:o,task_prompts_with_input:r}=this.image_processor.config;this.tasks_answer_post_processing_type=new Map(Object.entries(s??{})),this.task_prompts_without_inputs=new Map(Object.entries(o??{})),this.task_prompts_with_input=new Map(Object.entries(r??{})),this.regexes={quad_boxes:/(.+?)<loc_(\d+)><loc_(\d+)><loc_(\d+)><loc_(\d+)><loc_(\d+)><loc_(\d+)><loc_(\d+)><loc_(\d+)>/gm,bboxes:/([^<]+)?<loc_(\d+)><loc_(\d+)><loc_(\d+)><loc_(\d+)>/gm},this.size_per_bin=1e3}construct_prompts(e){"string"==typeof e&&(e=[e]);const t=[];for(const s of e)if(this.task_prompts_without_inputs.has(s))t.push(this.task_prompts_without_inputs.get(s));else{for(const[e,o]of this.task_prompts_with_input)if(s.includes(e)){t.push(o.replaceAll("{input}",s).replaceAll(e,""));break}t.length!==e.length&&t.push(s)}return t}post_process_generation(e,t,s){const o=this.tasks_answer_post_processing_type.get(t)??"pure_text";let r;switch(e=e.replaceAll("<s>","").replaceAll("</s>",""),o){case"pure_text":r=e;break;case"description_with_bboxes":case"bboxes":case"phrase_grounding":case"ocr":const n="ocr"===o?"quad_boxes":"bboxes",a=e.matchAll(this.regexes[n]),i=[],l=[];for(const[e,t,...o]of a)i.push(t?t.trim():i.at(-1)??""),l.push(o.map(((e,t)=>(Number(e)+.5)/this.size_per_bin*s[t%2])));r={labels:i,[n]:l};break;default:throw new Error(`Task "${t}" (of type "${o}") not yet implemented.`)}return{[t]:r}}async _call(e,t=null,s={}){if(!e&&!t)throw new Error("Either text or images must be provided");return{...await this.image_processor(e,s),...t?this.tokenizer(t,s):{}}}}},"./src/models/glpn/image_processing_glpn.js":(e,t,s)=>{s.r(t),s.d(t,{GLPNFeatureExtractor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{}},"./src/models/grounding_dino/image_processing_grounding_dino.js":(e,t,s)=>{s.r(t),s.d(t,{GroundingDinoImageProcessor:()=>n});var o=s("./src/base/image_processors_utils.js"),r=s("./src/utils/tensor.js");class n extends o.ImageProcessor{async _call(e){const t=await super._call(e),s=t.pixel_values.dims,o=(0,r.ones)([s[0],s[2],s[3]]);return{...t,pixel_mask:o}}}},"./src/models/grounding_dino/processing_grounding_dino.js":(e,t,s)=>{s.r(t),s.d(t,{GroundingDinoProcessor:()=>l});var o=s("./src/base/processing_utils.js"),r=s("./src/models/auto/image_processing_auto.js"),n=s("./src/tokenizers.js"),a=s("./src/base/image_processors_utils.js");function i(e,t){const s=e.dims.at(-1)-1,o=e.tolist();o.fill(!1,0,1),o.fill(!1,s);const r=t.tolist();return o.map(((e,t)=>e?t:null)).filter((e=>null!==e)).map((e=>r[e]))}class l extends o.Processor{static tokenizer_class=n.AutoTokenizer;static image_processor_class=r.AutoImageProcessor;async _call(e,t,s={}){const o=e?await this.image_processor(e,s):{};return{...t?this.tokenizer(t,s):{},...o}}post_process_grounded_object_detection(e,t,{box_threshold:s=.25,text_threshold:o=.25,target_sizes:r=null}={}){const{logits:n,pred_boxes:l}=e,c=n.dims[0];if(null!==r&&r.length!==c)throw Error("Make sure that you pass in as many target sizes as the batch dimension of the logits");const d=n.dims.at(1),u=n.sigmoid(),_=u.max(-1).tolist(),p=l.tolist().map((e=>e.map((e=>(0,a.center_to_corners_format)(e))))),m=[];for(let e=0;e<c;++e){const n=null!==r?r[e]:null;null!==n&&(p[e]=p[e].map((e=>e.map(((e,t)=>e*n[(t+1)%2])))));const a=_[e],l=[],c=[],h=[];for(let r=0;r<d;++r){const n=a[r];if(n<=s)continue;const d=p[e][r],_=u[e][r];l.push(n),h.push(d);const m=i(_.gt(o),t[e]);c.push(m)}m.push({scores:l,boxes:h,labels:this.batch_decode(c)})}return m}}},"./src/models/idefics3/image_processing_idefics3.js":(e,t,s)=>{s.r(t),s.d(t,{Idefics3ImageProcessor:()=>n});var o=s("./src/base/image_processors_utils.js"),r=s("./src/utils/tensor.js");class n extends o.ImageProcessor{constructor(e){super(e),this.do_image_splitting=e.do_image_splitting??!0,this.max_image_size=e.max_image_size}get_resize_for_vision_encoder(e,t){let[s,o]=e.dims.slice(-2);const r=o/s;return o>=s?(o=Math.ceil(o/t)*t,s=Math.floor(o/r),s=Math.ceil(s/t)*t):(s=Math.ceil(s/t)*t,o=Math.floor(s*r),o=Math.ceil(o/t)*t),{height:s,width:o}}async _call(e,{do_image_splitting:t=null,return_row_col_info:s=!1}={}){let o;if(Array.isArray(e)){if(0===e.length||!e[0])throw new Error("No images provided.");o=Array.isArray(e[0])?e:[e]}else o=[[e]];let n=[],a=[],i=[];const l=[],c=[];for(const e of o){let s=await Promise.all(e.map((e=>this.preprocess(e))));l.push(...s.map((e=>e.original_size))),c.push(...s.map((e=>e.reshaped_input_size))),s.forEach((e=>e.pixel_values.unsqueeze_(0)));const{longest_edge:o}=this.max_image_size;let d;if(t??this.do_image_splitting){let e=new Array(s.length),t=new Array(s.length);d=await Promise.all(s.map((async(s,n)=>{const a=this.get_resize_for_vision_encoder(s.pixel_values,o),i=await(0,r.interpolate_4d)(s.pixel_values,{size:[a.height,a.width]}),{frames:l,num_splits_h:c,num_splits_w:d}=await this.split_image(i,this.max_image_size);return e[n]=c,t[n]=d,(0,r.cat)(l,0)}))),a.push(e),i.push(t)}else{const e=[o,o];d=await Promise.all(s.map((t=>(0,r.interpolate_4d)(t.pixel_values,{size:e})))),a.push(new Array(s.length).fill(0)),i.push(new Array(s.length).fill(0))}n.push((0,r.cat)(d,0))}const d=n.length,[u,_,p,m]=n[0].dims;let h,g;if(1===d)h=n[0].unsqueeze_(0),g=(0,r.full)([d,u,p,m],!0);else{const e=Math.max(...n.map((e=>e.dims.at(0))));g=(0,r.full)([d,e,p,m],!0);const t=g.data,s=e*p*m;for(let o=0;o<d;++o){const a=n[o].dims[0];if(a<e){n[o]=(0,r.cat)([n[o],(0,r.full)([e-a,_,p,m],0)],0);const i=o*s+a*p*m,l=(o+1)*s;t.fill(!1,i,l)}}h=(0,r.stack)(n,0)}return{pixel_values:h,pixel_attention_mask:g,original_sizes:l,reshaped_input_sizes:c,...s?{rows:a,cols:i}:{}}}async split_image(e,{longest_edge:t}){const s=t,o=t,n=[],[a,i]=e.dims.slice(-2);let l=0,c=0;if(a>s||i>o){l=Math.ceil(a/s),c=Math.ceil(i/o);const t=Math.ceil(a/l),d=Math.ceil(i/c);for(let s=0;s<l;++s)for(let o=0;o<c;++o){let u,_,p,m;s===l-1?(_=a-t,m=a):(_=s*t,m=(s+1)*t),o===c-1?(u=i-d,p=i):(u=o*d,p=(o+1)*d);const h=[_,u],g=[m,p],f=await(0,r.slice)(e,h,g,[2,3]);n.push(f)}const u=s,_=o;a===u&&i===_||(e=await(0,r.interpolate_4d)(e,{size:[u,_]}))}return n.push(e),{frames:n,num_splits_h:l,num_splits_w:c}}}},"./src/models/idefics3/processing_idefics3.js":(e,t,s)=>{s.r(t),s.d(t,{Idefics3Processor:()=>l});var o=s("./src/base/processing_utils.js"),r=s("./src/models/auto/image_processing_auto.js"),n=s("./src/tokenizers.js"),a=(s("./src/utils/image.js"),s("./src/utils/core.js"));function i(e,t,s,o,r,n){return 0===e&&0===t?function(e,t,s,o){return`${t}${o}`+s.repeat(e)+`${t}`}(s,o,r,n):function(e,t,s,o,r,n){let a="";for(let n=0;n<t;++n){for(let t=0;t<s;++t)a+=o+`<row_${n+1}_col_${t+1}>`+r.repeat(e);a+="\n"}return a+=`\n${o}${n}`+r.repeat(e)+`${o}`,a}(s,e,t,o,r,n)}class l extends o.Processor{static image_processor_class=r.AutoImageProcessor;static tokenizer_class=n.AutoTokenizer;static uses_processor_config=!0;fake_image_token="<fake_token_around_image>";image_token="<image>";global_img_token="<global-img>";async _call(e,t=null,s={}){let o;s.return_row_col_info??=!0,t&&(o=await this.image_processor(t,s)),Array.isArray(e)||(e=[e]);const r=o.rows??[new Array(e.length).fill(0)],n=o.cols??[new Array(e.length).fill(0)],l=this.config.image_seq_len,c=[],d=[];for(let t=0;t<e.length;++t){const s=e[t],o=r[t],u=n[t];c.push((0,a.count)(s,this.image_token));const _=o.map(((e,t)=>i(e,u[t],l,this.fake_image_token,this.image_token,this.global_img_token))),p=s.split(this.image_token);if(0===p.length)throw new Error("The image token should be present in the text.");let m=p[0];for(let e=0;e<_.length;++e)m+=_[e]+p[e+1];d.push(m)}return{...this.tokenizer(d),...o}}}},"./src/models/image_processors.js":(e,t,s)=>{s.r(t),s.d(t,{BeitFeatureExtractor:()=>o.BeitFeatureExtractor,BitImageProcessor:()=>r.BitImageProcessor,CLIPFeatureExtractor:()=>a.CLIPFeatureExtractor,CLIPImageProcessor:()=>a.CLIPImageProcessor,ChineseCLIPFeatureExtractor:()=>n.ChineseCLIPFeatureExtractor,ConvNextFeatureExtractor:()=>i.ConvNextFeatureExtractor,ConvNextImageProcessor:()=>i.ConvNextImageProcessor,DPTFeatureExtractor:()=>u.DPTFeatureExtractor,DPTImageProcessor:()=>u.DPTImageProcessor,DeiTFeatureExtractor:()=>l.DeiTFeatureExtractor,DeiTImageProcessor:()=>l.DeiTImageProcessor,DetrFeatureExtractor:()=>c.DetrFeatureExtractor,DetrImageProcessor:()=>c.DetrImageProcessor,DonutFeatureExtractor:()=>d.DonutFeatureExtractor,DonutImageProcessor:()=>d.DonutImageProcessor,EfficientNetImageProcessor:()=>_.EfficientNetImageProcessor,GLPNFeatureExtractor:()=>p.GLPNFeatureExtractor,GroundingDinoImageProcessor:()=>m.GroundingDinoImageProcessor,Idefics3ImageProcessor:()=>h.Idefics3ImageProcessor,JinaCLIPImageProcessor:()=>f.JinaCLIPImageProcessor,LlavaOnevisionImageProcessor:()=>M.LlavaOnevisionImageProcessor,Mask2FormerImageProcessor:()=>w.Mask2FormerImageProcessor,MaskFormerFeatureExtractor:()=>T.MaskFormerFeatureExtractor,MaskFormerImageProcessor:()=>T.MaskFormerImageProcessor,MobileNetV1FeatureExtractor:()=>b.MobileNetV1FeatureExtractor,MobileNetV1ImageProcessor:()=>b.MobileNetV1ImageProcessor,MobileNetV2FeatureExtractor:()=>x.MobileNetV2FeatureExtractor,MobileNetV2ImageProcessor:()=>x.MobileNetV2ImageProcessor,MobileNetV3FeatureExtractor:()=>P.MobileNetV3FeatureExtractor,MobileNetV3ImageProcessor:()=>P.MobileNetV3ImageProcessor,MobileNetV4FeatureExtractor:()=>k.MobileNetV4FeatureExtractor,MobileNetV4ImageProcessor:()=>k.MobileNetV4ImageProcessor,MobileViTFeatureExtractor:()=>F.MobileViTFeatureExtractor,MobileViTImageProcessor:()=>F.MobileViTImageProcessor,NougatImageProcessor:()=>y.NougatImageProcessor,OwlViTFeatureExtractor:()=>C.OwlViTFeatureExtractor,OwlViTImageProcessor:()=>C.OwlViTImageProcessor,Owlv2ImageProcessor:()=>v.Owlv2ImageProcessor,Phi3VImageProcessor:()=>S.Phi3VImageProcessor,PvtImageProcessor:()=>A.PvtImageProcessor,Qwen2VLImageProcessor:()=>E.Qwen2VLImageProcessor,RTDetrImageProcessor:()=>L.RTDetrImageProcessor,SamImageProcessor:()=>I.SamImageProcessor,SegformerFeatureExtractor:()=>z.SegformerFeatureExtractor,SegformerImageProcessor:()=>z.SegformerImageProcessor,SiglipImageProcessor:()=>V.SiglipImageProcessor,SmolVLMImageProcessor:()=>j.SmolVLMImageProcessor,Swin2SRImageProcessor:()=>N.Swin2SRImageProcessor,VLMImageProcessor:()=>g.VLMImageProcessor,ViTFeatureExtractor:()=>D.ViTFeatureExtractor,ViTImageProcessor:()=>D.ViTImageProcessor,VitMatteImageProcessor:()=>O.VitMatteImageProcessor,VitPoseImageProcessor:()=>B.VitPoseImageProcessor,YolosFeatureExtractor:()=>G.YolosFeatureExtractor,YolosImageProcessor:()=>G.YolosImageProcessor});var o=s("./src/models/beit/image_processing_beit.js"),r=s("./src/models/bit/image_processing_bit.js"),n=s("./src/models/chinese_clip/image_processing_chinese_clip.js"),a=s("./src/models/clip/image_processing_clip.js"),i=s("./src/models/convnext/image_processing_convnext.js"),l=s("./src/models/deit/image_processing_deit.js"),c=s("./src/models/detr/image_processing_detr.js"),d=s("./src/models/donut/image_processing_donut.js"),u=s("./src/models/dpt/image_processing_dpt.js"),_=s("./src/models/efficientnet/image_processing_efficientnet.js"),p=s("./src/models/glpn/image_processing_glpn.js"),m=s("./src/models/grounding_dino/image_processing_grounding_dino.js"),h=s("./src/models/idefics3/image_processing_idefics3.js"),g=s("./src/models/janus/image_processing_janus.js"),f=s("./src/models/jina_clip/image_processing_jina_clip.js"),M=s("./src/models/llava_onevision/image_processing_llava_onevision.js"),w=s("./src/models/mask2former/image_processing_mask2former.js"),T=s("./src/models/maskformer/image_processing_maskformer.js"),b=s("./src/models/mobilenet_v1/image_processing_mobilenet_v1.js"),x=s("./src/models/mobilenet_v2/image_processing_mobilenet_v2.js"),P=s("./src/models/mobilenet_v3/image_processing_mobilenet_v3.js"),k=s("./src/models/mobilenet_v4/image_processing_mobilenet_v4.js"),F=s("./src/models/mobilevit/image_processing_mobilevit.js"),y=s("./src/models/nougat/image_processing_nougat.js"),v=s("./src/models/owlv2/image_processing_owlv2.js"),C=s("./src/models/owlvit/image_processing_owlvit.js"),S=s("./src/models/phi3_v/image_processing_phi3_v.js"),A=s("./src/models/pvt/image_processing_pvt.js"),E=s("./src/models/qwen2_vl/image_processing_qwen2_vl.js"),L=s("./src/models/rt_detr/image_processing_rt_detr.js"),I=s("./src/models/sam/image_processing_sam.js"),z=s("./src/models/segformer/image_processing_segformer.js"),V=s("./src/models/siglip/image_processing_siglip.js"),j=s("./src/models/smolvlm/image_processing_smolvlm.js"),N=s("./src/models/swin2sr/image_processing_swin2sr.js"),D=s("./src/models/vit/image_processing_vit.js"),O=s("./src/models/vitmatte/image_processing_vitmatte.js"),B=s("./src/models/vitpose/image_processing_vitpose.js"),G=s("./src/models/yolos/image_processing_yolos.js")},"./src/models/janus/image_processing_janus.js":(e,t,s)=>{s.r(t),s.d(t,{VLMImageProcessor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{constructor(e){super({do_pad:!0,pad_size:{width:e.image_size,height:e.image_size},...e}),this.constant_values=this.config.background_color.map((e=>e*this.rescale_factor))}pad_image(e,t,s,o){return super.pad_image(e,t,s,{constant_values:this.constant_values,center:!0,...o})}}},"./src/models/janus/processing_janus.js":(e,t,s)=>{s.r(t),s.d(t,{VLChatProcessor:()=>c});var o=s("./src/base/processing_utils.js"),r=s("./src/models/auto/image_processing_auto.js"),n=s("./src/tokenizers.js"),a=s("./src/utils/core.js"),i=s("./src/utils/tensor.js"),l=s("./src/utils/image.js");class c extends o.Processor{static image_processor_class=r.AutoImageProcessor;static tokenizer_class=n.AutoTokenizer;static uses_processor_config=!0;constructor(e,t){super(e,t),this.image_tag=this.config.image_tag,this.image_start_tag=this.config.image_start_tag,this.image_end_tag=this.config.image_end_tag,this.num_image_tokens=this.config.num_image_tokens}async _call(e,{images:t=null,chat_template:s="default"}={}){t?Array.isArray(t)||(t=[t]):t=await Promise.all(e.filter((e=>e.images)).flatMap((e=>e.images)).map((e=>l.RawImage.read(e))));const o=this.tokenizer,r=e=>o.encode(e,{add_special_tokens:!1}),n=o.apply_chat_template(e,{tokenize:!1,add_generation_prompt:!0,chat_template:s}).split(this.image_tag),c=n.length-1;if(t.length!==c)throw new Error(`Number of images provided (${t.length}) does not match number of "${this.image_tag}" image tags (${c})`);const[d,u,_]=o.model.convert_tokens_to_ids([this.image_tag,this.image_start_tag,this.image_end_tag]);let p=r(n[0]),m=new Array(p.length).fill(!1);for(let e=1;e<n.length;++e){const t=new Array(this.num_image_tokens).fill(d),s=r(n[e]);p=(0,a.mergeArrays)(p,[u],t,[_],s);const o=new Array(this.num_image_tokens).fill(!0);m=(0,a.mergeArrays)(m,[!1],o,[!1],new Array(s.length).fill(!1))}const h=[1,p.length],g={input_ids:new i.Tensor("int64",p,h),attention_mask:new i.Tensor("int64",new Array(p.length).fill(1),h),images_seq_mask:new i.Tensor("bool",m,h),images_emb_mask:new i.Tensor("bool",new Array(c*this.num_image_tokens).fill(!0),[1,c,this.num_image_tokens])};if(t&&t.length>0){const e=await this.image_processor(t);return e.pixel_values.unsqueeze_(0),{...g,...e}}return g}}},"./src/models/jina_clip/image_processing_jina_clip.js":(e,t,s)=>{s.r(t),s.d(t,{JinaCLIPImageProcessor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{constructor(e){const{resize_mode:t,fill_color:s,interpolation:o,size:r,...n}=e;super({...n,size:"squash"===t?{width:r,height:r}:"shortest"===t?{shortest_edge:r}:{longest_edge:r},resample:"bicubic"===o?3:2,do_center_crop:!0,crop_size:r,do_normalize:!0})}}},"./src/models/jina_clip/processing_jina_clip.js":(e,t,s)=>{s.r(t),s.d(t,{JinaCLIPProcessor:()=>a});var o=s("./src/base/processing_utils.js"),r=s("./src/models/auto/image_processing_auto.js"),n=s("./src/tokenizers.js");class a extends o.Processor{static tokenizer_class=n.AutoTokenizer;static image_processor_class=r.AutoImageProcessor;async _call(e=null,t=null,s={}){if(!e&&!t)throw new Error("Either text or images must be provided");return{...e?this.tokenizer(e,s):{},...t?await this.image_processor(t,s):{}}}}},"./src/models/llava_onevision/image_processing_llava_onevision.js":(e,t,s)=>{s.r(t),s.d(t,{LlavaOnevisionImageProcessor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{}},"./src/models/mask2former/image_processing_mask2former.js":(e,t,s)=>{s.r(t),s.d(t,{Mask2FormerImageProcessor:()=>r});var o=s("./src/models/maskformer/image_processing_maskformer.js");class r extends o.MaskFormerImageProcessor{}},"./src/models/maskformer/image_processing_maskformer.js":(e,t,s)=>{s.r(t),s.d(t,{MaskFormerFeatureExtractor:()=>n,MaskFormerImageProcessor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{post_process_panoptic_segmentation(...e){return(0,o.post_process_panoptic_segmentation)(...e)}post_process_instance_segmentation(...e){return(0,o.post_process_instance_segmentation)(...e)}}class n extends r{}},"./src/models/mgp_str/processing_mgp_str.js":(e,t,s)=>{s.r(t),s.d(t,{MgpstrProcessor:()=>l});var o=s("./src/base/processing_utils.js"),r=s("./src/models/auto/image_processing_auto.js"),n=s("./src/tokenizers.js"),a=s("./src/utils/maths.js");const i={char:["char_decode",1],bpe:["bpe_decode",2],wp:["wp_decode",102]};class l extends o.Processor{static tokenizer_class=n.AutoTokenizer;static image_processor_class=r.AutoImageProcessor;get char_tokenizer(){return this.components.char_tokenizer}get bpe_tokenizer(){return this.components.bpe_tokenizer}get wp_tokenizer(){return this.components.wp_tokenizer}_decode_helper(e,t){if(!i.hasOwnProperty(t))throw new Error(`Format ${t} is not supported.`);const[s,o]=i[t],r=this[s].bind(this),[n,l]=e.dims,c=[],d=[],u=e.tolist();for(let e=0;e<n;++e){const t=u[e],s=[],r=[];for(let e=1;e<l;++e){const[n,i]=(0,a.max)((0,a.softmax)(t[e]));if(r.push(n),i==o)break;s.push(i)}const n=r.length>0?r.reduce(((e,t)=>e*t),1):0;d.push(s),c.push(n)}return[r(d),c]}char_decode(e){return this.char_tokenizer.batch_decode(e).map((e=>e.replaceAll(" ","")))}bpe_decode(e){return this.bpe_tokenizer.batch_decode(e)}wp_decode(e){return this.wp_tokenizer.batch_decode(e).map((e=>e.replaceAll(" ","")))}batch_decode([e,t,s]){const[o,r]=this._decode_helper(e,"char"),[n,i]=this._decode_helper(t,"bpe"),[l,c]=this._decode_helper(s,"wp"),d=[],u=[];for(let e=0;e<o.length;++e){const[t,s]=(0,a.max)([r[e],i[e],c[e]]);d.push([o[e],n[e],l[e]][s]),u.push(t)}return{generated_text:d,scores:u,char_preds:o,bpe_preds:n,wp_preds:l}}static async from_pretrained(...e){const t=await super.from_pretrained(...e),s=await n.AutoTokenizer.from_pretrained("Xenova/gpt2"),o=await n.AutoTokenizer.from_pretrained("Xenova/bert-base-uncased");return t.components={image_processor:t.image_processor,char_tokenizer:t.tokenizer,bpe_tokenizer:s,wp_tokenizer:o},t}async _call(e,t=null){const s=await this.image_processor(e);return t&&(s.labels=this.tokenizer(t).input_ids),s}}},"./src/models/mobilenet_v1/image_processing_mobilenet_v1.js":(e,t,s)=>{s.r(t),s.d(t,{MobileNetV1FeatureExtractor:()=>n,MobileNetV1ImageProcessor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{}class n extends r{}},"./src/models/mobilenet_v2/image_processing_mobilenet_v2.js":(e,t,s)=>{s.r(t),s.d(t,{MobileNetV2FeatureExtractor:()=>n,MobileNetV2ImageProcessor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{}class n extends r{}},"./src/models/mobilenet_v3/image_processing_mobilenet_v3.js":(e,t,s)=>{s.r(t),s.d(t,{MobileNetV3FeatureExtractor:()=>n,MobileNetV3ImageProcessor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{}class n extends r{}},"./src/models/mobilenet_v4/image_processing_mobilenet_v4.js":(e,t,s)=>{s.r(t),s.d(t,{MobileNetV4FeatureExtractor:()=>n,MobileNetV4ImageProcessor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{}class n extends r{}},"./src/models/mobilevit/image_processing_mobilevit.js":(e,t,s)=>{s.r(t),s.d(t,{MobileViTFeatureExtractor:()=>n,MobileViTImageProcessor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{}class n extends r{}},"./src/models/moonshine/feature_extraction_moonshine.js":(e,t,s)=>{s.r(t),s.d(t,{MoonshineFeatureExtractor:()=>n});var o=s("./src/base/feature_extraction_utils.js"),r=s("./src/utils/tensor.js");class n extends o.FeatureExtractor{async _call(e){(0,o.validate_audio_inputs)(e,"MoonshineFeatureExtractor"),e instanceof Float64Array&&(e=new Float32Array(e));const t=[1,e.length];return{input_values:new r.Tensor("float32",e,t)}}}},"./src/models/moonshine/processing_moonshine.js":(e,t,s)=>{s.r(t),s.d(t,{MoonshineProcessor:()=>a});var o=s("./src/models/auto/feature_extraction_auto.js"),r=s("./src/tokenizers.js"),n=s("./src/base/processing_utils.js");class a extends n.Processor{static tokenizer_class=r.AutoTokenizer;static feature_extractor_class=o.AutoFeatureExtractor;async _call(e){return await this.feature_extractor(e)}}},"./src/models/nougat/image_processing_nougat.js":(e,t,s)=>{s.r(t),s.d(t,{NougatImageProcessor:()=>r});var o=s("./src/models/donut/image_processing_donut.js");class r extends o.DonutImageProcessor{}},"./src/models/owlv2/image_processing_owlv2.js":(e,t,s)=>{s.r(t),s.d(t,{Owlv2ImageProcessor:()=>r});var o=s("./src/models/owlvit/image_processing_owlvit.js");class r extends o.OwlViTImageProcessor{}},"./src/models/owlvit/image_processing_owlvit.js":(e,t,s)=>{s.r(t),s.d(t,{OwlViTFeatureExtractor:()=>n,OwlViTImageProcessor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{post_process_object_detection(...e){return(0,o.post_process_object_detection)(...e)}}class n extends r{}},"./src/models/owlvit/processing_owlvit.js":(e,t,s)=>{s.r(t),s.d(t,{OwlViTProcessor:()=>a});var o=s("./src/base/processing_utils.js"),r=s("./src/models/auto/image_processing_auto.js"),n=s("./src/tokenizers.js");class a extends o.Processor{static tokenizer_class=n.AutoTokenizer;static image_processor_class=r.AutoImageProcessor}},"./src/models/paligemma/processing_paligemma.js":(e,t,s)=>{s.r(t),s.d(t,{PaliGemmaProcessor:()=>i});var o=s("./src/base/processing_utils.js"),r=s("./src/models/auto/image_processing_auto.js"),n=s("./src/tokenizers.js");const a="<image>";class i extends o.Processor{static tokenizer_class=n.AutoTokenizer;static image_processor_class=r.AutoImageProcessor;static uses_processor_config=!1;async _call(e,t=null,s={}){t||(console.warn("You are using PaliGemma without a text prefix. It will perform as a picture-captioning model."),t=""),Array.isArray(e)||(e=[e]),Array.isArray(t)||(t=[t]);const o=this.tokenizer.bos_token,r=this.image_processor.config.image_seq_length;let n;t.some((e=>e.includes(a)))?n=t.map((e=>{const t=e.replaceAll(a,a.repeat(r)),s=t.lastIndexOf(a),n=-1===s?0:s+7;return t.slice(0,n)+o+t.slice(n)+"\n"})):(console.warn("You are passing both `text` and `images` to `PaliGemmaProcessor`. The processor expects special image tokens in the text, as many tokens as there are images per each text. It is recommended to add `<image>` tokens in the very beginning of your text. For this call, we will infer how many images each text has and add special tokens."),n=t.map((t=>function(e,t,s,o,r){return`${o.repeat(s*r)}${t}${e}\n`}(t,o,r,a,e.length))));const i=this.tokenizer(n,s);return{...await this.image_processor(e,s),...i}}}},"./src/models/phi3_v/image_processing_phi3_v.js":(e,t,s)=>{s.r(t),s.d(t,{Phi3VImageProcessor:()=>d});var o=s("./src/base/image_processors_utils.js"),r=s("./src/utils/tensor.js");const n=336,a=[2,3],{ceil:i,floor:l,sqrt:c}=Math;class d extends o.ImageProcessor{constructor(e){super({...e,do_normalize:!0,do_pad:!0,pad_size:"custom",do_convert_rgb:!0,do_resize:!0}),this._num_crops=e.num_crops}calc_num_image_tokens_from_image_size(e,t){const{num_img_tokens:s}=this.config;return l((l(t/n)*l(e/n)+1)*s+1+(l(t/n)+1)*c(s))}get_resize_output_image_size(e,t){const s=this._num_crops,[o,r]=e.size;let n=o/r,a=1;for(;a*Math.ceil(a/n)<=s;)a+=1;a-=1;const i=Math.floor(336*a);return[i,Math.floor(i/n)]}pad_image(e,t,s,o={}){const[r,a]=t,l=n*i(r/n),c=n*i(a/n),d=[1,1,1].map(((e,t)=>(e-this.image_mean[t])/this.image_std[t]));return super.pad_image(e,t,{width:c,height:l},{center:!0,constant_values:d,...o})}async _call(e,{num_crops:t=null}={}){if(this._num_crops=t??=this.config.num_crops,t<4||c(t)%1!=0)throw new Error("num_crops must be a square number >= 4");Array.isArray(e)||(e=[e]);const s=e.length,o=await Promise.all(e.map((e=>this.preprocess(e)))),d=o.map((e=>e.original_size)),u=o.map((e=>e.reshaped_input_size)),_=[];for(const{pixel_values:e}of o){e.unsqueeze_(0);const[s,o]=e.dims.slice(-2),i=await(0,r.interpolate_4d)(e,{size:[n,n],mode:"bicubic"});if(t>0){const d=[],u=c(t),p=l(o/u),m=l(s/u);for(let t=0;t<u;++t)for(let n=0;n<u;++n){let i,l,c,_;t===u-1?(l=s-m,_=s):(l=t*m,_=(t+1)*m),n===u-1?(i=o-p,c=o):(i=n*p,c=(n+1)*p);const h=[l,i],g=[_,c],f=await(0,r.slice)(e,h,g,a);d.push(f)}const h=await(0,r.interpolate_4d)((0,r.cat)(d,0),{size:[n,n],mode:"bicubic"});_.push((0,r.cat)([i,h],0))}else _.push(i)}const p=(0,r.stack)(_,0),m=u.map((e=>e.map((e=>n*i(e/n)))));return{pixel_values:p,original_sizes:d,reshaped_input_sizes:u,image_sizes:new r.Tensor("int64",m.flat(),[s,2]),num_img_tokens:m.map((([e,t])=>this.calc_num_image_tokens_from_image_size(t,e)))}}}},"./src/models/phi3_v/processing_phi3_v.js":(e,t,s)=>{s.r(t),s.d(t,{Phi3VProcessor:()=>l});var o=s("./src/base/processing_utils.js"),r=s("./src/models/auto/image_processing_auto.js"),n=s("./src/tokenizers.js");s("./src/utils/image.js");const a="<|image|>",i=/<\|image_\d+\|>/g;class l extends o.Processor{static image_processor_class=r.AutoImageProcessor;static tokenizer_class=n.AutoTokenizer;async _call(e,t=null,{padding:s=!0,truncation:o=!0,num_crops:r=null}={}){let n,l;if(Array.isArray(e)||(e=[e]),t){l=await this.image_processor(t,{num_crops:r});const{num_img_tokens:c}=l,d=e.map(((e,t)=>e.split(i).join(a.repeat(c[t]))));n=this.tokenizer(d,{padding:s,truncation:o});const u=this.tokenizer.model.convert_tokens_to_ids([a])[0];n.input_ids.map_((e=>e==u?-e:e))}else n=this.tokenizer(e);return{...n,...l}}}},"./src/models/processors.js":(e,t,s)=>{s.r(t),s.d(t,{Florence2Processor:()=>o.Florence2Processor,GroundingDinoProcessor:()=>r.GroundingDinoProcessor,Idefics3Processor:()=>n.Idefics3Processor,JinaCLIPProcessor:()=>i.JinaCLIPProcessor,MgpstrProcessor:()=>l.MgpstrProcessor,MoonshineProcessor:()=>c.MoonshineProcessor,OwlViTProcessor:()=>d.OwlViTProcessor,PaliGemmaProcessor:()=>_.PaliGemmaProcessor,Phi3VProcessor:()=>u.Phi3VProcessor,PyAnnoteProcessor:()=>p.PyAnnoteProcessor,Qwen2VLProcessor:()=>m.Qwen2VLProcessor,SamProcessor:()=>h.SamProcessor,SmolVLMProcessor:()=>g.SmolVLMProcessor,SpeechT5Processor:()=>f.SpeechT5Processor,UltravoxProcessor:()=>M.UltravoxProcessor,VLChatProcessor:()=>a.VLChatProcessor,Wav2Vec2Processor:()=>w.Wav2Vec2Processor,Wav2Vec2ProcessorWithLM:()=>T.Wav2Vec2ProcessorWithLM,WhisperProcessor:()=>b.WhisperProcessor});var o=s("./src/models/florence2/processing_florence2.js"),r=s("./src/models/grounding_dino/processing_grounding_dino.js"),n=s("./src/models/idefics3/processing_idefics3.js"),a=s("./src/models/janus/processing_janus.js"),i=s("./src/models/jina_clip/processing_jina_clip.js"),l=s("./src/models/mgp_str/processing_mgp_str.js"),c=s("./src/models/moonshine/processing_moonshine.js"),d=s("./src/models/owlvit/processing_owlvit.js"),u=s("./src/models/phi3_v/processing_phi3_v.js"),_=s("./src/models/paligemma/processing_paligemma.js"),p=s("./src/models/pyannote/processing_pyannote.js"),m=s("./src/models/qwen2_vl/processing_qwen2_vl.js"),h=s("./src/models/sam/processing_sam.js"),g=s("./src/models/smolvlm/processing_smolvlm.js"),f=s("./src/models/speecht5/processing_speecht5.js"),M=s("./src/models/ultravox/processing_ultravox.js"),w=s("./src/models/wav2vec2/processing_wav2vec2.js"),T=s("./src/models/wav2vec2_with_lm/processing_wav2vec2_with_lm.js"),b=s("./src/models/whisper/processing_whisper.js")},"./src/models/pvt/image_processing_pvt.js":(e,t,s)=>{s.r(t),s.d(t,{PvtImageProcessor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{}},"./src/models/pyannote/feature_extraction_pyannote.js":(e,t,s)=>{s.r(t),s.d(t,{PyAnnoteFeatureExtractor:()=>a});var o=s("./src/base/feature_extraction_utils.js"),r=s("./src/utils/tensor.js"),n=s("./src/utils/maths.js");class a extends o.FeatureExtractor{async _call(e){(0,o.validate_audio_inputs)(e,"PyAnnoteFeatureExtractor"),e instanceof Float64Array&&(e=new Float32Array(e));const t=[1,1,e.length];return{input_values:new r.Tensor("float32",e,t)}}samples_to_frames(e){return(e-this.config.offset)/this.config.step}post_process_speaker_diarization(e,t){const s=t/this.samples_to_frames(t)/this.config.sampling_rate,o=[];for(const t of e.tolist()){const e=[];let r=-1;for(let s=0;s<t.length;++s){const o=(0,n.softmax)(t[s]),[a,i]=(0,n.max)(o),[l,c]=[s,s+1];i!==r?(r=i,e.push({id:i,start:l,end:c,score:a})):(e.at(-1).end=c,e.at(-1).score+=a)}o.push(e.map((({id:e,start:t,end:o,score:r})=>({id:e,start:t*s,end:o*s,confidence:r/(o-t)}))))}return o}}},"./src/models/pyannote/processing_pyannote.js":(e,t,s)=>{s.r(t),s.d(t,{PyAnnoteProcessor:()=>n});var o=s("./src/base/processing_utils.js"),r=s("./src/models/pyannote/feature_extraction_pyannote.js");class n extends o.Processor{static feature_extractor_class=r.PyAnnoteFeatureExtractor;async _call(e){return await this.feature_extractor(e)}post_process_speaker_diarization(...e){return this.feature_extractor.post_process_speaker_diarization(...e)}get sampling_rate(){return this.feature_extractor.config.sampling_rate}}},"./src/models/qwen2_vl/image_processing_qwen2_vl.js":(e,t,s)=>{s.r(t),s.d(t,{Qwen2VLImageProcessor:()=>n});var o=s("./src/base/image_processors_utils.js"),r=s("./src/utils/tensor.js");class n extends o.ImageProcessor{async _call(e,...t){const{pixel_values:s,original_sizes:o,reshaped_input_sizes:n}=await super._call(e,...t);let a=s;const{temporal_patch_size:i,merge_size:l,patch_size:c}=this.config;1===a.dims[0]&&(a=(0,r.cat)(Array.from({length:i},(()=>a)),0));const d=a.dims[0]/i,u=a.dims[1],_=Math.floor(a.dims[2]/c),p=Math.floor(a.dims[3]/c);return{pixel_values:a.view(d,i,u,Math.floor(_/l),l,c,Math.floor(p/l),l,c).permute(0,3,6,4,7,2,1,5,8).view(d*_*p,u*i*c*c),image_grid_thw:new r.Tensor("int64",[d,_,p],[1,3]),original_sizes:o,reshaped_input_sizes:n}}}},"./src/models/qwen2_vl/processing_qwen2_vl.js":(e,t,s)=>{s.r(t),s.d(t,{Qwen2VLProcessor:()=>a});var o=s("./src/base/processing_utils.js"),r=s("./src/models/auto/image_processing_auto.js"),n=s("./src/tokenizers.js");s("./src/utils/image.js");class a extends o.Processor{static image_processor_class=r.AutoImageProcessor;static tokenizer_class=n.AutoTokenizer;async _call(e,t=null,...s){let o,r;if(Array.isArray(e)||(e=[e]),t&&(o=await this.image_processor(t),r=o.image_grid_thw),r){let t=this.image_processor.config.merge_size**2,s=0;const o=r.tolist();e=e.map((e=>{for(;e.includes("<|image_pad|>");){const r=Number(o[s++].reduce(((e,t)=>e*t),1n));e=e.replace("<|image_pad|>","<|placeholder|>".repeat(Math.floor(r/t)))}return e.replaceAll("<|placeholder|>","<|image_pad|>")}))}return{...this.tokenizer(e),...o}}}},"./src/models/rt_detr/image_processing_rt_detr.js":(e,t,s)=>{s.r(t),s.d(t,{RTDetrImageProcessor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{post_process_object_detection(...e){return(0,o.post_process_object_detection)(...e)}}},"./src/models/sam/image_processing_sam.js":(e,t,s)=>{s.r(t),s.d(t,{SamImageProcessor:()=>a});var o=s("./src/base/image_processors_utils.js"),r=s("./src/utils/core.js"),n=s("./src/utils/tensor.js");class a extends o.ImageProcessor{reshape_input_points(e,t,s,o=!1){e=structuredClone(e);let a=(0,r.calculateDimensions)(e);if(3===a.length)o||(a=[1,...a]),e=[e];else if(4!==a.length)throw Error("The input_points must be a 4D tensor of shape `batch_size`, `point_batch_size`, `nb_points_per_image`, `2`.");for(let o=0;o<e.length;++o){let r=t[o],n=s[o],a=[n[0]/r[0],n[1]/r[1]];for(let t=0;t<e[o].length;++t)for(let s=0;s<e[o][t].length;++s)for(let r=0;r<e[o][t][s].length;++r)e[o][t][s][r]*=a[r%2]}return new n.Tensor("float32",Float32Array.from(e.flat(1/0)),a)}add_input_labels(e,t){let s=(0,r.calculateDimensions)(e);if(2===s.length)s=[1,...s],e=[e];else if(3!==s.length)throw Error("The input_points must be a 4D tensor of shape `batch_size`, `point_batch_size`, `nb_points_per_image`, `2`.");if(s.some(((e,s)=>e!==t.dims[s])))throw Error(`The first ${s.length} dimensions of 'input_points' and 'input_labels' must be the same.`);return new n.Tensor("int64",e.flat(1/0).map(BigInt),s)}async _call(e,{input_points:t=null,input_labels:s=null,input_boxes:o=null}={}){const r=await super._call(e);if(t&&(r.input_points=this.reshape_input_points(t,r.original_sizes,r.reshaped_input_sizes)),s){if(!r.input_points)throw Error("`input_points` must be provided if `input_labels` are provided.");r.input_labels=this.add_input_labels(s,r.input_points)}return o&&(r.input_boxes=this.reshape_input_points(o,r.original_sizes,r.reshaped_input_sizes,!0)),r}async post_process_masks(e,t,s,{mask_threshold:o=0,binarize:r=!0,pad_size:a=null}={}){const i=[],l=[(a=a??this.pad_size).height,a.width];for(let a=0;a<t.length;++a){const c=t[a],d=s[a];let u=await(0,n.interpolate_4d)(e[a],{mode:"bilinear",size:l});if(u=u.slice(null,null,[0,d[0]],[0,d[1]]),u=await(0,n.interpolate_4d)(u,{mode:"bilinear",size:c}),r){const e=u.data,t=new Uint8Array(e.length);for(let s=0;s<e.length;++s)e[s]>o&&(t[s]=1);u=new n.Tensor("bool",t,u.dims)}i.push(u)}return i}generate_crop_boxes(e,t,{crop_n_layers:s=0,overlap_ratio:o=512/1500,points_per_crop:r=32,crop_n_points_downscale_factor:n=1}={}){}}},"./src/models/sam/processing_sam.js":(e,t,s)=>{s.r(t),s.d(t,{SamProcessor:()=>n});var o=s("./src/base/processing_utils.js"),r=s("./src/models/auto/image_processing_auto.js");class n extends o.Processor{static image_processor_class=r.AutoImageProcessor;async _call(...e){return await this.image_processor(...e)}post_process_masks(...e){return this.image_processor.post_process_masks(...e)}reshape_input_points(...e){return this.image_processor.reshape_input_points(...e)}}},"./src/models/seamless_m4t/feature_extraction_seamless_m4t.js":(e,t,s)=>{s.r(t),s.d(t,{SeamlessM4TFeatureExtractor:()=>a});var o=s("./src/base/feature_extraction_utils.js"),r=s("./src/utils/tensor.js"),n=s("./src/utils/audio.js");class a extends o.FeatureExtractor{constructor(e){super(e);const t=this.config.sampling_rate,s=(0,n.mel_filter_bank)(256,this.config.num_mel_bins,20,Math.floor(t/2),t,null,"kaldi",!0);for(let e=0;e<s.length;++e)s[e].push(0);this.mel_filters=s,this.window=(0,n.window_function)(400,"povey",{periodic:!1})}async _extract_fbank_features(e,t){return e=e.map((e=>32768*e)),(0,n.spectrogram)(e,this.window,400,160,{fft_length:512,power:2,center:!1,preemphasis:.97,mel_filters:this.mel_filters,log_mel:"log",mel_floor:1.192092955078125e-7,remove_dc_offset:!0,max_num_frames:t,transpose:!0})}async _call(e,{padding:t=!0,pad_to_multiple_of:s=2,do_normalize_per_mel_bins:n=!0,return_attention_mask:a=!0}={}){(0,o.validate_audio_inputs)(e,"SeamlessM4TFeatureExtractor");let i,l=await this._extract_fbank_features(e,this.config.max_length);if(n){const[e,t]=l.dims,s=l.data;for(let o=0;o<t;++o){let r=0;for(let n=0;n<e;++n)r+=s[n*t+o];const n=r/e;let a=0;for(let r=0;r<e;++r)a+=(s[r*t+o]-n)**2;a/=e-1;const i=Math.sqrt(a+1e-7);for(let r=0;r<e;++r){const e=r*t+o;s[e]=(s[e]-n)/i}}}if(t){const[e,t]=l.dims,o=l.data,n=e%s;if(n>0){const s=new Float32Array(t*(e+n));s.set(o),s.fill(this.config.padding_value,o.length);const c=e+n;l=new r.Tensor(l.type,s,[c,t]),a&&(i=new r.Tensor("int64",new BigInt64Array(c),[1,c]),i.data.fill(1n,0,e))}}const[c,d]=l.dims,u=this.config.stride;if(0!==c%u)throw new Error(`The number of frames (${c}) must be a multiple of the stride (${u}).`);const _=l.view(1,Math.floor(c/u),d*u),p={input_features:_};if(a){const e=_.dims[1],t=new BigInt64Array(e);if(i){const e=i.data;for(let s=1,o=0;s<c;s+=u,++o)t[o]=e[s]}else t.fill(1n);p.attention_mask=new r.Tensor("int64",t,[1,e])}return p}}},"./src/models/segformer/image_processing_segformer.js":(e,t,s)=>{s.r(t),s.d(t,{SegformerFeatureExtractor:()=>n,SegformerImageProcessor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{post_process_semantic_segmentation(...e){return(0,o.post_process_semantic_segmentation)(...e)}}class n extends r{}},"./src/models/siglip/image_processing_siglip.js":(e,t,s)=>{s.r(t),s.d(t,{SiglipImageProcessor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{}},"./src/models/smolvlm/image_processing_smolvlm.js":(e,t,s)=>{s.r(t),s.d(t,{SmolVLMImageProcessor:()=>o.Idefics3ImageProcessor});var o=s("./src/models/idefics3/image_processing_idefics3.js")},"./src/models/smolvlm/processing_smolvlm.js":(e,t,s)=>{s.r(t),s.d(t,{SmolVLMProcessor:()=>o.Idefics3Processor});var o=s("./src/models/idefics3/processing_idefics3.js")},"./src/models/speecht5/feature_extraction_speecht5.js":(e,t,s)=>{s.r(t),s.d(t,{SpeechT5FeatureExtractor:()=>r});var o=s("./src/base/feature_extraction_utils.js");class r extends o.FeatureExtractor{}},"./src/models/speecht5/processing_speecht5.js":(e,t,s)=>{s.r(t),s.d(t,{SpeechT5Processor:()=>a});var o=s("./src/base/processing_utils.js"),r=s("./src/tokenizers.js"),n=s("./src/models/auto/feature_extraction_auto.js");class a extends o.Processor{static tokenizer_class=r.AutoTokenizer;static feature_extractor_class=n.AutoFeatureExtractor;async _call(e){return await this.feature_extractor(e)}}},"./src/models/swin2sr/image_processing_swin2sr.js":(e,t,s)=>{s.r(t),s.d(t,{Swin2SRImageProcessor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{pad_image(e,t,s,o={}){const[r,n,a]=t;return super.pad_image(e,t,{width:n+(s-n%s)%s,height:r+(s-r%s)%s},{mode:"symmetric",center:!1,constant_values:-1,...o})}}},"./src/models/ultravox/processing_ultravox.js":(e,t,s)=>{s.r(t),s.d(t,{UltravoxProcessor:()=>a});var o=s("./src/models/auto/feature_extraction_auto.js"),r=s("./src/tokenizers.js"),n=s("./src/base/processing_utils.js");class a extends n.Processor{static tokenizer_class=r.AutoTokenizer;static feature_extractor_class=o.AutoFeatureExtractor;static uses_processor_config=!0;async _call(e,t=null,s={}){if(Array.isArray(e))throw new Error("Batched inputs are not supported yet.");let o={};if(t){const r=t.length,{input_features:n}=await this.feature_extractor(t,{...s,max_length:r}),a=Math.round(r/this.config.encoder_ds_factor+1e-4),i=1+Math.ceil(a/this.config.stack_factor);o.audio_token_len=[i],o.audio_values=n;const l=this.config.audio_placeholder;if(!e.includes(l))throw new Error(`The input text does not contain the image token ${l}.`);e=e.replaceAll(l,l.repeat(i))}return{...this.tokenizer(e,{add_special_tokens:!1,...s}),...o}}}},"./src/models/vit/image_processing_vit.js":(e,t,s)=>{s.r(t),s.d(t,{ViTFeatureExtractor:()=>n,ViTImageProcessor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{}class n extends r{}},"./src/models/vitmatte/image_processing_vitmatte.js":(e,t,s)=>{s.r(t),s.d(t,{VitMatteImageProcessor:()=>n});var o=s("./src/base/image_processors_utils.js"),r=s("./src/utils/tensor.js");class n extends o.ImageProcessor{async _call(e,t){Array.isArray(e)||(e=[e]),Array.isArray(t)||(t=[t]);const s=await Promise.all(e.map((e=>this.preprocess(e)))),o=await Promise.all(t.map((e=>this.preprocess(e,{do_normalize:!1,do_convert_rgb:!1,do_convert_grayscale:!0}))));return{pixel_values:(0,r.stack)(s.map(((e,t)=>(0,r.cat)([e.pixel_values,o[t].pixel_values],0))),0),original_sizes:s.map((e=>e.original_size)),reshaped_input_sizes:s.map((e=>e.reshaped_input_size))}}}},"./src/models/vitpose/image_processing_vitpose.js":(e,t,s)=>{s.r(t),s.d(t,{VitPoseImageProcessor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{post_process_pose_estimation(e,t,{threshold:s=null}={}){const o=e.tolist(),[r,n,a,i]=e.dims,l=[];for(let e=0;e<r;++e){const r=o[e],n=t[e],c=[];for(let e=0;e<n.length;++e){const t=n[e],o=[],l=[],d=[],u=t.at(-2)/i,_=t.at(-1)/a;for(let e=0;e<r.length;++e){let[t,n]=[0,0],a=0,i=-1/0;const c=r[e];for(let e=0;e<c.length;++e){const s=c[e];for(let o=0;o<s.length;++o){const r=s[o];a+=r,i=Math.max(i,r),t+=(o+.5)*r,n+=e*r}}if(null!=s&&i<s)continue;const p=[u*t/a,_*n/a];o.push(p),d.push(e),l.push(i)}c.push({bbox:t,scores:l,labels:d,keypoints:o})}l.push(c)}return l}}},"./src/models/wav2vec2/feature_extraction_wav2vec2.js":(e,t,s)=>{s.r(t),s.d(t,{Wav2Vec2FeatureExtractor:()=>n});var o=s("./src/base/feature_extraction_utils.js"),r=s("./src/utils/tensor.js");class n extends o.FeatureExtractor{_zero_mean_unit_var_norm(e){const t=e.reduce(((e,t)=>e+t),0)/e.length,s=e.reduce(((e,s)=>e+(s-t)**2),0)/e.length;return e.map((e=>(e-t)/Math.sqrt(s+1e-7)))}async _call(e){(0,o.validate_audio_inputs)(e,"Wav2Vec2FeatureExtractor"),e instanceof Float64Array&&(e=new Float32Array(e));let t=e;this.config.do_normalize&&(t=this._zero_mean_unit_var_norm(t));const s=[1,t.length];return{input_values:new r.Tensor("float32",t,s),attention_mask:new r.Tensor("int64",new BigInt64Array(t.length).fill(1n),s)}}}},"./src/models/wav2vec2/processing_wav2vec2.js":(e,t,s)=>{s.r(t),s.d(t,{Wav2Vec2Processor:()=>a});var o=s("./src/tokenizers.js"),r=s("./src/models/auto/feature_extraction_auto.js"),n=s("./src/base/processing_utils.js");class a extends n.Processor{static tokenizer_class=o.AutoTokenizer;static feature_extractor_class=r.AutoFeatureExtractor;async _call(e){return await this.feature_extractor(e)}}},"./src/models/wav2vec2_with_lm/processing_wav2vec2_with_lm.js":(e,t,s)=>{s.r(t),s.d(t,{Wav2Vec2ProcessorWithLM:()=>a});var o=s("./src/tokenizers.js"),r=s("./src/models/auto/feature_extraction_auto.js"),n=s("./src/base/processing_utils.js");class a extends n.Processor{static tokenizer_class=o.AutoTokenizer;static feature_extractor_class=r.AutoFeatureExtractor;async _call(e){return await this.feature_extractor(e)}}},"./src/models/wespeaker/feature_extraction_wespeaker.js":(e,t,s)=>{s.r(t),s.d(t,{WeSpeakerFeatureExtractor:()=>n});var o=s("./src/base/feature_extraction_utils.js"),r=(s("./src/utils/tensor.js"),s("./src/utils/audio.js"));class n extends o.FeatureExtractor{constructor(e){super(e);const t=this.config.sampling_rate,s=(0,r.mel_filter_bank)(256,this.config.num_mel_bins,20,Math.floor(t/2),t,null,"kaldi",!0);for(let e=0;e<s.length;++e)s[e].push(0);this.mel_filters=s,this.window=(0,r.window_function)(400,"hamming",{periodic:!1}),this.min_num_frames=this.config.min_num_frames}async _extract_fbank_features(e){return e=e.map((e=>32768*e)),(0,r.spectrogram)(e,this.window,400,160,{fft_length:512,power:2,center:!1,preemphasis:.97,mel_filters:this.mel_filters,log_mel:"log",mel_floor:1.192092955078125e-7,remove_dc_offset:!0,transpose:!0,min_num_frames:this.min_num_frames})}async _call(e){(0,o.validate_audio_inputs)(e,"WeSpeakerFeatureExtractor");const t=(await this._extract_fbank_features(e)).unsqueeze_(0);if(null===this.config.fbank_centering_span){const e=t.mean(1).data,s=t.data,[o,r,n]=t.dims;for(let t=0;t<o;++t){const o=t*r*n,a=t*n;for(let t=0;t<r;++t){const r=o+t*n;for(let t=0;t<n;++t)s[r+t]-=e[a+t]}}}return{input_features:t}}}},"./src/models/whisper/common_whisper.js":(e,t,s)=>{s.r(t),s.d(t,{WHISPER_LANGUAGE_MAPPING:()=>r,WHISPER_TO_LANGUAGE_CODE_MAPPING:()=>n,whisper_language_to_code:()=>a});const o=[["en","english"],["zh","chinese"],["de","german"],["es","spanish"],["ru","russian"],["ko","korean"],["fr","french"],["ja","japanese"],["pt","portuguese"],["tr","turkish"],["pl","polish"],["ca","catalan"],["nl","dutch"],["ar","arabic"],["sv","swedish"],["it","italian"],["id","indonesian"],["hi","hindi"],["fi","finnish"],["vi","vietnamese"],["he","hebrew"],["uk","ukrainian"],["el","greek"],["ms","malay"],["cs","czech"],["ro","romanian"],["da","danish"],["hu","hungarian"],["ta","tamil"],["no","norwegian"],["th","thai"],["ur","urdu"],["hr","croatian"],["bg","bulgarian"],["lt","lithuanian"],["la","latin"],["mi","maori"],["ml","malayalam"],["cy","welsh"],["sk","slovak"],["te","telugu"],["fa","persian"],["lv","latvian"],["bn","bengali"],["sr","serbian"],["az","azerbaijani"],["sl","slovenian"],["kn","kannada"],["et","estonian"],["mk","macedonian"],["br","breton"],["eu","basque"],["is","icelandic"],["hy","armenian"],["ne","nepali"],["mn","mongolian"],["bs","bosnian"],["kk","kazakh"],["sq","albanian"],["sw","swahili"],["gl","galician"],["mr","marathi"],["pa","punjabi"],["si","sinhala"],["km","khmer"],["sn","shona"],["yo","yoruba"],["so","somali"],["af","afrikaans"],["oc","occitan"],["ka","georgian"],["be","belarusian"],["tg","tajik"],["sd","sindhi"],["gu","gujarati"],["am","amharic"],["yi","yiddish"],["lo","lao"],["uz","uzbek"],["fo","faroese"],["ht","haitian creole"],["ps","pashto"],["tk","turkmen"],["nn","nynorsk"],["mt","maltese"],["sa","sanskrit"],["lb","luxembourgish"],["my","myanmar"],["bo","tibetan"],["tl","tagalog"],["mg","malagasy"],["as","assamese"],["tt","tatar"],["haw","hawaiian"],["ln","lingala"],["ha","hausa"],["ba","bashkir"],["jw","javanese"],["su","sundanese"]],r=new Map(o),n=new Map([...o.map((([e,t])=>[t,e])),["burmese","my"],["valencian","ca"],["flemish","nl"],["haitian","ht"],["letzeburgesch","lb"],["pushto","ps"],["panjabi","pa"],["moldavian","ro"],["moldovan","ro"],["sinhalese","si"],["castilian","es"]]);function a(e){e=e.toLowerCase();let t=n.get(e);if(void 0===t){const s=e.match(/^<\|([a-z]{2})\|>$/);if(s&&(e=s[1]),!r.has(e)){const t=2===e.length?r.keys():r.values();throw new Error(`Language "${e}" is not supported. Must be one of: ${JSON.stringify(Array.from(t))}`)}t=e}return t}},"./src/models/whisper/feature_extraction_whisper.js":(e,t,s)=>{s.r(t),s.d(t,{WhisperFeatureExtractor:()=>a});var o=s("./src/base/feature_extraction_utils.js"),r=(s("./src/utils/tensor.js"),s("./src/utils/audio.js")),n=s("./src/utils/maths.js");class a extends o.FeatureExtractor{constructor(e){super(e),this.config.mel_filters??=(0,r.mel_filter_bank)(Math.floor(1+this.config.n_fft/2),this.config.feature_size,0,8e3,this.config.sampling_rate,"slaney","slaney"),this.window=(0,r.window_function)(this.config.n_fft,"hann")}async _extract_fbank_features(e){const t=await(0,r.spectrogram)(e,this.window,this.config.n_fft,this.config.hop_length,{power:2,mel_filters:this.config.mel_filters,log_mel:"log10",max_num_frames:Math.min(Math.floor(e.length/this.config.hop_length),this.config.nb_max_frames)}),s=t.data,o=(0,n.max)(s)[0];for(let e=0;e<s.length;++e)s[e]=(Math.max(s[e],o-8)+4)/4;return t}async _call(e,{max_length:t=null}={}){let s;(0,o.validate_audio_inputs)(e,"WhisperFeatureExtractor");const r=t??this.config.n_samples;e.length>r?(e.length>this.config.n_samples&&console.warn("Attempting to extract features for audio longer than 30 seconds. If using a pipeline to extract transcript from a long audio clip, remember to specify `chunk_length_s` and/or `stride_length_s`."),s=e.slice(0,r)):(s=new Float32Array(r),s.set(e));return{input_features:(await this._extract_fbank_features(s)).unsqueeze_(0)}}}},"./src/models/whisper/generation_whisper.js":(e,t,s)=>{s.r(t),s.d(t,{WhisperGenerationConfig:()=>r});var o=s("./src/generation/configuration_utils.js");class r extends o.GenerationConfig{return_timestamps=null;return_token_timestamps=null;num_frames=null;alignment_heads=null;task=null;language=null;no_timestamps_token_id=null;prompt_ids=null;is_multilingual=null;lang_to_id=null;task_to_id=null;max_initial_timestamp_index=1}},"./src/models/whisper/processing_whisper.js":(e,t,s)=>{s.r(t),s.d(t,{WhisperProcessor:()=>a});var o=s("./src/models/auto/feature_extraction_auto.js"),r=s("./src/tokenizers.js"),n=s("./src/base/processing_utils.js");class a extends n.Processor{static tokenizer_class=r.AutoTokenizer;static feature_extractor_class=o.AutoFeatureExtractor;async _call(e){return await this.feature_extractor(e)}}},"./src/models/yolos/image_processing_yolos.js":(e,t,s)=>{s.r(t),s.d(t,{YolosFeatureExtractor:()=>n,YolosImageProcessor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{post_process_object_detection(...e){return(0,o.post_process_object_detection)(...e)}}class n extends r{}},"./src/ops/registry.js":(e,t,s)=>{s.r(t),s.d(t,{TensorOpRegistry:()=>l});var o=s("./src/backends/onnx.js"),r=s("./src/utils/tensor.js"),n=s("./src/env.js");const a=n.apis.IS_BROWSER_ENV||n.apis.IS_WEBWORKER_ENV,i=async(e,t,s)=>{const n=await(0,o.createInferenceSession)(new Uint8Array(e),t);let i=Promise.resolve();return async e=>{const t=(0,o.isONNXProxy)(),l=Object.fromEntries(Object.entries(e).map((([e,s])=>[e,(t?s.clone():s).ort_tensor]))),c=await(i=a?i.then((()=>n.run(l))):n.run(l));return Array.isArray(s)?s.map((e=>new r.Tensor(c[e]))):new r.Tensor(c[s])}};class l{static session_options={};static get nearest_interpolate_4d(){return this._nearest_interpolate_4d||(this._nearest_interpolate_4d=i([8,10,18,0,58,129,1,10,41,10,1,120,10,0,10,0,10,1,115,18,1,121,34,6,82,101,115,105,122,101,42,18,10,4,109,111,100,101,34,7,110,101,97,114,101,115,116,160,1,3,18,1,114,90,31,10,1,120,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,90,15,10,1,115,18,10,10,8,8,7,18,4,10,2,8,4,98,31,10,1,121,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,66,2,16,21],this.session_options,"y")),this._nearest_interpolate_4d}static get bilinear_interpolate_4d(){return this._bilinear_interpolate_4d||(this._bilinear_interpolate_4d=i([8,9,18,0,58,128,1,10,40,10,1,120,10,0,10,0,10,1,115,18,1,121,34,6,82,101,115,105,122,101,42,17,10,4,109,111,100,101,34,6,108,105,110,101,97,114,160,1,3,18,1,114,90,31,10,1,120,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,90,15,10,1,115,18,10,10,8,8,7,18,4,10,2,8,4,98,31,10,1,121,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,66,2,16,20],this.session_options,"y")),this._bilinear_interpolate_4d}static get bicubic_interpolate_4d(){return this._bicubic_interpolate_4d||(this._bicubic_interpolate_4d=i([8,9,18,0,58,127,10,39,10,1,120,10,0,10,0,10,1,115,18,1,121,34,6,82,101,115,105,122,101,42,16,10,4,109,111,100,101,34,5,99,117,98,105,99,160,1,3,18,1,114,90,31,10,1,120,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,90,15,10,1,115,18,10,10,8,8,7,18,4,10,2,8,4,98,31,10,1,121,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,66,2,16,20],this.session_options,"y")),this._bicubic_interpolate_4d}static get matmul(){return this._matmul||(this._matmul=i([8,9,18,0,58,55,10,17,10,1,97,10,1,98,18,1,99,34,6,77,97,116,77,117,108,18,1,114,90,9,10,1,97,18,4,10,2,8,1,90,9,10,1,98,18,4,10,2,8,1,98,9,10,1,99,18,4,10,2,8,1,66,2,16,20],this.session_options,"c")),this._matmul}static get stft(){return this._stft||(this._stft=i([8,7,18,0,58,148,1,10,38,10,1,115,10,1,106,10,1,119,10,1,108,18,1,111,34,4,83,84,70,84,42,15,10,8,111,110,101,115,105,100,101,100,24,1,160,1,2,18,1,115,90,26,10,1,115,18,21,10,19,8,1,18,15,10,3,18,1,98,10,3,18,1,115,10,3,18,1,99,90,11,10,1,106,18,6,10,4,8,7,18,0,90,16,10,1,119,18,11,10,9,8,1,18,5,10,3,18,1,119,90,11,10,1,108,18,6,10,4,8,7,18,0,98,31,10,1,111,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,102,10,3,18,1,100,10,3,18,1,99,66,2,16,17],this.session_options,"o")),this._stft}static get rfft(){return this._rfft||(this._rfft=i([8,9,18,0,58,97,10,33,10,1,120,10,0,10,1,97,18,1,121,34,3,68,70,84,42,15,10,8,111,110,101,115,105,100,101,100,24,1,160,1,2,18,1,100,90,21,10,1,120,18,16,10,14,8,1,18,10,10,3,18,1,115,10,3,18,1,99,90,11,10,1,97,18,6,10,4,8,7,18,0,98,21,10,1,121,18,16,10,14,8,1,18,10,10,3,18,1,115,10,3,18,1,99,66,2,16,20],this.session_options,"y")),this._rfft}static get top_k(){return this._top_k||(this._top_k=i([8,10,18,0,58,73,10,18,10,1,120,10,1,107,18,1,118,18,1,105,34,4,84,111,112,75,18,1,116,90,9,10,1,120,18,4,10,2,8,1,90,15,10,1,107,18,10,10,8,8,7,18,4,10,2,8,1,98,9,10,1,118,18,4,10,2,8,1,98,9,10,1,105,18,4,10,2,8,7,66,2,16,21],this.session_options,["v","i"])),this._top_k}static get slice(){return this._slice||(this._slice=i([8,7,18,0,58,96,10,25,10,1,120,10,1,115,10,1,101,10,1,97,10,1,116,18,1,121,34,5,83,108,105,99,101,18,1,114,90,9,10,1,120,18,4,10,2,8,1,90,9,10,1,115,18,4,10,2,8,7,90,9,10,1,101,18,4,10,2,8,7,90,9,10,1,97,18,4,10,2,8,7,90,9,10,1,116,18,4,10,2,8,7,98,9,10,1,121,18,4,10,2,8,1,66,2,16,13],this.session_options,"y")),this._slice}}},"./src/pipelines.js":(e,t,s)=>{s.r(t),s.d(t,{AudioClassificationPipeline:()=>C,AutomaticSpeechRecognitionPipeline:()=>A,BackgroundRemovalPipeline:()=>z,DepthEstimationPipeline:()=>G,DocumentQuestionAnsweringPipeline:()=>D,FeatureExtractionPipeline:()=>y,FillMaskPipeline:()=>w,ImageClassificationPipeline:()=>L,ImageFeatureExtractionPipeline:()=>v,ImageSegmentationPipeline:()=>I,ImageToImagePipeline:()=>B,ImageToTextPipeline:()=>E,ObjectDetectionPipeline:()=>j,Pipeline:()=>h,QuestionAnsweringPipeline:()=>M,SummarizationPipeline:()=>b,Text2TextGenerationPipeline:()=>T,TextClassificationPipeline:()=>g,TextGenerationPipeline:()=>k,TextToAudioPipeline:()=>O,TokenClassificationPipeline:()=>f,TranslationPipeline:()=>x,ZeroShotAudioClassificationPipeline:()=>S,ZeroShotClassificationPipeline:()=>F,ZeroShotImageClassificationPipeline:()=>V,ZeroShotObjectDetectionPipeline:()=>N,pipeline:()=>W});var o=s("./src/tokenizers.js"),r=s("./src/models.js"),n=s("./src/models/auto/processing_auto.js"),a=(s("./src/base/processing_utils.js"),s("./src/utils/generic.js")),i=s("./src/utils/core.js"),l=s("./src/utils/maths.js"),c=s("./src/utils/audio.js"),d=s("./src/utils/tensor.js"),u=s("./src/utils/image.js");async function _(e){return Array.isArray(e)||(e=[e]),await Promise.all(e.map((e=>u.RawImage.read(e))))}async function p(e,t){return Array.isArray(e)||(e=[e]),await Promise.all(e.map((e=>"string"==typeof e||e instanceof URL?(0,c.read_audio)(e,t):e instanceof Float64Array?new Float32Array(e):e)))}function m(e,t){t&&(e=e.map((e=>0|e)));const[s,o,r,n]=e;return{xmin:s,ymin:o,xmax:r,ymax:n}}class h extends a.Callable{constructor({task:e,model:t,tokenizer:s=null,processor:o=null}){super(),this.task=e,this.model=t,this.tokenizer=s,this.processor=o}async dispose(){await this.model.dispose()}}class g extends h{constructor(e){super(e)}async _call(e,{top_k:t=1}={}){const s=this.tokenizer(e,{padding:!0,truncation:!0}),o=await this.model(s),r="multi_label_classification"===this.model.config.problem_type?e=>e.sigmoid():e=>new d.Tensor("float32",(0,l.softmax)(e.data),e.dims),n=this.model.config.id2label,a=[];for(const e of o.logits){const s=r(e),o=await(0,d.topk)(s,t),i=o[0].tolist(),l=o[1].tolist().map(((e,t)=>({label:n?n[e]:`LABEL_${e}`,score:i[t]})));1===t?a.push(...l):a.push(l)}return Array.isArray(e)||1===t?a:a[0]}}class f extends h{constructor(e){super(e)}async _call(e,{ignore_labels:t=["O"]}={}){const s=Array.isArray(e),o=this.tokenizer(s?e:[e],{padding:!0,truncation:!0}),r=(await this.model(o)).logits,n=this.model.config.id2label,a=[];for(let e=0;e<r.dims[0];++e){const s=o.input_ids[e],i=r[e],c=[];for(let e=0;e<i.dims[0];++e){const o=i[e],r=(0,l.max)(o.data)[1],a=n?n[r]:`LABEL_${r}`;if(t.includes(a))continue;const d=this.tokenizer.decode([s[e].item()],{skip_special_tokens:!0});if(""===d)continue;const u=(0,l.softmax)(o.data);c.push({entity:a,score:u[r],index:e,word:d})}a.push(c)}return s?a:a[0]}}class M extends h{constructor(e){super(e)}async _call(e,t,{top_k:s=1}={}){const o=this.tokenizer(e,{text_pair:t,padding:!0,truncation:!0}),{start_logits:r,end_logits:n}=await this.model(o),a=o.input_ids.tolist(),c=o.attention_mask.tolist(),d=this.tokenizer.all_special_ids,u=[];for(let e=0;e<r.dims[0];++e){const t=a[e],o=t.findIndex((e=>e==this.tokenizer.sep_token_id)),_=(c[e].map(((e,s)=>1==e&&(0===s||s>o&&-1===d.findIndex((e=>e==t[s]))))),r[e].tolist()),p=n[e].tolist();for(let s=1;s<_.length;++s)(0==c[e]||s<=o||-1!==d.findIndex((e=>e==t[s])))&&(_[s]=-1/0,p[s]=-1/0);const m=(0,l.softmax)(_).map(((e,t)=>[e,t])),h=(0,l.softmax)(p).map(((e,t)=>[e,t]));m[0][0]=0,h[0][0]=0;const g=(0,i.product)(m,h).filter((e=>e[0][1]<=e[1][1])).map((e=>[e[0][1],e[1][1],e[0][0]*e[1][0]])).sort(((e,t)=>t[2]-e[2]));for(let e=0;e<Math.min(g.length,s);++e){const[s,o,r]=g[e],n=t.slice(s,o+1),a=this.tokenizer.decode(n,{skip_special_tokens:!0});u.push({answer:a,score:r})}}return 1===s?u[0]:u}}class w extends h{constructor(e){super(e)}async _call(e,{top_k:t=5}={}){const s=this.tokenizer(e,{padding:!0,truncation:!0}),{logits:o}=await this.model(s),r=[],n=s.input_ids.tolist();for(let e=0;e<n.length;++e){const s=n[e],a=s.findIndex((e=>e==this.tokenizer.mask_token_id));if(-1===a)throw Error(`Mask token (${this.tokenizer.mask_token}) not found in text.`);const i=o[e][a],c=await(0,d.topk)(new d.Tensor("float32",(0,l.softmax)(i.data),i.dims),t),u=c[0].tolist(),_=c[1].tolist();r.push(_.map(((e,t)=>{const o=s.slice();return o[a]=e,{score:u[t],token:Number(e),token_str:this.tokenizer.decode([e]),sequence:this.tokenizer.decode(o,{skip_special_tokens:!0})}})))}return Array.isArray(e)?r:r[0]}}class T extends h{_key="generated_text";constructor(e){super(e)}async _call(e,t={}){Array.isArray(e)||(e=[e]),this.model.config.prefix&&(e=e.map((e=>this.model.config.prefix+e)));const s=this.model.config.task_specific_params;s&&s[this.task]&&s[this.task].prefix&&(e=e.map((e=>s[this.task].prefix+e)));const o=this.tokenizer,r={padding:!0,truncation:!0};let n;n=this instanceof x&&"_build_translation_inputs"in o?o._build_translation_inputs(e,r,t):o(e,r);const a=await this.model.generate({...n,...t});return o.batch_decode(a,{skip_special_tokens:!0}).map((e=>({[this._key]:e})))}}class b extends T{_key="summary_text";constructor(e){super(e)}}class x extends T{_key="translation_text";constructor(e){super(e)}}function P(e){return Array.isArray(e)&&e.every((e=>"role"in e&&"content"in e))}class k extends h{constructor(e){super(e)}async _call(e,t={}){let s,o=!1,r=!1;if("string"==typeof e)s=e=[e];else if(Array.isArray(e)&&e.every((e=>"string"==typeof e)))o=!0,s=e;else{if(P(e))e=[e];else{if(!Array.isArray(e)||!e.every(P))throw new Error("Input must be a string, an array of strings, a Chat, or an array of Chats");o=!0}r=!0,s=e.map((e=>this.tokenizer.apply_chat_template(e,{tokenize:!1,add_generation_prompt:!0})))}const n=t.add_special_tokens??!1,a=!r&&(t.return_full_text??!0);this.tokenizer.padding_side="left";const i=this.tokenizer(s,{add_special_tokens:n,padding:!0,truncation:!0}),l=await this.model.generate({...i,...t}),c=this.tokenizer.batch_decode(l,{skip_special_tokens:!0});let d;!a&&i.input_ids.dims.at(-1)>0&&(d=this.tokenizer.batch_decode(i.input_ids,{skip_special_tokens:!0}).map((e=>e.length)));const u=Array.from({length:e.length},(e=>[]));for(let t=0;t<c.length;++t){const s=Math.floor(t/l.dims[0]*e.length);d&&(c[t]=c[t].slice(d[s])),u[s].push({generated_text:r?[...e[s],{role:"assistant",content:c[t]}]:c[t]})}return o||1!==u.length?u:u[0]}}class F extends h{constructor(e){super(e),this.label2id=Object.fromEntries(Object.entries(this.model.config.label2id).map((([e,t])=>[e.toLowerCase(),t]))),this.entailment_id=this.label2id.entailment,void 0===this.entailment_id&&(console.warn("Could not find 'entailment' in label2id mapping. Using 2 as entailment_id."),this.entailment_id=2),this.contradiction_id=this.label2id.contradiction??this.label2id.not_entailment,void 0===this.contradiction_id&&(console.warn("Could not find 'contradiction' in label2id mapping. Using 0 as contradiction_id."),this.contradiction_id=0)}async _call(e,t,{hypothesis_template:s="This example is {}.",multi_label:o=!1}={}){const r=Array.isArray(e);r||(e=[e]),Array.isArray(t)||(t=[t]);const n=t.map((e=>s.replace("{}",e))),a=o||1===t.length,i=[];for(const s of e){const e=[];for(const t of n){const o=this.tokenizer(s,{text_pair:t,padding:!0,truncation:!0}),r=await this.model(o);a?e.push([r.logits.data[this.contradiction_id],r.logits.data[this.entailment_id]]):e.push(r.logits.data[this.entailment_id])}const o=(a?e.map((e=>(0,l.softmax)(e)[1])):(0,l.softmax)(e)).map(((e,t)=>[e,t])).sort(((e,t)=>t[0]-e[0]));i.push({sequence:s,labels:o.map((e=>t[e[1]])),scores:o.map((e=>e[0]))})}return r?i:i[0]}}class y extends h{constructor(e){super(e)}async _call(e,{pooling:t="none",normalize:s=!1,quantize:o=!1,precision:r="binary"}={}){const n=this.tokenizer(e,{padding:!0,truncation:!0}),a=await this.model(n);let i=a.last_hidden_state??a.logits??a.token_embeddings;if("none"===t);else if("mean"===t)i=(0,d.mean_pooling)(i,n.attention_mask);else{if("cls"!==t)throw Error(`Pooling method '${t}' not supported.`);i=i.slice(null,0)}return s&&(i=i.normalize(2,-1)),o&&(i=(0,d.quantize_embeddings)(i,r)),i}}class v extends h{constructor(e){super(e)}async _call(e,{pool:t=null}={}){const s=await _(e),{pixel_values:o}=await this.processor(s),r=await this.model({pixel_values:o});let n;if(t){if(!("pooler_output"in r))throw Error("No pooled output was returned. Make sure the model has a 'pooler' layer when using the 'pool' option.");n=r.pooler_output}else n=r.last_hidden_state??r.logits??r.image_embeds;return n}}class C extends h{constructor(e){super(e)}async _call(e,{top_k:t=5}={}){const s=this.processor.feature_extractor.config.sampling_rate,o=await p(e,s),r=this.model.config.id2label,n=[];for(const e of o){const s=await this.processor(e),o=(await this.model(s)).logits[0],a=await(0,d.topk)(new d.Tensor("float32",(0,l.softmax)(o.data),o.dims),t),i=a[0].tolist(),c=a[1].tolist().map(((e,t)=>({label:r?r[e]:`LABEL_${e}`,score:i[t]})));n.push(c)}return Array.isArray(e)?n:n[0]}}class S extends h{constructor(e){super(e)}async _call(e,t,{hypothesis_template:s="This is a sound of {}."}={}){const o=!Array.isArray(e);o&&(e=[e]);const r=t.map((e=>s.replace("{}",e))),n=this.tokenizer(r,{padding:!0,truncation:!0}),a=this.processor.feature_extractor.config.sampling_rate,i=await p(e,a),c=[];for(const e of i){const s=await this.processor(e),o=await this.model({...n,...s}),r=(0,l.softmax)(o.logits_per_audio.data);c.push([...r].map(((e,s)=>({score:e,label:t[s]}))))}return o?c[0]:c}}class A extends h{constructor(e){super(e)}async _call(e,t={}){switch(this.model.config.model_type){case"whisper":case"lite-whisper":return this._call_whisper(e,t);case"wav2vec2":case"wav2vec2-bert":case"unispeech":case"unispeech-sat":case"hubert":return this._call_wav2vec2(e,t);case"moonshine":return this._call_moonshine(e,t);default:throw new Error(`AutomaticSpeechRecognitionPipeline does not support model type '${this.model.config.model_type}'.`)}}async _call_wav2vec2(e,t){t.language&&console.warn('`language` parameter is not yet supported for `wav2vec2` models, defaulting to "English".'),t.task&&console.warn('`task` parameter is not yet supported for `wav2vec2` models, defaulting to "transcribe".');const s=!Array.isArray(e);s&&(e=[e]);const o=this.processor.feature_extractor.config.sampling_rate,r=await p(e,o),n=[];for(const e of r){const t=await this.processor(e),s=(await this.model(t)).logits[0],o=[];for(const e of s)o.push((0,l.max)(e.data)[1]);const r=this.tokenizer.decode(o);n.push({text:r})}return s?n[0]:n}async _call_whisper(e,t){const s=t.return_timestamps??!1,o=t.chunk_length_s??0,r=t.force_full_sequences??!1;let n=t.stride_length_s??null;const a={...t};"word"===s&&(a.return_token_timestamps=!0,a.return_timestamps=!1);const i=!Array.isArray(e);i&&(e=[e]);const c=this.processor.feature_extractor.config.chunk_length/this.model.config.max_source_positions,d=this.processor.feature_extractor.config.hop_length,u=this.processor.feature_extractor.config.sampling_rate,_=await p(e,u),m=[];for(const e of _){let t=[];if(o>0){if(null===n)n=o/6;else if(o<=n)throw Error("`chunk_length_s` must be larger than `stride_length_s`.");const s=u*o,r=u*n,a=s-2*r;let i=0;for(;;){const o=i+s,n=e.subarray(i,o),l=await this.processor(n),c=0===i,d=o>=e.length;if(t.push({stride:[n.length,c?0:r,d?0:r],input_features:l.input_features,is_last:d}),d)break;i+=a}}else t=[{stride:[e.length,0,0],input_features:(await this.processor(e)).input_features,is_last:!0}];for(const e of t){a.num_frames=Math.floor(e.stride[0]/d);const t=await this.model.generate({inputs:e.input_features,...a});"word"===s?(e.tokens=t.sequences.tolist()[0],e.token_timestamps=t.token_timestamps.tolist()[0].map((e=>(0,l.round)(e,2)))):e.tokens=t[0].tolist(),e.stride=e.stride.map((e=>e/u))}const[i,_]=this.tokenizer._decode_asr(t,{time_precision:c,return_timestamps:s,force_full_sequences:r});m.push({text:i,..._})}return i?m[0]:m}async _call_moonshine(e,t){const s=!Array.isArray(e);s&&(e=[e]);const o=this.processor.feature_extractor.config.sampling_rate,r=await p(e,o),n=[];for(const e of r){const s=await this.processor(e),r=6*Math.floor(e.length/o),a=await this.model.generate({max_new_tokens:r,...t,...s}),i=this.processor.batch_decode(a,{skip_special_tokens:!0})[0];n.push({text:i})}return s?n[0]:n}}class E extends h{constructor(e){super(e)}async _call(e,t={}){const s=Array.isArray(e),o=await _(e),{pixel_values:r}=await this.processor(o),n=[];for(const e of r){e.dims=[1,...e.dims];const s=await this.model.generate({inputs:e,...t}),o=this.tokenizer.batch_decode(s,{skip_special_tokens:!0}).map((e=>({generated_text:e.trim()})));n.push(o)}return s?n:n[0]}}class L extends h{constructor(e){super(e)}async _call(e,{top_k:t=5}={}){const s=await _(e),{pixel_values:o}=await this.processor(s),r=await this.model({pixel_values:o}),n=this.model.config.id2label,a=[];for(const e of r.logits){const s=await(0,d.topk)(new d.Tensor("float32",(0,l.softmax)(e.data),e.dims),t),o=s[0].tolist(),r=s[1].tolist().map(((e,t)=>({label:n?n[e]:`LABEL_${e}`,score:o[t]})));a.push(r)}return Array.isArray(e)?a:a[0]}}class I extends h{constructor(e){super(e),this.subtasks_mapping={panoptic:"post_process_panoptic_segmentation",instance:"post_process_instance_segmentation",semantic:"post_process_semantic_segmentation"}}async _call(e,{threshold:t=.5,mask_threshold:s=.5,overlap_mask_area_threshold:o=.8,label_ids_to_fuse:r=null,target_sizes:n=null,subtask:a=null}={}){if(Array.isArray(e)&&1!==e.length)throw Error("Image segmentation pipeline currently only supports a batch size of 1.");const i=await _(e),l=i.map((e=>[e.height,e.width])),c=await this.processor(i),{inputNames:d,outputNames:p}=this.model.sessions.model;if(!d.includes("pixel_values")){if(1!==d.length)throw Error(`Expected a single input name, but got ${d.length} inputs: ${d}.`);const e=d[0];if(e in c)throw Error(`Input name ${e} already exists in the inputs.`);c[e]=c.pixel_values}const m=await this.model(c);let h=null;if(null!==a)h=this.subtasks_mapping[a];else if(this.processor.image_processor)for(const[e,t]of Object.entries(this.subtasks_mapping))if(t in this.processor.image_processor){h=this.processor.image_processor[t].bind(this.processor.image_processor),a=e;break}const g=this.model.config.id2label,f=[];if(a)if("panoptic"===a||"instance"===a){const e=h(m,t,s,o,r,n??l)[0],a=e.segmentation;for(const t of e.segments_info){const e=new Uint8ClampedArray(a.data.length);for(let s=0;s<a.data.length;++s)a.data[s]===t.id&&(e[s]=255);const s=new u.RawImage(e,a.dims[1],a.dims[0],1);f.push({score:t.score,label:g[t.label_id],mask:s})}}else{if("semantic"!==a)throw Error(`Subtask ${a} not supported.`);{const{segmentation:e,labels:t}=h(m,n??l)[0];for(const s of t){const t=new Uint8ClampedArray(e.data.length);for(let o=0;o<e.data.length;++o)e.data[o]===s&&(t[o]=255);const o=new u.RawImage(t,e.dims[1],e.dims[0],1);f.push({score:null,label:g[s],mask:o})}}}else{const e=m[p[0]];for(let t=0;t<l.length;++t){const s=l[t],o=e[t];o.data.some((e=>e<0||e>1))&&o.sigmoid_();const r=await u.RawImage.fromTensor(o.mul_(255).to("uint8")).resize(s[1],s[0]);f.push({label:null,score:null,mask:r})}}return f}}class z extends I{constructor(e){super(e)}async _call(e,t={}){if(Array.isArray(e)&&1!==e.length)throw Error("Background removal pipeline currently only supports a batch size of 1.");const s=await _(e),o=await super._call(e,t);return s.map(((e,t)=>{const s=e.clone();return s.putAlpha(o[t].mask),s}))}}class V extends h{constructor(e){super(e)}async _call(e,t,{hypothesis_template:s="This is a photo of {}"}={}){const o=Array.isArray(e),r=await _(e),n=t.map((e=>s.replace("{}",e))),a=this.tokenizer(n,{padding:"siglip"!==this.model.config.model_type||"max_length",truncation:!0}),{pixel_values:i}=await this.processor(r),c=await this.model({...a,pixel_values:i}),d="siglip"===this.model.config.model_type?e=>e.sigmoid().data:e=>(0,l.softmax)(e.data),u=[];for(const e of c.logits_per_image){const s=[...d(e)].map(((e,s)=>({score:e,label:t[s]})));s.sort(((e,t)=>t.score-e.score)),u.push(s)}return o?u:u[0]}}class j extends h{constructor(e){super(e)}async _call(e,{threshold:t=.9,percentage:s=!1}={}){const o=Array.isArray(e);if(o&&1!==e.length)throw Error("Object detection pipeline currently only supports a batch size of 1.");const r=await _(e),n=s?null:r.map((e=>[e.height,e.width])),{pixel_values:a,pixel_mask:i}=await this.processor(r),l=await this.model({pixel_values:a,pixel_mask:i}),c=this.processor.image_processor.post_process_object_detection(l,t,n),d=this.model.config.id2label,u=c.map((e=>e.boxes.map(((t,o)=>({score:e.scores[o],label:d[e.classes[o]],box:m(t,!s)})))));return o?u:u[0]}}class N extends h{constructor(e){super(e)}async _call(e,t,{threshold:s=.1,top_k:o=null,percentage:r=!1}={}){const n=Array.isArray(e),a=await _(e),i=this.tokenizer(t,{padding:!0,truncation:!0}),l=await this.processor(a),c=[];for(let e=0;e<a.length;++e){const n=a[e],d=r?null:[[n.height,n.width]],u=l.pixel_values[e].unsqueeze_(0),_=await this.model({...i,pixel_values:u});let p;if("post_process_grounded_object_detection"in this.processor){const e=this.processor.post_process_grounded_object_detection(_,i.input_ids,{box_threshold:s,text_threshold:s,target_sizes:d})[0];p=e.boxes.map(((t,s)=>({score:e.scores[s],label:e.labels[s],box:m(t,!r)})))}else{const e=this.processor.image_processor.post_process_object_detection(_,s,d,!0)[0];p=e.boxes.map(((s,o)=>({score:e.scores[o],label:t[e.classes[o]],box:m(s,!r)})))}p.sort(((e,t)=>t.score-e.score)),null!==o&&(p=p.slice(0,o)),c.push(p)}return n?c:c[0]}}class D extends h{constructor(e){super(e)}async _call(e,t,s={}){const o=(await _(e))[0],{pixel_values:r}=await this.processor(o),n=`<s_docvqa><s_question>${t}</s_question><s_answer>`,a=this.tokenizer(n,{add_special_tokens:!1,padding:!0,truncation:!0}).input_ids,i=await this.model.generate({inputs:r,max_length:this.model.config.decoder.max_position_embeddings,decoder_input_ids:a,...s}),l=this.tokenizer.batch_decode(i)[0].match(/<s_answer>(.*?)<\/s_answer>/);let c=null;return l&&l.length>=2&&(c=l[1].trim()),[{answer:c}]}}class O extends h{DEFAULT_VOCODER_ID="Xenova/speecht5_hifigan";constructor(e){super(e),this.vocoder=e.vocoder??null}async _call(e,{speaker_embeddings:t=null}={}){return this.processor?this._call_text_to_spectrogram(e,{speaker_embeddings:t}):this._call_text_to_waveform(e)}async _call_text_to_waveform(e){const t=this.tokenizer(e,{padding:!0,truncation:!0}),{waveform:s}=await this.model(t),o=this.model.config.sampling_rate;return new c.RawAudio(s.data,o)}async _call_text_to_spectrogram(e,{speaker_embeddings:t}){if(this.vocoder||(console.log("No vocoder specified, using default HifiGan vocoder."),this.vocoder=await r.AutoModel.from_pretrained(this.DEFAULT_VOCODER_ID,{dtype:"fp32"})),("string"==typeof t||t instanceof URL)&&(t=new Float32Array(await(await fetch(t)).arrayBuffer())),t instanceof Float32Array)t=new d.Tensor("float32",t,[1,t.length]);else if(!(t instanceof d.Tensor))throw new Error("Speaker embeddings must be a `Tensor`, `Float32Array`, `string`, or `URL`.");const{input_ids:s}=this.tokenizer(e,{padding:!0,truncation:!0}),{waveform:o}=await this.model.generate_speech(s,t,{vocoder:this.vocoder}),n=this.processor.feature_extractor.config.sampling_rate;return new c.RawAudio(o.data,n)}}class B extends h{constructor(e){super(e)}async _call(e){const t=await _(e),s=await this.processor(t),o=await this.model(s),r=[];for(const e of o.reconstruction){const t=e.squeeze().clamp_(0,1).mul_(255).round_().to("uint8");r.push(u.RawImage.fromTensor(t))}return r.length>1?r:r[0]}}class G extends h{constructor(e){super(e)}async _call(e){const t=await _(e),s=await this.processor(t),{predicted_depth:o}=await this.model(s),r=[];for(let e=0;e<t.length;++e){const s=o[e],[n,a]=s.dims.slice(-2),[i,l]=t[e].size,c=(await(0,d.interpolate_4d)(s.view(1,1,n,a),{size:[l,i],mode:"bilinear"})).view(l,i),_=c.min().item(),p=c.max().item(),m=c.sub(_).div_(p-_).mul_(255).to("uint8").unsqueeze(0),h=u.RawImage.fromTensor(m);r.push({predicted_depth:c,depth:h})}return r.length>1?r:r[0]}}const R=Object.freeze({"text-classification":{tokenizer:o.AutoTokenizer,pipeline:g,model:r.AutoModelForSequenceClassification,default:{model:"Xenova/distilbert-base-uncased-finetuned-sst-2-english"},type:"text"},"token-classification":{tokenizer:o.AutoTokenizer,pipeline:f,model:r.AutoModelForTokenClassification,default:{model:"Xenova/bert-base-multilingual-cased-ner-hrl"},type:"text"},"question-answering":{tokenizer:o.AutoTokenizer,pipeline:M,model:r.AutoModelForQuestionAnswering,default:{model:"Xenova/distilbert-base-cased-distilled-squad"},type:"text"},"fill-mask":{tokenizer:o.AutoTokenizer,pipeline:w,model:r.AutoModelForMaskedLM,default:{model:"Xenova/bert-base-uncased"},type:"text"},summarization:{tokenizer:o.AutoTokenizer,pipeline:b,model:r.AutoModelForSeq2SeqLM,default:{model:"Xenova/distilbart-cnn-6-6"},type:"text"},translation:{tokenizer:o.AutoTokenizer,pipeline:x,model:r.AutoModelForSeq2SeqLM,default:{model:"Xenova/t5-small"},type:"text"},"text2text-generation":{tokenizer:o.AutoTokenizer,pipeline:T,model:r.AutoModelForSeq2SeqLM,default:{model:"Xenova/flan-t5-small"},type:"text"},"text-generation":{tokenizer:o.AutoTokenizer,pipeline:k,model:r.AutoModelForCausalLM,default:{model:"Xenova/gpt2"},type:"text"},"zero-shot-classification":{tokenizer:o.AutoTokenizer,pipeline:F,model:r.AutoModelForSequenceClassification,default:{model:"Xenova/distilbert-base-uncased-mnli"},type:"text"},"audio-classification":{pipeline:C,model:r.AutoModelForAudioClassification,processor:n.AutoProcessor,default:{model:"Xenova/wav2vec2-base-superb-ks"},type:"audio"},"zero-shot-audio-classification":{tokenizer:o.AutoTokenizer,pipeline:S,model:r.AutoModel,processor:n.AutoProcessor,default:{model:"Xenova/clap-htsat-unfused"},type:"multimodal"},"automatic-speech-recognition":{tokenizer:o.AutoTokenizer,pipeline:A,model:[r.AutoModelForSpeechSeq2Seq,r.AutoModelForCTC],processor:n.AutoProcessor,default:{model:"Xenova/whisper-tiny.en"},type:"multimodal"},"text-to-audio":{tokenizer:o.AutoTokenizer,pipeline:O,model:[r.AutoModelForTextToWaveform,r.AutoModelForTextToSpectrogram],processor:[n.AutoProcessor,null],default:{model:"Xenova/speecht5_tts"},type:"text"},"image-to-text":{tokenizer:o.AutoTokenizer,pipeline:E,model:r.AutoModelForVision2Seq,processor:n.AutoProcessor,default:{model:"Xenova/vit-gpt2-image-captioning"},type:"multimodal"},"image-classification":{pipeline:L,model:r.AutoModelForImageClassification,processor:n.AutoProcessor,default:{model:"Xenova/vit-base-patch16-224"},type:"multimodal"},"image-segmentation":{pipeline:I,model:[r.AutoModelForImageSegmentation,r.AutoModelForSemanticSegmentation,r.AutoModelForUniversalSegmentation],processor:n.AutoProcessor,default:{model:"Xenova/detr-resnet-50-panoptic"},type:"multimodal"},"background-removal":{pipeline:z,model:[r.AutoModelForImageSegmentation,r.AutoModelForSemanticSegmentation,r.AutoModelForUniversalSegmentation],processor:n.AutoProcessor,default:{model:"Xenova/modnet"},type:"image"},"zero-shot-image-classification":{tokenizer:o.AutoTokenizer,pipeline:V,model:r.AutoModel,processor:n.AutoProcessor,default:{model:"Xenova/clip-vit-base-patch32"},type:"multimodal"},"object-detection":{pipeline:j,model:r.AutoModelForObjectDetection,processor:n.AutoProcessor,default:{model:"Xenova/detr-resnet-50"},type:"multimodal"},"zero-shot-object-detection":{tokenizer:o.AutoTokenizer,pipeline:N,model:r.AutoModelForZeroShotObjectDetection,processor:n.AutoProcessor,default:{model:"Xenova/owlvit-base-patch32"},type:"multimodal"},"document-question-answering":{tokenizer:o.AutoTokenizer,pipeline:D,model:r.AutoModelForDocumentQuestionAnswering,processor:n.AutoProcessor,default:{model:"Xenova/donut-base-finetuned-docvqa"},type:"multimodal"},"image-to-image":{pipeline:B,model:r.AutoModelForImageToImage,processor:n.AutoProcessor,default:{model:"Xenova/swin2SR-classical-sr-x2-64"},type:"image"},"depth-estimation":{pipeline:G,model:r.AutoModelForDepthEstimation,processor:n.AutoProcessor,default:{model:"Xenova/dpt-large"},type:"image"},"feature-extraction":{tokenizer:o.AutoTokenizer,pipeline:y,model:r.AutoModel,default:{model:"Xenova/all-MiniLM-L6-v2"},type:"text"},"image-feature-extraction":{processor:n.AutoProcessor,pipeline:v,model:[r.AutoModelForImageFeatureExtraction,r.AutoModel],default:{model:"Xenova/vit-base-patch16-224-in21k"},type:"image"}}),q=Object.freeze({"sentiment-analysis":"text-classification",ner:"token-classification",asr:"automatic-speech-recognition","text-to-speech":"text-to-audio",embeddings:"feature-extraction"});async function W(e,t=null,{progress_callback:s=null,config:o=null,cache_dir:r=null,local_files_only:n=!1,revision:a="main",device:l=null,dtype:c=null,subfolder:d="onnx",use_external_data_format:u=null,model_file_name:_=null,session_options:p={}}={}){e=q[e]??e;const m=R[e.split("_",1)[0]];if(!m)throw Error(`Unsupported pipeline: ${e}. Must be one of [${Object.keys(R)}]`);t||(t=m.default.model,console.log(`No model specified. Using default model: "${t}".`));const h={progress_callback:s,config:o,cache_dir:r,local_files_only:n,revision:a,device:l,dtype:c,subfolder:d,use_external_data_format:u,model_file_name:_,session_options:p},g=new Map([["tokenizer",m.tokenizer],["model",m.model],["processor",m.processor]]),f=await async function(e,t,s){const o=Object.create(null),r=[];for(const[n,a]of e.entries()){if(!a)continue;let e;e=Array.isArray(a)?new Promise((async(e,o)=>{let r;for(const n of a){if(null===n)return void e(null);try{return void e(await n.from_pretrained(t,s))}catch(e){if(e.message?.includes("Unsupported model type"))r=e;else{if(!e.message?.includes("Could not locate file"))return void o(e);r=e}}}o(r)})):a.from_pretrained(t,s),o[n]=e,r.push(e)}await Promise.all(r);for(const[e,t]of Object.entries(o))o[e]=await t;return o}(g,t,h);f.task=e,(0,i.dispatchCallback)(s,{status:"ready",task:e,model:t});return new(0,m.pipeline)(f)}},"./src/tokenizers.js":(e,t,s)=>{s.r(t),s.d(t,{AlbertTokenizer:()=>ke,AutoTokenizer:()=>gt,BartTokenizer:()=>De,BertTokenizer:()=>Pe,BlenderbotSmallTokenizer:()=>dt,BlenderbotTokenizer:()=>ct,BloomTokenizer:()=>Re,CLIPTokenizer:()=>nt,CamembertTokenizer:()=>Ie,CodeGenTokenizer:()=>rt,CodeLlamaTokenizer:()=>$e,CohereTokenizer:()=>mt,ConvBertTokenizer:()=>Ae,DebertaTokenizer:()=>ve,DebertaV2Tokenizer:()=>Ce,DistilBertTokenizer:()=>Le,ElectraTokenizer:()=>Ve,EsmTokenizer:()=>Je,FalconTokenizer:()=>Qe,GPT2Tokenizer:()=>Ne,GPTNeoXTokenizer:()=>He,GemmaTokenizer:()=>Ke,Grok1Tokenizer:()=>Ze,HerbertTokenizer:()=>Se,LlamaTokenizer:()=>We,M2M100Tokenizer:()=>st,MBart50Tokenizer:()=>Be,MBartTokenizer:()=>Oe,MPNetTokenizer:()=>Xe,MarianTokenizer:()=>it,MgpstrTokenizer:()=>ht,MobileBertTokenizer:()=>Fe,NllbTokenizer:()=>tt,NougatTokenizer:()=>_t,PreTrainedTokenizer:()=>xe,Qwen2Tokenizer:()=>Ye,RoFormerTokenizer:()=>Ee,RobertaTokenizer:()=>Ge,SiglipTokenizer:()=>at,SpeechT5Tokenizer:()=>ut,SqueezeBertTokenizer:()=>ye,T5Tokenizer:()=>je,TokenizerModel:()=>P,VitsTokenizer:()=>pt,Wav2Vec2CTCTokenizer:()=>lt,WhisperTokenizer:()=>ot,XLMRobertaTokenizer:()=>Ue,XLMTokenizer:()=>ze,is_chinese_char:()=>f});var o=s("./src/utils/generic.js"),r=s("./src/utils/core.js"),n=s("./src/utils/hub.js"),a=s("./src/utils/maths.js"),i=s("./src/utils/tensor.js"),l=s("./src/utils/data-structures.js"),c=s("./node_modules/@huggingface/jinja/dist/index.js"),d=s("./src/models/whisper/common_whisper.js");async function u(e,t){const s=await Promise.all([(0,n.getModelJSON)(e,"tokenizer.json",!0,t),(0,n.getModelJSON)(e,"tokenizer_config.json",!0,t)]);return null!==t.legacy&&(s[1].legacy=t.legacy),s}function _(e,t=!0){if(void 0!==e.Regex){let t=e.Regex.replace(/\\([#&~])/g,"$1");for(const[e,s]of b)t=t.replaceAll(e,s);return new RegExp(t,"gu")}if(void 0!==e.String){const s=(0,r.escapeRegExp)(e.String);return new RegExp(t?s:`(${s})`,"gu")}return console.warn("Unknown pattern type:",e),null}function p(e){return new Map(Object.entries(e))}function m(e){const t=e.dims;switch(t.length){case 1:return e.tolist();case 2:if(1!==t[0])throw new Error("Unable to decode tensor with `batch size !== 1`. Use `tokenizer.batch_decode(...)` for batched inputs.");return e.tolist()[0];default:throw new Error(`Expected tensor to have 1-2 dimensions, got ${t.length}.`)}}function h(e){return e.replace(/ \./g,".").replace(/ \?/g,"?").replace(/ \!/g,"!").replace(/ ,/g,",").replace(/ \' /g,"'").replace(/ n\'t/g,"n't").replace(/ \'m/g,"'m").replace(/ \'s/g,"'s").replace(/ \'ve/g,"'ve").replace(/ \'re/g,"'re")}function g(e){return e.replace(/\p{M}/gu,"")}function f(e){return e>=19968&&e<=40959||e>=13312&&e<=19903||e>=131072&&e<=173791||e>=173824&&e<=177983||e>=177984&&e<=178207||e>=178208&&e<=183983||e>=63744&&e<=64255||e>=194560&&e<=195103}const M="\\p{P}\\u0021-\\u002F\\u003A-\\u0040\\u005B-\\u0060\\u007B-\\u007E",w=new RegExp(`^[${M}]+$`,"gu"),T=".,!?…。,、।۔،",b=new Map([["(?i:'s|'t|'re|'ve|'m|'ll|'d)","(?:'([sS]|[tT]|[rR][eE]|[vV][eE]|[mM]|[lL][lL]|[dD]))"],[` ?[^(\\s|[${T}])]+`,` ?[^\\s${T}]+`]]);class x{constructor(e){this.content=e.content,this.id=e.id,this.single_word=e.single_word??!1,this.lstrip=e.lstrip??!1,this.rstrip=e.rstrip??!1,this.special=e.special??!1,this.normalized=e.normalized??null}}class P extends o.Callable{constructor(e){super(),this.config=e,this.vocab=[],this.tokens_to_ids=new Map,this.unk_token_id=void 0,this.unk_token=void 0,this.end_of_word_suffix=void 0,this.fuse_unk=this.config.fuse_unk??!1}static fromConfig(e,...t){switch(e.type){case"WordPiece":return new k(e);case"Unigram":return new F(e,...t);case"BPE":return new C(e);default:if(e.vocab)return Array.isArray(e.vocab)?new F(e,...t):"object"==typeof e.vocab&&e.continuing_subword_prefix&&e.unk_token?new k(e):new S(e,...t);throw new Error(`Unknown TokenizerModel type: ${e.type}`)}}_call(e){return e=this.encode(e),this.fuse_unk&&(e=function(e,t,s){const o=[];let r=0;for(;r<e.length;)if(o.push(e[r]),(t.get(e[r])??s)===s)for(;++r<e.length&&(t.get(e[r])??s)===s;)t.get(o.at(-1))!==s&&(o[o.length-1]+=e[r]);else++r;return o}(e,this.tokens_to_ids,this.unk_token_id)),e}encode(e){throw Error("encode should be implemented in subclass.")}convert_tokens_to_ids(e){return e.map((e=>this.tokens_to_ids.get(e)??this.unk_token_id))}convert_ids_to_tokens(e){return e.map((e=>this.vocab[e]??this.unk_token))}}class k extends P{constructor(e){super(e),this.tokens_to_ids=p(e.vocab),this.unk_token_id=this.tokens_to_ids.get(e.unk_token),this.unk_token=e.unk_token,this.max_input_chars_per_word=e.max_input_chars_per_word??100,this.vocab=new Array(this.tokens_to_ids.size);for(const[e,t]of this.tokens_to_ids)this.vocab[t]=e}encode(e){const t=[];for(const s of e){const e=[...s];if(e.length>this.max_input_chars_per_word){t.push(this.unk_token);continue}let o=!1,r=0;const n=[];for(;r<e.length;){let t=e.length,s=null;for(;r<t;){let o=e.slice(r,t).join("");if(r>0&&(o=this.config.continuing_subword_prefix+o),this.tokens_to_ids.has(o)){s=o;break}--t}if(null===s){o=!0;break}n.push(s),r=t}o?t.push(this.unk_token):t.push(...n)}return t}}class F extends P{constructor(e,t){super(e);const s=e.vocab.length;this.vocab=new Array(s),this.scores=new Array(s);for(let t=0;t<s;++t)[this.vocab[t],this.scores[t]]=e.vocab[t];this.unk_token_id=e.unk_id,this.unk_token=this.vocab[e.unk_id],this.tokens_to_ids=new Map(this.vocab.map(((e,t)=>[e,t]))),this.bos_token=" ",this.bos_token_id=this.tokens_to_ids.get(this.bos_token),this.eos_token=t.eos_token,this.eos_token_id=this.tokens_to_ids.get(this.eos_token),this.unk_token=this.vocab[this.unk_token_id],this.minScore=(0,a.min)(this.scores)[0],this.unk_score=this.minScore-10,this.scores[this.unk_token_id]=this.unk_score,this.trie=new l.CharTrie,this.trie.extend(this.vocab),this.fuse_unk=!0}populateNodes(e){const t=e.chars;let s=0;for(;s<t.length;){let o=!1;const n=[],a=t.slice(s).join(""),i=this.trie.commonPrefixSearch(a);for(const t of i){n.push(t);const a=this.tokens_to_ids.get(t),i=this.scores[a],l=(0,r.len)(t);e.insert(s,l,i,a),o||1!==l||(o=!0)}o||e.insert(s,1,this.unk_score,this.unk_token_id),s+=1}}tokenize(e){const t=new l.TokenLattice(e,this.bos_token_id,this.eos_token_id);return this.populateNodes(t),t.tokens()}encode(e){const t=[];for(const s of e){const e=this.tokenize(s);t.push(...e)}return t}}const y=(()=>{const e=[...Array.from({length:"~".charCodeAt(0)-"!".charCodeAt(0)+1},((e,t)=>t+"!".charCodeAt(0))),...Array.from({length:"¬".charCodeAt(0)-"¡".charCodeAt(0)+1},((e,t)=>t+"¡".charCodeAt(0))),...Array.from({length:"ÿ".charCodeAt(0)-"®".charCodeAt(0)+1},((e,t)=>t+"®".charCodeAt(0)))],t=e.slice();let s=0;for(let o=0;o<256;++o)e.includes(o)||(e.push(o),t.push(256+s),s+=1);const o=t.map((e=>String.fromCharCode(e)));return Object.fromEntries(e.map(((e,t)=>[e,o[t]])))})(),v=(0,r.reverseDictionary)(y);class C extends P{constructor(e){super(e),this.tokens_to_ids=p(e.vocab),this.unk_token_id=this.tokens_to_ids.get(e.unk_token),this.unk_token=e.unk_token,this.vocab=new Array(this.tokens_to_ids.size);for(const[e,t]of this.tokens_to_ids)this.vocab[t]=e;const t=Array.isArray(e.merges[0]);this.merges=t?e.merges:e.merges.map((e=>e.split(" ",2))),this.bpe_ranks=new Map(this.merges.map(((e,t)=>[JSON.stringify(e),t]))),this.end_of_word_suffix=e.end_of_word_suffix,this.continuing_subword_suffix=e.continuing_subword_suffix??null,this.byte_fallback=this.config.byte_fallback??!1,this.byte_fallback&&(this.text_encoder=new TextEncoder),this.ignore_merges=this.config.ignore_merges??!1,this.cache=new Map}bpe(e){if(0===e.length)return[];const t=this.cache.get(e);if(void 0!==t)return t;const s=Array.from(e);this.end_of_word_suffix&&(s[s.length-1]+=this.end_of_word_suffix);let o=[];if(s.length>1){const e=new l.PriorityQueue(((e,t)=>e.score<t.score));let t={token:s[0],bias:0,prev:null,next:null},r=t;for(let t=1;t<s.length;++t){const o={bias:t/s.length,token:s[t],prev:r,next:null};r.next=o,this._add_node(e,r),r=o}for(;!e.isEmpty();){const s=e.pop();if(s.deleted||!s.next||s.next.deleted)continue;if(s.deleted=!0,s.next.deleted=!0,s.prev){const e={...s.prev};s.prev.deleted=!0,s.prev=e,e.prev?e.prev.next=e:t=e}const o={token:s.token+s.next.token,bias:s.bias,prev:s.prev,next:s.next.next};o.prev?(o.prev.next=o,this._add_node(e,o.prev)):t=o,o.next&&(o.next.prev=o,this._add_node(e,o))}for(let e=t;null!==e;e=e.next)o.push(e.token)}else o=s;if(this.continuing_subword_suffix)for(let e=0;e<o.length-1;++e)o[e]+=this.continuing_subword_suffix;return this.cache.set(e,o),o}_add_node(e,t){const s=this.bpe_ranks.get(JSON.stringify([t.token,t.next.token]));void 0!==s&&(t.score=s+t.bias,e.push(t))}encode(e){const t=[];for(const s of e){if(this.ignore_merges&&this.tokens_to_ids.has(s)){t.push(s);continue}const e=this.bpe(s);for(const s of e)if(this.tokens_to_ids.has(s))t.push(s);else if(this.byte_fallback){const e=Array.from(this.text_encoder.encode(s)).map((e=>`<0x${e.toString(16).toUpperCase().padStart(2,"0")}>`));e.every((e=>this.tokens_to_ids.has(e)))?t.push(...e):t.push(this.unk_token)}else t.push(this.unk_token)}return t}}class S extends P{constructor(e,t){super(e),this.tokens_to_ids=p(t.target_lang?e.vocab[t.target_lang]:e.vocab),this.bos_token=t.bos_token,this.bos_token_id=this.tokens_to_ids.get(this.bos_token),this.eos_token=t.eos_token,this.eos_token_id=this.tokens_to_ids.get(this.eos_token),this.pad_token=t.pad_token,this.pad_token_id=this.tokens_to_ids.get(this.pad_token),this.unk_token=t.unk_token,this.unk_token_id=this.tokens_to_ids.get(this.unk_token),this.vocab=new Array(this.tokens_to_ids.size);for(const[e,t]of this.tokens_to_ids)this.vocab[t]=e}encode(e){return e}}class A extends o.Callable{constructor(e){super(),this.config=e}static fromConfig(e){if(null===e)return null;switch(e.type){case"BertNormalizer":return new R(e);case"Precompiled":return new me(e);case"Sequence":return new G(e);case"Replace":return new E(e);case"NFC":return new I(e);case"NFD":return new z(e);case"NFKC":return new V(e);case"NFKD":return new j(e);case"Strip":return new N(e);case"StripAccents":return new D(e);case"Lowercase":return new O(e);case"Prepend":return new B(e);default:throw new Error(`Unknown Normalizer type: ${e.type}`)}}normalize(e){throw Error("normalize should be implemented in subclass.")}_call(e){return this.normalize(e)}}class E extends A{normalize(e){const t=_(this.config.pattern);return null===t?e:e.replaceAll(t,this.config.content)}}class L extends A{form=void 0;normalize(e){return e=e.normalize(this.form)}}class I extends L{form="NFC"}class z extends L{form="NFD"}class V extends L{form="NFKC"}class j extends L{form="NFKD"}class N extends A{normalize(e){return this.config.strip_left&&this.config.strip_right?e=e.trim():(this.config.strip_left&&(e=e.trimStart()),this.config.strip_right&&(e=e.trimEnd())),e}}class D extends A{normalize(e){return e=g(e)}}class O extends A{normalize(e){return e=e.toLowerCase()}}class B extends A{normalize(e){return e=this.config.prepend+e}}class G extends A{constructor(e){super(e),this.normalizers=e.normalizers.map((e=>A.fromConfig(e)))}normalize(e){return this.normalizers.reduce(((e,t)=>t.normalize(e)),e)}}class R extends A{_tokenize_chinese_chars(e){const t=[];for(let s=0;s<e.length;++s){const o=e[s];f(o.charCodeAt(0))?(t.push(" "),t.push(o),t.push(" ")):t.push(o)}return t.join("")}stripAccents(e){return e.normalize("NFD").replace(/\p{Mn}/gu,"")}_is_control(e){switch(e){case"\t":case"\n":case"\r":return!1;default:return/^\p{Cc}|\p{Cf}|\p{Co}|\p{Cs}$/u.test(e)}}_clean_text(e){const t=[];for(const s of e){const e=s.charCodeAt(0);0===e||65533===e||this._is_control(s)||(/^\s$/.test(s)?t.push(" "):t.push(s))}return t.join("")}normalize(e){return this.config.clean_text&&(e=this._clean_text(e)),this.config.handle_chinese_chars&&(e=this._tokenize_chinese_chars(e)),this.config.lowercase?(e=e.toLowerCase(),!1!==this.config.strip_accents&&(e=this.stripAccents(e))):this.config.strip_accents&&(e=this.stripAccents(e)),e}}class q extends o.Callable{static fromConfig(e){if(null===e)return null;switch(e.type){case"BertPreTokenizer":return new W(e);case"Sequence":return new he(e);case"Whitespace":return new ge(e);case"WhitespaceSplit":return new fe(e);case"Metaspace":return new _e(e);case"ByteLevel":return new $(e);case"Split":return new U(e);case"Punctuation":return new X(e);case"Digits":return new Q(e);case"Replace":return new Me(e);default:throw new Error(`Unknown PreTokenizer type: ${e.type}`)}}pre_tokenize_text(e,t){throw Error("pre_tokenize_text should be implemented in subclass.")}pre_tokenize(e,t){return(Array.isArray(e)?e.map((e=>this.pre_tokenize_text(e,t))):this.pre_tokenize_text(e,t)).flat()}_call(e,t){return this.pre_tokenize(e,t)}}class W extends q{constructor(e){super(),this.pattern=new RegExp(`[^\\s${M}]+|[${M}]`,"gu")}pre_tokenize_text(e,t){return e.trim().match(this.pattern)||[]}}class $ extends q{constructor(e){super(),this.config=e,this.add_prefix_space=this.config.add_prefix_space,this.trim_offsets=this.config.trim_offsets,this.use_regex=this.config.use_regex??!0,this.pattern=/'s|'t|'re|'ve|'m|'ll|'d| ?\p{L}+| ?\p{N}+| ?[^\s\p{L}\p{N}]+|\s+(?!\S)|\s+/gu,this.byte_encoder=y,this.text_encoder=new TextEncoder}pre_tokenize_text(e,t){this.add_prefix_space&&!e.startsWith(" ")&&(e=" "+e);return(this.use_regex?e.match(this.pattern)||[]:[e]).map((e=>Array.from(this.text_encoder.encode(e),(e=>this.byte_encoder[e])).join("")))}}class U extends q{constructor(e){super(),this.config=e,this.pattern=_(this.config.pattern,this.config.invert)}pre_tokenize_text(e,t){return null===this.pattern?[]:this.config.invert?e.match(this.pattern)||[]:"removed"===this.config.behavior?.toLowerCase()?e.split(this.pattern).filter((e=>e)):function(e,t){const s=[];let o=0;for(const r of e.matchAll(t)){const t=r[0];o<r.index&&s.push(e.slice(o,r.index)),t.length>0&&s.push(t),o=r.index+t.length}return o<e.length&&s.push(e.slice(o)),s}(e,this.pattern)}}class X extends q{constructor(e){super(),this.config=e,this.pattern=new RegExp(`[^${M}]+|[${M}]+`,"gu")}pre_tokenize_text(e,t){return e.match(this.pattern)||[]}}class Q extends q{constructor(e){super(),this.config=e;const t="[^\\d]+|\\d"+(this.config.individual_digits?"":"+");this.pattern=new RegExp(t,"gu")}pre_tokenize_text(e,t){return e.match(this.pattern)||[]}}class H extends o.Callable{constructor(e){super(),this.config=e}static fromConfig(e){if(null===e)return null;switch(e.type){case"TemplateProcessing":return new K(e);case"ByteLevel":return new Z(e);case"RobertaProcessing":return new Y(e);case"BertProcessing":return new J(e);case"Sequence":return new ee(e);default:throw new Error(`Unknown PostProcessor type: ${e.type}`)}}post_process(e,...t){throw Error("post_process should be implemented in subclass.")}_call(e,...t){return this.post_process(e,...t)}}class J extends H{constructor(e){super(e),this.cls=e.cls[0],this.sep=e.sep[0]}post_process(e,t=null,{add_special_tokens:s=!0}={}){s&&(e=(0,r.mergeArrays)([this.cls],e,[this.sep]));let o=new Array(e.length).fill(0);if(null!==t){const n=s&&this instanceof Y?[this.sep]:[],a=s?[this.sep]:[];e=(0,r.mergeArrays)(e,n,t,a),o=(0,r.mergeArrays)(o,new Array(t.length+n.length+a.length).fill(1))}return{tokens:e,token_type_ids:o}}}class Y extends J{}class K extends H{constructor(e){super(e),this.single=e.single,this.pair=e.pair}post_process(e,t=null,{add_special_tokens:s=!0}={}){const o=null===t?this.single:this.pair;let n=[],a=[];for(const i of o)"SpecialToken"in i?s&&(n.push(i.SpecialToken.id),a.push(i.SpecialToken.type_id)):"Sequence"in i&&("A"===i.Sequence.id?(n=(0,r.mergeArrays)(n,e),a=(0,r.mergeArrays)(a,new Array(e.length).fill(i.Sequence.type_id))):"B"===i.Sequence.id&&(n=(0,r.mergeArrays)(n,t),a=(0,r.mergeArrays)(a,new Array(t.length).fill(i.Sequence.type_id))));return{tokens:n,token_type_ids:a}}}class Z extends H{post_process(e,t=null){return t&&(e=(0,r.mergeArrays)(e,t)),{tokens:e}}}class ee extends H{constructor(e){super(e),this.processors=e.processors.map((e=>H.fromConfig(e)))}post_process(e,t=null,s={}){let o;for(const r of this.processors)if(r instanceof Z){if(e=r.post_process(e).tokens,t){t=r.post_process(t).tokens}}else{const n=r.post_process(e,t,s);e=n.tokens,o=n.token_type_ids}return{tokens:e,token_type_ids:o}}}class te extends o.Callable{constructor(e){super(),this.config=e,this.added_tokens=[],this.end_of_word_suffix=null,this.trim_offsets=e.trim_offsets}static fromConfig(e){if(null===e)return null;switch(e.type){case"WordPiece":return new ae(e);case"Metaspace":return new pe(e);case"ByteLevel":return new ie(e);case"Replace":return new se(e);case"ByteFallback":return new oe(e);case"Fuse":return new re(e);case"Strip":return new ne(e);case"Sequence":return new ce(e);case"CTC":return new le(e);case"BPEDecoder":return new de(e);default:throw new Error(`Unknown Decoder type: ${e.type}`)}}_call(e){return this.decode(e)}decode(e){return this.decode_chain(e).join("")}decode_chain(e){throw Error("`decode_chain` should be implemented in subclass.")}}class se extends te{decode_chain(e){const t=_(this.config.pattern);return null===t?e:e.map((e=>e.replaceAll(t,this.config.content)))}}class oe extends te{constructor(e){super(e),this.text_decoder=new TextDecoder}decode_chain(e){const t=[];let s=[];for(const o of e){let e=null;if(6===o.length&&o.startsWith("<0x")&&o.endsWith(">")){const t=parseInt(o.slice(3,5),16);isNaN(t)||(e=t)}if(null!==e)s.push(e);else{if(s.length>0){const e=this.text_decoder.decode(Uint8Array.from(s));t.push(e),s=[]}t.push(o)}}if(s.length>0){const e=this.text_decoder.decode(Uint8Array.from(s));t.push(e),s=[]}return t}}class re extends te{decode_chain(e){return[e.join("")]}}class ne extends te{constructor(e){super(e),this.content=this.config.content,this.start=this.config.start,this.stop=this.config.stop}decode_chain(e){return e.map((e=>{let t=0;for(let s=0;s<this.start&&e[s]===this.content;++s)t=s+1;let s=e.length;for(let t=0;t<this.stop;++t){const o=e.length-t-1;if(e[o]!==this.content)break;s=o}return e.slice(t,s)}))}}class ae extends te{constructor(e){super(e),this.cleanup=e.cleanup}decode_chain(e){return e.map(((e,t)=>(0!==t&&(e=e.startsWith(this.config.prefix)?e.replace(this.config.prefix,""):" "+e),this.cleanup&&(e=h(e)),e)))}}class ie extends te{constructor(e){super(e),this.byte_decoder=v,this.text_decoder=new TextDecoder("utf-8",{fatal:!1,ignoreBOM:!0}),this.end_of_word_suffix=null}convert_tokens_to_string(e){const t=e.join(""),s=new Uint8Array([...t].map((e=>this.byte_decoder[e])));return this.text_decoder.decode(s)}decode_chain(e){const t=[];let s=[];for(const o of e)void 0!==this.added_tokens.find((e=>e.content===o))?(s.length>0&&(t.push(this.convert_tokens_to_string(s)),s=[]),t.push(o)):s.push(o);return s.length>0&&t.push(this.convert_tokens_to_string(s)),t}}class le extends te{constructor(e){super(e),this.pad_token=this.config.pad_token,this.word_delimiter_token=this.config.word_delimiter_token,this.cleanup=this.config.cleanup}convert_tokens_to_string(e){if(0===e.length)return"";const t=[e[0]];for(let s=1;s<e.length;++s)e[s]!==t.at(-1)&&t.push(e[s]);let s=t.filter((e=>e!==this.pad_token)).join("");return this.cleanup&&(s=h(s).replaceAll(this.word_delimiter_token," ").trim()),s}decode_chain(e){return[this.convert_tokens_to_string(e)]}}class ce extends te{constructor(e){super(e),this.decoders=e.decoders.map((e=>te.fromConfig(e)))}decode_chain(e){return this.decoders.reduce(((e,t)=>t.decode_chain(e)),e)}}class de extends te{constructor(e){super(e),this.suffix=this.config.suffix}decode_chain(e){return e.map(((t,s)=>t.replaceAll(this.suffix,s===e.length-1?"":" ")))}}class ue extends te{decode_chain(e){let t="";for(let s=1;s<e.length;s+=2)t+=e[s];return[t]}}class _e extends q{constructor(e){super(),this.addPrefixSpace=e.add_prefix_space,this.replacement=e.replacement,this.strRep=e.str_rep||this.replacement,this.prepend_scheme=e.prepend_scheme??"always"}pre_tokenize_text(e,{section_index:t}={}){let s=e.replaceAll(" ",this.strRep);return this.addPrefixSpace&&!s.startsWith(this.replacement)&&("always"===this.prepend_scheme||"first"===this.prepend_scheme&&0===t)&&(s=this.strRep+s),[s]}}class pe extends te{constructor(e){super(e),this.addPrefixSpace=e.add_prefix_space,this.replacement=e.replacement}decode_chain(e){const t=[];for(let s=0;s<e.length;++s){let o=e[s].replaceAll(this.replacement," ");this.addPrefixSpace&&0==s&&o.startsWith(" ")&&(o=o.substring(1)),t.push(o)}return t}}class me extends A{constructor(e){super(e),this.charsmap=e.precompiled_charsmap}normalize(e){if((e=(e=e.replace(/[\u0001-\u0008\u000B\u000E-\u001F\u007F\u008F\u009F]/gm,"")).replace(/[\u0009\u000A\u000C\u000D\u00A0\u1680\u2000-\u200F\u2028\u2029\u202F\u205F\u2581\u3000\uFEFF\uFFFD]/gm," ")).includes("~")){const t=e.split("~");e=t.map((e=>e.normalize("NFKC"))).join("~")}else e=e.normalize("NFKC");return e}}class he extends q{constructor(e){super(),this.tokenizers=e.pretokenizers.map((e=>q.fromConfig(e)))}pre_tokenize_text(e,t){return this.tokenizers.reduce(((e,s)=>s.pre_tokenize(e,t)),[e])}}class ge extends q{constructor(e){super()}pre_tokenize_text(e,t){return e.match(/\w+|[^\w\s]+/g)||[]}}class fe extends q{constructor(e){super()}pre_tokenize_text(e,t){return function(e){return e.match(/\S+/g)||[]}(e)}}class Me extends q{constructor(e){super(),this.config=e,this.pattern=_(this.config.pattern),this.content=this.config.content}pre_tokenize_text(e,t){return null===this.pattern?[e]:[e.replaceAll(this.pattern,this.config.content)]}}const we=["bos_token","eos_token","unk_token","sep_token","pad_token","cls_token","mask_token"];function Te(e,t,s,o){for(const n of Object.keys(e)){const a=t-e[n].length,i=s(n),l=new Array(a).fill(i);e[n]="right"===o?(0,r.mergeArrays)(e[n],l):(0,r.mergeArrays)(l,e[n])}}function be(e,t){for(const s of Object.keys(e))e[s].length=t}class xe extends o.Callable{return_token_type_ids=!1;padding_side="right";constructor(e,t){super(),this._tokenizer_config=t,this.normalizer=A.fromConfig(e.normalizer),this.pre_tokenizer=q.fromConfig(e.pre_tokenizer),this.model=P.fromConfig(e.model,t),this.post_processor=H.fromConfig(e.post_processor),this.decoder=te.fromConfig(e.decoder),this.special_tokens=[],this.all_special_ids=[],this.added_tokens=[];for(const t of e.added_tokens){const e=new x(t);this.added_tokens.push(e),this.model.tokens_to_ids.set(e.content,e.id),this.model.vocab[e.id]=e.content,e.special&&(this.special_tokens.push(e.content),this.all_special_ids.push(e.id))}if(this.additional_special_tokens=t.additional_special_tokens??[],this.special_tokens.push(...this.additional_special_tokens),this.special_tokens=[...new Set(this.special_tokens)],this.decoder&&(this.decoder.added_tokens=this.added_tokens,this.decoder.end_of_word_suffix=this.model.end_of_word_suffix),this.added_tokens_regex=this.added_tokens.length>0?new RegExp(this.added_tokens.slice().sort(((e,t)=>t.content.length-e.content.length)).map((e=>`${e.lstrip?"\\s*":""}(${(0,r.escapeRegExp)(e.content)})${e.rstrip?"\\s*":""}`)).join("|")):null,this.mask_token=this.getToken("mask_token"),this.mask_token_id=this.model.tokens_to_ids.get(this.mask_token),this.pad_token=this.getToken("pad_token","eos_token"),this.pad_token_id=this.model.tokens_to_ids.get(this.pad_token),this.sep_token=this.getToken("sep_token"),this.sep_token_id=this.model.tokens_to_ids.get(this.sep_token),this.unk_token=this.getToken("unk_token"),this.unk_token_id=this.model.tokens_to_ids.get(this.unk_token),this.bos_token=this.getToken("bos_token"),this.bos_token_id=this.model.tokens_to_ids.get(this.bos_token),this.eos_token=this.getToken("eos_token"),this.eos_token_id=this.model.tokens_to_ids.get(this.eos_token),this.model_max_length=t.model_max_length,this.remove_space=t.remove_space,this.clean_up_tokenization_spaces=t.clean_up_tokenization_spaces??!0,this.do_lowercase_and_remove_accent=t.do_lowercase_and_remove_accent??!1,t.padding_side&&(this.padding_side=t.padding_side),this.legacy=!1,this.chat_template=t.chat_template??null,Array.isArray(this.chat_template)){const e=Object.create(null);for(const{name:t,template:s}of this.chat_template){if("string"!=typeof t||"string"!=typeof s)throw new Error('Chat template must be a list of objects with "name" and "template" properties');e[t]=s}this.chat_template=e}this._compiled_template_cache=new Map}getToken(...e){for(const t of e){const e=this._tokenizer_config[t];if(e){if("object"==typeof e){if("AddedToken"===e.__type)return e.content;throw Error(`Unknown token: ${e}`)}return e}}return null}static async from_pretrained(e,{progress_callback:t=null,config:s=null,cache_dir:o=null,local_files_only:r=!1,revision:n="main",legacy:a=null}={}){return new this(...await u(e,{progress_callback:t,config:s,cache_dir:o,local_files_only:r,revision:n,legacy:a}))}_call(e,{text_pair:t=null,add_special_tokens:s=!0,padding:o=!1,truncation:r=null,max_length:n=null,return_tensor:l=!0,return_token_type_ids:c=null}={}){const d=Array.isArray(e);let u;if(d){if(0===e.length)throw Error("text array must be non-empty");if(null!==t){if(!Array.isArray(t))throw Error("text_pair must also be an array");if(e.length!==t.length)throw Error("text and text_pair must have the same length");u=e.map(((e,o)=>this._encode_plus(e,{text_pair:t[o],add_special_tokens:s,return_token_type_ids:c})))}else u=e.map((e=>this._encode_plus(e,{add_special_tokens:s,return_token_type_ids:c})))}else{if(null==e)throw Error("text may not be null or undefined");if(Array.isArray(t))throw Error("When specifying `text_pair`, since `text` is a string, `text_pair` must also be a string (i.e., not an array).");u=[this._encode_plus(e,{text_pair:t,add_special_tokens:s,return_token_type_ids:c})]}if(null===n?n="max_length"===o?this.model_max_length:(0,a.max)(u.map((e=>e.input_ids.length)))[0]:r||console.warn("Truncation was not explicitly activated but `max_length` is provided a specific value, please use `truncation=true` to explicitly truncate examples to max length."),n=Math.min(n,this.model_max_length??1/0),o||r)for(let e=0;e<u.length;++e)u[e].input_ids.length!==n&&(u[e].input_ids.length>n?r&&be(u[e],n):o&&Te(u[e],n,(e=>"input_ids"===e?this.pad_token_id:0),this.padding_side));const _={};if(l){if((!o||!r)&&u.some((e=>{for(const t of Object.keys(e))if(e[t].length!==u[0][t]?.length)return!0;return!1})))throw Error("Unable to create tensor, you should probably activate truncation and/or padding with 'padding=true' and 'truncation=true' to have batched tensors with the same length.");const e=[u.length,u[0].input_ids.length];for(const t of Object.keys(u[0]))_[t]=new i.Tensor("int64",BigInt64Array.from(u.flatMap((e=>e[t])).map(BigInt)),e)}else{for(const e of Object.keys(u[0]))_[e]=u.map((t=>t[e]));if(!d)for(const e of Object.keys(_))_[e]=_[e][0]}return _}_encode_text(e){if(null===e)return null;const t=(this.added_tokens_regex?e.split(this.added_tokens_regex).filter((e=>e)):[e]).map(((e,t)=>{if(void 0!==this.added_tokens.find((t=>t.content===e)))return e;{if(!0===this.remove_space&&(e=e.trim().split(/\s+/).join(" ")),this.do_lowercase_and_remove_accent&&(e=function(e){return g(e.toLowerCase())}(e)),null!==this.normalizer&&(e=this.normalizer(e)),0===e.length)return[];const s=null!==this.pre_tokenizer?this.pre_tokenizer(e,{section_index:t}):[e];return this.model(s)}})).flat();return t}_encode_plus(e,{text_pair:t=null,add_special_tokens:s=!0,return_token_type_ids:o=null}={}){const{tokens:r,token_type_ids:n}=this._tokenize_helper(e,{pair:t,add_special_tokens:s}),a=this.model.convert_tokens_to_ids(r),i={input_ids:a,attention_mask:new Array(a.length).fill(1)};return(o??this.return_token_type_ids)&&n&&(i.token_type_ids=n),i}_tokenize_helper(e,{pair:t=null,add_special_tokens:s=!1}={}){const o=this._encode_text(e),n=this._encode_text(t);return this.post_processor?this.post_processor(o,n,{add_special_tokens:s}):{tokens:(0,r.mergeArrays)(o??[],n??[])}}tokenize(e,{pair:t=null,add_special_tokens:s=!1}={}){return this._tokenize_helper(e,{pair:t,add_special_tokens:s}).tokens}encode(e,{text_pair:t=null,add_special_tokens:s=!0,return_token_type_ids:o=null}={}){return this._encode_plus(e,{text_pair:t,add_special_tokens:s,return_token_type_ids:o}).input_ids}batch_decode(e,t={}){return e instanceof i.Tensor&&(e=e.tolist()),e.map((e=>this.decode(e,t)))}decode(e,t={}){if(e instanceof i.Tensor&&(e=m(e)),!Array.isArray(e)||0===e.length||!(0,r.isIntegralNumber)(e[0]))throw Error("token_ids must be a non-empty array of integers.");return this.decode_single(e,t)}decode_single(e,{skip_special_tokens:t=!1,clean_up_tokenization_spaces:s=null}){let o=this.model.convert_ids_to_tokens(e);t&&(o=o.filter((e=>!this.special_tokens.includes(e))));let r=this.decoder?this.decoder(o):o.join(" ");return this.decoder&&this.decoder.end_of_word_suffix&&(r=r.replaceAll(this.decoder.end_of_word_suffix," "),t&&(r=r.trim())),(s??this.clean_up_tokenization_spaces)&&(r=h(r)),r}get_chat_template({chat_template:e=null,tools:t=null}={}){if(this.chat_template&&"object"==typeof this.chat_template){const s=this.chat_template;if(null!==e&&Object.hasOwn(s,e))e=s[e];else if(null===e)if(null!==t&&"tool_use"in s)e=s.tool_use;else{if(!("default"in s))throw Error(`This model has multiple chat templates with no default specified! Please either pass a chat template or the name of the template you wish to use to the 'chat_template' argument. Available template names are ${Object.keys(s).sort()}.`);e=s.default}}else if(null===e){if(!this.chat_template)throw Error("Cannot use apply_chat_template() because tokenizer.chat_template is not set and no template argument was passed! For information about writing templates and setting the tokenizer.chat_template attribute, please see the documentation at https://huggingface.co/docs/transformers/main/en/chat_templating");e=this.chat_template}return e}apply_chat_template(e,{tools:t=null,documents:s=null,chat_template:o=null,add_generation_prompt:r=!1,tokenize:n=!0,padding:a=!1,truncation:i=!1,max_length:l=null,return_tensor:d=!0,return_dict:u=!1,tokenizer_kwargs:_={},...p}={}){if("string"!=typeof(o=this.get_chat_template({chat_template:o,tools:t})))throw Error("chat_template must be a string, but got "+typeof o);let m=this._compiled_template_cache.get(o);void 0===m&&(m=new c.Template(o),this._compiled_template_cache.set(o,m));const h=Object.create(null);for(const e of we){const t=this.getToken(e);t&&(h[e]=t)}const g=m.render({messages:e,add_generation_prompt:r,tools:t,documents:s,...h,...p});if(n){const e=this._call(g,{add_special_tokens:!1,padding:a,truncation:i,max_length:l,return_tensor:d,..._});return u?e:e.input_ids}return g}}class Pe extends xe{return_token_type_ids=!0}class ke extends xe{return_token_type_ids=!0}class Fe extends xe{return_token_type_ids=!0}class ye extends xe{return_token_type_ids=!0}class ve extends xe{return_token_type_ids=!0}class Ce extends xe{return_token_type_ids=!0}class Se extends xe{return_token_type_ids=!0}class Ae extends xe{return_token_type_ids=!0}class Ee extends xe{return_token_type_ids=!0}class Le extends xe{}class Ie extends xe{}class ze extends xe{return_token_type_ids=!0;constructor(e,t){super(e,t),console.warn('WARNING: `XLMTokenizer` is not yet supported by Hugging Face\'s "fast" tokenizers library. Therefore, you may experience slightly inaccurate results.')}}class Ve extends xe{return_token_type_ids=!0}class je extends xe{}class Ne extends xe{}class De extends xe{}class Oe extends xe{constructor(e,t){super(e,t),this.languageRegex=/^[a-z]{2}_[A-Z]{2}$/,this.language_codes=this.special_tokens.filter((e=>this.languageRegex.test(e))),this.lang_to_token=e=>e}_build_translation_inputs(e,t,s){return et(this,e,t,s)}}class Be extends Oe{}class Ge extends xe{}class Re extends xe{}const qe="▁";class We extends xe{padding_side="left";constructor(e,t){super(e,t),this.legacy=t.legacy??!0,this.legacy||(this.normalizer=null,this.pre_tokenizer=new _e({replacement:qe,add_prefix_space:!0,prepend_scheme:"first"}))}_encode_text(e){if(null===e)return null;if(this.legacy||0===e.length)return super._encode_text(e);let t=super._encode_text(qe+e.replaceAll(qe," "));return t.length>1&&t[0]===qe&&this.special_tokens.includes(t[1])&&(t=t.slice(1)),t}}class $e extends xe{}class Ue extends xe{}class Xe extends xe{}class Qe extends xe{}class He extends xe{}class Je extends xe{}class Ye extends xe{}class Ke extends xe{}class Ze extends xe{}function et(e,t,s,o){if(!("language_codes"in e)||!Array.isArray(e.language_codes))throw new Error("Tokenizer must have `language_codes` attribute set and it should be an array of language ids.");if(!("languageRegex"in e&&e.languageRegex instanceof RegExp))throw new Error("Tokenizer must have `languageRegex` attribute set and it should be a regular expression.");if(!("lang_to_token"in e)||"function"!=typeof e.lang_to_token)throw new Error("Tokenizer must have `lang_to_token` attribute set and it should be a function.");const r=o.src_lang,n=o.tgt_lang;if(!e.language_codes.includes(n))throw new Error(`Target language code "${n}" is not valid. Must be one of: {${e.language_codes.join(", ")}}`);if(void 0!==r){if(!e.language_codes.includes(r))throw new Error(`Source language code "${r}" is not valid. Must be one of: {${e.language_codes.join(", ")}}`);for(const t of e.post_processor.config.single)if("SpecialToken"in t&&e.languageRegex.test(t.SpecialToken.id)){t.SpecialToken.id=e.lang_to_token(r);break}}return o.forced_bos_token_id=e.model.convert_tokens_to_ids([e.lang_to_token(n)])[0],e._call(t,s)}class tt extends xe{constructor(e,t){super(e,t),this.languageRegex=/^[a-z]{3}_[A-Z][a-z]{3}$/,this.language_codes=this.special_tokens.filter((e=>this.languageRegex.test(e))),this.lang_to_token=e=>e}_build_translation_inputs(e,t,s){return et(this,e,t,s)}}class st extends xe{constructor(e,t){super(e,t),this.languageRegex=/^__[a-z]{2,3}__$/,this.language_codes=this.special_tokens.filter((e=>this.languageRegex.test(e))).map((e=>e.slice(2,-2))),this.lang_to_token=e=>`__${e}__`}_build_translation_inputs(e,t,s){return et(this,e,t,s)}}class ot extends xe{get timestamp_begin(){return this.model.convert_tokens_to_ids(["<|notimestamps|>"])[0]+1}_decode_asr(e,{return_timestamps:t=!1,return_language:s=!1,time_precision:o=null,force_full_sequences:r=!0}={}){if(null===o)throw Error("Must specify time_precision");let n=null;const i="word"===t;function l(){return{language:n,timestamp:[null,null],text:""}}const c=[];let u=l(),_=0;const p=this.timestamp_begin,m=p+1500;let h=[],g=[],f=!1,M=null;const T=new Set(this.all_special_ids);for(const s of e){const e=s.tokens,r=i?s.token_timestamps:null;let b=null,x=p;if("stride"in s){const[t,r,n]=s.stride;if(_-=r,M=t-n,r&&(x=r/o+p),n)for(let t=e.length-1;t>=0;--t){const s=Number(e[t]);if(s>=p){if(null!==b&&(s-p)*o<M)break;b=s}}}let P=[],k=[];for(let s=0;s<e.length;++s){const M=Number(e[s]);if(T.has(M)){const e=this.decode([M]),s=d.WHISPER_LANGUAGE_MAPPING.get(e.slice(2,-2));if(void 0!==s){if(null!==n&&s!==n&&!t){h.push(P);const e=this.findLongestCommonSequence(h)[0],t=this.decode(e);u.text=t,c.push(u),h=[],P=[],u=l()}n=u.language=s}}else if(M>=p&&M<=m){const e=(M-p)*o+_,t=(0,a.round)(e,2);if(null!==b&&M>=b)f=!0;else if(f||h.length>0&&M<x)f=!1;else if(null===u.timestamp[0])u.timestamp[0]=t;else if(t===u.timestamp[0]);else{u.timestamp[1]=t,h.push(P),i&&g.push(k);const[e,s]=this.findLongestCommonSequence(h,g),o=this.decode(e);u.text=o,i&&(u.words=this.collateWordTimestamps(e,s,n)),c.push(u),h=[],P=[],g=[],k=[],u=l()}}else if(P.push(M),i){let e,t=(0,a.round)(r[s]+_,2);if(s+1<r.length){e=(0,a.round)(r[s+1]+_,2);const n=this.decode([M]);w.test(n)&&(e=(0,a.round)(Math.min(t+o,e),2))}else e=null;k.push([t,e])}}if("stride"in s){const[e,t,o]=s.stride;_+=e-o}P.length>0?(h.push(P),i&&g.push(k)):h.every((e=>0===e.length))&&(u=l(),h=[],P=[],g=[],k=[])}if(h.length>0){if(r&&t)throw new Error("Whisper did not predict an ending timestamp, which can happen if audio is cut off in the middle of a word. Also make sure WhisperTimeStampLogitsProcessor was used during generation.");const[e,s]=this.findLongestCommonSequence(h,g),o=this.decode(e);u.text=o,i&&(u.words=this.collateWordTimestamps(e,s,n)),c.push(u)}let b=Object.create(null);const x=c.map((e=>e.text)).join("");if(t||s){for(let e=0;e<c.length;++e){const o=c[e];t||delete o.timestamp,s||delete o.language}if(i){const e=[];for(const t of c)for(const s of t.words)e.push(s);b={chunks:e}}else b={chunks:c}}return[x,b]}findLongestCommonSequence(e,t=null){let s=e[0],o=s.length,r=[];const n=Array.isArray(t)&&t.length>0;let a=n?[]:null,i=n?t[0]:null;for(let l=1;l<e.length;++l){const c=e[l];let d=0,u=[o,o,0,0];const _=c.length;for(let e=1;e<o+_;++e){const r=Math.max(0,o-e),a=Math.min(o,o+_-e),p=s.slice(r,a),m=Math.max(0,e-o),h=Math.min(_,e),g=c.slice(m,h);if(p.length!==g.length)throw new Error("There is a bug within whisper `decode_asr` function, please report it. Dropping to prevent bad inference.");let f;f=n?p.filter(((e,s)=>e===g[s]&&i[r+s]<=t[l][m+s])).length:p.filter(((e,t)=>e===g[t])).length;const M=f/e+e/1e4;f>1&&M>d&&(d=M,u=[r,a,m,h])}const[p,m,h,g]=u,f=Math.floor((m+p)/2),M=Math.floor((g+h)/2);r.push(...s.slice(0,f)),s=c.slice(M),o=s.length,n&&(a.push(...i.slice(0,f)),i=t[l].slice(M))}return r.push(...s),n?(a.push(...i),[r,a]):[r,[]]}collateWordTimestamps(e,t,s){const[o,r,n]=this.combineTokensIntoWords(e,s),a=[];for(let e=0;e<o.length;++e){const s=n[e];a.push({text:o[e],timestamp:[t[s.at(0)][0],t[s.at(-1)][1]]})}return a}combineTokensIntoWords(e,t,s="\"'“¡¿([{-",o="\"'.。,,!!??::”)]}、"){let r,n,a;return["chinese","japanese","thai","lao","myanmar"].includes(t=t??"english")?[r,n,a]=this.splitTokensOnUnicode(e):[r,n,a]=this.splitTokensOnSpaces(e),this.mergePunctuations(r,n,a,s,o)}decode(e,t){let s;return t?.decode_with_timestamps?(e instanceof i.Tensor&&(e=m(e)),s=this.decodeWithTimestamps(e,t)):s=super.decode(e,t),s}decodeWithTimestamps(e,t){const s=t?.time_precision??.02,o=Array.from(this.all_special_ids).at(-1)+1;let r=[[]];for(let t of e)if(t=Number(t),t>=o){const e=((t-o)*s).toFixed(2);r.push(`<|${e}|>`),r.push([])}else r[r.length-1].push(t);return r=r.map((e=>"string"==typeof e?e:super.decode(e,t))),r.join("")}splitTokensOnUnicode(e){const t=this.decode(e,{decode_with_timestamps:!0}),s=[],o=[],r=[];let n=[],a=[],i=0;for(let l=0;l<e.length;++l){const c=e[l];n.push(c),a.push(l);const d=this.decode(n,{decode_with_timestamps:!0});d.includes("�")&&"�"!==t[i+d.indexOf("�")]||(s.push(d),o.push(n),r.push(a),n=[],a=[],i+=d.length)}return[s,o,r]}splitTokensOnSpaces(e){const[t,s,o]=this.splitTokensOnUnicode(e),r=[],n=[],a=[],i=new RegExp(`^[${M}]$`,"gu");for(let e=0;e<t.length;++e){const l=t[e],c=s[e],d=o[e],u=c[0]>=this.model.tokens_to_ids.get("<|endoftext|>"),_=l.startsWith(" "),p=l.trim(),m=i.test(p);if(u||_||m||0===r.length)r.push(l),n.push(c),a.push(d);else{const e=r.length-1;r[e]+=l,n[e].push(...c),a[e].push(...d)}}return[r,n,a]}mergePunctuations(e,t,s,o,n){const a=structuredClone(e),i=structuredClone(t),l=structuredClone(s);let c=a.length-2,d=a.length-1;for(;c>=0;)a[c].startsWith(" ")&&o.includes(a[c].trim())?(a[d]=a[c]+a[d],i[d]=(0,r.mergeArrays)(i[c],i[d]),l[d]=(0,r.mergeArrays)(l[c],l[d]),a[c]="",i[c]=[],l[c]=[]):d=c,--c;for(c=0,d=1;d<a.length;)!a[c].endsWith(" ")&&n.includes(a[d])?(a[c]+=a[d],i[c]=(0,r.mergeArrays)(i[c],i[d]),l[c]=(0,r.mergeArrays)(l[c],l[d]),a[d]="",i[d]=[],l[d]=[]):c=d,++d;return[a.filter((e=>e)),i.filter((e=>e.length>0)),l.filter((e=>e.length>0))]}}class rt extends xe{}class nt extends xe{}class at extends xe{}class it extends xe{constructor(e,t){super(e,t),this.languageRegex=/^(>>\w+<<)\s*/g,this.supported_language_codes=this.model.vocab.filter((e=>this.languageRegex.test(e))),console.warn('WARNING: `MarianTokenizer` is not yet supported by Hugging Face\'s "fast" tokenizers library. Therefore, you may experience slightly inaccurate results.')}_encode_text(e){if(null===e)return null;const[t,...s]=e.trim().split(this.languageRegex);if(0===s.length)return super._encode_text(t);if(2===s.length){const[e,t]=s;return this.supported_language_codes.includes(e)||console.warn(`Unsupported language code "${e}" detected, which may lead to unexpected behavior. Should be one of: ${JSON.stringify(this.supported_language_codes)}`),(0,r.mergeArrays)([e],super._encode_text(t))}}}class lt extends xe{}class ct extends xe{}class dt extends xe{}class ut extends xe{}class _t extends xe{}class pt extends xe{constructor(e,t){super(e,t),this.decoder=new ue({})}}class mt extends xe{}class ht extends xe{}class gt{static TOKENIZER_CLASS_MAPPING={T5Tokenizer:je,DistilBertTokenizer:Le,CamembertTokenizer:Ie,DebertaTokenizer:ve,DebertaV2Tokenizer:Ce,BertTokenizer:Pe,HerbertTokenizer:Se,ConvBertTokenizer:Ae,RoFormerTokenizer:Ee,XLMTokenizer:ze,ElectraTokenizer:Ve,MobileBertTokenizer:Fe,SqueezeBertTokenizer:ye,AlbertTokenizer:ke,GPT2Tokenizer:Ne,BartTokenizer:De,MBartTokenizer:Oe,MBart50Tokenizer:Be,RobertaTokenizer:Ge,WhisperTokenizer:ot,CodeGenTokenizer:rt,CLIPTokenizer:nt,SiglipTokenizer:at,MarianTokenizer:it,BloomTokenizer:Re,NllbTokenizer:tt,M2M100Tokenizer:st,LlamaTokenizer:We,CodeLlamaTokenizer:$e,XLMRobertaTokenizer:Ue,MPNetTokenizer:Xe,FalconTokenizer:Qe,GPTNeoXTokenizer:He,EsmTokenizer:Je,Wav2Vec2CTCTokenizer:lt,BlenderbotTokenizer:ct,BlenderbotSmallTokenizer:dt,SpeechT5Tokenizer:ut,NougatTokenizer:_t,VitsTokenizer:pt,Qwen2Tokenizer:Ye,GemmaTokenizer:Ke,Grok1Tokenizer:Ze,CohereTokenizer:mt,MgpstrTokenizer:ht,PreTrainedTokenizer:xe};static async from_pretrained(e,{progress_callback:t=null,config:s=null,cache_dir:o=null,local_files_only:r=!1,revision:n="main",legacy:a=null}={}){const[i,l]=await u(e,{progress_callback:t,config:s,cache_dir:o,local_files_only:r,revision:n,legacy:a}),c=l.tokenizer_class?.replace(/Fast$/,"")??"PreTrainedTokenizer";let d=this.TOKENIZER_CLASS_MAPPING[c];return d||(console.warn(`Unknown tokenizer class "${c}", attempting to construct from base class.`),d=xe),new d(i,l)}}},"./src/utils/audio.js":(e,t,s)=>{s.r(t),s.d(t,{RawAudio:()=>x,hamming:()=>_,hanning:()=>u,mel_filter_bank:()=>f,read_audio:()=>c,spectrogram:()=>w,window_function:()=>T});var o=s("./src/utils/hub.js"),r=s("./src/utils/maths.js"),n=s("./src/utils/core.js"),a=s("./src/env.js"),i=s("fs"),l=s("./src/utils/tensor.js");async function c(e,t){if("undefined"==typeof AudioContext)throw Error("Unable to load audio from path/URL since `AudioContext` is not available in your environment. Instead, audio data should be passed directly to the pipeline/processor. For more information and some example code, see https://huggingface.co/docs/transformers.js/guides/node-audio-processing.");const s=await(await(0,o.getFile)(e)).arrayBuffer(),r=new AudioContext({sampleRate:t});void 0===t&&console.warn(`No sampling rate provided, using default of ${r.sampleRate}Hz.`);const n=await r.decodeAudioData(s);let a;if(2===n.numberOfChannels){const e=Math.sqrt(2),t=n.getChannelData(0),s=n.getChannelData(1);a=new Float32Array(t.length);for(let o=0;o<n.length;++o)a[o]=e*(t[o]+s[o])/2}else a=n.getChannelData(0);return a}function d(e,t){if(e<1)return new Float64Array;if(1===e)return new Float64Array([1]);const s=1-t,o=2*Math.PI/(e-1),r=new Float64Array(e);for(let n=0;n<e;++n)r[n]=t-s*Math.cos(n*o);return r}function u(e){return d(e,.5)}function _(e){return d(e,.54)}const p={htk:e=>2595*Math.log10(1+e/700),kaldi:e=>1127*Math.log(1+e/700),slaney:(e,t=1e3,s=15,o=27/Math.log(6.4))=>e>=t?s+Math.log(e/t)*o:3*e/200};function m(e,t="htk"){const s=p[t];if(!s)throw new Error('mel_scale should be one of "htk", "slaney" or "kaldi".');return"number"==typeof e?s(e):e.map((e=>s(e)))}const h={htk:e=>700*(10**(e/2595)-1),kaldi:e=>700*(Math.exp(e/1127)-1),slaney:(e,t=1e3,s=15,o=Math.log(6.4)/27)=>e>=s?t*Math.exp(o*(e-s)):200*e/3};function g(e,t,s){const o=(t-e)/(s-1);return Float64Array.from({length:s},((t,s)=>e+o*s))}function f(e,t,s,o,r,n=null,a="htk",i=!1){if(null!==n&&"slaney"!==n)throw new Error('norm must be one of null or "slaney"');const l=g(m(s,a),m(o,a),t+2);let c,d=function(e,t="htk"){const s=h[t];if(!s)throw new Error('mel_scale should be one of "htk", "slaney" or "kaldi".');return"number"==typeof e?s(e):e.map((e=>s(e)))}(l,a);if(i){const t=r/(2*e);c=m(Float64Array.from({length:e},((e,s)=>s*t)),a),d=l}else c=g(0,Math.floor(r/2),e);const u=function(e,t){const s=Float64Array.from({length:t.length-1},((e,s)=>t[s+1]-t[s])),o=Array.from({length:e.length},(()=>new Array(t.length)));for(let s=0;s<e.length;++s){const r=o[s];for(let o=0;o<t.length;++o)r[o]=t[o]-e[s]}const r=t.length-2,n=Array.from({length:r},(()=>new Array(e.length)));for(let t=0;t<e.length;++t){const e=o[t];for(let o=0;o<r;++o){const r=-e[o]/s[o],a=e[o+2]/s[o+1];n[o][t]=Math.max(0,Math.min(r,a))}}return n}(c,d);if(null!==n&&"slaney"===n)for(let s=0;s<t;++s){const t=u[s],o=2/(d[s+2]-d[s]);for(let s=0;s<e;++s)t[s]*=o}return u}function M(e,t,s,o,n){if(s<=0)throw new Error("reference must be greater than zero");if(o<=0)throw new Error("min_value must be greater than zero");s=Math.max(o,s);const a=Math.log10(s);for(let s=0;s<e.length;++s)e[s]=t*Math.log10(Math.max(o,e[s])-a);if(null!==n){if(n<=0)throw new Error("db_range must be greater than zero");const t=(0,r.max)(e)[0]-n;for(let s=0;s<e.length;++s)e[s]=Math.max(e[s],t)}return e}async function w(e,t,s,o,{fft_length:a=null,power:i=1,center:c=!0,pad_mode:d="reflect",onesided:u=!0,preemphasis:_=null,mel_filters:p=null,mel_floor:m=1e-10,log_mel:h=null,reference:g=1,min_value:f=1e-10,db_range:w=null,remove_dc_offset:T=null,min_num_frames:b=null,max_num_frames:x=null,do_pad:P=!0,transpose:k=!1}={}){const F=t.length;if(null===a&&(a=s),s>a)throw Error(`frame_length (${s}) may not be larger than fft_length (${a})`);if(F!==s)throw new Error(`Length of the window (${F}) must equal frame_length (${s})`);if(o<=0)throw new Error("hop_length must be greater than zero");if(null===i&&null!==p)throw new Error("You have provided `mel_filters` but `power` is `None`. Mel spectrogram computation is not yet supported for complex-valued spectrogram. Specify `power` to fix this issue.");if(c){if("reflect"!==d)throw new Error(`pad_mode="${d}" not implemented yet.`);const t=Math.floor((a-1)/2)+1;e=function(e,t,s){const o=new e.constructor(e.length+t+s),r=e.length-1;for(let s=0;s<e.length;++s)o[t+s]=e[s];for(let s=1;s<=t;++s)o[t-s]=e[(0,n.calculateReflectOffset)(s,r)];for(let a=1;a<=s;++a)o[r+t+a]=e[(0,n.calculateReflectOffset)(r-a,r)];return o}(e,t,t)}let y=Math.floor(1+Math.floor((e.length-s)/o));null!==b&&y<b&&(y=b);const v=u?Math.floor(a/2)+1:a;let C=y,S=y;null!==x&&(x>y?P&&(S=x):S=C=x);const A=new r.FFT(a),E=new Float64Array(a),L=new Float64Array(A.outputBufferSize),I=new Float32Array(v*S);for(let r=0;r<C;++r){const n=r*o,a=Math.min(e.length-n,s);a!==s&&E.fill(0,0,s);for(let t=0;t<a;++t)E[t]=e[n+t];if(T){let e=0;for(let t=0;t<a;++t)e+=E[t];const t=e/a;for(let e=0;e<a;++e)E[e]-=t}if(null!==_){for(let e=a-1;e>=1;--e)E[e]-=_*E[e-1];E[0]*=1-_}for(let e=0;e<t.length;++e)E[e]*=t[e];A.realTransform(L,E);for(let e=0;e<v;++e){const t=e<<1;I[e*S+r]=L[t]**2+L[t+1]**2}}if(null!==i&&2!==i){const e=2/i;for(let t=0;t<I.length;++t)I[t]**=e}const z=p.length;let V=await(0,l.matmul)(new l.Tensor("float32",p.flat(),[z,v]),new l.Tensor("float32",I,[v,S]));k&&(V=V.transpose(1,0));const j=V.data;for(let e=0;e<j.length;++e)j[e]=Math.max(m,j[e]);if(null!==i&&null!==h){const e=Math.min(j.length,C*z);switch(h){case"log":for(let t=0;t<e;++t)j[t]=Math.log(j[t]);break;case"log10":for(let t=0;t<e;++t)j[t]=Math.log10(j[t]);break;case"dB":if(1===i)!function(e,t=1,s=1e-5,o=null){M(e,20,t,s,o)}(j,g,f,w);else{if(2!==i)throw new Error(`Cannot use log_mel option '${h}' with power ${i}`);!function(e,t=1,s=1e-10,o=null){M(e,10,t,s,o)}(j,g,f,w)}break;default:throw new Error(`log_mel must be one of null, 'log', 'log10' or 'dB'. Got '${h}'`)}}return V}function T(e,t,{periodic:s=!0,frame_length:o=null,center:r=!0}={}){const n=s?e+1:e;let a;switch(t){case"boxcar":a=new Float64Array(n).fill(1);break;case"hann":case"hann_window":a=u(n);break;case"hamming":a=_(n);break;case"povey":a=u(n).map((e=>Math.pow(e,.85)));break;default:throw new Error(`Unknown window type ${t}.`)}if(s&&(a=a.subarray(0,e)),null===o)return a;if(e>o)throw new Error(`Length of the window (${e}) may not be larger than frame_length (${o})`);return a}function b(e,t,s){for(let o=0;o<s.length;++o)e.setUint8(t+o,s.charCodeAt(o))}class x{constructor(e,t){this.audio=e,this.sampling_rate=t}toWav(){return function(e,t){let s=44;const o=new ArrayBuffer(s+4*e.length),r=new DataView(o);b(r,0,"RIFF"),r.setUint32(4,36+4*e.length,!0),b(r,8,"WAVE"),b(r,12,"fmt "),r.setUint32(16,16,!0),r.setUint16(20,3,!0),r.setUint16(22,1,!0),r.setUint32(24,t,!0),r.setUint32(28,4*t,!0),r.setUint16(32,4,!0),r.setUint16(34,32,!0),b(r,36,"data"),r.setUint32(40,4*e.length,!0);for(let t=0;t<e.length;++t,s+=4)r.setFloat32(s,e[t],!0);return o}(this.audio,this.sampling_rate)}toBlob(){const e=this.toWav();return new Blob([e],{type:"audio/wav"})}async save(e){let t;if(a.apis.IS_BROWSER_ENV){if(a.apis.IS_WEBWORKER_ENV)throw new Error("Unable to save a file from a Web Worker.");t=n.saveBlob}else{if(!a.apis.IS_FS_AVAILABLE)throw new Error("Unable to save because filesystem is disabled in this environment.");t=async(e,t)=>{let s=await t.arrayBuffer();i.default.writeFileSync(e,Buffer.from(s))}}await t(e,this.toBlob())}}},"./src/utils/constants.js":(e,t,s)=>{s.r(t),s.d(t,{CHAT_TEMPLATE_NAME:()=>l,CONFIG_NAME:()=>r,FEATURE_EXTRACTOR_NAME:()=>n,GENERATION_CONFIG_NAME:()=>c,GITHUB_ISSUE_URL:()=>o,IMAGE_PROCESSOR_NAME:()=>a,PROCESSOR_NAME:()=>i});const o="https://github.com/huggingface/transformers.js/issues/new/choose",r="config.json",n="preprocessor_config.json",a=n,i="processor_config.json",l="chat_template.json",c="generation_config.json"},"./src/utils/core.js":(e,t,s)=>{function o(e,t){e&&e(t)}function r(e){return Object.fromEntries(Object.entries(e).map((([e,t])=>[t,e])))}function n(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function a(e){return"TypedArray"===e?.prototype?.__proto__?.constructor?.name}function i(e){return Number.isInteger(e)||"bigint"==typeof e}function l(e){return null==e||-1===e}function c(e){const t=[];let s=e;for(;Array.isArray(s);)t.push(s.length),s=s[0];return t}function d(e,t,s=void 0){const o=e[t];if(void 0!==o)return delete e[t],o;if(void 0===s)throw Error(`Key ${t} does not exist in object.`);return s}function u(...e){return Array.prototype.concat.apply([],e)}function _(...e){return e.reduce(((e,t)=>e.flatMap((e=>t.map((t=>[e,t]))))))}function p(e,t){return Math.abs((e+t)%(2*t)-t)}function m(e,t){const s=URL.createObjectURL(t),o=document.createElement("a");o.href=s,o.download=e,o.click(),o.remove(),URL.revokeObjectURL(s)}function h(e,t){return Object.assign({},...t.map((t=>{if(void 0!==e[t])return{[t]:e[t]}})))}function g(e){let t=0;for(const s of e)++t;return t}function f(e,t){let s=0;for(const o of e)o===t&&++s;return s}s.r(t),s.d(t,{calculateDimensions:()=>c,calculateReflectOffset:()=>p,count:()=>f,dispatchCallback:()=>o,escapeRegExp:()=>n,isIntegralNumber:()=>i,isNullishDimension:()=>l,isTypedArray:()=>a,len:()=>g,mergeArrays:()=>u,pick:()=>h,pop:()=>d,product:()=>_,reverseDictionary:()=>r,saveBlob:()=>m})},"./src/utils/data-structures.js":(e,t,s)=>{s.r(t),s.d(t,{CharTrie:()=>r,PriorityQueue:()=>o,TokenLattice:()=>a});class o{constructor(e=(e,t)=>e>t,t=1/0){this._heap=[],this._comparator=e,this._maxSize=t}get size(){return this._heap.length}isEmpty(){return 0===this.size}peek(){return this._heap[0]}push(...e){return this.extend(e)}extend(e){for(const t of e)if(this.size<this._maxSize)this._heap.push(t),this._siftUp();else{const e=this._smallest();this._comparator(t,this._heap[e])&&(this._heap[e]=t,this._siftUpFrom(e))}return this.size}pop(){const e=this.peek(),t=this.size-1;return t>0&&this._swap(0,t),this._heap.pop(),this._siftDown(),e}replace(e){const t=this.peek();return this._heap[0]=e,this._siftDown(),t}_parent(e){return(e+1>>>1)-1}_left(e){return 1+(e<<1)}_right(e){return e+1<<1}_greater(e,t){return this._comparator(this._heap[e],this._heap[t])}_swap(e,t){const s=this._heap[e];this._heap[e]=this._heap[t],this._heap[t]=s}_siftUp(){this._siftUpFrom(this.size-1)}_siftUpFrom(e){for(;e>0&&this._greater(e,this._parent(e));)this._swap(e,this._parent(e)),e=this._parent(e)}_siftDown(){let e=0;for(;this._left(e)<this.size&&this._greater(this._left(e),e)||this._right(e)<this.size&&this._greater(this._right(e),e);){const t=this._right(e)<this.size&&this._greater(this._right(e),this._left(e))?this._right(e):this._left(e);this._swap(e,t),e=t}}_smallest(){return 2**Math.floor(Math.log2(this.size))-1}}class r{constructor(){this.root=n.default()}extend(e){for(const t of e)this.push(t)}push(e){let t=this.root;for(const s of e){let e=t.children.get(s);void 0===e&&(e=n.default(),t.children.set(s,e)),t=e}t.isLeaf=!0}*commonPrefixSearch(e){let t=this.root;if(void 0===t)return;let s="";for(const o of e){if(s+=o,t=t.children.get(o),void 0===t)return;t.isLeaf&&(yield s)}}}class n{constructor(e,t){this.isLeaf=e,this.children=t}static default(){return new n(!1,new Map)}}class a{constructor(e,t,s){this.chars=Array.from(e),this.len=this.chars.length,this.bosTokenId=t,this.eosTokenId=s,this.nodes=[],this.beginNodes=Array.from({length:this.len+1},(()=>[])),this.endNodes=Array.from({length:this.len+1},(()=>[]));const o=new i(this.bosTokenId,0,0,0,0),r=new i(this.eosTokenId,1,this.len,0,0);this.nodes.push(o.clone()),this.nodes.push(r.clone()),this.beginNodes[this.len].push(r),this.endNodes[0].push(o)}insert(e,t,s,o){const r=this.nodes.length,n=new i(o,r,e,t,s);this.beginNodes[e].push(n),this.endNodes[e+t].push(n),this.nodes.push(n)}viterbi(){const e=this.len;let t=0;for(;t<=e;){if(0==this.beginNodes[t].length)return[];for(let e of this.beginNodes[t]){e.prev=null;let s=0,o=null;for(let r of this.endNodes[t]){const t=r.backtraceScore+e.score;(null===o||t>s)&&(o=r.clone(),s=t)}if(null===o)return[];e.prev=o,e.backtraceScore=s}++t}const s=[],o=this.beginNodes[e][0].prev;if(null===o)return[];let r=o.clone();for(;null!==r.prev;){s.push(r.clone());const e=r.clone();r=e.prev.clone()}return s.reverse(),s}piece(e){return this.chars.slice(e.pos,e.pos+e.length).join("")}tokens(){return this.viterbi().map((e=>this.piece(e)))}tokenIds(){return this.viterbi().map((e=>e.tokenId))}}class i{constructor(e,t,s,o,r){this.tokenId=e,this.nodeId=t,this.pos=s,this.length=o,this.score=r,this.prev=null,this.backtraceScore=0}clone(){const e=new i(this.tokenId,this.nodeId,this.pos,this.length,this.score);return e.prev=this.prev,e.backtraceScore=this.backtraceScore,e}}},"./src/utils/devices.js":(e,t,s)=>{s.r(t),s.d(t,{DEVICE_TYPES:()=>o});const o=Object.freeze({auto:"auto",gpu:"gpu",cpu:"cpu",wasm:"wasm",webgpu:"webgpu",cuda:"cuda",dml:"dml",webnn:"webnn","webnn-npu":"webnn-npu","webnn-gpu":"webnn-gpu","webnn-cpu":"webnn-cpu"})},"./src/utils/dtypes.js":(e,t,s)=>{s.r(t),s.d(t,{DATA_TYPES:()=>a,DEFAULT_DEVICE_DTYPE_MAPPING:()=>i,DEFAULT_DTYPE_SUFFIX_MAPPING:()=>l,isWebGpuFp16Supported:()=>n});var o=s("./src/env.js"),r=s("./src/utils/devices.js");const n=function(){let e;return async function(){if(void 0===e)if(o.apis.IS_WEBGPU_AVAILABLE)try{const t=await navigator.gpu.requestAdapter();e=t.features.has("shader-f16")}catch(t){e=!1}else e=!1;return e}}(),a=Object.freeze({auto:"auto",fp32:"fp32",fp16:"fp16",q8:"q8",int8:"int8",uint8:"uint8",q4:"q4",bnb4:"bnb4",q4f16:"q4f16"}),i=Object.freeze({[r.DEVICE_TYPES.wasm]:a.q8}),l=Object.freeze({[a.fp32]:"",[a.fp16]:"_fp16",[a.int8]:"_int8",[a.uint8]:"_uint8",[a.q8]:"_quantized",[a.q4]:"_q4",[a.q4f16]:"_q4f16",[a.bnb4]:"_bnb4"})},"./src/utils/generic.js":(e,t,s)=>{s.r(t),s.d(t,{Callable:()=>o});const o=class{constructor(){let e=function(...t){return e._call(...t)};return Object.setPrototypeOf(e,new.target.prototype)}_call(...e){throw Error("Must implement _call method in subclass")}}},"./src/utils/hub.js":(e,t,s)=>{s.r(t),s.d(t,{MAX_EXTERNAL_DATA_CHUNKS:()=>i,getFile:()=>u,getModelFile:()=>m,getModelJSON:()=>h});var o=s("fs"),r=s("path"),n=s("./src/env.js"),a=s("./src/utils/core.js");const i=100,l={txt:"text/plain",html:"text/html",css:"text/css",js:"text/javascript",json:"application/json",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif"};class c{constructor(e){if(this.filePath=e,this.headers=new Headers,this.exists=o.default.existsSync(e),this.exists){this.status=200,this.statusText="OK";let t=o.default.statSync(e);this.headers.set("content-length",t.size.toString()),this.updateContentType();const s=o.default.createReadStream(e);this.body=new ReadableStream({start(e){s.on("data",(t=>e.enqueue(t))),s.on("end",(()=>e.close())),s.on("error",(t=>e.error(t)))},cancel(){s.destroy()}})}else this.status=404,this.statusText="Not Found",this.body=null}updateContentType(){const e=this.filePath.toString().split(".").pop().toLowerCase();this.headers.set("content-type",l[e]??"application/octet-stream")}clone(){let e=new c(this.filePath);return e.exists=this.exists,e.status=this.status,e.statusText=this.statusText,e.headers=new Headers(this.headers),e}async arrayBuffer(){return(await o.default.promises.readFile(this.filePath)).buffer}async blob(){const e=await o.default.promises.readFile(this.filePath);return new Blob([e],{type:this.headers.get("content-type")})}async text(){return await o.default.promises.readFile(this.filePath,"utf8")}async json(){return JSON.parse(await this.text())}}function d(e,t=null,s=null){let o;try{o=new URL(e)}catch(e){return!1}return!(t&&!t.includes(o.protocol))&&!(s&&!s.includes(o.hostname))}async function u(e){if(n.env.useFS&&!d(e,["http:","https:","blob:"]))return new c(e.toString());if("undefined"!=typeof process&&"node"===process?.release?.name){const t=!!process.env?.TESTING_REMOTELY,s=n.env.version,o=new Headers;o.set("User-Agent",`transformers.js/${s}; is_ci/${t};`);if(d(e,["http:","https:"],["huggingface.co","hf.co"])){const e=process.env?.HF_TOKEN??process.env?.HF_ACCESS_TOKEN;e&&o.set("Authorization",`Bearer ${e}`)}return fetch(e,{headers:o})}return fetch(e)}const _={400:"Bad request error occurred while trying to load file",401:"Unauthorized access to file",403:"Forbidden access to file",404:"Could not locate file",408:"Request timeout error occurred while trying to load file",500:"Internal server error error occurred while trying to load file",502:"Bad gateway error occurred while trying to load file",503:"Service unavailable error occurred while trying to load file",504:"Gateway timeout error occurred while trying to load file"};class p{constructor(e){this.path=e}async match(e){let t=r.default.join(this.path,e),s=new c(t);return s.exists?s:void 0}async put(e,t,s=void 0){let n=r.default.join(this.path,e);try{const e=t.headers.get("Content-Length"),a=parseInt(e??"0");let i=0;await o.default.promises.mkdir(r.default.dirname(n),{recursive:!0});const l=o.default.createWriteStream(n),c=t.body.getReader();for(;;){const{done:e,value:t}=await c.read();if(e)break;await new Promise(((e,s)=>{l.write(t,(t=>{t?s(t):e()}))})),i+=t.length;const o=a?i/a*100:0;s?.({progress:o,loaded:i,total:a})}l.close()}catch(e){try{await o.default.promises.unlink(n)}catch{}throw e}}}async function m(e,t,s=!0,o={},r=!1){if(!n.env.allowLocalModels){if(o.local_files_only)throw Error("Invalid configuration detected: local models are disabled (`env.allowLocalModels=false`) but you have requested to only use local models (`local_files_only=true`).");if(!n.env.allowRemoteModels)throw Error("Invalid configuration detected: both local and remote models are disabled. Fix by setting `env.allowLocalModels` or `env.allowRemoteModels` to `true`.")}let i;if((0,a.dispatchCallback)(o.progress_callback,{status:"initiate",name:e,file:t}),!i&&n.env.useBrowserCache){if("undefined"==typeof caches)throw Error("Browser cache is not available in this environment.");try{i=await caches.open("transformers-cache")}catch(e){console.warn("An error occurred while opening the browser cache:",e)}}if(!i&&n.env.useFSCache&&(i=new p(o.cache_dir??n.env.cacheDir)),!i&&n.env.useCustomCache){if(!n.env.customCache)throw Error("`env.useCustomCache=true`, but `env.customCache` is not defined.");if(!n.env.customCache.match||!n.env.customCache.put)throw new Error("`env.customCache` must be an object which implements the `match` and `put` functions of the Web Cache API. For more information, see https://developer.mozilla.org/en-US/docs/Web/API/Cache");i=n.env.customCache}const l=o.revision??"main";let m,h,f=g(e,t),M=g(n.env.localModelPath,f),w=f,T=g(n.env.remoteHost,n.env.remotePathTemplate.replaceAll("{model}",e).replaceAll("{revision}",encodeURIComponent(l)),t),b="main"===l?f:g(e,l,t),x=i instanceof p?b:T,P=!1;i&&(h=await async function(e,...t){for(let s of t)try{let t=await e.match(s);if(t)return t}catch(e){continue}}(i,M,x));const k=void 0!==h;if(void 0===h){if(n.env.allowLocalModels){if(d(f,["http:","https:"])){if(o.local_files_only)throw new Error(`\`local_files_only=true\`, but attempted to load a remote file from: ${w}.`);if(!n.env.allowRemoteModels)throw new Error(`\`env.allowRemoteModels=false\`, but attempted to load a remote file from: ${w}.`)}else try{h=await u(w),m=w}catch(e){console.warn(`Unable to load from local path "${w}": "${e}"`)}}if(void 0===h||404===h.status){if(o.local_files_only||!n.env.allowRemoteModels){if(s)throw Error(`\`local_files_only=true\` or \`env.allowRemoteModels=false\` and file was not found locally at "${w}".`);return null}if(h=await u(T),200!==h.status)return function(e,t,s){if(!s)return null;const o=_[e]??`Error (${e}) occurred while trying to load file`;throw Error(`${o}: "${t}".`)}(h.status,T,s);m=x}P=i&&"undefined"!=typeof Response&&h instanceof Response&&200===h.status}let F;if((0,a.dispatchCallback)(o.progress_callback,{status:"download",name:e,file:t}),!n.apis.IS_NODE_ENV||!r){let s;o.progress_callback?k&&"undefined"!=typeof navigator&&/firefox/i.test(navigator.userAgent)?(s=new Uint8Array(await h.arrayBuffer()),(0,a.dispatchCallback)(o.progress_callback,{status:"progress",name:e,file:t,progress:100,loaded:s.length,total:s.length})):s=await async function(e,t){const s=e.headers.get("Content-Length");null===s&&console.warn("Unable to determine content-length from response headers. Will expand buffer when needed.");let o=parseInt(s??"0"),r=new Uint8Array(o),n=0;const a=e.body.getReader();async function i(){const{done:e,value:s}=await a.read();if(e)return;const l=n+s.length;if(l>o){o=l;const e=new Uint8Array(o);e.set(r),r=e}r.set(s,n),n=l;return t({progress:n/o*100,loaded:n,total:o}),i()}return await i(),r}(h,(s=>{(0,a.dispatchCallback)(o.progress_callback,{status:"progress",name:e,file:t,...s})})):s=new Uint8Array(await h.arrayBuffer()),F=s}if(P&&m&&void 0===await i.match(m)&&(F?await i.put(m,new Response(F,{headers:h.headers})).catch((e=>{console.warn(`Unable to add response to browser cache: ${e}.`)})):await i.put(m,h,o.progress_callback)),(0,a.dispatchCallback)(o.progress_callback,{status:"done",name:e,file:t}),F){if(r)throw new Error("Cannot return path in a browser environment.");return F}if(h instanceof c)return h.filePath;const y=await i.match(m);if(y instanceof c)return y.filePath;throw new Error("Unable to return path for response.")}async function h(e,t,s=!0,o={}){const r=await m(e,t,s,o,!1);if(null===r)return{};const n=new TextDecoder("utf-8").decode(r);return JSON.parse(n)}function g(...e){return(e=e.map(((t,s)=>(s&&(t=t.replace(new RegExp("^/"),"")),s!==e.length-1&&(t=t.replace(new RegExp("/$"),"")),t)))).join("/")}},"./src/utils/image.js":(e,t,s)=>{s.r(t),s.d(t,{RawImage:()=>m,load_image:()=>h});var o=s("./src/utils/core.js"),r=s("./src/utils/hub.js"),n=s("./src/env.js"),a=s("./src/utils/tensor.js"),i=s("sharp");let l,c,d;const u=n.apis.IS_BROWSER_ENV||n.apis.IS_WEBWORKER_ENV;if(u)l=(e,t)=>{if(!self.OffscreenCanvas)throw new Error("OffscreenCanvas not supported by this browser.");return new self.OffscreenCanvas(e,t)},d=self.createImageBitmap,c=self.ImageData;else{if(!i.default)throw new Error("Unable to load image processing library.");d=async e=>{const t=(await e.metadata()).channels,{data:s,info:o}=await e.rotate().raw().toBuffer({resolveWithObject:!0}),r=new m(new Uint8ClampedArray(s),o.width,o.height,o.channels);return void 0!==t&&t!==o.channels&&r.convert(t),r}}const _={0:"nearest",1:"lanczos",2:"bilinear",3:"bicubic",4:"box",5:"hamming"},p=new Map([["png","image/png"],["jpg","image/jpeg"],["jpeg","image/jpeg"],["gif","image/gif"]]);class m{constructor(e,t,s,o){this.data=e,this.width=t,this.height=s,this.channels=o}get size(){return[this.width,this.height]}static async read(e){if(e instanceof m)return e;if("string"==typeof e||e instanceof URL)return await this.fromURL(e);throw new Error("Unsupported input type: "+typeof e)}static fromCanvas(e){if(!u)throw new Error("fromCanvas() is only supported in browser environments.");const t=e.getContext("2d").getImageData(0,0,e.width,e.height).data;return new m(t,e.width,e.height,4)}static async fromURL(e){const t=await(0,r.getFile)(e);if(200!==t.status)throw new Error(`Unable to read image from "${e}" (${t.status} ${t.statusText})`);const s=await t.blob();return this.fromBlob(s)}static async fromBlob(e){if(u){const t=await d(e),s=l(t.width,t.height).getContext("2d");return s.drawImage(t,0,0),new this(s.getImageData(0,0,t.width,t.height).data,t.width,t.height,4)}{const t=(0,i.default)(await e.arrayBuffer());return await d(t)}}static fromTensor(e,t="CHW"){if(3!==e.dims.length)throw new Error(`Tensor should have 3 dimensions, but has ${e.dims.length} dimensions.`);if("CHW"===t)e=e.transpose(1,2,0);else if("HWC"!==t)throw new Error(`Unsupported channel format: ${t}`);if(!(e.data instanceof Uint8ClampedArray||e.data instanceof Uint8Array))throw new Error(`Unsupported tensor type: ${e.type}`);switch(e.dims[2]){case 1:case 2:case 3:case 4:return new m(e.data,e.dims[1],e.dims[0],e.dims[2]);default:throw new Error(`Unsupported number of channels: ${e.dims[2]}`)}}grayscale(){if(1===this.channels)return this;const e=new Uint8ClampedArray(this.width*this.height*1);switch(this.channels){case 3:case 4:for(let t=0,s=0;t<this.data.length;t+=this.channels){const o=this.data[t],r=this.data[t+1],n=this.data[t+2];e[s++]=Math.round(.2989*o+.587*r+.114*n)}break;default:throw new Error(`Conversion failed due to unsupported number of channels: ${this.channels}`)}return this._update(e,this.width,this.height,1)}rgb(){if(3===this.channels)return this;const e=new Uint8ClampedArray(this.width*this.height*3);switch(this.channels){case 1:for(let t=0,s=0;t<this.data.length;++t)e[s++]=this.data[t],e[s++]=this.data[t],e[s++]=this.data[t];break;case 4:for(let t=0,s=0;t<this.data.length;t+=4)e[s++]=this.data[t],e[s++]=this.data[t+1],e[s++]=this.data[t+2];break;default:throw new Error(`Conversion failed due to unsupported number of channels: ${this.channels}`)}return this._update(e,this.width,this.height,3)}rgba(){if(4===this.channels)return this;const e=new Uint8ClampedArray(this.width*this.height*4);switch(this.channels){case 1:for(let t=0,s=0;t<this.data.length;++t)e[s++]=this.data[t],e[s++]=this.data[t],e[s++]=this.data[t],e[s++]=255;break;case 3:for(let t=0,s=0;t<this.data.length;t+=3)e[s++]=this.data[t],e[s++]=this.data[t+1],e[s++]=this.data[t+2],e[s++]=255;break;default:throw new Error(`Conversion failed due to unsupported number of channels: ${this.channels}`)}return this._update(e,this.width,this.height,4)}putAlpha(e){if(e.width!==this.width||e.height!==this.height)throw new Error(`Expected mask size to be ${this.width}x${this.height}, but got ${e.width}x${e.height}`);if(1!==e.channels)throw new Error(`Expected mask to have 1 channel, but got ${e.channels}`);const t=this.data,s=e.data,o=this.width*this.height;if(3===this.channels){const e=new Uint8ClampedArray(4*o);for(let r=0,n=0,a=0;r<o;++r)e[a++]=t[n++],e[a++]=t[n++],e[a++]=t[n++],e[a++]=s[r];return this._update(e,this.width,this.height,4)}if(4===this.channels){for(let e=0;e<o;++e)t[4*e+3]=s[e];return this}throw new Error(`Expected image to have 3 or 4 channels, but got ${this.channels}`)}async resize(e,t,{resample:s=2}={}){if(this.width===e&&this.height===t)return this;let r=_[s]??s;const n=(0,o.isNullishDimension)(e),a=(0,o.isNullishDimension)(t);if(n&&a)return this;if(n?e=t/this.height*this.width:a&&(t=e/this.width*this.height),u){const s=this.channels,o=this.toCanvas(),r=l(e,t).getContext("2d");r.drawImage(o,0,0,e,t);return new m(r.getImageData(0,0,e,t).data,e,t,4).convert(s)}{let s=this.toSharp();switch(r){case"box":case"hamming":"box"!==r&&"hamming"!==r||(console.warn(`Resampling method ${r} is not yet supported. Using bilinear instead.`),r="bilinear");case"nearest":case"bilinear":case"bicubic":s=s.affine([e/this.width,0,0,t/this.height],{interpolator:r});break;case"lanczos":s=s.resize({width:e,height:t,fit:"fill",kernel:"lanczos3"});break;default:throw new Error(`Resampling method ${r} is not supported.`)}return await d(s)}}async pad([e,t,s,o]){if(e=Math.max(e,0),t=Math.max(t,0),s=Math.max(s,0),o=Math.max(o,0),0===e&&0===t&&0===s&&0===o)return this;if(u){const r=this.channels,n=this.toCanvas(),a=this.width+e+t,i=this.height+s+o,c=l(a,i).getContext("2d");c.drawImage(n,0,0,this.width,this.height,e,s,this.width,this.height);return new m(c.getImageData(0,0,a,i).data,a,i,4).convert(r)}{const r=this.toSharp().extend({left:e,right:t,top:s,bottom:o});return await d(r)}}async crop([e,t,s,o]){if(e=Math.max(e,0),t=Math.max(t,0),s=Math.min(s,this.width-1),o=Math.min(o,this.height-1),0===e&&0===t&&s===this.width-1&&o===this.height-1)return this;const r=s-e+1,n=o-t+1;if(u){const s=this.channels,o=this.toCanvas(),a=l(r,n).getContext("2d");a.drawImage(o,e,t,r,n,0,0,r,n);return new m(a.getImageData(0,0,r,n).data,r,n,4).convert(s)}{const s=this.toSharp().extract({left:e,top:t,width:r,height:n});return await d(s)}}async center_crop(e,t){if(this.width===e&&this.height===t)return this;const s=(this.width-e)/2,o=(this.height-t)/2;if(u){const r=this.channels,n=this.toCanvas(),a=l(e,t).getContext("2d");let i=0,c=0,d=0,u=0;s>=0?i=s:d=-s,o>=0?c=o:u=-o,a.drawImage(n,i,c,e,t,d,u,e,t);return new m(a.getImageData(0,0,e,t).data,e,t,4).convert(r)}{let r=this.toSharp();if(s>=0&&o>=0)r=r.extract({left:Math.floor(s),top:Math.floor(o),width:e,height:t});else if(s<=0&&o<=0){const n=Math.floor(-o),a=Math.floor(-s);r=r.extend({top:n,left:a,right:e-this.width-a,bottom:t-this.height-n})}else{let n=[0,0],a=0;o<0?(n[0]=Math.floor(-o),n[1]=t-this.height-n[0]):a=Math.floor(o);let i=[0,0],l=0;s<0?(i[0]=Math.floor(-s),i[1]=e-this.width-i[0]):l=Math.floor(s),r=r.extend({top:n[0],bottom:n[1],left:i[0],right:i[1]}).extract({left:l,top:a,width:e,height:t})}return await d(r)}}async toBlob(e="image/png",t=1){if(!u)throw new Error("toBlob() is only supported in browser environments.");const s=this.toCanvas();return await s.convertToBlob({type:e,quality:t})}toTensor(e="CHW"){let t=new a.Tensor("uint8",new Uint8Array(this.data),[this.height,this.width,this.channels]);if("HWC"===e);else{if("CHW"!==e)throw new Error(`Unsupported channel format: ${e}`);t=t.permute(2,0,1)}return t}toCanvas(){if(!u)throw new Error("toCanvas() is only supported in browser environments.");const e=this.clone().rgba(),t=l(e.width,e.height),s=new c(e.data,e.width,e.height);return t.getContext("2d").putImageData(s,0,0),t}split(){const{data:e,width:t,height:s,channels:o}=this,r=e.constructor,n=e.length/o,a=Array.from({length:o},(()=>new r(n)));for(let t=0;t<n;++t){const s=o*t;for(let r=0;r<o;++r)a[r][t]=e[s+r]}return a.map((e=>new m(e,t,s,1)))}_update(e,t,s,o=null){return this.data=e,this.width=t,this.height=s,null!==o&&(this.channels=o),this}clone(){return new m(this.data.slice(),this.width,this.height,this.channels)}convert(e){if(this.channels===e)return this;switch(e){case 1:this.grayscale();break;case 3:this.rgb();break;case 4:this.rgba();break;default:throw new Error(`Conversion failed due to unsupported number of channels: ${this.channels}`)}return this}async save(e){if(!u){if(n.apis.IS_FS_AVAILABLE){const t=this.toSharp();return await t.toFile(e)}throw new Error("Unable to save the image because filesystem is disabled in this environment.")}{if(n.apis.IS_WEBWORKER_ENV)throw new Error("Unable to save an image from a Web Worker.");const t=e.split(".").pop().toLowerCase(),s=p.get(t)??"image/png",r=await this.toBlob(s);(0,o.saveBlob)(e,r)}}toSharp(){if(u)throw new Error("toSharp() is only supported in server-side environments.");return(0,i.default)(this.data,{raw:{width:this.width,height:this.height,channels:this.channels}})}}const h=m.read.bind(m)},"./src/utils/maths.js":(e,t,s)=>{function o(e,[t,s,o],[r,n],a="bilinear",i=!1){const l=n/o,c=r/s,d=new e.constructor(r*n*t),u=s*o,_=r*n;for(let a=0;a<r;++a)for(let r=0;r<n;++r){const i=a*n+r,p=(r+.5)/l-.5,m=(a+.5)/c-.5;let h=Math.floor(p),g=Math.floor(m);const f=Math.min(h+1,o-1),M=Math.min(g+1,s-1);h=Math.max(h,0),g=Math.max(g,0);const w=p-h,T=m-g,b=(1-w)*(1-T),x=w*(1-T),P=(1-w)*T,k=w*T,F=g*o,y=M*o,v=F+h,C=F+f,S=y+h,A=y+f;for(let s=0;s<t;++s){const t=s*u;d[s*_+i]=b*e[t+v]+x*e[t+C]+P*e[t+S]+k*e[t+A]}}return d}function r(e,t,s){const o=new Array(s.length),r=new Array(s.length);for(let e=s.length-1,n=1;e>=0;--e)r[e]=n,o[e]=t[s[e]],n*=o[e];const n=s.map(((e,t)=>r[s.indexOf(t)])),a=new e.constructor(e.length);for(let s=0;s<e.length;++s){let o=0;for(let e=t.length-1,r=s;e>=0;--e)o+=r%t[e]*n[e],r=Math.floor(r/t[e]);a[o]=e[s]}return[a,o]}function n(e){const t=u(e)[0],s=e.map((e=>Math.exp(e-t))),o=s.reduce(((e,t)=>e+t),0);return s.map((e=>e/o))}function a(e){const t=u(e)[0];let s=0;for(let o=0;o<e.length;++o)s+=Math.exp(e[o]-t);const o=Math.log(s);return e.map((e=>e-t-o))}function i(e,t){let s=0;for(let o=0;o<e.length;++o)s+=e[o]*t[o];return s}function l(e,t){return i(e,t)/(c(e)*c(t))}function c(e){return Math.sqrt(e.reduce(((e,t)=>e+t*t),0))}function d(e){if(0===e.length)throw Error("Array must not be empty");let t=e[0],s=0;for(let o=1;o<e.length;++o)e[o]<t&&(t=e[o],s=o);return[t,s]}function u(e){if(0===e.length)throw Error("Array must not be empty");let t=e[0],s=0;for(let o=1;o<e.length;++o)e[o]>t&&(t=e[o],s=o);return[t,s]}function _(e){return e>0&&!(e&e-1)}s.r(t),s.d(t,{FFT:()=>h,bankers_round:()=>M,cos_sim:()=>l,dot:()=>i,dynamic_time_warping:()=>w,interpolate_data:()=>o,log_softmax:()=>a,magnitude:()=>c,max:()=>u,medianFilter:()=>g,min:()=>d,permute_data:()=>r,round:()=>f,softmax:()=>n});class p{constructor(e){if(this.size=0|e,this.size<=1||!_(this.size))throw new Error("FFT size must be a power of two larger than 1");this._csize=e<<1,this.table=new Float64Array(2*this.size);for(let e=0;e<this.table.length;e+=2){const t=Math.PI*e/this.size;this.table[e]=Math.cos(t),this.table[e+1]=-Math.sin(t)}let t=0;for(let e=1;this.size>e;e<<=1)++t;this._width=t%2==0?t-1:t,this._bitrev=new Int32Array(1<<this._width);for(let e=0;e<this._bitrev.length;++e){this._bitrev[e]=0;for(let t=0;t<this._width;t+=2){const s=this._width-t-2;this._bitrev[e]|=(e>>>t&3)<<s}}}createComplexArray(){return new Float64Array(this._csize)}fromComplexArray(e,t){const s=t||new Array(e.length>>>1);for(let t=0;t<e.length;t+=2)s[t>>>1]=e[t];return s}toComplexArray(e,t){const s=t||this.createComplexArray();for(let t=0;t<s.length;t+=2)s[t]=e[t>>>1],s[t+1]=0;return s}transform(e,t){if(e===t)throw new Error("Input and output buffers must be different");this._transform4(e,t,1)}realTransform(e,t){if(e===t)throw new Error("Input and output buffers must be different");this._realTransform4(e,t,1)}inverseTransform(e,t){if(e===t)throw new Error("Input and output buffers must be different");this._transform4(e,t,-1);for(let t=0;t<e.length;++t)e[t]/=this.size}_transform4(e,t,s){const o=this._csize;let r,n,a=1<<this._width,i=o/a<<1;const l=this._bitrev;if(4===i)for(r=0,n=0;r<o;r+=i,++n){const s=l[n];this._singleTransform2(t,e,r,s,a)}else for(r=0,n=0;r<o;r+=i,++n){const o=l[n];this._singleTransform4(t,e,r,o,a,s)}const c=this.table;for(a>>=2;a>=2;a>>=2){i=o/a<<1;const t=i>>>2;for(r=0;r<o;r+=i){const o=r+t-1;for(let n=r,i=0;n<o;n+=2,i+=a){const o=n,r=o+t,a=r+t,l=a+t,d=e[o],u=e[o+1],_=e[r],p=e[r+1],m=e[a],h=e[a+1],g=e[l],f=e[l+1],M=c[i],w=s*c[i+1],T=_*M-p*w,b=_*w+p*M,x=c[2*i],P=s*c[2*i+1],k=m*x-h*P,F=m*P+h*x,y=c[3*i],v=s*c[3*i+1],C=g*y-f*v,S=g*v+f*y,A=d+k,E=u+F,L=d-k,I=u-F,z=T+C,V=b+S,j=s*(T-C),N=s*(b-S);e[o]=A+z,e[o+1]=E+V,e[r]=L+N,e[r+1]=I-j,e[a]=A-z,e[a+1]=E-V,e[l]=L-N,e[l+1]=I+j}}}}_singleTransform2(e,t,s,o,r){const n=e[o],a=e[o+1],i=e[o+r],l=e[o+r+1];t[s]=n+i,t[s+1]=a+l,t[s+2]=n-i,t[s+3]=a-l}_singleTransform4(e,t,s,o,r,n){const a=2*r,i=3*r,l=e[o],c=e[o+1],d=e[o+r],u=e[o+r+1],_=e[o+a],p=e[o+a+1],m=e[o+i],h=e[o+i+1],g=l+_,f=c+p,M=l-_,w=c-p,T=d+m,b=u+h,x=n*(d-m),P=n*(u-h);t[s]=g+T,t[s+1]=f+b,t[s+2]=M+P,t[s+3]=w-x,t[s+4]=g-T,t[s+5]=f-b,t[s+6]=M-P,t[s+7]=w+x}_realTransform4(e,t,s){const o=this._csize;let r,n,a=1<<this._width,i=o/a<<1;const l=this._bitrev;if(4===i)for(r=0,n=0;r<o;r+=i,++n){const s=l[n];this._singleRealTransform2(t,e,r,s>>>1,a>>>1)}else for(r=0,n=0;r<o;r+=i,++n){const o=l[n];this._singleRealTransform4(t,e,r,o>>>1,a>>>1,s)}const c=this.table;for(a>>=2;a>=2;a>>=2){i=o/a<<1;const t=i>>>1,n=t>>>1,l=n>>>1;for(r=0;r<o;r+=i)for(let o=0,i=0;o<=l;o+=2,i+=a){const a=r+o,d=a+n,u=d+n,_=u+n,p=e[a],m=e[a+1],h=e[d],g=e[d+1],f=e[u],M=e[u+1],w=e[_],T=e[_+1],b=p,x=m,P=c[i],k=s*c[i+1],F=h*P-g*k,y=h*k+g*P,v=c[2*i],C=s*c[2*i+1],S=f*v-M*C,A=f*C+M*v,E=c[3*i],L=s*c[3*i+1],I=w*E-T*L,z=w*L+T*E,V=b+S,j=x+A,N=b-S,D=x-A,O=F+I,B=y+z,G=s*(F-I),R=s*(y-z);if(e[a]=V+O,e[a+1]=j+B,e[d]=N+R,e[d+1]=D-G,0===o){e[u]=V-O,e[u+1]=j-B;continue}if(o===l)continue;const q=r+n-o,W=r+t-o;e[q]=N-s*R,e[q+1]=-D-s*G,e[W]=V-s*O,e[W+1]=s*B-j}}const d=o>>>1;for(let t=2;t<d;t+=2)e[o-t]=e[t],e[o-t+1]=-e[t+1]}_singleRealTransform2(e,t,s,o,r){const n=e[o],a=e[o+r];t[s]=n+a,t[s+1]=0,t[s+2]=n-a,t[s+3]=0}_singleRealTransform4(e,t,s,o,r,n){const a=2*r,i=3*r,l=e[o],c=e[o+r],d=e[o+a],u=e[o+i],_=l+d,p=l-d,m=c+u,h=n*(c-u);t[s]=_+m,t[s+1]=0,t[s+2]=p,t[s+3]=-h,t[s+4]=_-m,t[s+5]=0,t[s+6]=p,t[s+7]=h}}class m{constructor(e){const t=2*(e-1),s=2*(2*e-1),o=2**Math.ceil(Math.log2(s));this.bufferSize=o,this._a=t;const r=new Float64Array(s),n=new Float64Array(o);this._chirpBuffer=new Float64Array(o),this._buffer1=new Float64Array(o),this._buffer2=new Float64Array(o),this._outBuffer1=new Float64Array(o),this._outBuffer2=new Float64Array(o);const a=-2*Math.PI/e,i=Math.cos(a),l=Math.sin(a);for(let t=0;t<s>>1;++t){const s=(t+1-e)**2/2,o=Math.sqrt(i**2+l**2)**s,a=s*Math.atan2(l,i),c=2*t;r[c]=o*Math.cos(a),r[c+1]=o*Math.sin(a),n[c]=r[c],n[c+1]=-r[c+1]}this._slicedChirpBuffer=r.subarray(t,s),this._f=new p(o>>1),this._f.transform(this._chirpBuffer,n)}_transform(e,t,s){const o=this._buffer1,r=this._buffer2,n=this._outBuffer1,a=this._outBuffer2,i=this._chirpBuffer,l=this._slicedChirpBuffer,c=this._a;if(s)for(let e=0;e<l.length;e+=2){const s=e+1,r=t[e>>1];o[e]=r*l[e],o[s]=r*l[s]}else for(let e=0;e<l.length;e+=2){const s=e+1;o[e]=t[e]*l[e]-t[s]*l[s],o[s]=t[e]*l[s]+t[s]*l[e]}this._f.transform(n,o);for(let e=0;e<i.length;e+=2){const t=e+1;r[e]=n[e]*i[e]-n[t]*i[t],r[t]=n[e]*i[t]+n[t]*i[e]}this._f.inverseTransform(a,r);for(let t=0;t<a.length;t+=2){const s=a[t+c],o=a[t+c+1],r=l[t],n=l[t+1];e[t]=s*r-o*n,e[t+1]=s*n+o*r}}transform(e,t){this._transform(e,t,!1)}realTransform(e,t){this._transform(e,t,!0)}}class h{constructor(e){this.fft_length=e,this.isPowerOfTwo=_(e),this.isPowerOfTwo?(this.fft=new p(e),this.outputBufferSize=2*e):(this.fft=new m(e),this.outputBufferSize=this.fft.bufferSize)}realTransform(e,t){this.fft.realTransform(e,t)}transform(e,t){this.fft.transform(e,t)}}function g(e,t){if(t%2==0||t<=0)throw new Error("Window size must be a positive odd number");const s=new e.constructor(e.length),o=new e.constructor(t),r=Math.floor(t/2);for(let t=0;t<e.length;++t){let n=0;for(let s=-r;s<=r;++s){let r=t+s;r<0?r=Math.abs(r):r>=e.length&&(r=2*(e.length-1)-r),o[n++]=e[r]}o.sort(),s[t]=o[r]}return s}function f(e,t){const s=Math.pow(10,t);return Math.round(e*s)/s}function M(e){const t=Math.round(e);return Math.abs(e)%1==.5?t%2==0?t:t-1:t}function w(e){const t=e.length,s=e[0].length,o=[t+1,s+1],r=Array.from({length:o[0]},(()=>Array(o[1]).fill(1/0)));r[0][0]=0;const n=Array.from({length:o[0]},(()=>Array(o[1]).fill(-1)));for(let t=1;t<o[1];++t)for(let s=1;s<o[0];++s){const o=r[s-1][t-1],a=r[s-1][t],i=r[s][t-1];let l,c;o<a&&o<i?(l=o,c=0):a<o&&a<i?(l=a,c=1):(l=i,c=2),r[s][t]=e[s-1][t-1]+l,n[s][t]=c}for(let e=0;e<o[1];++e)n[0][e]=2;for(let e=0;e<o[0];++e)n[e][0]=1;let a=t,i=s,l=[],c=[];for(;a>0||i>0;)switch(l.push(a-1),c.push(i-1),n[a][i]){case 0:--a,--i;break;case 1:--a;break;case 2:--i;break;default:throw new Error(`Internal error in dynamic time warping. Unexpected trace[${a}, ${i}]. Please file a bug report.`)}return l.reverse(),c.reverse(),[l,c]}},"./src/utils/tensor.js":(e,t,s)=>{s.r(t),s.d(t,{DataTypeMap:()=>a,Tensor:()=>i,cat:()=>b,full:()=>v,full_like:()=>C,interpolate:()=>c,interpolate_4d:()=>d,layer_norm:()=>f,matmul:()=>u,mean:()=>F,mean_pooling:()=>g,ones:()=>S,ones_like:()=>A,permute:()=>l,quantize_embeddings:()=>z,rand:()=>I,rfft:()=>_,slice:()=>h,stack:()=>x,std_mean:()=>k,topk:()=>p,zeros:()=>E,zeros_like:()=>L});var o=s("./src/utils/maths.js"),r=s("./src/backends/onnx.js"),n=s("./src/ops/registry.js");const a=Object.freeze({float32:Float32Array,float16:"undefined"!=typeof Float16Array?Float16Array:Uint16Array,float64:Float64Array,string:Array,int8:Int8Array,uint8:Uint8Array,int16:Int16Array,uint16:Uint16Array,int32:Int32Array,uint32:Uint32Array,int64:BigInt64Array,uint64:BigUint64Array,bool:Uint8Array,uint4:Uint8Array,int4:Int8Array});class i{get dims(){return this.ort_tensor.dims}set dims(e){this.ort_tensor.dims=e}get type(){return this.ort_tensor.type}get data(){return this.ort_tensor.data}get size(){return this.ort_tensor.size}get location(){return this.ort_tensor.location}ort_tensor;constructor(...e){return(0,r.isONNXTensor)(e[0])?this.ort_tensor=e[0]:this.ort_tensor=new r.Tensor(e[0],e[1],e[2]),new Proxy(this,{get:(e,t)=>{if("string"==typeof t){let s=Number(t);if(Number.isInteger(s))return e._getitem(s)}return e[t]},set:(e,t,s)=>e[t]=s})}dispose(){this.ort_tensor.dispose()}*[Symbol.iterator](){const[e,...t]=this.dims;if(t.length>0){const s=t.reduce(((e,t)=>e*t));for(let o=0;o<e;++o)yield this._subarray(o,s,t)}else yield*this.data}_getitem(e){const[t,...s]=this.dims;if(e=T(e,t),s.length>0){const t=s.reduce(((e,t)=>e*t));return this._subarray(e,t,s)}return new i(this.type,[this.data[e]],s)}indexOf(e){const t=this.data;for(let s=0;s<t.length;++s)if(t[s]==e)return s;return-1}_subarray(e,t,s){const o=e*t,r=(e+1)*t,n="subarray"in this.data?this.data.subarray(o,r):this.data.slice(o,r);return new i(this.type,n,s)}item(){const e=this.data;if(1!==e.length)throw new Error(`a Tensor with ${e.length} elements cannot be converted to Scalar`);return e[0]}tolist(){return function(e,t){const s=e.length,o=t.reduce(((e,t)=>e*t));if(s!==o)throw Error(`cannot reshape array of size ${s} into shape (${t})`);let r=e;for(let e=t.length-1;e>=0;e--)r=r.reduce(((s,o)=>{let r=s[s.length-1];return r.length<t[e]?r.push(o):s.push([o]),s}),[[]]);return r[0]}(this.data,this.dims)}sigmoid(){return this.clone().sigmoid_()}sigmoid_(){const e=this.data;for(let t=0;t<e.length;++t)e[t]=1/(1+Math.exp(-e[t]));return this}map(e){return this.clone().map_(e)}map_(e){const t=this.data;for(let s=0;s<t.length;++s)t[s]=e(t[s],s,t);return this}mul(e){return this.clone().mul_(e)}mul_(e){const t=this.data;for(let s=0;s<t.length;++s)t[s]*=e;return this}div(e){return this.clone().div_(e)}div_(e){const t=this.data;for(let s=0;s<t.length;++s)t[s]/=e;return this}add(e){return this.clone().add_(e)}add_(e){const t=this.data;for(let s=0;s<t.length;++s)t[s]+=e;return this}sub(e){return this.clone().sub_(e)}sub_(e){const t=this.data;for(let s=0;s<t.length;++s)t[s]-=e;return this}clone(){return new i(this.type,this.data.slice(),this.dims.slice())}slice(...e){const t=[],s=[];for(let o=0;o<this.dims.length;++o){let r=e[o];if(null==r)s.push([0,this.dims[o]]),t.push(this.dims[o]);else if("number"==typeof r)r=T(r,this.dims[o],o),s.push([r,r+1]);else{if(!Array.isArray(r)||2!==r.length)throw new Error(`Invalid slice: ${r}`);{let[e,n]=r;if(e=null===e?0:T(e,this.dims[o],o,!1),n=null===n?this.dims[o]:T(n,this.dims[o],o,!1),e>n)throw new Error(`Invalid slice: ${r}`);const a=[Math.max(e,0),Math.min(n,this.dims[o])];s.push(a),t.push(a[1]-a[0])}}}const o=s.map((([e,t])=>t-e)),r=o.reduce(((e,t)=>e*t)),n=this.data,a=new n.constructor(r),l=this.stride();for(let e=0;e<r;++e){let t=0;for(let r=o.length-1,n=e;r>=0;--r){const e=o[r];t+=(n%e+s[r][0])*l[r],n=Math.floor(n/e)}a[e]=n[t]}return new i(this.type,a,t)}permute(...e){return l(this,e)}transpose(...e){return this.permute(...e)}sum(e=null,t=!1){return this.norm(1,e,t)}norm(e="fro",t=null,s=!1){if("fro"===e)e=2;else if("string"==typeof e)throw Error(`Unsupported norm: ${e}`);const o=this.data,r=(t,s)=>t+s**e;if(null===t){const t=o.reduce(r,0)**(1/e);return new i(this.type,[t],[])}const[n,a,l]=P(r,this,t,s);if(1!==e)for(let t=0;t<a.length;++t)a[t]=a[t]**(1/e);return new i(n,a,l)}normalize_(e=2,t=1){t=T(t,this.dims.length);const s=this.norm(e,t,!0),o=this.data,r=s.data;for(let e=0;e<o.length;++e){let s=0;for(let o=this.dims.length-1,r=e,n=1;o>=0;--o){const e=this.dims[o];if(o!==t){s+=r%e*n,n*=this.dims[o]}r=Math.floor(r/e)}o[e]/=r[s]}return this}normalize(e=2,t=1){return this.clone().normalize_(e,t)}stride(){return function(e){const t=new Array(e.length);for(let s=e.length-1,o=1;s>=0;--s)t[s]=o,o*=e[s];return t}(this.dims)}squeeze(e=null){return new i(this.type,this.data,M(this.dims,e))}squeeze_(e=null){return this.dims=M(this.dims,e),this}unsqueeze(e=null){return new i(this.type,this.data,w(this.dims,e))}unsqueeze_(e=null){return this.dims=w(this.dims,e),this}flatten_(e=0,t=-1){t=(t+this.dims.length)%this.dims.length;let s=this.dims.slice(0,e),o=this.dims.slice(e,t+1),r=this.dims.slice(t+1);return this.dims=[...s,o.reduce(((e,t)=>e*t),1),...r],this}flatten(e=0,t=-1){return this.clone().flatten_(e,t)}view(...e){let t=-1;for(let s=0;s<e.length;++s)if(-1===e[s]){if(-1!==t)throw new Error("Only one dimension can be inferred");t=s}const s=this.data;if(-1!==t){const o=e.reduce(((e,s,o)=>o!==t?e*s:e),1);e[t]=s.length/o}return new i(this.type,s,e)}neg_(){const e=this.data;for(let t=0;t<e.length;++t)e[t]=-e[t];return this}neg(){return this.clone().neg_()}gt(e){const t=new Uint8Array(this.data.length),s=this.data;for(let o=0;o<s.length;++o)t[o]=s[o]>e?1:0;return new i("bool",t,this.dims)}lt(e){const t=new Uint8Array(this.data.length),s=this.data;for(let o=0;o<s.length;++o)t[o]=s[o]<e?1:0;return new i("bool",t,this.dims)}clamp_(e,t){const s=this.data;for(let o=0;o<s.length;++o)s[o]=Math.min(Math.max(s[o],e),t);return this}clamp(e,t){return this.clone().clamp_(e,t)}round_(){const e=this.data;for(let t=0;t<e.length;++t)e[t]=Math.round(e[t]);return this}round(){return this.clone().round_()}mean(e=null,t=!1){return F(this,e,t)}min(e=null,t=!1){if(null===e){const e=(0,o.min)(this.data)[0];return new i(this.type,[e],[])}const[s,r,n]=P(((e,t)=>Math.min(e,t)),this,e,t,1/0);return new i(s,r,n)}max(e=null,t=!1){if(null===e){const e=(0,o.max)(this.data)[0];return new i(this.type,[e],[])}const[s,r,n]=P(((e,t)=>Math.max(e,t)),this,e,t,-1/0);return new i(s,r,n)}argmin(e=null,t=!1){if(null!==e)throw new Error("`dim !== null` not yet implemented.");const s=(0,o.min)(this.data)[1];return new i("int64",[BigInt(s)],[])}argmax(e=null,t=!1){if(null!==e)throw new Error("`dim !== null` not yet implemented.");const s=(0,o.max)(this.data)[1];return new i("int64",[BigInt(s)],[])}to(e){if(this.type===e)return this;if(!a.hasOwnProperty(e))throw new Error(`Unsupported type: ${e}`);let t;const s=["int64","uint64"].includes(this.type),o=["int64","uint64"].includes(e);return s&&!o?t=Number:!s&&o&&(t=BigInt),new i(e,a[e].from(this.data,t),this.dims)}}function l(e,t){const[s,r]=(0,o.permute_data)(e.data,e.dims,t);return new i(e.type,s,r)}function c(e,[t,s],r="bilinear",n=!1){const a=e.dims.at(-3)??1,l=e.dims.at(-2),c=e.dims.at(-1);let d=(0,o.interpolate_data)(e.data,[a,l,c],[t,s],r,n);return new i(e.type,d,[a,t,s])}async function d(e,{size:t=null,mode:s="bilinear"}={}){if(4!==e.dims.length)throw new Error("`interpolate_4d` currently only supports 4D input.");if(!t)throw new Error("`interpolate_4d` requires a `size` argument.");let o,r;if(2===t.length)o=[...e.dims.slice(0,2),...t];else if(3===t.length)o=[e.dims[0],...t];else{if(4!==t.length)throw new Error("`size` must be of length 2, 3, or 4.");o=t}if("nearest"===s)r=await n.TensorOpRegistry.nearest_interpolate_4d;else if("bilinear"===s)r=await n.TensorOpRegistry.bilinear_interpolate_4d;else{if("bicubic"!==s)throw new Error(`Unsupported mode: ${s}`);r=await n.TensorOpRegistry.bicubic_interpolate_4d}const a=new i("int64",new BigInt64Array(o.map(BigInt)),[o.length]);return await r({x:e,s:a})}async function u(e,t){const s=await n.TensorOpRegistry.matmul;return await s({a:e,b:t})}async function _(e,t){const s=await n.TensorOpRegistry.rfft;return await s({x:e,a:t})}async function p(e,t){const s=await n.TensorOpRegistry.top_k;return t=null==t?e.dims.at(-1):Math.min(t,e.dims.at(-1)),await s({x:e,k:new i("int64",[BigInt(t)],[1])})}const m=e=>new i("int64",e,[e.length]);async function h(e,t,s,o,r){const a=await n.TensorOpRegistry.slice;return await a({x:e,s:m(t),e:m(s),a:m(o),t:m(r??new Array(o.length).fill(1))})}function g(e,t){const s=e.data,o=t.data,r=[e.dims[0],e.dims[2]],n=new s.constructor(r[0]*r[1]),[a,l,c]=e.dims;let d=0;for(let e=0;e<a;++e){const t=e*c*l;for(let r=0;r<c;++r){let a=0,i=0;const u=e*l,_=t+r;for(let e=0;e<l;++e){const t=Number(o[u+e]);i+=t,a+=s[_+e*c]*t}const p=a/i;n[d++]=p}}return new i(e.type,n,r)}function f(e,t,{eps:s=1e-5}={}){if(2!==e.dims.length)throw new Error("`layer_norm` currently only supports 2D input.");const[o,r]=e.dims;if(1!==t.length&&t[0]!==r)throw new Error("`normalized_shape` must be a 1D array with shape `[input.dims[1]]`.");const[n,a]=k(e,1,0,!0),l=n.data,c=a.data,d=e.data,u=new d.constructor(d.length);for(let e=0;e<o;++e){const t=e*r;for(let o=0;o<r;++o){const r=t+o;u[r]=(d[r]-c[e])/(l[e]+s)}}return new i(e.type,u,e.dims)}function M(e,t){return e=e.slice(),null===t?e=e.filter((e=>1!==e)):"number"==typeof t?1===e[t]&&e.splice(t,1):Array.isArray(t)&&(e=e.filter(((e,s)=>1!==e||!t.includes(s)))),e}function w(e,t){return t=T(t,e.length+1),(e=e.slice()).splice(t,0,1),e}function T(e,t,s=null,o=!0){if(o&&(e<-t||e>=t))throw new Error(`IndexError: index ${e} is out of bounds for dimension${null===s?"":" "+s} with size ${t}`);return e<0&&(e=(e%t+t)%t),e}function b(e,t=0){t=T(t,e[0].dims.length);const s=e[0].dims.slice();s[t]=e.reduce(((e,s)=>e+s.dims[t]),0);const o=s.reduce(((e,t)=>e*t),1),r=new e[0].data.constructor(o),n=e[0].type;if(0===t){let t=0;for(const s of e){const e=s.data;r.set(e,t),t+=e.length}}else{let o=0;for(let n=0;n<e.length;++n){const{data:a,dims:i}=e[n];for(let e=0;e<a.length;++e){let n=0;for(let r=i.length-1,a=e,l=1;r>=0;--r){const e=i[r];let c=a%e;r===t&&(c+=o),n+=c*l,l*=s[r],a=Math.floor(a/e)}r[n]=a[e]}o+=i[t]}}return new i(n,r,s)}function x(e,t=0){return b(e.map((e=>e.unsqueeze(t))),t)}function P(e,t,s=null,o=!1,r=null){const n=t.data,a=t.dims;s=T(s,a.length);const i=a.slice();i[s]=1;const l=new n.constructor(n.length/a[s]);null!==r&&l.fill(r);for(let t=0;t<n.length;++t){let o=0;for(let e=a.length-1,r=t,n=1;e>=0;--e){const t=a[e];if(e!==s){o+=r%t*n,n*=i[e]}r=Math.floor(r/t)}l[o]=e(l[o],n[t],t,o)}return o||i.splice(s,1),[t.type,l,i]}function k(e,t=null,s=1,o=!1){const r=e.data,n=e.dims;if(null===t){const t=r.reduce(((e,t)=>e+t),0)/r.length,o=Math.sqrt(r.reduce(((e,s)=>e+(s-t)**2),0)/(r.length-s)),n=new i(e.type,[t],[]);return[new i(e.type,[o],[]),n]}const a=F(e,t=T(t,n.length),o),l=a.data,[c,d,u]=P(((e,t,s,o)=>e+(t-l[o])**2),e,t,o);for(let e=0;e<d.length;++e)d[e]=Math.sqrt(d[e]/(n[t]-s));return[new i(c,d,u),a]}function F(e,t=null,s=!1){const o=e.dims,r=e.data;if(null===t){const t=r.reduce(((e,t)=>e+t),0);return new i(e.type,[t/r.length],[])}t=T(t,o.length);const[n,a,l]=P(((e,t)=>e+t),e,t,s);if(1!==o[t])for(let e=0;e<a.length;++e)a[e]/=o[t];return new i(n,a,l)}function y(e,t,s,o){const r=e.reduce(((e,t)=>e*t),1);return new i(s,new o(r).fill(t),e)}function v(e,t){let s,o;if("number"==typeof t)s="float32",o=Float32Array;else if("bigint"==typeof t)s="int64",o=BigInt64Array;else{if("boolean"!=typeof t)throw new Error("Unsupported data type: "+typeof t);s="bool",o=Uint8Array}return y(e,t,s,o)}function C(e,t){return v(e.dims,t)}function S(e){return y(e,1n,"int64",BigInt64Array)}function A(e){return S(e.dims)}function E(e){return y(e,0n,"int64",BigInt64Array)}function L(e){return E(e.dims)}function I(e){const t=e.reduce(((e,t)=>e*t),1);return new i("float32",Float32Array.from({length:t},(()=>Math.random())),e)}function z(e,t){if(2!==e.dims.length)throw new Error("The tensor must have 2 dimensions");if(e.dims.at(-1)%8!=0)throw new Error("The last dimension of the tensor must be a multiple of 8");if(!["binary","ubinary"].includes(t))throw new Error("The precision must be either 'binary' or 'ubinary'");const s="binary"===t,o=s?"int8":"uint8",r=s?Int8Array:Uint8Array,n=e.data,a=new r(n.length/8);for(let e=0;e<n.length;++e){const t=n[e]>0?1:0,o=Math.floor(e/8),r=e%8;a[o]|=t<<7-r,s&&0===r&&(a[o]-=128)}return new i(o,a,[e.dims[0],e.dims[1]/8])}},"./src/utils/video.js":(e,t,s)=>{s.r(t),s.d(t,{RawVideo:()=>a,RawVideoFrame:()=>n,load_video:()=>i});var o=s("./src/utils/image.js"),r=s("./src/env.js");class n{constructor(e,t){this.image=e,this.timestamp=t}}class a{constructor(e,t){e.length>0&&e[0]instanceof o.RawImage&&(e=e.map(((s,o)=>new n(s,(o+1)/(e.length+1)*t)))),this.frames=e,this.duration=t}get width(){return this.frames[0].image.width}get height(){return this.frames[0].image.height}get fps(){return this.frames.length/this.duration}}async function i(e,{num_frames:t=null,fps:s=null}={}){if(!r.apis.IS_BROWSER_ENV)throw new Error("`load_video` is currently only supported in browser environments.");if(null==t&&null==s)throw new Error("Either num_frames or fps must be provided.");const i=[],l=document.createElement("video");if(l.crossOrigin="anonymous",l.muted=!0,"string"==typeof e)l.src=e;else if(e instanceof Blob)l.src=URL.createObjectURL(e);else{if(!(e instanceof HTMLVideoElement))throw new Error("Invalid URL or video element provided.");l.src=e.src}if(await new Promise((e=>l.onloadedmetadata=e)),l.seekable.start(0)===l.seekable.end(0)){const e=await fetch(l.src),t=await e.blob();l.src=URL.createObjectURL(t),await new Promise((e=>l.onloadedmetadata=e))}const c=l.duration;let d,u;null!=t?(d=t,u=1===t?0:c/(t-1)):(u=1/s,d=Math.floor(c/u));let _=[];for(let e=0;e<d;++e)_.push(1===t?c/2:e*u);const p=document.createElement("canvas");p.width=l.videoWidth,p.height=l.videoHeight;const m=p.getContext("2d",{willReadFrequently:!0});for(const e of _){l.currentTime=e,await new Promise((e=>{l.onseeked=e})),m.drawImage(l,0,0,p.width,p.height);const t=m.getImageData(0,0,p.width,p.height),s=new o.RawImage(t.data,p.width,p.height,4),r=new n(s,e);i.push(r)}return l.remove(),new a(i,c)}}},c={};function d(e){var t=c[e];if(void 0!==t)return t.exports;var s=c[e]={exports:{}};return l[e](s,s.exports,d),s.exports}i=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,d.t=function(e,t){if(1&t&&(e=this(e)),8&t)return e;if("object"==typeof e&&e){if(4&t&&e.__esModule)return e;if(16&t&&"function"==typeof e.then)return e}var s=Object.create(null);d.r(s);var o={};a=a||[null,i({}),i([]),i(i)];for(var r=2&t&&e;"object"==typeof r&&!~a.indexOf(r);r=i(r))Object.getOwnPropertyNames(r).forEach((t=>o[t]=()=>e[t]));return o.default=()=>e,d.d(s,o),s},d.d=(e,t)=>{for(var s in t)d.o(t,s)&&!d.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},d.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),d.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var u={};(()=>{d.r(u),d.d(u,{ASTFeatureExtractor:()=>p.ASTFeatureExtractor,ASTForAudioClassification:()=>s.ASTForAudioClassification,ASTModel:()=>s.ASTModel,ASTPreTrainedModel:()=>s.ASTPreTrainedModel,AlbertForMaskedLM:()=>s.AlbertForMaskedLM,AlbertForQuestionAnswering:()=>s.AlbertForQuestionAnswering,AlbertForSequenceClassification:()=>s.AlbertForSequenceClassification,AlbertModel:()=>s.AlbertModel,AlbertPreTrainedModel:()=>s.AlbertPreTrainedModel,AlbertTokenizer:()=>o.AlbertTokenizer,AudioClassificationPipeline:()=>t.AudioClassificationPipeline,AutoConfig:()=>r.AutoConfig,AutoFeatureExtractor:()=>m.AutoFeatureExtractor,AutoImageProcessor:()=>f.AutoImageProcessor,AutoModel:()=>s.AutoModel,AutoModelForAudioClassification:()=>s.AutoModelForAudioClassification,AutoModelForAudioFrameClassification:()=>s.AutoModelForAudioFrameClassification,AutoModelForAudioTextToText:()=>s.AutoModelForAudioTextToText,AutoModelForCTC:()=>s.AutoModelForCTC,AutoModelForCausalLM:()=>s.AutoModelForCausalLM,AutoModelForDepthEstimation:()=>s.AutoModelForDepthEstimation,AutoModelForDocumentQuestionAnswering:()=>s.AutoModelForDocumentQuestionAnswering,AutoModelForImageClassification:()=>s.AutoModelForImageClassification,AutoModelForImageFeatureExtraction:()=>s.AutoModelForImageFeatureExtraction,AutoModelForImageMatting:()=>s.AutoModelForImageMatting,AutoModelForImageSegmentation:()=>s.AutoModelForImageSegmentation,AutoModelForImageTextToText:()=>s.AutoModelForImageTextToText,AutoModelForImageToImage:()=>s.AutoModelForImageToImage,AutoModelForMaskGeneration:()=>s.AutoModelForMaskGeneration,AutoModelForMaskedLM:()=>s.AutoModelForMaskedLM,AutoModelForNormalEstimation:()=>s.AutoModelForNormalEstimation,AutoModelForObjectDetection:()=>s.AutoModelForObjectDetection,AutoModelForPoseEstimation:()=>s.AutoModelForPoseEstimation,AutoModelForQuestionAnswering:()=>s.AutoModelForQuestionAnswering,AutoModelForSemanticSegmentation:()=>s.AutoModelForSemanticSegmentation,AutoModelForSeq2SeqLM:()=>s.AutoModelForSeq2SeqLM,AutoModelForSequenceClassification:()=>s.AutoModelForSequenceClassification,AutoModelForSpeechSeq2Seq:()=>s.AutoModelForSpeechSeq2Seq,AutoModelForTextToSpectrogram:()=>s.AutoModelForTextToSpectrogram,AutoModelForTextToWaveform:()=>s.AutoModelForTextToWaveform,AutoModelForTokenClassification:()=>s.AutoModelForTokenClassification,AutoModelForUniversalSegmentation:()=>s.AutoModelForUniversalSegmentation,AutoModelForVision2Seq:()=>s.AutoModelForVision2Seq,AutoModelForXVector:()=>s.AutoModelForXVector,AutoModelForZeroShotObjectDetection:()=>s.AutoModelForZeroShotObjectDetection,AutoProcessor:()=>T.AutoProcessor,AutoTokenizer:()=>o.AutoTokenizer,AutomaticSpeechRecognitionPipeline:()=>t.AutomaticSpeechRecognitionPipeline,BackgroundRemovalPipeline:()=>t.BackgroundRemovalPipeline,BartForConditionalGeneration:()=>s.BartForConditionalGeneration,BartForSequenceClassification:()=>s.BartForSequenceClassification,BartModel:()=>s.BartModel,BartPretrainedModel:()=>s.BartPretrainedModel,BartTokenizer:()=>o.BartTokenizer,BaseModelOutput:()=>s.BaseModelOutput,BaseStreamer:()=>b.BaseStreamer,BeitFeatureExtractor:()=>g.BeitFeatureExtractor,BeitForImageClassification:()=>s.BeitForImageClassification,BeitModel:()=>s.BeitModel,BeitPreTrainedModel:()=>s.BeitPreTrainedModel,BertForMaskedLM:()=>s.BertForMaskedLM,BertForQuestionAnswering:()=>s.BertForQuestionAnswering,BertForSequenceClassification:()=>s.BertForSequenceClassification,BertForTokenClassification:()=>s.BertForTokenClassification,BertModel:()=>s.BertModel,BertPreTrainedModel:()=>s.BertPreTrainedModel,BertTokenizer:()=>o.BertTokenizer,BitImageProcessor:()=>g.BitImageProcessor,BlenderbotForConditionalGeneration:()=>s.BlenderbotForConditionalGeneration,BlenderbotModel:()=>s.BlenderbotModel,BlenderbotPreTrainedModel:()=>s.BlenderbotPreTrainedModel,BlenderbotSmallForConditionalGeneration:()=>s.BlenderbotSmallForConditionalGeneration,BlenderbotSmallModel:()=>s.BlenderbotSmallModel,BlenderbotSmallPreTrainedModel:()=>s.BlenderbotSmallPreTrainedModel,BlenderbotSmallTokenizer:()=>o.BlenderbotSmallTokenizer,BlenderbotTokenizer:()=>o.BlenderbotTokenizer,BloomForCausalLM:()=>s.BloomForCausalLM,BloomModel:()=>s.BloomModel,BloomPreTrainedModel:()=>s.BloomPreTrainedModel,BloomTokenizer:()=>o.BloomTokenizer,CLIPFeatureExtractor:()=>g.CLIPFeatureExtractor,CLIPImageProcessor:()=>g.CLIPImageProcessor,CLIPModel:()=>s.CLIPModel,CLIPPreTrainedModel:()=>s.CLIPPreTrainedModel,CLIPSegForImageSegmentation:()=>s.CLIPSegForImageSegmentation,CLIPSegModel:()=>s.CLIPSegModel,CLIPSegPreTrainedModel:()=>s.CLIPSegPreTrainedModel,CLIPTextModel:()=>s.CLIPTextModel,CLIPTextModelWithProjection:()=>s.CLIPTextModelWithProjection,CLIPTokenizer:()=>o.CLIPTokenizer,CLIPVisionModel:()=>s.CLIPVisionModel,CLIPVisionModelWithProjection:()=>s.CLIPVisionModelWithProjection,CamembertForMaskedLM:()=>s.CamembertForMaskedLM,CamembertForQuestionAnswering:()=>s.CamembertForQuestionAnswering,CamembertForSequenceClassification:()=>s.CamembertForSequenceClassification,CamembertForTokenClassification:()=>s.CamembertForTokenClassification,CamembertModel:()=>s.CamembertModel,CamembertPreTrainedModel:()=>s.CamembertPreTrainedModel,CamembertTokenizer:()=>o.CamembertTokenizer,CausalLMOutput:()=>s.CausalLMOutput,CausalLMOutputWithPast:()=>s.CausalLMOutputWithPast,ChineseCLIPFeatureExtractor:()=>g.ChineseCLIPFeatureExtractor,ChineseCLIPModel:()=>s.ChineseCLIPModel,ChineseCLIPPreTrainedModel:()=>s.ChineseCLIPPreTrainedModel,ClapAudioModelWithProjection:()=>s.ClapAudioModelWithProjection,ClapFeatureExtractor:()=>p.ClapFeatureExtractor,ClapModel:()=>s.ClapModel,ClapPreTrainedModel:()=>s.ClapPreTrainedModel,ClapTextModelWithProjection:()=>s.ClapTextModelWithProjection,ClassifierFreeGuidanceLogitsProcessor:()=>P.ClassifierFreeGuidanceLogitsProcessor,CodeGenForCausalLM:()=>s.CodeGenForCausalLM,CodeGenModel:()=>s.CodeGenModel,CodeGenPreTrainedModel:()=>s.CodeGenPreTrainedModel,CodeGenTokenizer:()=>o.CodeGenTokenizer,CodeLlamaTokenizer:()=>o.CodeLlamaTokenizer,CohereForCausalLM:()=>s.CohereForCausalLM,CohereModel:()=>s.CohereModel,CoherePreTrainedModel:()=>s.CoherePreTrainedModel,CohereTokenizer:()=>o.CohereTokenizer,ConvBertForMaskedLM:()=>s.ConvBertForMaskedLM,ConvBertForQuestionAnswering:()=>s.ConvBertForQuestionAnswering,ConvBertForSequenceClassification:()=>s.ConvBertForSequenceClassification,ConvBertForTokenClassification:()=>s.ConvBertForTokenClassification,ConvBertModel:()=>s.ConvBertModel,ConvBertPreTrainedModel:()=>s.ConvBertPreTrainedModel,ConvBertTokenizer:()=>o.ConvBertTokenizer,ConvNextFeatureExtractor:()=>g.ConvNextFeatureExtractor,ConvNextForImageClassification:()=>s.ConvNextForImageClassification,ConvNextImageProcessor:()=>g.ConvNextImageProcessor,ConvNextModel:()=>s.ConvNextModel,ConvNextPreTrainedModel:()=>s.ConvNextPreTrainedModel,ConvNextV2ForImageClassification:()=>s.ConvNextV2ForImageClassification,ConvNextV2Model:()=>s.ConvNextV2Model,ConvNextV2PreTrainedModel:()=>s.ConvNextV2PreTrainedModel,DPTFeatureExtractor:()=>g.DPTFeatureExtractor,DPTForDepthEstimation:()=>s.DPTForDepthEstimation,DPTImageProcessor:()=>g.DPTImageProcessor,DPTModel:()=>s.DPTModel,DPTPreTrainedModel:()=>s.DPTPreTrainedModel,DacDecoderModel:()=>s.DacDecoderModel,DacDecoderOutput:()=>s.DacDecoderOutput,DacEncoderModel:()=>s.DacEncoderModel,DacEncoderOutput:()=>s.DacEncoderOutput,DacFeatureExtractor:()=>p.DacFeatureExtractor,DacModel:()=>s.DacModel,DacPreTrainedModel:()=>s.DacPreTrainedModel,DataTypeMap:()=>l.DataTypeMap,DebertaForMaskedLM:()=>s.DebertaForMaskedLM,DebertaForQuestionAnswering:()=>s.DebertaForQuestionAnswering,DebertaForSequenceClassification:()=>s.DebertaForSequenceClassification,DebertaForTokenClassification:()=>s.DebertaForTokenClassification,DebertaModel:()=>s.DebertaModel,DebertaPreTrainedModel:()=>s.DebertaPreTrainedModel,DebertaTokenizer:()=>o.DebertaTokenizer,DebertaV2ForMaskedLM:()=>s.DebertaV2ForMaskedLM,DebertaV2ForQuestionAnswering:()=>s.DebertaV2ForQuestionAnswering,DebertaV2ForSequenceClassification:()=>s.DebertaV2ForSequenceClassification,DebertaV2ForTokenClassification:()=>s.DebertaV2ForTokenClassification,DebertaV2Model:()=>s.DebertaV2Model,DebertaV2PreTrainedModel:()=>s.DebertaV2PreTrainedModel,DebertaV2Tokenizer:()=>o.DebertaV2Tokenizer,DecisionTransformerModel:()=>s.DecisionTransformerModel,DecisionTransformerPreTrainedModel:()=>s.DecisionTransformerPreTrainedModel,DeiTFeatureExtractor:()=>g.DeiTFeatureExtractor,DeiTForImageClassification:()=>s.DeiTForImageClassification,DeiTImageProcessor:()=>g.DeiTImageProcessor,DeiTModel:()=>s.DeiTModel,DeiTPreTrainedModel:()=>s.DeiTPreTrainedModel,DepthAnythingForDepthEstimation:()=>s.DepthAnythingForDepthEstimation,DepthAnythingPreTrainedModel:()=>s.DepthAnythingPreTrainedModel,DepthEstimationPipeline:()=>t.DepthEstimationPipeline,DepthProForDepthEstimation:()=>s.DepthProForDepthEstimation,DepthProPreTrainedModel:()=>s.DepthProPreTrainedModel,DetrFeatureExtractor:()=>g.DetrFeatureExtractor,DetrForObjectDetection:()=>s.DetrForObjectDetection,DetrForSegmentation:()=>s.DetrForSegmentation,DetrImageProcessor:()=>g.DetrImageProcessor,DetrModel:()=>s.DetrModel,DetrObjectDetectionOutput:()=>s.DetrObjectDetectionOutput,DetrPreTrainedModel:()=>s.DetrPreTrainedModel,DetrSegmentationOutput:()=>s.DetrSegmentationOutput,Dinov2ForImageClassification:()=>s.Dinov2ForImageClassification,Dinov2Model:()=>s.Dinov2Model,Dinov2PreTrainedModel:()=>s.Dinov2PreTrainedModel,Dinov2WithRegistersForImageClassification:()=>s.Dinov2WithRegistersForImageClassification,Dinov2WithRegistersModel:()=>s.Dinov2WithRegistersModel,Dinov2WithRegistersPreTrainedModel:()=>s.Dinov2WithRegistersPreTrainedModel,DistilBertForMaskedLM:()=>s.DistilBertForMaskedLM,DistilBertForQuestionAnswering:()=>s.DistilBertForQuestionAnswering,DistilBertForSequenceClassification:()=>s.DistilBertForSequenceClassification,DistilBertForTokenClassification:()=>s.DistilBertForTokenClassification,DistilBertModel:()=>s.DistilBertModel,DistilBertPreTrainedModel:()=>s.DistilBertPreTrainedModel,DistilBertTokenizer:()=>o.DistilBertTokenizer,DocumentQuestionAnsweringPipeline:()=>t.DocumentQuestionAnsweringPipeline,DonutFeatureExtractor:()=>g.DonutFeatureExtractor,DonutImageProcessor:()=>g.DonutImageProcessor,DonutSwinModel:()=>s.DonutSwinModel,DonutSwinPreTrainedModel:()=>s.DonutSwinPreTrainedModel,EfficientNetForImageClassification:()=>s.EfficientNetForImageClassification,EfficientNetImageProcessor:()=>g.EfficientNetImageProcessor,EfficientNetModel:()=>s.EfficientNetModel,EfficientNetPreTrainedModel:()=>s.EfficientNetPreTrainedModel,ElectraForMaskedLM:()=>s.ElectraForMaskedLM,ElectraForQuestionAnswering:()=>s.ElectraForQuestionAnswering,ElectraForSequenceClassification:()=>s.ElectraForSequenceClassification,ElectraForTokenClassification:()=>s.ElectraForTokenClassification,ElectraModel:()=>s.ElectraModel,ElectraPreTrainedModel:()=>s.ElectraPreTrainedModel,ElectraTokenizer:()=>o.ElectraTokenizer,EncodecFeatureExtractor:()=>p.EncodecFeatureExtractor,EosTokenCriteria:()=>x.EosTokenCriteria,EsmForMaskedLM:()=>s.EsmForMaskedLM,EsmForSequenceClassification:()=>s.EsmForSequenceClassification,EsmForTokenClassification:()=>s.EsmForTokenClassification,EsmModel:()=>s.EsmModel,EsmPreTrainedModel:()=>s.EsmPreTrainedModel,EsmTokenizer:()=>o.EsmTokenizer,ExaoneForCausalLM:()=>s.ExaoneForCausalLM,ExaoneModel:()=>s.ExaoneModel,ExaonePreTrainedModel:()=>s.ExaonePreTrainedModel,FFT:()=>c.FFT,FalconForCausalLM:()=>s.FalconForCausalLM,FalconModel:()=>s.FalconModel,FalconPreTrainedModel:()=>s.FalconPreTrainedModel,FalconTokenizer:()=>o.FalconTokenizer,FastViTForImageClassification:()=>s.FastViTForImageClassification,FastViTModel:()=>s.FastViTModel,FastViTPreTrainedModel:()=>s.FastViTPreTrainedModel,FeatureExtractionPipeline:()=>t.FeatureExtractionPipeline,FeatureExtractor:()=>_.FeatureExtractor,FillMaskPipeline:()=>t.FillMaskPipeline,Florence2ForConditionalGeneration:()=>s.Florence2ForConditionalGeneration,Florence2PreTrainedModel:()=>s.Florence2PreTrainedModel,Florence2Processor:()=>w.Florence2Processor,ForcedBOSTokenLogitsProcessor:()=>P.ForcedBOSTokenLogitsProcessor,ForcedEOSTokenLogitsProcessor:()=>P.ForcedEOSTokenLogitsProcessor,GLPNFeatureExtractor:()=>g.GLPNFeatureExtractor,GLPNForDepthEstimation:()=>s.GLPNForDepthEstimation,GLPNModel:()=>s.GLPNModel,GLPNPreTrainedModel:()=>s.GLPNPreTrainedModel,GPT2LMHeadModel:()=>s.GPT2LMHeadModel,GPT2Model:()=>s.GPT2Model,GPT2PreTrainedModel:()=>s.GPT2PreTrainedModel,GPT2Tokenizer:()=>o.GPT2Tokenizer,GPTBigCodeForCausalLM:()=>s.GPTBigCodeForCausalLM,GPTBigCodeModel:()=>s.GPTBigCodeModel,GPTBigCodePreTrainedModel:()=>s.GPTBigCodePreTrainedModel,GPTJForCausalLM:()=>s.GPTJForCausalLM,GPTJModel:()=>s.GPTJModel,GPTJPreTrainedModel:()=>s.GPTJPreTrainedModel,GPTNeoForCausalLM:()=>s.GPTNeoForCausalLM,GPTNeoModel:()=>s.GPTNeoModel,GPTNeoPreTrainedModel:()=>s.GPTNeoPreTrainedModel,GPTNeoXForCausalLM:()=>s.GPTNeoXForCausalLM,GPTNeoXModel:()=>s.GPTNeoXModel,GPTNeoXPreTrainedModel:()=>s.GPTNeoXPreTrainedModel,GPTNeoXTokenizer:()=>o.GPTNeoXTokenizer,Gemma2ForCausalLM:()=>s.Gemma2ForCausalLM,Gemma2Model:()=>s.Gemma2Model,Gemma2PreTrainedModel:()=>s.Gemma2PreTrainedModel,GemmaForCausalLM:()=>s.GemmaForCausalLM,GemmaModel:()=>s.GemmaModel,GemmaPreTrainedModel:()=>s.GemmaPreTrainedModel,GemmaTokenizer:()=>o.GemmaTokenizer,GlmForCausalLM:()=>s.GlmForCausalLM,GlmModel:()=>s.GlmModel,GlmPreTrainedModel:()=>s.GlmPreTrainedModel,GraniteForCausalLM:()=>s.GraniteForCausalLM,GraniteModel:()=>s.GraniteModel,GranitePreTrainedModel:()=>s.GranitePreTrainedModel,Grok1Tokenizer:()=>o.Grok1Tokenizer,GroundingDinoForObjectDetection:()=>s.GroundingDinoForObjectDetection,GroundingDinoImageProcessor:()=>g.GroundingDinoImageProcessor,GroundingDinoPreTrainedModel:()=>s.GroundingDinoPreTrainedModel,GroundingDinoProcessor:()=>w.GroundingDinoProcessor,GroupViTModel:()=>s.GroupViTModel,GroupViTPreTrainedModel:()=>s.GroupViTPreTrainedModel,HeliumForCausalLM:()=>s.HeliumForCausalLM,HeliumModel:()=>s.HeliumModel,HeliumPreTrainedModel:()=>s.HeliumPreTrainedModel,HerbertTokenizer:()=>o.HerbertTokenizer,HieraForImageClassification:()=>s.HieraForImageClassification,HieraModel:()=>s.HieraModel,HieraPreTrainedModel:()=>s.HieraPreTrainedModel,HubertForCTC:()=>s.HubertForCTC,HubertForSequenceClassification:()=>s.HubertForSequenceClassification,HubertModel:()=>s.HubertModel,HubertPreTrainedModel:()=>s.HubertPreTrainedModel,IJepaForImageClassification:()=>s.IJepaForImageClassification,IJepaModel:()=>s.IJepaModel,IJepaPreTrainedModel:()=>s.IJepaPreTrainedModel,Idefics3ForConditionalGeneration:()=>s.Idefics3ForConditionalGeneration,Idefics3ImageProcessor:()=>g.Idefics3ImageProcessor,Idefics3PreTrainedModel:()=>s.Idefics3PreTrainedModel,Idefics3Processor:()=>w.Idefics3Processor,ImageClassificationPipeline:()=>t.ImageClassificationPipeline,ImageFeatureExtractionPipeline:()=>t.ImageFeatureExtractionPipeline,ImageFeatureExtractor:()=>p.ImageFeatureExtractor,ImageMattingOutput:()=>s.ImageMattingOutput,ImageProcessor:()=>h.ImageProcessor,ImageSegmentationPipeline:()=>t.ImageSegmentationPipeline,ImageToImagePipeline:()=>t.ImageToImagePipeline,ImageToTextPipeline:()=>t.ImageToTextPipeline,InterruptableStoppingCriteria:()=>x.InterruptableStoppingCriteria,JAISLMHeadModel:()=>s.JAISLMHeadModel,JAISModel:()=>s.JAISModel,JAISPreTrainedModel:()=>s.JAISPreTrainedModel,JinaCLIPImageProcessor:()=>g.JinaCLIPImageProcessor,JinaCLIPModel:()=>s.JinaCLIPModel,JinaCLIPPreTrainedModel:()=>s.JinaCLIPPreTrainedModel,JinaCLIPProcessor:()=>w.JinaCLIPProcessor,JinaCLIPTextModel:()=>s.JinaCLIPTextModel,JinaCLIPVisionModel:()=>s.JinaCLIPVisionModel,LiteWhisperForConditionalGeneration:()=>s.LiteWhisperForConditionalGeneration,LlamaForCausalLM:()=>s.LlamaForCausalLM,LlamaModel:()=>s.LlamaModel,LlamaPreTrainedModel:()=>s.LlamaPreTrainedModel,LlamaTokenizer:()=>o.LlamaTokenizer,LlavaForConditionalGeneration:()=>s.LlavaForConditionalGeneration,LlavaOnevisionForConditionalGeneration:()=>s.LlavaOnevisionForConditionalGeneration,LlavaOnevisionImageProcessor:()=>g.LlavaOnevisionImageProcessor,LlavaPreTrainedModel:()=>s.LlavaPreTrainedModel,LogitsProcessor:()=>P.LogitsProcessor,LogitsProcessorList:()=>P.LogitsProcessorList,LogitsWarper:()=>P.LogitsWarper,LongT5ForConditionalGeneration:()=>s.LongT5ForConditionalGeneration,LongT5Model:()=>s.LongT5Model,LongT5PreTrainedModel:()=>s.LongT5PreTrainedModel,M2M100ForConditionalGeneration:()=>s.M2M100ForConditionalGeneration,M2M100Model:()=>s.M2M100Model,M2M100PreTrainedModel:()=>s.M2M100PreTrainedModel,M2M100Tokenizer:()=>o.M2M100Tokenizer,MBart50Tokenizer:()=>o.MBart50Tokenizer,MBartForCausalLM:()=>s.MBartForCausalLM,MBartForConditionalGeneration:()=>s.MBartForConditionalGeneration,MBartForSequenceClassification:()=>s.MBartForSequenceClassification,MBartModel:()=>s.MBartModel,MBartPreTrainedModel:()=>s.MBartPreTrainedModel,MBartTokenizer:()=>o.MBartTokenizer,MPNetForMaskedLM:()=>s.MPNetForMaskedLM,MPNetForQuestionAnswering:()=>s.MPNetForQuestionAnswering,MPNetForSequenceClassification:()=>s.MPNetForSequenceClassification,MPNetForTokenClassification:()=>s.MPNetForTokenClassification,MPNetModel:()=>s.MPNetModel,MPNetPreTrainedModel:()=>s.MPNetPreTrainedModel,MPNetTokenizer:()=>o.MPNetTokenizer,MT5ForConditionalGeneration:()=>s.MT5ForConditionalGeneration,MT5Model:()=>s.MT5Model,MT5PreTrainedModel:()=>s.MT5PreTrainedModel,MarianMTModel:()=>s.MarianMTModel,MarianModel:()=>s.MarianModel,MarianPreTrainedModel:()=>s.MarianPreTrainedModel,MarianTokenizer:()=>o.MarianTokenizer,Mask2FormerImageProcessor:()=>g.Mask2FormerImageProcessor,MaskFormerFeatureExtractor:()=>g.MaskFormerFeatureExtractor,MaskFormerForInstanceSegmentation:()=>s.MaskFormerForInstanceSegmentation,MaskFormerImageProcessor:()=>g.MaskFormerImageProcessor,MaskFormerModel:()=>s.MaskFormerModel,MaskFormerPreTrainedModel:()=>s.MaskFormerPreTrainedModel,MaskedLMOutput:()=>s.MaskedLMOutput,MaxLengthCriteria:()=>x.MaxLengthCriteria,MgpstrForSceneTextRecognition:()=>s.MgpstrForSceneTextRecognition,MgpstrModelOutput:()=>s.MgpstrModelOutput,MgpstrPreTrainedModel:()=>s.MgpstrPreTrainedModel,MgpstrProcessor:()=>w.MgpstrProcessor,MgpstrTokenizer:()=>o.MgpstrTokenizer,MimiDecoderModel:()=>s.MimiDecoderModel,MimiDecoderOutput:()=>s.MimiDecoderOutput,MimiEncoderModel:()=>s.MimiEncoderModel,MimiEncoderOutput:()=>s.MimiEncoderOutput,MimiModel:()=>s.MimiModel,MimiPreTrainedModel:()=>s.MimiPreTrainedModel,MinLengthLogitsProcessor:()=>P.MinLengthLogitsProcessor,MinNewTokensLengthLogitsProcessor:()=>P.MinNewTokensLengthLogitsProcessor,MistralForCausalLM:()=>s.MistralForCausalLM,MistralModel:()=>s.MistralModel,MistralPreTrainedModel:()=>s.MistralPreTrainedModel,MobileBertForMaskedLM:()=>s.MobileBertForMaskedLM,MobileBertForQuestionAnswering:()=>s.MobileBertForQuestionAnswering,MobileBertForSequenceClassification:()=>s.MobileBertForSequenceClassification,MobileBertModel:()=>s.MobileBertModel,MobileBertPreTrainedModel:()=>s.MobileBertPreTrainedModel,MobileBertTokenizer:()=>o.MobileBertTokenizer,MobileLLMForCausalLM:()=>s.MobileLLMForCausalLM,MobileLLMModel:()=>s.MobileLLMModel,MobileLLMPreTrainedModel:()=>s.MobileLLMPreTrainedModel,MobileNetV1FeatureExtractor:()=>g.MobileNetV1FeatureExtractor,MobileNetV1ForImageClassification:()=>s.MobileNetV1ForImageClassification,MobileNetV1ForSemanticSegmentation:()=>s.MobileNetV1ForSemanticSegmentation,MobileNetV1ImageProcessor:()=>g.MobileNetV1ImageProcessor,MobileNetV1Model:()=>s.MobileNetV1Model,MobileNetV1PreTrainedModel:()=>s.MobileNetV1PreTrainedModel,MobileNetV2FeatureExtractor:()=>g.MobileNetV2FeatureExtractor,MobileNetV2ForImageClassification:()=>s.MobileNetV2ForImageClassification,MobileNetV2ForSemanticSegmentation:()=>s.MobileNetV2ForSemanticSegmentation,MobileNetV2ImageProcessor:()=>g.MobileNetV2ImageProcessor,MobileNetV2Model:()=>s.MobileNetV2Model,MobileNetV2PreTrainedModel:()=>s.MobileNetV2PreTrainedModel,MobileNetV3FeatureExtractor:()=>g.MobileNetV3FeatureExtractor,MobileNetV3ForImageClassification:()=>s.MobileNetV3ForImageClassification,MobileNetV3ForSemanticSegmentation:()=>s.MobileNetV3ForSemanticSegmentation,MobileNetV3ImageProcessor:()=>g.MobileNetV3ImageProcessor,MobileNetV3Model:()=>s.MobileNetV3Model,MobileNetV3PreTrainedModel:()=>s.MobileNetV3PreTrainedModel,MobileNetV4FeatureExtractor:()=>g.MobileNetV4FeatureExtractor,MobileNetV4ForImageClassification:()=>s.MobileNetV4ForImageClassification,MobileNetV4ForSemanticSegmentation:()=>s.MobileNetV4ForSemanticSegmentation,MobileNetV4ImageProcessor:()=>g.MobileNetV4ImageProcessor,MobileNetV4Model:()=>s.MobileNetV4Model,MobileNetV4PreTrainedModel:()=>s.MobileNetV4PreTrainedModel,MobileViTFeatureExtractor:()=>g.MobileViTFeatureExtractor,MobileViTForImageClassification:()=>s.MobileViTForImageClassification,MobileViTImageProcessor:()=>g.MobileViTImageProcessor,MobileViTModel:()=>s.MobileViTModel,MobileViTPreTrainedModel:()=>s.MobileViTPreTrainedModel,MobileViTV2ForImageClassification:()=>s.MobileViTV2ForImageClassification,MobileViTV2Model:()=>s.MobileViTV2Model,MobileViTV2PreTrainedModel:()=>s.MobileViTV2PreTrainedModel,ModelOutput:()=>s.ModelOutput,ModernBertForMaskedLM:()=>s.ModernBertForMaskedLM,ModernBertForSequenceClassification:()=>s.ModernBertForSequenceClassification,ModernBertForTokenClassification:()=>s.ModernBertForTokenClassification,ModernBertModel:()=>s.ModernBertModel,ModernBertPreTrainedModel:()=>s.ModernBertPreTrainedModel,Moondream1ForConditionalGeneration:()=>s.Moondream1ForConditionalGeneration,MoonshineFeatureExtractor:()=>p.MoonshineFeatureExtractor,MoonshineForConditionalGeneration:()=>s.MoonshineForConditionalGeneration,MoonshineModel:()=>s.MoonshineModel,MoonshinePreTrainedModel:()=>s.MoonshinePreTrainedModel,MoonshineProcessor:()=>w.MoonshineProcessor,MptForCausalLM:()=>s.MptForCausalLM,MptModel:()=>s.MptModel,MptPreTrainedModel:()=>s.MptPreTrainedModel,MultiModalityCausalLM:()=>s.MultiModalityCausalLM,MultiModalityPreTrainedModel:()=>s.MultiModalityPreTrainedModel,MusicgenForCausalLM:()=>s.MusicgenForCausalLM,MusicgenForConditionalGeneration:()=>s.MusicgenForConditionalGeneration,MusicgenModel:()=>s.MusicgenModel,MusicgenPreTrainedModel:()=>s.MusicgenPreTrainedModel,NllbTokenizer:()=>o.NllbTokenizer,NoBadWordsLogitsProcessor:()=>P.NoBadWordsLogitsProcessor,NoRepeatNGramLogitsProcessor:()=>P.NoRepeatNGramLogitsProcessor,NomicBertModel:()=>s.NomicBertModel,NomicBertPreTrainedModel:()=>s.NomicBertPreTrainedModel,NougatImageProcessor:()=>g.NougatImageProcessor,NougatTokenizer:()=>o.NougatTokenizer,OPTForCausalLM:()=>s.OPTForCausalLM,OPTModel:()=>s.OPTModel,OPTPreTrainedModel:()=>s.OPTPreTrainedModel,ObjectDetectionPipeline:()=>t.ObjectDetectionPipeline,Olmo2ForCausalLM:()=>s.Olmo2ForCausalLM,Olmo2Model:()=>s.Olmo2Model,Olmo2PreTrainedModel:()=>s.Olmo2PreTrainedModel,OlmoForCausalLM:()=>s.OlmoForCausalLM,OlmoModel:()=>s.OlmoModel,OlmoPreTrainedModel:()=>s.OlmoPreTrainedModel,OpenELMForCausalLM:()=>s.OpenELMForCausalLM,OpenELMModel:()=>s.OpenELMModel,OpenELMPreTrainedModel:()=>s.OpenELMPreTrainedModel,OwlViTFeatureExtractor:()=>g.OwlViTFeatureExtractor,OwlViTForObjectDetection:()=>s.OwlViTForObjectDetection,OwlViTImageProcessor:()=>g.OwlViTImageProcessor,OwlViTModel:()=>s.OwlViTModel,OwlViTPreTrainedModel:()=>s.OwlViTPreTrainedModel,OwlViTProcessor:()=>w.OwlViTProcessor,Owlv2ForObjectDetection:()=>s.Owlv2ForObjectDetection,Owlv2ImageProcessor:()=>g.Owlv2ImageProcessor,Owlv2Model:()=>s.Owlv2Model,Owlv2PreTrainedModel:()=>s.Owlv2PreTrainedModel,PaliGemmaForConditionalGeneration:()=>s.PaliGemmaForConditionalGeneration,PaliGemmaPreTrainedModel:()=>s.PaliGemmaPreTrainedModel,PaliGemmaProcessor:()=>w.PaliGemmaProcessor,PatchTSMixerForPrediction:()=>s.PatchTSMixerForPrediction,PatchTSMixerModel:()=>s.PatchTSMixerModel,PatchTSMixerPreTrainedModel:()=>s.PatchTSMixerPreTrainedModel,PatchTSTForPrediction:()=>s.PatchTSTForPrediction,PatchTSTModel:()=>s.PatchTSTModel,PatchTSTPreTrainedModel:()=>s.PatchTSTPreTrainedModel,Phi3ForCausalLM:()=>s.Phi3ForCausalLM,Phi3Model:()=>s.Phi3Model,Phi3PreTrainedModel:()=>s.Phi3PreTrainedModel,Phi3VForCausalLM:()=>s.Phi3VForCausalLM,Phi3VImageProcessor:()=>g.Phi3VImageProcessor,Phi3VPreTrainedModel:()=>s.Phi3VPreTrainedModel,Phi3VProcessor:()=>w.Phi3VProcessor,PhiForCausalLM:()=>s.PhiForCausalLM,PhiModel:()=>s.PhiModel,PhiPreTrainedModel:()=>s.PhiPreTrainedModel,Pipeline:()=>t.Pipeline,PreTrainedModel:()=>s.PreTrainedModel,PreTrainedTokenizer:()=>o.PreTrainedTokenizer,PretrainedConfig:()=>r.PretrainedConfig,PretrainedMixin:()=>s.PretrainedMixin,Processor:()=>M.Processor,PvtForImageClassification:()=>s.PvtForImageClassification,PvtImageProcessor:()=>g.PvtImageProcessor,PvtModel:()=>s.PvtModel,PvtPreTrainedModel:()=>s.PvtPreTrainedModel,PyAnnoteFeatureExtractor:()=>p.PyAnnoteFeatureExtractor,PyAnnoteForAudioFrameClassification:()=>s.PyAnnoteForAudioFrameClassification,PyAnnoteModel:()=>s.PyAnnoteModel,PyAnnotePreTrainedModel:()=>s.PyAnnotePreTrainedModel,PyAnnoteProcessor:()=>w.PyAnnoteProcessor,QuestionAnsweringModelOutput:()=>s.QuestionAnsweringModelOutput,QuestionAnsweringPipeline:()=>t.QuestionAnsweringPipeline,Qwen2ForCausalLM:()=>s.Qwen2ForCausalLM,Qwen2Model:()=>s.Qwen2Model,Qwen2PreTrainedModel:()=>s.Qwen2PreTrainedModel,Qwen2Tokenizer:()=>o.Qwen2Tokenizer,Qwen2VLForConditionalGeneration:()=>s.Qwen2VLForConditionalGeneration,Qwen2VLImageProcessor:()=>g.Qwen2VLImageProcessor,Qwen2VLPreTrainedModel:()=>s.Qwen2VLPreTrainedModel,Qwen2VLProcessor:()=>w.Qwen2VLProcessor,RTDetrForObjectDetection:()=>s.RTDetrForObjectDetection,RTDetrImageProcessor:()=>g.RTDetrImageProcessor,RTDetrModel:()=>s.RTDetrModel,RTDetrObjectDetectionOutput:()=>s.RTDetrObjectDetectionOutput,RTDetrPreTrainedModel:()=>s.RTDetrPreTrainedModel,RawAudio:()=>n.RawAudio,RawImage:()=>a.RawImage,RawVideo:()=>i.RawVideo,RawVideoFrame:()=>i.RawVideoFrame,RepetitionPenaltyLogitsProcessor:()=>P.RepetitionPenaltyLogitsProcessor,ResNetForImageClassification:()=>s.ResNetForImageClassification,ResNetModel:()=>s.ResNetModel,ResNetPreTrainedModel:()=>s.ResNetPreTrainedModel,RoFormerForMaskedLM:()=>s.RoFormerForMaskedLM,RoFormerForQuestionAnswering:()=>s.RoFormerForQuestionAnswering,RoFormerForSequenceClassification:()=>s.RoFormerForSequenceClassification,RoFormerForTokenClassification:()=>s.RoFormerForTokenClassification,RoFormerModel:()=>s.RoFormerModel,RoFormerPreTrainedModel:()=>s.RoFormerPreTrainedModel,RoFormerTokenizer:()=>o.RoFormerTokenizer,RobertaForMaskedLM:()=>s.RobertaForMaskedLM,RobertaForQuestionAnswering:()=>s.RobertaForQuestionAnswering,RobertaForSequenceClassification:()=>s.RobertaForSequenceClassification,RobertaForTokenClassification:()=>s.RobertaForTokenClassification,RobertaModel:()=>s.RobertaModel,RobertaPreTrainedModel:()=>s.RobertaPreTrainedModel,RobertaTokenizer:()=>o.RobertaTokenizer,SamImageProcessor:()=>g.SamImageProcessor,SamImageSegmentationOutput:()=>s.SamImageSegmentationOutput,SamModel:()=>s.SamModel,SamPreTrainedModel:()=>s.SamPreTrainedModel,SamProcessor:()=>w.SamProcessor,SapiensForDepthEstimation:()=>s.SapiensForDepthEstimation,SapiensForNormalEstimation:()=>s.SapiensForNormalEstimation,SapiensForSemanticSegmentation:()=>s.SapiensForSemanticSegmentation,SapiensPreTrainedModel:()=>s.SapiensPreTrainedModel,SeamlessM4TFeatureExtractor:()=>p.SeamlessM4TFeatureExtractor,SegformerFeatureExtractor:()=>g.SegformerFeatureExtractor,SegformerForImageClassification:()=>s.SegformerForImageClassification,SegformerForSemanticSegmentation:()=>s.SegformerForSemanticSegmentation,SegformerImageProcessor:()=>g.SegformerImageProcessor,SegformerModel:()=>s.SegformerModel,SegformerPreTrainedModel:()=>s.SegformerPreTrainedModel,Seq2SeqLMOutput:()=>s.Seq2SeqLMOutput,SequenceClassifierOutput:()=>s.SequenceClassifierOutput,SiglipImageProcessor:()=>g.SiglipImageProcessor,SiglipModel:()=>s.SiglipModel,SiglipPreTrainedModel:()=>s.SiglipPreTrainedModel,SiglipTextModel:()=>s.SiglipTextModel,SiglipTokenizer:()=>o.SiglipTokenizer,SiglipVisionModel:()=>s.SiglipVisionModel,SmolVLMForConditionalGeneration:()=>s.SmolVLMForConditionalGeneration,SmolVLMImageProcessor:()=>g.SmolVLMImageProcessor,SmolVLMProcessor:()=>w.SmolVLMProcessor,SpeechT5FeatureExtractor:()=>p.SpeechT5FeatureExtractor,SpeechT5ForSpeechToText:()=>s.SpeechT5ForSpeechToText,SpeechT5ForTextToSpeech:()=>s.SpeechT5ForTextToSpeech,SpeechT5HifiGan:()=>s.SpeechT5HifiGan,SpeechT5Model:()=>s.SpeechT5Model,SpeechT5PreTrainedModel:()=>s.SpeechT5PreTrainedModel,SpeechT5Processor:()=>w.SpeechT5Processor,SpeechT5Tokenizer:()=>o.SpeechT5Tokenizer,SqueezeBertForMaskedLM:()=>s.SqueezeBertForMaskedLM,SqueezeBertForQuestionAnswering:()=>s.SqueezeBertForQuestionAnswering,SqueezeBertForSequenceClassification:()=>s.SqueezeBertForSequenceClassification,SqueezeBertModel:()=>s.SqueezeBertModel,SqueezeBertPreTrainedModel:()=>s.SqueezeBertPreTrainedModel,SqueezeBertTokenizer:()=>o.SqueezeBertTokenizer,StableLmForCausalLM:()=>s.StableLmForCausalLM,StableLmModel:()=>s.StableLmModel,StableLmPreTrainedModel:()=>s.StableLmPreTrainedModel,Starcoder2ForCausalLM:()=>s.Starcoder2ForCausalLM,Starcoder2Model:()=>s.Starcoder2Model,Starcoder2PreTrainedModel:()=>s.Starcoder2PreTrainedModel,StoppingCriteria:()=>x.StoppingCriteria,StoppingCriteriaList:()=>x.StoppingCriteriaList,StyleTextToSpeech2Model:()=>s.StyleTextToSpeech2Model,StyleTextToSpeech2PreTrainedModel:()=>s.StyleTextToSpeech2PreTrainedModel,SummarizationPipeline:()=>t.SummarizationPipeline,SuppressTokensAtBeginLogitsProcessor:()=>P.SuppressTokensAtBeginLogitsProcessor,Swin2SRForImageSuperResolution:()=>s.Swin2SRForImageSuperResolution,Swin2SRImageProcessor:()=>g.Swin2SRImageProcessor,Swin2SRModel:()=>s.Swin2SRModel,Swin2SRPreTrainedModel:()=>s.Swin2SRPreTrainedModel,SwinForImageClassification:()=>s.SwinForImageClassification,SwinForSemanticSegmentation:()=>s.SwinForSemanticSegmentation,SwinModel:()=>s.SwinModel,SwinPreTrainedModel:()=>s.SwinPreTrainedModel,T5ForConditionalGeneration:()=>s.T5ForConditionalGeneration,T5Model:()=>s.T5Model,T5PreTrainedModel:()=>s.T5PreTrainedModel,T5Tokenizer:()=>o.T5Tokenizer,TableTransformerForObjectDetection:()=>s.TableTransformerForObjectDetection,TableTransformerModel:()=>s.TableTransformerModel,TableTransformerObjectDetectionOutput:()=>s.TableTransformerObjectDetectionOutput,TableTransformerPreTrainedModel:()=>s.TableTransformerPreTrainedModel,TemperatureLogitsWarper:()=>P.TemperatureLogitsWarper,Tensor:()=>l.Tensor,Text2TextGenerationPipeline:()=>t.Text2TextGenerationPipeline,TextClassificationPipeline:()=>t.TextClassificationPipeline,TextGenerationPipeline:()=>t.TextGenerationPipeline,TextStreamer:()=>b.TextStreamer,TextToAudioPipeline:()=>t.TextToAudioPipeline,TokenClassificationPipeline:()=>t.TokenClassificationPipeline,TokenClassifierOutput:()=>s.TokenClassifierOutput,TokenizerModel:()=>o.TokenizerModel,TopKLogitsWarper:()=>P.TopKLogitsWarper,TopPLogitsWarper:()=>P.TopPLogitsWarper,TrOCRForCausalLM:()=>s.TrOCRForCausalLM,TrOCRPreTrainedModel:()=>s.TrOCRPreTrainedModel,TranslationPipeline:()=>t.TranslationPipeline,UltravoxModel:()=>s.UltravoxModel,UltravoxPreTrainedModel:()=>s.UltravoxPreTrainedModel,UltravoxProcessor:()=>w.UltravoxProcessor,UniSpeechForCTC:()=>s.UniSpeechForCTC,UniSpeechForSequenceClassification:()=>s.UniSpeechForSequenceClassification,UniSpeechModel:()=>s.UniSpeechModel,UniSpeechPreTrainedModel:()=>s.UniSpeechPreTrainedModel,UniSpeechSatForAudioFrameClassification:()=>s.UniSpeechSatForAudioFrameClassification,UniSpeechSatForCTC:()=>s.UniSpeechSatForCTC,UniSpeechSatForSequenceClassification:()=>s.UniSpeechSatForSequenceClassification,UniSpeechSatModel:()=>s.UniSpeechSatModel,UniSpeechSatPreTrainedModel:()=>s.UniSpeechSatPreTrainedModel,VLChatProcessor:()=>w.VLChatProcessor,VLMImageProcessor:()=>g.VLMImageProcessor,ViTFeatureExtractor:()=>g.ViTFeatureExtractor,ViTForImageClassification:()=>s.ViTForImageClassification,ViTImageProcessor:()=>g.ViTImageProcessor,ViTMAEModel:()=>s.ViTMAEModel,ViTMAEPreTrainedModel:()=>s.ViTMAEPreTrainedModel,ViTMSNForImageClassification:()=>s.ViTMSNForImageClassification,ViTMSNModel:()=>s.ViTMSNModel,ViTMSNPreTrainedModel:()=>s.ViTMSNPreTrainedModel,ViTModel:()=>s.ViTModel,ViTPreTrainedModel:()=>s.ViTPreTrainedModel,VisionEncoderDecoderModel:()=>s.VisionEncoderDecoderModel,VitMatteForImageMatting:()=>s.VitMatteForImageMatting,VitMatteImageProcessor:()=>g.VitMatteImageProcessor,VitMattePreTrainedModel:()=>s.VitMattePreTrainedModel,VitPoseForPoseEstimation:()=>s.VitPoseForPoseEstimation,VitPoseImageProcessor:()=>g.VitPoseImageProcessor,VitPosePreTrainedModel:()=>s.VitPosePreTrainedModel,VitsModel:()=>s.VitsModel,VitsModelOutput:()=>s.VitsModelOutput,VitsPreTrainedModel:()=>s.VitsPreTrainedModel,VitsTokenizer:()=>o.VitsTokenizer,Wav2Vec2BertForCTC:()=>s.Wav2Vec2BertForCTC,Wav2Vec2BertForSequenceClassification:()=>s.Wav2Vec2BertForSequenceClassification,Wav2Vec2BertModel:()=>s.Wav2Vec2BertModel,Wav2Vec2BertPreTrainedModel:()=>s.Wav2Vec2BertPreTrainedModel,Wav2Vec2CTCTokenizer:()=>o.Wav2Vec2CTCTokenizer,Wav2Vec2FeatureExtractor:()=>p.Wav2Vec2FeatureExtractor,Wav2Vec2ForAudioFrameClassification:()=>s.Wav2Vec2ForAudioFrameClassification,Wav2Vec2ForCTC:()=>s.Wav2Vec2ForCTC,Wav2Vec2ForSequenceClassification:()=>s.Wav2Vec2ForSequenceClassification,Wav2Vec2Model:()=>s.Wav2Vec2Model,Wav2Vec2PreTrainedModel:()=>s.Wav2Vec2PreTrainedModel,Wav2Vec2Processor:()=>w.Wav2Vec2Processor,Wav2Vec2ProcessorWithLM:()=>w.Wav2Vec2ProcessorWithLM,WavLMForAudioFrameClassification:()=>s.WavLMForAudioFrameClassification,WavLMForCTC:()=>s.WavLMForCTC,WavLMForSequenceClassification:()=>s.WavLMForSequenceClassification,WavLMForXVector:()=>s.WavLMForXVector,WavLMModel:()=>s.WavLMModel,WavLMPreTrainedModel:()=>s.WavLMPreTrainedModel,WeSpeakerFeatureExtractor:()=>p.WeSpeakerFeatureExtractor,WeSpeakerResNetModel:()=>s.WeSpeakerResNetModel,WeSpeakerResNetPreTrainedModel:()=>s.WeSpeakerResNetPreTrainedModel,WhisperFeatureExtractor:()=>p.WhisperFeatureExtractor,WhisperForConditionalGeneration:()=>s.WhisperForConditionalGeneration,WhisperModel:()=>s.WhisperModel,WhisperPreTrainedModel:()=>s.WhisperPreTrainedModel,WhisperProcessor:()=>w.WhisperProcessor,WhisperTextStreamer:()=>b.WhisperTextStreamer,WhisperTimeStampLogitsProcessor:()=>P.WhisperTimeStampLogitsProcessor,WhisperTokenizer:()=>o.WhisperTokenizer,XLMForQuestionAnswering:()=>s.XLMForQuestionAnswering,XLMForSequenceClassification:()=>s.XLMForSequenceClassification,XLMForTokenClassification:()=>s.XLMForTokenClassification,XLMModel:()=>s.XLMModel,XLMPreTrainedModel:()=>s.XLMPreTrainedModel,XLMRobertaForMaskedLM:()=>s.XLMRobertaForMaskedLM,XLMRobertaForQuestionAnswering:()=>s.XLMRobertaForQuestionAnswering,XLMRobertaForSequenceClassification:()=>s.XLMRobertaForSequenceClassification,XLMRobertaForTokenClassification:()=>s.XLMRobertaForTokenClassification,XLMRobertaModel:()=>s.XLMRobertaModel,XLMRobertaPreTrainedModel:()=>s.XLMRobertaPreTrainedModel,XLMRobertaTokenizer:()=>o.XLMRobertaTokenizer,XLMTokenizer:()=>o.XLMTokenizer,XLMWithLMHeadModel:()=>s.XLMWithLMHeadModel,XVectorOutput:()=>s.XVectorOutput,YolosFeatureExtractor:()=>g.YolosFeatureExtractor,YolosForObjectDetection:()=>s.YolosForObjectDetection,YolosImageProcessor:()=>g.YolosImageProcessor,YolosModel:()=>s.YolosModel,YolosObjectDetectionOutput:()=>s.YolosObjectDetectionOutput,YolosPreTrainedModel:()=>s.YolosPreTrainedModel,ZeroShotAudioClassificationPipeline:()=>t.ZeroShotAudioClassificationPipeline,ZeroShotClassificationPipeline:()=>t.ZeroShotClassificationPipeline,ZeroShotImageClassificationPipeline:()=>t.ZeroShotImageClassificationPipeline,ZeroShotObjectDetectionPipeline:()=>t.ZeroShotObjectDetectionPipeline,bankers_round:()=>c.bankers_round,cat:()=>l.cat,cos_sim:()=>c.cos_sim,dot:()=>c.dot,dynamic_time_warping:()=>c.dynamic_time_warping,env:()=>e.env,full:()=>l.full,full_like:()=>l.full_like,getKeyValueShapes:()=>r.getKeyValueShapes,hamming:()=>n.hamming,hanning:()=>n.hanning,interpolate:()=>l.interpolate,interpolate_4d:()=>l.interpolate_4d,interpolate_data:()=>c.interpolate_data,is_chinese_char:()=>o.is_chinese_char,layer_norm:()=>l.layer_norm,load_image:()=>a.load_image,load_video:()=>i.load_video,log_softmax:()=>c.log_softmax,magnitude:()=>c.magnitude,matmul:()=>l.matmul,max:()=>c.max,mean:()=>l.mean,mean_pooling:()=>l.mean_pooling,medianFilter:()=>c.medianFilter,mel_filter_bank:()=>n.mel_filter_bank,min:()=>c.min,ones:()=>l.ones,ones_like:()=>l.ones_like,permute:()=>l.permute,permute_data:()=>c.permute_data,pipeline:()=>t.pipeline,quantize_embeddings:()=>l.quantize_embeddings,rand:()=>l.rand,read_audio:()=>n.read_audio,rfft:()=>l.rfft,round:()=>c.round,slice:()=>l.slice,softmax:()=>c.softmax,spectrogram:()=>n.spectrogram,stack:()=>l.stack,std_mean:()=>l.std_mean,topk:()=>l.topk,window_function:()=>n.window_function,zeros:()=>l.zeros,zeros_like:()=>l.zeros_like});var e=d("./src/env.js"),t=d("./src/pipelines.js"),s=d("./src/models.js"),o=d("./src/tokenizers.js"),r=d("./src/configs.js"),n=d("./src/utils/audio.js"),a=d("./src/utils/image.js"),i=d("./src/utils/video.js"),l=d("./src/utils/tensor.js"),c=d("./src/utils/maths.js"),_=d("./src/base/feature_extraction_utils.js"),p=d("./src/models/feature_extractors.js"),m=d("./src/models/auto/feature_extraction_auto.js"),h=d("./src/base/image_processors_utils.js"),g=d("./src/models/image_processors.js"),f=d("./src/models/auto/image_processing_auto.js"),M=d("./src/base/processing_utils.js"),w=d("./src/models/processors.js"),T=d("./src/models/auto/processing_auto.js"),b=d("./src/generation/streamers.js"),x=d("./src/generation/stopping_criteria.js"),P=d("./src/generation/logits_process.js")})();var _=u.ASTFeatureExtractor,p=u.ASTForAudioClassification,m=u.ASTModel,h=u.ASTPreTrainedModel,g=u.AlbertForMaskedLM,f=u.AlbertForQuestionAnswering,M=u.AlbertForSequenceClassification,w=u.AlbertModel,T=u.AlbertPreTrainedModel,b=u.AlbertTokenizer,x=u.AudioClassificationPipeline,P=u.AutoConfig,k=u.AutoFeatureExtractor,F=u.AutoImageProcessor,y=u.AutoModel,v=u.AutoModelForAudioClassification,C=u.AutoModelForAudioFrameClassification,S=u.AutoModelForAudioTextToText,A=u.AutoModelForCTC,E=u.AutoModelForCausalLM,L=u.AutoModelForDepthEstimation,I=u.AutoModelForDocumentQuestionAnswering,z=u.AutoModelForImageClassification,V=u.AutoModelForImageFeatureExtraction,j=u.AutoModelForImageMatting,N=u.AutoModelForImageSegmentation,D=u.AutoModelForImageTextToText,O=u.AutoModelForImageToImage,B=u.AutoModelForMaskGeneration,G=u.AutoModelForMaskedLM,R=u.AutoModelForNormalEstimation,q=u.AutoModelForObjectDetection,W=u.AutoModelForPoseEstimation,$=u.AutoModelForQuestionAnswering,U=u.AutoModelForSemanticSegmentation,X=u.AutoModelForSeq2SeqLM,Q=u.AutoModelForSequenceClassification,H=u.AutoModelForSpeechSeq2Seq,J=u.AutoModelForTextToSpectrogram,Y=u.AutoModelForTextToWaveform,K=u.AutoModelForTokenClassification,Z=u.AutoModelForUniversalSegmentation,ee=u.AutoModelForVision2Seq,te=u.AutoModelForXVector,se=u.AutoModelForZeroShotObjectDetection,oe=u.AutoProcessor,re=u.AutoTokenizer,ne=u.AutomaticSpeechRecognitionPipeline,ae=u.BackgroundRemovalPipeline,ie=u.BartForConditionalGeneration,le=u.BartForSequenceClassification,ce=u.BartModel,de=u.BartPretrainedModel,ue=u.BartTokenizer,_e=u.BaseModelOutput,pe=u.BaseStreamer,me=u.BeitFeatureExtractor,he=u.BeitForImageClassification,ge=u.BeitModel,fe=u.BeitPreTrainedModel,Me=u.BertForMaskedLM,we=u.BertForQuestionAnswering,Te=u.BertForSequenceClassification,be=u.BertForTokenClassification,xe=u.BertModel,Pe=u.BertPreTrainedModel,ke=u.BertTokenizer,Fe=u.BitImageProcessor,ye=u.BlenderbotForConditionalGeneration,ve=u.BlenderbotModel,Ce=u.BlenderbotPreTrainedModel,Se=u.BlenderbotSmallForConditionalGeneration,Ae=u.BlenderbotSmallModel,Ee=u.BlenderbotSmallPreTrainedModel,Le=u.BlenderbotSmallTokenizer,Ie=u.BlenderbotTokenizer,ze=u.BloomForCausalLM,Ve=u.BloomModel,je=u.BloomPreTrainedModel,Ne=u.BloomTokenizer,De=u.CLIPFeatureExtractor,Oe=u.CLIPImageProcessor,Be=u.CLIPModel,Ge=u.CLIPPreTrainedModel,Re=u.CLIPSegForImageSegmentation,qe=u.CLIPSegModel,We=u.CLIPSegPreTrainedModel,$e=u.CLIPTextModel,Ue=u.CLIPTextModelWithProjection,Xe=u.CLIPTokenizer,Qe=u.CLIPVisionModel,He=u.CLIPVisionModelWithProjection,Je=u.CamembertForMaskedLM,Ye=u.CamembertForQuestionAnswering,Ke=u.CamembertForSequenceClassification,Ze=u.CamembertForTokenClassification,et=u.CamembertModel,tt=u.CamembertPreTrainedModel,st=u.CamembertTokenizer,ot=u.CausalLMOutput,rt=u.CausalLMOutputWithPast,nt=u.ChineseCLIPFeatureExtractor,at=u.ChineseCLIPModel,it=u.ChineseCLIPPreTrainedModel,lt=u.ClapAudioModelWithProjection,ct=u.ClapFeatureExtractor,dt=u.ClapModel,ut=u.ClapPreTrainedModel,_t=u.ClapTextModelWithProjection,pt=u.ClassifierFreeGuidanceLogitsProcessor,mt=u.CodeGenForCausalLM,ht=u.CodeGenModel,gt=u.CodeGenPreTrainedModel,ft=u.CodeGenTokenizer,Mt=u.CodeLlamaTokenizer,wt=u.CohereForCausalLM,Tt=u.CohereModel,bt=u.CoherePreTrainedModel,xt=u.CohereTokenizer,Pt=u.ConvBertForMaskedLM,kt=u.ConvBertForQuestionAnswering,Ft=u.ConvBertForSequenceClassification,yt=u.ConvBertForTokenClassification,vt=u.ConvBertModel,Ct=u.ConvBertPreTrainedModel,St=u.ConvBertTokenizer,At=u.ConvNextFeatureExtractor,Et=u.ConvNextForImageClassification,Lt=u.ConvNextImageProcessor,It=u.ConvNextModel,zt=u.ConvNextPreTrainedModel,Vt=u.ConvNextV2ForImageClassification,jt=u.ConvNextV2Model,Nt=u.ConvNextV2PreTrainedModel,Dt=u.DPTFeatureExtractor,Ot=u.DPTForDepthEstimation,Bt=u.DPTImageProcessor,Gt=u.DPTModel,Rt=u.DPTPreTrainedModel,qt=u.DacDecoderModel,Wt=u.DacDecoderOutput,$t=u.DacEncoderModel,Ut=u.DacEncoderOutput,Xt=u.DacFeatureExtractor,Qt=u.DacModel,Ht=u.DacPreTrainedModel,Jt=u.DataTypeMap,Yt=u.DebertaForMaskedLM,Kt=u.DebertaForQuestionAnswering,Zt=u.DebertaForSequenceClassification,es=u.DebertaForTokenClassification,ts=u.DebertaModel,ss=u.DebertaPreTrainedModel,os=u.DebertaTokenizer,rs=u.DebertaV2ForMaskedLM,ns=u.DebertaV2ForQuestionAnswering,as=u.DebertaV2ForSequenceClassification,is=u.DebertaV2ForTokenClassification,ls=u.DebertaV2Model,cs=u.DebertaV2PreTrainedModel,ds=u.DebertaV2Tokenizer,us=u.DecisionTransformerModel,_s=u.DecisionTransformerPreTrainedModel,ps=u.DeiTFeatureExtractor,ms=u.DeiTForImageClassification,hs=u.DeiTImageProcessor,gs=u.DeiTModel,fs=u.DeiTPreTrainedModel,Ms=u.DepthAnythingForDepthEstimation,ws=u.DepthAnythingPreTrainedModel,Ts=u.DepthEstimationPipeline,bs=u.DepthProForDepthEstimation,xs=u.DepthProPreTrainedModel,Ps=u.DetrFeatureExtractor,ks=u.DetrForObjectDetection,Fs=u.DetrForSegmentation,ys=u.DetrImageProcessor,vs=u.DetrModel,Cs=u.DetrObjectDetectionOutput,Ss=u.DetrPreTrainedModel,As=u.DetrSegmentationOutput,Es=u.Dinov2ForImageClassification,Ls=u.Dinov2Model,Is=u.Dinov2PreTrainedModel,zs=u.Dinov2WithRegistersForImageClassification,Vs=u.Dinov2WithRegistersModel,js=u.Dinov2WithRegistersPreTrainedModel,Ns=u.DistilBertForMaskedLM,Ds=u.DistilBertForQuestionAnswering,Os=u.DistilBertForSequenceClassification,Bs=u.DistilBertForTokenClassification,Gs=u.DistilBertModel,Rs=u.DistilBertPreTrainedModel,qs=u.DistilBertTokenizer,Ws=u.DocumentQuestionAnsweringPipeline,$s=u.DonutFeatureExtractor,Us=u.DonutImageProcessor,Xs=u.DonutSwinModel,Qs=u.DonutSwinPreTrainedModel,Hs=u.EfficientNetForImageClassification,Js=u.EfficientNetImageProcessor,Ys=u.EfficientNetModel,Ks=u.EfficientNetPreTrainedModel,Zs=u.ElectraForMaskedLM,eo=u.ElectraForQuestionAnswering,to=u.ElectraForSequenceClassification,so=u.ElectraForTokenClassification,oo=u.ElectraModel,ro=u.ElectraPreTrainedModel,no=u.ElectraTokenizer,ao=u.EncodecFeatureExtractor,io=u.EosTokenCriteria,lo=u.EsmForMaskedLM,co=u.EsmForSequenceClassification,uo=u.EsmForTokenClassification,_o=u.EsmModel,po=u.EsmPreTrainedModel,mo=u.EsmTokenizer,ho=u.ExaoneForCausalLM,go=u.ExaoneModel,fo=u.ExaonePreTrainedModel,Mo=u.FFT,wo=u.FalconForCausalLM,To=u.FalconModel,bo=u.FalconPreTrainedModel,xo=u.FalconTokenizer,Po=u.FastViTForImageClassification,ko=u.FastViTModel,Fo=u.FastViTPreTrainedModel,yo=u.FeatureExtractionPipeline,vo=u.FeatureExtractor,Co=u.FillMaskPipeline,So=u.Florence2ForConditionalGeneration,Ao=u.Florence2PreTrainedModel,Eo=u.Florence2Processor,Lo=u.ForcedBOSTokenLogitsProcessor,Io=u.ForcedEOSTokenLogitsProcessor,zo=u.GLPNFeatureExtractor,Vo=u.GLPNForDepthEstimation,jo=u.GLPNModel,No=u.GLPNPreTrainedModel,Do=u.GPT2LMHeadModel,Oo=u.GPT2Model,Bo=u.GPT2PreTrainedModel,Go=u.GPT2Tokenizer,Ro=u.GPTBigCodeForCausalLM,qo=u.GPTBigCodeModel,Wo=u.GPTBigCodePreTrainedModel,$o=u.GPTJForCausalLM,Uo=u.GPTJModel,Xo=u.GPTJPreTrainedModel,Qo=u.GPTNeoForCausalLM,Ho=u.GPTNeoModel,Jo=u.GPTNeoPreTrainedModel,Yo=u.GPTNeoXForCausalLM,Ko=u.GPTNeoXModel,Zo=u.GPTNeoXPreTrainedModel,er=u.GPTNeoXTokenizer,tr=u.Gemma2ForCausalLM,sr=u.Gemma2Model,or=u.Gemma2PreTrainedModel,rr=u.GemmaForCausalLM,nr=u.GemmaModel,ar=u.GemmaPreTrainedModel,ir=u.GemmaTokenizer,lr=u.GlmForCausalLM,cr=u.GlmModel,dr=u.GlmPreTrainedModel,ur=u.GraniteForCausalLM,_r=u.GraniteModel,pr=u.GranitePreTrainedModel,mr=u.Grok1Tokenizer,hr=u.GroundingDinoForObjectDetection,gr=u.GroundingDinoImageProcessor,fr=u.GroundingDinoPreTrainedModel,Mr=u.GroundingDinoProcessor,wr=u.GroupViTModel,Tr=u.GroupViTPreTrainedModel,br=u.HeliumForCausalLM,xr=u.HeliumModel,Pr=u.HeliumPreTrainedModel,kr=u.HerbertTokenizer,Fr=u.HieraForImageClassification,yr=u.HieraModel,vr=u.HieraPreTrainedModel,Cr=u.HubertForCTC,Sr=u.HubertForSequenceClassification,Ar=u.HubertModel,Er=u.HubertPreTrainedModel,Lr=u.IJepaForImageClassification,Ir=u.IJepaModel,zr=u.IJepaPreTrainedModel,Vr=u.Idefics3ForConditionalGeneration,jr=u.Idefics3ImageProcessor,Nr=u.Idefics3PreTrainedModel,Dr=u.Idefics3Processor,Or=u.ImageClassificationPipeline,Br=u.ImageFeatureExtractionPipeline,Gr=u.ImageFeatureExtractor,Rr=u.ImageMattingOutput,qr=u.ImageProcessor,Wr=u.ImageSegmentationPipeline,$r=u.ImageToImagePipeline,Ur=u.ImageToTextPipeline,Xr=u.InterruptableStoppingCriteria,Qr=u.JAISLMHeadModel,Hr=u.JAISModel,Jr=u.JAISPreTrainedModel,Yr=u.JinaCLIPImageProcessor,Kr=u.JinaCLIPModel,Zr=u.JinaCLIPPreTrainedModel,en=u.JinaCLIPProcessor,tn=u.JinaCLIPTextModel,sn=u.JinaCLIPVisionModel,on=u.LiteWhisperForConditionalGeneration,rn=u.LlamaForCausalLM,nn=u.LlamaModel,an=u.LlamaPreTrainedModel,ln=u.LlamaTokenizer,cn=u.LlavaForConditionalGeneration,dn=u.LlavaOnevisionForConditionalGeneration,un=u.LlavaOnevisionImageProcessor,_n=u.LlavaPreTrainedModel,pn=u.LogitsProcessor,mn=u.LogitsProcessorList,hn=u.LogitsWarper,gn=u.LongT5ForConditionalGeneration,fn=u.LongT5Model,Mn=u.LongT5PreTrainedModel,wn=u.M2M100ForConditionalGeneration,Tn=u.M2M100Model,bn=u.M2M100PreTrainedModel,xn=u.M2M100Tokenizer,Pn=u.MBart50Tokenizer,kn=u.MBartForCausalLM,Fn=u.MBartForConditionalGeneration,yn=u.MBartForSequenceClassification,vn=u.MBartModel,Cn=u.MBartPreTrainedModel,Sn=u.MBartTokenizer,An=u.MPNetForMaskedLM,En=u.MPNetForQuestionAnswering,Ln=u.MPNetForSequenceClassification,In=u.MPNetForTokenClassification,zn=u.MPNetModel,Vn=u.MPNetPreTrainedModel,jn=u.MPNetTokenizer,Nn=u.MT5ForConditionalGeneration,Dn=u.MT5Model,On=u.MT5PreTrainedModel,Bn=u.MarianMTModel,Gn=u.MarianModel,Rn=u.MarianPreTrainedModel,qn=u.MarianTokenizer,Wn=u.Mask2FormerImageProcessor,$n=u.MaskFormerFeatureExtractor,Un=u.MaskFormerForInstanceSegmentation,Xn=u.MaskFormerImageProcessor,Qn=u.MaskFormerModel,Hn=u.MaskFormerPreTrainedModel,Jn=u.MaskedLMOutput,Yn=u.MaxLengthCriteria,Kn=u.MgpstrForSceneTextRecognition,Zn=u.MgpstrModelOutput,ea=u.MgpstrPreTrainedModel,ta=u.MgpstrProcessor,sa=u.MgpstrTokenizer,oa=u.MimiDecoderModel,ra=u.MimiDecoderOutput,na=u.MimiEncoderModel,aa=u.MimiEncoderOutput,ia=u.MimiModel,la=u.MimiPreTrainedModel,ca=u.MinLengthLogitsProcessor,da=u.MinNewTokensLengthLogitsProcessor,ua=u.MistralForCausalLM,_a=u.MistralModel,pa=u.MistralPreTrainedModel,ma=u.MobileBertForMaskedLM,ha=u.MobileBertForQuestionAnswering,ga=u.MobileBertForSequenceClassification,fa=u.MobileBertModel,Ma=u.MobileBertPreTrainedModel,wa=u.MobileBertTokenizer,Ta=u.MobileLLMForCausalLM,ba=u.MobileLLMModel,xa=u.MobileLLMPreTrainedModel,Pa=u.MobileNetV1FeatureExtractor,ka=u.MobileNetV1ForImageClassification,Fa=u.MobileNetV1ForSemanticSegmentation,ya=u.MobileNetV1ImageProcessor,va=u.MobileNetV1Model,Ca=u.MobileNetV1PreTrainedModel,Sa=u.MobileNetV2FeatureExtractor,Aa=u.MobileNetV2ForImageClassification,Ea=u.MobileNetV2ForSemanticSegmentation,La=u.MobileNetV2ImageProcessor,Ia=u.MobileNetV2Model,za=u.MobileNetV2PreTrainedModel,Va=u.MobileNetV3FeatureExtractor,ja=u.MobileNetV3ForImageClassification,Na=u.MobileNetV3ForSemanticSegmentation,Da=u.MobileNetV3ImageProcessor,Oa=u.MobileNetV3Model,Ba=u.MobileNetV3PreTrainedModel,Ga=u.MobileNetV4FeatureExtractor,Ra=u.MobileNetV4ForImageClassification,qa=u.MobileNetV4ForSemanticSegmentation,Wa=u.MobileNetV4ImageProcessor,$a=u.MobileNetV4Model,Ua=u.MobileNetV4PreTrainedModel,Xa=u.MobileViTFeatureExtractor,Qa=u.MobileViTForImageClassification,Ha=u.MobileViTImageProcessor,Ja=u.MobileViTModel,Ya=u.MobileViTPreTrainedModel,Ka=u.MobileViTV2ForImageClassification,Za=u.MobileViTV2Model,ei=u.MobileViTV2PreTrainedModel,ti=u.ModelOutput,si=u.ModernBertForMaskedLM,oi=u.ModernBertForSequenceClassification,ri=u.ModernBertForTokenClassification,ni=u.ModernBertModel,ai=u.ModernBertPreTrainedModel,ii=u.Moondream1ForConditionalGeneration,li=u.MoonshineFeatureExtractor,ci=u.MoonshineForConditionalGeneration,di=u.MoonshineModel,ui=u.MoonshinePreTrainedModel,_i=u.MoonshineProcessor,pi=u.MptForCausalLM,mi=u.MptModel,hi=u.MptPreTrainedModel,gi=u.MultiModalityCausalLM,fi=u.MultiModalityPreTrainedModel,Mi=u.MusicgenForCausalLM,wi=u.MusicgenForConditionalGeneration,Ti=u.MusicgenModel,bi=u.MusicgenPreTrainedModel,xi=u.NllbTokenizer,Pi=u.NoBadWordsLogitsProcessor,ki=u.NoRepeatNGramLogitsProcessor,Fi=u.NomicBertModel,yi=u.NomicBertPreTrainedModel,vi=u.NougatImageProcessor,Ci=u.NougatTokenizer,Si=u.OPTForCausalLM,Ai=u.OPTModel,Ei=u.OPTPreTrainedModel,Li=u.ObjectDetectionPipeline,Ii=u.Olmo2ForCausalLM,zi=u.Olmo2Model,Vi=u.Olmo2PreTrainedModel,ji=u.OlmoForCausalLM,Ni=u.OlmoModel,Di=u.OlmoPreTrainedModel,Oi=u.OpenELMForCausalLM,Bi=u.OpenELMModel,Gi=u.OpenELMPreTrainedModel,Ri=u.OwlViTFeatureExtractor,qi=u.OwlViTForObjectDetection,Wi=u.OwlViTImageProcessor,$i=u.OwlViTModel,Ui=u.OwlViTPreTrainedModel,Xi=u.OwlViTProcessor,Qi=u.Owlv2ForObjectDetection,Hi=u.Owlv2ImageProcessor,Ji=u.Owlv2Model,Yi=u.Owlv2PreTrainedModel,Ki=u.PaliGemmaForConditionalGeneration,Zi=u.PaliGemmaPreTrainedModel,el=u.PaliGemmaProcessor,tl=u.PatchTSMixerForPrediction,sl=u.PatchTSMixerModel,ol=u.PatchTSMixerPreTrainedModel,rl=u.PatchTSTForPrediction,nl=u.PatchTSTModel,al=u.PatchTSTPreTrainedModel,il=u.Phi3ForCausalLM,ll=u.Phi3Model,cl=u.Phi3PreTrainedModel,dl=u.Phi3VForCausalLM,ul=u.Phi3VImageProcessor,_l=u.Phi3VPreTrainedModel,pl=u.Phi3VProcessor,ml=u.PhiForCausalLM,hl=u.PhiModel,gl=u.PhiPreTrainedModel,fl=u.Pipeline,Ml=u.PreTrainedModel,wl=u.PreTrainedTokenizer,Tl=u.PretrainedConfig,bl=u.PretrainedMixin,xl=u.Processor,Pl=u.PvtForImageClassification,kl=u.PvtImageProcessor,Fl=u.PvtModel,yl=u.PvtPreTrainedModel,vl=u.PyAnnoteFeatureExtractor,Cl=u.PyAnnoteForAudioFrameClassification,Sl=u.PyAnnoteModel,Al=u.PyAnnotePreTrainedModel,El=u.PyAnnoteProcessor,Ll=u.QuestionAnsweringModelOutput,Il=u.QuestionAnsweringPipeline,zl=u.Qwen2ForCausalLM,Vl=u.Qwen2Model,jl=u.Qwen2PreTrainedModel,Nl=u.Qwen2Tokenizer,Dl=u.Qwen2VLForConditionalGeneration,Ol=u.Qwen2VLImageProcessor,Bl=u.Qwen2VLPreTrainedModel,Gl=u.Qwen2VLProcessor,Rl=u.RTDetrForObjectDetection,ql=u.RTDetrImageProcessor,Wl=u.RTDetrModel,$l=u.RTDetrObjectDetectionOutput,Ul=u.RTDetrPreTrainedModel,Xl=u.RawAudio,Ql=u.RawImage,Hl=u.RawVideo,Jl=u.RawVideoFrame,Yl=u.RepetitionPenaltyLogitsProcessor,Kl=u.ResNetForImageClassification,Zl=u.ResNetModel,ec=u.ResNetPreTrainedModel,tc=u.RoFormerForMaskedLM,sc=u.RoFormerForQuestionAnswering,oc=u.RoFormerForSequenceClassification,rc=u.RoFormerForTokenClassification,nc=u.RoFormerModel,ac=u.RoFormerPreTrainedModel,ic=u.RoFormerTokenizer,lc=u.RobertaForMaskedLM,cc=u.RobertaForQuestionAnswering,dc=u.RobertaForSequenceClassification,uc=u.RobertaForTokenClassification,_c=u.RobertaModel,pc=u.RobertaPreTrainedModel,mc=u.RobertaTokenizer,hc=u.SamImageProcessor,gc=u.SamImageSegmentationOutput,fc=u.SamModel,Mc=u.SamPreTrainedModel,wc=u.SamProcessor,Tc=u.SapiensForDepthEstimation,bc=u.SapiensForNormalEstimation,xc=u.SapiensForSemanticSegmentation,Pc=u.SapiensPreTrainedModel,kc=u.SeamlessM4TFeatureExtractor,Fc=u.SegformerFeatureExtractor,yc=u.SegformerForImageClassification,vc=u.SegformerForSemanticSegmentation,Cc=u.SegformerImageProcessor,Sc=u.SegformerModel,Ac=u.SegformerPreTrainedModel,Ec=u.Seq2SeqLMOutput,Lc=u.SequenceClassifierOutput,Ic=u.SiglipImageProcessor,zc=u.SiglipModel,Vc=u.SiglipPreTrainedModel,jc=u.SiglipTextModel,Nc=u.SiglipTokenizer,Dc=u.SiglipVisionModel,Oc=u.SmolVLMForConditionalGeneration,Bc=u.SmolVLMImageProcessor,Gc=u.SmolVLMProcessor,Rc=u.SpeechT5FeatureExtractor,qc=u.SpeechT5ForSpeechToText,Wc=u.SpeechT5ForTextToSpeech,$c=u.SpeechT5HifiGan,Uc=u.SpeechT5Model,Xc=u.SpeechT5PreTrainedModel,Qc=u.SpeechT5Processor,Hc=u.SpeechT5Tokenizer,Jc=u.SqueezeBertForMaskedLM,Yc=u.SqueezeBertForQuestionAnswering,Kc=u.SqueezeBertForSequenceClassification,Zc=u.SqueezeBertModel,ed=u.SqueezeBertPreTrainedModel,td=u.SqueezeBertTokenizer,sd=u.StableLmForCausalLM,od=u.StableLmModel,rd=u.StableLmPreTrainedModel,nd=u.Starcoder2ForCausalLM,ad=u.Starcoder2Model,id=u.Starcoder2PreTrainedModel,ld=u.StoppingCriteria,cd=u.StoppingCriteriaList,dd=u.StyleTextToSpeech2Model,ud=u.StyleTextToSpeech2PreTrainedModel,_d=u.SummarizationPipeline,pd=u.SuppressTokensAtBeginLogitsProcessor,md=u.Swin2SRForImageSuperResolution,hd=u.Swin2SRImageProcessor,gd=u.Swin2SRModel,fd=u.Swin2SRPreTrainedModel,Md=u.SwinForImageClassification,wd=u.SwinForSemanticSegmentation,Td=u.SwinModel,bd=u.SwinPreTrainedModel,xd=u.T5ForConditionalGeneration,Pd=u.T5Model,kd=u.T5PreTrainedModel,Fd=u.T5Tokenizer,yd=u.TableTransformerForObjectDetection,vd=u.TableTransformerModel,Cd=u.TableTransformerObjectDetectionOutput,Sd=u.TableTransformerPreTrainedModel,Ad=u.TemperatureLogitsWarper,Ed=u.Tensor,Ld=u.Text2TextGenerationPipeline,Id=u.TextClassificationPipeline,zd=u.TextGenerationPipeline,Vd=u.TextStreamer,jd=u.TextToAudioPipeline,Nd=u.TokenClassificationPipeline,Dd=u.TokenClassifierOutput,Od=u.TokenizerModel,Bd=u.TopKLogitsWarper,Gd=u.TopPLogitsWarper,Rd=u.TrOCRForCausalLM,qd=u.TrOCRPreTrainedModel,Wd=u.TranslationPipeline,$d=u.UltravoxModel,Ud=u.UltravoxPreTrainedModel,Xd=u.UltravoxProcessor,Qd=u.UniSpeechForCTC,Hd=u.UniSpeechForSequenceClassification,Jd=u.UniSpeechModel,Yd=u.UniSpeechPreTrainedModel,Kd=u.UniSpeechSatForAudioFrameClassification,Zd=u.UniSpeechSatForCTC,eu=u.UniSpeechSatForSequenceClassification,tu=u.UniSpeechSatModel,su=u.UniSpeechSatPreTrainedModel,ou=u.VLChatProcessor,ru=u.VLMImageProcessor,nu=u.ViTFeatureExtractor,au=u.ViTForImageClassification,iu=u.ViTImageProcessor,lu=u.ViTMAEModel,cu=u.ViTMAEPreTrainedModel,du=u.ViTMSNForImageClassification,uu=u.ViTMSNModel,_u=u.ViTMSNPreTrainedModel,pu=u.ViTModel,mu=u.ViTPreTrainedModel,hu=u.VisionEncoderDecoderModel,gu=u.VitMatteForImageMatting,fu=u.VitMatteImageProcessor,Mu=u.VitMattePreTrainedModel,wu=u.VitPoseForPoseEstimation,Tu=u.VitPoseImageProcessor,bu=u.VitPosePreTrainedModel,xu=u.VitsModel,Pu=u.VitsModelOutput,ku=u.VitsPreTrainedModel,Fu=u.VitsTokenizer,yu=u.Wav2Vec2BertForCTC,vu=u.Wav2Vec2BertForSequenceClassification,Cu=u.Wav2Vec2BertModel,Su=u.Wav2Vec2BertPreTrainedModel,Au=u.Wav2Vec2CTCTokenizer,Eu=u.Wav2Vec2FeatureExtractor,Lu=u.Wav2Vec2ForAudioFrameClassification,Iu=u.Wav2Vec2ForCTC,zu=u.Wav2Vec2ForSequenceClassification,Vu=u.Wav2Vec2Model,ju=u.Wav2Vec2PreTrainedModel,Nu=u.Wav2Vec2Processor,Du=u.Wav2Vec2ProcessorWithLM,Ou=u.WavLMForAudioFrameClassification,Bu=u.WavLMForCTC,Gu=u.WavLMForSequenceClassification,Ru=u.WavLMForXVector,qu=u.WavLMModel,Wu=u.WavLMPreTrainedModel,$u=u.WeSpeakerFeatureExtractor,Uu=u.WeSpeakerResNetModel,Xu=u.WeSpeakerResNetPreTrainedModel,Qu=u.WhisperFeatureExtractor,Hu=u.WhisperForConditionalGeneration,Ju=u.WhisperModel,Yu=u.WhisperPreTrainedModel,Ku=u.WhisperProcessor,Zu=u.WhisperTextStreamer,e_=u.WhisperTimeStampLogitsProcessor,t_=u.WhisperTokenizer,s_=u.XLMForQuestionAnswering,o_=u.XLMForSequenceClassification,r_=u.XLMForTokenClassification,n_=u.XLMModel,a_=u.XLMPreTrainedModel,i_=u.XLMRobertaForMaskedLM,l_=u.XLMRobertaForQuestionAnswering,c_=u.XLMRobertaForSequenceClassification,d_=u.XLMRobertaForTokenClassification,u_=u.XLMRobertaModel,__=u.XLMRobertaPreTrainedModel,p_=u.XLMRobertaTokenizer,m_=u.XLMTokenizer,h_=u.XLMWithLMHeadModel,g_=u.XVectorOutput,f_=u.YolosFeatureExtractor,M_=u.YolosForObjectDetection,w_=u.YolosImageProcessor,T_=u.YolosModel,b_=u.YolosObjectDetectionOutput,x_=u.YolosPreTrainedModel,P_=u.ZeroShotAudioClassificationPipeline,k_=u.ZeroShotClassificationPipeline,F_=u.ZeroShotImageClassificationPipeline,y_=u.ZeroShotObjectDetectionPipeline,v_=u.bankers_round,C_=u.cat,S_=u.cos_sim,A_=u.dot,E_=u.dynamic_time_warping,L_=u.env,I_=u.full,z_=u.full_like,V_=u.getKeyValueShapes,j_=u.hamming,N_=u.hanning,D_=u.interpolate,O_=u.interpolate_4d,B_=u.interpolate_data,G_=u.is_chinese_char,R_=u.layer_norm,q_=u.load_image,W_=u.load_video,$_=u.log_softmax,U_=u.magnitude,X_=u.matmul,Q_=u.max,H_=u.mean,J_=u.mean_pooling,Y_=u.medianFilter,K_=u.mel_filter_bank,Z_=u.min,ep=u.ones,tp=u.ones_like,sp=u.permute,op=u.permute_data,rp=u.pipeline,np=u.quantize_embeddings,ap=u.rand,ip=u.read_audio,lp=u.rfft,cp=u.round,dp=u.slice,up=u.softmax,_p=u.spectrogram,pp=u.stack,mp=u.std_mean,hp=u.topk,gp=u.window_function,fp=u.zeros,Mp=u.zeros_like;export{_ as ASTFeatureExtractor,p as ASTForAudioClassification,m as ASTModel,h as ASTPreTrainedModel,g as AlbertForMaskedLM,f as AlbertForQuestionAnswering,M as AlbertForSequenceClassification,w as AlbertModel,T as AlbertPreTrainedModel,b as AlbertTokenizer,x as AudioClassificationPipeline,P as AutoConfig,k as AutoFeatureExtractor,F as AutoImageProcessor,y as AutoModel,v as AutoModelForAudioClassification,C as AutoModelForAudioFrameClassification,S as AutoModelForAudioTextToText,A as AutoModelForCTC,E as AutoModelForCausalLM,L as AutoModelForDepthEstimation,I as AutoModelForDocumentQuestionAnswering,z as AutoModelForImageClassification,V as AutoModelForImageFeatureExtraction,j as AutoModelForImageMatting,N as AutoModelForImageSegmentation,D as AutoModelForImageTextToText,O as AutoModelForImageToImage,B as AutoModelForMaskGeneration,G as AutoModelForMaskedLM,R as AutoModelForNormalEstimation,q as AutoModelForObjectDetection,W as AutoModelForPoseEstimation,$ as AutoModelForQuestionAnswering,U as AutoModelForSemanticSegmentation,X as AutoModelForSeq2SeqLM,Q as AutoModelForSequenceClassification,H as AutoModelForSpeechSeq2Seq,J as AutoModelForTextToSpectrogram,Y as AutoModelForTextToWaveform,K as AutoModelForTokenClassification,Z as AutoModelForUniversalSegmentation,ee as AutoModelForVision2Seq,te as AutoModelForXVector,se as AutoModelForZeroShotObjectDetection,oe as AutoProcessor,re as AutoTokenizer,ne as AutomaticSpeechRecognitionPipeline,ae as BackgroundRemovalPipeline,ie as BartForConditionalGeneration,le as BartForSequenceClassification,ce as BartModel,de as BartPretrainedModel,ue as BartTokenizer,_e as BaseModelOutput,pe as BaseStreamer,me as BeitFeatureExtractor,he as BeitForImageClassification,ge as BeitModel,fe as BeitPreTrainedModel,Me as BertForMaskedLM,we as BertForQuestionAnswering,Te as BertForSequenceClassification,be as BertForTokenClassification,xe as BertModel,Pe as BertPreTrainedModel,ke as BertTokenizer,Fe as BitImageProcessor,ye as BlenderbotForConditionalGeneration,ve as BlenderbotModel,Ce as BlenderbotPreTrainedModel,Se as BlenderbotSmallForConditionalGeneration,Ae as BlenderbotSmallModel,Ee as BlenderbotSmallPreTrainedModel,Le as BlenderbotSmallTokenizer,Ie as BlenderbotTokenizer,ze as BloomForCausalLM,Ve as BloomModel,je as BloomPreTrainedModel,Ne as BloomTokenizer,De as CLIPFeatureExtractor,Oe as CLIPImageProcessor,Be as CLIPModel,Ge as CLIPPreTrainedModel,Re as CLIPSegForImageSegmentation,qe as CLIPSegModel,We as CLIPSegPreTrainedModel,$e as CLIPTextModel,Ue as CLIPTextModelWithProjection,Xe as CLIPTokenizer,Qe as CLIPVisionModel,He as CLIPVisionModelWithProjection,Je as CamembertForMaskedLM,Ye as CamembertForQuestionAnswering,Ke as CamembertForSequenceClassification,Ze as CamembertForTokenClassification,et as CamembertModel,tt as CamembertPreTrainedModel,st as CamembertTokenizer,ot as CausalLMOutput,rt as CausalLMOutputWithPast,nt as ChineseCLIPFeatureExtractor,at as ChineseCLIPModel,it as ChineseCLIPPreTrainedModel,lt as ClapAudioModelWithProjection,ct as ClapFeatureExtractor,dt as ClapModel,ut as ClapPreTrainedModel,_t as ClapTextModelWithProjection,pt as ClassifierFreeGuidanceLogitsProcessor,mt as CodeGenForCausalLM,ht as CodeGenModel,gt as CodeGenPreTrainedModel,ft as CodeGenTokenizer,Mt as CodeLlamaTokenizer,wt as CohereForCausalLM,Tt as CohereModel,bt as CoherePreTrainedModel,xt as CohereTokenizer,Pt as ConvBertForMaskedLM,kt as ConvBertForQuestionAnswering,Ft as ConvBertForSequenceClassification,yt as ConvBertForTokenClassification,vt as ConvBertModel,Ct as ConvBertPreTrainedModel,St as ConvBertTokenizer,At as ConvNextFeatureExtractor,Et as ConvNextForImageClassification,Lt as ConvNextImageProcessor,It as ConvNextModel,zt as ConvNextPreTrainedModel,Vt as ConvNextV2ForImageClassification,jt as ConvNextV2Model,Nt as ConvNextV2PreTrainedModel,Dt as DPTFeatureExtractor,Ot as DPTForDepthEstimation,Bt as DPTImageProcessor,Gt as DPTModel,Rt as DPTPreTrainedModel,qt as DacDecoderModel,Wt as DacDecoderOutput,$t as DacEncoderModel,Ut as DacEncoderOutput,Xt as DacFeatureExtractor,Qt as DacModel,Ht as DacPreTrainedModel,Jt as DataTypeMap,Yt as DebertaForMaskedLM,Kt as DebertaForQuestionAnswering,Zt as DebertaForSequenceClassification,es as DebertaForTokenClassification,ts as DebertaModel,ss as DebertaPreTrainedModel,os as DebertaTokenizer,rs as DebertaV2ForMaskedLM,ns as DebertaV2ForQuestionAnswering,as as DebertaV2ForSequenceClassification,is as DebertaV2ForTokenClassification,ls as DebertaV2Model,cs as DebertaV2PreTrainedModel,ds as DebertaV2Tokenizer,us as DecisionTransformerModel,_s as DecisionTransformerPreTrainedModel,ps as DeiTFeatureExtractor,ms as DeiTForImageClassification,hs as DeiTImageProcessor,gs as DeiTModel,fs as DeiTPreTrainedModel,Ms as DepthAnythingForDepthEstimation,ws as DepthAnythingPreTrainedModel,Ts as DepthEstimationPipeline,bs as DepthProForDepthEstimation,xs as DepthProPreTrainedModel,Ps as DetrFeatureExtractor,ks as DetrForObjectDetection,Fs as DetrForSegmentation,ys as DetrImageProcessor,vs as DetrModel,Cs as DetrObjectDetectionOutput,Ss as DetrPreTrainedModel,As as DetrSegmentationOutput,Es as Dinov2ForImageClassification,Ls as Dinov2Model,Is as Dinov2PreTrainedModel,zs as Dinov2WithRegistersForImageClassification,Vs as Dinov2WithRegistersModel,js as Dinov2WithRegistersPreTrainedModel,Ns as DistilBertForMaskedLM,Ds as DistilBertForQuestionAnswering,Os as DistilBertForSequenceClassification,Bs as DistilBertForTokenClassification,Gs as DistilBertModel,Rs as DistilBertPreTrainedModel,qs as DistilBertTokenizer,Ws as DocumentQuestionAnsweringPipeline,$s as DonutFeatureExtractor,Us as DonutImageProcessor,Xs as DonutSwinModel,Qs as DonutSwinPreTrainedModel,Hs as EfficientNetForImageClassification,Js as EfficientNetImageProcessor,Ys as EfficientNetModel,Ks as EfficientNetPreTrainedModel,Zs as ElectraForMaskedLM,eo as ElectraForQuestionAnswering,to as ElectraForSequenceClassification,so as ElectraForTokenClassification,oo as ElectraModel,ro as ElectraPreTrainedModel,no as ElectraTokenizer,ao as EncodecFeatureExtractor,io as EosTokenCriteria,lo as EsmForMaskedLM,co as EsmForSequenceClassification,uo as EsmForTokenClassification,_o as EsmModel,po as EsmPreTrainedModel,mo as EsmTokenizer,ho as ExaoneForCausalLM,go as ExaoneModel,fo as ExaonePreTrainedModel,Mo as FFT,wo as FalconForCausalLM,To as FalconModel,bo as FalconPreTrainedModel,xo as FalconTokenizer,Po as FastViTForImageClassification,ko as FastViTModel,Fo as FastViTPreTrainedModel,yo as FeatureExtractionPipeline,vo as FeatureExtractor,Co as FillMaskPipeline,So as Florence2ForConditionalGeneration,Ao as Florence2PreTrainedModel,Eo as Florence2Processor,Lo as ForcedBOSTokenLogitsProcessor,Io as ForcedEOSTokenLogitsProcessor,zo as GLPNFeatureExtractor,Vo as GLPNForDepthEstimation,jo as GLPNModel,No as GLPNPreTrainedModel,Do as GPT2LMHeadModel,Oo as GPT2Model,Bo as GPT2PreTrainedModel,Go as GPT2Tokenizer,Ro as GPTBigCodeForCausalLM,qo as GPTBigCodeModel,Wo as GPTBigCodePreTrainedModel,$o as GPTJForCausalLM,Uo as GPTJModel,Xo as GPTJPreTrainedModel,Qo as GPTNeoForCausalLM,Ho as GPTNeoModel,Jo as GPTNeoPreTrainedModel,Yo as GPTNeoXForCausalLM,Ko as GPTNeoXModel,Zo as GPTNeoXPreTrainedModel,er as GPTNeoXTokenizer,tr as Gemma2ForCausalLM,sr as Gemma2Model,or as Gemma2PreTrainedModel,rr as GemmaForCausalLM,nr as GemmaModel,ar as GemmaPreTrainedModel,ir as GemmaTokenizer,lr as GlmForCausalLM,cr as GlmModel,dr as GlmPreTrainedModel,ur as GraniteForCausalLM,_r as GraniteModel,pr as GranitePreTrainedModel,mr as Grok1Tokenizer,hr as GroundingDinoForObjectDetection,gr as GroundingDinoImageProcessor,fr as GroundingDinoPreTrainedModel,Mr as GroundingDinoProcessor,wr as GroupViTModel,Tr as GroupViTPreTrainedModel,br as HeliumForCausalLM,xr as HeliumModel,Pr as HeliumPreTrainedModel,kr as HerbertTokenizer,Fr as HieraForImageClassification,yr as HieraModel,vr as HieraPreTrainedModel,Cr as HubertForCTC,Sr as HubertForSequenceClassification,Ar as HubertModel,Er as HubertPreTrainedModel,Lr as IJepaForImageClassification,Ir as IJepaModel,zr as IJepaPreTrainedModel,Vr as Idefics3ForConditionalGeneration,jr as Idefics3ImageProcessor,Nr as Idefics3PreTrainedModel,Dr as Idefics3Processor,Or as ImageClassificationPipeline,Br as ImageFeatureExtractionPipeline,Gr as ImageFeatureExtractor,Rr as ImageMattingOutput,qr as ImageProcessor,Wr as ImageSegmentationPipeline,$r as ImageToImagePipeline,Ur as ImageToTextPipeline,Xr as InterruptableStoppingCriteria,Qr as JAISLMHeadModel,Hr as JAISModel,Jr as JAISPreTrainedModel,Yr as JinaCLIPImageProcessor,Kr as JinaCLIPModel,Zr as JinaCLIPPreTrainedModel,en as JinaCLIPProcessor,tn as JinaCLIPTextModel,sn as JinaCLIPVisionModel,on as LiteWhisperForConditionalGeneration,rn as LlamaForCausalLM,nn as LlamaModel,an as LlamaPreTrainedModel,ln as LlamaTokenizer,cn as LlavaForConditionalGeneration,dn as LlavaOnevisionForConditionalGeneration,un as LlavaOnevisionImageProcessor,_n as LlavaPreTrainedModel,pn as LogitsProcessor,mn as LogitsProcessorList,hn as LogitsWarper,gn as LongT5ForConditionalGeneration,fn as LongT5Model,Mn as LongT5PreTrainedModel,wn as M2M100ForConditionalGeneration,Tn as M2M100Model,bn as M2M100PreTrainedModel,xn as M2M100Tokenizer,Pn as MBart50Tokenizer,kn as MBartForCausalLM,Fn as MBartForConditionalGeneration,yn as MBartForSequenceClassification,vn as MBartModel,Cn as MBartPreTrainedModel,Sn as MBartTokenizer,An as MPNetForMaskedLM,En as MPNetForQuestionAnswering,Ln as MPNetForSequenceClassification,In as MPNetForTokenClassification,zn as MPNetModel,Vn as MPNetPreTrainedModel,jn as MPNetTokenizer,Nn as MT5ForConditionalGeneration,Dn as MT5Model,On as MT5PreTrainedModel,Bn as MarianMTModel,Gn as MarianModel,Rn as MarianPreTrainedModel,qn as MarianTokenizer,Wn as Mask2FormerImageProcessor,$n as MaskFormerFeatureExtractor,Un as MaskFormerForInstanceSegmentation,Xn as MaskFormerImageProcessor,Qn as MaskFormerModel,Hn as MaskFormerPreTrainedModel,Jn as MaskedLMOutput,Yn as MaxLengthCriteria,Kn as MgpstrForSceneTextRecognition,Zn as MgpstrModelOutput,ea as MgpstrPreTrainedModel,ta as MgpstrProcessor,sa as MgpstrTokenizer,oa as MimiDecoderModel,ra as MimiDecoderOutput,na as MimiEncoderModel,aa as MimiEncoderOutput,ia as MimiModel,la as MimiPreTrainedModel,ca as MinLengthLogitsProcessor,da as MinNewTokensLengthLogitsProcessor,ua as MistralForCausalLM,_a as MistralModel,pa as MistralPreTrainedModel,ma as MobileBertForMaskedLM,ha as MobileBertForQuestionAnswering,ga as MobileBertForSequenceClassification,fa as MobileBertModel,Ma as MobileBertPreTrainedModel,wa as MobileBertTokenizer,Ta as MobileLLMForCausalLM,ba as MobileLLMModel,xa as MobileLLMPreTrainedModel,Pa as MobileNetV1FeatureExtractor,ka as MobileNetV1ForImageClassification,Fa as MobileNetV1ForSemanticSegmentation,ya as MobileNetV1ImageProcessor,va as MobileNetV1Model,Ca as MobileNetV1PreTrainedModel,Sa as MobileNetV2FeatureExtractor,Aa as MobileNetV2ForImageClassification,Ea as MobileNetV2ForSemanticSegmentation,La as MobileNetV2ImageProcessor,Ia as MobileNetV2Model,za as MobileNetV2PreTrainedModel,Va as MobileNetV3FeatureExtractor,ja as MobileNetV3ForImageClassification,Na as MobileNetV3ForSemanticSegmentation,Da as MobileNetV3ImageProcessor,Oa as MobileNetV3Model,Ba as MobileNetV3PreTrainedModel,Ga as MobileNetV4FeatureExtractor,Ra as MobileNetV4ForImageClassification,qa as MobileNetV4ForSemanticSegmentation,Wa as MobileNetV4ImageProcessor,$a as MobileNetV4Model,Ua as MobileNetV4PreTrainedModel,Xa as MobileViTFeatureExtractor,Qa as MobileViTForImageClassification,Ha as MobileViTImageProcessor,Ja as MobileViTModel,Ya as MobileViTPreTrainedModel,Ka as MobileViTV2ForImageClassification,Za as MobileViTV2Model,ei as MobileViTV2PreTrainedModel,ti as ModelOutput,si as ModernBertForMaskedLM,oi as ModernBertForSequenceClassification,ri as ModernBertForTokenClassification,ni as ModernBertModel,ai as ModernBertPreTrainedModel,ii as Moondream1ForConditionalGeneration,li as MoonshineFeatureExtractor,ci as MoonshineForConditionalGeneration,di as MoonshineModel,ui as MoonshinePreTrainedModel,_i as MoonshineProcessor,pi as MptForCausalLM,mi as MptModel,hi as MptPreTrainedModel,gi as MultiModalityCausalLM,fi as MultiModalityPreTrainedModel,Mi as MusicgenForCausalLM,wi as MusicgenForConditionalGeneration,Ti as MusicgenModel,bi as MusicgenPreTrainedModel,xi as NllbTokenizer,Pi as NoBadWordsLogitsProcessor,ki as NoRepeatNGramLogitsProcessor,Fi as NomicBertModel,yi as NomicBertPreTrainedModel,vi as NougatImageProcessor,Ci as NougatTokenizer,Si as OPTForCausalLM,Ai as OPTModel,Ei as OPTPreTrainedModel,Li as ObjectDetectionPipeline,Ii as Olmo2ForCausalLM,zi as Olmo2Model,Vi as Olmo2PreTrainedModel,ji as OlmoForCausalLM,Ni as OlmoModel,Di as OlmoPreTrainedModel,Oi as OpenELMForCausalLM,Bi as OpenELMModel,Gi as OpenELMPreTrainedModel,Ri as OwlViTFeatureExtractor,qi as OwlViTForObjectDetection,Wi as OwlViTImageProcessor,$i as OwlViTModel,Ui as OwlViTPreTrainedModel,Xi as OwlViTProcessor,Qi as Owlv2ForObjectDetection,Hi as Owlv2ImageProcessor,Ji as Owlv2Model,Yi as Owlv2PreTrainedModel,Ki as PaliGemmaForConditionalGeneration,Zi as PaliGemmaPreTrainedModel,el as PaliGemmaProcessor,tl as PatchTSMixerForPrediction,sl as PatchTSMixerModel,ol as PatchTSMixerPreTrainedModel,rl as PatchTSTForPrediction,nl as PatchTSTModel,al as PatchTSTPreTrainedModel,il as Phi3ForCausalLM,ll as Phi3Model,cl as Phi3PreTrainedModel,dl as Phi3VForCausalLM,ul as Phi3VImageProcessor,_l as Phi3VPreTrainedModel,pl as Phi3VProcessor,ml as PhiForCausalLM,hl as PhiModel,gl as PhiPreTrainedModel,fl as Pipeline,Ml as PreTrainedModel,wl as PreTrainedTokenizer,Tl as PretrainedConfig,bl as PretrainedMixin,xl as Processor,Pl as PvtForImageClassification,kl as PvtImageProcessor,Fl as PvtModel,yl as PvtPreTrainedModel,vl as PyAnnoteFeatureExtractor,Cl as PyAnnoteForAudioFrameClassification,Sl as PyAnnoteModel,Al as PyAnnotePreTrainedModel,El as PyAnnoteProcessor,Ll as QuestionAnsweringModelOutput,Il as QuestionAnsweringPipeline,zl as Qwen2ForCausalLM,Vl as Qwen2Model,jl as Qwen2PreTrainedModel,Nl as Qwen2Tokenizer,Dl as Qwen2VLForConditionalGeneration,Ol as Qwen2VLImageProcessor,Bl as Qwen2VLPreTrainedModel,Gl as Qwen2VLProcessor,Rl as RTDetrForObjectDetection,ql as RTDetrImageProcessor,Wl as RTDetrModel,$l as RTDetrObjectDetectionOutput,Ul as RTDetrPreTrainedModel,Xl as RawAudio,Ql as RawImage,Hl as RawVideo,Jl as RawVideoFrame,Yl as RepetitionPenaltyLogitsProcessor,Kl as ResNetForImageClassification,Zl as ResNetModel,ec as ResNetPreTrainedModel,tc as RoFormerForMaskedLM,sc as RoFormerForQuestionAnswering,oc as RoFormerForSequenceClassification,rc as RoFormerForTokenClassification,nc as RoFormerModel,ac as RoFormerPreTrainedModel,ic as RoFormerTokenizer,lc as RobertaForMaskedLM,cc as RobertaForQuestionAnswering,dc as RobertaForSequenceClassification,uc as RobertaForTokenClassification,_c as RobertaModel,pc as RobertaPreTrainedModel,mc as RobertaTokenizer,hc as SamImageProcessor,gc as SamImageSegmentationOutput,fc as SamModel,Mc as SamPreTrainedModel,wc as SamProcessor,Tc as SapiensForDepthEstimation,bc as SapiensForNormalEstimation,xc as SapiensForSemanticSegmentation,Pc as SapiensPreTrainedModel,kc as SeamlessM4TFeatureExtractor,Fc as SegformerFeatureExtractor,yc as SegformerForImageClassification,vc as SegformerForSemanticSegmentation,Cc as SegformerImageProcessor,Sc as SegformerModel,Ac as SegformerPreTrainedModel,Ec as Seq2SeqLMOutput,Lc as SequenceClassifierOutput,Ic as SiglipImageProcessor,zc as SiglipModel,Vc as SiglipPreTrainedModel,jc as SiglipTextModel,Nc as SiglipTokenizer,Dc as SiglipVisionModel,Oc as SmolVLMForConditionalGeneration,Bc as SmolVLMImageProcessor,Gc as SmolVLMProcessor,Rc as SpeechT5FeatureExtractor,qc as SpeechT5ForSpeechToText,Wc as SpeechT5ForTextToSpeech,$c as SpeechT5HifiGan,Uc as SpeechT5Model,Xc as SpeechT5PreTrainedModel,Qc as SpeechT5Processor,Hc as SpeechT5Tokenizer,Jc as SqueezeBertForMaskedLM,Yc as SqueezeBertForQuestionAnswering,Kc as SqueezeBertForSequenceClassification,Zc as SqueezeBertModel,ed as SqueezeBertPreTrainedModel,td as SqueezeBertTokenizer,sd as StableLmForCausalLM,od as StableLmModel,rd as StableLmPreTrainedModel,nd as Starcoder2ForCausalLM,ad as Starcoder2Model,id as Starcoder2PreTrainedModel,ld as StoppingCriteria,cd as StoppingCriteriaList,dd as StyleTextToSpeech2Model,ud as StyleTextToSpeech2PreTrainedModel,_d as SummarizationPipeline,pd as SuppressTokensAtBeginLogitsProcessor,md as Swin2SRForImageSuperResolution,hd as Swin2SRImageProcessor,gd as Swin2SRModel,fd as Swin2SRPreTrainedModel,Md as SwinForImageClassification,wd as SwinForSemanticSegmentation,Td as SwinModel,bd as SwinPreTrainedModel,xd as T5ForConditionalGeneration,Pd as T5Model,kd as T5PreTrainedModel,Fd as T5Tokenizer,yd as TableTransformerForObjectDetection,vd as TableTransformerModel,Cd as TableTransformerObjectDetectionOutput,Sd as TableTransformerPreTrainedModel,Ad as TemperatureLogitsWarper,Ed as Tensor,Ld as Text2TextGenerationPipeline,Id as TextClassificationPipeline,zd as TextGenerationPipeline,Vd as TextStreamer,jd as TextToAudioPipeline,Nd as TokenClassificationPipeline,Dd as TokenClassifierOutput,Od as TokenizerModel,Bd as TopKLogitsWarper,Gd as TopPLogitsWarper,Rd as TrOCRForCausalLM,qd as TrOCRPreTrainedModel,Wd as TranslationPipeline,$d as UltravoxModel,Ud as UltravoxPreTrainedModel,Xd as UltravoxProcessor,Qd as UniSpeechForCTC,Hd as UniSpeechForSequenceClassification,Jd as UniSpeechModel,Yd as UniSpeechPreTrainedModel,Kd as UniSpeechSatForAudioFrameClassification,Zd as UniSpeechSatForCTC,eu as UniSpeechSatForSequenceClassification,tu as UniSpeechSatModel,su as UniSpeechSatPreTrainedModel,ou as VLChatProcessor,ru as VLMImageProcessor,nu as ViTFeatureExtractor,au as ViTForImageClassification,iu as ViTImageProcessor,lu as ViTMAEModel,cu as ViTMAEPreTrainedModel,du as ViTMSNForImageClassification,uu as ViTMSNModel,_u as ViTMSNPreTrainedModel,pu as ViTModel,mu as ViTPreTrainedModel,hu as VisionEncoderDecoderModel,gu as VitMatteForImageMatting,fu as VitMatteImageProcessor,Mu as VitMattePreTrainedModel,wu as VitPoseForPoseEstimation,Tu as VitPoseImageProcessor,bu as VitPosePreTrainedModel,xu as VitsModel,Pu as VitsModelOutput,ku as VitsPreTrainedModel,Fu as VitsTokenizer,yu as Wav2Vec2BertForCTC,vu as Wav2Vec2BertForSequenceClassification,Cu as Wav2Vec2BertModel,Su as Wav2Vec2BertPreTrainedModel,Au as Wav2Vec2CTCTokenizer,Eu as Wav2Vec2FeatureExtractor,Lu as Wav2Vec2ForAudioFrameClassification,Iu as Wav2Vec2ForCTC,zu as Wav2Vec2ForSequenceClassification,Vu as Wav2Vec2Model,ju as Wav2Vec2PreTrainedModel,Nu as Wav2Vec2Processor,Du as Wav2Vec2ProcessorWithLM,Ou as WavLMForAudioFrameClassification,Bu as WavLMForCTC,Gu as WavLMForSequenceClassification,Ru as WavLMForXVector,qu as WavLMModel,Wu as WavLMPreTrainedModel,$u as WeSpeakerFeatureExtractor,Uu as WeSpeakerResNetModel,Xu as WeSpeakerResNetPreTrainedModel,Qu as WhisperFeatureExtractor,Hu as WhisperForConditionalGeneration,Ju as WhisperModel,Yu as WhisperPreTrainedModel,Ku as WhisperProcessor,Zu as WhisperTextStreamer,e_ as WhisperTimeStampLogitsProcessor,t_ as WhisperTokenizer,s_ as XLMForQuestionAnswering,o_ as XLMForSequenceClassification,r_ as XLMForTokenClassification,n_ as XLMModel,a_ as XLMPreTrainedModel,i_ as XLMRobertaForMaskedLM,l_ as XLMRobertaForQuestionAnswering,c_ as XLMRobertaForSequenceClassification,d_ as XLMRobertaForTokenClassification,u_ as XLMRobertaModel,__ as XLMRobertaPreTrainedModel,p_ as XLMRobertaTokenizer,m_ as XLMTokenizer,h_ as XLMWithLMHeadModel,g_ as XVectorOutput,f_ as YolosFeatureExtractor,M_ as YolosForObjectDetection,w_ as YolosImageProcessor,T_ as YolosModel,b_ as YolosObjectDetectionOutput,x_ as YolosPreTrainedModel,P_ as ZeroShotAudioClassificationPipeline,k_ as ZeroShotClassificationPipeline,F_ as ZeroShotImageClassificationPipeline,y_ as ZeroShotObjectDetectionPipeline,v_ as bankers_round,C_ as cat,S_ as cos_sim,A_ as dot,E_ as dynamic_time_warping,L_ as env,I_ as full,z_ as full_like,V_ as getKeyValueShapes,j_ as hamming,N_ as hanning,D_ as interpolate,O_ as interpolate_4d,B_ as interpolate_data,G_ as is_chinese_char,R_ as layer_norm,q_ as load_image,W_ as load_video,$_ as log_softmax,U_ as magnitude,X_ as matmul,Q_ as max,H_ as mean,J_ as mean_pooling,Y_ as medianFilter,K_ as mel_filter_bank,Z_ as min,ep as ones,tp as ones_like,sp as permute,op as permute_data,rp as pipeline,np as quantize_embeddings,ap as rand,ip as read_audio,lp as rfft,cp as round,dp as slice,up as softmax,_p as spectrogram,pp as stack,mp as std_mean,hp as topk,gp as window_function,fp as zeros,Mp as zeros_like};
|
|
1
|
+
import*as e from"fs";import*as t from"onnxruntime-common";import*as s from"onnxruntime-node";import*as o from"path";import*as r from"sharp";import*as n from"url";var a,i,l={fs:t=>{t.exports=e},"onnxruntime-common":e=>{e.exports=t},"onnxruntime-node":e=>{e.exports=s},path:e=>{e.exports=o},sharp:e=>{e.exports=r},url:e=>{e.exports=n},"?8b6b":()=>{},"./node_modules/@huggingface/jinja/dist/index.js":(e,t,s)=>{s.r(t),s.d(t,{Environment:()=>Y,Interpreter:()=>K,Template:()=>te,parse:()=>j,tokenize:()=>d});var o=Object.freeze({Text:"Text",NumericLiteral:"NumericLiteral",BooleanLiteral:"BooleanLiteral",NullLiteral:"NullLiteral",StringLiteral:"StringLiteral",Identifier:"Identifier",Equals:"Equals",OpenParen:"OpenParen",CloseParen:"CloseParen",OpenStatement:"OpenStatement",CloseStatement:"CloseStatement",OpenExpression:"OpenExpression",CloseExpression:"CloseExpression",OpenSquareBracket:"OpenSquareBracket",CloseSquareBracket:"CloseSquareBracket",OpenCurlyBracket:"OpenCurlyBracket",CloseCurlyBracket:"CloseCurlyBracket",Comma:"Comma",Dot:"Dot",Colon:"Colon",Pipe:"Pipe",CallOperator:"CallOperator",AdditiveBinaryOperator:"AdditiveBinaryOperator",MultiplicativeBinaryOperator:"MultiplicativeBinaryOperator",ComparisonBinaryOperator:"ComparisonBinaryOperator",UnaryOperator:"UnaryOperator",Set:"Set",If:"If",For:"For",In:"In",Is:"Is",NotIn:"NotIn",Else:"Else",EndIf:"EndIf",ElseIf:"ElseIf",EndFor:"EndFor",And:"And",Or:"Or",Not:"UnaryOperator",Macro:"Macro",EndMacro:"EndMacro"}),r=Object.freeze({set:o.Set,for:o.For,in:o.In,is:o.Is,if:o.If,else:o.Else,endif:o.EndIf,elif:o.ElseIf,endfor:o.EndFor,and:o.And,or:o.Or,not:o.Not,"not in":o.NotIn,macro:o.Macro,endmacro:o.EndMacro,true:o.BooleanLiteral,false:o.BooleanLiteral,none:o.NullLiteral,True:o.BooleanLiteral,False:o.BooleanLiteral,None:o.NullLiteral}),n=class{constructor(e,t){this.value=e,this.type=t}};function a(e){return/\w/.test(e)}function i(e){return/[0-9]/.test(e)}var l=[["{%",o.OpenStatement],["%}",o.CloseStatement],["{{",o.OpenExpression],["}}",o.CloseExpression],["(",o.OpenParen],[")",o.CloseParen],["{",o.OpenCurlyBracket],["}",o.CloseCurlyBracket],["[",o.OpenSquareBracket],["]",o.CloseSquareBracket],[",",o.Comma],[".",o.Dot],[":",o.Colon],["|",o.Pipe],["<=",o.ComparisonBinaryOperator],[">=",o.ComparisonBinaryOperator],["==",o.ComparisonBinaryOperator],["!=",o.ComparisonBinaryOperator],["<",o.ComparisonBinaryOperator],[">",o.ComparisonBinaryOperator],["+",o.AdditiveBinaryOperator],["-",o.AdditiveBinaryOperator],["*",o.MultiplicativeBinaryOperator],["/",o.MultiplicativeBinaryOperator],["%",o.MultiplicativeBinaryOperator],["=",o.Equals]],c=new Map([["n","\n"],["t","\t"],["r","\r"],["b","\b"],["f","\f"],["v","\v"],["'","'"],['"','"'],["\\","\\"]]);function d(e,t={}){const s=[],d=function(e,t={}){return e.endsWith("\n")&&(e=e.slice(0,-1)),e=e.replace(/{#.*?#}/gs,"{##}"),t.lstrip_blocks&&(e=e.replace(/^[ \t]*({[#%])/gm,"$1")),t.trim_blocks&&(e=e.replace(/([#%]})\n/g,"$1")),e.replace(/{##}/g,"").replace(/-%}\s*/g,"%}").replace(/\s*{%-/g,"{%").replace(/-}}\s*/g,"}}").replace(/\s*{{-/g,"{{")}(e,t);let u=0;const _=e=>{let t="";for(;e(d[u]);)if("\\"!==d[u]){if(t+=d[u++],u>=d.length)throw new SyntaxError("Unexpected end of input")}else{if(++u,u>=d.length)throw new SyntaxError("Unexpected end of input");const e=d[u++],s=c.get(e);if(void 0===s)throw new SyntaxError(`Unexpected escaped character: ${e}`);t+=s}return t};e:for(;u<d.length;){const e=s.at(-1)?.type;if(void 0===e||e===o.CloseStatement||e===o.CloseExpression){let e="";for(;u<d.length&&("{"!==d[u]||"%"!==d[u+1]&&"{"!==d[u+1]);)e+=d[u++];if(e.length>0){s.push(new n(e,o.Text));continue}}_((e=>/\s/.test(e)));const t=d[u];if("-"===t||"+"===t){const e=s.at(-1)?.type;if(e===o.Text||void 0===e)throw new SyntaxError(`Unexpected character: ${t}`);switch(e){case o.Identifier:case o.NumericLiteral:case o.BooleanLiteral:case o.NullLiteral:case o.StringLiteral:case o.CloseParen:case o.CloseSquareBracket:break;default:{++u;const e=_(i);s.push(new n(`${t}${e}`,e.length>0?o.NumericLiteral:o.UnaryOperator));continue}}}for(const[e,t]of l){if(d.slice(u,u+e.length)===e){s.push(new n(e,t)),u+=e.length;continue e}}if("'"!==t&&'"'!==t)if(i(t)){const e=_(i);s.push(new n(e,o.NumericLiteral))}else{if(!a(t))throw new SyntaxError(`Unexpected character: ${t}`);{const e=_(a),t=Object.hasOwn(r,e)?r[e]:o.Identifier;t===o.In&&s.at(-1)?.type===o.Not?(s.pop(),s.push(new n("not in",o.NotIn))):s.push(new n(e,t))}}else{++u;const e=_((e=>e!==t));s.push(new n(e,o.StringLiteral)),++u}}return s}var u=class{type="Statement"},_=class extends u{constructor(e){super(),this.body=e}type="Program"},m=class extends u{constructor(e,t,s){super(),this.test=e,this.body=t,this.alternate=s}type="If"},p=class extends u{constructor(e,t,s,o){super(),this.loopvar=e,this.iterable=t,this.body=s,this.defaultBlock=o}type="For"},h=class extends u{constructor(e,t){super(),this.assignee=e,this.value=t}type="Set"},g=class extends u{constructor(e,t,s){super(),this.name=e,this.args=t,this.body=s}type="Macro"},f=class extends u{type="Expression"},M=class extends f{constructor(e,t,s){super(),this.object=e,this.property=t,this.computed=s}type="MemberExpression"},w=class extends f{constructor(e,t){super(),this.callee=e,this.args=t}type="CallExpression"},T=class extends f{constructor(e){super(),this.value=e}type="Identifier"},b=class extends f{constructor(e){super(),this.value=e}type="Literal"},x=class extends b{type="NumericLiteral"},P=class extends b{type="StringLiteral"},k=class extends b{type="BooleanLiteral"},F=class extends b{type="NullLiteral"},y=class extends b{type="ArrayLiteral"},v=class extends b{type="TupleLiteral"},C=class extends b{type="ObjectLiteral"},S=class extends f{constructor(e,t,s){super(),this.operator=e,this.left=t,this.right=s}type="BinaryExpression"},A=class extends f{constructor(e,t){super(),this.operand=e,this.filter=t}type="FilterExpression"},E=class extends f{constructor(e,t){super(),this.iterable=e,this.test=t}type="SelectExpression"},L=class extends f{constructor(e,t,s){super(),this.operand=e,this.negate=t,this.test=s}type="TestExpression"},I=class extends f{constructor(e,t){super(),this.operator=e,this.argument=t}type="UnaryExpression"},z=class extends f{constructor(e=void 0,t=void 0,s=void 0){super(),this.start=e,this.stop=t,this.step=s}type="SliceExpression"},V=class extends f{constructor(e,t){super(),this.key=e,this.value=t}type="KeywordArgumentExpression"};function j(e){const t=new _([]);let s=0;function r(t,o){const r=e[s++];if(!r||r.type!==t)throw new Error(`Parser Error: ${o}. ${r.type} !== ${t}.`);return r}function n(){switch(e[s].type){case o.Text:return new P(r(o.Text,"Expected text token").value);case o.OpenStatement:return function(){let t;switch(r(o.OpenStatement,"Expected opening statement token"),e[s].type){case o.Set:++s,t=l(),r(o.CloseStatement,"Expected closing statement token");break;case o.If:++s,t=c(),r(o.OpenStatement,"Expected {% token"),r(o.EndIf,"Expected endif token"),r(o.CloseStatement,"Expected %} token");break;case o.Macro:++s,t=function(){const e=W();if("Identifier"!==e.type)throw new SyntaxError("Expected identifier following macro statement");const t=O();r(o.CloseStatement,"Expected closing statement token");const s=[];for(;a(o.OpenStatement,o.EndMacro);)s.push(n());return new g(e,t,s)}(),r(o.OpenStatement,"Expected {% token"),r(o.EndMacro,"Expected endmacro token"),r(o.CloseStatement,"Expected %} token");break;case o.For:++s,t=function(){const e=d(!0);if(!(e instanceof T||e instanceof v))throw new SyntaxError(`Expected identifier/tuple for the loop variable, got ${e.type} instead`);r(o.In,"Expected `in` keyword following loop variable");const t=u();r(o.CloseStatement,"Expected closing statement token");const l=[];for(;a(o.OpenStatement,o.EndFor)&&a(o.OpenStatement,o.Else);)l.push(n());const c=[];if(i(o.OpenStatement,o.Else))for(++s,++s,r(o.CloseStatement,"Expected closing statement token");a(o.OpenStatement,o.EndFor);)c.push(n());return new p(e,t,l,c)}(),r(o.OpenStatement,"Expected {% token"),r(o.EndFor,"Expected endfor token"),r(o.CloseStatement,"Expected %} token");break;default:throw new SyntaxError(`Unknown statement type: ${e[s].type}`)}return t}();case o.OpenExpression:return function(){r(o.OpenExpression,"Expected opening expression token");const e=u();return r(o.CloseExpression,"Expected closing expression token"),e}();default:throw new SyntaxError(`Unexpected token type: ${e[s].type}`)}}function a(...t){return s+t.length<=e.length&&t.some(((t,o)=>t!==e[s+o].type))}function i(...t){return s+t.length<=e.length&&t.every(((t,o)=>t===e[s+o].type))}function l(){const e=u();if(i(o.Equals)){++s;const t=l();return new h(e,t)}return e}function c(){const t=u();r(o.CloseStatement,"Expected closing statement token");const a=[],l=[];for(;e[s]?.type!==o.OpenStatement||e[s+1]?.type!==o.ElseIf&&e[s+1]?.type!==o.Else&&e[s+1]?.type!==o.EndIf;)a.push(n());if(e[s]?.type===o.OpenStatement&&e[s+1]?.type!==o.EndIf)if(++s,i(o.ElseIf))r(o.ElseIf,"Expected elseif token"),l.push(c());else for(r(o.Else,"Expected else token"),r(o.CloseStatement,"Expected closing statement token");e[s]?.type!==o.OpenStatement||e[s+1]?.type!==o.EndIf;)l.push(n());return new m(t,a,l)}function d(e=!1){const t=e?W:u,r=[t()],n=i(o.Comma);for(;n&&(++s,r.push(t()),i(o.Comma)););return n?new v(r):r[0]}function u(){return function(){const e=f();if(i(o.If)){++s;const t=f();if(i(o.Else)){++s;const o=f();return new m(t,[e],[o])}return new E(e,t)}return e}()}function f(){let t=b();for(;i(o.Or);){const o=e[s];++s;const r=b();t=new S(o,t,r)}return t}function b(){let t=j();for(;i(o.And);){const o=e[s];++s;const r=j();t=new S(o,t,r)}return t}function j(){let t;for(;i(o.Not);){const o=e[s];++s;const r=j();t=new I(o,r)}return t??function(){let t=D();for(;i(o.ComparisonBinaryOperator)||i(o.In)||i(o.NotIn);){const o=e[s];++s;const r=D();t=new S(o,t,r)}return t}()}function D(){let t=R();for(;i(o.AdditiveBinaryOperator);){const o=e[s];++s;const r=R();t=new S(o,t,r)}return t}function N(e){let t=new w(e,O());return t=G(t),i(o.OpenParen)&&(t=N(t)),t}function O(){r(o.OpenParen,"Expected opening parenthesis for arguments list");const e=function(){const e=[];for(;!i(o.CloseParen);){let t=u();if(i(o.Equals)){if(++s,!(t instanceof T))throw new SyntaxError("Expected identifier for keyword argument");const e=u();t=new V(t,e)}e.push(t),i(o.Comma)&&++s}return e}();return r(o.CloseParen,"Expected closing parenthesis for arguments list"),e}function B(){const e=[];let t=!1;for(;!i(o.CloseSquareBracket);)i(o.Colon)?(e.push(void 0),++s,t=!0):(e.push(u()),i(o.Colon)&&(++s,t=!0));if(0===e.length)throw new SyntaxError("Expected at least one argument for member/slice expression");if(t){if(e.length>3)throw new SyntaxError("Expected 0-3 arguments for slice expression");return new z(...e)}return e[0]}function G(t){for(;i(o.Dot)||i(o.OpenSquareBracket);){const n=e[s];let a;++s;const i=n.type!==o.Dot;if(i)a=B(),r(o.CloseSquareBracket,"Expected closing square bracket");else if(a=W(),"Identifier"!==a.type)throw new SyntaxError("Expected identifier following dot operator");t=new M(t,a,i)}return t}function R(){let t=q();for(;i(o.MultiplicativeBinaryOperator);){const o=e[s];++s;const r=q();t=new S(o,t,r)}return t}function q(){let e=function(){let e=function(){const e=G(W());return i(o.OpenParen)?N(e):e}();for(;i(o.Pipe);){++s;let t=W();if(!(t instanceof T))throw new SyntaxError("Expected identifier for the filter");i(o.OpenParen)&&(t=N(t)),e=new A(e,t)}return e}();for(;i(o.Is);){++s;const t=i(o.Not);t&&++s;let r=W();if(r instanceof k?r=new T(r.value.toString()):r instanceof F&&(r=new T("none")),!(r instanceof T))throw new SyntaxError("Expected identifier for the test");e=new L(e,t,r)}return e}function W(){const t=e[s];switch(t.type){case o.NumericLiteral:return++s,new x(Number(t.value));case o.StringLiteral:return++s,new P(t.value);case o.BooleanLiteral:return++s,new k("true"===t.value.toLowerCase());case o.NullLiteral:return++s,new F(null);case o.Identifier:return++s,new T(t.value);case o.OpenParen:{++s;const t=d();if(e[s].type!==o.CloseParen)throw new SyntaxError(`Expected closing parenthesis, got ${e[s].type} instead`);return++s,t}case o.OpenSquareBracket:{++s;const e=[];for(;!i(o.CloseSquareBracket);)e.push(u()),i(o.Comma)&&++s;return++s,new y(e)}case o.OpenCurlyBracket:{++s;const e=new Map;for(;!i(o.CloseCurlyBracket);){const t=u();r(o.Colon,"Expected colon between key and value in object literal");const n=u();e.set(t,n),i(o.Comma)&&++s}return++s,new C(e)}default:throw new SyntaxError(`Unexpected token: ${t.type}`)}}for(;s<e.length;)t.body.push(n());return t}function D(e,t,s=1){void 0===t&&(t=e,e=0);const o=[];for(let r=e;r<t;r+=s)o.push(r);return o}function N(e,t,s,o=1){const r=Math.sign(o);r>=0?(t=(t??=0)<0?Math.max(e.length+t,0):Math.min(t,e.length),s=(s??=e.length)<0?Math.max(e.length+s,0):Math.min(s,e.length)):(t=(t??=e.length-1)<0?Math.max(e.length+t,-1):Math.min(t,e.length-1),s=(s??=-1)<-1?Math.max(e.length+s,-1):Math.min(s,e.length-1));const n=[];for(let a=t;r*a<r*s;a+=o)n.push(e[a]);return n}function O(e){return e.replace(/\b\w/g,(e=>e.toUpperCase()))}var B=class{type="RuntimeValue";value;builtins=new Map;constructor(e=void 0){this.value=e}__bool__(){return new q(!!this.value)}},G=class extends B{type="NumericValue"},R=class extends B{type="StringValue";builtins=new Map([["upper",new Q((()=>new R(this.value.toUpperCase())))],["lower",new Q((()=>new R(this.value.toLowerCase())))],["strip",new Q((()=>new R(this.value.trim())))],["title",new Q((()=>new R(O(this.value))))],["length",new G(this.value.length)],["rstrip",new Q((()=>new R(this.value.trimEnd())))],["lstrip",new Q((()=>new R(this.value.trimStart())))],["split",new Q((e=>{const t=e[0]??new H;if(!(t instanceof R||t instanceof H))throw new Error("sep argument must be a string or null");const s=e[1]??new G(-1);if(!(s instanceof G))throw new Error("maxsplit argument must be a number");let o=[];if(t instanceof H){const e=this.value.trimStart();for(const{0:t,index:r}of e.matchAll(/\S+/g)){if(-1!==s.value&&o.length>=s.value&&void 0!==r){o.push(t+e.slice(r+t.length));break}o.push(t)}}else{if(""===t.value)throw new Error("empty separator");o=this.value.split(t.value),-1!==s.value&&o.length>s.value&&o.push(o.splice(s.value).join(t.value))}return new U(o.map((e=>new R(e))))}))]])},q=class extends B{type="BooleanValue"},W=class extends B{type="ObjectValue";__bool__(){return new q(this.value.size>0)}builtins=new Map([["get",new Q((([e,t])=>{if(!(e instanceof R))throw new Error(`Object key must be a string: got ${e.type}`);return this.value.get(e.value)??t??new H}))],["items",new Q((()=>new U(Array.from(this.value.entries()).map((([e,t])=>new U([new R(e),t]))))))]])},$=class extends W{type="KeywordArgumentsValue"},U=class extends B{type="ArrayValue";builtins=new Map([["length",new G(this.value.length)]]);__bool__(){return new q(this.value.length>0)}},X=class extends U{type="TupleValue"},Q=class extends B{type="FunctionValue"},H=class extends B{type="NullValue"},J=class extends B{type="UndefinedValue"},Y=class{constructor(e){this.parent=e}variables=new Map([["namespace",new Q((e=>{if(0===e.length)return new W(new Map);if(1!==e.length||!(e[0]instanceof W))throw new Error("`namespace` expects either zero arguments or a single object argument");return e[0]}))]]);tests=new Map([["boolean",e=>"BooleanValue"===e.type],["callable",e=>e instanceof Q],["odd",e=>{if("NumericValue"!==e.type)throw new Error(`Cannot apply test "odd" to type: ${e.type}`);return e.value%2!=0}],["even",e=>{if("NumericValue"!==e.type)throw new Error(`Cannot apply test "even" to type: ${e.type}`);return e.value%2==0}],["false",e=>"BooleanValue"===e.type&&!e.value],["true",e=>"BooleanValue"===e.type&&e.value],["none",e=>"NullValue"===e.type],["string",e=>"StringValue"===e.type],["number",e=>"NumericValue"===e.type],["integer",e=>"NumericValue"===e.type&&Number.isInteger(e.value)],["iterable",e=>"ArrayValue"===e.type||"StringValue"===e.type],["mapping",e=>"ObjectValue"===e.type],["lower",e=>{const t=e.value;return"StringValue"===e.type&&t===t.toLowerCase()}],["upper",e=>{const t=e.value;return"StringValue"===e.type&&t===t.toUpperCase()}],["none",e=>"NullValue"===e.type],["defined",e=>"UndefinedValue"!==e.type],["undefined",e=>"UndefinedValue"===e.type],["equalto",(e,t)=>e.value===t.value],["eq",(e,t)=>e.value===t.value]]);set(e,t){return this.declareVariable(e,Z(t))}declareVariable(e,t){if(this.variables.has(e))throw new SyntaxError(`Variable already declared: ${e}`);return this.variables.set(e,t),t}setVariable(e,t){return this.variables.set(e,t),t}resolve(e){if(this.variables.has(e))return this;if(this.parent)return this.parent.resolve(e);throw new Error(`Unknown variable: ${e}`)}lookupVariable(e){try{return this.resolve(e).variables.get(e)??new J}catch{return new J}}},K=class{global;constructor(e){this.global=e??new Y}run(e){return this.evaluate(e,this.global)}evaluateBinaryExpression(e,t){const s=this.evaluate(e.left,t);switch(e.operator.value){case"and":return s.__bool__().value?this.evaluate(e.right,t):s;case"or":return s.__bool__().value?s:this.evaluate(e.right,t)}const o=this.evaluate(e.right,t);switch(e.operator.value){case"==":return new q(s.value==o.value);case"!=":return new q(s.value!=o.value)}if(s instanceof J||o instanceof J)throw new Error("Cannot perform operation on undefined values");if(s instanceof H||o instanceof H)throw new Error("Cannot perform operation on null values");if(s instanceof G&&o instanceof G)switch(e.operator.value){case"+":return new G(s.value+o.value);case"-":return new G(s.value-o.value);case"*":return new G(s.value*o.value);case"/":return new G(s.value/o.value);case"%":return new G(s.value%o.value);case"<":return new q(s.value<o.value);case">":return new q(s.value>o.value);case">=":return new q(s.value>=o.value);case"<=":return new q(s.value<=o.value)}else if(s instanceof U&&o instanceof U){if("+"===e.operator.value)return new U(s.value.concat(o.value))}else if(o instanceof U){const t=void 0!==o.value.find((e=>e.value===s.value));switch(e.operator.value){case"in":return new q(t);case"not in":return new q(!t)}}if((s instanceof R||o instanceof R)&&"+"===e.operator.value)return new R(s.value.toString()+o.value.toString());if(s instanceof R&&o instanceof R)switch(e.operator.value){case"in":return new q(o.value.includes(s.value));case"not in":return new q(!o.value.includes(s.value))}if(s instanceof R&&o instanceof W)switch(e.operator.value){case"in":return new q(o.value.has(s.value));case"not in":return new q(!o.value.has(s.value))}throw new SyntaxError(`Unknown operator "${e.operator.value}" between ${s.type} and ${o.type}`)}evaluateArguments(e,t){const s=[],o=new Map;for(const r of e)if("KeywordArgumentExpression"===r.type){const e=r;o.set(e.key.value,this.evaluate(e.value,t))}else{if(o.size>0)throw new Error("Positional arguments must come before keyword arguments");s.push(this.evaluate(r,t))}return[s,o]}evaluateFilterExpression(e,t){const s=this.evaluate(e.operand,t);if("Identifier"===e.filter.type){const t=e.filter;if("tojson"===t.value)return new R(ee(s));if(s instanceof U)switch(t.value){case"list":return s;case"first":return s.value[0];case"last":return s.value[s.value.length-1];case"length":return new G(s.value.length);case"reverse":return new U(s.value.reverse());case"sort":return new U(s.value.sort(((e,t)=>{if(e.type!==t.type)throw new Error(`Cannot compare different types: ${e.type} and ${t.type}`);switch(e.type){case"NumericValue":return e.value-t.value;case"StringValue":return e.value.localeCompare(t.value);default:throw new Error(`Cannot compare type: ${e.type}`)}})));case"join":return new R(s.value.map((e=>e.value)).join(""));default:throw new Error(`Unknown ArrayValue filter: ${t.value}`)}else if(s instanceof R)switch(t.value){case"length":return new G(s.value.length);case"upper":return new R(s.value.toUpperCase());case"lower":return new R(s.value.toLowerCase());case"title":return new R(O(s.value));case"capitalize":return new R(s.value.charAt(0).toUpperCase()+s.value.slice(1));case"trim":return new R(s.value.trim());case"indent":return new R(s.value.split("\n").map(((e,t)=>0===t||0===e.length?e:" "+e)).join("\n"));case"join":case"string":return s;default:throw new Error(`Unknown StringValue filter: ${t.value}`)}else{if(s instanceof G){if("abs"===t.value)return new G(Math.abs(s.value));throw new Error(`Unknown NumericValue filter: ${t.value}`)}if(s instanceof W)switch(t.value){case"items":return new U(Array.from(s.value.entries()).map((([e,t])=>new U([new R(e),t]))));case"length":return new G(s.value.size);default:throw new Error(`Unknown ObjectValue filter: ${t.value}`)}}throw new Error(`Cannot apply filter "${t.value}" to type: ${s.type}`)}if("CallExpression"===e.filter.type){const o=e.filter;if("Identifier"!==o.callee.type)throw new Error(`Unknown filter: ${o.callee.type}`);const r=o.callee.value;if("tojson"===r){const[,e]=this.evaluateArguments(o.args,t),r=e.get("indent")??new H;if(!(r instanceof G||r instanceof H))throw new Error("If set, indent must be a number");return new R(ee(s,r.value))}if("join"===r){let e;if(s instanceof R)e=Array.from(s.value);else{if(!(s instanceof U))throw new Error(`Cannot apply filter "${r}" to type: ${s.type}`);e=s.value.map((e=>e.value))}const[n,a]=this.evaluateArguments(o.args,t),i=n.at(0)??a.get("separator")??new R("");if(!(i instanceof R))throw new Error("separator must be a string");return new R(e.join(i.value))}if(s instanceof U){switch(r){case"selectattr":case"rejectattr":{const e="selectattr"===r;if(s.value.some((e=>!(e instanceof W))))throw new Error(`\`${r}\` can only be applied to array of objects`);if(o.args.some((e=>"StringLiteral"!==e.type)))throw new Error(`arguments of \`${r}\` must be strings`);const[n,a,i]=o.args.map((e=>this.evaluate(e,t)));let l;if(a){const e=t.tests.get(a.value);if(!e)throw new Error(`Unknown test: ${a.value}`);l=e}else l=(...e)=>e[0].__bool__().value;const c=s.value.filter((t=>{const s=t.value.get(n.value),o=!!s&&l(s,i);return e?o:!o}));return new U(c)}case"map":{const[,e]=this.evaluateArguments(o.args,t);if(e.has("attribute")){const t=e.get("attribute");if(!(t instanceof R))throw new Error("attribute must be a string");const o=e.get("default"),r=s.value.map((e=>{if(!(e instanceof W))throw new Error("items in map must be an object");return e.value.get(t.value)??o??new J}));return new U(r)}throw new Error("`map` expressions without `attribute` set are not currently supported.")}}throw new Error(`Unknown ArrayValue filter: ${r}`)}if(s instanceof R){if("indent"===r){const[e,r]=this.evaluateArguments(o.args,t),n=e.at(0)??r.get("width")??new G(4);if(!(n instanceof G))throw new Error("width must be a number");const a=e.at(1)??r.get("first")??new q(!1),i=e.at(2)??r.get("blank")??new q(!1),l=s.value.split("\n"),c=" ".repeat(n.value),d=l.map(((e,t)=>!a.value&&0===t||!i.value&&0===e.length?e:c+e));return new R(d.join("\n"))}throw new Error(`Unknown StringValue filter: ${r}`)}throw new Error(`Cannot apply filter "${r}" to type: ${s.type}`)}throw new Error(`Unknown filter: ${e.filter.type}`)}evaluateTestExpression(e,t){const s=this.evaluate(e.operand,t),o=t.tests.get(e.test.value);if(!o)throw new Error(`Unknown test: ${e.test.value}`);const r=o(s);return new q(e.negate?!r:r)}evaluateUnaryExpression(e,t){const s=this.evaluate(e.argument,t);if("not"===e.operator.value)return new q(!s.value);throw new SyntaxError(`Unknown operator: ${e.operator.value}`)}evalProgram(e,t){return this.evaluateBlock(e.body,t)}evaluateBlock(e,t){let s="";for(const o of e){const e=this.evaluate(o,t);"NullValue"!==e.type&&"UndefinedValue"!==e.type&&(s+=e.value)}return new R(s)}evaluateIdentifier(e,t){return t.lookupVariable(e.value)}evaluateCallExpression(e,t){const[s,o]=this.evaluateArguments(e.args,t);o.size>0&&s.push(new $(o));const r=this.evaluate(e.callee,t);if("FunctionValue"!==r.type)throw new Error(`Cannot call something that is not a function: got ${r.type}`);return r.value(s,t)}evaluateSliceExpression(e,t,s){if(!(e instanceof U||e instanceof R))throw new Error("Slice object must be an array or string");const o=this.evaluate(t.start,s),r=this.evaluate(t.stop,s),n=this.evaluate(t.step,s);if(!(o instanceof G||o instanceof J))throw new Error("Slice start must be numeric or undefined");if(!(r instanceof G||r instanceof J))throw new Error("Slice stop must be numeric or undefined");if(!(n instanceof G||n instanceof J))throw new Error("Slice step must be numeric or undefined");return e instanceof U?new U(N(e.value,o.value,r.value,n.value)):new R(N(Array.from(e.value),o.value,r.value,n.value).join(""))}evaluateMemberExpression(e,t){const s=this.evaluate(e.object,t);let o,r;if(e.computed){if("SliceExpression"===e.property.type)return this.evaluateSliceExpression(s,e.property,t);o=this.evaluate(e.property,t)}else o=new R(e.property.value);if(s instanceof W){if(!(o instanceof R))throw new Error(`Cannot access property with non-string: got ${o.type}`);r=s.value.get(o.value)??s.builtins.get(o.value)}else if(s instanceof U||s instanceof R)if(o instanceof G)r=s.value.at(o.value),s instanceof R&&(r=new R(s.value.at(o.value)));else{if(!(o instanceof R))throw new Error(`Cannot access property with non-string/non-number: got ${o.type}`);r=s.builtins.get(o.value)}else{if(!(o instanceof R))throw new Error(`Cannot access property with non-string: got ${o.type}`);r=s.builtins.get(o.value)}return r instanceof B?r:new J}evaluateSet(e,t){const s=this.evaluate(e.value,t);if("Identifier"===e.assignee.type){const o=e.assignee.value;t.setVariable(o,s)}else{if("MemberExpression"!==e.assignee.type)throw new Error(`Invalid LHS inside assignment expression: ${JSON.stringify(e.assignee)}`);{const o=e.assignee,r=this.evaluate(o.object,t);if(!(r instanceof W))throw new Error("Cannot assign to member of non-object");if("Identifier"!==o.property.type)throw new Error("Cannot assign to member with non-identifier property");r.value.set(o.property.value,s)}}return new H}evaluateIf(e,t){const s=this.evaluate(e.test,t);return this.evaluateBlock(s.__bool__().value?e.body:e.alternate,t)}evaluateFor(e,t){const s=new Y(t);let o,r;if("SelectExpression"===e.iterable.type){const t=e.iterable;r=this.evaluate(t.iterable,s),o=t.test}else r=this.evaluate(e.iterable,s);if(!(r instanceof U))throw new Error(`Expected iterable type in for loop: got ${r.type}`);const n=[],a=[];for(let t=0;t<r.value.length;++t){const i=new Y(s),l=r.value[t];let c;if("Identifier"===e.loopvar.type)c=t=>t.setVariable(e.loopvar.value,l);else{if("TupleLiteral"!==e.loopvar.type)throw new Error(`Invalid loop variable(s): ${e.loopvar.type}`);{const t=e.loopvar;if("ArrayValue"!==l.type)throw new Error(`Cannot unpack non-iterable type: ${l.type}`);const s=l;if(t.value.length!==s.value.length)throw new Error(`Too ${t.value.length>s.value.length?"few":"many"} items to unpack`);c=e=>{for(let o=0;o<t.value.length;++o){if("Identifier"!==t.value[o].type)throw new Error(`Cannot unpack non-identifier type: ${t.value[o].type}`);e.setVariable(t.value[o].value,s.value[o])}}}}if(o){c(i);if(!this.evaluate(o,i).__bool__().value)continue}n.push(l),a.push(c)}let i="",l=!0;for(let t=0;t<n.length;++t){const o=new Map([["index",new G(t+1)],["index0",new G(t)],["revindex",new G(n.length-t)],["revindex0",new G(n.length-t-1)],["first",new q(0===t)],["last",new q(t===n.length-1)],["length",new G(n.length)],["previtem",t>0?n[t-1]:new J],["nextitem",t<n.length-1?n[t+1]:new J]]);s.setVariable("loop",new W(o)),a[t](s);i+=this.evaluateBlock(e.body,s).value,l=!1}if(l){i+=this.evaluateBlock(e.defaultBlock,s).value}return new R(i)}evaluateMacro(e,t){return t.setVariable(e.name.value,new Q(((t,s)=>{const o=new Y(s);let r;t=t.slice(),"KeywordArgumentsValue"===t.at(-1)?.type&&(r=t.pop());for(let s=0;s<e.args.length;++s){const n=e.args[s],a=t[s];if("Identifier"===n.type){const e=n;if(!a)throw new Error(`Missing positional argument: ${e.value}`);o.setVariable(e.value,a)}else{if("KeywordArgumentExpression"!==n.type)throw new Error(`Unknown argument type: ${n.type}`);{const e=n,t=a??r?.value.get(e.key.value)??this.evaluate(e.value,o);o.setVariable(e.key.value,t)}}}return this.evaluateBlock(e.body,o)}))),new H}evaluate(e,t){if(void 0===e)return new J;switch(e.type){case"Program":return this.evalProgram(e,t);case"Set":return this.evaluateSet(e,t);case"If":return this.evaluateIf(e,t);case"For":return this.evaluateFor(e,t);case"Macro":return this.evaluateMacro(e,t);case"NumericLiteral":return new G(Number(e.value));case"StringLiteral":return new R(e.value);case"BooleanLiteral":return new q(e.value);case"NullLiteral":return new H(e.value);case"ArrayLiteral":return new U(e.value.map((e=>this.evaluate(e,t))));case"TupleLiteral":return new X(e.value.map((e=>this.evaluate(e,t))));case"ObjectLiteral":{const s=new Map;for(const[o,r]of e.value){const e=this.evaluate(o,t);if(!(e instanceof R))throw new Error(`Object keys must be strings: got ${e.type}`);s.set(e.value,this.evaluate(r,t))}return new W(s)}case"Identifier":return this.evaluateIdentifier(e,t);case"CallExpression":return this.evaluateCallExpression(e,t);case"MemberExpression":return this.evaluateMemberExpression(e,t);case"UnaryExpression":return this.evaluateUnaryExpression(e,t);case"BinaryExpression":return this.evaluateBinaryExpression(e,t);case"FilterExpression":return this.evaluateFilterExpression(e,t);case"TestExpression":return this.evaluateTestExpression(e,t);default:throw new SyntaxError(`Unknown node type: ${e.type}`)}}};function Z(e){switch(typeof e){case"number":return new G(e);case"string":return new R(e);case"boolean":return new q(e);case"undefined":return new J;case"object":return null===e?new H:Array.isArray(e)?new U(e.map(Z)):new W(new Map(Object.entries(e).map((([e,t])=>[e,Z(t)]))));case"function":return new Q(((t,s)=>Z(e(...t.map((e=>e.value)))??null)));default:throw new Error(`Cannot convert to runtime value: ${e}`)}}function ee(e,t,s){const o=s??0;switch(e.type){case"NullValue":case"UndefinedValue":return"null";case"NumericValue":case"StringValue":case"BooleanValue":return JSON.stringify(e.value);case"ArrayValue":case"ObjectValue":{const s=t?" ".repeat(t):"",r="\n"+s.repeat(o),n=r+s;if("ArrayValue"===e.type){const s=e.value.map((e=>ee(e,t,o+1)));return t?`[${n}${s.join(`,${n}`)}${r}]`:`[${s.join(", ")}]`}{const s=Array.from(e.value.entries()).map((([e,s])=>{const r=`"${e}": ${ee(s,t,o+1)}`;return t?`${n}${r}`:r}));return t?`{${s.join(",")}${r}}`:`{${s.join(", ")}}`}}default:throw new Error(`Cannot convert to JSON: ${e.type}`)}}var te=class{parsed;constructor(e){const t=d(e,{lstrip_blocks:!0,trim_blocks:!0});this.parsed=j(t)}render(e){const t=new Y;if(t.set("false",!1),t.set("true",!0),t.set("raise_exception",(e=>{throw new Error(e)})),t.set("range",D),e)for(const[s,o]of Object.entries(e))t.set(s,o);return new K(t).run(this.parsed).value}}},"./src/backends/onnx.js":(e,t,s)=>{var o;s.r(t),s.d(t,{Tensor:()=>i.Tensor,createInferenceSession:()=>g,deviceToExecutionProviders:()=>p,isONNXProxy:()=>w,isONNXTensor:()=>f});var r=s("./src/env.js"),n=s("onnxruntime-node"),a=s("?8b6b"),i=s("onnxruntime-common");const l=Object.freeze({auto:null,gpu:null,cpu:"cpu",wasm:"wasm",webgpu:"webgpu",cuda:"cuda",dml:"dml",webnn:{name:"webnn",deviceType:"cpu"},"webnn-npu":{name:"webnn",deviceType:"npu"},"webnn-gpu":{name:"webnn",deviceType:"gpu"},"webnn-cpu":{name:"webnn",deviceType:"cpu"}}),c=[];let d,u;const _=Symbol.for("onnxruntime");if(_ in globalThis)u=globalThis[_];else if(r.apis.IS_NODE_ENV){switch(u=n.default??n,process.platform){case"win32":c.push("dml");break;case"linux":"x64"===process.arch&&c.push("cuda")}c.push("cpu"),d=["cpu"]}else u=o||(o=s.t(a,2)),r.apis.IS_WEBNN_AVAILABLE&&c.push("webnn-npu","webnn-gpu","webnn-cpu","webnn"),r.apis.IS_WEBGPU_AVAILABLE&&c.push("webgpu"),c.push("wasm"),d=["wasm"];const m=u.InferenceSession;function p(e=null){if(!e)return d;switch(e){case"auto":return c;case"gpu":return c.filter((e=>["webgpu","cuda","dml","webnn-gpu"].includes(e)))}if(c.includes(e))return[l[e]??e];throw new Error(`Unsupported device: "${e}". Should be one of: ${c.join(", ")}.`)}let h=null;async function g(e,t,s){h&&await h;const o=m.create(e,t);h??=o;const r=await o;return r.config=s,r}function f(e){return e instanceof u.Tensor}const M=u?.env;function w(){return M?.wasm?.proxy}M?.wasm&&("undefined"!=typeof ServiceWorkerGlobalScope&&self instanceof ServiceWorkerGlobalScope||M.wasm.wasmPaths||(M.wasm.wasmPaths=`https://cdn.jsdelivr.net/npm/@huggingface/transformers@${r.env.version}/dist/`),M.wasm.proxy=!1),M?.webgpu&&(M.webgpu.powerPreference="high-performance"),r.env.backends.onnx=M},"./src/base/feature_extraction_utils.js":(e,t,s)=>{s.r(t),s.d(t,{FeatureExtractor:()=>a,validate_audio_inputs:()=>i});var o=s("./src/utils/constants.js"),r=s("./src/utils/generic.js"),n=s("./src/utils/hub.js");class a extends r.Callable{constructor(e){super(),this.config=e}static async from_pretrained(e,t){return new this(await(0,n.getModelJSON)(e,o.FEATURE_EXTRACTOR_NAME,!0,t))}}function i(e,t){if(!(e instanceof Float32Array||e instanceof Float64Array))throw new Error(`${t} expects input to be a Float32Array or a Float64Array, but got ${e?.constructor?.name??typeof e} instead. If using the feature extractor directly, remember to use \`read_audio(url, sampling_rate)\` to obtain the raw audio data of the file/url.`)}},"./src/base/image_processors_utils.js":(e,t,s)=>{s.r(t),s.d(t,{ImageProcessor:()=>w,center_to_corners_format:()=>u,post_process_instance_segmentation:()=>M,post_process_object_detection:()=>_,post_process_panoptic_segmentation:()=>f,post_process_semantic_segmentation:()=>m});var o=s("./src/utils/generic.js"),r=s("./src/utils/tensor.js"),n=s("./src/utils/maths.js"),a=(s("./src/utils/image.js"),s("./src/utils/core.js")),i=s("./src/utils/hub.js"),l=s("./src/utils/constants.js");function c(e,t,s=0,o=null){const r=e/t;let a=(0,n.bankers_round)(r)*t;return null!==o&&a>o&&(a=Math.floor(r)*t),a<s&&(a=Math.ceil(r)*t),a}function d([e,t],s){return[Math.max(Math.floor(e/s),1)*s,Math.max(Math.floor(t/s),1)*s]}function u([e,t,s,o]){return[e-s/2,t-o/2,e+s/2,t+o/2]}function _(e,t=.5,s=null,o=!1){const r=e.logits,a=e.pred_boxes,[i,l,c]=r.dims;if(null!==s&&s.length!==i)throw Error("Make sure that you pass in as many target sizes as the batch dimension of the logits");let d=[];for(let e=0;e<i;++e){let i=null!==s?s[e]:null,_={boxes:[],classes:[],scores:[]},m=r[e],p=a[e];for(let e=0;e<l;++e){let s,r=m[e],a=[];if(o){s=r.sigmoid().data;for(let e=0;e<s.length;++e)s[e]>t&&a.push(e)}else{let e=(0,n.max)(r.data)[1];if(e===c-1)continue;if(s=(0,n.softmax)(r.data),s[e]<t)continue;a.push(e)}for(const t of a){let o=p[e].data;o=u(o),null!==i&&(o=o.map(((e,t)=>e*i[(t+1)%2]))),_.boxes.push(o),_.classes.push(t),_.scores.push(s[t])}}d.push(_)}return d}function m(e,t=null){const s=e.logits,o=s.dims[0];if(null!==t&&t.length!==o)throw Error("Make sure that you pass in as many target sizes as the batch dimension of the logits");const n=[];for(let e=0;e<o;++e){const o=null!==t?t[e]:null;let a=s[e];null!==o&&(a=(0,r.interpolate)(a,o,"bilinear",!1));const[i,l]=o??a.dims.slice(-2),c=new r.Tensor("int32",new Int32Array(i*l),[i,l]),d=a[0].data,u=c.data;for(let e=1;e<a.dims[0];++e){const t=a[e].data;for(let s=0;s<t.length;++s)t[s]>d[s]&&(d[s]=t[s],u[s]=e)}const _=new Array(a.dims[0]);for(let e=0;e<u.length;++e){const t=u[e];_[t]=t}const m=_.filter((e=>void 0!==e));n.push({segmentation:c,labels:m})}return n}function p(e,t,s,o){const r=[],a=[],i=[];for(let l=0;l<e.dims[0];++l){const c=e[l],d=t[l],u=(0,n.max)(c.data)[1];if(u===o)continue;const _=(0,n.softmax)(c.data)[u];_>s&&(r.push(d),a.push(_),i.push(u))}return[r,a,i]}function h(e,t,s,o=.5,r=.8){const n=[];let a=0,i=0;const l=t[s].data;for(let t=0;t<e.length;++t)e[t]===s&&(n.push(t),++a),l[t]>=o&&++i;let c=a>0&&i>0;if(c){c=a/i>r}return[c,n]}function g(e,t,s,o,n,a=null,i=null){const[l,c]=i??e[0].dims,d=new r.Tensor("int32",new Int32Array(l*c),[l,c]),u=[];if(null!==i)for(let t=0;t<e.length;++t)e[t]=(0,r.interpolate)(e[t],i,"bilinear",!1);const _=new Int32Array(e[0].data.length),m=new Float32Array(e[0].data.length);for(let s=0;s<e.length;++s){let o=t[s];const r=e[s].data;for(let e=0;e<r.length;++e)r[e]*=o,r[e]>m[e]&&(_[e]=s,m[e]=r[e])}let p=0;const g=d.data;for(let r=0;r<s.length;++r){const a=s[r],[i,l]=h(_,e,r,o,n);if(i){++p;for(const e of l)g[e]=p;u.push({id:p,label_id:a,score:t[r]})}}return[d,u]}function f(e,t=.5,s=.5,o=.8,n=null,a=null){null===n&&(console.warn("`label_ids_to_fuse` unset. No instance will be fused."),n=new Set);const i=e.class_queries_logits??e.logits,l=(e.masks_queries_logits??e.pred_masks).sigmoid();let[c,d,u]=i.dims;if(u-=1,null!==a&&a.length!==c)throw Error("Make sure that you pass in as many target sizes as the batch dimension of the logits");let _=[];for(let e=0;e<c;++e){let c=null!==a?a[e]:null,d=i[e],m=l[e],[h,f,M]=p(d,m,t,u);if(0===M.length){let[e,t]=c??m.dims.slice(-2),s=new r.Tensor("int32",new Int32Array(e*t).fill(-1),[e,t]);_.push({segmentation:s,segments_info:[]});continue}let[w,T]=g(h,f,M,s,o,n,c);_.push({segmentation:w,segments_info:T})}return _}function M(e,t=.5,s=null){throw new Error("`post_process_instance_segmentation` is not yet implemented.")}class w extends o.Callable{constructor(e){super(),this.image_mean=e.image_mean??e.mean,this.image_std=e.image_std??e.std,this.resample=e.resample??2,this.do_rescale=e.do_rescale??!0,this.rescale_factor=e.rescale_factor??1/255,this.do_normalize=e.do_normalize,this.do_thumbnail=e.do_thumbnail,this.size=e.size??e.image_size,this.do_resize=e.do_resize??void 0!==this.size,this.size_divisibility=e.size_divisibility??e.size_divisor,this.do_center_crop=e.do_center_crop,this.crop_size=e.crop_size,this.do_convert_rgb=e.do_convert_rgb??!0,this.do_crop_margin=e.do_crop_margin,this.pad_size=e.pad_size,this.do_pad=e.do_pad,this.do_pad&&!this.pad_size&&this.size&&void 0!==this.size.width&&void 0!==this.size.height&&(this.pad_size=this.size),this.do_flip_channel_order=e.do_flip_channel_order??!1,this.config=e}async thumbnail(e,t,s=2){const o=e.height,r=e.width,n=t.height,a=t.width;let i=Math.min(o,n),l=Math.min(r,a);return i===o&&l===r?e:(o>r?l=Math.floor(r*i/o):r>o&&(i=Math.floor(o*l/r)),await e.resize(l,i,{resample:s}))}async crop_margin(e,t=200){const s=e.clone().grayscale(),o=(0,n.min)(s.data)[0],r=(0,n.max)(s.data)[0]-o;if(0===r)return e;const a=t/255;let i=s.width,l=s.height,c=0,d=0;const u=s.data;for(let e=0;e<s.height;++e){const t=e*s.width;for(let n=0;n<s.width;++n)(u[t+n]-o)/r<a&&(i=Math.min(i,n),l=Math.min(l,e),c=Math.max(c,n),d=Math.max(d,e))}return e=await e.crop([i,l,c,d])}pad_image(e,t,s,{mode:o="constant",center:r=!1,constant_values:n=0}={}){const[i,l,c]=t;let d,u;if("number"==typeof s?(d=s,u=s):"square"===s?d=u=Math.max(i,l):(d=s.width,u=s.height),d!==l||u!==i){const s=new Float32Array(d*u*c);if(Array.isArray(n))for(let e=0;e<s.length;++e)s[e]=n[e%c];else 0!==n&&s.fill(n);const[_,m]=r?[Math.floor((d-l)/2),Math.floor((u-i)/2)]:[0,0];for(let t=0;t<i;++t){const o=(t+m)*d,r=t*l;for(let t=0;t<l;++t){const n=(o+t+_)*c,a=(r+t)*c;for(let t=0;t<c;++t)s[n+t]=e[a+t]}}if("symmetric"===o){if(r)throw new Error("`center` padding is not supported when `mode` is set to `symmetric`.");const t=i-1,o=l-1;for(let r=0;r<u;++r){const n=r*d,u=(0,a.calculateReflectOffset)(r,t)*l;for(let t=0;t<d;++t){if(r<i&&t<l)continue;const d=(n+t)*c,_=(u+(0,a.calculateReflectOffset)(t,o))*c;for(let t=0;t<c;++t)s[d+t]=e[_+t]}}}e=s,t=[u,d,c]}return[e,t]}rescale(e){for(let t=0;t<e.length;++t)e[t]=this.rescale_factor*e[t]}get_resize_output_image_size(e,t){const[s,o]=e.size;let r,n;if(this.do_thumbnail){const{height:e,width:s}=t;r=Math.min(e,s)}else Number.isInteger(t)?(r=t,n=this.config.max_size??r):void 0!==t&&(r=t.shortest_edge,n=t.longest_edge);if(void 0!==r||void 0!==n){const e=void 0===r?1:Math.max(r/s,r/o),t=s*e,a=o*e,i=void 0===n?1:Math.min(n/t,n/a);let l=Math.floor(Number((t*i).toFixed(2))),c=Math.floor(Number((a*i).toFixed(2)));return void 0!==this.size_divisibility&&([l,c]=d([l,c],this.size_divisibility)),[l,c]}if(void 0!==t&&void 0!==t.width&&void 0!==t.height){let e=t.width,r=t.height;if(this.config.keep_aspect_ratio&&this.config.ensure_multiple_of){let t=r/o,n=e/s;Math.abs(1-n)<Math.abs(1-t)?t=n:n=t,r=c(t*o,this.config.ensure_multiple_of),e=c(n*s,this.config.ensure_multiple_of)}return[e,r]}if(void 0!==this.size_divisibility)return d([s,o],this.size_divisibility);if(void 0!==t.min_pixels&&void 0!==t.max_pixels){const{min_pixels:e,max_pixels:r}=t;return function(e,t,s=28,o=3136,r=1003520){if(e<s||t<s)throw new Error(`height:${e} or width:${t} must be larger than factor:${s}`);if(Math.max(e,t)/Math.min(e,t)>200)throw new Error("absolute aspect ratio must be smaller than 200, got "+Math.max(e,t)/Math.min(e,t));let n=Math.round(e/s)*s,a=Math.round(t/s)*s;if(n*a>r){const o=Math.sqrt(e*t/r);n=Math.floor(e/o/s)*s,a=Math.floor(t/o/s)*s}else if(n*a<o){const r=Math.sqrt(o/(e*t));n=Math.ceil(e*r/s)*s,a=Math.ceil(t*r/s)*s}return[n,a]}(o,s,this.config.patch_size*this.config.merge_size,e,r)}throw new Error(`Could not resize image due to unsupported \`this.size\` option in config: ${JSON.stringify(t)}`)}async resize(e){const[t,s]=this.get_resize_output_image_size(e,this.size);return await e.resize(t,s,{resample:this.resample})}async preprocess(e,{do_normalize:t=null,do_pad:s=null,do_convert_rgb:o=null,do_convert_grayscale:n=null,do_flip_channel_order:a=null}={}){this.do_crop_margin&&(e=await this.crop_margin(e));const[i,l]=e.size;if(o??this.do_convert_rgb?e=e.rgb():n&&(e=e.grayscale()),this.do_resize&&(e=await this.resize(e)),this.do_thumbnail&&(e=await this.thumbnail(e,this.size,this.resample)),this.do_center_crop){let t,s;Number.isInteger(this.crop_size)?(t=this.crop_size,s=this.crop_size):(t=this.crop_size.width,s=this.crop_size.height),e=await e.center_crop(t,s)}const c=[e.height,e.width];let u=Float32Array.from(e.data),_=[e.height,e.width,e.channels];if(this.do_rescale&&this.rescale(u),t??this.do_normalize){let t=this.image_mean;Array.isArray(this.image_mean)||(t=new Array(e.channels).fill(t));let s=this.image_std;if(Array.isArray(this.image_std)||(s=new Array(e.channels).fill(t)),t.length!==e.channels||s.length!==e.channels)throw new Error(`When set to arrays, the length of \`image_mean\` (${t.length}) and \`image_std\` (${s.length}) must match the number of channels in the image (${e.channels}).`);for(let o=0;o<u.length;o+=e.channels)for(let r=0;r<e.channels;++r)u[o+r]=(u[o+r]-t[r])/s[r]}if(s??this.do_pad)if(this.pad_size){const t=this.pad_image(u,[e.height,e.width,e.channels],this.pad_size);[u,_]=t}else if(this.size_divisibility){const[e,t]=d([_[1],_[0]],this.size_divisibility);[u,_]=this.pad_image(u,_,{width:e,height:t})}if(a??this.do_flip_channel_order){if(3!==_[2])throw new Error("Flipping channel order is only supported for RGB images.");for(let e=0;e<u.length;e+=3){const t=u[e];u[e]=u[e+2],u[e+2]=t}}return{original_size:[l,i],reshaped_input_size:c,pixel_values:new r.Tensor("float32",u,_).permute(2,0,1)}}async _call(e,...t){Array.isArray(e)||(e=[e]);const s=await Promise.all(e.map((e=>this.preprocess(e))));return{pixel_values:(0,r.stack)(s.map((e=>e.pixel_values)),0),original_sizes:s.map((e=>e.original_size)),reshaped_input_sizes:s.map((e=>e.reshaped_input_size))}}static async from_pretrained(e,t){return new this(await(0,i.getModelJSON)(e,l.IMAGE_PROCESSOR_NAME,!0,t))}}},"./src/base/processing_utils.js":(e,t,s)=>{s.r(t),s.d(t,{Processor:()=>a});var o=s("./src/utils/constants.js"),r=s("./src/utils/generic.js"),n=s("./src/utils/hub.js");class a extends r.Callable{static classes=["image_processor_class","tokenizer_class","feature_extractor_class"];static uses_processor_config=!1;constructor(e,t){super(),this.config=e,this.components=t}get image_processor(){return this.components.image_processor}get tokenizer(){return this.components.tokenizer}get feature_extractor(){return this.components.feature_extractor}apply_chat_template(e,t={}){if(!this.tokenizer)throw new Error("Unable to apply chat template without a tokenizer.");return this.tokenizer.apply_chat_template(e,{tokenize:!1,...t})}batch_decode(...e){if(!this.tokenizer)throw new Error("Unable to decode without a tokenizer.");return this.tokenizer.batch_decode(...e)}decode(...e){if(!this.tokenizer)throw new Error("Unable to decode without a tokenizer.");return this.tokenizer.decode(...e)}async _call(e,...t){for(const s of[this.image_processor,this.feature_extractor,this.tokenizer])if(s)return s(e,...t);throw new Error("No image processor, feature extractor, or tokenizer found.")}static async from_pretrained(e,t){const[s,r]=await Promise.all([this.uses_processor_config?(0,n.getModelJSON)(e,o.PROCESSOR_NAME,!0,t):{},Promise.all(this.classes.filter((e=>e in this)).map((async s=>{const o=await this[s].from_pretrained(e,t);return[s.replace(/_class$/,""),o]}))).then(Object.fromEntries)]);return new this(s,r)}}},"./src/configs.js":(e,t,s)=>{s.r(t),s.d(t,{AutoConfig:()=>l,PretrainedConfig:()=>i,getKeyValueShapes:()=>a});var o=s("./src/utils/core.js"),r=s("./src/utils/hub.js");function n(e){const t={};let s={};switch(e.model_type){case"llava":case"paligemma":case"gemma3":case"florence2":case"llava_onevision":case"idefics3":case"ultravox":case"smolvlm":s=n(e.text_config);break;case"moondream1":s=n(e.phi_config);break;case"musicgen":s=n(e.decoder);break;case"multi_modality":s=n(e.language_config);break;case"gpt2":case"gptj":case"jais":case"codegen":case"gpt_bigcode":t.num_heads="n_head",t.num_layers="n_layer",t.hidden_size="n_embd";break;case"gpt_neox":case"stablelm":case"opt":case"falcon":t.num_heads="num_attention_heads",t.num_layers="num_hidden_layers",t.hidden_size="hidden_size";break;case"llama":case"olmo":case"olmo2":case"mobilellm":case"granite":case"cohere":case"mistral":case"starcoder2":case"qwen2":case"qwen2_vl":case"phi":case"phi3":case"phi3_v":t.num_heads="num_key_value_heads",t.num_layers="num_hidden_layers",t.hidden_size="hidden_size",t.num_attention_heads="num_attention_heads";break;case"gemma":case"gemma2":case"gemma3_text":case"glm":case"helium":t.num_heads="num_key_value_heads",t.num_layers="num_hidden_layers",t.dim_kv="head_dim";break;case"openelm":t.num_heads="num_kv_heads",t.num_layers="num_transformer_layers",t.dim_kv="head_dim";break;case"gpt_neo":case"donut-swin":t.num_heads="num_heads",t.num_layers="num_layers",t.hidden_size="hidden_size";break;case"bloom":t.num_heads="n_head",t.num_layers="n_layer",t.hidden_size="hidden_size";break;case"mpt":t.num_heads="n_heads",t.num_layers="n_layers",t.hidden_size="d_model";break;case"exaone":t.num_heads="num_key_value_heads",t.num_layers="num_layers",t.dim_kv="head_dim",t.num_attention_heads="num_attention_heads";break;case"t5":case"mt5":case"longt5":t.num_decoder_layers="num_decoder_layers",t.num_decoder_heads="num_heads",t.decoder_dim_kv="d_kv",t.num_encoder_layers="num_layers",t.num_encoder_heads="num_heads",t.encoder_dim_kv="d_kv";break;case"bart":case"mbart":case"marian":case"whisper":case"lite-whisper":case"m2m_100":case"blenderbot":case"blenderbot-small":case"florence2_language":t.num_decoder_layers="decoder_layers",t.num_decoder_heads="decoder_attention_heads",t.decoder_hidden_size="d_model",t.num_encoder_layers="encoder_layers",t.num_encoder_heads="encoder_attention_heads",t.encoder_hidden_size="d_model";break;case"speecht5":t.num_decoder_layers="decoder_layers",t.num_decoder_heads="decoder_attention_heads",t.decoder_hidden_size="hidden_size",t.num_encoder_layers="encoder_layers",t.num_encoder_heads="encoder_attention_heads",t.encoder_hidden_size="hidden_size";break;case"trocr":t.num_encoder_layers=t.num_decoder_layers="decoder_layers",t.num_encoder_heads=t.num_decoder_heads="decoder_attention_heads",t.encoder_hidden_size=t.decoder_hidden_size="d_model";break;case"musicgen_decoder":t.num_encoder_layers=t.num_decoder_layers="num_hidden_layers",t.num_encoder_heads=t.num_decoder_heads="num_attention_heads",t.encoder_hidden_size=t.decoder_hidden_size="hidden_size";break;case"moonshine":t.num_decoder_layers="decoder_num_hidden_layers",t.num_decoder_heads="decoder_num_key_value_heads",t.num_encoder_layers="encoder_num_hidden_layers",t.num_encoder_heads="encoder_num_key_value_heads",t.encoder_hidden_size=t.decoder_hidden_size="hidden_size";break;case"vision-encoder-decoder":const r=n(e.decoder),a="num_decoder_layers"in r,i=(0,o.pick)(e,["model_type","is_encoder_decoder"]);return a?(i.num_decoder_layers=r.num_decoder_layers,i.num_decoder_heads=r.num_decoder_heads,i.decoder_hidden_size=r.decoder_hidden_size,i.num_encoder_layers=r.num_encoder_layers,i.num_encoder_heads=r.num_encoder_heads,i.encoder_hidden_size=r.encoder_hidden_size):(i.num_layers=r.num_layers,i.num_heads=r.num_heads,i.hidden_size=r.hidden_size),i}const r={...s,...(0,o.pick)(e,["model_type","multi_query","is_encoder_decoder"])};for(const s in t)r[s]=e[t[s]];return r}function a(e,{prefix:t="past_key_values",batch_size:s=1}={}){const o={},r=e.normalized_config;if(r.is_encoder_decoder&&"num_encoder_heads"in r&&"num_decoder_heads"in r){const e=r.encoder_dim_kv??r.encoder_hidden_size/r.num_encoder_heads,n=r.decoder_dim_kv??r.decoder_hidden_size/r.num_decoder_heads,a=[s,r.num_encoder_heads,0,e],i=[s,r.num_decoder_heads,0,n];for(let e=0;e<r.num_decoder_layers;++e)o[`${t}.${e}.encoder.key`]=a,o[`${t}.${e}.encoder.value`]=a,o[`${t}.${e}.decoder.key`]=i,o[`${t}.${e}.decoder.value`]=i}else{const e=r.num_heads,n=r.num_layers,a=r.dim_kv??r.hidden_size/(r.num_attention_heads??e);if("falcon"===r.model_type){const r=[s*e,0,a];for(let e=0;e<n;++e)o[`${t}.${e}.key`]=r,o[`${t}.${e}.value`]=r}else if(r.multi_query){const r=[s*e,0,2*a];for(let e=0;e<n;++e)o[`${t}.${e}.key_value`]=r}else if("bloom"===r.model_type){const r=[s*e,a,0],i=[s*e,0,a];for(let e=0;e<n;++e)o[`${t}.${e}.key`]=r,o[`${t}.${e}.value`]=i}else if("openelm"===r.model_type)for(let r=0;r<n;++r){const n=[s,e[r],0,a];o[`${t}.${r}.key`]=n,o[`${t}.${r}.value`]=n}else{const r=[s,e,0,a];for(let e=0;e<n;++e)o[`${t}.${e}.key`]=r,o[`${t}.${e}.value`]=r}}return o}class i{model_type=null;is_encoder_decoder=!1;max_position_embeddings;"transformers.js_config";constructor(e){Object.assign(this,e),this.normalized_config=n(this)}static async from_pretrained(e,{progress_callback:t=null,config:s=null,cache_dir:o=null,local_files_only:n=!1,revision:a="main"}={}){!s||s instanceof i||(s=new i(s));const l=s??await async function(e,t){return await(0,r.getModelJSON)(e,"config.json",!0,t)}(e,{progress_callback:t,config:s,cache_dir:o,local_files_only:n,revision:a});return new this(l)}}class l{static async from_pretrained(...e){return i.from_pretrained(...e)}}},"./src/env.js":(e,t,s)=>{s.r(t),s.d(t,{apis:()=>h,env:()=>T});var o=s("fs"),r=s("path"),n=s("url");const a="undefined"!=typeof window&&void 0!==window.document,i="undefined"!=typeof self&&"DedicatedWorkerGlobalScope"===self.constructor?.name,l="undefined"!=typeof self&&"caches"in self,c="undefined"!=typeof navigator&&"gpu"in navigator,d="undefined"!=typeof navigator&&"ml"in navigator,u="undefined"!=typeof process,_=u&&"node"===process?.release?.name,m=!b(o.default),p=!b(r.default),h=Object.freeze({IS_BROWSER_ENV:a,IS_WEBWORKER_ENV:i,IS_WEB_CACHE_AVAILABLE:l,IS_WEBGPU_AVAILABLE:c,IS_WEBNN_AVAILABLE:d,IS_PROCESS_AVAILABLE:u,IS_NODE_ENV:_,IS_FS_AVAILABLE:m,IS_PATH_AVAILABLE:p}),g=m&&p;let f="./";if(g){const e=Object(import.meta).url;e?f=r.default.dirname(r.default.dirname(n.default.fileURLToPath(e))):"undefined"!=typeof __dirname&&(f=r.default.dirname(__dirname))}const M=g?r.default.join(f,"/.cache/"):null,w="/models/",T={version:"3.4.1",backends:{onnx:{}},allowRemoteModels:!0,remoteHost:"https://huggingface.co/",remotePathTemplate:"{model}/resolve/{revision}/",allowLocalModels:!(a||i),localModelPath:g?r.default.join(f,w):w,useFS:m,useBrowserCache:l,useFSCache:m,cacheDir:M,useCustomCache:!1,customCache:null};function b(e){return 0===Object.keys(e).length}},"./src/generation/configuration_utils.js":(e,t,s)=>{s.r(t),s.d(t,{GenerationConfig:()=>r});var o=s("./src/utils/core.js");class r{max_length=20;max_new_tokens=null;min_length=0;min_new_tokens=null;early_stopping=!1;max_time=null;do_sample=!1;num_beams=1;num_beam_groups=1;penalty_alpha=null;use_cache=!0;temperature=1;top_k=50;top_p=1;typical_p=1;epsilon_cutoff=0;eta_cutoff=0;diversity_penalty=0;repetition_penalty=1;encoder_repetition_penalty=1;length_penalty=1;no_repeat_ngram_size=0;bad_words_ids=null;force_words_ids=null;renormalize_logits=!1;constraints=null;forced_bos_token_id=null;forced_eos_token_id=null;remove_invalid_values=!1;exponential_decay_length_penalty=null;suppress_tokens=null;streamer=null;begin_suppress_tokens=null;forced_decoder_ids=null;guidance_scale=null;num_return_sequences=1;output_attentions=!1;output_hidden_states=!1;output_scores=!1;return_dict_in_generate=!1;pad_token_id=null;bos_token_id=null;eos_token_id=null;encoder_no_repeat_ngram_size=0;decoder_start_token_id=null;generation_kwargs={};constructor(e){Object.assign(this,(0,o.pick)(e,Object.getOwnPropertyNames(this)))}}},"./src/generation/logits_process.js":(e,t,s)=>{s.r(t),s.d(t,{ClassifierFreeGuidanceLogitsProcessor:()=>f,ForcedBOSTokenLogitsProcessor:()=>l,ForcedEOSTokenLogitsProcessor:()=>c,LogitsProcessor:()=>n,LogitsProcessorList:()=>i,LogitsWarper:()=>a,MinLengthLogitsProcessor:()=>p,MinNewTokensLengthLogitsProcessor:()=>h,NoBadWordsLogitsProcessor:()=>g,NoRepeatNGramLogitsProcessor:()=>_,RepetitionPenaltyLogitsProcessor:()=>m,SuppressTokensAtBeginLogitsProcessor:()=>d,TemperatureLogitsWarper:()=>M,TopKLogitsWarper:()=>T,TopPLogitsWarper:()=>w,WhisperTimeStampLogitsProcessor:()=>u});var o=s("./src/utils/generic.js"),r=(s("./src/utils/tensor.js"),s("./src/utils/maths.js"));class n extends o.Callable{_call(e,t){throw Error("`_call` should be implemented in a subclass")}}class a extends o.Callable{_call(e,t){throw Error("`_call` should be implemented in a subclass")}}class i extends o.Callable{constructor(){super(),this.processors=[]}push(e){this.processors.push(e)}extend(e){this.processors.push(...e)}_call(e,t){let s=t;for(const t of this.processors)s=t(e,s);return s}[Symbol.iterator](){return this.processors.values()}}class l extends n{constructor(e){super(),this.bos_token_id=e}_call(e,t){for(let s=0;s<e.length;++s)if(1===e[s].length){const e=t[s].data;e.fill(-1/0),e[this.bos_token_id]=0}return t}}class c extends n{constructor(e,t){super(),this.max_length=e,this.eos_token_id=Array.isArray(t)?t:[t]}_call(e,t){for(let s=0;s<e.length;++s)if(e[s].length===this.max_length-1){const e=t[s].data;e.fill(-1/0);for(const t of this.eos_token_id)e[t]=0}return t}}class d extends n{constructor(e,t){super(),this.begin_suppress_tokens=e,this.begin_index=t}_call(e,t){for(let s=0;s<e.length;++s)if(e[s].length===this.begin_index){const e=t[s].data;for(const t of this.begin_suppress_tokens)e[t]=-1/0}return t}}class u extends n{constructor(e,t){super(),this.eos_token_id=Array.isArray(e.eos_token_id)?e.eos_token_id[0]:e.eos_token_id,this.no_timestamps_token_id=e.no_timestamps_token_id,this.timestamp_begin=this.no_timestamps_token_id+1,this.begin_index=t.length,t.at(-1)===this.no_timestamps_token_id&&(this.begin_index-=1),this.max_initial_timestamp_index=e.max_initial_timestamp_index}_call(e,t){for(let s=0;s<e.length;++s){const o=t[s].data;if(o[this.no_timestamps_token_id]=-1/0,e[s].length===this.begin_index-1){o.fill(-1/0),o[this.timestamp_begin]=0;continue}const n=e[s].slice(this.begin_index),a=n.length>=1&&n[n.length-1]>=this.timestamp_begin,i=n.length<2||n[n.length-2]>=this.timestamp_begin;if(a&&(i?o.subarray(this.timestamp_begin).fill(-1/0):o.subarray(0,this.eos_token_id).fill(-1/0)),e[s].length===this.begin_index&&null!==this.max_initial_timestamp_index){const e=this.timestamp_begin+this.max_initial_timestamp_index;o.subarray(e+1).fill(-1/0)}const l=(0,r.log_softmax)(o);Math.log(l.subarray(this.timestamp_begin).map(Math.exp).reduce(((e,t)=>e+t)))>(0,r.max)(l.subarray(0,this.timestamp_begin))[0]&&o.subarray(0,this.timestamp_begin).fill(-1/0)}return t}}class _ extends n{constructor(e){super(),this.no_repeat_ngram_size=e}getNgrams(e){const t=e.length,s=[];for(let o=0;o<t+1-this.no_repeat_ngram_size;++o){const t=[];for(let s=0;s<this.no_repeat_ngram_size;++s)t.push(e[o+s]);s.push(t.map(Number))}const o=new Map;for(const e of s){const t=e.slice(0,e.length-1),s=JSON.stringify(t),r=o.get(s)??[];r.push(e[e.length-1]),o.set(s,r)}return o}getGeneratedNgrams(e,t){const s=t.slice(t.length+1-this.no_repeat_ngram_size,t.length);return e.get(JSON.stringify(s.map(Number)))??[]}calcBannedNgramTokens(e){const t=[];if(e.length+1<this.no_repeat_ngram_size)return t;{const t=this.getNgrams(e);return this.getGeneratedNgrams(t,e)}}_call(e,t){for(let s=0;s<e.length;++s){const o=t[s].data,r=this.calcBannedNgramTokens(e[s]);for(const e of r)o[e]=-1/0}return t}}class m extends n{constructor(e){super(),this.penalty=e}_call(e,t){for(let s=0;s<e.length;++s){const o=t[s].data;for(const t of new Set(e[s])){const e=Number(t);o[e]<0?o[e]*=this.penalty:o[e]/=this.penalty}}return t}}class p extends n{constructor(e,t){super(),this.min_length=e,this.eos_token_id=Array.isArray(t)?t:[t]}_call(e,t){for(let s=0;s<e.length;++s)if(e[s].length<this.min_length){const e=t[s].data;for(const t of this.eos_token_id)e[t]=-1/0}return t}}class h extends n{constructor(e,t,s){super(),this.prompt_length_to_skip=e,this.min_new_tokens=t,this.eos_token_id=Array.isArray(s)?s:[s]}_call(e,t){for(let s=0;s<e.length;++s){if(e[s].length-this.prompt_length_to_skip<this.min_new_tokens){const e=t[s].data;for(const t of this.eos_token_id)e[t]=-1/0}}return t}}class g extends n{constructor(e,t){super(),this.bad_words_ids=e,this.eos_token_id=Array.isArray(t)?t:[t]}_call(e,t){for(let s=0;s<e.length;++s){const o=t[s].data,r=e[s];for(const e of this.bad_words_ids){let t=!0;for(let s=1;s<=e.length-1&&e.length<r.length;++s)if(e.at(-s-1)!=r.at(-s)){t=!1;break}t&&(o[e.at(-1)]=-1/0)}}return t}}class f extends n{constructor(e){if(super(),e<=1)throw new Error(`Require guidance scale >1 to use the classifier free guidance processor, got guidance scale ${e}.`);this.guidance_scale=e}_call(e,t){if(t.dims[0]!==2*e.length)throw new Error(`Logits should have twice the batch size of the input ids, the first half of batches corresponding to the conditional inputs, and the second half of batches corresponding to the unconditional inputs. Got batch size ${t.dims[0]} for the logits and ${e.length} for the input ids.`);const s=e.length,o=t.slice([0,s],null),r=t.slice([s,t.dims[0]],null);for(let e=0;e<r.data.length;++e)r.data[e]+=(o.data[e]-r.data[e])*this.guidance_scale;return r}}class M extends a{constructor(e){if(super(),"number"!=typeof e||e<=0){let t=`\`temperature\` (=${e}) must be a strictly positive float, otherwise your next token scores will be invalid.`;0===e&&(t+=" If you're looking for greedy decoding strategies, set `do_sample=false`.")}this.temperature=e}_call(e,t){const s=t.data;for(let e=0;e<s.length;++e)s[e]/=this.temperature;return t}}class w extends a{constructor(e,{filter_value:t=-1/0,min_tokens_to_keep:s=1}={}){if(super(),e<0||e>1)throw new Error(`\`top_p\` must be a float > 0 and < 1, but is ${e}`);if(!Number.isInteger(s)||s<1)throw new Error(`\`min_tokens_to_keep\` must be a positive integer, but is ${s}`);this.top_p=e,this.filter_value=t,this.min_tokens_to_keep=s}}class T extends a{constructor(e,{filter_value:t=-1/0,min_tokens_to_keep:s=1}={}){if(super(),!Number.isInteger(e)||e<0)throw new Error(`\`top_k\` must be a positive integer, but is ${e}`);this.top_k=Math.max(e,s),this.filter_value=t}}},"./src/generation/logits_sampler.js":(e,t,s)=>{s.r(t),s.d(t,{LogitsSampler:()=>a});var o=s("./src/utils/generic.js"),r=s("./src/utils/tensor.js"),n=s("./src/utils/maths.js");s("./src/generation/configuration_utils.js");class a extends o.Callable{constructor(e){super(),this.generation_config=e}async _call(e){return this.sample(e)}async sample(e){throw Error("sample should be implemented in subclasses.")}getLogits(e,t){let s=e.dims.at(-1),o=e.data;if(-1===t)o=o.slice(-s);else{let e=t*s;o=o.slice(e,e+s)}return o}randomSelect(e){let t=0;for(let s=0;s<e.length;++s)t+=e[s];let s=Math.random()*t;for(let t=0;t<e.length;++t)if(s-=e[t],s<=0)return t;return 0}static getSampler(e){if(e.do_sample)return new l(e);if(e.num_beams>1)return new c(e);if(e.num_return_sequences>1)throw Error(`num_return_sequences has to be 1 when doing greedy search, but is ${e.num_return_sequences}.`);return new i(e)}}class i extends a{async sample(e){const t=(0,n.max)(e.data)[1];return[[BigInt(t),0]]}}class l extends a{async sample(e){let t=e.dims.at(-1);this.generation_config.top_k>0&&(t=Math.min(this.generation_config.top_k,t));const[s,o]=await(0,r.topk)(e,t),a=(0,n.softmax)(s.data);return Array.from({length:this.generation_config.num_beams},(()=>{const e=this.randomSelect(a);return[o.data[e],Math.log(a[e])]}))}}class c extends a{async sample(e){let t=e.dims.at(-1);this.generation_config.top_k>0&&(t=Math.min(this.generation_config.top_k,t));const[s,o]=await(0,r.topk)(e,t),a=(0,n.softmax)(s.data);return Array.from({length:this.generation_config.num_beams},((e,t)=>[o.data[t],Math.log(a[t])]))}}},"./src/generation/stopping_criteria.js":(e,t,s)=>{s.r(t),s.d(t,{EosTokenCriteria:()=>i,InterruptableStoppingCriteria:()=>l,MaxLengthCriteria:()=>a,StoppingCriteria:()=>r,StoppingCriteriaList:()=>n});var o=s("./src/utils/generic.js");class r extends o.Callable{_call(e,t){throw Error("StoppingCriteria needs to be subclassed")}}class n extends o.Callable{constructor(){super(),this.criteria=[]}push(e){this.criteria.push(e)}extend(e){e instanceof n?e=e.criteria:e instanceof r&&(e=[e]),this.criteria.push(...e)}_call(e,t){const s=new Array(e.length).fill(!1);for(const o of this.criteria){const r=o(e,t);for(let e=0;e<s.length;++e)s[e]||=r[e]}return s}[Symbol.iterator](){return this.criteria.values()}}class a extends r{constructor(e,t=null){super(),this.max_length=e,this.max_position_embeddings=t}_call(e){return e.map((e=>e.length>=this.max_length))}}class i extends r{constructor(e){super(),Array.isArray(e)||(e=[e]),this.eos_token_id=e}_call(e,t){return e.map((e=>{const t=e.at(-1);return this.eos_token_id.some((e=>t==e))}))}}class l extends r{constructor(){super(),this.interrupted=!1}interrupt(){this.interrupted=!0}reset(){this.interrupted=!1}_call(e,t){return new Array(e.length).fill(this.interrupted)}}},"./src/generation/streamers.js":(e,t,s)=>{s.r(t),s.d(t,{BaseStreamer:()=>a,TextStreamer:()=>l,WhisperTextStreamer:()=>c});var o=s("./src/utils/core.js"),r=s("./src/tokenizers.js"),n=s("./src/env.js");class a{put(e){throw Error("Not implemented")}end(){throw Error("Not implemented")}}const i=n.apis.IS_PROCESS_AVAILABLE?e=>process.stdout.write(e):e=>console.log(e);class l extends a{constructor(e,{skip_prompt:t=!1,callback_function:s=null,token_callback_function:o=null,skip_special_tokens:r=!0,decode_kwargs:n={},...a}={}){super(),this.tokenizer=e,this.skip_prompt=t,this.callback_function=s??i,this.token_callback_function=o,this.decode_kwargs={skip_special_tokens:r,...n,...a},this.token_cache=[],this.print_len=0,this.next_tokens_are_prompt=!0}put(e){if(e.length>1)throw Error("TextStreamer only supports batch size of 1");const t=this.next_tokens_are_prompt;if(t&&(this.next_tokens_are_prompt=!1,this.skip_prompt))return;const s=e[0];this.token_callback_function?.(s),this.token_cache=(0,o.mergeArrays)(this.token_cache,s);const n=this.tokenizer.decode(this.token_cache,this.decode_kwargs);let a;t||n.endsWith("\n")?(a=n.slice(this.print_len),this.token_cache=[],this.print_len=0):n.length>0&&(0,r.is_chinese_char)(n.charCodeAt(n.length-1))?(a=n.slice(this.print_len),this.print_len+=a.length):(a=n.slice(this.print_len,n.lastIndexOf(" ")+1),this.print_len+=a.length),this.on_finalized_text(a,!1)}end(){let e;if(this.token_cache.length>0){e=this.tokenizer.decode(this.token_cache,this.decode_kwargs).slice(this.print_len),this.token_cache=[],this.print_len=0}else e="";this.next_tokens_are_prompt=!0,this.on_finalized_text(e,!0)}on_finalized_text(e,t){e.length>0&&this.callback_function?.(e),t&&this.callback_function===i&&n.apis.IS_PROCESS_AVAILABLE&&this.callback_function?.("\n")}}class c extends l{constructor(e,{skip_prompt:t=!1,callback_function:s=null,token_callback_function:o=null,on_chunk_start:r=null,on_chunk_end:n=null,on_finalize:a=null,time_precision:i=.02,skip_special_tokens:l=!0,decode_kwargs:c={}}={}){super(e,{skip_prompt:t,skip_special_tokens:l,callback_function:s,token_callback_function:o,decode_kwargs:c}),this.timestamp_begin=e.timestamp_begin,this.on_chunk_start=r,this.on_chunk_end=n,this.on_finalize=a,this.time_precision=i,this.waiting_for_timestamp=!1}put(e){if(e.length>1)throw Error("WhisperTextStreamer only supports batch size of 1");const t=e[0];if(1===t.length){const s=Number(t[0])-this.timestamp_begin;if(s>=0){const t=s*this.time_precision;this.waiting_for_timestamp?this.on_chunk_end?.(t):this.on_chunk_start?.(t),this.waiting_for_timestamp=!this.waiting_for_timestamp,e=[[]]}}return super.put(e)}end(){super.end(),this.on_finalize?.()}}},"./src/models.js":(e,t,s)=>{s.r(t),s.d(t,{ASTForAudioClassification:()=>bs,ASTModel:()=>Ts,ASTPreTrainedModel:()=>ws,AlbertForMaskedLM:()=>At,AlbertForQuestionAnswering:()=>St,AlbertForSequenceClassification:()=>Ct,AlbertModel:()=>vt,AlbertPreTrainedModel:()=>yt,AutoModel:()=>Rc,AutoModelForAudioClassification:()=>id,AutoModelForAudioFrameClassification:()=>cd,AutoModelForAudioTextToText:()=>Md,AutoModelForCTC:()=>ad,AutoModelForCausalLM:()=>Hc,AutoModelForDepthEstimation:()=>md,AutoModelForDocumentQuestionAnswering:()=>dd,AutoModelForImageClassification:()=>Zc,AutoModelForImageFeatureExtraction:()=>gd,AutoModelForImageMatting:()=>ud,AutoModelForImageSegmentation:()=>ed,AutoModelForImageTextToText:()=>fd,AutoModelForImageToImage:()=>_d,AutoModelForMaskGeneration:()=>nd,AutoModelForMaskedLM:()=>Jc,AutoModelForNormalEstimation:()=>pd,AutoModelForObjectDetection:()=>od,AutoModelForPoseEstimation:()=>hd,AutoModelForQuestionAnswering:()=>Yc,AutoModelForSemanticSegmentation:()=>td,AutoModelForSeq2SeqLM:()=>$c,AutoModelForSequenceClassification:()=>qc,AutoModelForSpeechSeq2Seq:()=>Uc,AutoModelForTextToSpectrogram:()=>Xc,AutoModelForTextToWaveform:()=>Qc,AutoModelForTokenClassification:()=>Wc,AutoModelForUniversalSegmentation:()=>sd,AutoModelForVision2Seq:()=>Kc,AutoModelForXVector:()=>ld,AutoModelForZeroShotObjectDetection:()=>rd,BartForConditionalGeneration:()=>Rt,BartForSequenceClassification:()=>qt,BartModel:()=>Gt,BartPretrainedModel:()=>Bt,BaseModelOutput:()=>oe,BeitForImageClassification:()=>wn,BeitModel:()=>Mn,BeitPreTrainedModel:()=>fn,BertForMaskedLM:()=>ae,BertForQuestionAnswering:()=>ce,BertForSequenceClassification:()=>ie,BertForTokenClassification:()=>le,BertModel:()=>ne,BertPreTrainedModel:()=>re,BlenderbotForConditionalGeneration:()=>Yt,BlenderbotModel:()=>Jt,BlenderbotPreTrainedModel:()=>Ht,BlenderbotSmallForConditionalGeneration:()=>es,BlenderbotSmallModel:()=>Zt,BlenderbotSmallPreTrainedModel:()=>Kt,BloomForCausalLM:()=>Cr,BloomModel:()=>vr,BloomPreTrainedModel:()=>yr,CLIPModel:()=>Ws,CLIPPreTrainedModel:()=>qs,CLIPSegForImageSegmentation:()=>io,CLIPSegModel:()=>ao,CLIPSegPreTrainedModel:()=>no,CLIPTextModel:()=>$s,CLIPTextModelWithProjection:()=>Us,CLIPVisionModel:()=>Xs,CLIPVisionModelWithProjection:()=>Qs,CamembertForMaskedLM:()=>De,CamembertForQuestionAnswering:()=>Be,CamembertForSequenceClassification:()=>Ne,CamembertForTokenClassification:()=>Oe,CamembertModel:()=>je,CamembertPreTrainedModel:()=>Ve,CausalLMOutput:()=>Fd,CausalLMOutputWithPast:()=>yd,ChineseCLIPModel:()=>eo,ChineseCLIPPreTrainedModel:()=>Zs,ClapAudioModelWithProjection:()=>Ui,ClapModel:()=>Wi,ClapPreTrainedModel:()=>qi,ClapTextModelWithProjection:()=>$i,CodeGenForCausalLM:()=>So,CodeGenModel:()=>Co,CodeGenPreTrainedModel:()=>vo,CohereForCausalLM:()=>sr,CohereModel:()=>tr,CoherePreTrainedModel:()=>er,ConvBertForMaskedLM:()=>Fe,ConvBertForQuestionAnswering:()=>Ce,ConvBertForSequenceClassification:()=>ye,ConvBertForTokenClassification:()=>ve,ConvBertModel:()=>ke,ConvBertPreTrainedModel:()=>Pe,ConvNextForImageClassification:()=>ba,ConvNextModel:()=>Ta,ConvNextPreTrainedModel:()=>wa,ConvNextV2ForImageClassification:()=>ka,ConvNextV2Model:()=>Pa,ConvNextV2PreTrainedModel:()=>xa,DPTForDepthEstimation:()=>Kn,DPTModel:()=>Yn,DPTPreTrainedModel:()=>Jn,DacDecoderModel:()=>Yl,DacDecoderOutput:()=>Ql,DacEncoderModel:()=>Jl,DacEncoderOutput:()=>Xl,DacModel:()=>Hl,DacPreTrainedModel:()=>Ul,DebertaForMaskedLM:()=>qe,DebertaForQuestionAnswering:()=>Ue,DebertaForSequenceClassification:()=>We,DebertaForTokenClassification:()=>$e,DebertaModel:()=>Re,DebertaPreTrainedModel:()=>Ge,DebertaV2ForMaskedLM:()=>He,DebertaV2ForQuestionAnswering:()=>Ke,DebertaV2ForSequenceClassification:()=>Je,DebertaV2ForTokenClassification:()=>Ye,DebertaV2Model:()=>Qe,DebertaV2PreTrainedModel:()=>Xe,DecisionTransformerModel:()=>yl,DecisionTransformerPreTrainedModel:()=>Fl,DeiTForImageClassification:()=>jn,DeiTModel:()=>Vn,DeiTPreTrainedModel:()=>zn,DepthAnythingForDepthEstimation:()=>ea,DepthAnythingPreTrainedModel:()=>Zn,DepthProForDepthEstimation:()=>aa,DepthProPreTrainedModel:()=>na,DetrForObjectDetection:()=>xn,DetrForSegmentation:()=>Pn,DetrModel:()=>bn,DetrObjectDetectionOutput:()=>kn,DetrPreTrainedModel:()=>Tn,DetrSegmentationOutput:()=>Fn,Dinov2ForImageClassification:()=>va,Dinov2Model:()=>ya,Dinov2PreTrainedModel:()=>Fa,Dinov2WithRegistersForImageClassification:()=>Aa,Dinov2WithRegistersModel:()=>Sa,Dinov2WithRegistersPreTrainedModel:()=>Ca,DistilBertForMaskedLM:()=>rt,DistilBertForQuestionAnswering:()=>ot,DistilBertForSequenceClassification:()=>tt,DistilBertForTokenClassification:()=>st,DistilBertModel:()=>et,DistilBertPreTrainedModel:()=>Ze,DonutSwinModel:()=>Ma,DonutSwinPreTrainedModel:()=>fa,EfficientNetForImageClassification:()=>rl,EfficientNetModel:()=>ol,EfficientNetPreTrainedModel:()=>sl,ElectraForMaskedLM:()=>Ee,ElectraForQuestionAnswering:()=>ze,ElectraForSequenceClassification:()=>Le,ElectraForTokenClassification:()=>Ie,ElectraModel:()=>Ae,ElectraPreTrainedModel:()=>Se,EsmForMaskedLM:()=>it,EsmForSequenceClassification:()=>lt,EsmForTokenClassification:()=>ct,EsmModel:()=>at,EsmPreTrainedModel:()=>nt,ExaoneForCausalLM:()=>Go,ExaoneModel:()=>Bo,ExaonePreTrainedModel:()=>Oo,FalconForCausalLM:()=>Ri,FalconModel:()=>Gi,FalconPreTrainedModel:()=>Bi,FastViTForImageClassification:()=>tn,FastViTModel:()=>en,FastViTPreTrainedModel:()=>Zr,Florence2ForConditionalGeneration:()=>Vs,Florence2PreTrainedModel:()=>zs,GLPNForDepthEstimation:()=>ga,GLPNModel:()=>ha,GLPNPreTrainedModel:()=>pa,GPT2LMHeadModel:()=>uo,GPT2Model:()=>co,GPT2PreTrainedModel:()=>lo,GPTBigCodeForCausalLM:()=>yo,GPTBigCodeModel:()=>Fo,GPTBigCodePreTrainedModel:()=>ko,GPTJForCausalLM:()=>Po,GPTJModel:()=>xo,GPTJPreTrainedModel:()=>bo,GPTNeoForCausalLM:()=>fo,GPTNeoModel:()=>go,GPTNeoPreTrainedModel:()=>ho,GPTNeoXForCausalLM:()=>To,GPTNeoXModel:()=>wo,GPTNeoXPreTrainedModel:()=>Mo,Gemma2ForCausalLM:()=>lr,Gemma2Model:()=>ir,Gemma2PreTrainedModel:()=>ar,Gemma3ForCausalLM:()=>ur,Gemma3Model:()=>dr,Gemma3PreTrainedModel:()=>cr,GemmaForCausalLM:()=>nr,GemmaModel:()=>rr,GemmaPreTrainedModel:()=>or,GlmForCausalLM:()=>No,GlmModel:()=>Do,GlmPreTrainedModel:()=>jo,GraniteForCausalLM:()=>Zo,GraniteModel:()=>Ko,GranitePreTrainedModel:()=>Yo,GroundingDinoForObjectDetection:()=>La,GroundingDinoPreTrainedModel:()=>Ea,GroupViTModel:()=>Kr,GroupViTPreTrainedModel:()=>Yr,HeliumForCausalLM:()=>Vo,HeliumModel:()=>zo,HeliumPreTrainedModel:()=>Io,HieraForImageClassification:()=>On,HieraModel:()=>Nn,HieraPreTrainedModel:()=>Dn,HubertForCTC:()=>fi,HubertForSequenceClassification:()=>Mi,HubertModel:()=>gi,HubertPreTrainedModel:()=>hi,IJepaForImageClassification:()=>Br,IJepaModel:()=>Or,IJepaPreTrainedModel:()=>Nr,Idefics3ForConditionalGeneration:()=>Os,Idefics3PreTrainedModel:()=>Ns,ImageMattingOutput:()=>vd,JAISLMHeadModel:()=>po,JAISModel:()=>mo,JAISPreTrainedModel:()=>_o,JinaCLIPModel:()=>so,JinaCLIPPreTrainedModel:()=>to,JinaCLIPTextModel:()=>oo,JinaCLIPVisionModel:()=>ro,LiteWhisperForConditionalGeneration:()=>Fs,LlamaForCausalLM:()=>Lo,LlamaModel:()=>Eo,LlamaPreTrainedModel:()=>Ao,LlavaForConditionalGeneration:()=>Es,LlavaOnevisionForConditionalGeneration:()=>Ls,LlavaPreTrainedModel:()=>As,LongT5ForConditionalGeneration:()=>jt,LongT5Model:()=>Vt,LongT5PreTrainedModel:()=>zt,M2M100ForConditionalGeneration:()=>$a,M2M100Model:()=>Wa,M2M100PreTrainedModel:()=>qa,MBartForCausalLM:()=>Qt,MBartForConditionalGeneration:()=>Ut,MBartForSequenceClassification:()=>Xt,MBartModel:()=>$t,MBartPreTrainedModel:()=>Wt,MPNetForMaskedLM:()=>ft,MPNetForQuestionAnswering:()=>Tt,MPNetForSequenceClassification:()=>Mt,MPNetForTokenClassification:()=>wt,MPNetModel:()=>gt,MPNetPreTrainedModel:()=>ht,MT5ForConditionalGeneration:()=>Ot,MT5Model:()=>Nt,MT5PreTrainedModel:()=>Dt,MarianMTModel:()=>Ra,MarianModel:()=>Ga,MarianPreTrainedModel:()=>Ba,MaskFormerForInstanceSegmentation:()=>ma,MaskFormerModel:()=>_a,MaskFormerPreTrainedModel:()=>ua,MaskedLMOutput:()=>Pd,Metric3DForDepthEstimation:()=>la,Metric3DPreTrainedModel:()=>ia,Metric3Dv2ForDepthEstimation:()=>da,Metric3Dv2PreTrainedModel:()=>ca,MgpstrForSceneTextRecognition:()=>El,MgpstrModelOutput:()=>Sl,MgpstrPreTrainedModel:()=>Al,MimiDecoderModel:()=>$l,MimiDecoderOutput:()=>Rl,MimiEncoderModel:()=>Wl,MimiEncoderOutput:()=>Gl,MimiModel:()=>ql,MimiPreTrainedModel:()=>Bl,MistralForCausalLM:()=>ji,MistralModel:()=>Vi,MistralPreTrainedModel:()=>zi,MobileBertForMaskedLM:()=>_t,MobileBertForQuestionAnswering:()=>pt,MobileBertForSequenceClassification:()=>mt,MobileBertModel:()=>ut,MobileBertPreTrainedModel:()=>dt,MobileLLMForCausalLM:()=>Wo,MobileLLMModel:()=>qo,MobileLLMPreTrainedModel:()=>Ro,MobileNetV1ForImageClassification:()=>ul,MobileNetV1ForSemanticSegmentation:()=>_l,MobileNetV1Model:()=>dl,MobileNetV1PreTrainedModel:()=>cl,MobileNetV2ForImageClassification:()=>hl,MobileNetV2ForSemanticSegmentation:()=>gl,MobileNetV2Model:()=>pl,MobileNetV2PreTrainedModel:()=>ml,MobileNetV3ForImageClassification:()=>wl,MobileNetV3ForSemanticSegmentation:()=>Tl,MobileNetV3Model:()=>Ml,MobileNetV3PreTrainedModel:()=>fl,MobileNetV4ForImageClassification:()=>Pl,MobileNetV4ForSemanticSegmentation:()=>kl,MobileNetV4Model:()=>xl,MobileNetV4PreTrainedModel:()=>bl,MobileViTForImageClassification:()=>an,MobileViTModel:()=>nn,MobileViTPreTrainedModel:()=>rn,MobileViTV2ForImageClassification:()=>dn,MobileViTV2Model:()=>cn,MobileViTV2PreTrainedModel:()=>ln,ModelOutput:()=>se,ModernBertForMaskedLM:()=>_e,ModernBertForSequenceClassification:()=>me,ModernBertForTokenClassification:()=>pe,ModernBertModel:()=>ue,ModernBertPreTrainedModel:()=>de,Moondream1ForConditionalGeneration:()=>Is,MoonshineForConditionalGeneration:()=>Cs,MoonshineModel:()=>vs,MoonshinePreTrainedModel:()=>ys,MptForCausalLM:()=>Er,MptModel:()=>Ar,MptPreTrainedModel:()=>Sr,MultiModalityCausalLM:()=>Cl,MultiModalityPreTrainedModel:()=>vl,MusicgenForCausalLM:()=>il,MusicgenForConditionalGeneration:()=>ll,MusicgenModel:()=>al,MusicgenPreTrainedModel:()=>nl,NomicBertModel:()=>ge,NomicBertPreTrainedModel:()=>he,OPTForCausalLM:()=>zr,OPTModel:()=>Ir,OPTPreTrainedModel:()=>Lr,Olmo2ForCausalLM:()=>Jo,Olmo2Model:()=>Ho,Olmo2PreTrainedModel:()=>Qo,OlmoForCausalLM:()=>Xo,OlmoModel:()=>Uo,OlmoPreTrainedModel:()=>$o,OpenELMForCausalLM:()=>pr,OpenELMModel:()=>mr,OpenELMPreTrainedModel:()=>_r,OwlViTForObjectDetection:()=>mn,OwlViTModel:()=>_n,OwlViTPreTrainedModel:()=>un,Owlv2ForObjectDetection:()=>gn,Owlv2Model:()=>hn,Owlv2PreTrainedModel:()=>pn,PaliGemmaForConditionalGeneration:()=>Ds,PaliGemmaPreTrainedModel:()=>js,PatchTSMixerForPrediction:()=>Dl,PatchTSMixerModel:()=>jl,PatchTSMixerPreTrainedModel:()=>Vl,PatchTSTForPrediction:()=>zl,PatchTSTModel:()=>Il,PatchTSTPreTrainedModel:()=>Ll,Phi3ForCausalLM:()=>Fr,Phi3Model:()=>kr,Phi3PreTrainedModel:()=>Pr,Phi3VForCausalLM:()=>Rs,Phi3VPreTrainedModel:()=>Gs,PhiForCausalLM:()=>xr,PhiModel:()=>br,PhiPreTrainedModel:()=>Tr,PreTrainedModel:()=>te,PretrainedMixin:()=>sc,PvtForImageClassification:()=>$r,PvtModel:()=>Wr,PvtPreTrainedModel:()=>qr,PyAnnoteForAudioFrameClassification:()=>Za,PyAnnoteModel:()=>Ka,PyAnnotePreTrainedModel:()=>Ya,QuestionAnsweringModelOutput:()=>kd,Qwen2ForCausalLM:()=>fr,Qwen2Model:()=>gr,Qwen2PreTrainedModel:()=>hr,Qwen2VLForConditionalGeneration:()=>wr,Qwen2VLPreTrainedModel:()=>Mr,RTDetrForObjectDetection:()=>Cn,RTDetrModel:()=>vn,RTDetrObjectDetectionOutput:()=>Sn,RTDetrPreTrainedModel:()=>yn,ResNetForImageClassification:()=>Rn,ResNetModel:()=>Gn,ResNetPreTrainedModel:()=>Bn,RoFormerForMaskedLM:()=>we,RoFormerForQuestionAnswering:()=>xe,RoFormerForSequenceClassification:()=>Te,RoFormerForTokenClassification:()=>be,RoFormerModel:()=>Me,RoFormerPreTrainedModel:()=>fe,RobertaForMaskedLM:()=>os,RobertaForQuestionAnswering:()=>as,RobertaForSequenceClassification:()=>rs,RobertaForTokenClassification:()=>ns,RobertaModel:()=>ss,RobertaPreTrainedModel:()=>ts,SamImageSegmentationOutput:()=>Oa,SamModel:()=>Na,SamPreTrainedModel:()=>Da,SapiensForDepthEstimation:()=>oa,SapiensForNormalEstimation:()=>ra,SapiensForSemanticSegmentation:()=>sa,SapiensPreTrainedModel:()=>ta,SegformerForImageClassification:()=>Yi,SegformerForSemanticSegmentation:()=>Ki,SegformerModel:()=>Ji,SegformerPreTrainedModel:()=>Hi,Seq2SeqLMOutput:()=>wd,SequenceClassifierOutput:()=>Td,SiglipModel:()=>Js,SiglipPreTrainedModel:()=>Hs,SiglipTextModel:()=>Ys,SiglipVisionModel:()=>Ks,SmolVLMForConditionalGeneration:()=>Bs,SnacDecoderModel:()=>tc,SnacEncoderModel:()=>ec,SnacModel:()=>Zl,SnacPreTrainedModel:()=>Kl,SpeechT5ForSpeechToText:()=>Si,SpeechT5ForTextToSpeech:()=>Ai,SpeechT5HifiGan:()=>Ei,SpeechT5Model:()=>Ci,SpeechT5PreTrainedModel:()=>vi,SqueezeBertForMaskedLM:()=>Pt,SqueezeBertForQuestionAnswering:()=>Ft,SqueezeBertForSequenceClassification:()=>kt,SqueezeBertModel:()=>xt,SqueezeBertPreTrainedModel:()=>bt,StableLmForCausalLM:()=>tl,StableLmModel:()=>el,StableLmPreTrainedModel:()=>Zi,Starcoder2ForCausalLM:()=>Oi,Starcoder2Model:()=>Ni,Starcoder2PreTrainedModel:()=>Di,StyleTextToSpeech2Model:()=>yi,StyleTextToSpeech2PreTrainedModel:()=>Fi,Swin2SRForImageSuperResolution:()=>Hn,Swin2SRModel:()=>Qn,Swin2SRPreTrainedModel:()=>Xn,SwinForImageClassification:()=>$n,SwinForSemanticSegmentation:()=>Un,SwinModel:()=>Wn,SwinPreTrainedModel:()=>qn,T5ForConditionalGeneration:()=>It,T5Model:()=>Lt,T5PreTrainedModel:()=>Et,TableTransformerForObjectDetection:()=>Ln,TableTransformerModel:()=>En,TableTransformerObjectDetectionOutput:()=>In,TableTransformerPreTrainedModel:()=>An,TokenClassifierOutput:()=>xd,TrOCRForCausalLM:()=>Ii,TrOCRPreTrainedModel:()=>Li,UltravoxModel:()=>Ol,UltravoxPreTrainedModel:()=>Nl,UniSpeechForCTC:()=>ri,UniSpeechForSequenceClassification:()=>ni,UniSpeechModel:()=>oi,UniSpeechPreTrainedModel:()=>si,UniSpeechSatForAudioFrameClassification:()=>di,UniSpeechSatForCTC:()=>li,UniSpeechSatForSequenceClassification:()=>ci,UniSpeechSatModel:()=>ii,UniSpeechSatPreTrainedModel:()=>ai,ViTForImageClassification:()=>Dr,ViTMAEModel:()=>Xr,ViTMAEPreTrainedModel:()=>Ur,ViTMSNForImageClassification:()=>Jr,ViTMSNModel:()=>Hr,ViTMSNPreTrainedModel:()=>Qr,ViTModel:()=>jr,ViTPreTrainedModel:()=>Vr,VisionEncoderDecoderModel:()=>Ss,VitMatteForImageMatting:()=>on,VitMattePreTrainedModel:()=>sn,VitPoseForPoseEstimation:()=>Rr,VitPosePreTrainedModel:()=>Gr,VitsModel:()=>Qi,VitsModelOutput:()=>Cd,VitsPreTrainedModel:()=>Xi,Wav2Vec2BertForCTC:()=>mi,Wav2Vec2BertForSequenceClassification:()=>pi,Wav2Vec2BertModel:()=>_i,Wav2Vec2BertPreTrainedModel:()=>ui,Wav2Vec2ForAudioFrameClassification:()=>Ja,Wav2Vec2ForCTC:()=>Qa,Wav2Vec2ForSequenceClassification:()=>Ha,Wav2Vec2Model:()=>Xa,Wav2Vec2PreTrainedModel:()=>Ua,WavLMForAudioFrameClassification:()=>ki,WavLMForCTC:()=>bi,WavLMForSequenceClassification:()=>xi,WavLMForXVector:()=>Pi,WavLMModel:()=>Ti,WavLMPreTrainedModel:()=>wi,WeSpeakerResNetModel:()=>ti,WeSpeakerResNetPreTrainedModel:()=>ei,WhisperForConditionalGeneration:()=>ks,WhisperModel:()=>Ps,WhisperPreTrainedModel:()=>xs,XLMForQuestionAnswering:()=>_s,XLMForSequenceClassification:()=>ds,XLMForTokenClassification:()=>us,XLMModel:()=>ls,XLMPreTrainedModel:()=>is,XLMRobertaForMaskedLM:()=>hs,XLMRobertaForQuestionAnswering:()=>Ms,XLMRobertaForSequenceClassification:()=>gs,XLMRobertaForTokenClassification:()=>fs,XLMRobertaModel:()=>ps,XLMRobertaPreTrainedModel:()=>ms,XLMWithLMHeadModel:()=>cs,XVectorOutput:()=>bd,YolosForObjectDetection:()=>Va,YolosModel:()=>za,YolosObjectDetectionOutput:()=>ja,YolosPreTrainedModel:()=>Ia});var o=s("./src/configs.js"),r=s("./src/backends/onnx.js"),n=s("./src/utils/dtypes.js"),a=s("./src/utils/generic.js"),i=s("./src/utils/core.js"),l=s("./src/utils/hub.js"),c=s("./src/utils/constants.js"),d=s("./src/generation/logits_process.js"),u=s("./src/generation/configuration_utils.js"),_=s("./src/utils/tensor.js"),m=s("./src/utils/image.js"),p=s("./src/utils/maths.js"),h=s("./src/generation/stopping_criteria.js"),g=s("./src/generation/logits_sampler.js"),f=s("./src/env.js"),M=s("./src/models/whisper/generation_whisper.js"),w=s("./src/models/whisper/common_whisper.js");const T=0,b=1,x=2,P=3,k=4,F=5,y=6,v=7,C=8,S=9,A=10,E=11,L=new Map,I=new Map,z=new Map;async function V(e,t,s){return Object.fromEntries(await Promise.all(Object.keys(t).map((async a=>{const{buffer_or_path:i,session_options:c,session_config:d}=await async function(e,t,s){const a=s.config?.["transformers.js_config"]??{};let i=s.device??a.device;i&&"string"!=typeof i&&(i.hasOwnProperty(t)?i=i[t]:(console.warn(`device not specified for "${t}". Using the default device.`),i=null));const c=i??(f.apis.IS_NODE_ENV?"cpu":"wasm"),d=(0,r.deviceToExecutionProviders)(c);let u=s.dtype??a.dtype;if("string"!=typeof u&&(u&&u.hasOwnProperty(t)?u=u[t]:(u=n.DEFAULT_DEVICE_DTYPE_MAPPING[c]??n.DATA_TYPES.fp32,console.warn(`dtype not specified for "${t}". Using the default dtype (${u}) for this device (${c}).`))),u===n.DATA_TYPES.auto){let e=a.dtype;"string"!=typeof e&&(e=e[t]),u=e&&e!==n.DATA_TYPES.auto&&n.DATA_TYPES.hasOwnProperty(e)?e:n.DEFAULT_DEVICE_DTYPE_MAPPING[c]??n.DATA_TYPES.fp32}const _=u;if(!n.DEFAULT_DTYPE_SUFFIX_MAPPING.hasOwnProperty(_))throw new Error(`Invalid dtype: ${_}. Should be one of: ${Object.keys(n.DATA_TYPES).join(", ")}`);if(_===n.DATA_TYPES.fp16&&"webgpu"===c&&!await(0,n.isWebGpuFp16Supported)())throw new Error(`The device (${c}) does not support fp16.`);const m=a.kv_cache_dtype?"string"==typeof a.kv_cache_dtype?a.kv_cache_dtype:a.kv_cache_dtype[_]??"float32":void 0;if(m&&!["float32","float16"].includes(m))throw new Error(`Invalid kv_cache_dtype: ${m}. Should be one of: float32, float16`);const p={dtype:_,kv_cache_dtype:m},h=`${t}${n.DEFAULT_DTYPE_SUFFIX_MAPPING[_]}.onnx`,g=`${s.subfolder??""}/${h}`,M={...s.session_options};M.executionProviders??=d;const w=a.free_dimension_overrides;w?M.freeDimensionOverrides??=w:c.startsWith("webnn")&&!M.freeDimensionOverrides&&console.warn('WebNN does not currently support dynamic shapes and requires `free_dimension_overrides` to be set in config.json as a field within "transformers.js_config". When `free_dimension_overrides` is not set, you may experience significant performance degradation.');const T=(0,l.getModelFile)(e,g,!0,s,f.apis.IS_NODE_ENV),b=s.use_external_data_format??a.use_external_data_format;let x=[];if(b){let o;o="object"==typeof b?b.hasOwnProperty(h)?b[h]:!!b.hasOwnProperty(t)&&b[t]:b;const r=+o;if(r>l.MAX_EXTERNAL_DATA_CHUNKS)throw new Error(`The number of external data chunks (${r}) exceeds the maximum allowed value (${l.MAX_EXTERNAL_DATA_CHUNKS}).`);for(let t=0;t<r;++t){const o=`${h}_data${0===t?"":"_"+t}`,r=`${s.subfolder??""}/${o}`;x.push(new Promise((async(t,n)=>{const a=await(0,l.getModelFile)(e,r,!0,s,f.apis.IS_NODE_ENV);t(a instanceof Uint8Array?{path:o,data:a}:o)})))}}else void 0!==M.externalData&&(x=M.externalData.map((async t=>{if("string"==typeof t.data){const o=await(0,l.getModelFile)(e,t.data,!0,s);return{...t,data:o}}return t})));if(x.length>0){const e=await Promise.all(x);f.apis.IS_NODE_ENV||(M.externalData=e)}if("webgpu"===c){const e=(0,o.getKeyValueShapes)(s.config,{prefix:"present"});if(Object.keys(e).length>0&&!(0,r.isONNXProxy)()){const t={};for(const s in e)t[s]="gpu-buffer";M.preferredOutputLocation=t}}return{buffer_or_path:await T,session_options:M,session_config:p}}(e,t[a],s);return[a,await(0,r.createInferenceSession)(i,c,d)]}))))}async function j(e,t,s){return Object.fromEntries(await Promise.all(Object.keys(t).map((async o=>[o,await(0,l.getModelJSON)(e,t[o],!1,s)]))))}async function D(e,t){const s=function(e,t){const s=Object.create(null),o=[];for(const n of e.inputNames){const e=t[n];e instanceof _.Tensor?s[n]=(0,r.isONNXProxy)()?e.clone():e:o.push(n)}if(o.length>0)throw new Error(`An error occurred during model execution: "Missing the following inputs: ${o.join(", ")}.`);const n=Object.keys(t).length,a=e.inputNames.length;if(n>a){let s=Object.keys(t).filter((t=>!e.inputNames.includes(t)));console.warn(`WARNING: Too many inputs were provided (${n} > ${a}). The following inputs will be ignored: "${s.join(", ")}".`)}return s}(e,t);try{const t=Object.fromEntries(Object.entries(s).map((([e,t])=>[e,t.ort_tensor])));let o=await e.run(t);return o=N(o),o}catch(e){const t=Object.fromEntries(Object.entries(s).map((([e,{type:t,dims:s,data:o}])=>[e,{type:t,dims:s,data:o}])));throw console.error(`An error occurred during model execution: "${e}".`),console.error("Inputs given to model:",t),e}}function N(e){for(let t in e)(0,r.isONNXTensor)(e[t])?e[t]=new _.Tensor(e[t]):"object"==typeof e[t]&&N(e[t]);return e}function O(e){if(e instanceof _.Tensor)return e;if(0===e.length)throw Error("items must be non-empty");if(Array.isArray(e[0])){if(e.some((t=>t.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 _.Tensor("int64",BigInt64Array.from(e.flat().map((e=>BigInt(e)))),[e.length,e[0].length])}return new _.Tensor("int64",BigInt64Array.from(e.map((e=>BigInt(e)))),[1,e.length])}function B(e){return new _.Tensor("bool",[e],[1])}async function G(e,t){let{encoder_outputs:s,input_ids:o,decoder_input_ids:r,...n}=t;if(!s){const o=(0,i.pick)(t,e.sessions.model.inputNames);s=(await R(e,o)).last_hidden_state}n.input_ids=r,n.encoder_hidden_states=s,e.sessions.decoder_model_merged.inputNames.includes("encoder_attention_mask")&&(n.encoder_attention_mask=t.attention_mask);return await W(e,n,!0)}async function R(e,t){const s=e.sessions.model,o=(0,i.pick)(t,s.inputNames);if(s.inputNames.includes("inputs_embeds")&&!o.inputs_embeds){if(!t.input_ids)throw new Error("Both `input_ids` and `inputs_embeds` are missing in the model inputs.");o.inputs_embeds=await e.encode_text({input_ids:t.input_ids})}if(s.inputNames.includes("token_type_ids")&&!o.token_type_ids){if(!o.input_ids)throw new Error("Both `input_ids` and `token_type_ids` are missing in the model inputs.");o.token_type_ids=(0,_.zeros_like)(o.input_ids)}if(s.inputNames.includes("pixel_mask")&&!o.pixel_mask){if(!o.pixel_values)throw new Error("Both `pixel_values` and `pixel_mask` are missing in the model inputs.");const e=o.pixel_values.dims;o.pixel_mask=(0,_.ones)([e[0],e[2],e[3]])}return await D(s,o)}async function q(e,t){const s=await e.encode(t);return await e.decode(s)}async function W(e,t,s=!1){const o=e.sessions[s?"decoder_model_merged":"model"],{past_key_values:r,...n}=t;if(o.inputNames.includes("use_cache_branch")&&(n.use_cache_branch=B(!!r)),o.inputNames.includes("position_ids")&&n.attention_mask&&!n.position_ids){const t=["paligemma","gemma3_text","gemma3"].includes(e.config.model_type)?1:0;n.position_ids=function(e,t=null,s=0){const{input_ids:o,inputs_embeds:r,attention_mask:n}=e,{data:a,dims:i}=J(n,s);let l=new _.Tensor("int64",a,i);if(t){const e=-(o??r).dims.at(1);l=l.slice(null,[e,null])}return l}(n,r,t)}e.addPastKeyValues(n,r);const a=(0,i.pick)(n,o.inputNames);return await D(o,a)}function $({modality_token_id:e,inputs_embeds:t,modality_features:s,input_ids:o,attention_mask:r}){const n=o.tolist().map((t=>t.reduce(((t,s,o)=>(s==e&&t.push(o),t)),[]))),a=n.reduce(((e,t)=>e+t.length),0),i=s.dims[0];if(a!==i)throw new Error(`Number of tokens and features do not match: tokens: ${a}, features ${i}`);let l=0;for(let e=0;e<n.length;++e){const o=n[e],r=t[e];for(let e=0;e<o.length;++e)r[o[e]].data.set(s[l++].data)}return{inputs_embeds:t,attention_mask:r}}function U({image_token_id:e,inputs_embeds:t,image_features:s,input_ids:o,attention_mask:r}){return $({modality_token_id:e,inputs_embeds:t,modality_features:s,input_ids:o,attention_mask:r})}async function X(e,{encode_function:t,merge_function:s,modality_input_name:o,modality_output_name:r,input_ids:n=null,attention_mask:a=null,position_ids:i=null,inputs_embeds:l=null,past_key_values:c=null,generation_config:d=null,logits_processor:u=null,...m}){const p=m[o];if(!l)if(l=await e.encode_text({input_ids:n,...m}),p&&1!==n.dims[1]){const e=await t({[o]:p,...m});({inputs_embeds:l,attention_mask:a}=s({[r]:e,inputs_embeds:l,input_ids:n,attention_mask:a}))}else if(c&&p&&1===n.dims[1]){const e=n.dims[1],t=Object.values(c)[0].dims.at(-2);a=(0,_.cat)([(0,_.ones)([n.dims[0],t]),a.slice(null,[a.dims[1]-e,a.dims[1]])],1)}if(!i&&"qwen2_vl"===e.config.model_type){const{image_grid_thw:t,video_grid_thw:s}=m;[i]=e.get_rope_index(n,t,s,a)}return await W(e,{inputs_embeds:l,past_key_values:c,attention_mask:a,position_ids:i,generation_config:d,logits_processor:u},!0)}async function Q(e,t){return await X(e,{...t,modality_input_name:"audio_values",modality_output_name:"audio_features",encode_function:e.encode_audio.bind(e),merge_function:e._merge_input_ids_with_audio_features.bind(e)})}async function H(e,t){return await X(e,{...t,modality_input_name:"pixel_values",modality_output_name:"image_features",encode_function:e.encode_image.bind(e),merge_function:e._merge_input_ids_with_image_features.bind(e)})}function J(e,t=0){const[s,o]=e.dims,r=e.data,n=new BigInt64Array(r.length);for(let e=0;e<s;++e){const s=e*o;let a=BigInt(t);for(let e=0;e<o;++e){const t=s+e;0n===r[t]?n[t]=BigInt(1):(n[t]=a,a+=r[t])}}return{data:n,dims:e.dims}}function Y(e,t,s,o){if(s.past_key_values){const t=Object.values(s.past_key_values)[0].dims.at(-2),{input_ids:o,attention_mask:r}=s;if(r&&r.dims[1]>o.dims[1]);else if(t<o.dims[1])s.input_ids=o.slice(null,[t,null]);else if(null!=e.config.image_token_index&&o.data.some((t=>t==e.config.image_token_index))){const r=e.config.num_image_tokens;if(!r)throw new Error("`num_image_tokens` is missing in the model configuration.");const n=o.dims[1]-(t-r);s.input_ids=o.slice(null,[-n,null]),s.attention_mask=(0,_.ones)([1,t+n])}}return s}function K(e,t,s,o){return s.past_key_values&&(t=t.map((e=>[e.at(-1)]))),{...s,decoder_input_ids:O(t)}}function Z(e,...t){return e.config.is_encoder_decoder?K(e,...t):Y(e,...t)}function ee(e,t,s,o){const r=!!s.past_key_values;if(null!==o.guidance_scale&&o.guidance_scale>1&&(r?s.input_ids=(0,_.cat)([s.input_ids,s.input_ids],0):(s.input_ids=(0,_.cat)([s.input_ids,(0,_.full_like)(s.input_ids,BigInt(o.pad_token_id))],0),s.attention_mask=(0,_.cat)([s.attention_mask,(0,_.full_like)(s.attention_mask,0n)],0))),!r&&s.pixel_values||(s.pixel_values=(0,_.full)([0,0,3,384,384],1)),r){const e=0,t=1,o=e>0?1:0,r=1;s.images_seq_mask=new _.Tensor("bool",new Array(e+t).fill(!0).fill(!1,0,t),[r,e+t]),s.images_emb_mask=new _.Tensor("bool",new Array(e).fill(!!o),[r,1,e])}return s}class te extends a.Callable{main_input_name="input_ids";forward_params=["input_ids","attention_mask"];constructor(e,t,s){super(),this.config=e,this.sessions=t,this.configs=s;const o=z.get(this.constructor),r=L.get(o);switch(this.can_generate=!1,this._forward=null,this._prepare_inputs_for_generation=null,r){case k:this.can_generate=!0,this._forward=W,this._prepare_inputs_for_generation=Y;break;case x:case P:case v:this.can_generate=!0,this._forward=G,this._prepare_inputs_for_generation=K;break;case b:this._forward=G;break;case y:this.can_generate=!0,this._forward=H,this._prepare_inputs_for_generation=Z;break;case A:this.can_generate=!0,this._forward=Q,this._prepare_inputs_for_generation=Z;break;case S:this.can_generate=!0,this._prepare_inputs_for_generation=Z;break;case C:this.can_generate=!0,this._prepare_inputs_for_generation=ee;break;case E:this._forward=q;break;default:this._forward=R}this.can_generate&&this.forward_params.push("past_key_values"),this.custom_config=this.config["transformers.js_config"]??{}}async dispose(){const e=[];for(const t of Object.values(this.sessions))t?.handler?.dispose&&e.push(t.handler.dispose());return await Promise.all(e)}static async from_pretrained(e,{progress_callback:t=null,config:s=null,cache_dir:r=null,local_files_only:n=!1,revision:a="main",model_file_name:i=null,subfolder:l="onnx",device:d=null,dtype:u=null,use_external_data_format:_=null,session_options:m={}}={}){let p={progress_callback:t,config:s,cache_dir:r,local_files_only:n,revision:a,model_file_name:i,subfolder:l,device:d,dtype:u,use_external_data_format:_,session_options:m};const h=z.get(this),g=L.get(h);let f;if(s=p.config=await o.AutoConfig.from_pretrained(e,p),g===k)f=await Promise.all([V(e,{model:p.model_file_name??"model"},p),j(e,{generation_config:"generation_config.json"},p)]);else if(g===x||g===P)f=await Promise.all([V(e,{model:"encoder_model",decoder_model_merged:"decoder_model_merged"},p),j(e,{generation_config:"generation_config.json"},p)]);else if(g===F)f=await Promise.all([V(e,{model:"vision_encoder",prompt_encoder_mask_decoder:"prompt_encoder_mask_decoder"},p)]);else if(g===b)f=await Promise.all([V(e,{model:"encoder_model",decoder_model_merged:"decoder_model_merged"},p)]);else if(g===y){const t={embed_tokens:"embed_tokens",vision_encoder:"vision_encoder",decoder_model_merged:"decoder_model_merged"};s.is_encoder_decoder&&(t.model="encoder_model"),f=await Promise.all([V(e,t,p),j(e,{generation_config:"generation_config.json"},p)])}else if(g===A){const t={embed_tokens:"embed_tokens",audio_encoder:"audio_encoder",decoder_model_merged:"decoder_model_merged"};f=await Promise.all([V(e,t,p),j(e,{generation_config:"generation_config.json"},p)])}else if(g===v)f=await Promise.all([V(e,{model:"text_encoder",decoder_model_merged:"decoder_model_merged",encodec_decode:"encodec_decode"},p),j(e,{generation_config:"generation_config.json"},p)]);else if(g===C)f=await Promise.all([V(e,{prepare_inputs_embeds:"prepare_inputs_embeds",model:"language_model",lm_head:"lm_head",gen_head:"gen_head",gen_img_embeds:"gen_img_embeds",image_decode:"image_decode"},p),j(e,{generation_config:"generation_config.json"},p)]);else if(g===S)f=await Promise.all([V(e,{prepare_inputs_embeds:"prepare_inputs_embeds",model:"model",vision_encoder:"vision_encoder"},p),j(e,{generation_config:"generation_config.json"},p)]);else if(g===E)f=await Promise.all([V(e,{encoder_model:"encoder_model",decoder_model:"decoder_model"},p)]);else{if(g!==T){const e=h??s?.model_type;"custom"!==e&&console.warn(`Model type for '${e}' not found, assuming encoder-only architecture. Please report this at ${c.GITHUB_ISSUE_URL}.`)}f=await Promise.all([V(e,{model:p.model_file_name??"model"},p)])}return new this(s,...f)}async _call(e){return await this.forward(e)}async forward(e){return await this._forward(this,e)}get generation_config(){return this.configs?.generation_config??null}_get_logits_warper(e){const t=new d.LogitsProcessorList;return null!==e.temperature&&1!==e.temperature&&t.push(new d.TemperatureLogitsWarper(e.temperature)),null!==e.top_k&&0!==e.top_k&&t.push(new d.TopKLogitsWarper(e.top_k)),null!==e.top_p&&e.top_p<1&&t.push(new d.TopPLogitsWarper(e.top_p)),t}_get_logits_processor(e,t,s=null){const o=new d.LogitsProcessorList;if(null!==e.repetition_penalty&&1!==e.repetition_penalty&&o.push(new d.RepetitionPenaltyLogitsProcessor(e.repetition_penalty)),null!==e.no_repeat_ngram_size&&e.no_repeat_ngram_size>0&&o.push(new d.NoRepeatNGramLogitsProcessor(e.no_repeat_ngram_size)),null!==e.bad_words_ids&&o.push(new d.NoBadWordsLogitsProcessor(e.bad_words_ids,e.eos_token_id)),null!==e.min_length&&null!==e.eos_token_id&&e.min_length>0&&o.push(new d.MinLengthLogitsProcessor(e.min_length,e.eos_token_id)),null!==e.min_new_tokens&&null!==e.eos_token_id&&e.min_new_tokens>0&&o.push(new d.MinNewTokensLengthLogitsProcessor(t,e.min_new_tokens,e.eos_token_id)),null!==e.forced_bos_token_id&&o.push(new d.ForcedBOSTokenLogitsProcessor(e.forced_bos_token_id)),null!==e.forced_eos_token_id&&o.push(new d.ForcedEOSTokenLogitsProcessor(e.max_length,e.forced_eos_token_id)),null!==e.begin_suppress_tokens){const s=t>1||null===e.forced_bos_token_id?t:t+1;o.push(new d.SuppressTokensAtBeginLogitsProcessor(e.begin_suppress_tokens,s))}return null!==e.guidance_scale&&e.guidance_scale>1&&o.push(new d.ClassifierFreeGuidanceLogitsProcessor(e.guidance_scale)),null!==s&&o.extend(s),o}_prepare_generation_config(e,t,s=u.GenerationConfig){const o={...this.config};for(const e of["decoder","generator","text_config"])e in o&&Object.assign(o,o[e]);const r=new s(o);return Object.assign(r,this.generation_config??{}),e&&Object.assign(r,e),t&&Object.assign(r,(0,i.pick)(t,Object.getOwnPropertyNames(r))),r}_get_stopping_criteria(e,t=null){const s=new h.StoppingCriteriaList;return null!==e.max_length&&s.push(new h.MaxLengthCriteria(e.max_length,this.config.max_position_embeddings??null)),null!==e.eos_token_id&&s.push(new h.EosTokenCriteria(e.eos_token_id)),t&&s.extend(t),s}_validate_model_class(){if(!this.can_generate){const e=[mc,fc,_c,ic],t=z.get(this.constructor),s=new Set,o=this.config.model_type;for(const t of e){const e=t.get(o);e&&s.add(e[0])}let r=`The current model class (${t}) is not compatible with \`.generate()\`, as it doesn't have a language model head.`;throw s.size>0&&(r+=` Please use the following class instead: ${[...s].join(", ")}`),Error(r)}}prepare_inputs_for_generation(...e){return this._prepare_inputs_for_generation(this,...e)}_update_model_kwargs_for_generation({generated_input_ids:e,outputs:t,model_inputs:s,is_encoder_decoder:o}){return s.past_key_values=this.getPastKeyValues(t,s.past_key_values),s.input_ids=new _.Tensor("int64",e.flat(),[e.length,1]),o||(s.attention_mask=(0,_.cat)([s.attention_mask,(0,_.ones)([s.attention_mask.dims[0],1])],1)),s.position_ids=null,s}_prepare_model_inputs({inputs:e,bos_token_id:t,model_kwargs:s}){const o=(0,i.pick)(s,this.forward_params),r=this.main_input_name;if(r in o){if(e)throw new Error("`inputs`: {inputs}` were passed alongside {input_name} which is not allowed. Make sure to either pass {inputs} or {input_name}=...")}else o[r]=e;return{inputs_tensor:o[r],model_inputs:o,model_input_name:r}}async _prepare_encoder_decoder_kwargs_for_generation({inputs_tensor:e,model_inputs:t,model_input_name:s,generation_config:o}){if(this.sessions.model.inputNames.includes("inputs_embeds")&&!t.inputs_embeds&&"_prepare_inputs_embeds"in this){const{input_ids:e,pixel_values:s,attention_mask:o,...r}=t,n=await this._prepare_inputs_embeds(t);t={...r,...(0,i.pick)(n,["inputs_embeds","attention_mask"])}}let{last_hidden_state:r}=await R(this,t);if(null!==o.guidance_scale&&o.guidance_scale>1)r=(0,_.cat)([r,(0,_.full_like)(r,0)],0),"attention_mask"in t&&(t.attention_mask=(0,_.cat)([t.attention_mask,(0,_.zeros_like)(t.attention_mask)],0));else if(t.decoder_input_ids){const e=O(t.decoder_input_ids).dims[0];if(e!==r.dims[0]){if(1!==r.dims[0])throw new Error(`The encoder outputs have a different batch size (${r.dims[0]}) than the decoder inputs (${e}).`);r=(0,_.cat)(Array.from({length:e},(()=>r)),0)}}return t.encoder_outputs=r,t}_prepare_decoder_input_ids_for_generation({batch_size:e,model_input_name:t,model_kwargs:s,decoder_start_token_id:o,bos_token_id:r,generation_config:n}){let{decoder_input_ids:a,...i}=s;if(!(a instanceof _.Tensor)){if(a)Array.isArray(a[0])||(a=Array.from({length:e},(()=>a)));else if(o??=r,"musicgen"===this.config.model_type)a=Array.from({length:e*this.config.decoder.num_codebooks},(()=>[o]));else if(Array.isArray(o)){if(o.length!==e)throw new Error(`\`decoder_start_token_id\` expcted to have length ${e} but got ${o.length}`);a=o}else a=Array.from({length:e},(()=>[o]));a=O(a)}return s.decoder_attention_mask=(0,_.ones_like)(a),{input_ids:a,model_inputs:i}}async generate({inputs:e=null,generation_config:t=null,logits_processor:s=null,stopping_criteria:o=null,streamer:r=null,...n}){this._validate_model_class(),t=this._prepare_generation_config(t,n);let{inputs_tensor:a,model_inputs:i,model_input_name:l}=this._prepare_model_inputs({inputs:e,model_kwargs:n});const c=this.config.is_encoder_decoder;let d;c&&("encoder_outputs"in i||(i=await this._prepare_encoder_decoder_kwargs_for_generation({inputs_tensor:a,model_inputs:i,model_input_name:l,generation_config:t}))),c?({input_ids:d,model_inputs:i}=this._prepare_decoder_input_ids_for_generation({batch_size:i[l].dims.at(0),model_input_name:l,model_kwargs:i,decoder_start_token_id:t.decoder_start_token_id,bos_token_id:t.bos_token_id,generation_config:t})):d=i[l];let u=d.dims.at(-1);null!==t.max_new_tokens&&(t.max_length=u+t.max_new_tokens);const m=this._get_logits_processor(t,u,s),p=this._get_stopping_criteria(t,o),h=i[l].dims.at(0),f=g.LogitsSampler.getSampler(t),M=new Array(h).fill(0),w=d.tolist();let T;r&&r.put(w);let b={};for(;;){if(i=this.prepare_inputs_for_generation(w,i,t),T=await this.forward(i),t.output_attentions&&t.return_dict_in_generate){const e=this.getAttentions(T);for(const t in e)t in b||(b[t]=[]),b[t].push(e[t])}const e=m(w,T.logits.slice(null,-1,null)),s=[];for(let t=0;t<e.dims.at(0);++t){const o=e[t],r=await f(o);for(const[e,o]of r){const r=BigInt(e);M[t]+=o,w[t].push(r),s.push([r]);break}}r&&r.put(s);if(p(w).every((e=>e)))break;i=this._update_model_kwargs_for_generation({generated_input_ids:s,outputs:T,model_inputs:i,is_encoder_decoder:c})}r&&r.end();const x=this.getPastKeyValues(T,i.past_key_values,!0),P=new _.Tensor("int64",w.flat(),[w.length,w[0].length]);if(t.return_dict_in_generate)return{sequences:P,past_key_values:x,...b};for(const e of Object.values(T))"gpu-buffer"===e.location&&e.dispose();return P}getPastKeyValues(e,t,s=!1){const o=Object.create(null);for(const r in e)if(r.startsWith("present")){const n=r.replace("present","past_key_values"),a=r.includes("encoder");if(o[n]=a&&t?t[n]:e[r],t&&(!a||s)){const e=t[n];"gpu-buffer"===e.location&&e.dispose()}}return o}getAttentions(e){const t={};for(const s of["cross_attentions","encoder_attentions","decoder_attentions"])for(const o in e)o.startsWith(s)&&(s in t||(t[s]=[]),t[s].push(e[o]));return t}addPastKeyValues(e,t){if(t)Object.assign(e,t);else{const t=this.sessions.decoder_model_merged??this.sessions.model,s=t?.config?.kv_cache_dtype??"float32",r="float16"===s?new _.DataTypeMap.float16:[],n=(e[this.main_input_name]??e.attention_mask)?.dims?.[0]??1,a=(0,o.getKeyValueShapes)(this.config,{batch_size:n});for(const t in a)e[t]=new _.Tensor(s,r,a[t])}}async encode_image({pixel_values:e}){const t=(await D(this.sessions.vision_encoder,{pixel_values:e})).image_features;return this.config.num_image_tokens||(console.warn(`The number of image tokens was not set in the model configuration. Setting it to the number of features detected by the vision encoder (${t.dims[1]}).`),this.config.num_image_tokens=t.dims[1]),t}async encode_text({input_ids:e}){return(await D(this.sessions.embed_tokens,{input_ids:e})).inputs_embeds}async encode_audio({audio_values:e}){return(await D(this.sessions.audio_encoder,{audio_values:e})).audio_features}}class se{}class oe extends se{constructor({last_hidden_state:e,hidden_states:t=null,attentions:s=null}){super(),this.last_hidden_state=e,this.hidden_states=t,this.attentions=s}}class re extends te{}class ne extends re{}class ae extends re{async _call(e){return new Pd(await super._call(e))}}class ie extends re{async _call(e){return new Td(await super._call(e))}}class le extends re{async _call(e){return new xd(await super._call(e))}}class ce extends re{async _call(e){return new kd(await super._call(e))}}class de extends te{}class ue extends de{}class _e extends de{async _call(e){return new Pd(await super._call(e))}}class me extends de{async _call(e){return new Td(await super._call(e))}}class pe extends de{async _call(e){return new xd(await super._call(e))}}class he extends te{}class ge extends he{}class fe extends te{}class Me extends fe{}class we extends fe{async _call(e){return new Pd(await super._call(e))}}class Te extends fe{async _call(e){return new Td(await super._call(e))}}class be extends fe{async _call(e){return new xd(await super._call(e))}}class xe extends fe{async _call(e){return new kd(await super._call(e))}}class Pe extends te{}class ke extends Pe{}class Fe extends Pe{async _call(e){return new Pd(await super._call(e))}}class ye extends Pe{async _call(e){return new Td(await super._call(e))}}class ve extends Pe{async _call(e){return new xd(await super._call(e))}}class Ce extends Pe{async _call(e){return new kd(await super._call(e))}}class Se extends te{}class Ae extends Se{}class Ee extends Se{async _call(e){return new Pd(await super._call(e))}}class Le extends Se{async _call(e){return new Td(await super._call(e))}}class Ie extends Se{async _call(e){return new xd(await super._call(e))}}class ze extends Se{async _call(e){return new kd(await super._call(e))}}class Ve extends te{}class je extends Ve{}class De extends Ve{async _call(e){return new Pd(await super._call(e))}}class Ne extends Ve{async _call(e){return new Td(await super._call(e))}}class Oe extends Ve{async _call(e){return new xd(await super._call(e))}}class Be extends Ve{async _call(e){return new kd(await super._call(e))}}class Ge extends te{}class Re extends Ge{}class qe extends Ge{async _call(e){return new Pd(await super._call(e))}}class We extends Ge{async _call(e){return new Td(await super._call(e))}}class $e extends Ge{async _call(e){return new xd(await super._call(e))}}class Ue extends Ge{async _call(e){return new kd(await super._call(e))}}class Xe extends te{}class Qe extends Xe{}class He extends Xe{async _call(e){return new Pd(await super._call(e))}}class Je extends Xe{async _call(e){return new Td(await super._call(e))}}class Ye extends Xe{async _call(e){return new xd(await super._call(e))}}class Ke extends Xe{async _call(e){return new kd(await super._call(e))}}class Ze extends te{}class et extends Ze{}class tt extends Ze{async _call(e){return new Td(await super._call(e))}}class st extends Ze{async _call(e){return new xd(await super._call(e))}}class ot extends Ze{async _call(e){return new kd(await super._call(e))}}class rt extends Ze{async _call(e){return new Pd(await super._call(e))}}class nt extends te{}class at extends nt{}class it extends nt{async _call(e){return new Pd(await super._call(e))}}class lt extends nt{async _call(e){return new Td(await super._call(e))}}class ct extends nt{async _call(e){return new xd(await super._call(e))}}class dt extends te{}class ut extends dt{}class _t extends dt{async _call(e){return new Pd(await super._call(e))}}class mt extends dt{async _call(e){return new Td(await super._call(e))}}class pt extends dt{async _call(e){return new kd(await super._call(e))}}class ht extends te{}class gt extends ht{}class ft extends ht{async _call(e){return new Pd(await super._call(e))}}class Mt extends ht{async _call(e){return new Td(await super._call(e))}}class wt extends ht{async _call(e){return new xd(await super._call(e))}}class Tt extends ht{async _call(e){return new kd(await super._call(e))}}class bt extends te{}class xt extends bt{}class Pt extends bt{async _call(e){return new Pd(await super._call(e))}}class kt extends bt{async _call(e){return new Td(await super._call(e))}}class Ft extends bt{async _call(e){return new kd(await super._call(e))}}class yt extends te{}class vt extends yt{}class Ct extends yt{async _call(e){return new Td(await super._call(e))}}class St extends yt{async _call(e){return new kd(await super._call(e))}}class At extends yt{async _call(e){return new Pd(await super._call(e))}}class Et extends te{forward_params=["input_ids","attention_mask","encoder_outputs","decoder_input_ids","decoder_attention_mask","past_key_values"]}class Lt extends Et{}class It extends Et{}class zt extends te{}class Vt extends zt{}class jt extends zt{}class Dt extends te{}class Nt extends Dt{}class Ot extends Dt{}class Bt extends te{}class Gt extends Bt{}class Rt extends Bt{}class qt extends Bt{async _call(e){return new Td(await super._call(e))}}class Wt extends te{}class $t extends Wt{}class Ut extends Wt{}class Xt extends Wt{async _call(e){return new Td(await super._call(e))}}class Qt extends Wt{}class Ht extends te{}class Jt extends Ht{}class Yt extends Ht{}class Kt extends te{}class Zt extends Kt{}class es extends Kt{}class ts extends te{}class ss extends ts{}class os extends ts{async _call(e){return new Pd(await super._call(e))}}class rs extends ts{async _call(e){return new Td(await super._call(e))}}class ns extends ts{async _call(e){return new xd(await super._call(e))}}class as extends ts{async _call(e){return new kd(await super._call(e))}}class is extends te{}class ls extends is{}class cs extends is{async _call(e){return new Pd(await super._call(e))}}class ds extends is{async _call(e){return new Td(await super._call(e))}}class us extends is{async _call(e){return new xd(await super._call(e))}}class _s extends is{async _call(e){return new kd(await super._call(e))}}class ms extends te{}class ps extends ms{}class hs extends ms{async _call(e){return new Pd(await super._call(e))}}class gs extends ms{async _call(e){return new Td(await super._call(e))}}class fs extends ms{async _call(e){return new xd(await super._call(e))}}class Ms extends ms{async _call(e){return new kd(await super._call(e))}}class ws extends te{}class Ts extends ws{}class bs extends ws{}class xs extends te{requires_attention_mask=!1;main_input_name="input_features";forward_params=["input_features","attention_mask","decoder_input_ids","decoder_attention_mask","past_key_values"]}class Ps extends xs{}class ks extends xs{_prepare_generation_config(e,t){return super._prepare_generation_config(e,t,M.WhisperGenerationConfig)}_retrieve_init_tokens(e){const t=[e.decoder_start_token_id];let s=e.language;const o=e.task;if(e.is_multilingual){s||(console.warn("No language specified - defaulting to English (en)."),s="en");const r=`<|${(0,w.whisper_language_to_code)(s)}|>`;t.push(e.lang_to_id[r]),t.push(e.task_to_id[o??"transcribe"])}else if(s||o)throw new Error("Cannot specify `task` or `language` for an English-only model. If the model is intended to be multilingual, pass `is_multilingual=true` to generate, or update the generation config.");return!e.return_timestamps&&e.no_timestamps_token_id&&t.at(-1)!==e.no_timestamps_token_id?t.push(e.no_timestamps_token_id):e.return_timestamps&&t.at(-1)===e.no_timestamps_token_id&&(console.warn("<|notimestamps|> prompt token is removed from generation_config since `return_timestamps` is set to `true`."),t.pop()),t.filter((e=>null!=e))}async generate({inputs:e=null,generation_config:t=null,logits_processor:s=null,stopping_criteria:o=null,...r}){t=this._prepare_generation_config(t,r);const n=r.decoder_input_ids??this._retrieve_init_tokens(t);if(t.return_timestamps&&(s??=new d.LogitsProcessorList,s.push(new d.WhisperTimeStampLogitsProcessor(t,n))),t.begin_suppress_tokens&&(s??=new d.LogitsProcessorList,s.push(new d.SuppressTokensAtBeginLogitsProcessor(t.begin_suppress_tokens,n.length))),t.return_token_timestamps){if(!t.alignment_heads)throw new 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.");"translate"===t.task&&console.warn("Token-level timestamps may not be reliable for task 'translate'."),t.output_attentions=!0,t.return_dict_in_generate=!0}const a=await super.generate({inputs:e,generation_config:t,logits_processor:s,decoder_input_ids:n,...r});return t.return_token_timestamps&&(a.token_timestamps=this._extract_token_timestamps(a,t.alignment_heads,t.num_frames)),a}_extract_token_timestamps(e,t,s=null,o=.02){if(!e.cross_attentions)throw new Error("Model outputs must contain cross attentions to extract timestamps. This is most likely because the model was not exported with `output_attentions=True`.");null==s&&console.warn("`num_frames` has not been set, meaning the entire audio will be analyzed. This may lead to inaccurate token-level timestamps for short audios (< 30 seconds).");let r=this.config.median_filter_width;void 0===r&&(console.warn("Model config has no `median_filter_width`, using default value of 7."),r=7);const n=e.cross_attentions,a=Array.from({length:this.config.decoder_layers},((e,t)=>(0,_.cat)(n.map((e=>e[t])),2))),l=(0,_.stack)(t.map((([e,t])=>{if(e>=a.length)throw new Error(`Layer index ${e} is out of bounds for cross attentions (length ${a.length}).`);return s?a[e].slice(null,t,null,[0,s]):a[e].slice(null,t)}))).transpose(1,0,2,3),[c,d]=(0,_.std_mean)(l,-2,0,!0),u=l.clone();for(let e=0;e<u.dims[0];++e){const t=u[e];for(let s=0;s<t.dims[0];++s){const o=t[s],n=c[e][s][0].data,a=d[e][s][0].data;for(let e=0;e<o.dims[0];++e){let t=o[e].data;for(let e=0;e<t.length;++e)t[e]=(t[e]-a[e])/n[e];t.set((0,p.medianFilter)(t,r))}}}const m=[(0,_.mean)(u,1)],h=e.sequences.dims,g=new _.Tensor("float32",new Float32Array(h[0]*h[1]),h);for(let e=0;e<h[0];++e){const t=m[e].neg().squeeze_(0),[s,r]=(0,p.dynamic_time_warping)(t.tolist()),n=Array.from({length:s.length-1},((e,t)=>s[t+1]-s[t])),a=(0,i.mergeArrays)([1],n).map((e=>!!e)),l=[];for(let e=0;e<a.length;++e)a[e]&&l.push(r[e]*o);g[e].data.set(l,1)}return g}}class Fs extends ks{}class ys extends te{requires_attention_mask=!1;main_input_name="input_values";forward_params=["input_values","decoder_input_ids","past_key_values"]}class vs extends ys{}class Cs extends ys{}class Ss extends te{main_input_name="pixel_values";forward_params=["pixel_values","decoder_input_ids","encoder_hidden_states","past_key_values"]}class As extends te{forward_params=["input_ids","attention_mask","pixel_values","position_ids","past_key_values"]}class Es extends As{_merge_input_ids_with_image_features({inputs_embeds:e,image_features:t,input_ids:s,attention_mask:o}){const r=this.config.image_token_index,n=s.tolist().map((e=>e.findIndex((e=>e==r)))),a=n.every((e=>-1===e)),i=n.every((e=>-1!==e));if(!a&&!i)throw new Error("Every input should contain either 0 or 1 image token.");if(a)return{inputs_embeds:e,attention_mask:o};const l=[],c=[];for(let s=0;s<n.length;++s){const r=n[s],a=e[s],i=t[s],d=o[s];l.push((0,_.cat)([a.slice([0,r]),i,a.slice([r+1,a.dims[0]])],0)),c.push((0,_.cat)([d.slice([0,r]),(0,_.ones)([i.dims[0]]),d.slice([r+1,d.dims[0]])],0))}return{inputs_embeds:(0,_.stack)(l,0),attention_mask:(0,_.stack)(c,0)}}}class Ls extends Es{}class Is extends Es{}class zs extends te{forward_params=["input_ids","inputs_embeds","attention_mask","pixel_values","encoder_outputs","decoder_input_ids","decoder_inputs_embeds","decoder_attention_mask","past_key_values"];main_input_name="inputs_embeds"}class Vs extends zs{_merge_input_ids_with_image_features({inputs_embeds:e,image_features:t,input_ids:s,attention_mask:o}){return{inputs_embeds:(0,_.cat)([t,e],1),attention_mask:(0,_.cat)([(0,_.ones)(t.dims.slice(0,2)),o],1)}}async _prepare_inputs_embeds({input_ids:e,pixel_values:t,inputs_embeds:s,attention_mask:o}){if(!e&&!t)throw new Error("Either `input_ids` or `pixel_values` should be provided.");let r,n;return e&&(r=await this.encode_text({input_ids:e})),t&&(n=await this.encode_image({pixel_values:t})),r&&n?({inputs_embeds:s,attention_mask:o}=this._merge_input_ids_with_image_features({inputs_embeds:r,image_features:n,input_ids:e,attention_mask:o})):s=r||n,{inputs_embeds:s,attention_mask:o}}async forward({input_ids:e,pixel_values:t,attention_mask:s,decoder_input_ids:o,decoder_attention_mask:r,encoder_outputs:n,past_key_values:a,inputs_embeds:i,decoder_inputs_embeds:l}){if(i||({inputs_embeds:i,attention_mask:s}=await this._prepare_inputs_embeds({input_ids:e,pixel_values:t,inputs_embeds:i,attention_mask:s})),!n){let{last_hidden_state:e}=await R(this,{inputs_embeds:i,attention_mask:s});n=e}if(!l){if(!o)throw new Error("Either `decoder_input_ids` or `decoder_inputs_embeds` should be provided.");l=await this.encode_text({input_ids:o})}const c={inputs_embeds:l,attention_mask:r,encoder_attention_mask:s,encoder_hidden_states:n,past_key_values:a};return await W(this,c,!0)}}class js extends te{forward_params=["input_ids","attention_mask","pixel_values","position_ids","past_key_values"]}class Ds extends js{_merge_input_ids_with_image_features(e){const t=e.image_features.dims.at(-1),s=e.image_features.view(-1,t);return U({image_token_id:this.config.image_token_index,...e,image_features:s})}}class Ns extends te{forward_params=["input_ids","attention_mask","pixel_values","pixel_attention_mask","position_ids","past_key_values"]}class Os extends Ns{async encode_image({pixel_values:e,pixel_attention_mask:t}){return(await D(this.sessions.vision_encoder,{pixel_values:e,pixel_attention_mask:t})).image_features}_merge_input_ids_with_image_features(e){const t=e.image_features.dims.at(-1),s=e.image_features.view(-1,t);return U({image_token_id:this.config.image_token_id,...e,image_features:s})}}class Bs extends Os{}class Gs extends te{forward_params=["input_ids","inputs_embeds","attention_mask","position_ids","pixel_values","image_sizes","past_key_values"]}class Rs extends Gs{async forward({input_ids:e=null,attention_mask:t=null,pixel_values:s=null,image_sizes:o=null,position_ids:r=null,inputs_embeds:n=null,past_key_values:a=null,generation_config:i=null,logits_processor:l=null,...c}){if(!n){let t;if(s&&1!==e.dims[1]){if(!o)throw new Error("`image_sizes` must be provided when `pixel_values` is provided.");({image_features:t}=await D(this.sessions.vision_encoder,{pixel_values:s,image_sizes:o}))}else{const e=this.config.normalized_config.hidden_size;t=new _.Tensor("float32",[],[0,e])}({inputs_embeds:n}=await D(this.sessions.prepare_inputs_embeds,{input_ids:e,image_features:t}))}return await W(this,{inputs_embeds:n,past_key_values:a,attention_mask:t,position_ids:r,generation_config:i,logits_processor:l},!1)}}class qs extends te{}class Ws extends qs{}class $s extends qs{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"text_model"})}}class Us extends qs{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"text_model"})}}class Xs extends qs{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"vision_model"})}}class Qs extends qs{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"vision_model"})}}class Hs extends te{}class Js extends Hs{}class Ys extends Hs{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"text_model"})}}class Ks extends qs{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"vision_model"})}}class Zs extends te{}class eo extends Zs{}class to extends te{}class so extends to{async forward(e){const t=!e.input_ids,s=!e.pixel_values;if(t&&s)throw new Error("Either `input_ids` or `pixel_values` should be provided.");if(t&&(e.input_ids=(0,_.ones)([e.pixel_values.dims[0],1])),s){const{image_size:t}=this.config.vision_config;e.pixel_values=(0,_.full)([0,3,t,t],0)}const{text_embeddings:o,image_embeddings:r,l2norm_text_embeddings:n,l2norm_image_embeddings:a}=await super.forward(e),i={};return t||(i.text_embeddings=o,i.l2norm_text_embeddings=n),s||(i.image_embeddings=r,i.l2norm_image_embeddings=a),i}}class oo extends to{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"text_model"})}}class ro extends to{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"vision_model"})}}class no extends te{}class ao extends no{}class io extends no{}class lo extends te{}class co extends lo{}class uo extends lo{}class _o extends te{}class mo extends _o{}class po extends _o{}class ho extends te{}class go extends ho{}class fo extends ho{}class Mo extends te{}class wo extends Mo{}class To extends Mo{}class bo extends te{}class xo extends bo{}class Po extends bo{}class ko extends te{}class Fo extends ko{}class yo extends ko{}class vo extends te{}class Co extends vo{}class So extends vo{}class Ao extends te{}class Eo extends Ao{}class Lo extends Ao{}class Io extends te{}class zo extends Io{}class Vo extends Io{}class jo extends te{}class Do extends jo{}class No extends jo{}class Oo extends te{}class Bo extends Oo{}class Go extends Oo{}class Ro extends te{}class qo extends Ro{}class Wo extends Ro{}class $o extends te{}class Uo extends $o{}class Xo extends $o{}class Qo extends te{}class Ho extends Qo{}class Jo extends Qo{}class Yo extends te{}class Ko extends Yo{}class Zo extends Yo{}class er extends te{}class tr extends er{}class sr extends er{}class or extends te{}class rr extends or{}class nr extends or{}class ar extends te{}class ir extends ar{}class lr extends ar{}class cr extends te{}class dr extends cr{}class ur extends cr{}class _r extends te{}class mr extends _r{}class pr extends _r{}class hr extends te{}class gr extends hr{}class fr extends hr{}class Mr extends te{forward_params=["input_ids","attention_mask","position_ids","past_key_values","pixel_values","image_grid_thw"]}class wr extends Mr{get_rope_index(e,t,s,o){const{vision_config:r,image_token_id:n,video_token_id:a,vision_start_token_id:i}=this.config,l=r.spatial_merge_size??2,c=[];if(t||s){let r=e.tolist();o||(o=(0,_.ones_like)(e));const d=o.tolist(),u=Array.from({length:3},(t=>Array.from({length:e.dims[0]},(t=>Array.from({length:e.dims[1]},(e=>1)))))),m=t?t.tolist():[],h=s?s.tolist():[];let g=0,f=0;for(let e=0;e<r.length;++e){const t=r[e].filter(((t,s)=>1==d[e][s])),s=t.reduce(((e,t,s)=>(t==i&&e.push(s),e)),[]).map((e=>t[e+1])),o=s.filter((e=>e==n)).length,_=s.filter((e=>e==a)).length;let M=[],w=0,T=o,b=_;for(let e=0;e<s.length;++e){const e=t.findIndex(((e,t)=>t>w&&e==n)),s=t.findIndex(((e,t)=>t>w&&e==a)),o=T>0&&-1!==e?e:t.length+1,r=b>0&&-1!==s?s:t.length+1;let i,c,d,u;o<r?([c,d,u]=m[g],++g,--T,i=o):([c,d,u]=h[f],++f,--b,i=r);const[_,x,P]=[Number(c),Math.floor(Number(d)/l),Math.floor(Number(u)/l)],k=i-w,F=M.length>0?(0,p.max)(M.at(-1))[0]+1:0;M.push(Array.from({length:3*k},((e,t)=>F+t%k)));const y=k+F,v=_*x*P,C=Array.from({length:v},((e,t)=>y+Math.floor(t/(x*P)))),S=Array.from({length:v},((e,t)=>y+Math.floor(t/P)%x)),A=Array.from({length:v},((e,t)=>y+t%P));M.push([C,S,A].flat()),w=i+v}if(w<t.length){const e=M.length>0?(0,p.max)(M.at(-1))[0]+1:0,s=t.length-w;M.push(Array.from({length:3*s},((t,o)=>e+o%s)))}const x=M.reduce(((e,t)=>e+t.length),0),P=new Array(x);let k=0;for(let e=0;e<3;++e)for(let t=0;t<M.length;++t){const s=M[t],o=s.length/3;for(let t=e*o;t<(e+1)*o;++t)P[k++]=s[t]}let F=0;const y=d[e];for(let t=0;t<y.length;++t)if(1==y[t]){for(let s=0;s<3;++s)u[s][e][t]=P[s*x/3+F];++F}const v=(0,p.max)(P)[0];c.push(v+1-r[e].length)}return[new _.Tensor("int64",u.flat(1/0),[3,e.dims[0],e.dims[1]]),new _.Tensor("int64",c,[c.length,1])]}if(o){const{data:e,dims:t}=J(o),s=BigInt64Array.from({length:3*e.length},((t,s)=>e[s%e.length])),r=Array.from({length:t[0]},((s,o)=>(0,p.max)(e.subarray(t[1]*o,t[1]*(o+1)))[0]+1n+BigInt(t[1])));return[new _.Tensor("int64",s,[3,...t]),new _.Tensor("int64",r,[r.length,1])]}{const[t,s]=e.dims,o=BigInt64Array.from({length:3*t*s},((e,o)=>BigInt(Math.floor(o%s/t))));return[new _.Tensor("int64",o,[3,...e.dims]),(0,_.zeros)([t,1])]}}async encode_image({pixel_values:e,image_grid_thw:t}){return(await D(this.sessions.vision_encoder,{pixel_values:e,grid_thw:t})).image_features}_merge_input_ids_with_image_features(e){return U({image_token_id:this.config.image_token_id,...e})}prepare_inputs_for_generation(e,t,s){if(t.attention_mask&&!t.position_ids)if(t.past_key_values){t.pixel_values=null;const e=BigInt(Object.values(t.past_key_values)[0].dims.at(-2)),s=t.rope_deltas.map((t=>e+t));t.position_ids=(0,_.stack)([s,s,s],0)}else[t.position_ids,t.rope_deltas]=this.get_rope_index(t.input_ids,t.image_grid_thw,t.video_grid_thw,t.attention_mask);return t}}class Tr extends te{}class br extends Tr{}class xr extends Tr{}class Pr extends te{}class kr extends Pr{}class Fr extends Pr{}class yr extends te{}class vr extends yr{}class Cr extends yr{}class Sr extends te{}class Ar extends Sr{}class Er extends Sr{}class Lr extends te{}class Ir extends Lr{}class zr extends Lr{}class Vr extends te{}class jr extends Vr{}class Dr extends Vr{async _call(e){return new Td(await super._call(e))}}class Nr extends te{}class Or extends Nr{}class Br extends Nr{async _call(e){return new Td(await super._call(e))}}class Gr extends te{}class Rr extends Gr{}class qr extends te{}class Wr extends qr{}class $r extends qr{async _call(e){return new Td(await super._call(e))}}class Ur extends te{}class Xr extends Ur{}class Qr extends te{}class Hr extends Qr{}class Jr extends Qr{async _call(e){return new Td(await super._call(e))}}class Yr extends te{}class Kr extends Yr{}class Zr extends te{}class en extends Zr{}class tn extends Zr{async _call(e){return new Td(await super._call(e))}}class sn extends te{}class on extends sn{async _call(e){return new vd(await super._call(e))}}class rn extends te{}class nn extends rn{}class an extends rn{async _call(e){return new Td(await super._call(e))}}class ln extends te{}class cn extends ln{}class dn extends ln{async _call(e){return new Td(await super._call(e))}}class un extends te{}class _n extends un{}class mn extends un{}class pn extends te{}class hn extends pn{}class gn extends pn{}class fn extends te{}class Mn extends fn{}class wn extends fn{async _call(e){return new Td(await super._call(e))}}class Tn extends te{}class bn extends Tn{}class xn extends Tn{async _call(e){return new kn(await super._call(e))}}class Pn extends Tn{async _call(e){return new Fn(await super._call(e))}}class kn extends se{constructor({logits:e,pred_boxes:t}){super(),this.logits=e,this.pred_boxes=t}}class Fn extends se{constructor({logits:e,pred_boxes:t,pred_masks:s}){super(),this.logits=e,this.pred_boxes=t,this.pred_masks=s}}class yn extends te{}class vn extends yn{}class Cn extends yn{async _call(e){return new Sn(await super._call(e))}}class Sn extends se{constructor({logits:e,pred_boxes:t}){super(),this.logits=e,this.pred_boxes=t}}class An extends te{}class En extends An{}class Ln extends An{async _call(e){return new In(await super._call(e))}}class In extends kn{}class zn extends te{}class Vn extends zn{}class jn extends zn{async _call(e){return new Td(await super._call(e))}}class Dn extends te{}class Nn extends Dn{}class On extends Dn{async _call(e){return new Td(await super._call(e))}}class Bn extends te{}class Gn extends Bn{}class Rn extends Bn{async _call(e){return new Td(await super._call(e))}}class qn extends te{}class Wn extends qn{}class $n extends qn{async _call(e){return new Td(await super._call(e))}}class Un extends qn{}class Xn extends te{}class Qn extends Xn{}class Hn extends Xn{}class Jn extends te{}class Yn extends Jn{}class Kn extends Jn{}class Zn extends te{}class ea extends Zn{}class ta extends te{}class sa extends ta{}class oa extends ta{}class ra extends ta{}class na extends te{}class aa extends na{}class ia extends te{}class la extends ia{}class ca extends te{}class da extends ca{}class ua extends te{}class _a extends ua{}class ma extends ua{}class pa extends te{}class ha extends pa{}class ga extends pa{}class fa extends te{}class Ma extends fa{}class wa extends te{}class Ta extends wa{}class ba extends wa{async _call(e){return new Td(await super._call(e))}}class xa extends te{}class Pa extends xa{}class ka extends xa{async _call(e){return new Td(await super._call(e))}}class Fa extends te{}class ya extends Fa{}class va extends Fa{async _call(e){return new Td(await super._call(e))}}class Ca extends te{}class Sa extends Ca{}class Aa extends Ca{async _call(e){return new Td(await super._call(e))}}class Ea extends te{}class La extends Ea{}class Ia extends te{}class za extends Ia{}class Va extends Ia{async _call(e){return new ja(await super._call(e))}}class ja extends se{constructor({logits:e,pred_boxes:t}){super(),this.logits=e,this.pred_boxes=t}}class Da extends te{}class Na extends Da{async get_image_embeddings({pixel_values:e}){return await R(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&&e.input_points){const t=e.input_points.dims.slice(0,-1),s=t.reduce(((e,t)=>e*t),1);e.input_labels=new _.Tensor("int64",new BigInt64Array(s).fill(1n),t)}const t={image_embeddings:e.image_embeddings,image_positional_embeddings:e.image_positional_embeddings};return e.input_points&&(t.input_points=e.input_points),e.input_labels&&(t.input_labels=e.input_labels),e.input_boxes&&(t.input_boxes=e.input_boxes),await D(this.sessions.prompt_encoder_mask_decoder,t)}async _call(e){return new Oa(await super._call(e))}}class Oa extends se{constructor({iou_scores:e,pred_masks:t}){super(),this.iou_scores=e,this.pred_masks=t}}class Ba extends te{}class Ga extends Ba{}class Ra extends Ba{}class qa extends te{}class Wa extends qa{}class $a extends qa{}class Ua extends te{}class Xa extends Ua{}class Qa extends Ua{async _call(e){return new Fd(await super._call(e))}}class Ha extends Ua{async _call(e){return new Td(await super._call(e))}}class Ja extends Ua{async _call(e){return new xd(await super._call(e))}}class Ya extends te{}class Ka extends Ya{}class Za extends Ya{async _call(e){return new xd(await super._call(e))}}class ei extends te{}class ti extends ei{}class si extends te{}class oi extends si{}class ri extends si{async _call(e){return new Fd(await super._call(e))}}class ni extends si{async _call(e){return new Td(await super._call(e))}}class ai extends te{}class ii extends ai{}class li extends ai{async _call(e){return new Fd(await super._call(e))}}class ci extends ai{async _call(e){return new Td(await super._call(e))}}class di extends ai{async _call(e){return new xd(await super._call(e))}}class ui extends te{}class _i extends ui{}class mi extends ui{async _call(e){return new Fd(await super._call(e))}}class pi extends ui{async _call(e){return new Td(await super._call(e))}}class hi extends te{}class gi extends Ua{}class fi extends Ua{async _call(e){return new Fd(await super._call(e))}}class Mi extends Ua{async _call(e){return new Td(await super._call(e))}}class wi extends te{}class Ti extends wi{}class bi extends wi{async _call(e){return new Fd(await super._call(e))}}class xi extends wi{async _call(e){return new Td(await super._call(e))}}class Pi extends wi{async _call(e){return new bd(await super._call(e))}}class ki extends wi{async _call(e){return new xd(await super._call(e))}}class Fi extends te{}class yi extends Fi{}class vi extends te{}class Ci extends vi{}class Si extends vi{}class Ai extends vi{async generate_speech(e,t,{threshold:s=.5,minlenratio:o=0,maxlenratio:r=20,vocoder:n=null}={}){const a={input_ids:e},{encoder_outputs:i,encoder_attention_mask:l}=await R(this,a),c=i.dims[1]/this.config.reduction_factor,d=Math.floor(c*r),u=Math.floor(c*o),m=this.config.num_mel_bins;let p=[],h=null,g=null,f=0;for(;;){++f;const e=B(!!g);let o;o=g?g.output_sequence_out:new _.Tensor("float32",new Float32Array(m),[1,1,m]);let r={use_cache_branch:e,output_sequence:o,encoder_attention_mask:l,speaker_embeddings:t,encoder_hidden_states:i};this.addPastKeyValues(r,h),g=await D(this.sessions.decoder_model_merged,r),h=this.getPastKeyValues(g,h);const{prob:n,spectrum:a}=g;if(p.push(a),f>=u&&(Array.from(n.data).filter((e=>e>=s)).length>0||f>=d))break}const M=(0,_.cat)(p),{waveform:w}=await D(n.sessions.model,{spectrogram:M});return{spectrogram:M,waveform:w}}}class Ei extends te{main_input_name="spectrogram"}class Li extends te{}class Ii extends Li{}class zi extends te{}class Vi extends zi{}class ji extends zi{}class Di extends te{}class Ni extends Di{}class Oi extends Di{}class Bi extends te{}class Gi extends Bi{}class Ri extends Bi{}class qi extends te{}class Wi extends qi{}class $i extends qi{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"text_model"})}}class Ui extends qi{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"audio_model"})}}class Xi extends te{}class Qi extends Xi{async _call(e){return new Cd(await super._call(e))}}class Hi extends te{}class Ji extends Hi{}class Yi extends Hi{}class Ki extends Hi{}class Zi extends te{}class el extends Zi{}class tl extends Zi{}class sl extends te{}class ol extends sl{}class rl extends sl{async _call(e){return new Td(await super._call(e))}}class nl extends te{}class al extends nl{}class il extends nl{}class ll extends te{forward_params=["input_ids","attention_mask","encoder_outputs","decoder_input_ids","decoder_attention_mask","past_key_values"];_apply_and_filter_by_delay_pattern_mask(e){const[t,s]=e.dims,o=this.config.decoder.num_codebooks,r=s-o;let n=0;for(let t=0;t<e.size;++t){if(e.data[t]===this.config.decoder.pad_token_id)continue;const a=t%s-Math.floor(t/s)%o;a>0&&a<=r&&(e.data[n++]=e.data[t])}const a=Math.floor(t/o),i=n/(a*o);return new _.Tensor(e.type,e.data.slice(0,n),[a,o,i])}prepare_inputs_for_generation(e,t,s){let o=structuredClone(e);for(let e=0;e<o.length;++e)for(let t=0;t<o[e].length;++t)e%this.config.decoder.num_codebooks>=t&&(o[e][t]=BigInt(this.config.decoder.pad_token_id));null!==s.guidance_scale&&s.guidance_scale>1&&(o=o.concat(o));return super.prepare_inputs_for_generation(o,t,s)}async generate(e){const t=await super.generate(e),s=this._apply_and_filter_by_delay_pattern_mask(t).unsqueeze_(0),{audio_values:o}=await D(this.sessions.encodec_decode,{audio_codes:s});return o}}class cl extends te{}class dl extends cl{}class ul extends cl{async _call(e){return new Td(await super._call(e))}}class _l extends cl{}class ml extends te{}class pl extends ml{}class hl extends ml{async _call(e){return new Td(await super._call(e))}}class gl extends ml{}class fl extends te{}class Ml extends fl{}class wl extends fl{async _call(e){return new Td(await super._call(e))}}class Tl extends fl{}class bl extends te{}class xl extends bl{}class Pl extends bl{async _call(e){return new Td(await super._call(e))}}class kl extends bl{}class Fl extends te{}class yl extends Fl{}class vl extends te{}class Cl extends vl{forward_params=["input_ids","pixel_values","images_seq_mask","images_emb_mask","attention_mask","position_ids","past_key_values"];constructor(...e){super(...e),this._generation_mode="text"}async forward(e){const t=this._generation_mode??"text";let s;if("text"!==t&&e.past_key_values){const t=this.sessions.gen_img_embeds,o=(0,i.pick)({image_ids:e.input_ids},t.inputNames);s=await D(t,o)}else{const t=this.sessions.prepare_inputs_embeds,o=(0,i.pick)(e,t.inputNames);s=await D(t,o)}const o={...e,...s},r=await W(this,o),n=this.sessions["text"===t?"lm_head":"gen_head"];if(!n)throw new Error(`Unable to find "${n}" generation head`);const a=await D(n,(0,i.pick)(r,n.inputNames));return{...s,...r,...a}}async generate(e){return this._generation_mode="text",super.generate(e)}async generate_images(e){this._generation_mode="image";const t=(e.inputs??e[this.main_input_name]).dims[1],s=(await super.generate(e)).slice(null,[t,null]),o=this.sessions.image_decode,{decoded_image:r}=await D(o,{generated_tokens:s}),n=r.add_(1).mul_(127.5).clamp_(0,255).to("uint8"),a=[];for(const e of n){const t=m.RawImage.fromTensor(e);a.push(t)}return a}}class Sl extends se{constructor({char_logits:e,bpe_logits:t,wp_logits:s}){super(),this.char_logits=e,this.bpe_logits=t,this.wp_logits=s}get logits(){return[this.char_logits,this.bpe_logits,this.wp_logits]}}class Al extends te{}class El extends Al{async _call(e){return new Sl(await super._call(e))}}class Ll extends te{}class Il extends Ll{}class zl extends Ll{}class Vl extends te{}class jl extends Vl{}class Dl extends Vl{}class Nl extends te{forward_params=["input_ids","attention_mask","position_ids","audio_values","past_key_values"]}class Ol extends Nl{_merge_input_ids_with_audio_features(e){const t=e.audio_features.dims.at(-1),s=e.audio_features.view(-1,t);return function({audio_token_id:e,inputs_embeds:t,audio_features:s,input_ids:o,attention_mask:r}){return $({modality_token_id:e,inputs_embeds:t,modality_features:s,input_ids:o,attention_mask:r})}({audio_token_id:this.config.ignore_index,...e,audio_features:s})}}class Bl extends te{main_input_name="input_values";forward_params=["input_values"]}class Gl extends se{constructor({audio_codes:e}){super(),this.audio_codes=e}}class Rl extends se{constructor({audio_values:e}){super(),this.audio_values=e}}class ql extends Bl{async encode(e){return new Gl(await D(this.sessions.encoder_model,e))}async decode(e){return new Rl(await D(this.sessions.decoder_model,e))}}class Wl extends Bl{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"encoder_model"})}}class $l extends Bl{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"decoder_model"})}}class Ul extends te{main_input_name="input_values";forward_params=["input_values"]}class Xl extends se{constructor({audio_codes:e}){super(),this.audio_codes=e}}class Ql extends se{constructor({audio_values:e}){super(),this.audio_values=e}}class Hl extends Ul{async encode(e){return new Xl(await D(this.sessions.encoder_model,e))}async decode(e){return new Ql(await D(this.sessions.decoder_model,e))}}class Jl extends Ul{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"encoder_model"})}}class Yl extends Ul{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"decoder_model"})}}class Kl extends te{main_input_name="input_values";forward_params=["input_values"]}class Zl extends Kl{async encode(e){return await D(this.sessions.encoder_model,e)}async decode(e){return await D(this.sessions.decoder_model,e)}}class ec extends Kl{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"encoder_model"})}}class tc extends Kl{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"decoder_model"})}}class sc{static MODEL_CLASS_MAPPINGS=null;static BASE_IF_FAIL=!1;static async from_pretrained(e,{progress_callback:t=null,config:s=null,cache_dir:r=null,local_files_only:n=!1,revision:a="main",model_file_name:i=null,subfolder:l="onnx",device:c=null,dtype:d=null,use_external_data_format:u=null,session_options:_={}}={}){const m={progress_callback:t,config:s,cache_dir:r,local_files_only:n,revision:a,model_file_name:i,subfolder:l,device:c,dtype:d,use_external_data_format:u,session_options:_};if(m.config=await o.AutoConfig.from_pretrained(e,m),!this.MODEL_CLASS_MAPPINGS)throw new Error("`MODEL_CLASS_MAPPINGS` not implemented for this type of `AutoClass`: "+this.name);const p=m.config.model_type;for(const t of this.MODEL_CLASS_MAPPINGS){let s=t.get(p);if(!s){for(const e of t.values())if(e[0]===p){s=e;break}if(!s)continue}return await s[1].from_pretrained(e,m)}if(this.BASE_IF_FAIL)return Gc.has(p)||console.warn(`Unknown model class "${p}", attempting to construct from base class.`),await te.from_pretrained(e,m);throw Error(`Unsupported model type: ${p}`)}}const oc=new Map([["bert",["BertModel",ne]],["modernbert",["ModernBertModel",ue]],["nomic_bert",["NomicBertModel",ge]],["roformer",["RoFormerModel",Me]],["electra",["ElectraModel",Ae]],["esm",["EsmModel",at]],["convbert",["ConvBertModel",ke]],["camembert",["CamembertModel",je]],["deberta",["DebertaModel",Re]],["deberta-v2",["DebertaV2Model",Qe]],["mpnet",["MPNetModel",gt]],["albert",["AlbertModel",vt]],["distilbert",["DistilBertModel",et]],["roberta",["RobertaModel",ss]],["xlm",["XLMModel",ls]],["xlm-roberta",["XLMRobertaModel",ps]],["clap",["ClapModel",Wi]],["clip",["CLIPModel",Ws]],["clipseg",["CLIPSegModel",ao]],["chinese_clip",["ChineseCLIPModel",eo]],["siglip",["SiglipModel",Js]],["jina_clip",["JinaCLIPModel",so]],["mobilebert",["MobileBertModel",ut]],["squeezebert",["SqueezeBertModel",xt]],["wav2vec2",["Wav2Vec2Model",Xa]],["wav2vec2-bert",["Wav2Vec2BertModel",_i]],["unispeech",["UniSpeechModel",oi]],["unispeech-sat",["UniSpeechSatModel",ii]],["hubert",["HubertModel",gi]],["wavlm",["WavLMModel",Ti]],["audio-spectrogram-transformer",["ASTModel",Ts]],["vits",["VitsModel",Qi]],["pyannote",["PyAnnoteModel",Ka]],["wespeaker-resnet",["WeSpeakerResNetModel",ti]],["detr",["DetrModel",bn]],["rt_detr",["RTDetrModel",vn]],["table-transformer",["TableTransformerModel",En]],["vit",["ViTModel",jr]],["ijepa",["IJepaModel",Or]],["pvt",["PvtModel",Wr]],["vit_msn",["ViTMSNModel",Hr]],["vit_mae",["ViTMAEModel",Xr]],["groupvit",["GroupViTModel",Kr]],["fastvit",["FastViTModel",en]],["mobilevit",["MobileViTModel",nn]],["mobilevitv2",["MobileViTV2Model",cn]],["owlvit",["OwlViTModel",_n]],["owlv2",["Owlv2Model",hn]],["beit",["BeitModel",Mn]],["deit",["DeiTModel",Vn]],["hiera",["HieraModel",Nn]],["convnext",["ConvNextModel",Ta]],["convnextv2",["ConvNextV2Model",Pa]],["dinov2",["Dinov2Model",ya]],["dinov2_with_registers",["Dinov2WithRegistersModel",Sa]],["resnet",["ResNetModel",Gn]],["swin",["SwinModel",Wn]],["swin2sr",["Swin2SRModel",Qn]],["donut-swin",["DonutSwinModel",Ma]],["yolos",["YolosModel",za]],["dpt",["DPTModel",Yn]],["glpn",["GLPNModel",ha]],["hifigan",["SpeechT5HifiGan",Ei]],["efficientnet",["EfficientNetModel",ol]],["decision_transformer",["DecisionTransformerModel",yl]],["patchtst",["PatchTSTForPrediction",Il]],["patchtsmixer",["PatchTSMixerForPrediction",jl]],["mobilenet_v1",["MobileNetV1Model",dl]],["mobilenet_v2",["MobileNetV2Model",pl]],["mobilenet_v3",["MobileNetV3Model",Ml]],["mobilenet_v4",["MobileNetV4Model",xl]],["maskformer",["MaskFormerModel",_a]],["mgp-str",["MgpstrForSceneTextRecognition",El]],["style_text_to_speech_2",["StyleTextToSpeech2Model",yi]]]),rc=new Map([["t5",["T5Model",Lt]],["longt5",["LongT5Model",Vt]],["mt5",["MT5Model",Nt]],["bart",["BartModel",Gt]],["mbart",["MBartModel",$t]],["marian",["MarianModel",Ga]],["whisper",["WhisperModel",Ps]],["m2m_100",["M2M100Model",Wa]],["blenderbot",["BlenderbotModel",Jt]],["blenderbot-small",["BlenderbotSmallModel",Zt]]]),nc=new Map([["mimi",["MimiModel",ql]],["dac",["DacModel",Hl]],["snac",["SnacModel",Zl]]]),ac=new Map([["bloom",["BloomModel",vr]],["jais",["JAISModel",mo]],["gpt2",["GPT2Model",co]],["gptj",["GPTJModel",xo]],["gpt_bigcode",["GPTBigCodeModel",Fo]],["gpt_neo",["GPTNeoModel",go]],["gpt_neox",["GPTNeoXModel",wo]],["codegen",["CodeGenModel",Co]],["llama",["LlamaModel",Eo]],["exaone",["ExaoneModel",Bo]],["olmo",["OlmoModel",Uo]],["olmo2",["Olmo2Model",Ho]],["mobilellm",["MobileLLMModel",qo]],["granite",["GraniteModel",Ko]],["cohere",["CohereModel",tr]],["gemma",["GemmaModel",rr]],["gemma2",["Gemma2Model",ir]],["gemma3_text",["Gemma3Model",dr]],["helium",["HeliumModel",zo]],["glm",["GlmModel",Do]],["openelm",["OpenELMModel",mr]],["qwen2",["Qwen2Model",gr]],["phi",["PhiModel",br]],["phi3",["Phi3Model",kr]],["mpt",["MptModel",Ar]],["opt",["OPTModel",Ir]],["mistral",["MistralModel",Vi]],["starcoder2",["Starcoder2Model",Ni]],["falcon",["FalconModel",Gi]],["stablelm",["StableLmModel",el]]]),ic=new Map([["speecht5",["SpeechT5ForSpeechToText",Si]],["whisper",["WhisperForConditionalGeneration",ks]],["lite-whisper",["LiteWhisperForConditionalGeneration",Fs]],["moonshine",["MoonshineForConditionalGeneration",Cs]]]),lc=new Map([["speecht5",["SpeechT5ForTextToSpeech",Ai]]]),cc=new Map([["vits",["VitsModel",Qi]],["musicgen",["MusicgenForConditionalGeneration",ll]]]),dc=new Map([["bert",["BertForSequenceClassification",ie]],["modernbert",["ModernBertForSequenceClassification",me]],["roformer",["RoFormerForSequenceClassification",Te]],["electra",["ElectraForSequenceClassification",Le]],["esm",["EsmForSequenceClassification",lt]],["convbert",["ConvBertForSequenceClassification",ye]],["camembert",["CamembertForSequenceClassification",Ne]],["deberta",["DebertaForSequenceClassification",We]],["deberta-v2",["DebertaV2ForSequenceClassification",Je]],["mpnet",["MPNetForSequenceClassification",Mt]],["albert",["AlbertForSequenceClassification",Ct]],["distilbert",["DistilBertForSequenceClassification",tt]],["roberta",["RobertaForSequenceClassification",rs]],["xlm",["XLMForSequenceClassification",ds]],["xlm-roberta",["XLMRobertaForSequenceClassification",gs]],["bart",["BartForSequenceClassification",qt]],["mbart",["MBartForSequenceClassification",Xt]],["mobilebert",["MobileBertForSequenceClassification",mt]],["squeezebert",["SqueezeBertForSequenceClassification",kt]]]),uc=new Map([["bert",["BertForTokenClassification",le]],["modernbert",["ModernBertForTokenClassification",pe]],["roformer",["RoFormerForTokenClassification",be]],["electra",["ElectraForTokenClassification",Ie]],["esm",["EsmForTokenClassification",ct]],["convbert",["ConvBertForTokenClassification",ve]],["camembert",["CamembertForTokenClassification",Oe]],["deberta",["DebertaForTokenClassification",$e]],["deberta-v2",["DebertaV2ForTokenClassification",Ye]],["mpnet",["MPNetForTokenClassification",wt]],["distilbert",["DistilBertForTokenClassification",st]],["roberta",["RobertaForTokenClassification",ns]],["xlm",["XLMForTokenClassification",us]],["xlm-roberta",["XLMRobertaForTokenClassification",fs]]]),_c=new Map([["t5",["T5ForConditionalGeneration",It]],["longt5",["LongT5ForConditionalGeneration",jt]],["mt5",["MT5ForConditionalGeneration",Ot]],["bart",["BartForConditionalGeneration",Rt]],["mbart",["MBartForConditionalGeneration",Ut]],["marian",["MarianMTModel",Ra]],["m2m_100",["M2M100ForConditionalGeneration",$a]],["blenderbot",["BlenderbotForConditionalGeneration",Yt]],["blenderbot-small",["BlenderbotSmallForConditionalGeneration",es]]]),mc=new Map([["bloom",["BloomForCausalLM",Cr]],["gpt2",["GPT2LMHeadModel",uo]],["jais",["JAISLMHeadModel",po]],["gptj",["GPTJForCausalLM",Po]],["gpt_bigcode",["GPTBigCodeForCausalLM",yo]],["gpt_neo",["GPTNeoForCausalLM",fo]],["gpt_neox",["GPTNeoXForCausalLM",To]],["codegen",["CodeGenForCausalLM",So]],["llama",["LlamaForCausalLM",Lo]],["exaone",["ExaoneForCausalLM",Go]],["olmo",["OlmoForCausalLM",Xo]],["olmo2",["Olmo2ForCausalLM",Jo]],["mobilellm",["MobileLLMForCausalLM",Wo]],["granite",["GraniteForCausalLM",Zo]],["cohere",["CohereForCausalLM",sr]],["gemma",["GemmaForCausalLM",nr]],["gemma2",["Gemma2ForCausalLM",lr]],["gemma3_text",["Gemma3ForCausalLM",ur]],["helium",["HeliumForCausalLM",Vo]],["glm",["GlmForCausalLM",No]],["openelm",["OpenELMForCausalLM",pr]],["qwen2",["Qwen2ForCausalLM",fr]],["phi",["PhiForCausalLM",xr]],["phi3",["Phi3ForCausalLM",Fr]],["mpt",["MptForCausalLM",Er]],["opt",["OPTForCausalLM",zr]],["mbart",["MBartForCausalLM",Qt]],["mistral",["MistralForCausalLM",ji]],["starcoder2",["Starcoder2ForCausalLM",Oi]],["falcon",["FalconForCausalLM",Ri]],["trocr",["TrOCRForCausalLM",Ii]],["stablelm",["StableLmForCausalLM",tl]],["phi3_v",["Phi3VForCausalLM",Rs]]]),pc=new Map([["multi_modality",["MultiModalityCausalLM",Cl]]]),hc=new Map([["bert",["BertForMaskedLM",ae]],["modernbert",["ModernBertForMaskedLM",_e]],["roformer",["RoFormerForMaskedLM",we]],["electra",["ElectraForMaskedLM",Ee]],["esm",["EsmForMaskedLM",it]],["convbert",["ConvBertForMaskedLM",Fe]],["camembert",["CamembertForMaskedLM",De]],["deberta",["DebertaForMaskedLM",qe]],["deberta-v2",["DebertaV2ForMaskedLM",He]],["mpnet",["MPNetForMaskedLM",ft]],["albert",["AlbertForMaskedLM",At]],["distilbert",["DistilBertForMaskedLM",rt]],["roberta",["RobertaForMaskedLM",os]],["xlm",["XLMWithLMHeadModel",cs]],["xlm-roberta",["XLMRobertaForMaskedLM",hs]],["mobilebert",["MobileBertForMaskedLM",_t]],["squeezebert",["SqueezeBertForMaskedLM",Pt]]]),gc=new Map([["bert",["BertForQuestionAnswering",ce]],["roformer",["RoFormerForQuestionAnswering",xe]],["electra",["ElectraForQuestionAnswering",ze]],["convbert",["ConvBertForQuestionAnswering",Ce]],["camembert",["CamembertForQuestionAnswering",Be]],["deberta",["DebertaForQuestionAnswering",Ue]],["deberta-v2",["DebertaV2ForQuestionAnswering",Ke]],["mpnet",["MPNetForQuestionAnswering",Tt]],["albert",["AlbertForQuestionAnswering",St]],["distilbert",["DistilBertForQuestionAnswering",ot]],["roberta",["RobertaForQuestionAnswering",as]],["xlm",["XLMForQuestionAnswering",_s]],["xlm-roberta",["XLMRobertaForQuestionAnswering",Ms]],["mobilebert",["MobileBertForQuestionAnswering",pt]],["squeezebert",["SqueezeBertForQuestionAnswering",Ft]]]),fc=new Map([["vision-encoder-decoder",["VisionEncoderDecoderModel",Ss]],["idefics3",["Idefics3ForConditionalGeneration",Os]],["smolvlm",["SmolVLMForConditionalGeneration",Bs]]]),Mc=new Map([["llava",["LlavaForConditionalGeneration",Es]],["llava_onevision",["LlavaOnevisionForConditionalGeneration",Ls]],["moondream1",["Moondream1ForConditionalGeneration",Is]],["florence2",["Florence2ForConditionalGeneration",Vs]],["qwen2-vl",["Qwen2VLForConditionalGeneration",wr]],["idefics3",["Idefics3ForConditionalGeneration",Os]],["smolvlm",["SmolVLMForConditionalGeneration",Bs]],["paligemma",["PaliGemmaForConditionalGeneration",Ds]]]),wc=new Map([["ultravox",["UltravoxModel",Ol]]]),Tc=new Map([["vision-encoder-decoder",["VisionEncoderDecoderModel",Ss]]]),bc=new Map([["vit",["ViTForImageClassification",Dr]],["ijepa",["IJepaForImageClassification",Br]],["pvt",["PvtForImageClassification",$r]],["vit_msn",["ViTMSNForImageClassification",Jr]],["fastvit",["FastViTForImageClassification",tn]],["mobilevit",["MobileViTForImageClassification",an]],["mobilevitv2",["MobileViTV2ForImageClassification",dn]],["beit",["BeitForImageClassification",wn]],["deit",["DeiTForImageClassification",jn]],["hiera",["HieraForImageClassification",On]],["convnext",["ConvNextForImageClassification",ba]],["convnextv2",["ConvNextV2ForImageClassification",ka]],["dinov2",["Dinov2ForImageClassification",va]],["dinov2_with_registers",["Dinov2WithRegistersForImageClassification",Aa]],["resnet",["ResNetForImageClassification",Rn]],["swin",["SwinForImageClassification",$n]],["segformer",["SegformerForImageClassification",Yi]],["efficientnet",["EfficientNetForImageClassification",rl]],["mobilenet_v1",["MobileNetV1ForImageClassification",ul]],["mobilenet_v2",["MobileNetV2ForImageClassification",hl]],["mobilenet_v3",["MobileNetV3ForImageClassification",wl]],["mobilenet_v4",["MobileNetV4ForImageClassification",Pl]]]),xc=new Map([["detr",["DetrForObjectDetection",xn]],["rt_detr",["RTDetrForObjectDetection",Cn]],["table-transformer",["TableTransformerForObjectDetection",Ln]],["yolos",["YolosForObjectDetection",Va]]]),Pc=new Map([["owlvit",["OwlViTForObjectDetection",mn]],["owlv2",["Owlv2ForObjectDetection",gn]],["grounding-dino",["GroundingDinoForObjectDetection",La]]]),kc=new Map([["detr",["DetrForSegmentation",Pn]],["clipseg",["CLIPSegForImageSegmentation",io]]]),Fc=new Map([["segformer",["SegformerForSemanticSegmentation",Ki]],["sapiens",["SapiensForSemanticSegmentation",sa]],["swin",["SwinForSemanticSegmentation",Un]],["mobilenet_v1",["MobileNetV1ForSemanticSegmentation",_l]],["mobilenet_v2",["MobileNetV2ForSemanticSegmentation",gl]],["mobilenet_v3",["MobileNetV3ForSemanticSegmentation",Tl]],["mobilenet_v4",["MobileNetV4ForSemanticSegmentation",kl]]]),yc=new Map([["detr",["DetrForSegmentation",Pn]],["maskformer",["MaskFormerForInstanceSegmentation",ma]]]),vc=new Map([["sam",["SamModel",Na]]]),Cc=new Map([["wav2vec2",["Wav2Vec2ForCTC",Qa]],["wav2vec2-bert",["Wav2Vec2BertForCTC",mi]],["unispeech",["UniSpeechForCTC",ri]],["unispeech-sat",["UniSpeechSatForCTC",li]],["wavlm",["WavLMForCTC",bi]],["hubert",["HubertForCTC",fi]]]),Sc=new Map([["wav2vec2",["Wav2Vec2ForSequenceClassification",Ha]],["wav2vec2-bert",["Wav2Vec2BertForSequenceClassification",pi]],["unispeech",["UniSpeechForSequenceClassification",ni]],["unispeech-sat",["UniSpeechSatForSequenceClassification",ci]],["wavlm",["WavLMForSequenceClassification",xi]],["hubert",["HubertForSequenceClassification",Mi]],["audio-spectrogram-transformer",["ASTForAudioClassification",bs]]]),Ac=new Map([["wavlm",["WavLMForXVector",Pi]]]),Ec=new Map([["unispeech-sat",["UniSpeechSatForAudioFrameClassification",di]],["wavlm",["WavLMForAudioFrameClassification",ki]],["wav2vec2",["Wav2Vec2ForAudioFrameClassification",Ja]],["pyannote",["PyAnnoteForAudioFrameClassification",Za]]]),Lc=new Map([["vitmatte",["VitMatteForImageMatting",on]]]),Ic=new Map([["patchtst",["PatchTSTForPrediction",zl]],["patchtsmixer",["PatchTSMixerForPrediction",Dl]]]),zc=new Map([["swin2sr",["Swin2SRForImageSuperResolution",Hn]]]),Vc=new Map([["dpt",["DPTForDepthEstimation",Kn]],["depth_anything",["DepthAnythingForDepthEstimation",ea]],["glpn",["GLPNForDepthEstimation",ga]],["sapiens",["SapiensForDepthEstimation",oa]],["depth_pro",["DepthProForDepthEstimation",aa]],["metric3d",["Metric3DForDepthEstimation",la]],["metric3dv2",["Metric3Dv2ForDepthEstimation",da]]]),jc=new Map([["sapiens",["SapiensForNormalEstimation",ra]]]),Dc=new Map([["vitpose",["VitPoseForPoseEstimation",Rr]]]),Nc=new Map([["clip",["CLIPVisionModelWithProjection",Qs]],["siglip",["SiglipVisionModel",Ks]],["jina_clip",["JinaCLIPVisionModel",ro]]]),Oc=[[oc,T],[rc,b],[ac,k],[nc,E],[dc,T],[uc,T],[_c,x],[ic,x],[mc,k],[pc,C],[hc,T],[gc,T],[fc,P],[Mc,y],[wc,A],[bc,T],[kc,T],[yc,T],[Fc,T],[Lc,T],[Ic,T],[zc,T],[Vc,T],[jc,T],[Dc,T],[xc,T],[Pc,T],[vc,F],[Cc,T],[Sc,T],[lc,x],[cc,T],[Ac,T],[Ec,T],[Nc,T]];for(const[e,t]of Oc)for(const[s,o]of e.values())L.set(s,t),z.set(o,s),I.set(s,o);const Bc=[["MusicgenForConditionalGeneration",ll,v],["Phi3VForCausalLM",Rs,S],["CLIPTextModelWithProjection",Us,T],["SiglipTextModel",Ys,T],["JinaCLIPTextModel",oo,T],["ClapTextModelWithProjection",$i,T],["ClapAudioModelWithProjection",Ui,T],["DacEncoderModel",Jl,T],["DacDecoderModel",Yl,T],["MimiEncoderModel",Wl,T],["MimiDecoderModel",$l,T],["SnacEncoderModel",ec,T],["SnacDecoderModel",tc,T]];for(const[e,t,s]of Bc)L.set(e,s),z.set(t,e),I.set(e,t);const Gc=new Map([["modnet",kc],["birefnet",kc],["isnet",kc],["ben",kc]]);for(const[e,t]of Gc.entries())t.set(e,["PreTrainedModel",te]),L.set(e,T),z.set(te,e),I.set(e,te);class Rc extends sc{static MODEL_CLASS_MAPPINGS=Oc.map((e=>e[0]));static BASE_IF_FAIL=!0}class qc extends sc{static MODEL_CLASS_MAPPINGS=[dc]}class Wc extends sc{static MODEL_CLASS_MAPPINGS=[uc]}class $c extends sc{static MODEL_CLASS_MAPPINGS=[_c]}class Uc extends sc{static MODEL_CLASS_MAPPINGS=[ic]}class Xc extends sc{static MODEL_CLASS_MAPPINGS=[lc]}class Qc extends sc{static MODEL_CLASS_MAPPINGS=[cc]}class Hc extends sc{static MODEL_CLASS_MAPPINGS=[mc]}class Jc extends sc{static MODEL_CLASS_MAPPINGS=[hc]}class Yc extends sc{static MODEL_CLASS_MAPPINGS=[gc]}class Kc extends sc{static MODEL_CLASS_MAPPINGS=[fc]}class Zc extends sc{static MODEL_CLASS_MAPPINGS=[bc]}class ed extends sc{static MODEL_CLASS_MAPPINGS=[kc]}class td extends sc{static MODEL_CLASS_MAPPINGS=[Fc]}class sd extends sc{static MODEL_CLASS_MAPPINGS=[yc]}class od extends sc{static MODEL_CLASS_MAPPINGS=[xc]}class rd extends sc{static MODEL_CLASS_MAPPINGS=[Pc]}class nd extends sc{static MODEL_CLASS_MAPPINGS=[vc]}class ad extends sc{static MODEL_CLASS_MAPPINGS=[Cc]}class id extends sc{static MODEL_CLASS_MAPPINGS=[Sc]}class ld extends sc{static MODEL_CLASS_MAPPINGS=[Ac]}class cd extends sc{static MODEL_CLASS_MAPPINGS=[Ec]}class dd extends sc{static MODEL_CLASS_MAPPINGS=[Tc]}class ud extends sc{static MODEL_CLASS_MAPPINGS=[Lc]}class _d extends sc{static MODEL_CLASS_MAPPINGS=[zc]}class md extends sc{static MODEL_CLASS_MAPPINGS=[Vc]}class pd extends sc{static MODEL_CLASS_MAPPINGS=[jc]}class hd extends sc{static MODEL_CLASS_MAPPINGS=[Dc]}class gd extends sc{static MODEL_CLASS_MAPPINGS=[Nc]}class fd extends sc{static MODEL_CLASS_MAPPINGS=[Mc]}class Md extends sc{static MODEL_CLASS_MAPPINGS=[wc]}class wd extends se{constructor({logits:e,past_key_values:t,encoder_outputs:s,decoder_attentions:o=null,cross_attentions:r=null}){super(),this.logits=e,this.past_key_values=t,this.encoder_outputs=s,this.decoder_attentions=o,this.cross_attentions=r}}class Td extends se{constructor({logits:e,...t}){super(),this.logits=e;const s=Object.values(t);s.length>0&&(this.attentions=s)}}class bd extends se{constructor({logits:e,embeddings:t}){super(),this.logits=e,this.embeddings=t}}class xd extends se{constructor({logits:e}){super(),this.logits=e}}class Pd extends se{constructor({logits:e}){super(),this.logits=e}}class kd extends se{constructor({start_logits:e,end_logits:t}){super(),this.start_logits=e,this.end_logits=t}}class Fd extends se{constructor({logits:e}){super(),this.logits=e}}class yd extends se{constructor({logits:e,past_key_values:t}){super(),this.logits=e,this.past_key_values=t}}class vd extends se{constructor({alphas:e}){super(),this.alphas=e}}class Cd extends se{constructor({waveform:e,spectrogram:t}){super(),this.waveform=e,this.spectrogram=t}}},"./src/models/audio_spectrogram_transformer/feature_extraction_audio_spectrogram_transformer.js":(e,t,s)=>{s.r(t),s.d(t,{ASTFeatureExtractor:()=>n});var o=s("./src/base/feature_extraction_utils.js"),r=(s("./src/utils/tensor.js"),s("./src/utils/audio.js"));class n extends o.FeatureExtractor{constructor(e){super(e);const t=this.config.sampling_rate,s=(0,r.mel_filter_bank)(256,this.config.num_mel_bins,20,Math.floor(t/2),t,null,"kaldi",!0);for(let e=0;e<s.length;++e)s[e].push(0);this.mel_filters=s,this.window=(0,r.window_function)(400,"hann",{periodic:!1}),this.mean=this.config.mean,this.std=this.config.std}async _extract_fbank_features(e,t){return(0,r.spectrogram)(e,this.window,400,160,{fft_length:512,power:2,center:!1,preemphasis:.97,mel_filters:this.mel_filters,log_mel:"log",mel_floor:1.192092955078125e-7,remove_dc_offset:!0,max_num_frames:t,transpose:!0})}async _call(e){(0,o.validate_audio_inputs)(e,"ASTFeatureExtractor");const t=await this._extract_fbank_features(e,this.config.max_length);if(this.config.do_normalize){const e=2*this.std,s=t.data;for(let t=0;t<s.length;++t)s[t]=(s[t]-this.mean)/e}return{input_values:t.unsqueeze_(0)}}}},"./src/models/auto/feature_extraction_auto.js":(e,t,s)=>{s.r(t),s.d(t,{AutoFeatureExtractor:()=>a});var o=s("./src/utils/constants.js"),r=s("./src/utils/hub.js"),n=(s("./src/base/feature_extraction_utils.js"),s("./src/models/feature_extractors.js"));class a{static async from_pretrained(e,t={}){const s=await(0,r.getModelJSON)(e,o.FEATURE_EXTRACTOR_NAME,!0,t),a=s.feature_extractor_type,i=n[a];if(!i)throw new Error(`Unknown feature_extractor_type: '${a}'. Please report this at ${o.GITHUB_ISSUE_URL}.`);return new i(s)}}},"./src/models/auto/image_processing_auto.js":(e,t,s)=>{s.r(t),s.d(t,{AutoImageProcessor:()=>i});var o=s("./src/utils/constants.js"),r=s("./src/utils/hub.js"),n=s("./src/base/image_processors_utils.js"),a=s("./src/models/image_processors.js");class i{static async from_pretrained(e,t={}){const s=await(0,r.getModelJSON)(e,o.IMAGE_PROCESSOR_NAME,!0,t),i=s.image_processor_type??s.feature_extractor_type;let l=a[i];return l||(void 0!==i&&console.warn(`Image processor type '${i}' not found, assuming base ImageProcessor. Please report this at ${o.GITHUB_ISSUE_URL}.`),l=n.ImageProcessor),new l(s)}}},"./src/models/auto/processing_auto.js":(e,t,s)=>{s.r(t),s.d(t,{AutoProcessor:()=>c});var o=s("./src/utils/constants.js"),r=s("./src/utils/hub.js"),n=s("./src/base/processing_utils.js"),a=s("./src/models/processors.js"),i=s("./src/models/image_processors.js"),l=s("./src/models/feature_extractors.js");class c{static async from_pretrained(e,t={}){const s=await(0,r.getModelJSON)(e,o.IMAGE_PROCESSOR_NAME,!0,t),{image_processor_type:c,feature_extractor_type:d,processor_class:u}=s;if(u&&a[u])return a[u].from_pretrained(e,t);if(!c&&!d)throw new Error("No `image_processor_type` or `feature_extractor_type` found in the config.");const _={};if(c){const e=i[c];if(!e)throw new Error(`Unknown image_processor_type: '${c}'.`);_.image_processor=new e(s)}if(d){const e=i[d];if(e)_.image_processor=new e(s);else{const e=l[d];if(!e)throw new Error(`Unknown feature_extractor_type: '${d}'.`);_.feature_extractor=new e(s)}}return new n.Processor({},_)}}},"./src/models/beit/image_processing_beit.js":(e,t,s)=>{s.r(t),s.d(t,{BeitFeatureExtractor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{}},"./src/models/bit/image_processing_bit.js":(e,t,s)=>{s.r(t),s.d(t,{BitImageProcessor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{}},"./src/models/chinese_clip/image_processing_chinese_clip.js":(e,t,s)=>{s.r(t),s.d(t,{ChineseCLIPFeatureExtractor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{}},"./src/models/clap/feature_extraction_clap.js":(e,t,s)=>{s.r(t),s.d(t,{ClapFeatureExtractor:()=>n});var o=s("./src/base/feature_extraction_utils.js"),r=(s("./src/utils/tensor.js"),s("./src/utils/audio.js"));class n extends o.FeatureExtractor{constructor(e){super(e),this.mel_filters=(0,r.mel_filter_bank)(this.config.nb_frequency_bins,this.config.feature_size,this.config.frequency_min,this.config.frequency_max,this.config.sampling_rate,null,"htk"),this.mel_filters_slaney=(0,r.mel_filter_bank)(this.config.nb_frequency_bins,this.config.feature_size,this.config.frequency_min,this.config.frequency_max,this.config.sampling_rate,"slaney","slaney"),this.window=(0,r.window_function)(this.config.fft_window_size,"hann")}async _get_input_mel(e,t,s,o){let r,n=!1;const a=e.length-t;if(a>0){if("rand_trunc"!==s)throw new Error(`Truncation strategy "${s}" not implemented`);{n=!0;const s=Math.floor(Math.random()*(a+1));e=e.subarray(s,s+t),r=await this._extract_fbank_features(e,this.mel_filters_slaney,this.config.nb_max_samples)}}else{if(a<0){let s=new Float64Array(t);if(s.set(e),"repeat"===o)for(let o=e.length;o<t;o+=e.length)s.set(e.subarray(0,Math.min(e.length,t-o)),o);else if("repeatpad"===o)for(let t=e.length;t<-a;t+=e.length)s.set(e,t);e=s}if("fusion"===s)throw new Error(`Truncation strategy "${s}" not implemented`);r=await this._extract_fbank_features(e,this.mel_filters_slaney,this.config.nb_max_samples)}return r.unsqueeze_(0)}async _extract_fbank_features(e,t,s=null){return(0,r.spectrogram)(e,this.window,this.config.fft_window_size,this.config.hop_length,{power:2,mel_filters:t,log_mel:"dB",max_num_frames:s,do_pad:!1,transpose:!0})}async _call(e,{max_length:t=null}={}){(0,o.validate_audio_inputs)(e,"ClapFeatureExtractor");return{input_features:(await this._get_input_mel(e,t??this.config.nb_max_samples,this.config.truncation,this.config.padding)).unsqueeze_(0)}}}},"./src/models/clip/image_processing_clip.js":(e,t,s)=>{s.r(t),s.d(t,{CLIPFeatureExtractor:()=>n,CLIPImageProcessor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{}class n extends r{}},"./src/models/convnext/image_processing_convnext.js":(e,t,s)=>{s.r(t),s.d(t,{ConvNextFeatureExtractor:()=>n,ConvNextImageProcessor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{constructor(e){super(e),this.crop_pct=this.config.crop_pct??.875}async resize(e){const t=this.size?.shortest_edge;if(void 0===t)throw new Error("Size dictionary must contain 'shortest_edge' key.");if(t<384){const s=Math.floor(t/this.crop_pct),[o,r]=this.get_resize_output_image_size(e,{shortest_edge:s});e=await e.resize(o,r,{resample:this.resample}),e=await e.center_crop(t,t)}else e=await e.resize(t,t,{resample:this.resample});return e}}class n extends r{}},"./src/models/dac/feature_extraction_dac.js":(e,t,s)=>{s.r(t),s.d(t,{DacFeatureExtractor:()=>r});var o=s("./src/models/encodec/feature_extraction_encodec.js");class r extends o.EncodecFeatureExtractor{}},"./src/models/deit/image_processing_deit.js":(e,t,s)=>{s.r(t),s.d(t,{DeiTFeatureExtractor:()=>n,DeiTImageProcessor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{}class n extends r{}},"./src/models/detr/image_processing_detr.js":(e,t,s)=>{s.r(t),s.d(t,{DetrFeatureExtractor:()=>a,DetrImageProcessor:()=>n});var o=s("./src/base/image_processors_utils.js"),r=s("./src/utils/tensor.js");class n extends o.ImageProcessor{async _call(e){const t=await super._call(e),s=[t.pixel_values.dims[0],64,64],o=(0,r.full)(s,1n);return{...t,pixel_mask:o}}post_process_object_detection(...e){return(0,o.post_process_object_detection)(...e)}post_process_panoptic_segmentation(...e){return(0,o.post_process_panoptic_segmentation)(...e)}post_process_instance_segmentation(...e){return(0,o.post_process_instance_segmentation)(...e)}}class a extends n{}},"./src/models/donut/image_processing_donut.js":(e,t,s)=>{s.r(t),s.d(t,{DonutFeatureExtractor:()=>n,DonutImageProcessor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{pad_image(e,t,s,o={}){const[r,n,a]=t;let i=this.image_mean;Array.isArray(this.image_mean)||(i=new Array(a).fill(i));let l=this.image_std;Array.isArray(l)||(l=new Array(a).fill(i));const c=i.map(((e,t)=>-e/l[t]));return super.pad_image(e,t,s,{center:!0,constant_values:c,...o})}}class n extends r{}},"./src/models/dpt/image_processing_dpt.js":(e,t,s)=>{s.r(t),s.d(t,{DPTFeatureExtractor:()=>n,DPTImageProcessor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{}class n extends r{}},"./src/models/efficientnet/image_processing_efficientnet.js":(e,t,s)=>{s.r(t),s.d(t,{EfficientNetImageProcessor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{constructor(e){super(e),this.include_top=this.config.include_top??!0,this.include_top&&(this.image_std=this.image_std.map((e=>e*e)))}}},"./src/models/encodec/feature_extraction_encodec.js":(e,t,s)=>{s.r(t),s.d(t,{EncodecFeatureExtractor:()=>n});var o=s("./src/base/feature_extraction_utils.js"),r=s("./src/utils/tensor.js");class n extends o.FeatureExtractor{async _call(e){(0,o.validate_audio_inputs)(e,"EncodecFeatureExtractor"),e instanceof Float64Array&&(e=new Float32Array(e));const t=this.config.feature_size;if(e.length%t!=0)throw new Error(`The length of the audio data must be a multiple of the number of channels (${t}).`);const s=[1,t,e.length/t];return{input_values:new r.Tensor("float32",e,s)}}}},"./src/models/feature_extractors.js":(e,t,s)=>{s.r(t),s.d(t,{ASTFeatureExtractor:()=>o.ASTFeatureExtractor,ClapFeatureExtractor:()=>n.ClapFeatureExtractor,DacFeatureExtractor:()=>a.DacFeatureExtractor,EncodecFeatureExtractor:()=>r.EncodecFeatureExtractor,ImageFeatureExtractor:()=>h.ImageProcessor,MoonshineFeatureExtractor:()=>i.MoonshineFeatureExtractor,PyAnnoteFeatureExtractor:()=>l.PyAnnoteFeatureExtractor,SeamlessM4TFeatureExtractor:()=>c.SeamlessM4TFeatureExtractor,SnacFeatureExtractor:()=>d.SnacFeatureExtractor,SpeechT5FeatureExtractor:()=>u.SpeechT5FeatureExtractor,Wav2Vec2FeatureExtractor:()=>_.Wav2Vec2FeatureExtractor,WeSpeakerFeatureExtractor:()=>m.WeSpeakerFeatureExtractor,WhisperFeatureExtractor:()=>p.WhisperFeatureExtractor});var o=s("./src/models/audio_spectrogram_transformer/feature_extraction_audio_spectrogram_transformer.js"),r=s("./src/models/encodec/feature_extraction_encodec.js"),n=s("./src/models/clap/feature_extraction_clap.js"),a=s("./src/models/dac/feature_extraction_dac.js"),i=s("./src/models/moonshine/feature_extraction_moonshine.js"),l=s("./src/models/pyannote/feature_extraction_pyannote.js"),c=s("./src/models/seamless_m4t/feature_extraction_seamless_m4t.js"),d=s("./src/models/snac/feature_extraction_snac.js"),u=s("./src/models/speecht5/feature_extraction_speecht5.js"),_=s("./src/models/wav2vec2/feature_extraction_wav2vec2.js"),m=s("./src/models/wespeaker/feature_extraction_wespeaker.js"),p=s("./src/models/whisper/feature_extraction_whisper.js"),h=s("./src/base/image_processors_utils.js")},"./src/models/florence2/processing_florence2.js":(e,t,s)=>{s.r(t),s.d(t,{Florence2Processor:()=>a});var o=s("./src/base/processing_utils.js"),r=s("./src/models/auto/image_processing_auto.js"),n=s("./src/tokenizers.js");class a extends o.Processor{static tokenizer_class=n.AutoTokenizer;static image_processor_class=r.AutoImageProcessor;constructor(e,t){super(e,t);const{tasks_answer_post_processing_type:s,task_prompts_without_inputs:o,task_prompts_with_input:r}=this.image_processor.config;this.tasks_answer_post_processing_type=new Map(Object.entries(s??{})),this.task_prompts_without_inputs=new Map(Object.entries(o??{})),this.task_prompts_with_input=new Map(Object.entries(r??{})),this.regexes={quad_boxes:/(.+?)<loc_(\d+)><loc_(\d+)><loc_(\d+)><loc_(\d+)><loc_(\d+)><loc_(\d+)><loc_(\d+)><loc_(\d+)>/gm,bboxes:/([^<]+)?<loc_(\d+)><loc_(\d+)><loc_(\d+)><loc_(\d+)>/gm},this.size_per_bin=1e3}construct_prompts(e){"string"==typeof e&&(e=[e]);const t=[];for(const s of e)if(this.task_prompts_without_inputs.has(s))t.push(this.task_prompts_without_inputs.get(s));else{for(const[e,o]of this.task_prompts_with_input)if(s.includes(e)){t.push(o.replaceAll("{input}",s).replaceAll(e,""));break}t.length!==e.length&&t.push(s)}return t}post_process_generation(e,t,s){const o=this.tasks_answer_post_processing_type.get(t)??"pure_text";let r;switch(e=e.replaceAll("<s>","").replaceAll("</s>",""),o){case"pure_text":r=e;break;case"description_with_bboxes":case"bboxes":case"phrase_grounding":case"ocr":const n="ocr"===o?"quad_boxes":"bboxes",a=e.matchAll(this.regexes[n]),i=[],l=[];for(const[e,t,...o]of a)i.push(t?t.trim():i.at(-1)??""),l.push(o.map(((e,t)=>(Number(e)+.5)/this.size_per_bin*s[t%2])));r={labels:i,[n]:l};break;default:throw new Error(`Task "${t}" (of type "${o}") not yet implemented.`)}return{[t]:r}}async _call(e,t=null,s={}){if(!e&&!t)throw new Error("Either text or images must be provided");return{...await this.image_processor(e,s),...t?this.tokenizer(t,s):{}}}}},"./src/models/glpn/image_processing_glpn.js":(e,t,s)=>{s.r(t),s.d(t,{GLPNFeatureExtractor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{}},"./src/models/grounding_dino/image_processing_grounding_dino.js":(e,t,s)=>{s.r(t),s.d(t,{GroundingDinoImageProcessor:()=>n});var o=s("./src/base/image_processors_utils.js"),r=s("./src/utils/tensor.js");class n extends o.ImageProcessor{async _call(e){const t=await super._call(e),s=t.pixel_values.dims,o=(0,r.ones)([s[0],s[2],s[3]]);return{...t,pixel_mask:o}}}},"./src/models/grounding_dino/processing_grounding_dino.js":(e,t,s)=>{s.r(t),s.d(t,{GroundingDinoProcessor:()=>l});var o=s("./src/base/processing_utils.js"),r=s("./src/models/auto/image_processing_auto.js"),n=s("./src/tokenizers.js"),a=s("./src/base/image_processors_utils.js");function i(e,t){const s=e.dims.at(-1)-1,o=e.tolist();o.fill(!1,0,1),o.fill(!1,s);const r=t.tolist();return o.map(((e,t)=>e?t:null)).filter((e=>null!==e)).map((e=>r[e]))}class l extends o.Processor{static tokenizer_class=n.AutoTokenizer;static image_processor_class=r.AutoImageProcessor;async _call(e,t,s={}){const o=e?await this.image_processor(e,s):{};return{...t?this.tokenizer(t,s):{},...o}}post_process_grounded_object_detection(e,t,{box_threshold:s=.25,text_threshold:o=.25,target_sizes:r=null}={}){const{logits:n,pred_boxes:l}=e,c=n.dims[0];if(null!==r&&r.length!==c)throw Error("Make sure that you pass in as many target sizes as the batch dimension of the logits");const d=n.dims.at(1),u=n.sigmoid(),_=u.max(-1).tolist(),m=l.tolist().map((e=>e.map((e=>(0,a.center_to_corners_format)(e))))),p=[];for(let e=0;e<c;++e){const n=null!==r?r[e]:null;null!==n&&(m[e]=m[e].map((e=>e.map(((e,t)=>e*n[(t+1)%2])))));const a=_[e],l=[],c=[],h=[];for(let r=0;r<d;++r){const n=a[r];if(n<=s)continue;const d=m[e][r],_=u[e][r];l.push(n),h.push(d);const p=i(_.gt(o),t[e]);c.push(p)}p.push({scores:l,boxes:h,labels:this.batch_decode(c)})}return p}}},"./src/models/idefics3/image_processing_idefics3.js":(e,t,s)=>{s.r(t),s.d(t,{Idefics3ImageProcessor:()=>n});var o=s("./src/base/image_processors_utils.js"),r=s("./src/utils/tensor.js");class n extends o.ImageProcessor{constructor(e){super(e),this.do_image_splitting=e.do_image_splitting??!0,this.max_image_size=e.max_image_size}get_resize_for_vision_encoder(e,t){let[s,o]=e.dims.slice(-2);const r=o/s;return o>=s?(o=Math.ceil(o/t)*t,s=Math.floor(o/r),s=Math.ceil(s/t)*t):(s=Math.ceil(s/t)*t,o=Math.floor(s*r),o=Math.ceil(o/t)*t),{height:s,width:o}}async _call(e,{do_image_splitting:t=null,return_row_col_info:s=!1}={}){let o;if(Array.isArray(e)){if(0===e.length||!e[0])throw new Error("No images provided.");o=Array.isArray(e[0])?e:[e]}else o=[[e]];let n=[],a=[],i=[];const l=[],c=[];for(const e of o){let s=await Promise.all(e.map((e=>this.preprocess(e))));l.push(...s.map((e=>e.original_size))),c.push(...s.map((e=>e.reshaped_input_size))),s.forEach((e=>e.pixel_values.unsqueeze_(0)));const{longest_edge:o}=this.max_image_size;let d;if(t??this.do_image_splitting){let e=new Array(s.length),t=new Array(s.length);d=await Promise.all(s.map((async(s,n)=>{const a=this.get_resize_for_vision_encoder(s.pixel_values,o),i=await(0,r.interpolate_4d)(s.pixel_values,{size:[a.height,a.width]}),{frames:l,num_splits_h:c,num_splits_w:d}=await this.split_image(i,this.max_image_size);return e[n]=c,t[n]=d,(0,r.cat)(l,0)}))),a.push(e),i.push(t)}else{const e=[o,o];d=await Promise.all(s.map((t=>(0,r.interpolate_4d)(t.pixel_values,{size:e})))),a.push(new Array(s.length).fill(0)),i.push(new Array(s.length).fill(0))}n.push((0,r.cat)(d,0))}const d=n.length,[u,_,m,p]=n[0].dims;let h,g;if(1===d)h=n[0].unsqueeze_(0),g=(0,r.full)([d,u,m,p],!0);else{const e=Math.max(...n.map((e=>e.dims.at(0))));g=(0,r.full)([d,e,m,p],!0);const t=g.data,s=e*m*p;for(let o=0;o<d;++o){const a=n[o].dims[0];if(a<e){n[o]=(0,r.cat)([n[o],(0,r.full)([e-a,_,m,p],0)],0);const i=o*s+a*m*p,l=(o+1)*s;t.fill(!1,i,l)}}h=(0,r.stack)(n,0)}return{pixel_values:h,pixel_attention_mask:g,original_sizes:l,reshaped_input_sizes:c,...s?{rows:a,cols:i}:{}}}async split_image(e,{longest_edge:t}){const s=t,o=t,n=[],[a,i]=e.dims.slice(-2);let l=0,c=0;if(a>s||i>o){l=Math.ceil(a/s),c=Math.ceil(i/o);const t=Math.ceil(a/l),d=Math.ceil(i/c);for(let s=0;s<l;++s)for(let o=0;o<c;++o){let u,_,m,p;s===l-1?(_=a-t,p=a):(_=s*t,p=(s+1)*t),o===c-1?(u=i-d,m=i):(u=o*d,m=(o+1)*d);const h=[_,u],g=[p,m],f=await(0,r.slice)(e,h,g,[2,3]);n.push(f)}const u=s,_=o;a===u&&i===_||(e=await(0,r.interpolate_4d)(e,{size:[u,_]}))}return n.push(e),{frames:n,num_splits_h:l,num_splits_w:c}}}},"./src/models/idefics3/processing_idefics3.js":(e,t,s)=>{s.r(t),s.d(t,{Idefics3Processor:()=>l});var o=s("./src/base/processing_utils.js"),r=s("./src/models/auto/image_processing_auto.js"),n=s("./src/tokenizers.js"),a=(s("./src/utils/image.js"),s("./src/utils/core.js"));function i(e,t,s,o,r,n){return 0===e&&0===t?function(e,t,s,o){return`${t}${o}`+s.repeat(e)+`${t}`}(s,o,r,n):function(e,t,s,o,r,n){let a="";for(let n=0;n<t;++n){for(let t=0;t<s;++t)a+=o+`<row_${n+1}_col_${t+1}>`+r.repeat(e);a+="\n"}return a+=`\n${o}${n}`+r.repeat(e)+`${o}`,a}(s,e,t,o,r,n)}class l extends o.Processor{static image_processor_class=r.AutoImageProcessor;static tokenizer_class=n.AutoTokenizer;static uses_processor_config=!0;fake_image_token="<fake_token_around_image>";image_token="<image>";global_img_token="<global-img>";async _call(e,t=null,s={}){let o;s.return_row_col_info??=!0,t&&(o=await this.image_processor(t,s)),Array.isArray(e)||(e=[e]);const r=o.rows??[new Array(e.length).fill(0)],n=o.cols??[new Array(e.length).fill(0)],l=this.config.image_seq_len,c=[],d=[];for(let t=0;t<e.length;++t){const s=e[t],o=r[t],u=n[t];c.push((0,a.count)(s,this.image_token));const _=o.map(((e,t)=>i(e,u[t],l,this.fake_image_token,this.image_token,this.global_img_token))),m=s.split(this.image_token);if(0===m.length)throw new Error("The image token should be present in the text.");let p=m[0];for(let e=0;e<_.length;++e)p+=_[e]+m[e+1];d.push(p)}return{...this.tokenizer(d),...o}}}},"./src/models/image_processors.js":(e,t,s)=>{s.r(t),s.d(t,{BeitFeatureExtractor:()=>o.BeitFeatureExtractor,BitImageProcessor:()=>r.BitImageProcessor,CLIPFeatureExtractor:()=>a.CLIPFeatureExtractor,CLIPImageProcessor:()=>a.CLIPImageProcessor,ChineseCLIPFeatureExtractor:()=>n.ChineseCLIPFeatureExtractor,ConvNextFeatureExtractor:()=>i.ConvNextFeatureExtractor,ConvNextImageProcessor:()=>i.ConvNextImageProcessor,DPTFeatureExtractor:()=>u.DPTFeatureExtractor,DPTImageProcessor:()=>u.DPTImageProcessor,DeiTFeatureExtractor:()=>l.DeiTFeatureExtractor,DeiTImageProcessor:()=>l.DeiTImageProcessor,DetrFeatureExtractor:()=>c.DetrFeatureExtractor,DetrImageProcessor:()=>c.DetrImageProcessor,DonutFeatureExtractor:()=>d.DonutFeatureExtractor,DonutImageProcessor:()=>d.DonutImageProcessor,EfficientNetImageProcessor:()=>_.EfficientNetImageProcessor,GLPNFeatureExtractor:()=>m.GLPNFeatureExtractor,GroundingDinoImageProcessor:()=>p.GroundingDinoImageProcessor,Idefics3ImageProcessor:()=>h.Idefics3ImageProcessor,JinaCLIPImageProcessor:()=>f.JinaCLIPImageProcessor,LlavaOnevisionImageProcessor:()=>M.LlavaOnevisionImageProcessor,Mask2FormerImageProcessor:()=>w.Mask2FormerImageProcessor,MaskFormerFeatureExtractor:()=>T.MaskFormerFeatureExtractor,MaskFormerImageProcessor:()=>T.MaskFormerImageProcessor,MobileNetV1FeatureExtractor:()=>b.MobileNetV1FeatureExtractor,MobileNetV1ImageProcessor:()=>b.MobileNetV1ImageProcessor,MobileNetV2FeatureExtractor:()=>x.MobileNetV2FeatureExtractor,MobileNetV2ImageProcessor:()=>x.MobileNetV2ImageProcessor,MobileNetV3FeatureExtractor:()=>P.MobileNetV3FeatureExtractor,MobileNetV3ImageProcessor:()=>P.MobileNetV3ImageProcessor,MobileNetV4FeatureExtractor:()=>k.MobileNetV4FeatureExtractor,MobileNetV4ImageProcessor:()=>k.MobileNetV4ImageProcessor,MobileViTFeatureExtractor:()=>F.MobileViTFeatureExtractor,MobileViTImageProcessor:()=>F.MobileViTImageProcessor,NougatImageProcessor:()=>y.NougatImageProcessor,OwlViTFeatureExtractor:()=>C.OwlViTFeatureExtractor,OwlViTImageProcessor:()=>C.OwlViTImageProcessor,Owlv2ImageProcessor:()=>v.Owlv2ImageProcessor,Phi3VImageProcessor:()=>S.Phi3VImageProcessor,PvtImageProcessor:()=>A.PvtImageProcessor,Qwen2VLImageProcessor:()=>E.Qwen2VLImageProcessor,RTDetrImageProcessor:()=>L.RTDetrImageProcessor,SamImageProcessor:()=>I.SamImageProcessor,SegformerFeatureExtractor:()=>z.SegformerFeatureExtractor,SegformerImageProcessor:()=>z.SegformerImageProcessor,SiglipImageProcessor:()=>V.SiglipImageProcessor,SmolVLMImageProcessor:()=>j.SmolVLMImageProcessor,Swin2SRImageProcessor:()=>D.Swin2SRImageProcessor,VLMImageProcessor:()=>g.VLMImageProcessor,ViTFeatureExtractor:()=>N.ViTFeatureExtractor,ViTImageProcessor:()=>N.ViTImageProcessor,VitMatteImageProcessor:()=>O.VitMatteImageProcessor,VitPoseImageProcessor:()=>B.VitPoseImageProcessor,YolosFeatureExtractor:()=>G.YolosFeatureExtractor,YolosImageProcessor:()=>G.YolosImageProcessor});var o=s("./src/models/beit/image_processing_beit.js"),r=s("./src/models/bit/image_processing_bit.js"),n=s("./src/models/chinese_clip/image_processing_chinese_clip.js"),a=s("./src/models/clip/image_processing_clip.js"),i=s("./src/models/convnext/image_processing_convnext.js"),l=s("./src/models/deit/image_processing_deit.js"),c=s("./src/models/detr/image_processing_detr.js"),d=s("./src/models/donut/image_processing_donut.js"),u=s("./src/models/dpt/image_processing_dpt.js"),_=s("./src/models/efficientnet/image_processing_efficientnet.js"),m=s("./src/models/glpn/image_processing_glpn.js"),p=s("./src/models/grounding_dino/image_processing_grounding_dino.js"),h=s("./src/models/idefics3/image_processing_idefics3.js"),g=s("./src/models/janus/image_processing_janus.js"),f=s("./src/models/jina_clip/image_processing_jina_clip.js"),M=s("./src/models/llava_onevision/image_processing_llava_onevision.js"),w=s("./src/models/mask2former/image_processing_mask2former.js"),T=s("./src/models/maskformer/image_processing_maskformer.js"),b=s("./src/models/mobilenet_v1/image_processing_mobilenet_v1.js"),x=s("./src/models/mobilenet_v2/image_processing_mobilenet_v2.js"),P=s("./src/models/mobilenet_v3/image_processing_mobilenet_v3.js"),k=s("./src/models/mobilenet_v4/image_processing_mobilenet_v4.js"),F=s("./src/models/mobilevit/image_processing_mobilevit.js"),y=s("./src/models/nougat/image_processing_nougat.js"),v=s("./src/models/owlv2/image_processing_owlv2.js"),C=s("./src/models/owlvit/image_processing_owlvit.js"),S=s("./src/models/phi3_v/image_processing_phi3_v.js"),A=s("./src/models/pvt/image_processing_pvt.js"),E=s("./src/models/qwen2_vl/image_processing_qwen2_vl.js"),L=s("./src/models/rt_detr/image_processing_rt_detr.js"),I=s("./src/models/sam/image_processing_sam.js"),z=s("./src/models/segformer/image_processing_segformer.js"),V=s("./src/models/siglip/image_processing_siglip.js"),j=s("./src/models/smolvlm/image_processing_smolvlm.js"),D=s("./src/models/swin2sr/image_processing_swin2sr.js"),N=s("./src/models/vit/image_processing_vit.js"),O=s("./src/models/vitmatte/image_processing_vitmatte.js"),B=s("./src/models/vitpose/image_processing_vitpose.js"),G=s("./src/models/yolos/image_processing_yolos.js")},"./src/models/janus/image_processing_janus.js":(e,t,s)=>{s.r(t),s.d(t,{VLMImageProcessor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{constructor(e){super({do_pad:!0,pad_size:{width:e.image_size,height:e.image_size},...e}),this.constant_values=this.config.background_color.map((e=>e*this.rescale_factor))}pad_image(e,t,s,o){return super.pad_image(e,t,s,{constant_values:this.constant_values,center:!0,...o})}}},"./src/models/janus/processing_janus.js":(e,t,s)=>{s.r(t),s.d(t,{VLChatProcessor:()=>c});var o=s("./src/base/processing_utils.js"),r=s("./src/models/auto/image_processing_auto.js"),n=s("./src/tokenizers.js"),a=s("./src/utils/core.js"),i=s("./src/utils/tensor.js"),l=s("./src/utils/image.js");class c extends o.Processor{static image_processor_class=r.AutoImageProcessor;static tokenizer_class=n.AutoTokenizer;static uses_processor_config=!0;constructor(e,t){super(e,t),this.image_tag=this.config.image_tag,this.image_start_tag=this.config.image_start_tag,this.image_end_tag=this.config.image_end_tag,this.num_image_tokens=this.config.num_image_tokens}async _call(e,{images:t=null,chat_template:s="default"}={}){t?Array.isArray(t)||(t=[t]):t=await Promise.all(e.filter((e=>e.images)).flatMap((e=>e.images)).map((e=>l.RawImage.read(e))));const o=this.tokenizer,r=e=>o.encode(e,{add_special_tokens:!1}),n=o.apply_chat_template(e,{tokenize:!1,add_generation_prompt:!0,chat_template:s}).split(this.image_tag),c=n.length-1;if(t.length!==c)throw new Error(`Number of images provided (${t.length}) does not match number of "${this.image_tag}" image tags (${c})`);const[d,u,_]=o.model.convert_tokens_to_ids([this.image_tag,this.image_start_tag,this.image_end_tag]);let m=r(n[0]),p=new Array(m.length).fill(!1);for(let e=1;e<n.length;++e){const t=new Array(this.num_image_tokens).fill(d),s=r(n[e]);m=(0,a.mergeArrays)(m,[u],t,[_],s);const o=new Array(this.num_image_tokens).fill(!0);p=(0,a.mergeArrays)(p,[!1],o,[!1],new Array(s.length).fill(!1))}const h=[1,m.length],g={input_ids:new i.Tensor("int64",m,h),attention_mask:new i.Tensor("int64",new Array(m.length).fill(1),h),images_seq_mask:new i.Tensor("bool",p,h),images_emb_mask:new i.Tensor("bool",new Array(c*this.num_image_tokens).fill(!0),[1,c,this.num_image_tokens])};if(t&&t.length>0){const e=await this.image_processor(t);return e.pixel_values.unsqueeze_(0),{...g,...e}}return g}}},"./src/models/jina_clip/image_processing_jina_clip.js":(e,t,s)=>{s.r(t),s.d(t,{JinaCLIPImageProcessor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{constructor(e){const{resize_mode:t,fill_color:s,interpolation:o,size:r,...n}=e;super({...n,size:"squash"===t?{width:r,height:r}:"shortest"===t?{shortest_edge:r}:{longest_edge:r},resample:"bicubic"===o?3:2,do_center_crop:!0,crop_size:r,do_normalize:!0})}}},"./src/models/jina_clip/processing_jina_clip.js":(e,t,s)=>{s.r(t),s.d(t,{JinaCLIPProcessor:()=>a});var o=s("./src/base/processing_utils.js"),r=s("./src/models/auto/image_processing_auto.js"),n=s("./src/tokenizers.js");class a extends o.Processor{static tokenizer_class=n.AutoTokenizer;static image_processor_class=r.AutoImageProcessor;async _call(e=null,t=null,s={}){if(!e&&!t)throw new Error("Either text or images must be provided");return{...e?this.tokenizer(e,s):{},...t?await this.image_processor(t,s):{}}}}},"./src/models/llava_onevision/image_processing_llava_onevision.js":(e,t,s)=>{s.r(t),s.d(t,{LlavaOnevisionImageProcessor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{}},"./src/models/mask2former/image_processing_mask2former.js":(e,t,s)=>{s.r(t),s.d(t,{Mask2FormerImageProcessor:()=>r});var o=s("./src/models/maskformer/image_processing_maskformer.js");class r extends o.MaskFormerImageProcessor{}},"./src/models/maskformer/image_processing_maskformer.js":(e,t,s)=>{s.r(t),s.d(t,{MaskFormerFeatureExtractor:()=>n,MaskFormerImageProcessor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{post_process_panoptic_segmentation(...e){return(0,o.post_process_panoptic_segmentation)(...e)}post_process_instance_segmentation(...e){return(0,o.post_process_instance_segmentation)(...e)}}class n extends r{}},"./src/models/mgp_str/processing_mgp_str.js":(e,t,s)=>{s.r(t),s.d(t,{MgpstrProcessor:()=>l});var o=s("./src/base/processing_utils.js"),r=s("./src/models/auto/image_processing_auto.js"),n=s("./src/tokenizers.js"),a=s("./src/utils/maths.js");const i={char:["char_decode",1],bpe:["bpe_decode",2],wp:["wp_decode",102]};class l extends o.Processor{static tokenizer_class=n.AutoTokenizer;static image_processor_class=r.AutoImageProcessor;get char_tokenizer(){return this.components.char_tokenizer}get bpe_tokenizer(){return this.components.bpe_tokenizer}get wp_tokenizer(){return this.components.wp_tokenizer}_decode_helper(e,t){if(!i.hasOwnProperty(t))throw new Error(`Format ${t} is not supported.`);const[s,o]=i[t],r=this[s].bind(this),[n,l]=e.dims,c=[],d=[],u=e.tolist();for(let e=0;e<n;++e){const t=u[e],s=[],r=[];for(let e=1;e<l;++e){const[n,i]=(0,a.max)((0,a.softmax)(t[e]));if(r.push(n),i==o)break;s.push(i)}const n=r.length>0?r.reduce(((e,t)=>e*t),1):0;d.push(s),c.push(n)}return[r(d),c]}char_decode(e){return this.char_tokenizer.batch_decode(e).map((e=>e.replaceAll(" ","")))}bpe_decode(e){return this.bpe_tokenizer.batch_decode(e)}wp_decode(e){return this.wp_tokenizer.batch_decode(e).map((e=>e.replaceAll(" ","")))}batch_decode([e,t,s]){const[o,r]=this._decode_helper(e,"char"),[n,i]=this._decode_helper(t,"bpe"),[l,c]=this._decode_helper(s,"wp"),d=[],u=[];for(let e=0;e<o.length;++e){const[t,s]=(0,a.max)([r[e],i[e],c[e]]);d.push([o[e],n[e],l[e]][s]),u.push(t)}return{generated_text:d,scores:u,char_preds:o,bpe_preds:n,wp_preds:l}}static async from_pretrained(...e){const t=await super.from_pretrained(...e),s=await n.AutoTokenizer.from_pretrained("Xenova/gpt2"),o=await n.AutoTokenizer.from_pretrained("Xenova/bert-base-uncased");return t.components={image_processor:t.image_processor,char_tokenizer:t.tokenizer,bpe_tokenizer:s,wp_tokenizer:o},t}async _call(e,t=null){const s=await this.image_processor(e);return t&&(s.labels=this.tokenizer(t).input_ids),s}}},"./src/models/mobilenet_v1/image_processing_mobilenet_v1.js":(e,t,s)=>{s.r(t),s.d(t,{MobileNetV1FeatureExtractor:()=>n,MobileNetV1ImageProcessor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{}class n extends r{}},"./src/models/mobilenet_v2/image_processing_mobilenet_v2.js":(e,t,s)=>{s.r(t),s.d(t,{MobileNetV2FeatureExtractor:()=>n,MobileNetV2ImageProcessor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{}class n extends r{}},"./src/models/mobilenet_v3/image_processing_mobilenet_v3.js":(e,t,s)=>{s.r(t),s.d(t,{MobileNetV3FeatureExtractor:()=>n,MobileNetV3ImageProcessor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{}class n extends r{}},"./src/models/mobilenet_v4/image_processing_mobilenet_v4.js":(e,t,s)=>{s.r(t),s.d(t,{MobileNetV4FeatureExtractor:()=>n,MobileNetV4ImageProcessor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{}class n extends r{}},"./src/models/mobilevit/image_processing_mobilevit.js":(e,t,s)=>{s.r(t),s.d(t,{MobileViTFeatureExtractor:()=>n,MobileViTImageProcessor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{}class n extends r{}},"./src/models/moonshine/feature_extraction_moonshine.js":(e,t,s)=>{s.r(t),s.d(t,{MoonshineFeatureExtractor:()=>n});var o=s("./src/base/feature_extraction_utils.js"),r=s("./src/utils/tensor.js");class n extends o.FeatureExtractor{async _call(e){(0,o.validate_audio_inputs)(e,"MoonshineFeatureExtractor"),e instanceof Float64Array&&(e=new Float32Array(e));const t=[1,e.length];return{input_values:new r.Tensor("float32",e,t)}}}},"./src/models/moonshine/processing_moonshine.js":(e,t,s)=>{s.r(t),s.d(t,{MoonshineProcessor:()=>a});var o=s("./src/models/auto/feature_extraction_auto.js"),r=s("./src/tokenizers.js"),n=s("./src/base/processing_utils.js");class a extends n.Processor{static tokenizer_class=r.AutoTokenizer;static feature_extractor_class=o.AutoFeatureExtractor;async _call(e){return await this.feature_extractor(e)}}},"./src/models/nougat/image_processing_nougat.js":(e,t,s)=>{s.r(t),s.d(t,{NougatImageProcessor:()=>r});var o=s("./src/models/donut/image_processing_donut.js");class r extends o.DonutImageProcessor{}},"./src/models/owlv2/image_processing_owlv2.js":(e,t,s)=>{s.r(t),s.d(t,{Owlv2ImageProcessor:()=>r});var o=s("./src/models/owlvit/image_processing_owlvit.js");class r extends o.OwlViTImageProcessor{}},"./src/models/owlvit/image_processing_owlvit.js":(e,t,s)=>{s.r(t),s.d(t,{OwlViTFeatureExtractor:()=>n,OwlViTImageProcessor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{post_process_object_detection(...e){return(0,o.post_process_object_detection)(...e)}}class n extends r{}},"./src/models/owlvit/processing_owlvit.js":(e,t,s)=>{s.r(t),s.d(t,{OwlViTProcessor:()=>a});var o=s("./src/base/processing_utils.js"),r=s("./src/models/auto/image_processing_auto.js"),n=s("./src/tokenizers.js");class a extends o.Processor{static tokenizer_class=n.AutoTokenizer;static image_processor_class=r.AutoImageProcessor}},"./src/models/paligemma/processing_paligemma.js":(e,t,s)=>{s.r(t),s.d(t,{PaliGemmaProcessor:()=>i});var o=s("./src/base/processing_utils.js"),r=s("./src/models/auto/image_processing_auto.js"),n=s("./src/tokenizers.js");const a="<image>";class i extends o.Processor{static tokenizer_class=n.AutoTokenizer;static image_processor_class=r.AutoImageProcessor;static uses_processor_config=!1;async _call(e,t=null,s={}){t||(console.warn("You are using PaliGemma without a text prefix. It will perform as a picture-captioning model."),t=""),Array.isArray(e)||(e=[e]),Array.isArray(t)||(t=[t]);const o=this.tokenizer.bos_token,r=this.image_processor.config.image_seq_length;let n;t.some((e=>e.includes(a)))?n=t.map((e=>{const t=e.replaceAll(a,a.repeat(r)),s=t.lastIndexOf(a),n=-1===s?0:s+7;return t.slice(0,n)+o+t.slice(n)+"\n"})):(console.warn("You are passing both `text` and `images` to `PaliGemmaProcessor`. The processor expects special image tokens in the text, as many tokens as there are images per each text. It is recommended to add `<image>` tokens in the very beginning of your text. For this call, we will infer how many images each text has and add special tokens."),n=t.map((t=>function(e,t,s,o,r){return`${o.repeat(s*r)}${t}${e}\n`}(t,o,r,a,e.length))));const i=this.tokenizer(n,s);return{...await this.image_processor(e,s),...i}}}},"./src/models/phi3_v/image_processing_phi3_v.js":(e,t,s)=>{s.r(t),s.d(t,{Phi3VImageProcessor:()=>d});var o=s("./src/base/image_processors_utils.js"),r=s("./src/utils/tensor.js");const n=336,a=[2,3],{ceil:i,floor:l,sqrt:c}=Math;class d extends o.ImageProcessor{constructor(e){super({...e,do_normalize:!0,do_pad:!0,pad_size:"custom",do_convert_rgb:!0,do_resize:!0}),this._num_crops=e.num_crops}calc_num_image_tokens_from_image_size(e,t){const{num_img_tokens:s}=this.config;return l((l(t/n)*l(e/n)+1)*s+1+(l(t/n)+1)*c(s))}get_resize_output_image_size(e,t){const s=this._num_crops,[o,r]=e.size;let n=o/r,a=1;for(;a*Math.ceil(a/n)<=s;)a+=1;a-=1;const i=Math.floor(336*a);return[i,Math.floor(i/n)]}pad_image(e,t,s,o={}){const[r,a]=t,l=n*i(r/n),c=n*i(a/n),d=[1,1,1].map(((e,t)=>(e-this.image_mean[t])/this.image_std[t]));return super.pad_image(e,t,{width:c,height:l},{center:!0,constant_values:d,...o})}async _call(e,{num_crops:t=null}={}){if(this._num_crops=t??=this.config.num_crops,t<4||c(t)%1!=0)throw new Error("num_crops must be a square number >= 4");Array.isArray(e)||(e=[e]);const s=e.length,o=await Promise.all(e.map((e=>this.preprocess(e)))),d=o.map((e=>e.original_size)),u=o.map((e=>e.reshaped_input_size)),_=[];for(const{pixel_values:e}of o){e.unsqueeze_(0);const[s,o]=e.dims.slice(-2),i=await(0,r.interpolate_4d)(e,{size:[n,n],mode:"bicubic"});if(t>0){const d=[],u=c(t),m=l(o/u),p=l(s/u);for(let t=0;t<u;++t)for(let n=0;n<u;++n){let i,l,c,_;t===u-1?(l=s-p,_=s):(l=t*p,_=(t+1)*p),n===u-1?(i=o-m,c=o):(i=n*m,c=(n+1)*m);const h=[l,i],g=[_,c],f=await(0,r.slice)(e,h,g,a);d.push(f)}const h=await(0,r.interpolate_4d)((0,r.cat)(d,0),{size:[n,n],mode:"bicubic"});_.push((0,r.cat)([i,h],0))}else _.push(i)}const m=(0,r.stack)(_,0),p=u.map((e=>e.map((e=>n*i(e/n)))));return{pixel_values:m,original_sizes:d,reshaped_input_sizes:u,image_sizes:new r.Tensor("int64",p.flat(),[s,2]),num_img_tokens:p.map((([e,t])=>this.calc_num_image_tokens_from_image_size(t,e)))}}}},"./src/models/phi3_v/processing_phi3_v.js":(e,t,s)=>{s.r(t),s.d(t,{Phi3VProcessor:()=>l});var o=s("./src/base/processing_utils.js"),r=s("./src/models/auto/image_processing_auto.js"),n=s("./src/tokenizers.js");s("./src/utils/image.js");const a="<|image|>",i=/<\|image_\d+\|>/g;class l extends o.Processor{static image_processor_class=r.AutoImageProcessor;static tokenizer_class=n.AutoTokenizer;async _call(e,t=null,{padding:s=!0,truncation:o=!0,num_crops:r=null}={}){let n,l;if(Array.isArray(e)||(e=[e]),t){l=await this.image_processor(t,{num_crops:r});const{num_img_tokens:c}=l,d=e.map(((e,t)=>e.split(i).join(a.repeat(c[t]))));n=this.tokenizer(d,{padding:s,truncation:o});const u=this.tokenizer.model.convert_tokens_to_ids([a])[0];n.input_ids.map_((e=>e==u?-e:e))}else n=this.tokenizer(e);return{...n,...l}}}},"./src/models/processors.js":(e,t,s)=>{s.r(t),s.d(t,{Florence2Processor:()=>o.Florence2Processor,GroundingDinoProcessor:()=>r.GroundingDinoProcessor,Idefics3Processor:()=>n.Idefics3Processor,JinaCLIPProcessor:()=>i.JinaCLIPProcessor,MgpstrProcessor:()=>l.MgpstrProcessor,MoonshineProcessor:()=>c.MoonshineProcessor,OwlViTProcessor:()=>d.OwlViTProcessor,PaliGemmaProcessor:()=>_.PaliGemmaProcessor,Phi3VProcessor:()=>u.Phi3VProcessor,PyAnnoteProcessor:()=>m.PyAnnoteProcessor,Qwen2VLProcessor:()=>p.Qwen2VLProcessor,SamProcessor:()=>h.SamProcessor,SmolVLMProcessor:()=>g.SmolVLMProcessor,SpeechT5Processor:()=>f.SpeechT5Processor,UltravoxProcessor:()=>M.UltravoxProcessor,VLChatProcessor:()=>a.VLChatProcessor,Wav2Vec2Processor:()=>w.Wav2Vec2Processor,Wav2Vec2ProcessorWithLM:()=>T.Wav2Vec2ProcessorWithLM,WhisperProcessor:()=>b.WhisperProcessor});var o=s("./src/models/florence2/processing_florence2.js"),r=s("./src/models/grounding_dino/processing_grounding_dino.js"),n=s("./src/models/idefics3/processing_idefics3.js"),a=s("./src/models/janus/processing_janus.js"),i=s("./src/models/jina_clip/processing_jina_clip.js"),l=s("./src/models/mgp_str/processing_mgp_str.js"),c=s("./src/models/moonshine/processing_moonshine.js"),d=s("./src/models/owlvit/processing_owlvit.js"),u=s("./src/models/phi3_v/processing_phi3_v.js"),_=s("./src/models/paligemma/processing_paligemma.js"),m=s("./src/models/pyannote/processing_pyannote.js"),p=s("./src/models/qwen2_vl/processing_qwen2_vl.js"),h=s("./src/models/sam/processing_sam.js"),g=s("./src/models/smolvlm/processing_smolvlm.js"),f=s("./src/models/speecht5/processing_speecht5.js"),M=s("./src/models/ultravox/processing_ultravox.js"),w=s("./src/models/wav2vec2/processing_wav2vec2.js"),T=s("./src/models/wav2vec2_with_lm/processing_wav2vec2_with_lm.js"),b=s("./src/models/whisper/processing_whisper.js")},"./src/models/pvt/image_processing_pvt.js":(e,t,s)=>{s.r(t),s.d(t,{PvtImageProcessor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{}},"./src/models/pyannote/feature_extraction_pyannote.js":(e,t,s)=>{s.r(t),s.d(t,{PyAnnoteFeatureExtractor:()=>a});var o=s("./src/base/feature_extraction_utils.js"),r=s("./src/utils/tensor.js"),n=s("./src/utils/maths.js");class a extends o.FeatureExtractor{async _call(e){(0,o.validate_audio_inputs)(e,"PyAnnoteFeatureExtractor"),e instanceof Float64Array&&(e=new Float32Array(e));const t=[1,1,e.length];return{input_values:new r.Tensor("float32",e,t)}}samples_to_frames(e){return(e-this.config.offset)/this.config.step}post_process_speaker_diarization(e,t){const s=t/this.samples_to_frames(t)/this.config.sampling_rate,o=[];for(const t of e.tolist()){const e=[];let r=-1;for(let s=0;s<t.length;++s){const o=(0,n.softmax)(t[s]),[a,i]=(0,n.max)(o),[l,c]=[s,s+1];i!==r?(r=i,e.push({id:i,start:l,end:c,score:a})):(e.at(-1).end=c,e.at(-1).score+=a)}o.push(e.map((({id:e,start:t,end:o,score:r})=>({id:e,start:t*s,end:o*s,confidence:r/(o-t)}))))}return o}}},"./src/models/pyannote/processing_pyannote.js":(e,t,s)=>{s.r(t),s.d(t,{PyAnnoteProcessor:()=>n});var o=s("./src/base/processing_utils.js"),r=s("./src/models/pyannote/feature_extraction_pyannote.js");class n extends o.Processor{static feature_extractor_class=r.PyAnnoteFeatureExtractor;async _call(e){return await this.feature_extractor(e)}post_process_speaker_diarization(...e){return this.feature_extractor.post_process_speaker_diarization(...e)}get sampling_rate(){return this.feature_extractor.config.sampling_rate}}},"./src/models/qwen2_vl/image_processing_qwen2_vl.js":(e,t,s)=>{s.r(t),s.d(t,{Qwen2VLImageProcessor:()=>n});var o=s("./src/base/image_processors_utils.js"),r=s("./src/utils/tensor.js");class n extends o.ImageProcessor{async _call(e,...t){const{pixel_values:s,original_sizes:o,reshaped_input_sizes:n}=await super._call(e,...t);let a=s;const{temporal_patch_size:i,merge_size:l,patch_size:c}=this.config;1===a.dims[0]&&(a=(0,r.cat)(Array.from({length:i},(()=>a)),0));const d=a.dims[0]/i,u=a.dims[1],_=Math.floor(a.dims[2]/c),m=Math.floor(a.dims[3]/c);return{pixel_values:a.view(d,i,u,Math.floor(_/l),l,c,Math.floor(m/l),l,c).permute(0,3,6,4,7,2,1,5,8).view(d*_*m,u*i*c*c),image_grid_thw:new r.Tensor("int64",[d,_,m],[1,3]),original_sizes:o,reshaped_input_sizes:n}}}},"./src/models/qwen2_vl/processing_qwen2_vl.js":(e,t,s)=>{s.r(t),s.d(t,{Qwen2VLProcessor:()=>a});var o=s("./src/base/processing_utils.js"),r=s("./src/models/auto/image_processing_auto.js"),n=s("./src/tokenizers.js");s("./src/utils/image.js");class a extends o.Processor{static image_processor_class=r.AutoImageProcessor;static tokenizer_class=n.AutoTokenizer;async _call(e,t=null,...s){let o,r;if(Array.isArray(e)||(e=[e]),t&&(o=await this.image_processor(t),r=o.image_grid_thw),r){let t=this.image_processor.config.merge_size**2,s=0;const o=r.tolist();e=e.map((e=>{for(;e.includes("<|image_pad|>");){const r=Number(o[s++].reduce(((e,t)=>e*t),1n));e=e.replace("<|image_pad|>","<|placeholder|>".repeat(Math.floor(r/t)))}return e.replaceAll("<|placeholder|>","<|image_pad|>")}))}return{...this.tokenizer(e),...o}}}},"./src/models/rt_detr/image_processing_rt_detr.js":(e,t,s)=>{s.r(t),s.d(t,{RTDetrImageProcessor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{post_process_object_detection(...e){return(0,o.post_process_object_detection)(...e)}}},"./src/models/sam/image_processing_sam.js":(e,t,s)=>{s.r(t),s.d(t,{SamImageProcessor:()=>a});var o=s("./src/base/image_processors_utils.js"),r=s("./src/utils/core.js"),n=s("./src/utils/tensor.js");class a extends o.ImageProcessor{reshape_input_points(e,t,s,o=!1){e=structuredClone(e);let a=(0,r.calculateDimensions)(e);if(3===a.length)o||(a=[1,...a]),e=[e];else if(4!==a.length)throw Error("The input_points must be a 4D tensor of shape `batch_size`, `point_batch_size`, `nb_points_per_image`, `2`.");for(let o=0;o<e.length;++o){let r=t[o],n=s[o],a=[n[0]/r[0],n[1]/r[1]];for(let t=0;t<e[o].length;++t)for(let s=0;s<e[o][t].length;++s)for(let r=0;r<e[o][t][s].length;++r)e[o][t][s][r]*=a[r%2]}return new n.Tensor("float32",Float32Array.from(e.flat(1/0)),a)}add_input_labels(e,t){let s=(0,r.calculateDimensions)(e);if(2===s.length)s=[1,...s],e=[e];else if(3!==s.length)throw Error("The input_points must be a 4D tensor of shape `batch_size`, `point_batch_size`, `nb_points_per_image`, `2`.");if(s.some(((e,s)=>e!==t.dims[s])))throw Error(`The first ${s.length} dimensions of 'input_points' and 'input_labels' must be the same.`);return new n.Tensor("int64",e.flat(1/0).map(BigInt),s)}async _call(e,{input_points:t=null,input_labels:s=null,input_boxes:o=null}={}){const r=await super._call(e);if(t&&(r.input_points=this.reshape_input_points(t,r.original_sizes,r.reshaped_input_sizes)),s){if(!r.input_points)throw Error("`input_points` must be provided if `input_labels` are provided.");r.input_labels=this.add_input_labels(s,r.input_points)}return o&&(r.input_boxes=this.reshape_input_points(o,r.original_sizes,r.reshaped_input_sizes,!0)),r}async post_process_masks(e,t,s,{mask_threshold:o=0,binarize:r=!0,pad_size:a=null}={}){const i=[],l=[(a=a??this.pad_size).height,a.width];for(let a=0;a<t.length;++a){const c=t[a],d=s[a];let u=await(0,n.interpolate_4d)(e[a],{mode:"bilinear",size:l});if(u=u.slice(null,null,[0,d[0]],[0,d[1]]),u=await(0,n.interpolate_4d)(u,{mode:"bilinear",size:c}),r){const e=u.data,t=new Uint8Array(e.length);for(let s=0;s<e.length;++s)e[s]>o&&(t[s]=1);u=new n.Tensor("bool",t,u.dims)}i.push(u)}return i}generate_crop_boxes(e,t,{crop_n_layers:s=0,overlap_ratio:o=512/1500,points_per_crop:r=32,crop_n_points_downscale_factor:n=1}={}){}}},"./src/models/sam/processing_sam.js":(e,t,s)=>{s.r(t),s.d(t,{SamProcessor:()=>n});var o=s("./src/base/processing_utils.js"),r=s("./src/models/auto/image_processing_auto.js");class n extends o.Processor{static image_processor_class=r.AutoImageProcessor;async _call(...e){return await this.image_processor(...e)}post_process_masks(...e){return this.image_processor.post_process_masks(...e)}reshape_input_points(...e){return this.image_processor.reshape_input_points(...e)}}},"./src/models/seamless_m4t/feature_extraction_seamless_m4t.js":(e,t,s)=>{s.r(t),s.d(t,{SeamlessM4TFeatureExtractor:()=>a});var o=s("./src/base/feature_extraction_utils.js"),r=s("./src/utils/tensor.js"),n=s("./src/utils/audio.js");class a extends o.FeatureExtractor{constructor(e){super(e);const t=this.config.sampling_rate,s=(0,n.mel_filter_bank)(256,this.config.num_mel_bins,20,Math.floor(t/2),t,null,"kaldi",!0);for(let e=0;e<s.length;++e)s[e].push(0);this.mel_filters=s,this.window=(0,n.window_function)(400,"povey",{periodic:!1})}async _extract_fbank_features(e,t){return e=e.map((e=>32768*e)),(0,n.spectrogram)(e,this.window,400,160,{fft_length:512,power:2,center:!1,preemphasis:.97,mel_filters:this.mel_filters,log_mel:"log",mel_floor:1.192092955078125e-7,remove_dc_offset:!0,max_num_frames:t,transpose:!0})}async _call(e,{padding:t=!0,pad_to_multiple_of:s=2,do_normalize_per_mel_bins:n=!0,return_attention_mask:a=!0}={}){(0,o.validate_audio_inputs)(e,"SeamlessM4TFeatureExtractor");let i,l=await this._extract_fbank_features(e,this.config.max_length);if(n){const[e,t]=l.dims,s=l.data;for(let o=0;o<t;++o){let r=0;for(let n=0;n<e;++n)r+=s[n*t+o];const n=r/e;let a=0;for(let r=0;r<e;++r)a+=(s[r*t+o]-n)**2;a/=e-1;const i=Math.sqrt(a+1e-7);for(let r=0;r<e;++r){const e=r*t+o;s[e]=(s[e]-n)/i}}}if(t){const[e,t]=l.dims,o=l.data,n=e%s;if(n>0){const s=new Float32Array(t*(e+n));s.set(o),s.fill(this.config.padding_value,o.length);const c=e+n;l=new r.Tensor(l.type,s,[c,t]),a&&(i=new r.Tensor("int64",new BigInt64Array(c),[1,c]),i.data.fill(1n,0,e))}}const[c,d]=l.dims,u=this.config.stride;if(0!==c%u)throw new Error(`The number of frames (${c}) must be a multiple of the stride (${u}).`);const _=l.view(1,Math.floor(c/u),d*u),m={input_features:_};if(a){const e=_.dims[1],t=new BigInt64Array(e);if(i){const e=i.data;for(let s=1,o=0;s<c;s+=u,++o)t[o]=e[s]}else t.fill(1n);m.attention_mask=new r.Tensor("int64",t,[1,e])}return m}}},"./src/models/segformer/image_processing_segformer.js":(e,t,s)=>{s.r(t),s.d(t,{SegformerFeatureExtractor:()=>n,SegformerImageProcessor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{post_process_semantic_segmentation(...e){return(0,o.post_process_semantic_segmentation)(...e)}}class n extends r{}},"./src/models/siglip/image_processing_siglip.js":(e,t,s)=>{s.r(t),s.d(t,{SiglipImageProcessor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{}},"./src/models/smolvlm/image_processing_smolvlm.js":(e,t,s)=>{s.r(t),s.d(t,{SmolVLMImageProcessor:()=>o.Idefics3ImageProcessor});var o=s("./src/models/idefics3/image_processing_idefics3.js")},"./src/models/smolvlm/processing_smolvlm.js":(e,t,s)=>{s.r(t),s.d(t,{SmolVLMProcessor:()=>o.Idefics3Processor});var o=s("./src/models/idefics3/processing_idefics3.js")},"./src/models/snac/feature_extraction_snac.js":(e,t,s)=>{s.r(t),s.d(t,{SnacFeatureExtractor:()=>r});var o=s("./src/models/dac/feature_extraction_dac.js");class r extends o.DacFeatureExtractor{}},"./src/models/speecht5/feature_extraction_speecht5.js":(e,t,s)=>{s.r(t),s.d(t,{SpeechT5FeatureExtractor:()=>r});var o=s("./src/base/feature_extraction_utils.js");class r extends o.FeatureExtractor{}},"./src/models/speecht5/processing_speecht5.js":(e,t,s)=>{s.r(t),s.d(t,{SpeechT5Processor:()=>a});var o=s("./src/base/processing_utils.js"),r=s("./src/tokenizers.js"),n=s("./src/models/auto/feature_extraction_auto.js");class a extends o.Processor{static tokenizer_class=r.AutoTokenizer;static feature_extractor_class=n.AutoFeatureExtractor;async _call(e){return await this.feature_extractor(e)}}},"./src/models/swin2sr/image_processing_swin2sr.js":(e,t,s)=>{s.r(t),s.d(t,{Swin2SRImageProcessor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{pad_image(e,t,s,o={}){const[r,n,a]=t;return super.pad_image(e,t,{width:n+(s-n%s)%s,height:r+(s-r%s)%s},{mode:"symmetric",center:!1,constant_values:-1,...o})}}},"./src/models/ultravox/processing_ultravox.js":(e,t,s)=>{s.r(t),s.d(t,{UltravoxProcessor:()=>a});var o=s("./src/models/auto/feature_extraction_auto.js"),r=s("./src/tokenizers.js"),n=s("./src/base/processing_utils.js");class a extends n.Processor{static tokenizer_class=r.AutoTokenizer;static feature_extractor_class=o.AutoFeatureExtractor;static uses_processor_config=!0;async _call(e,t=null,s={}){if(Array.isArray(e))throw new Error("Batched inputs are not supported yet.");let o={};if(t){const r=t.length,{input_features:n}=await this.feature_extractor(t,{...s,max_length:r}),a=Math.round(r/this.config.encoder_ds_factor+1e-4),i=1+Math.ceil(a/this.config.stack_factor);o.audio_token_len=[i],o.audio_values=n;const l=this.config.audio_placeholder;if(!e.includes(l))throw new Error(`The input text does not contain the image token ${l}.`);e=e.replaceAll(l,l.repeat(i))}return{...this.tokenizer(e,{add_special_tokens:!1,...s}),...o}}}},"./src/models/vit/image_processing_vit.js":(e,t,s)=>{s.r(t),s.d(t,{ViTFeatureExtractor:()=>n,ViTImageProcessor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{}class n extends r{}},"./src/models/vitmatte/image_processing_vitmatte.js":(e,t,s)=>{s.r(t),s.d(t,{VitMatteImageProcessor:()=>n});var o=s("./src/base/image_processors_utils.js"),r=s("./src/utils/tensor.js");class n extends o.ImageProcessor{async _call(e,t){Array.isArray(e)||(e=[e]),Array.isArray(t)||(t=[t]);const s=await Promise.all(e.map((e=>this.preprocess(e)))),o=await Promise.all(t.map((e=>this.preprocess(e,{do_normalize:!1,do_convert_rgb:!1,do_convert_grayscale:!0}))));return{pixel_values:(0,r.stack)(s.map(((e,t)=>(0,r.cat)([e.pixel_values,o[t].pixel_values],0))),0),original_sizes:s.map((e=>e.original_size)),reshaped_input_sizes:s.map((e=>e.reshaped_input_size))}}}},"./src/models/vitpose/image_processing_vitpose.js":(e,t,s)=>{s.r(t),s.d(t,{VitPoseImageProcessor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{post_process_pose_estimation(e,t,{threshold:s=null}={}){const o=e.tolist(),[r,n,a,i]=e.dims,l=[];for(let e=0;e<r;++e){const r=o[e],n=t[e],c=[];for(let e=0;e<n.length;++e){const t=n[e],o=[],l=[],d=[],u=t.at(-2)/i,_=t.at(-1)/a;for(let e=0;e<r.length;++e){let[t,n]=[0,0],a=0,i=-1/0;const c=r[e];for(let e=0;e<c.length;++e){const s=c[e];for(let o=0;o<s.length;++o){const r=s[o];a+=r,i=Math.max(i,r),t+=(o+.5)*r,n+=e*r}}if(null!=s&&i<s)continue;const m=[u*t/a,_*n/a];o.push(m),d.push(e),l.push(i)}c.push({bbox:t,scores:l,labels:d,keypoints:o})}l.push(c)}return l}}},"./src/models/wav2vec2/feature_extraction_wav2vec2.js":(e,t,s)=>{s.r(t),s.d(t,{Wav2Vec2FeatureExtractor:()=>n});var o=s("./src/base/feature_extraction_utils.js"),r=s("./src/utils/tensor.js");class n extends o.FeatureExtractor{_zero_mean_unit_var_norm(e){const t=e.reduce(((e,t)=>e+t),0)/e.length,s=e.reduce(((e,s)=>e+(s-t)**2),0)/e.length;return e.map((e=>(e-t)/Math.sqrt(s+1e-7)))}async _call(e){(0,o.validate_audio_inputs)(e,"Wav2Vec2FeatureExtractor"),e instanceof Float64Array&&(e=new Float32Array(e));let t=e;this.config.do_normalize&&(t=this._zero_mean_unit_var_norm(t));const s=[1,t.length];return{input_values:new r.Tensor("float32",t,s),attention_mask:new r.Tensor("int64",new BigInt64Array(t.length).fill(1n),s)}}}},"./src/models/wav2vec2/processing_wav2vec2.js":(e,t,s)=>{s.r(t),s.d(t,{Wav2Vec2Processor:()=>a});var o=s("./src/tokenizers.js"),r=s("./src/models/auto/feature_extraction_auto.js"),n=s("./src/base/processing_utils.js");class a extends n.Processor{static tokenizer_class=o.AutoTokenizer;static feature_extractor_class=r.AutoFeatureExtractor;async _call(e){return await this.feature_extractor(e)}}},"./src/models/wav2vec2_with_lm/processing_wav2vec2_with_lm.js":(e,t,s)=>{s.r(t),s.d(t,{Wav2Vec2ProcessorWithLM:()=>a});var o=s("./src/tokenizers.js"),r=s("./src/models/auto/feature_extraction_auto.js"),n=s("./src/base/processing_utils.js");class a extends n.Processor{static tokenizer_class=o.AutoTokenizer;static feature_extractor_class=r.AutoFeatureExtractor;async _call(e){return await this.feature_extractor(e)}}},"./src/models/wespeaker/feature_extraction_wespeaker.js":(e,t,s)=>{s.r(t),s.d(t,{WeSpeakerFeatureExtractor:()=>n});var o=s("./src/base/feature_extraction_utils.js"),r=(s("./src/utils/tensor.js"),s("./src/utils/audio.js"));class n extends o.FeatureExtractor{constructor(e){super(e);const t=this.config.sampling_rate,s=(0,r.mel_filter_bank)(256,this.config.num_mel_bins,20,Math.floor(t/2),t,null,"kaldi",!0);for(let e=0;e<s.length;++e)s[e].push(0);this.mel_filters=s,this.window=(0,r.window_function)(400,"hamming",{periodic:!1}),this.min_num_frames=this.config.min_num_frames}async _extract_fbank_features(e){return e=e.map((e=>32768*e)),(0,r.spectrogram)(e,this.window,400,160,{fft_length:512,power:2,center:!1,preemphasis:.97,mel_filters:this.mel_filters,log_mel:"log",mel_floor:1.192092955078125e-7,remove_dc_offset:!0,transpose:!0,min_num_frames:this.min_num_frames})}async _call(e){(0,o.validate_audio_inputs)(e,"WeSpeakerFeatureExtractor");const t=(await this._extract_fbank_features(e)).unsqueeze_(0);if(null===this.config.fbank_centering_span){const e=t.mean(1).data,s=t.data,[o,r,n]=t.dims;for(let t=0;t<o;++t){const o=t*r*n,a=t*n;for(let t=0;t<r;++t){const r=o+t*n;for(let t=0;t<n;++t)s[r+t]-=e[a+t]}}}return{input_features:t}}}},"./src/models/whisper/common_whisper.js":(e,t,s)=>{s.r(t),s.d(t,{WHISPER_LANGUAGE_MAPPING:()=>r,WHISPER_TO_LANGUAGE_CODE_MAPPING:()=>n,whisper_language_to_code:()=>a});const o=[["en","english"],["zh","chinese"],["de","german"],["es","spanish"],["ru","russian"],["ko","korean"],["fr","french"],["ja","japanese"],["pt","portuguese"],["tr","turkish"],["pl","polish"],["ca","catalan"],["nl","dutch"],["ar","arabic"],["sv","swedish"],["it","italian"],["id","indonesian"],["hi","hindi"],["fi","finnish"],["vi","vietnamese"],["he","hebrew"],["uk","ukrainian"],["el","greek"],["ms","malay"],["cs","czech"],["ro","romanian"],["da","danish"],["hu","hungarian"],["ta","tamil"],["no","norwegian"],["th","thai"],["ur","urdu"],["hr","croatian"],["bg","bulgarian"],["lt","lithuanian"],["la","latin"],["mi","maori"],["ml","malayalam"],["cy","welsh"],["sk","slovak"],["te","telugu"],["fa","persian"],["lv","latvian"],["bn","bengali"],["sr","serbian"],["az","azerbaijani"],["sl","slovenian"],["kn","kannada"],["et","estonian"],["mk","macedonian"],["br","breton"],["eu","basque"],["is","icelandic"],["hy","armenian"],["ne","nepali"],["mn","mongolian"],["bs","bosnian"],["kk","kazakh"],["sq","albanian"],["sw","swahili"],["gl","galician"],["mr","marathi"],["pa","punjabi"],["si","sinhala"],["km","khmer"],["sn","shona"],["yo","yoruba"],["so","somali"],["af","afrikaans"],["oc","occitan"],["ka","georgian"],["be","belarusian"],["tg","tajik"],["sd","sindhi"],["gu","gujarati"],["am","amharic"],["yi","yiddish"],["lo","lao"],["uz","uzbek"],["fo","faroese"],["ht","haitian creole"],["ps","pashto"],["tk","turkmen"],["nn","nynorsk"],["mt","maltese"],["sa","sanskrit"],["lb","luxembourgish"],["my","myanmar"],["bo","tibetan"],["tl","tagalog"],["mg","malagasy"],["as","assamese"],["tt","tatar"],["haw","hawaiian"],["ln","lingala"],["ha","hausa"],["ba","bashkir"],["jw","javanese"],["su","sundanese"]],r=new Map(o),n=new Map([...o.map((([e,t])=>[t,e])),["burmese","my"],["valencian","ca"],["flemish","nl"],["haitian","ht"],["letzeburgesch","lb"],["pushto","ps"],["panjabi","pa"],["moldavian","ro"],["moldovan","ro"],["sinhalese","si"],["castilian","es"]]);function a(e){e=e.toLowerCase();let t=n.get(e);if(void 0===t){const s=e.match(/^<\|([a-z]{2})\|>$/);if(s&&(e=s[1]),!r.has(e)){const t=2===e.length?r.keys():r.values();throw new Error(`Language "${e}" is not supported. Must be one of: ${JSON.stringify(Array.from(t))}`)}t=e}return t}},"./src/models/whisper/feature_extraction_whisper.js":(e,t,s)=>{s.r(t),s.d(t,{WhisperFeatureExtractor:()=>a});var o=s("./src/base/feature_extraction_utils.js"),r=(s("./src/utils/tensor.js"),s("./src/utils/audio.js")),n=s("./src/utils/maths.js");class a extends o.FeatureExtractor{constructor(e){super(e),this.config.mel_filters??=(0,r.mel_filter_bank)(Math.floor(1+this.config.n_fft/2),this.config.feature_size,0,8e3,this.config.sampling_rate,"slaney","slaney"),this.window=(0,r.window_function)(this.config.n_fft,"hann")}async _extract_fbank_features(e){const t=await(0,r.spectrogram)(e,this.window,this.config.n_fft,this.config.hop_length,{power:2,mel_filters:this.config.mel_filters,log_mel:"log10",max_num_frames:Math.min(Math.floor(e.length/this.config.hop_length),this.config.nb_max_frames)}),s=t.data,o=(0,n.max)(s)[0];for(let e=0;e<s.length;++e)s[e]=(Math.max(s[e],o-8)+4)/4;return t}async _call(e,{max_length:t=null}={}){let s;(0,o.validate_audio_inputs)(e,"WhisperFeatureExtractor");const r=t??this.config.n_samples;e.length>r?(e.length>this.config.n_samples&&console.warn("Attempting to extract features for audio longer than 30 seconds. If using a pipeline to extract transcript from a long audio clip, remember to specify `chunk_length_s` and/or `stride_length_s`."),s=e.slice(0,r)):(s=new Float32Array(r),s.set(e));return{input_features:(await this._extract_fbank_features(s)).unsqueeze_(0)}}}},"./src/models/whisper/generation_whisper.js":(e,t,s)=>{s.r(t),s.d(t,{WhisperGenerationConfig:()=>r});var o=s("./src/generation/configuration_utils.js");class r extends o.GenerationConfig{return_timestamps=null;return_token_timestamps=null;num_frames=null;alignment_heads=null;task=null;language=null;no_timestamps_token_id=null;prompt_ids=null;is_multilingual=null;lang_to_id=null;task_to_id=null;max_initial_timestamp_index=1}},"./src/models/whisper/processing_whisper.js":(e,t,s)=>{s.r(t),s.d(t,{WhisperProcessor:()=>a});var o=s("./src/models/auto/feature_extraction_auto.js"),r=s("./src/tokenizers.js"),n=s("./src/base/processing_utils.js");class a extends n.Processor{static tokenizer_class=r.AutoTokenizer;static feature_extractor_class=o.AutoFeatureExtractor;async _call(e){return await this.feature_extractor(e)}}},"./src/models/yolos/image_processing_yolos.js":(e,t,s)=>{s.r(t),s.d(t,{YolosFeatureExtractor:()=>n,YolosImageProcessor:()=>r});var o=s("./src/base/image_processors_utils.js");class r extends o.ImageProcessor{post_process_object_detection(...e){return(0,o.post_process_object_detection)(...e)}}class n extends r{}},"./src/ops/registry.js":(e,t,s)=>{s.r(t),s.d(t,{TensorOpRegistry:()=>l});var o=s("./src/backends/onnx.js"),r=s("./src/utils/tensor.js"),n=s("./src/env.js");const a=n.apis.IS_BROWSER_ENV||n.apis.IS_WEBWORKER_ENV,i=async(e,t,s)=>{const n=await(0,o.createInferenceSession)(new Uint8Array(e),t);let i=Promise.resolve();return async e=>{const t=(0,o.isONNXProxy)(),l=Object.fromEntries(Object.entries(e).map((([e,s])=>[e,(t?s.clone():s).ort_tensor]))),c=await(i=a?i.then((()=>n.run(l))):n.run(l));return Array.isArray(s)?s.map((e=>new r.Tensor(c[e]))):new r.Tensor(c[s])}};class l{static session_options={};static get nearest_interpolate_4d(){return this._nearest_interpolate_4d||(this._nearest_interpolate_4d=i([8,10,18,0,58,129,1,10,41,10,1,120,10,0,10,0,10,1,115,18,1,121,34,6,82,101,115,105,122,101,42,18,10,4,109,111,100,101,34,7,110,101,97,114,101,115,116,160,1,3,18,1,114,90,31,10,1,120,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,90,15,10,1,115,18,10,10,8,8,7,18,4,10,2,8,4,98,31,10,1,121,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,66,2,16,21],this.session_options,"y")),this._nearest_interpolate_4d}static get bilinear_interpolate_4d(){return this._bilinear_interpolate_4d||(this._bilinear_interpolate_4d=i([8,9,18,0,58,128,1,10,40,10,1,120,10,0,10,0,10,1,115,18,1,121,34,6,82,101,115,105,122,101,42,17,10,4,109,111,100,101,34,6,108,105,110,101,97,114,160,1,3,18,1,114,90,31,10,1,120,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,90,15,10,1,115,18,10,10,8,8,7,18,4,10,2,8,4,98,31,10,1,121,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,66,2,16,20],this.session_options,"y")),this._bilinear_interpolate_4d}static get bicubic_interpolate_4d(){return this._bicubic_interpolate_4d||(this._bicubic_interpolate_4d=i([8,9,18,0,58,127,10,39,10,1,120,10,0,10,0,10,1,115,18,1,121,34,6,82,101,115,105,122,101,42,16,10,4,109,111,100,101,34,5,99,117,98,105,99,160,1,3,18,1,114,90,31,10,1,120,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,90,15,10,1,115,18,10,10,8,8,7,18,4,10,2,8,4,98,31,10,1,121,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,66,2,16,20],this.session_options,"y")),this._bicubic_interpolate_4d}static get matmul(){return this._matmul||(this._matmul=i([8,9,18,0,58,55,10,17,10,1,97,10,1,98,18,1,99,34,6,77,97,116,77,117,108,18,1,114,90,9,10,1,97,18,4,10,2,8,1,90,9,10,1,98,18,4,10,2,8,1,98,9,10,1,99,18,4,10,2,8,1,66,2,16,20],this.session_options,"c")),this._matmul}static get stft(){return this._stft||(this._stft=i([8,7,18,0,58,148,1,10,38,10,1,115,10,1,106,10,1,119,10,1,108,18,1,111,34,4,83,84,70,84,42,15,10,8,111,110,101,115,105,100,101,100,24,1,160,1,2,18,1,115,90,26,10,1,115,18,21,10,19,8,1,18,15,10,3,18,1,98,10,3,18,1,115,10,3,18,1,99,90,11,10,1,106,18,6,10,4,8,7,18,0,90,16,10,1,119,18,11,10,9,8,1,18,5,10,3,18,1,119,90,11,10,1,108,18,6,10,4,8,7,18,0,98,31,10,1,111,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,102,10,3,18,1,100,10,3,18,1,99,66,2,16,17],this.session_options,"o")),this._stft}static get rfft(){return this._rfft||(this._rfft=i([8,9,18,0,58,97,10,33,10,1,120,10,0,10,1,97,18,1,121,34,3,68,70,84,42,15,10,8,111,110,101,115,105,100,101,100,24,1,160,1,2,18,1,100,90,21,10,1,120,18,16,10,14,8,1,18,10,10,3,18,1,115,10,3,18,1,99,90,11,10,1,97,18,6,10,4,8,7,18,0,98,21,10,1,121,18,16,10,14,8,1,18,10,10,3,18,1,115,10,3,18,1,99,66,2,16,20],this.session_options,"y")),this._rfft}static get top_k(){return this._top_k||(this._top_k=i([8,10,18,0,58,73,10,18,10,1,120,10,1,107,18,1,118,18,1,105,34,4,84,111,112,75,18,1,116,90,9,10,1,120,18,4,10,2,8,1,90,15,10,1,107,18,10,10,8,8,7,18,4,10,2,8,1,98,9,10,1,118,18,4,10,2,8,1,98,9,10,1,105,18,4,10,2,8,7,66,2,16,21],this.session_options,["v","i"])),this._top_k}static get slice(){return this._slice||(this._slice=i([8,7,18,0,58,96,10,25,10,1,120,10,1,115,10,1,101,10,1,97,10,1,116,18,1,121,34,5,83,108,105,99,101,18,1,114,90,9,10,1,120,18,4,10,2,8,1,90,9,10,1,115,18,4,10,2,8,7,90,9,10,1,101,18,4,10,2,8,7,90,9,10,1,97,18,4,10,2,8,7,90,9,10,1,116,18,4,10,2,8,7,98,9,10,1,121,18,4,10,2,8,1,66,2,16,13],this.session_options,"y")),this._slice}}},"./src/pipelines.js":(e,t,s)=>{s.r(t),s.d(t,{AudioClassificationPipeline:()=>C,AutomaticSpeechRecognitionPipeline:()=>A,BackgroundRemovalPipeline:()=>z,DepthEstimationPipeline:()=>G,DocumentQuestionAnsweringPipeline:()=>N,FeatureExtractionPipeline:()=>y,FillMaskPipeline:()=>w,ImageClassificationPipeline:()=>L,ImageFeatureExtractionPipeline:()=>v,ImageSegmentationPipeline:()=>I,ImageToImagePipeline:()=>B,ImageToTextPipeline:()=>E,ObjectDetectionPipeline:()=>j,Pipeline:()=>h,QuestionAnsweringPipeline:()=>M,SummarizationPipeline:()=>b,Text2TextGenerationPipeline:()=>T,TextClassificationPipeline:()=>g,TextGenerationPipeline:()=>k,TextToAudioPipeline:()=>O,TokenClassificationPipeline:()=>f,TranslationPipeline:()=>x,ZeroShotAudioClassificationPipeline:()=>S,ZeroShotClassificationPipeline:()=>F,ZeroShotImageClassificationPipeline:()=>V,ZeroShotObjectDetectionPipeline:()=>D,pipeline:()=>W});var o=s("./src/tokenizers.js"),r=s("./src/models.js"),n=s("./src/models/auto/processing_auto.js"),a=(s("./src/base/processing_utils.js"),s("./src/utils/generic.js")),i=s("./src/utils/core.js"),l=s("./src/utils/maths.js"),c=s("./src/utils/audio.js"),d=s("./src/utils/tensor.js"),u=s("./src/utils/image.js");async function _(e){return Array.isArray(e)||(e=[e]),await Promise.all(e.map((e=>u.RawImage.read(e))))}async function m(e,t){return Array.isArray(e)||(e=[e]),await Promise.all(e.map((e=>"string"==typeof e||e instanceof URL?(0,c.read_audio)(e,t):e instanceof Float64Array?new Float32Array(e):e)))}function p(e,t){t&&(e=e.map((e=>0|e)));const[s,o,r,n]=e;return{xmin:s,ymin:o,xmax:r,ymax:n}}class h extends a.Callable{constructor({task:e,model:t,tokenizer:s=null,processor:o=null}){super(),this.task=e,this.model=t,this.tokenizer=s,this.processor=o}async dispose(){await this.model.dispose()}}class g extends h{constructor(e){super(e)}async _call(e,{top_k:t=1}={}){const s=this.tokenizer(e,{padding:!0,truncation:!0}),o=await this.model(s),r="multi_label_classification"===this.model.config.problem_type?e=>e.sigmoid():e=>new d.Tensor("float32",(0,l.softmax)(e.data),e.dims),n=this.model.config.id2label,a=[];for(const e of o.logits){const s=r(e),o=await(0,d.topk)(s,t),i=o[0].tolist(),l=o[1].tolist().map(((e,t)=>({label:n?n[e]:`LABEL_${e}`,score:i[t]})));1===t?a.push(...l):a.push(l)}return Array.isArray(e)||1===t?a:a[0]}}class f extends h{constructor(e){super(e)}async _call(e,{ignore_labels:t=["O"]}={}){const s=Array.isArray(e),o=this.tokenizer(s?e:[e],{padding:!0,truncation:!0}),r=(await this.model(o)).logits,n=this.model.config.id2label,a=[];for(let e=0;e<r.dims[0];++e){const s=o.input_ids[e],i=r[e],c=[];for(let e=0;e<i.dims[0];++e){const o=i[e],r=(0,l.max)(o.data)[1],a=n?n[r]:`LABEL_${r}`;if(t.includes(a))continue;const d=this.tokenizer.decode([s[e].item()],{skip_special_tokens:!0});if(""===d)continue;const u=(0,l.softmax)(o.data);c.push({entity:a,score:u[r],index:e,word:d})}a.push(c)}return s?a:a[0]}}class M extends h{constructor(e){super(e)}async _call(e,t,{top_k:s=1}={}){const o=this.tokenizer(e,{text_pair:t,padding:!0,truncation:!0}),{start_logits:r,end_logits:n}=await this.model(o),a=o.input_ids.tolist(),c=o.attention_mask.tolist(),d=this.tokenizer.all_special_ids,u=[];for(let e=0;e<r.dims[0];++e){const t=a[e],o=t.findIndex((e=>e==this.tokenizer.sep_token_id)),_=(c[e].map(((e,s)=>1==e&&(0===s||s>o&&-1===d.findIndex((e=>e==t[s]))))),r[e].tolist()),m=n[e].tolist();for(let s=1;s<_.length;++s)(0==c[e]||s<=o||-1!==d.findIndex((e=>e==t[s])))&&(_[s]=-1/0,m[s]=-1/0);const p=(0,l.softmax)(_).map(((e,t)=>[e,t])),h=(0,l.softmax)(m).map(((e,t)=>[e,t]));p[0][0]=0,h[0][0]=0;const g=(0,i.product)(p,h).filter((e=>e[0][1]<=e[1][1])).map((e=>[e[0][1],e[1][1],e[0][0]*e[1][0]])).sort(((e,t)=>t[2]-e[2]));for(let e=0;e<Math.min(g.length,s);++e){const[s,o,r]=g[e],n=t.slice(s,o+1),a=this.tokenizer.decode(n,{skip_special_tokens:!0});u.push({answer:a,score:r})}}return 1===s?u[0]:u}}class w extends h{constructor(e){super(e)}async _call(e,{top_k:t=5}={}){const s=this.tokenizer(e,{padding:!0,truncation:!0}),{logits:o}=await this.model(s),r=[],n=s.input_ids.tolist();for(let e=0;e<n.length;++e){const s=n[e],a=s.findIndex((e=>e==this.tokenizer.mask_token_id));if(-1===a)throw Error(`Mask token (${this.tokenizer.mask_token}) not found in text.`);const i=o[e][a],c=await(0,d.topk)(new d.Tensor("float32",(0,l.softmax)(i.data),i.dims),t),u=c[0].tolist(),_=c[1].tolist();r.push(_.map(((e,t)=>{const o=s.slice();return o[a]=e,{score:u[t],token:Number(e),token_str:this.tokenizer.decode([e]),sequence:this.tokenizer.decode(o,{skip_special_tokens:!0})}})))}return Array.isArray(e)?r:r[0]}}class T extends h{_key="generated_text";constructor(e){super(e)}async _call(e,t={}){Array.isArray(e)||(e=[e]),this.model.config.prefix&&(e=e.map((e=>this.model.config.prefix+e)));const s=this.model.config.task_specific_params;s&&s[this.task]&&s[this.task].prefix&&(e=e.map((e=>s[this.task].prefix+e)));const o=this.tokenizer,r={padding:!0,truncation:!0};let n;n=this instanceof x&&"_build_translation_inputs"in o?o._build_translation_inputs(e,r,t):o(e,r);const a=await this.model.generate({...n,...t});return o.batch_decode(a,{skip_special_tokens:!0}).map((e=>({[this._key]:e})))}}class b extends T{_key="summary_text";constructor(e){super(e)}}class x extends T{_key="translation_text";constructor(e){super(e)}}function P(e){return Array.isArray(e)&&e.every((e=>"role"in e&&"content"in e))}class k extends h{constructor(e){super(e)}async _call(e,t={}){let s,o=!1,r=!1;if("string"==typeof e)s=e=[e];else if(Array.isArray(e)&&e.every((e=>"string"==typeof e)))o=!0,s=e;else{if(P(e))e=[e];else{if(!Array.isArray(e)||!e.every(P))throw new Error("Input must be a string, an array of strings, a Chat, or an array of Chats");o=!0}r=!0,s=e.map((e=>this.tokenizer.apply_chat_template(e,{tokenize:!1,add_generation_prompt:!0})))}const n=t.add_special_tokens??!1,a=!r&&(t.return_full_text??!0);this.tokenizer.padding_side="left";const i=this.tokenizer(s,{add_special_tokens:n,padding:!0,truncation:!0}),l=await this.model.generate({...i,...t}),c=this.tokenizer.batch_decode(l,{skip_special_tokens:!0});let d;!a&&i.input_ids.dims.at(-1)>0&&(d=this.tokenizer.batch_decode(i.input_ids,{skip_special_tokens:!0}).map((e=>e.length)));const u=Array.from({length:e.length},(e=>[]));for(let t=0;t<c.length;++t){const s=Math.floor(t/l.dims[0]*e.length);d&&(c[t]=c[t].slice(d[s])),u[s].push({generated_text:r?[...e[s],{role:"assistant",content:c[t]}]:c[t]})}return o||1!==u.length?u:u[0]}}class F extends h{constructor(e){super(e),this.label2id=Object.fromEntries(Object.entries(this.model.config.label2id).map((([e,t])=>[e.toLowerCase(),t]))),this.entailment_id=this.label2id.entailment,void 0===this.entailment_id&&(console.warn("Could not find 'entailment' in label2id mapping. Using 2 as entailment_id."),this.entailment_id=2),this.contradiction_id=this.label2id.contradiction??this.label2id.not_entailment,void 0===this.contradiction_id&&(console.warn("Could not find 'contradiction' in label2id mapping. Using 0 as contradiction_id."),this.contradiction_id=0)}async _call(e,t,{hypothesis_template:s="This example is {}.",multi_label:o=!1}={}){const r=Array.isArray(e);r||(e=[e]),Array.isArray(t)||(t=[t]);const n=t.map((e=>s.replace("{}",e))),a=o||1===t.length,i=[];for(const s of e){const e=[];for(const t of n){const o=this.tokenizer(s,{text_pair:t,padding:!0,truncation:!0}),r=await this.model(o);a?e.push([r.logits.data[this.contradiction_id],r.logits.data[this.entailment_id]]):e.push(r.logits.data[this.entailment_id])}const o=(a?e.map((e=>(0,l.softmax)(e)[1])):(0,l.softmax)(e)).map(((e,t)=>[e,t])).sort(((e,t)=>t[0]-e[0]));i.push({sequence:s,labels:o.map((e=>t[e[1]])),scores:o.map((e=>e[0]))})}return r?i:i[0]}}class y extends h{constructor(e){super(e)}async _call(e,{pooling:t="none",normalize:s=!1,quantize:o=!1,precision:r="binary"}={}){const n=this.tokenizer(e,{padding:!0,truncation:!0}),a=await this.model(n);let i=a.last_hidden_state??a.logits??a.token_embeddings;if("none"===t);else if("mean"===t)i=(0,d.mean_pooling)(i,n.attention_mask);else{if("cls"!==t)throw Error(`Pooling method '${t}' not supported.`);i=i.slice(null,0)}return s&&(i=i.normalize(2,-1)),o&&(i=(0,d.quantize_embeddings)(i,r)),i}}class v extends h{constructor(e){super(e)}async _call(e,{pool:t=null}={}){const s=await _(e),{pixel_values:o}=await this.processor(s),r=await this.model({pixel_values:o});let n;if(t){if(!("pooler_output"in r))throw Error("No pooled output was returned. Make sure the model has a 'pooler' layer when using the 'pool' option.");n=r.pooler_output}else n=r.last_hidden_state??r.logits??r.image_embeds;return n}}class C extends h{constructor(e){super(e)}async _call(e,{top_k:t=5}={}){const s=this.processor.feature_extractor.config.sampling_rate,o=await m(e,s),r=this.model.config.id2label,n=[];for(const e of o){const s=await this.processor(e),o=(await this.model(s)).logits[0],a=await(0,d.topk)(new d.Tensor("float32",(0,l.softmax)(o.data),o.dims),t),i=a[0].tolist(),c=a[1].tolist().map(((e,t)=>({label:r?r[e]:`LABEL_${e}`,score:i[t]})));n.push(c)}return Array.isArray(e)?n:n[0]}}class S extends h{constructor(e){super(e)}async _call(e,t,{hypothesis_template:s="This is a sound of {}."}={}){const o=!Array.isArray(e);o&&(e=[e]);const r=t.map((e=>s.replace("{}",e))),n=this.tokenizer(r,{padding:!0,truncation:!0}),a=this.processor.feature_extractor.config.sampling_rate,i=await m(e,a),c=[];for(const e of i){const s=await this.processor(e),o=await this.model({...n,...s}),r=(0,l.softmax)(o.logits_per_audio.data);c.push([...r].map(((e,s)=>({score:e,label:t[s]}))))}return o?c[0]:c}}class A extends h{constructor(e){super(e)}async _call(e,t={}){switch(this.model.config.model_type){case"whisper":case"lite-whisper":return this._call_whisper(e,t);case"wav2vec2":case"wav2vec2-bert":case"unispeech":case"unispeech-sat":case"hubert":return this._call_wav2vec2(e,t);case"moonshine":return this._call_moonshine(e,t);default:throw new Error(`AutomaticSpeechRecognitionPipeline does not support model type '${this.model.config.model_type}'.`)}}async _call_wav2vec2(e,t){t.language&&console.warn('`language` parameter is not yet supported for `wav2vec2` models, defaulting to "English".'),t.task&&console.warn('`task` parameter is not yet supported for `wav2vec2` models, defaulting to "transcribe".');const s=!Array.isArray(e);s&&(e=[e]);const o=this.processor.feature_extractor.config.sampling_rate,r=await m(e,o),n=[];for(const e of r){const t=await this.processor(e),s=(await this.model(t)).logits[0],o=[];for(const e of s)o.push((0,l.max)(e.data)[1]);const r=this.tokenizer.decode(o);n.push({text:r})}return s?n[0]:n}async _call_whisper(e,t){const s=t.return_timestamps??!1,o=t.chunk_length_s??0,r=t.force_full_sequences??!1;let n=t.stride_length_s??null;const a={...t};"word"===s&&(a.return_token_timestamps=!0,a.return_timestamps=!1);const i=!Array.isArray(e);i&&(e=[e]);const c=this.processor.feature_extractor.config.chunk_length/this.model.config.max_source_positions,d=this.processor.feature_extractor.config.hop_length,u=this.processor.feature_extractor.config.sampling_rate,_=await m(e,u),p=[];for(const e of _){let t=[];if(o>0){if(null===n)n=o/6;else if(o<=n)throw Error("`chunk_length_s` must be larger than `stride_length_s`.");const s=u*o,r=u*n,a=s-2*r;let i=0;for(;;){const o=i+s,n=e.subarray(i,o),l=await this.processor(n),c=0===i,d=o>=e.length;if(t.push({stride:[n.length,c?0:r,d?0:r],input_features:l.input_features,is_last:d}),d)break;i+=a}}else t=[{stride:[e.length,0,0],input_features:(await this.processor(e)).input_features,is_last:!0}];for(const e of t){a.num_frames=Math.floor(e.stride[0]/d);const t=await this.model.generate({inputs:e.input_features,...a});"word"===s?(e.tokens=t.sequences.tolist()[0],e.token_timestamps=t.token_timestamps.tolist()[0].map((e=>(0,l.round)(e,2)))):e.tokens=t[0].tolist(),e.stride=e.stride.map((e=>e/u))}const[i,_]=this.tokenizer._decode_asr(t,{time_precision:c,return_timestamps:s,force_full_sequences:r});p.push({text:i,..._})}return i?p[0]:p}async _call_moonshine(e,t){const s=!Array.isArray(e);s&&(e=[e]);const o=this.processor.feature_extractor.config.sampling_rate,r=await m(e,o),n=[];for(const e of r){const s=await this.processor(e),r=6*Math.floor(e.length/o),a=await this.model.generate({max_new_tokens:r,...t,...s}),i=this.processor.batch_decode(a,{skip_special_tokens:!0})[0];n.push({text:i})}return s?n[0]:n}}class E extends h{constructor(e){super(e)}async _call(e,t={}){const s=Array.isArray(e),o=await _(e),{pixel_values:r}=await this.processor(o),n=[];for(const e of r){e.dims=[1,...e.dims];const s=await this.model.generate({inputs:e,...t}),o=this.tokenizer.batch_decode(s,{skip_special_tokens:!0}).map((e=>({generated_text:e.trim()})));n.push(o)}return s?n:n[0]}}class L extends h{constructor(e){super(e)}async _call(e,{top_k:t=5}={}){const s=await _(e),{pixel_values:o}=await this.processor(s),r=await this.model({pixel_values:o}),n=this.model.config.id2label,a=[];for(const e of r.logits){const s=await(0,d.topk)(new d.Tensor("float32",(0,l.softmax)(e.data),e.dims),t),o=s[0].tolist(),r=s[1].tolist().map(((e,t)=>({label:n?n[e]:`LABEL_${e}`,score:o[t]})));a.push(r)}return Array.isArray(e)?a:a[0]}}class I extends h{constructor(e){super(e),this.subtasks_mapping={panoptic:"post_process_panoptic_segmentation",instance:"post_process_instance_segmentation",semantic:"post_process_semantic_segmentation"}}async _call(e,{threshold:t=.5,mask_threshold:s=.5,overlap_mask_area_threshold:o=.8,label_ids_to_fuse:r=null,target_sizes:n=null,subtask:a=null}={}){if(Array.isArray(e)&&1!==e.length)throw Error("Image segmentation pipeline currently only supports a batch size of 1.");const i=await _(e),l=i.map((e=>[e.height,e.width])),c=await this.processor(i),{inputNames:d,outputNames:m}=this.model.sessions.model;if(!d.includes("pixel_values")){if(1!==d.length)throw Error(`Expected a single input name, but got ${d.length} inputs: ${d}.`);const e=d[0];if(e in c)throw Error(`Input name ${e} already exists in the inputs.`);c[e]=c.pixel_values}const p=await this.model(c);let h=null;if(null!==a)h=this.subtasks_mapping[a];else if(this.processor.image_processor)for(const[e,t]of Object.entries(this.subtasks_mapping))if(t in this.processor.image_processor){h=this.processor.image_processor[t].bind(this.processor.image_processor),a=e;break}const g=this.model.config.id2label,f=[];if(a)if("panoptic"===a||"instance"===a){const e=h(p,t,s,o,r,n??l)[0],a=e.segmentation;for(const t of e.segments_info){const e=new Uint8ClampedArray(a.data.length);for(let s=0;s<a.data.length;++s)a.data[s]===t.id&&(e[s]=255);const s=new u.RawImage(e,a.dims[1],a.dims[0],1);f.push({score:t.score,label:g[t.label_id],mask:s})}}else{if("semantic"!==a)throw Error(`Subtask ${a} not supported.`);{const{segmentation:e,labels:t}=h(p,n??l)[0];for(const s of t){const t=new Uint8ClampedArray(e.data.length);for(let o=0;o<e.data.length;++o)e.data[o]===s&&(t[o]=255);const o=new u.RawImage(t,e.dims[1],e.dims[0],1);f.push({score:null,label:g[s],mask:o})}}}else{const e=1e-5,t=p[m[0]];for(let s=0;s<l.length;++s){const o=l[s],r=t[s];r.data.some((t=>t<-e||t>1+e))&&r.sigmoid_();const n=await u.RawImage.fromTensor(r.mul_(255).to("uint8")).resize(o[1],o[0]);f.push({label:null,score:null,mask:n})}}return f}}class z extends I{constructor(e){super(e)}async _call(e,t={}){if(Array.isArray(e)&&1!==e.length)throw Error("Background removal pipeline currently only supports a batch size of 1.");const s=await _(e),o=await super._call(e,t);return s.map(((e,t)=>{const s=e.clone();return s.putAlpha(o[t].mask),s}))}}class V extends h{constructor(e){super(e)}async _call(e,t,{hypothesis_template:s="This is a photo of {}"}={}){const o=Array.isArray(e),r=await _(e),n=t.map((e=>s.replace("{}",e))),a=this.tokenizer(n,{padding:"siglip"!==this.model.config.model_type||"max_length",truncation:!0}),{pixel_values:i}=await this.processor(r),c=await this.model({...a,pixel_values:i}),d="siglip"===this.model.config.model_type?e=>e.sigmoid().data:e=>(0,l.softmax)(e.data),u=[];for(const e of c.logits_per_image){const s=[...d(e)].map(((e,s)=>({score:e,label:t[s]})));s.sort(((e,t)=>t.score-e.score)),u.push(s)}return o?u:u[0]}}class j extends h{constructor(e){super(e)}async _call(e,{threshold:t=.9,percentage:s=!1}={}){const o=Array.isArray(e);if(o&&1!==e.length)throw Error("Object detection pipeline currently only supports a batch size of 1.");const r=await _(e),n=s?null:r.map((e=>[e.height,e.width])),{pixel_values:a,pixel_mask:i}=await this.processor(r),l=await this.model({pixel_values:a,pixel_mask:i}),c=this.processor.image_processor.post_process_object_detection(l,t,n),d=this.model.config.id2label,u=c.map((e=>e.boxes.map(((t,o)=>({score:e.scores[o],label:d[e.classes[o]],box:p(t,!s)})))));return o?u:u[0]}}class D extends h{constructor(e){super(e)}async _call(e,t,{threshold:s=.1,top_k:o=null,percentage:r=!1}={}){const n=Array.isArray(e),a=await _(e),i=this.tokenizer(t,{padding:!0,truncation:!0}),l=await this.processor(a),c=[];for(let e=0;e<a.length;++e){const n=a[e],d=r?null:[[n.height,n.width]],u=l.pixel_values[e].unsqueeze_(0),_=await this.model({...i,pixel_values:u});let m;if("post_process_grounded_object_detection"in this.processor){const e=this.processor.post_process_grounded_object_detection(_,i.input_ids,{box_threshold:s,text_threshold:s,target_sizes:d})[0];m=e.boxes.map(((t,s)=>({score:e.scores[s],label:e.labels[s],box:p(t,!r)})))}else{const e=this.processor.image_processor.post_process_object_detection(_,s,d,!0)[0];m=e.boxes.map(((s,o)=>({score:e.scores[o],label:t[e.classes[o]],box:p(s,!r)})))}m.sort(((e,t)=>t.score-e.score)),null!==o&&(m=m.slice(0,o)),c.push(m)}return n?c:c[0]}}class N extends h{constructor(e){super(e)}async _call(e,t,s={}){const o=(await _(e))[0],{pixel_values:r}=await this.processor(o),n=`<s_docvqa><s_question>${t}</s_question><s_answer>`,a=this.tokenizer(n,{add_special_tokens:!1,padding:!0,truncation:!0}).input_ids,i=await this.model.generate({inputs:r,max_length:this.model.config.decoder.max_position_embeddings,decoder_input_ids:a,...s}),l=this.tokenizer.batch_decode(i)[0].match(/<s_answer>(.*?)<\/s_answer>/);let c=null;return l&&l.length>=2&&(c=l[1].trim()),[{answer:c}]}}class O extends h{DEFAULT_VOCODER_ID="Xenova/speecht5_hifigan";constructor(e){super(e),this.vocoder=e.vocoder??null}async _call(e,{speaker_embeddings:t=null}={}){return this.processor?this._call_text_to_spectrogram(e,{speaker_embeddings:t}):this._call_text_to_waveform(e)}async _call_text_to_waveform(e){const t=this.tokenizer(e,{padding:!0,truncation:!0}),{waveform:s}=await this.model(t),o=this.model.config.sampling_rate;return new c.RawAudio(s.data,o)}async _call_text_to_spectrogram(e,{speaker_embeddings:t}){if(this.vocoder||(console.log("No vocoder specified, using default HifiGan vocoder."),this.vocoder=await r.AutoModel.from_pretrained(this.DEFAULT_VOCODER_ID,{dtype:"fp32"})),("string"==typeof t||t instanceof URL)&&(t=new Float32Array(await(await fetch(t)).arrayBuffer())),t instanceof Float32Array)t=new d.Tensor("float32",t,[1,t.length]);else if(!(t instanceof d.Tensor))throw new Error("Speaker embeddings must be a `Tensor`, `Float32Array`, `string`, or `URL`.");const{input_ids:s}=this.tokenizer(e,{padding:!0,truncation:!0}),{waveform:o}=await this.model.generate_speech(s,t,{vocoder:this.vocoder}),n=this.processor.feature_extractor.config.sampling_rate;return new c.RawAudio(o.data,n)}}class B extends h{constructor(e){super(e)}async _call(e){const t=await _(e),s=await this.processor(t),o=await this.model(s),r=[];for(const e of o.reconstruction){const t=e.squeeze().clamp_(0,1).mul_(255).round_().to("uint8");r.push(u.RawImage.fromTensor(t))}return r.length>1?r:r[0]}}class G extends h{constructor(e){super(e)}async _call(e){const t=await _(e),s=await this.processor(t),{predicted_depth:o}=await this.model(s),r=[];for(let e=0;e<t.length;++e){const s=o[e],[n,a]=s.dims.slice(-2),[i,l]=t[e].size,c=(await(0,d.interpolate_4d)(s.view(1,1,n,a),{size:[l,i],mode:"bilinear"})).view(l,i),_=c.min().item(),m=c.max().item(),p=c.sub(_).div_(m-_).mul_(255).to("uint8").unsqueeze(0),h=u.RawImage.fromTensor(p);r.push({predicted_depth:c,depth:h})}return r.length>1?r:r[0]}}const R=Object.freeze({"text-classification":{tokenizer:o.AutoTokenizer,pipeline:g,model:r.AutoModelForSequenceClassification,default:{model:"Xenova/distilbert-base-uncased-finetuned-sst-2-english"},type:"text"},"token-classification":{tokenizer:o.AutoTokenizer,pipeline:f,model:r.AutoModelForTokenClassification,default:{model:"Xenova/bert-base-multilingual-cased-ner-hrl"},type:"text"},"question-answering":{tokenizer:o.AutoTokenizer,pipeline:M,model:r.AutoModelForQuestionAnswering,default:{model:"Xenova/distilbert-base-cased-distilled-squad"},type:"text"},"fill-mask":{tokenizer:o.AutoTokenizer,pipeline:w,model:r.AutoModelForMaskedLM,default:{model:"Xenova/bert-base-uncased"},type:"text"},summarization:{tokenizer:o.AutoTokenizer,pipeline:b,model:r.AutoModelForSeq2SeqLM,default:{model:"Xenova/distilbart-cnn-6-6"},type:"text"},translation:{tokenizer:o.AutoTokenizer,pipeline:x,model:r.AutoModelForSeq2SeqLM,default:{model:"Xenova/t5-small"},type:"text"},"text2text-generation":{tokenizer:o.AutoTokenizer,pipeline:T,model:r.AutoModelForSeq2SeqLM,default:{model:"Xenova/flan-t5-small"},type:"text"},"text-generation":{tokenizer:o.AutoTokenizer,pipeline:k,model:r.AutoModelForCausalLM,default:{model:"Xenova/gpt2"},type:"text"},"zero-shot-classification":{tokenizer:o.AutoTokenizer,pipeline:F,model:r.AutoModelForSequenceClassification,default:{model:"Xenova/distilbert-base-uncased-mnli"},type:"text"},"audio-classification":{pipeline:C,model:r.AutoModelForAudioClassification,processor:n.AutoProcessor,default:{model:"Xenova/wav2vec2-base-superb-ks"},type:"audio"},"zero-shot-audio-classification":{tokenizer:o.AutoTokenizer,pipeline:S,model:r.AutoModel,processor:n.AutoProcessor,default:{model:"Xenova/clap-htsat-unfused"},type:"multimodal"},"automatic-speech-recognition":{tokenizer:o.AutoTokenizer,pipeline:A,model:[r.AutoModelForSpeechSeq2Seq,r.AutoModelForCTC],processor:n.AutoProcessor,default:{model:"Xenova/whisper-tiny.en"},type:"multimodal"},"text-to-audio":{tokenizer:o.AutoTokenizer,pipeline:O,model:[r.AutoModelForTextToWaveform,r.AutoModelForTextToSpectrogram],processor:[n.AutoProcessor,null],default:{model:"Xenova/speecht5_tts"},type:"text"},"image-to-text":{tokenizer:o.AutoTokenizer,pipeline:E,model:r.AutoModelForVision2Seq,processor:n.AutoProcessor,default:{model:"Xenova/vit-gpt2-image-captioning"},type:"multimodal"},"image-classification":{pipeline:L,model:r.AutoModelForImageClassification,processor:n.AutoProcessor,default:{model:"Xenova/vit-base-patch16-224"},type:"multimodal"},"image-segmentation":{pipeline:I,model:[r.AutoModelForImageSegmentation,r.AutoModelForSemanticSegmentation,r.AutoModelForUniversalSegmentation],processor:n.AutoProcessor,default:{model:"Xenova/detr-resnet-50-panoptic"},type:"multimodal"},"background-removal":{pipeline:z,model:[r.AutoModelForImageSegmentation,r.AutoModelForSemanticSegmentation,r.AutoModelForUniversalSegmentation],processor:n.AutoProcessor,default:{model:"Xenova/modnet"},type:"image"},"zero-shot-image-classification":{tokenizer:o.AutoTokenizer,pipeline:V,model:r.AutoModel,processor:n.AutoProcessor,default:{model:"Xenova/clip-vit-base-patch32"},type:"multimodal"},"object-detection":{pipeline:j,model:r.AutoModelForObjectDetection,processor:n.AutoProcessor,default:{model:"Xenova/detr-resnet-50"},type:"multimodal"},"zero-shot-object-detection":{tokenizer:o.AutoTokenizer,pipeline:D,model:r.AutoModelForZeroShotObjectDetection,processor:n.AutoProcessor,default:{model:"Xenova/owlvit-base-patch32"},type:"multimodal"},"document-question-answering":{tokenizer:o.AutoTokenizer,pipeline:N,model:r.AutoModelForDocumentQuestionAnswering,processor:n.AutoProcessor,default:{model:"Xenova/donut-base-finetuned-docvqa"},type:"multimodal"},"image-to-image":{pipeline:B,model:r.AutoModelForImageToImage,processor:n.AutoProcessor,default:{model:"Xenova/swin2SR-classical-sr-x2-64"},type:"image"},"depth-estimation":{pipeline:G,model:r.AutoModelForDepthEstimation,processor:n.AutoProcessor,default:{model:"Xenova/dpt-large"},type:"image"},"feature-extraction":{tokenizer:o.AutoTokenizer,pipeline:y,model:r.AutoModel,default:{model:"Xenova/all-MiniLM-L6-v2"},type:"text"},"image-feature-extraction":{processor:n.AutoProcessor,pipeline:v,model:[r.AutoModelForImageFeatureExtraction,r.AutoModel],default:{model:"Xenova/vit-base-patch16-224-in21k"},type:"image"}}),q=Object.freeze({"sentiment-analysis":"text-classification",ner:"token-classification",asr:"automatic-speech-recognition","text-to-speech":"text-to-audio",embeddings:"feature-extraction"});async function W(e,t=null,{progress_callback:s=null,config:o=null,cache_dir:r=null,local_files_only:n=!1,revision:a="main",device:l=null,dtype:c=null,subfolder:d="onnx",use_external_data_format:u=null,model_file_name:_=null,session_options:m={}}={}){e=q[e]??e;const p=R[e.split("_",1)[0]];if(!p)throw Error(`Unsupported pipeline: ${e}. Must be one of [${Object.keys(R)}]`);t||(t=p.default.model,console.log(`No model specified. Using default model: "${t}".`));const h={progress_callback:s,config:o,cache_dir:r,local_files_only:n,revision:a,device:l,dtype:c,subfolder:d,use_external_data_format:u,model_file_name:_,session_options:m},g=new Map([["tokenizer",p.tokenizer],["model",p.model],["processor",p.processor]]),f=await async function(e,t,s){const o=Object.create(null),r=[];for(const[n,a]of e.entries()){if(!a)continue;let e;e=Array.isArray(a)?new Promise((async(e,o)=>{let r;for(const n of a){if(null===n)return void e(null);try{return void e(await n.from_pretrained(t,s))}catch(e){if(e.message?.includes("Unsupported model type"))r=e;else{if(!e.message?.includes("Could not locate file"))return void o(e);r=e}}}o(r)})):a.from_pretrained(t,s),o[n]=e,r.push(e)}await Promise.all(r);for(const[e,t]of Object.entries(o))o[e]=await t;return o}(g,t,h);f.task=e,(0,i.dispatchCallback)(s,{status:"ready",task:e,model:t});return new(0,p.pipeline)(f)}},"./src/tokenizers.js":(e,t,s)=>{s.r(t),s.d(t,{AlbertTokenizer:()=>ke,AutoTokenizer:()=>gt,BartTokenizer:()=>Ne,BertTokenizer:()=>Pe,BlenderbotSmallTokenizer:()=>dt,BlenderbotTokenizer:()=>ct,BloomTokenizer:()=>Re,CLIPTokenizer:()=>nt,CamembertTokenizer:()=>Ie,CodeGenTokenizer:()=>rt,CodeLlamaTokenizer:()=>$e,CohereTokenizer:()=>pt,ConvBertTokenizer:()=>Ae,DebertaTokenizer:()=>ve,DebertaV2Tokenizer:()=>Ce,DistilBertTokenizer:()=>Le,ElectraTokenizer:()=>Ve,EsmTokenizer:()=>Je,FalconTokenizer:()=>Qe,GPT2Tokenizer:()=>De,GPTNeoXTokenizer:()=>He,GemmaTokenizer:()=>Ke,Grok1Tokenizer:()=>Ze,HerbertTokenizer:()=>Se,LlamaTokenizer:()=>We,M2M100Tokenizer:()=>st,MBart50Tokenizer:()=>Be,MBartTokenizer:()=>Oe,MPNetTokenizer:()=>Xe,MarianTokenizer:()=>it,MgpstrTokenizer:()=>ht,MobileBertTokenizer:()=>Fe,NllbTokenizer:()=>tt,NougatTokenizer:()=>_t,PreTrainedTokenizer:()=>xe,Qwen2Tokenizer:()=>Ye,RoFormerTokenizer:()=>Ee,RobertaTokenizer:()=>Ge,SiglipTokenizer:()=>at,SpeechT5Tokenizer:()=>ut,SqueezeBertTokenizer:()=>ye,T5Tokenizer:()=>je,TokenizerModel:()=>P,VitsTokenizer:()=>mt,Wav2Vec2CTCTokenizer:()=>lt,WhisperTokenizer:()=>ot,XLMRobertaTokenizer:()=>Ue,XLMTokenizer:()=>ze,is_chinese_char:()=>f});var o=s("./src/utils/generic.js"),r=s("./src/utils/core.js"),n=s("./src/utils/hub.js"),a=s("./src/utils/maths.js"),i=s("./src/utils/tensor.js"),l=s("./src/utils/data-structures.js"),c=s("./node_modules/@huggingface/jinja/dist/index.js"),d=s("./src/models/whisper/common_whisper.js");async function u(e,t){const s=await Promise.all([(0,n.getModelJSON)(e,"tokenizer.json",!0,t),(0,n.getModelJSON)(e,"tokenizer_config.json",!0,t)]);return null!==t.legacy&&(s[1].legacy=t.legacy),s}function _(e,t=!0){if(void 0!==e.Regex){let t=e.Regex.replace(/\\([#&~])/g,"$1");for(const[e,s]of b)t=t.replaceAll(e,s);return new RegExp(t,"gu")}if(void 0!==e.String){const s=(0,r.escapeRegExp)(e.String);return new RegExp(t?s:`(${s})`,"gu")}return console.warn("Unknown pattern type:",e),null}function m(e){return new Map(Object.entries(e))}function p(e){const t=e.dims;switch(t.length){case 1:return e.tolist();case 2:if(1!==t[0])throw new Error("Unable to decode tensor with `batch size !== 1`. Use `tokenizer.batch_decode(...)` for batched inputs.");return e.tolist()[0];default:throw new Error(`Expected tensor to have 1-2 dimensions, got ${t.length}.`)}}function h(e){return e.replace(/ \./g,".").replace(/ \?/g,"?").replace(/ \!/g,"!").replace(/ ,/g,",").replace(/ \' /g,"'").replace(/ n\'t/g,"n't").replace(/ \'m/g,"'m").replace(/ \'s/g,"'s").replace(/ \'ve/g,"'ve").replace(/ \'re/g,"'re")}function g(e){return e.replace(/\p{M}/gu,"")}function f(e){return e>=19968&&e<=40959||e>=13312&&e<=19903||e>=131072&&e<=173791||e>=173824&&e<=177983||e>=177984&&e<=178207||e>=178208&&e<=183983||e>=63744&&e<=64255||e>=194560&&e<=195103}const M="\\p{P}\\u0021-\\u002F\\u003A-\\u0040\\u005B-\\u0060\\u007B-\\u007E",w=new RegExp(`^[${M}]+$`,"gu"),T=".,!?…。,、।۔،",b=new Map([["(?i:'s|'t|'re|'ve|'m|'ll|'d)","(?:'([sS]|[tT]|[rR][eE]|[vV][eE]|[mM]|[lL][lL]|[dD]))"],[` ?[^(\\s|[${T}])]+`,` ?[^\\s${T}]+`]]);class x{constructor(e){this.content=e.content,this.id=e.id,this.single_word=e.single_word??!1,this.lstrip=e.lstrip??!1,this.rstrip=e.rstrip??!1,this.special=e.special??!1,this.normalized=e.normalized??null}}class P extends o.Callable{constructor(e){super(),this.config=e,this.vocab=[],this.tokens_to_ids=new Map,this.unk_token_id=void 0,this.unk_token=void 0,this.end_of_word_suffix=void 0,this.fuse_unk=this.config.fuse_unk??!1}static fromConfig(e,...t){switch(e.type){case"WordPiece":return new k(e);case"Unigram":return new F(e,...t);case"BPE":return new C(e);default:if(e.vocab)return Array.isArray(e.vocab)?new F(e,...t):"object"==typeof e.vocab&&e.continuing_subword_prefix&&e.unk_token?new k(e):new S(e,...t);throw new Error(`Unknown TokenizerModel type: ${e.type}`)}}_call(e){return e=this.encode(e),this.fuse_unk&&(e=function(e,t,s){const o=[];let r=0;for(;r<e.length;)if(o.push(e[r]),(t.get(e[r])??s)===s)for(;++r<e.length&&(t.get(e[r])??s)===s;)t.get(o.at(-1))!==s&&(o[o.length-1]+=e[r]);else++r;return o}(e,this.tokens_to_ids,this.unk_token_id)),e}encode(e){throw Error("encode should be implemented in subclass.")}convert_tokens_to_ids(e){return e.map((e=>this.tokens_to_ids.get(e)??this.unk_token_id))}convert_ids_to_tokens(e){return e.map((e=>this.vocab[e]??this.unk_token))}}class k extends P{constructor(e){super(e),this.tokens_to_ids=m(e.vocab),this.unk_token_id=this.tokens_to_ids.get(e.unk_token),this.unk_token=e.unk_token,this.max_input_chars_per_word=e.max_input_chars_per_word??100,this.vocab=new Array(this.tokens_to_ids.size);for(const[e,t]of this.tokens_to_ids)this.vocab[t]=e}encode(e){const t=[];for(const s of e){const e=[...s];if(e.length>this.max_input_chars_per_word){t.push(this.unk_token);continue}let o=!1,r=0;const n=[];for(;r<e.length;){let t=e.length,s=null;for(;r<t;){let o=e.slice(r,t).join("");if(r>0&&(o=this.config.continuing_subword_prefix+o),this.tokens_to_ids.has(o)){s=o;break}--t}if(null===s){o=!0;break}n.push(s),r=t}o?t.push(this.unk_token):t.push(...n)}return t}}class F extends P{constructor(e,t){super(e);const s=e.vocab.length;this.vocab=new Array(s),this.scores=new Array(s);for(let t=0;t<s;++t)[this.vocab[t],this.scores[t]]=e.vocab[t];this.unk_token_id=e.unk_id,this.unk_token=this.vocab[e.unk_id],this.tokens_to_ids=new Map(this.vocab.map(((e,t)=>[e,t]))),this.bos_token=" ",this.bos_token_id=this.tokens_to_ids.get(this.bos_token),this.eos_token=t.eos_token,this.eos_token_id=this.tokens_to_ids.get(this.eos_token),this.unk_token=this.vocab[this.unk_token_id],this.minScore=(0,a.min)(this.scores)[0],this.unk_score=this.minScore-10,this.scores[this.unk_token_id]=this.unk_score,this.trie=new l.CharTrie,this.trie.extend(this.vocab),this.fuse_unk=!0}populateNodes(e){const t=e.chars;let s=0;for(;s<t.length;){let o=!1;const n=[],a=t.slice(s).join(""),i=this.trie.commonPrefixSearch(a);for(const t of i){n.push(t);const a=this.tokens_to_ids.get(t),i=this.scores[a],l=(0,r.len)(t);e.insert(s,l,i,a),o||1!==l||(o=!0)}o||e.insert(s,1,this.unk_score,this.unk_token_id),s+=1}}tokenize(e){const t=new l.TokenLattice(e,this.bos_token_id,this.eos_token_id);return this.populateNodes(t),t.tokens()}encode(e){const t=[];for(const s of e){const e=this.tokenize(s);t.push(...e)}return t}}const y=(()=>{const e=[...Array.from({length:"~".charCodeAt(0)-"!".charCodeAt(0)+1},((e,t)=>t+"!".charCodeAt(0))),...Array.from({length:"¬".charCodeAt(0)-"¡".charCodeAt(0)+1},((e,t)=>t+"¡".charCodeAt(0))),...Array.from({length:"ÿ".charCodeAt(0)-"®".charCodeAt(0)+1},((e,t)=>t+"®".charCodeAt(0)))],t=e.slice();let s=0;for(let o=0;o<256;++o)e.includes(o)||(e.push(o),t.push(256+s),s+=1);const o=t.map((e=>String.fromCharCode(e)));return Object.fromEntries(e.map(((e,t)=>[e,o[t]])))})(),v=(0,r.reverseDictionary)(y);class C extends P{constructor(e){super(e),this.tokens_to_ids=m(e.vocab),this.unk_token_id=this.tokens_to_ids.get(e.unk_token),this.unk_token=e.unk_token,this.vocab=new Array(this.tokens_to_ids.size);for(const[e,t]of this.tokens_to_ids)this.vocab[t]=e;const t=Array.isArray(e.merges[0]);this.merges=t?e.merges:e.merges.map((e=>e.split(" ",2))),this.bpe_ranks=new Map(this.merges.map(((e,t)=>[JSON.stringify(e),t]))),this.end_of_word_suffix=e.end_of_word_suffix,this.continuing_subword_suffix=e.continuing_subword_suffix??null,this.byte_fallback=this.config.byte_fallback??!1,this.byte_fallback&&(this.text_encoder=new TextEncoder),this.ignore_merges=this.config.ignore_merges??!1,this.cache=new Map}bpe(e){if(0===e.length)return[];const t=this.cache.get(e);if(void 0!==t)return t;const s=Array.from(e);this.end_of_word_suffix&&(s[s.length-1]+=this.end_of_word_suffix);let o=[];if(s.length>1){const e=new l.PriorityQueue(((e,t)=>e.score<t.score));let t={token:s[0],bias:0,prev:null,next:null},r=t;for(let t=1;t<s.length;++t){const o={bias:t/s.length,token:s[t],prev:r,next:null};r.next=o,this._add_node(e,r),r=o}for(;!e.isEmpty();){const s=e.pop();if(s.deleted||!s.next||s.next.deleted)continue;if(s.deleted=!0,s.next.deleted=!0,s.prev){const e={...s.prev};s.prev.deleted=!0,s.prev=e,e.prev?e.prev.next=e:t=e}const o={token:s.token+s.next.token,bias:s.bias,prev:s.prev,next:s.next.next};o.prev?(o.prev.next=o,this._add_node(e,o.prev)):t=o,o.next&&(o.next.prev=o,this._add_node(e,o))}for(let e=t;null!==e;e=e.next)o.push(e.token)}else o=s;if(this.continuing_subword_suffix)for(let e=0;e<o.length-1;++e)o[e]+=this.continuing_subword_suffix;return this.cache.set(e,o),o}_add_node(e,t){const s=this.bpe_ranks.get(JSON.stringify([t.token,t.next.token]));void 0!==s&&(t.score=s+t.bias,e.push(t))}encode(e){const t=[];for(const s of e){if(this.ignore_merges&&this.tokens_to_ids.has(s)){t.push(s);continue}const e=this.bpe(s);for(const s of e)if(this.tokens_to_ids.has(s))t.push(s);else if(this.byte_fallback){const e=Array.from(this.text_encoder.encode(s)).map((e=>`<0x${e.toString(16).toUpperCase().padStart(2,"0")}>`));e.every((e=>this.tokens_to_ids.has(e)))?t.push(...e):t.push(this.unk_token)}else t.push(this.unk_token)}return t}}class S extends P{constructor(e,t){super(e),this.tokens_to_ids=m(t.target_lang?e.vocab[t.target_lang]:e.vocab),this.bos_token=t.bos_token,this.bos_token_id=this.tokens_to_ids.get(this.bos_token),this.eos_token=t.eos_token,this.eos_token_id=this.tokens_to_ids.get(this.eos_token),this.pad_token=t.pad_token,this.pad_token_id=this.tokens_to_ids.get(this.pad_token),this.unk_token=t.unk_token,this.unk_token_id=this.tokens_to_ids.get(this.unk_token),this.vocab=new Array(this.tokens_to_ids.size);for(const[e,t]of this.tokens_to_ids)this.vocab[t]=e}encode(e){return e}}class A extends o.Callable{constructor(e){super(),this.config=e}static fromConfig(e){if(null===e)return null;switch(e.type){case"BertNormalizer":return new R(e);case"Precompiled":return new pe(e);case"Sequence":return new G(e);case"Replace":return new E(e);case"NFC":return new I(e);case"NFD":return new z(e);case"NFKC":return new V(e);case"NFKD":return new j(e);case"Strip":return new D(e);case"StripAccents":return new N(e);case"Lowercase":return new O(e);case"Prepend":return new B(e);default:throw new Error(`Unknown Normalizer type: ${e.type}`)}}normalize(e){throw Error("normalize should be implemented in subclass.")}_call(e){return this.normalize(e)}}class E extends A{normalize(e){const t=_(this.config.pattern);return null===t?e:e.replaceAll(t,this.config.content)}}class L extends A{form=void 0;normalize(e){return e=e.normalize(this.form)}}class I extends L{form="NFC"}class z extends L{form="NFD"}class V extends L{form="NFKC"}class j extends L{form="NFKD"}class D extends A{normalize(e){return this.config.strip_left&&this.config.strip_right?e=e.trim():(this.config.strip_left&&(e=e.trimStart()),this.config.strip_right&&(e=e.trimEnd())),e}}class N extends A{normalize(e){return e=g(e)}}class O extends A{normalize(e){return e=e.toLowerCase()}}class B extends A{normalize(e){return e=this.config.prepend+e}}class G extends A{constructor(e){super(e),this.normalizers=e.normalizers.map((e=>A.fromConfig(e)))}normalize(e){return this.normalizers.reduce(((e,t)=>t.normalize(e)),e)}}class R extends A{_tokenize_chinese_chars(e){const t=[];for(let s=0;s<e.length;++s){const o=e[s];f(o.charCodeAt(0))?(t.push(" "),t.push(o),t.push(" ")):t.push(o)}return t.join("")}stripAccents(e){return e.normalize("NFD").replace(/\p{Mn}/gu,"")}_is_control(e){switch(e){case"\t":case"\n":case"\r":return!1;default:return/^\p{Cc}|\p{Cf}|\p{Co}|\p{Cs}$/u.test(e)}}_clean_text(e){const t=[];for(const s of e){const e=s.charCodeAt(0);0===e||65533===e||this._is_control(s)||(/^\s$/.test(s)?t.push(" "):t.push(s))}return t.join("")}normalize(e){return this.config.clean_text&&(e=this._clean_text(e)),this.config.handle_chinese_chars&&(e=this._tokenize_chinese_chars(e)),this.config.lowercase?(e=e.toLowerCase(),!1!==this.config.strip_accents&&(e=this.stripAccents(e))):this.config.strip_accents&&(e=this.stripAccents(e)),e}}class q extends o.Callable{static fromConfig(e){if(null===e)return null;switch(e.type){case"BertPreTokenizer":return new W(e);case"Sequence":return new he(e);case"Whitespace":return new ge(e);case"WhitespaceSplit":return new fe(e);case"Metaspace":return new _e(e);case"ByteLevel":return new $(e);case"Split":return new U(e);case"Punctuation":return new X(e);case"Digits":return new Q(e);case"Replace":return new Me(e);default:throw new Error(`Unknown PreTokenizer type: ${e.type}`)}}pre_tokenize_text(e,t){throw Error("pre_tokenize_text should be implemented in subclass.")}pre_tokenize(e,t){return(Array.isArray(e)?e.map((e=>this.pre_tokenize_text(e,t))):this.pre_tokenize_text(e,t)).flat()}_call(e,t){return this.pre_tokenize(e,t)}}class W extends q{constructor(e){super(),this.pattern=new RegExp(`[^\\s${M}]+|[${M}]`,"gu")}pre_tokenize_text(e,t){return e.trim().match(this.pattern)||[]}}class $ extends q{constructor(e){super(),this.config=e,this.add_prefix_space=this.config.add_prefix_space,this.trim_offsets=this.config.trim_offsets,this.use_regex=this.config.use_regex??!0,this.pattern=/'s|'t|'re|'ve|'m|'ll|'d| ?\p{L}+| ?\p{N}+| ?[^\s\p{L}\p{N}]+|\s+(?!\S)|\s+/gu,this.byte_encoder=y,this.text_encoder=new TextEncoder}pre_tokenize_text(e,t){this.add_prefix_space&&!e.startsWith(" ")&&(e=" "+e);return(this.use_regex?e.match(this.pattern)||[]:[e]).map((e=>Array.from(this.text_encoder.encode(e),(e=>this.byte_encoder[e])).join("")))}}class U extends q{constructor(e){super(),this.config=e,this.pattern=_(this.config.pattern,this.config.invert)}pre_tokenize_text(e,t){return null===this.pattern?[]:this.config.invert?e.match(this.pattern)||[]:"removed"===this.config.behavior?.toLowerCase()?e.split(this.pattern).filter((e=>e)):function(e,t){const s=[];let o=0;for(const r of e.matchAll(t)){const t=r[0];o<r.index&&s.push(e.slice(o,r.index)),t.length>0&&s.push(t),o=r.index+t.length}return o<e.length&&s.push(e.slice(o)),s}(e,this.pattern)}}class X extends q{constructor(e){super(),this.config=e,this.pattern=new RegExp(`[^${M}]+|[${M}]+`,"gu")}pre_tokenize_text(e,t){return e.match(this.pattern)||[]}}class Q extends q{constructor(e){super(),this.config=e;const t="[^\\d]+|\\d"+(this.config.individual_digits?"":"+");this.pattern=new RegExp(t,"gu")}pre_tokenize_text(e,t){return e.match(this.pattern)||[]}}class H extends o.Callable{constructor(e){super(),this.config=e}static fromConfig(e){if(null===e)return null;switch(e.type){case"TemplateProcessing":return new K(e);case"ByteLevel":return new Z(e);case"RobertaProcessing":return new Y(e);case"BertProcessing":return new J(e);case"Sequence":return new ee(e);default:throw new Error(`Unknown PostProcessor type: ${e.type}`)}}post_process(e,...t){throw Error("post_process should be implemented in subclass.")}_call(e,...t){return this.post_process(e,...t)}}class J extends H{constructor(e){super(e),this.cls=e.cls[0],this.sep=e.sep[0]}post_process(e,t=null,{add_special_tokens:s=!0}={}){s&&(e=(0,r.mergeArrays)([this.cls],e,[this.sep]));let o=new Array(e.length).fill(0);if(null!==t){const n=s&&this instanceof Y?[this.sep]:[],a=s?[this.sep]:[];e=(0,r.mergeArrays)(e,n,t,a),o=(0,r.mergeArrays)(o,new Array(t.length+n.length+a.length).fill(1))}return{tokens:e,token_type_ids:o}}}class Y extends J{}class K extends H{constructor(e){super(e),this.single=e.single,this.pair=e.pair}post_process(e,t=null,{add_special_tokens:s=!0}={}){const o=null===t?this.single:this.pair;let n=[],a=[];for(const i of o)"SpecialToken"in i?s&&(n.push(i.SpecialToken.id),a.push(i.SpecialToken.type_id)):"Sequence"in i&&("A"===i.Sequence.id?(n=(0,r.mergeArrays)(n,e),a=(0,r.mergeArrays)(a,new Array(e.length).fill(i.Sequence.type_id))):"B"===i.Sequence.id&&(n=(0,r.mergeArrays)(n,t),a=(0,r.mergeArrays)(a,new Array(t.length).fill(i.Sequence.type_id))));return{tokens:n,token_type_ids:a}}}class Z extends H{post_process(e,t=null){return t&&(e=(0,r.mergeArrays)(e,t)),{tokens:e}}}class ee extends H{constructor(e){super(e),this.processors=e.processors.map((e=>H.fromConfig(e)))}post_process(e,t=null,s={}){let o;for(const r of this.processors)if(r instanceof Z){if(e=r.post_process(e).tokens,t){t=r.post_process(t).tokens}}else{const n=r.post_process(e,t,s);e=n.tokens,o=n.token_type_ids}return{tokens:e,token_type_ids:o}}}class te extends o.Callable{constructor(e){super(),this.config=e,this.added_tokens=[],this.end_of_word_suffix=null,this.trim_offsets=e.trim_offsets}static fromConfig(e){if(null===e)return null;switch(e.type){case"WordPiece":return new ae(e);case"Metaspace":return new me(e);case"ByteLevel":return new ie(e);case"Replace":return new se(e);case"ByteFallback":return new oe(e);case"Fuse":return new re(e);case"Strip":return new ne(e);case"Sequence":return new ce(e);case"CTC":return new le(e);case"BPEDecoder":return new de(e);default:throw new Error(`Unknown Decoder type: ${e.type}`)}}_call(e){return this.decode(e)}decode(e){return this.decode_chain(e).join("")}decode_chain(e){throw Error("`decode_chain` should be implemented in subclass.")}}class se extends te{decode_chain(e){const t=_(this.config.pattern);return null===t?e:e.map((e=>e.replaceAll(t,this.config.content)))}}class oe extends te{constructor(e){super(e),this.text_decoder=new TextDecoder}decode_chain(e){const t=[];let s=[];for(const o of e){let e=null;if(6===o.length&&o.startsWith("<0x")&&o.endsWith(">")){const t=parseInt(o.slice(3,5),16);isNaN(t)||(e=t)}if(null!==e)s.push(e);else{if(s.length>0){const e=this.text_decoder.decode(Uint8Array.from(s));t.push(e),s=[]}t.push(o)}}if(s.length>0){const e=this.text_decoder.decode(Uint8Array.from(s));t.push(e),s=[]}return t}}class re extends te{decode_chain(e){return[e.join("")]}}class ne extends te{constructor(e){super(e),this.content=this.config.content,this.start=this.config.start,this.stop=this.config.stop}decode_chain(e){return e.map((e=>{let t=0;for(let s=0;s<this.start&&e[s]===this.content;++s)t=s+1;let s=e.length;for(let t=0;t<this.stop;++t){const o=e.length-t-1;if(e[o]!==this.content)break;s=o}return e.slice(t,s)}))}}class ae extends te{constructor(e){super(e),this.cleanup=e.cleanup}decode_chain(e){return e.map(((e,t)=>(0!==t&&(e=e.startsWith(this.config.prefix)?e.replace(this.config.prefix,""):" "+e),this.cleanup&&(e=h(e)),e)))}}class ie extends te{constructor(e){super(e),this.byte_decoder=v,this.text_decoder=new TextDecoder("utf-8",{fatal:!1,ignoreBOM:!0}),this.end_of_word_suffix=null}convert_tokens_to_string(e){const t=e.join(""),s=new Uint8Array([...t].map((e=>this.byte_decoder[e])));return this.text_decoder.decode(s)}decode_chain(e){const t=[];let s=[];for(const o of e)void 0!==this.added_tokens.find((e=>e.content===o))?(s.length>0&&(t.push(this.convert_tokens_to_string(s)),s=[]),t.push(o)):s.push(o);return s.length>0&&t.push(this.convert_tokens_to_string(s)),t}}class le extends te{constructor(e){super(e),this.pad_token=this.config.pad_token,this.word_delimiter_token=this.config.word_delimiter_token,this.cleanup=this.config.cleanup}convert_tokens_to_string(e){if(0===e.length)return"";const t=[e[0]];for(let s=1;s<e.length;++s)e[s]!==t.at(-1)&&t.push(e[s]);let s=t.filter((e=>e!==this.pad_token)).join("");return this.cleanup&&(s=h(s).replaceAll(this.word_delimiter_token," ").trim()),s}decode_chain(e){return[this.convert_tokens_to_string(e)]}}class ce extends te{constructor(e){super(e),this.decoders=e.decoders.map((e=>te.fromConfig(e)))}decode_chain(e){return this.decoders.reduce(((e,t)=>t.decode_chain(e)),e)}}class de extends te{constructor(e){super(e),this.suffix=this.config.suffix}decode_chain(e){return e.map(((t,s)=>t.replaceAll(this.suffix,s===e.length-1?"":" ")))}}class ue extends te{decode_chain(e){let t="";for(let s=1;s<e.length;s+=2)t+=e[s];return[t]}}class _e extends q{constructor(e){super(),this.addPrefixSpace=e.add_prefix_space,this.replacement=e.replacement,this.strRep=e.str_rep||this.replacement,this.prepend_scheme=e.prepend_scheme??"always"}pre_tokenize_text(e,{section_index:t}={}){let s=e.replaceAll(" ",this.strRep);return this.addPrefixSpace&&!s.startsWith(this.replacement)&&("always"===this.prepend_scheme||"first"===this.prepend_scheme&&0===t)&&(s=this.strRep+s),[s]}}class me extends te{constructor(e){super(e),this.addPrefixSpace=e.add_prefix_space,this.replacement=e.replacement}decode_chain(e){const t=[];for(let s=0;s<e.length;++s){let o=e[s].replaceAll(this.replacement," ");this.addPrefixSpace&&0==s&&o.startsWith(" ")&&(o=o.substring(1)),t.push(o)}return t}}class pe extends A{constructor(e){super(e),this.charsmap=e.precompiled_charsmap}normalize(e){if((e=(e=e.replace(/[\u0001-\u0008\u000B\u000E-\u001F\u007F\u008F\u009F]/gm,"")).replace(/[\u0009\u000A\u000C\u000D\u00A0\u1680\u2000-\u200F\u2028\u2029\u202F\u205F\u2581\u3000\uFEFF\uFFFD]/gm," ")).includes("~")){const t=e.split("~");e=t.map((e=>e.normalize("NFKC"))).join("~")}else e=e.normalize("NFKC");return e}}class he extends q{constructor(e){super(),this.tokenizers=e.pretokenizers.map((e=>q.fromConfig(e)))}pre_tokenize_text(e,t){return this.tokenizers.reduce(((e,s)=>s.pre_tokenize(e,t)),[e])}}class ge extends q{constructor(e){super()}pre_tokenize_text(e,t){return e.match(/\w+|[^\w\s]+/g)||[]}}class fe extends q{constructor(e){super()}pre_tokenize_text(e,t){return function(e){return e.match(/\S+/g)||[]}(e)}}class Me extends q{constructor(e){super(),this.config=e,this.pattern=_(this.config.pattern),this.content=this.config.content}pre_tokenize_text(e,t){return null===this.pattern?[e]:[e.replaceAll(this.pattern,this.config.content)]}}const we=["bos_token","eos_token","unk_token","sep_token","pad_token","cls_token","mask_token"];function Te(e,t,s,o){for(const n of Object.keys(e)){const a=t-e[n].length,i=s(n),l=new Array(a).fill(i);e[n]="right"===o?(0,r.mergeArrays)(e[n],l):(0,r.mergeArrays)(l,e[n])}}function be(e,t){for(const s of Object.keys(e))e[s].length=t}class xe extends o.Callable{return_token_type_ids=!1;padding_side="right";constructor(e,t){super(),this._tokenizer_config=t,this.normalizer=A.fromConfig(e.normalizer),this.pre_tokenizer=q.fromConfig(e.pre_tokenizer),this.model=P.fromConfig(e.model,t),this.post_processor=H.fromConfig(e.post_processor),this.decoder=te.fromConfig(e.decoder),this.special_tokens=[],this.all_special_ids=[],this.added_tokens=[];for(const t of e.added_tokens){const e=new x(t);this.added_tokens.push(e),this.model.tokens_to_ids.set(e.content,e.id),this.model.vocab[e.id]=e.content,e.special&&(this.special_tokens.push(e.content),this.all_special_ids.push(e.id))}if(this.additional_special_tokens=t.additional_special_tokens??[],this.special_tokens.push(...this.additional_special_tokens),this.special_tokens=[...new Set(this.special_tokens)],this.decoder&&(this.decoder.added_tokens=this.added_tokens,this.decoder.end_of_word_suffix=this.model.end_of_word_suffix),this.added_tokens_regex=this.added_tokens.length>0?new RegExp(this.added_tokens.slice().sort(((e,t)=>t.content.length-e.content.length)).map((e=>`${e.lstrip?"\\s*":""}(${(0,r.escapeRegExp)(e.content)})${e.rstrip?"\\s*":""}`)).join("|")):null,this.mask_token=this.getToken("mask_token"),this.mask_token_id=this.model.tokens_to_ids.get(this.mask_token),this.pad_token=this.getToken("pad_token","eos_token"),this.pad_token_id=this.model.tokens_to_ids.get(this.pad_token),this.sep_token=this.getToken("sep_token"),this.sep_token_id=this.model.tokens_to_ids.get(this.sep_token),this.unk_token=this.getToken("unk_token"),this.unk_token_id=this.model.tokens_to_ids.get(this.unk_token),this.bos_token=this.getToken("bos_token"),this.bos_token_id=this.model.tokens_to_ids.get(this.bos_token),this.eos_token=this.getToken("eos_token"),this.eos_token_id=this.model.tokens_to_ids.get(this.eos_token),this.model_max_length=t.model_max_length,this.remove_space=t.remove_space,this.clean_up_tokenization_spaces=t.clean_up_tokenization_spaces??!0,this.do_lowercase_and_remove_accent=t.do_lowercase_and_remove_accent??!1,t.padding_side&&(this.padding_side=t.padding_side),this.legacy=!1,this.chat_template=t.chat_template??null,Array.isArray(this.chat_template)){const e=Object.create(null);for(const{name:t,template:s}of this.chat_template){if("string"!=typeof t||"string"!=typeof s)throw new Error('Chat template must be a list of objects with "name" and "template" properties');e[t]=s}this.chat_template=e}this._compiled_template_cache=new Map}getToken(...e){for(const t of e){const e=this._tokenizer_config[t];if(e){if("object"==typeof e){if("AddedToken"===e.__type)return e.content;throw Error(`Unknown token: ${e}`)}return e}}return null}static async from_pretrained(e,{progress_callback:t=null,config:s=null,cache_dir:o=null,local_files_only:r=!1,revision:n="main",legacy:a=null}={}){return new this(...await u(e,{progress_callback:t,config:s,cache_dir:o,local_files_only:r,revision:n,legacy:a}))}_call(e,{text_pair:t=null,add_special_tokens:s=!0,padding:o=!1,truncation:r=null,max_length:n=null,return_tensor:l=!0,return_token_type_ids:c=null}={}){const d=Array.isArray(e);let u;if(d){if(0===e.length)throw Error("text array must be non-empty");if(null!==t){if(!Array.isArray(t))throw Error("text_pair must also be an array");if(e.length!==t.length)throw Error("text and text_pair must have the same length");u=e.map(((e,o)=>this._encode_plus(e,{text_pair:t[o],add_special_tokens:s,return_token_type_ids:c})))}else u=e.map((e=>this._encode_plus(e,{add_special_tokens:s,return_token_type_ids:c})))}else{if(null==e)throw Error("text may not be null or undefined");if(Array.isArray(t))throw Error("When specifying `text_pair`, since `text` is a string, `text_pair` must also be a string (i.e., not an array).");u=[this._encode_plus(e,{text_pair:t,add_special_tokens:s,return_token_type_ids:c})]}if(null===n?n="max_length"===o?this.model_max_length:(0,a.max)(u.map((e=>e.input_ids.length)))[0]:r||console.warn("Truncation was not explicitly activated but `max_length` is provided a specific value, please use `truncation=true` to explicitly truncate examples to max length."),n=Math.min(n,this.model_max_length??1/0),o||r)for(let e=0;e<u.length;++e)u[e].input_ids.length!==n&&(u[e].input_ids.length>n?r&&be(u[e],n):o&&Te(u[e],n,(e=>"input_ids"===e?this.pad_token_id:0),this.padding_side));const _={};if(l){if((!o||!r)&&u.some((e=>{for(const t of Object.keys(e))if(e[t].length!==u[0][t]?.length)return!0;return!1})))throw Error("Unable to create tensor, you should probably activate truncation and/or padding with 'padding=true' and 'truncation=true' to have batched tensors with the same length.");const e=[u.length,u[0].input_ids.length];for(const t of Object.keys(u[0]))_[t]=new i.Tensor("int64",BigInt64Array.from(u.flatMap((e=>e[t])).map(BigInt)),e)}else{for(const e of Object.keys(u[0]))_[e]=u.map((t=>t[e]));if(!d)for(const e of Object.keys(_))_[e]=_[e][0]}return _}_encode_text(e){if(null===e)return null;const t=(this.added_tokens_regex?e.split(this.added_tokens_regex).filter((e=>e)):[e]).map(((e,t)=>{if(void 0!==this.added_tokens.find((t=>t.content===e)))return e;{if(!0===this.remove_space&&(e=e.trim().split(/\s+/).join(" ")),this.do_lowercase_and_remove_accent&&(e=function(e){return g(e.toLowerCase())}(e)),null!==this.normalizer&&(e=this.normalizer(e)),0===e.length)return[];const s=null!==this.pre_tokenizer?this.pre_tokenizer(e,{section_index:t}):[e];return this.model(s)}})).flat();return t}_encode_plus(e,{text_pair:t=null,add_special_tokens:s=!0,return_token_type_ids:o=null}={}){const{tokens:r,token_type_ids:n}=this._tokenize_helper(e,{pair:t,add_special_tokens:s}),a=this.model.convert_tokens_to_ids(r),i={input_ids:a,attention_mask:new Array(a.length).fill(1)};return(o??this.return_token_type_ids)&&n&&(i.token_type_ids=n),i}_tokenize_helper(e,{pair:t=null,add_special_tokens:s=!1}={}){const o=this._encode_text(e),n=this._encode_text(t);return this.post_processor?this.post_processor(o,n,{add_special_tokens:s}):{tokens:(0,r.mergeArrays)(o??[],n??[])}}tokenize(e,{pair:t=null,add_special_tokens:s=!1}={}){return this._tokenize_helper(e,{pair:t,add_special_tokens:s}).tokens}encode(e,{text_pair:t=null,add_special_tokens:s=!0,return_token_type_ids:o=null}={}){return this._encode_plus(e,{text_pair:t,add_special_tokens:s,return_token_type_ids:o}).input_ids}batch_decode(e,t={}){return e instanceof i.Tensor&&(e=e.tolist()),e.map((e=>this.decode(e,t)))}decode(e,t={}){if(e instanceof i.Tensor&&(e=p(e)),!Array.isArray(e)||0===e.length||!(0,r.isIntegralNumber)(e[0]))throw Error("token_ids must be a non-empty array of integers.");return this.decode_single(e,t)}decode_single(e,{skip_special_tokens:t=!1,clean_up_tokenization_spaces:s=null}){let o=this.model.convert_ids_to_tokens(e);t&&(o=o.filter((e=>!this.special_tokens.includes(e))));let r=this.decoder?this.decoder(o):o.join(" ");return this.decoder&&this.decoder.end_of_word_suffix&&(r=r.replaceAll(this.decoder.end_of_word_suffix," "),t&&(r=r.trim())),(s??this.clean_up_tokenization_spaces)&&(r=h(r)),r}get_chat_template({chat_template:e=null,tools:t=null}={}){if(this.chat_template&&"object"==typeof this.chat_template){const s=this.chat_template;if(null!==e&&Object.hasOwn(s,e))e=s[e];else if(null===e)if(null!==t&&"tool_use"in s)e=s.tool_use;else{if(!("default"in s))throw Error(`This model has multiple chat templates with no default specified! Please either pass a chat template or the name of the template you wish to use to the 'chat_template' argument. Available template names are ${Object.keys(s).sort()}.`);e=s.default}}else if(null===e){if(!this.chat_template)throw Error("Cannot use apply_chat_template() because tokenizer.chat_template is not set and no template argument was passed! For information about writing templates and setting the tokenizer.chat_template attribute, please see the documentation at https://huggingface.co/docs/transformers/main/en/chat_templating");e=this.chat_template}return e}apply_chat_template(e,{tools:t=null,documents:s=null,chat_template:o=null,add_generation_prompt:r=!1,tokenize:n=!0,padding:a=!1,truncation:i=!1,max_length:l=null,return_tensor:d=!0,return_dict:u=!1,tokenizer_kwargs:_={},...m}={}){if("string"!=typeof(o=this.get_chat_template({chat_template:o,tools:t})))throw Error("chat_template must be a string, but got "+typeof o);let p=this._compiled_template_cache.get(o);void 0===p&&(p=new c.Template(o),this._compiled_template_cache.set(o,p));const h=Object.create(null);for(const e of we){const t=this.getToken(e);t&&(h[e]=t)}const g=p.render({messages:e,add_generation_prompt:r,tools:t,documents:s,...h,...m});if(n){const e=this._call(g,{add_special_tokens:!1,padding:a,truncation:i,max_length:l,return_tensor:d,..._});return u?e:e.input_ids}return g}}class Pe extends xe{return_token_type_ids=!0}class ke extends xe{return_token_type_ids=!0}class Fe extends xe{return_token_type_ids=!0}class ye extends xe{return_token_type_ids=!0}class ve extends xe{return_token_type_ids=!0}class Ce extends xe{return_token_type_ids=!0}class Se extends xe{return_token_type_ids=!0}class Ae extends xe{return_token_type_ids=!0}class Ee extends xe{return_token_type_ids=!0}class Le extends xe{}class Ie extends xe{}class ze extends xe{return_token_type_ids=!0;constructor(e,t){super(e,t),console.warn('WARNING: `XLMTokenizer` is not yet supported by Hugging Face\'s "fast" tokenizers library. Therefore, you may experience slightly inaccurate results.')}}class Ve extends xe{return_token_type_ids=!0}class je extends xe{}class De extends xe{}class Ne extends xe{}class Oe extends xe{constructor(e,t){super(e,t),this.languageRegex=/^[a-z]{2}_[A-Z]{2}$/,this.language_codes=this.special_tokens.filter((e=>this.languageRegex.test(e))),this.lang_to_token=e=>e}_build_translation_inputs(e,t,s){return et(this,e,t,s)}}class Be extends Oe{}class Ge extends xe{}class Re extends xe{}const qe="▁";class We extends xe{padding_side="left";constructor(e,t){super(e,t),this.legacy=t.legacy??!0,this.legacy||(this.normalizer=null,this.pre_tokenizer=new _e({replacement:qe,add_prefix_space:!0,prepend_scheme:"first"}))}_encode_text(e){if(null===e)return null;if(this.legacy||0===e.length)return super._encode_text(e);let t=super._encode_text(qe+e.replaceAll(qe," "));return t.length>1&&t[0]===qe&&this.special_tokens.includes(t[1])&&(t=t.slice(1)),t}}class $e extends xe{}class Ue extends xe{}class Xe extends xe{}class Qe extends xe{}class He extends xe{}class Je extends xe{}class Ye extends xe{}class Ke extends xe{}class Ze extends xe{}function et(e,t,s,o){if(!("language_codes"in e)||!Array.isArray(e.language_codes))throw new Error("Tokenizer must have `language_codes` attribute set and it should be an array of language ids.");if(!("languageRegex"in e&&e.languageRegex instanceof RegExp))throw new Error("Tokenizer must have `languageRegex` attribute set and it should be a regular expression.");if(!("lang_to_token"in e)||"function"!=typeof e.lang_to_token)throw new Error("Tokenizer must have `lang_to_token` attribute set and it should be a function.");const r=o.src_lang,n=o.tgt_lang;if(!e.language_codes.includes(n))throw new Error(`Target language code "${n}" is not valid. Must be one of: {${e.language_codes.join(", ")}}`);if(void 0!==r){if(!e.language_codes.includes(r))throw new Error(`Source language code "${r}" is not valid. Must be one of: {${e.language_codes.join(", ")}}`);for(const t of e.post_processor.config.single)if("SpecialToken"in t&&e.languageRegex.test(t.SpecialToken.id)){t.SpecialToken.id=e.lang_to_token(r);break}}return o.forced_bos_token_id=e.model.convert_tokens_to_ids([e.lang_to_token(n)])[0],e._call(t,s)}class tt extends xe{constructor(e,t){super(e,t),this.languageRegex=/^[a-z]{3}_[A-Z][a-z]{3}$/,this.language_codes=this.special_tokens.filter((e=>this.languageRegex.test(e))),this.lang_to_token=e=>e}_build_translation_inputs(e,t,s){return et(this,e,t,s)}}class st extends xe{constructor(e,t){super(e,t),this.languageRegex=/^__[a-z]{2,3}__$/,this.language_codes=this.special_tokens.filter((e=>this.languageRegex.test(e))).map((e=>e.slice(2,-2))),this.lang_to_token=e=>`__${e}__`}_build_translation_inputs(e,t,s){return et(this,e,t,s)}}class ot extends xe{get timestamp_begin(){return this.model.convert_tokens_to_ids(["<|notimestamps|>"])[0]+1}_decode_asr(e,{return_timestamps:t=!1,return_language:s=!1,time_precision:o=null,force_full_sequences:r=!0}={}){if(null===o)throw Error("Must specify time_precision");let n=null;const i="word"===t;function l(){return{language:n,timestamp:[null,null],text:""}}const c=[];let u=l(),_=0;const m=this.timestamp_begin,p=m+1500;let h=[],g=[],f=!1,M=null;const T=new Set(this.all_special_ids);for(const s of e){const e=s.tokens,r=i?s.token_timestamps:null;let b=null,x=m;if("stride"in s){const[t,r,n]=s.stride;if(_-=r,M=t-n,r&&(x=r/o+m),n)for(let t=e.length-1;t>=0;--t){const s=Number(e[t]);if(s>=m){if(null!==b&&(s-m)*o<M)break;b=s}}}let P=[],k=[];for(let s=0;s<e.length;++s){const M=Number(e[s]);if(T.has(M)){const e=this.decode([M]),s=d.WHISPER_LANGUAGE_MAPPING.get(e.slice(2,-2));if(void 0!==s){if(null!==n&&s!==n&&!t){h.push(P);const e=this.findLongestCommonSequence(h)[0],t=this.decode(e);u.text=t,c.push(u),h=[],P=[],u=l()}n=u.language=s}}else if(M>=m&&M<=p){const e=(M-m)*o+_,t=(0,a.round)(e,2);if(null!==b&&M>=b)f=!0;else if(f||h.length>0&&M<x)f=!1;else if(null===u.timestamp[0])u.timestamp[0]=t;else if(t===u.timestamp[0]);else{u.timestamp[1]=t,h.push(P),i&&g.push(k);const[e,s]=this.findLongestCommonSequence(h,g),o=this.decode(e);u.text=o,i&&(u.words=this.collateWordTimestamps(e,s,n)),c.push(u),h=[],P=[],g=[],k=[],u=l()}}else if(P.push(M),i){let e,t=(0,a.round)(r[s]+_,2);if(s+1<r.length){e=(0,a.round)(r[s+1]+_,2);const n=this.decode([M]);w.test(n)&&(e=(0,a.round)(Math.min(t+o,e),2))}else e=null;k.push([t,e])}}if("stride"in s){const[e,t,o]=s.stride;_+=e-o}P.length>0?(h.push(P),i&&g.push(k)):h.every((e=>0===e.length))&&(u=l(),h=[],P=[],g=[],k=[])}if(h.length>0){if(r&&t)throw new Error("Whisper did not predict an ending timestamp, which can happen if audio is cut off in the middle of a word. Also make sure WhisperTimeStampLogitsProcessor was used during generation.");const[e,s]=this.findLongestCommonSequence(h,g),o=this.decode(e);u.text=o,i&&(u.words=this.collateWordTimestamps(e,s,n)),c.push(u)}let b=Object.create(null);const x=c.map((e=>e.text)).join("");if(t||s){for(let e=0;e<c.length;++e){const o=c[e];t||delete o.timestamp,s||delete o.language}if(i){const e=[];for(const t of c)for(const s of t.words)e.push(s);b={chunks:e}}else b={chunks:c}}return[x,b]}findLongestCommonSequence(e,t=null){let s=e[0],o=s.length,r=[];const n=Array.isArray(t)&&t.length>0;let a=n?[]:null,i=n?t[0]:null;for(let l=1;l<e.length;++l){const c=e[l];let d=0,u=[o,o,0,0];const _=c.length;for(let e=1;e<o+_;++e){const r=Math.max(0,o-e),a=Math.min(o,o+_-e),m=s.slice(r,a),p=Math.max(0,e-o),h=Math.min(_,e),g=c.slice(p,h);if(m.length!==g.length)throw new Error("There is a bug within whisper `decode_asr` function, please report it. Dropping to prevent bad inference.");let f;f=n?m.filter(((e,s)=>e===g[s]&&i[r+s]<=t[l][p+s])).length:m.filter(((e,t)=>e===g[t])).length;const M=f/e+e/1e4;f>1&&M>d&&(d=M,u=[r,a,p,h])}const[m,p,h,g]=u,f=Math.floor((p+m)/2),M=Math.floor((g+h)/2);r.push(...s.slice(0,f)),s=c.slice(M),o=s.length,n&&(a.push(...i.slice(0,f)),i=t[l].slice(M))}return r.push(...s),n?(a.push(...i),[r,a]):[r,[]]}collateWordTimestamps(e,t,s){const[o,r,n]=this.combineTokensIntoWords(e,s),a=[];for(let e=0;e<o.length;++e){const s=n[e];a.push({text:o[e],timestamp:[t[s.at(0)][0],t[s.at(-1)][1]]})}return a}combineTokensIntoWords(e,t,s="\"'“¡¿([{-",o="\"'.。,,!!??::”)]}、"){let r,n,a;return["chinese","japanese","thai","lao","myanmar"].includes(t=t??"english")?[r,n,a]=this.splitTokensOnUnicode(e):[r,n,a]=this.splitTokensOnSpaces(e),this.mergePunctuations(r,n,a,s,o)}decode(e,t){let s;return t?.decode_with_timestamps?(e instanceof i.Tensor&&(e=p(e)),s=this.decodeWithTimestamps(e,t)):s=super.decode(e,t),s}decodeWithTimestamps(e,t){const s=t?.time_precision??.02,o=Array.from(this.all_special_ids).at(-1)+1;let r=[[]];for(let t of e)if(t=Number(t),t>=o){const e=((t-o)*s).toFixed(2);r.push(`<|${e}|>`),r.push([])}else r[r.length-1].push(t);return r=r.map((e=>"string"==typeof e?e:super.decode(e,t))),r.join("")}splitTokensOnUnicode(e){const t=this.decode(e,{decode_with_timestamps:!0}),s=[],o=[],r=[];let n=[],a=[],i=0;for(let l=0;l<e.length;++l){const c=e[l];n.push(c),a.push(l);const d=this.decode(n,{decode_with_timestamps:!0});d.includes("�")&&"�"!==t[i+d.indexOf("�")]||(s.push(d),o.push(n),r.push(a),n=[],a=[],i+=d.length)}return[s,o,r]}splitTokensOnSpaces(e){const[t,s,o]=this.splitTokensOnUnicode(e),r=[],n=[],a=[],i=new RegExp(`^[${M}]$`,"gu");for(let e=0;e<t.length;++e){const l=t[e],c=s[e],d=o[e],u=c[0]>=this.model.tokens_to_ids.get("<|endoftext|>"),_=l.startsWith(" "),m=l.trim(),p=i.test(m);if(u||_||p||0===r.length)r.push(l),n.push(c),a.push(d);else{const e=r.length-1;r[e]+=l,n[e].push(...c),a[e].push(...d)}}return[r,n,a]}mergePunctuations(e,t,s,o,n){const a=structuredClone(e),i=structuredClone(t),l=structuredClone(s);let c=a.length-2,d=a.length-1;for(;c>=0;)a[c].startsWith(" ")&&o.includes(a[c].trim())?(a[d]=a[c]+a[d],i[d]=(0,r.mergeArrays)(i[c],i[d]),l[d]=(0,r.mergeArrays)(l[c],l[d]),a[c]="",i[c]=[],l[c]=[]):d=c,--c;for(c=0,d=1;d<a.length;)!a[c].endsWith(" ")&&n.includes(a[d])?(a[c]+=a[d],i[c]=(0,r.mergeArrays)(i[c],i[d]),l[c]=(0,r.mergeArrays)(l[c],l[d]),a[d]="",i[d]=[],l[d]=[]):c=d,++d;return[a.filter((e=>e)),i.filter((e=>e.length>0)),l.filter((e=>e.length>0))]}}class rt extends xe{}class nt extends xe{}class at extends xe{}class it extends xe{constructor(e,t){super(e,t),this.languageRegex=/^(>>\w+<<)\s*/g,this.supported_language_codes=this.model.vocab.filter((e=>this.languageRegex.test(e))),console.warn('WARNING: `MarianTokenizer` is not yet supported by Hugging Face\'s "fast" tokenizers library. Therefore, you may experience slightly inaccurate results.')}_encode_text(e){if(null===e)return null;const[t,...s]=e.trim().split(this.languageRegex);if(0===s.length)return super._encode_text(t);if(2===s.length){const[e,t]=s;return this.supported_language_codes.includes(e)||console.warn(`Unsupported language code "${e}" detected, which may lead to unexpected behavior. Should be one of: ${JSON.stringify(this.supported_language_codes)}`),(0,r.mergeArrays)([e],super._encode_text(t))}}}class lt extends xe{}class ct extends xe{}class dt extends xe{}class ut extends xe{}class _t extends xe{}class mt extends xe{constructor(e,t){super(e,t),this.decoder=new ue({})}}class pt extends xe{}class ht extends xe{}class gt{static TOKENIZER_CLASS_MAPPING={T5Tokenizer:je,DistilBertTokenizer:Le,CamembertTokenizer:Ie,DebertaTokenizer:ve,DebertaV2Tokenizer:Ce,BertTokenizer:Pe,HerbertTokenizer:Se,ConvBertTokenizer:Ae,RoFormerTokenizer:Ee,XLMTokenizer:ze,ElectraTokenizer:Ve,MobileBertTokenizer:Fe,SqueezeBertTokenizer:ye,AlbertTokenizer:ke,GPT2Tokenizer:De,BartTokenizer:Ne,MBartTokenizer:Oe,MBart50Tokenizer:Be,RobertaTokenizer:Ge,WhisperTokenizer:ot,CodeGenTokenizer:rt,CLIPTokenizer:nt,SiglipTokenizer:at,MarianTokenizer:it,BloomTokenizer:Re,NllbTokenizer:tt,M2M100Tokenizer:st,LlamaTokenizer:We,CodeLlamaTokenizer:$e,XLMRobertaTokenizer:Ue,MPNetTokenizer:Xe,FalconTokenizer:Qe,GPTNeoXTokenizer:He,EsmTokenizer:Je,Wav2Vec2CTCTokenizer:lt,BlenderbotTokenizer:ct,BlenderbotSmallTokenizer:dt,SpeechT5Tokenizer:ut,NougatTokenizer:_t,VitsTokenizer:mt,Qwen2Tokenizer:Ye,GemmaTokenizer:Ke,Grok1Tokenizer:Ze,CohereTokenizer:pt,MgpstrTokenizer:ht,PreTrainedTokenizer:xe};static async from_pretrained(e,{progress_callback:t=null,config:s=null,cache_dir:o=null,local_files_only:r=!1,revision:n="main",legacy:a=null}={}){const[i,l]=await u(e,{progress_callback:t,config:s,cache_dir:o,local_files_only:r,revision:n,legacy:a}),c=l.tokenizer_class?.replace(/Fast$/,"")??"PreTrainedTokenizer";let d=this.TOKENIZER_CLASS_MAPPING[c];return d||(console.warn(`Unknown tokenizer class "${c}", attempting to construct from base class.`),d=xe),new d(i,l)}}},"./src/utils/audio.js":(e,t,s)=>{s.r(t),s.d(t,{RawAudio:()=>x,hamming:()=>_,hanning:()=>u,mel_filter_bank:()=>f,read_audio:()=>c,spectrogram:()=>w,window_function:()=>T});var o=s("./src/utils/hub.js"),r=s("./src/utils/maths.js"),n=s("./src/utils/core.js"),a=s("./src/env.js"),i=s("fs"),l=s("./src/utils/tensor.js");async function c(e,t){if("undefined"==typeof AudioContext)throw Error("Unable to load audio from path/URL since `AudioContext` is not available in your environment. Instead, audio data should be passed directly to the pipeline/processor. For more information and some example code, see https://huggingface.co/docs/transformers.js/guides/node-audio-processing.");const s=await(await(0,o.getFile)(e)).arrayBuffer(),r=new AudioContext({sampleRate:t});void 0===t&&console.warn(`No sampling rate provided, using default of ${r.sampleRate}Hz.`);const n=await r.decodeAudioData(s);let a;if(2===n.numberOfChannels){const e=Math.sqrt(2),t=n.getChannelData(0),s=n.getChannelData(1);a=new Float32Array(t.length);for(let o=0;o<n.length;++o)a[o]=e*(t[o]+s[o])/2}else a=n.getChannelData(0);return a}function d(e,t){if(e<1)return new Float64Array;if(1===e)return new Float64Array([1]);const s=1-t,o=2*Math.PI/(e-1),r=new Float64Array(e);for(let n=0;n<e;++n)r[n]=t-s*Math.cos(n*o);return r}function u(e){return d(e,.5)}function _(e){return d(e,.54)}const m={htk:e=>2595*Math.log10(1+e/700),kaldi:e=>1127*Math.log(1+e/700),slaney:(e,t=1e3,s=15,o=27/Math.log(6.4))=>e>=t?s+Math.log(e/t)*o:3*e/200};function p(e,t="htk"){const s=m[t];if(!s)throw new Error('mel_scale should be one of "htk", "slaney" or "kaldi".');return"number"==typeof e?s(e):e.map((e=>s(e)))}const h={htk:e=>700*(10**(e/2595)-1),kaldi:e=>700*(Math.exp(e/1127)-1),slaney:(e,t=1e3,s=15,o=Math.log(6.4)/27)=>e>=s?t*Math.exp(o*(e-s)):200*e/3};function g(e,t,s){const o=(t-e)/(s-1);return Float64Array.from({length:s},((t,s)=>e+o*s))}function f(e,t,s,o,r,n=null,a="htk",i=!1){if(null!==n&&"slaney"!==n)throw new Error('norm must be one of null or "slaney"');const l=g(p(s,a),p(o,a),t+2);let c,d=function(e,t="htk"){const s=h[t];if(!s)throw new Error('mel_scale should be one of "htk", "slaney" or "kaldi".');return"number"==typeof e?s(e):e.map((e=>s(e)))}(l,a);if(i){const t=r/(2*e);c=p(Float64Array.from({length:e},((e,s)=>s*t)),a),d=l}else c=g(0,Math.floor(r/2),e);const u=function(e,t){const s=Float64Array.from({length:t.length-1},((e,s)=>t[s+1]-t[s])),o=Array.from({length:e.length},(()=>new Array(t.length)));for(let s=0;s<e.length;++s){const r=o[s];for(let o=0;o<t.length;++o)r[o]=t[o]-e[s]}const r=t.length-2,n=Array.from({length:r},(()=>new Array(e.length)));for(let t=0;t<e.length;++t){const e=o[t];for(let o=0;o<r;++o){const r=-e[o]/s[o],a=e[o+2]/s[o+1];n[o][t]=Math.max(0,Math.min(r,a))}}return n}(c,d);if(null!==n&&"slaney"===n)for(let s=0;s<t;++s){const t=u[s],o=2/(d[s+2]-d[s]);for(let s=0;s<e;++s)t[s]*=o}return u}function M(e,t,s,o,n){if(s<=0)throw new Error("reference must be greater than zero");if(o<=0)throw new Error("min_value must be greater than zero");s=Math.max(o,s);const a=Math.log10(s);for(let s=0;s<e.length;++s)e[s]=t*Math.log10(Math.max(o,e[s])-a);if(null!==n){if(n<=0)throw new Error("db_range must be greater than zero");const t=(0,r.max)(e)[0]-n;for(let s=0;s<e.length;++s)e[s]=Math.max(e[s],t)}return e}async function w(e,t,s,o,{fft_length:a=null,power:i=1,center:c=!0,pad_mode:d="reflect",onesided:u=!0,preemphasis:_=null,mel_filters:m=null,mel_floor:p=1e-10,log_mel:h=null,reference:g=1,min_value:f=1e-10,db_range:w=null,remove_dc_offset:T=null,min_num_frames:b=null,max_num_frames:x=null,do_pad:P=!0,transpose:k=!1}={}){const F=t.length;if(null===a&&(a=s),s>a)throw Error(`frame_length (${s}) may not be larger than fft_length (${a})`);if(F!==s)throw new Error(`Length of the window (${F}) must equal frame_length (${s})`);if(o<=0)throw new Error("hop_length must be greater than zero");if(null===i&&null!==m)throw new Error("You have provided `mel_filters` but `power` is `None`. Mel spectrogram computation is not yet supported for complex-valued spectrogram. Specify `power` to fix this issue.");if(c){if("reflect"!==d)throw new Error(`pad_mode="${d}" not implemented yet.`);const t=Math.floor((a-1)/2)+1;e=function(e,t,s){const o=new e.constructor(e.length+t+s),r=e.length-1;for(let s=0;s<e.length;++s)o[t+s]=e[s];for(let s=1;s<=t;++s)o[t-s]=e[(0,n.calculateReflectOffset)(s,r)];for(let a=1;a<=s;++a)o[r+t+a]=e[(0,n.calculateReflectOffset)(r-a,r)];return o}(e,t,t)}let y=Math.floor(1+Math.floor((e.length-s)/o));null!==b&&y<b&&(y=b);const v=u?Math.floor(a/2)+1:a;let C=y,S=y;null!==x&&(x>y?P&&(S=x):S=C=x);const A=new r.FFT(a),E=new Float64Array(a),L=new Float64Array(A.outputBufferSize),I=new Float32Array(v*S);for(let r=0;r<C;++r){const n=r*o,a=Math.min(e.length-n,s);a!==s&&E.fill(0,0,s);for(let t=0;t<a;++t)E[t]=e[n+t];if(T){let e=0;for(let t=0;t<a;++t)e+=E[t];const t=e/a;for(let e=0;e<a;++e)E[e]-=t}if(null!==_){for(let e=a-1;e>=1;--e)E[e]-=_*E[e-1];E[0]*=1-_}for(let e=0;e<t.length;++e)E[e]*=t[e];A.realTransform(L,E);for(let e=0;e<v;++e){const t=e<<1;I[e*S+r]=L[t]**2+L[t+1]**2}}if(null!==i&&2!==i){const e=2/i;for(let t=0;t<I.length;++t)I[t]**=e}const z=m.length;let V=await(0,l.matmul)(new l.Tensor("float32",m.flat(),[z,v]),new l.Tensor("float32",I,[v,S]));k&&(V=V.transpose(1,0));const j=V.data;for(let e=0;e<j.length;++e)j[e]=Math.max(p,j[e]);if(null!==i&&null!==h){const e=Math.min(j.length,C*z);switch(h){case"log":for(let t=0;t<e;++t)j[t]=Math.log(j[t]);break;case"log10":for(let t=0;t<e;++t)j[t]=Math.log10(j[t]);break;case"dB":if(1===i)!function(e,t=1,s=1e-5,o=null){M(e,20,t,s,o)}(j,g,f,w);else{if(2!==i)throw new Error(`Cannot use log_mel option '${h}' with power ${i}`);!function(e,t=1,s=1e-10,o=null){M(e,10,t,s,o)}(j,g,f,w)}break;default:throw new Error(`log_mel must be one of null, 'log', 'log10' or 'dB'. Got '${h}'`)}}return V}function T(e,t,{periodic:s=!0,frame_length:o=null,center:r=!0}={}){const n=s?e+1:e;let a;switch(t){case"boxcar":a=new Float64Array(n).fill(1);break;case"hann":case"hann_window":a=u(n);break;case"hamming":a=_(n);break;case"povey":a=u(n).map((e=>Math.pow(e,.85)));break;default:throw new Error(`Unknown window type ${t}.`)}if(s&&(a=a.subarray(0,e)),null===o)return a;if(e>o)throw new Error(`Length of the window (${e}) may not be larger than frame_length (${o})`);return a}function b(e,t,s){for(let o=0;o<s.length;++o)e.setUint8(t+o,s.charCodeAt(o))}class x{constructor(e,t){this.audio=e,this.sampling_rate=t}toWav(){return function(e,t){let s=44;const o=new ArrayBuffer(s+4*e.length),r=new DataView(o);b(r,0,"RIFF"),r.setUint32(4,36+4*e.length,!0),b(r,8,"WAVE"),b(r,12,"fmt "),r.setUint32(16,16,!0),r.setUint16(20,3,!0),r.setUint16(22,1,!0),r.setUint32(24,t,!0),r.setUint32(28,4*t,!0),r.setUint16(32,4,!0),r.setUint16(34,32,!0),b(r,36,"data"),r.setUint32(40,4*e.length,!0);for(let t=0;t<e.length;++t,s+=4)r.setFloat32(s,e[t],!0);return o}(this.audio,this.sampling_rate)}toBlob(){const e=this.toWav();return new Blob([e],{type:"audio/wav"})}async save(e){let t;if(a.apis.IS_BROWSER_ENV){if(a.apis.IS_WEBWORKER_ENV)throw new Error("Unable to save a file from a Web Worker.");t=n.saveBlob}else{if(!a.apis.IS_FS_AVAILABLE)throw new Error("Unable to save because filesystem is disabled in this environment.");t=async(e,t)=>{let s=await t.arrayBuffer();i.default.writeFileSync(e,Buffer.from(s))}}await t(e,this.toBlob())}}},"./src/utils/constants.js":(e,t,s)=>{s.r(t),s.d(t,{CHAT_TEMPLATE_NAME:()=>l,CONFIG_NAME:()=>r,FEATURE_EXTRACTOR_NAME:()=>n,GENERATION_CONFIG_NAME:()=>c,GITHUB_ISSUE_URL:()=>o,IMAGE_PROCESSOR_NAME:()=>a,PROCESSOR_NAME:()=>i});const o="https://github.com/huggingface/transformers.js/issues/new/choose",r="config.json",n="preprocessor_config.json",a=n,i="processor_config.json",l="chat_template.json",c="generation_config.json"},"./src/utils/core.js":(e,t,s)=>{function o(e,t){e&&e(t)}function r(e){return Object.fromEntries(Object.entries(e).map((([e,t])=>[t,e])))}function n(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function a(e){return"TypedArray"===e?.prototype?.__proto__?.constructor?.name}function i(e){return Number.isInteger(e)||"bigint"==typeof e}function l(e){return null==e||-1===e}function c(e){const t=[];let s=e;for(;Array.isArray(s);)t.push(s.length),s=s[0];return t}function d(e,t,s=void 0){const o=e[t];if(void 0!==o)return delete e[t],o;if(void 0===s)throw Error(`Key ${t} does not exist in object.`);return s}function u(...e){return Array.prototype.concat.apply([],e)}function _(...e){return e.reduce(((e,t)=>e.flatMap((e=>t.map((t=>[e,t]))))))}function m(e,t){return Math.abs((e+t)%(2*t)-t)}function p(e,t){const s=URL.createObjectURL(t),o=document.createElement("a");o.href=s,o.download=e,o.click(),o.remove(),URL.revokeObjectURL(s)}function h(e,t){return Object.assign({},...t.map((t=>{if(void 0!==e[t])return{[t]:e[t]}})))}function g(e){let t=0;for(const s of e)++t;return t}function f(e,t){let s=0;for(const o of e)o===t&&++s;return s}s.r(t),s.d(t,{calculateDimensions:()=>c,calculateReflectOffset:()=>m,count:()=>f,dispatchCallback:()=>o,escapeRegExp:()=>n,isIntegralNumber:()=>i,isNullishDimension:()=>l,isTypedArray:()=>a,len:()=>g,mergeArrays:()=>u,pick:()=>h,pop:()=>d,product:()=>_,reverseDictionary:()=>r,saveBlob:()=>p})},"./src/utils/data-structures.js":(e,t,s)=>{s.r(t),s.d(t,{CharTrie:()=>r,PriorityQueue:()=>o,TokenLattice:()=>a});class o{constructor(e=(e,t)=>e>t,t=1/0){this._heap=[],this._comparator=e,this._maxSize=t}get size(){return this._heap.length}isEmpty(){return 0===this.size}peek(){return this._heap[0]}push(...e){return this.extend(e)}extend(e){for(const t of e)if(this.size<this._maxSize)this._heap.push(t),this._siftUp();else{const e=this._smallest();this._comparator(t,this._heap[e])&&(this._heap[e]=t,this._siftUpFrom(e))}return this.size}pop(){const e=this.peek(),t=this.size-1;return t>0&&this._swap(0,t),this._heap.pop(),this._siftDown(),e}replace(e){const t=this.peek();return this._heap[0]=e,this._siftDown(),t}_parent(e){return(e+1>>>1)-1}_left(e){return 1+(e<<1)}_right(e){return e+1<<1}_greater(e,t){return this._comparator(this._heap[e],this._heap[t])}_swap(e,t){const s=this._heap[e];this._heap[e]=this._heap[t],this._heap[t]=s}_siftUp(){this._siftUpFrom(this.size-1)}_siftUpFrom(e){for(;e>0&&this._greater(e,this._parent(e));)this._swap(e,this._parent(e)),e=this._parent(e)}_siftDown(){let e=0;for(;this._left(e)<this.size&&this._greater(this._left(e),e)||this._right(e)<this.size&&this._greater(this._right(e),e);){const t=this._right(e)<this.size&&this._greater(this._right(e),this._left(e))?this._right(e):this._left(e);this._swap(e,t),e=t}}_smallest(){return 2**Math.floor(Math.log2(this.size))-1}}class r{constructor(){this.root=n.default()}extend(e){for(const t of e)this.push(t)}push(e){let t=this.root;for(const s of e){let e=t.children.get(s);void 0===e&&(e=n.default(),t.children.set(s,e)),t=e}t.isLeaf=!0}*commonPrefixSearch(e){let t=this.root;if(void 0===t)return;let s="";for(const o of e){if(s+=o,t=t.children.get(o),void 0===t)return;t.isLeaf&&(yield s)}}}class n{constructor(e,t){this.isLeaf=e,this.children=t}static default(){return new n(!1,new Map)}}class a{constructor(e,t,s){this.chars=Array.from(e),this.len=this.chars.length,this.bosTokenId=t,this.eosTokenId=s,this.nodes=[],this.beginNodes=Array.from({length:this.len+1},(()=>[])),this.endNodes=Array.from({length:this.len+1},(()=>[]));const o=new i(this.bosTokenId,0,0,0,0),r=new i(this.eosTokenId,1,this.len,0,0);this.nodes.push(o.clone()),this.nodes.push(r.clone()),this.beginNodes[this.len].push(r),this.endNodes[0].push(o)}insert(e,t,s,o){const r=this.nodes.length,n=new i(o,r,e,t,s);this.beginNodes[e].push(n),this.endNodes[e+t].push(n),this.nodes.push(n)}viterbi(){const e=this.len;let t=0;for(;t<=e;){if(0==this.beginNodes[t].length)return[];for(let e of this.beginNodes[t]){e.prev=null;let s=0,o=null;for(let r of this.endNodes[t]){const t=r.backtraceScore+e.score;(null===o||t>s)&&(o=r.clone(),s=t)}if(null===o)return[];e.prev=o,e.backtraceScore=s}++t}const s=[],o=this.beginNodes[e][0].prev;if(null===o)return[];let r=o.clone();for(;null!==r.prev;){s.push(r.clone());const e=r.clone();r=e.prev.clone()}return s.reverse(),s}piece(e){return this.chars.slice(e.pos,e.pos+e.length).join("")}tokens(){return this.viterbi().map((e=>this.piece(e)))}tokenIds(){return this.viterbi().map((e=>e.tokenId))}}class i{constructor(e,t,s,o,r){this.tokenId=e,this.nodeId=t,this.pos=s,this.length=o,this.score=r,this.prev=null,this.backtraceScore=0}clone(){const e=new i(this.tokenId,this.nodeId,this.pos,this.length,this.score);return e.prev=this.prev,e.backtraceScore=this.backtraceScore,e}}},"./src/utils/devices.js":(e,t,s)=>{s.r(t),s.d(t,{DEVICE_TYPES:()=>o});const o=Object.freeze({auto:"auto",gpu:"gpu",cpu:"cpu",wasm:"wasm",webgpu:"webgpu",cuda:"cuda",dml:"dml",webnn:"webnn","webnn-npu":"webnn-npu","webnn-gpu":"webnn-gpu","webnn-cpu":"webnn-cpu"})},"./src/utils/dtypes.js":(e,t,s)=>{s.r(t),s.d(t,{DATA_TYPES:()=>a,DEFAULT_DEVICE_DTYPE_MAPPING:()=>i,DEFAULT_DTYPE_SUFFIX_MAPPING:()=>l,isWebGpuFp16Supported:()=>n});var o=s("./src/env.js"),r=s("./src/utils/devices.js");const n=function(){let e;return async function(){if(void 0===e)if(o.apis.IS_WEBGPU_AVAILABLE)try{const t=await navigator.gpu.requestAdapter();e=t.features.has("shader-f16")}catch(t){e=!1}else e=!1;return e}}(),a=Object.freeze({auto:"auto",fp32:"fp32",fp16:"fp16",q8:"q8",int8:"int8",uint8:"uint8",q4:"q4",bnb4:"bnb4",q4f16:"q4f16"}),i=Object.freeze({[r.DEVICE_TYPES.wasm]:a.q8}),l=Object.freeze({[a.fp32]:"",[a.fp16]:"_fp16",[a.int8]:"_int8",[a.uint8]:"_uint8",[a.q8]:"_quantized",[a.q4]:"_q4",[a.q4f16]:"_q4f16",[a.bnb4]:"_bnb4"})},"./src/utils/generic.js":(e,t,s)=>{s.r(t),s.d(t,{Callable:()=>o});const o=class{constructor(){let e=function(...t){return e._call(...t)};return Object.setPrototypeOf(e,new.target.prototype)}_call(...e){throw Error("Must implement _call method in subclass")}}},"./src/utils/hub.js":(e,t,s)=>{s.r(t),s.d(t,{MAX_EXTERNAL_DATA_CHUNKS:()=>i,getFile:()=>u,getModelFile:()=>p,getModelJSON:()=>h});var o=s("fs"),r=s("path"),n=s("./src/env.js"),a=s("./src/utils/core.js");const i=100,l={txt:"text/plain",html:"text/html",css:"text/css",js:"text/javascript",json:"application/json",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif"};class c{constructor(e){if(this.filePath=e,this.headers=new Headers,this.exists=o.default.existsSync(e),this.exists){this.status=200,this.statusText="OK";let t=o.default.statSync(e);this.headers.set("content-length",t.size.toString()),this.updateContentType();const s=o.default.createReadStream(e);this.body=new ReadableStream({start(e){s.on("data",(t=>e.enqueue(t))),s.on("end",(()=>e.close())),s.on("error",(t=>e.error(t)))},cancel(){s.destroy()}})}else this.status=404,this.statusText="Not Found",this.body=null}updateContentType(){const e=this.filePath.toString().split(".").pop().toLowerCase();this.headers.set("content-type",l[e]??"application/octet-stream")}clone(){let e=new c(this.filePath);return e.exists=this.exists,e.status=this.status,e.statusText=this.statusText,e.headers=new Headers(this.headers),e}async arrayBuffer(){return(await o.default.promises.readFile(this.filePath)).buffer}async blob(){const e=await o.default.promises.readFile(this.filePath);return new Blob([e],{type:this.headers.get("content-type")})}async text(){return await o.default.promises.readFile(this.filePath,"utf8")}async json(){return JSON.parse(await this.text())}}function d(e,t=null,s=null){let o;try{o=new URL(e)}catch(e){return!1}return!(t&&!t.includes(o.protocol))&&!(s&&!s.includes(o.hostname))}async function u(e){if(n.env.useFS&&!d(e,["http:","https:","blob:"]))return new c(e.toString());if("undefined"!=typeof process&&"node"===process?.release?.name){const t=!!process.env?.TESTING_REMOTELY,s=n.env.version,o=new Headers;o.set("User-Agent",`transformers.js/${s}; is_ci/${t};`);if(d(e,["http:","https:"],["huggingface.co","hf.co"])){const e=process.env?.HF_TOKEN??process.env?.HF_ACCESS_TOKEN;e&&o.set("Authorization",`Bearer ${e}`)}return fetch(e,{headers:o})}return fetch(e)}const _={400:"Bad request error occurred while trying to load file",401:"Unauthorized access to file",403:"Forbidden access to file",404:"Could not locate file",408:"Request timeout error occurred while trying to load file",500:"Internal server error error occurred while trying to load file",502:"Bad gateway error occurred while trying to load file",503:"Service unavailable error occurred while trying to load file",504:"Gateway timeout error occurred while trying to load file"};class m{constructor(e){this.path=e}async match(e){let t=r.default.join(this.path,e),s=new c(t);return s.exists?s:void 0}async put(e,t,s=void 0){let n=r.default.join(this.path,e);try{const e=t.headers.get("Content-Length"),a=parseInt(e??"0");let i=0;await o.default.promises.mkdir(r.default.dirname(n),{recursive:!0});const l=o.default.createWriteStream(n),c=t.body.getReader();for(;;){const{done:e,value:t}=await c.read();if(e)break;await new Promise(((e,s)=>{l.write(t,(t=>{t?s(t):e()}))})),i+=t.length;const o=a?i/a*100:0;s?.({progress:o,loaded:i,total:a})}l.close()}catch(e){try{await o.default.promises.unlink(n)}catch{}throw e}}}async function p(e,t,s=!0,o={},r=!1){if(!n.env.allowLocalModels){if(o.local_files_only)throw Error("Invalid configuration detected: local models are disabled (`env.allowLocalModels=false`) but you have requested to only use local models (`local_files_only=true`).");if(!n.env.allowRemoteModels)throw Error("Invalid configuration detected: both local and remote models are disabled. Fix by setting `env.allowLocalModels` or `env.allowRemoteModels` to `true`.")}let i;if((0,a.dispatchCallback)(o.progress_callback,{status:"initiate",name:e,file:t}),!i&&n.env.useBrowserCache){if("undefined"==typeof caches)throw Error("Browser cache is not available in this environment.");try{i=await caches.open("transformers-cache")}catch(e){console.warn("An error occurred while opening the browser cache:",e)}}if(!i&&n.env.useFSCache&&(i=new m(o.cache_dir??n.env.cacheDir)),!i&&n.env.useCustomCache){if(!n.env.customCache)throw Error("`env.useCustomCache=true`, but `env.customCache` is not defined.");if(!n.env.customCache.match||!n.env.customCache.put)throw new Error("`env.customCache` must be an object which implements the `match` and `put` functions of the Web Cache API. For more information, see https://developer.mozilla.org/en-US/docs/Web/API/Cache");i=n.env.customCache}const l=o.revision??"main";let p,h,f=g(e,t),M=g(n.env.localModelPath,f),w=f,T=g(n.env.remoteHost,n.env.remotePathTemplate.replaceAll("{model}",e).replaceAll("{revision}",encodeURIComponent(l)),t),b="main"===l?f:g(e,l,t),x=i instanceof m?b:T,P=!1;i&&(h=await async function(e,...t){for(let s of t)try{let t=await e.match(s);if(t)return t}catch(e){continue}}(i,M,x));const k=void 0!==h;if(void 0===h){if(n.env.allowLocalModels){if(d(f,["http:","https:"])){if(o.local_files_only)throw new Error(`\`local_files_only=true\`, but attempted to load a remote file from: ${w}.`);if(!n.env.allowRemoteModels)throw new Error(`\`env.allowRemoteModels=false\`, but attempted to load a remote file from: ${w}.`)}else try{h=await u(w),p=w}catch(e){console.warn(`Unable to load from local path "${w}": "${e}"`)}}if(void 0===h||404===h.status){if(o.local_files_only||!n.env.allowRemoteModels){if(s)throw Error(`\`local_files_only=true\` or \`env.allowRemoteModels=false\` and file was not found locally at "${w}".`);return null}if(h=await u(T),200!==h.status)return function(e,t,s){if(!s)return null;const o=_[e]??`Error (${e}) occurred while trying to load file`;throw Error(`${o}: "${t}".`)}(h.status,T,s);p=x}P=i&&"undefined"!=typeof Response&&h instanceof Response&&200===h.status}let F;if((0,a.dispatchCallback)(o.progress_callback,{status:"download",name:e,file:t}),!n.apis.IS_NODE_ENV||!r){let s;o.progress_callback?k&&"undefined"!=typeof navigator&&/firefox/i.test(navigator.userAgent)?(s=new Uint8Array(await h.arrayBuffer()),(0,a.dispatchCallback)(o.progress_callback,{status:"progress",name:e,file:t,progress:100,loaded:s.length,total:s.length})):s=await async function(e,t){const s=e.headers.get("Content-Length");null===s&&console.warn("Unable to determine content-length from response headers. Will expand buffer when needed.");let o=parseInt(s??"0"),r=new Uint8Array(o),n=0;const a=e.body.getReader();async function i(){const{done:e,value:s}=await a.read();if(e)return;const l=n+s.length;if(l>o){o=l;const e=new Uint8Array(o);e.set(r),r=e}r.set(s,n),n=l;return t({progress:n/o*100,loaded:n,total:o}),i()}return await i(),r}(h,(s=>{(0,a.dispatchCallback)(o.progress_callback,{status:"progress",name:e,file:t,...s})})):s=new Uint8Array(await h.arrayBuffer()),F=s}if(P&&p&&void 0===await i.match(p)&&(F?await i.put(p,new Response(F,{headers:h.headers})).catch((e=>{console.warn(`Unable to add response to browser cache: ${e}.`)})):await i.put(p,h,o.progress_callback)),(0,a.dispatchCallback)(o.progress_callback,{status:"done",name:e,file:t}),F){if(r)throw new Error("Cannot return path in a browser environment.");return F}if(h instanceof c)return h.filePath;const y=await i.match(p);if(y instanceof c)return y.filePath;throw new Error("Unable to return path for response.")}async function h(e,t,s=!0,o={}){const r=await p(e,t,s,o,!1);if(null===r)return{};const n=new TextDecoder("utf-8").decode(r);return JSON.parse(n)}function g(...e){return(e=e.map(((t,s)=>(s&&(t=t.replace(new RegExp("^/"),"")),s!==e.length-1&&(t=t.replace(new RegExp("/$"),"")),t)))).join("/")}},"./src/utils/image.js":(e,t,s)=>{s.r(t),s.d(t,{RawImage:()=>p,load_image:()=>h});var o=s("./src/utils/core.js"),r=s("./src/utils/hub.js"),n=s("./src/env.js"),a=s("./src/utils/tensor.js"),i=s("sharp");let l,c,d;const u=n.apis.IS_BROWSER_ENV||n.apis.IS_WEBWORKER_ENV;if(u)l=(e,t)=>{if(!self.OffscreenCanvas)throw new Error("OffscreenCanvas not supported by this browser.");return new self.OffscreenCanvas(e,t)},d=self.createImageBitmap,c=self.ImageData;else{if(!i.default)throw new Error("Unable to load image processing library.");d=async e=>{const t=(await e.metadata()).channels,{data:s,info:o}=await e.rotate().raw().toBuffer({resolveWithObject:!0}),r=new p(new Uint8ClampedArray(s),o.width,o.height,o.channels);return void 0!==t&&t!==o.channels&&r.convert(t),r}}const _={0:"nearest",1:"lanczos",2:"bilinear",3:"bicubic",4:"box",5:"hamming"},m=new Map([["png","image/png"],["jpg","image/jpeg"],["jpeg","image/jpeg"],["gif","image/gif"]]);class p{constructor(e,t,s,o){this.data=e,this.width=t,this.height=s,this.channels=o}get size(){return[this.width,this.height]}static async read(e){if(e instanceof p)return e;if("string"==typeof e||e instanceof URL)return await this.fromURL(e);if(e instanceof Blob)return await this.fromBlob(e);if("undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas)return this.fromCanvas(e);throw new Error("Unsupported input type: "+typeof e)}static fromCanvas(e){if(!u)throw new Error("fromCanvas() is only supported in browser environments.");const t=e.getContext("2d").getImageData(0,0,e.width,e.height).data;return new p(t,e.width,e.height,4)}static async fromURL(e){const t=await(0,r.getFile)(e);if(200!==t.status)throw new Error(`Unable to read image from "${e}" (${t.status} ${t.statusText})`);const s=await t.blob();return this.fromBlob(s)}static async fromBlob(e){if(u){const t=await d(e),s=l(t.width,t.height).getContext("2d");return s.drawImage(t,0,0),new this(s.getImageData(0,0,t.width,t.height).data,t.width,t.height,4)}{const t=(0,i.default)(await e.arrayBuffer());return await d(t)}}static fromTensor(e,t="CHW"){if(3!==e.dims.length)throw new Error(`Tensor should have 3 dimensions, but has ${e.dims.length} dimensions.`);if("CHW"===t)e=e.transpose(1,2,0);else if("HWC"!==t)throw new Error(`Unsupported channel format: ${t}`);if(!(e.data instanceof Uint8ClampedArray||e.data instanceof Uint8Array))throw new Error(`Unsupported tensor type: ${e.type}`);switch(e.dims[2]){case 1:case 2:case 3:case 4:return new p(e.data,e.dims[1],e.dims[0],e.dims[2]);default:throw new Error(`Unsupported number of channels: ${e.dims[2]}`)}}grayscale(){if(1===this.channels)return this;const e=new Uint8ClampedArray(this.width*this.height*1);switch(this.channels){case 3:case 4:for(let t=0,s=0;t<this.data.length;t+=this.channels){const o=this.data[t],r=this.data[t+1],n=this.data[t+2];e[s++]=Math.round(.2989*o+.587*r+.114*n)}break;default:throw new Error(`Conversion failed due to unsupported number of channels: ${this.channels}`)}return this._update(e,this.width,this.height,1)}rgb(){if(3===this.channels)return this;const e=new Uint8ClampedArray(this.width*this.height*3);switch(this.channels){case 1:for(let t=0,s=0;t<this.data.length;++t)e[s++]=this.data[t],e[s++]=this.data[t],e[s++]=this.data[t];break;case 4:for(let t=0,s=0;t<this.data.length;t+=4)e[s++]=this.data[t],e[s++]=this.data[t+1],e[s++]=this.data[t+2];break;default:throw new Error(`Conversion failed due to unsupported number of channels: ${this.channels}`)}return this._update(e,this.width,this.height,3)}rgba(){if(4===this.channels)return this;const e=new Uint8ClampedArray(this.width*this.height*4);switch(this.channels){case 1:for(let t=0,s=0;t<this.data.length;++t)e[s++]=this.data[t],e[s++]=this.data[t],e[s++]=this.data[t],e[s++]=255;break;case 3:for(let t=0,s=0;t<this.data.length;t+=3)e[s++]=this.data[t],e[s++]=this.data[t+1],e[s++]=this.data[t+2],e[s++]=255;break;default:throw new Error(`Conversion failed due to unsupported number of channels: ${this.channels}`)}return this._update(e,this.width,this.height,4)}putAlpha(e){if(e.width!==this.width||e.height!==this.height)throw new Error(`Expected mask size to be ${this.width}x${this.height}, but got ${e.width}x${e.height}`);if(1!==e.channels)throw new Error(`Expected mask to have 1 channel, but got ${e.channels}`);const t=this.data,s=e.data,o=this.width*this.height;if(3===this.channels){const e=new Uint8ClampedArray(4*o);for(let r=0,n=0,a=0;r<o;++r)e[a++]=t[n++],e[a++]=t[n++],e[a++]=t[n++],e[a++]=s[r];return this._update(e,this.width,this.height,4)}if(4===this.channels){for(let e=0;e<o;++e)t[4*e+3]=s[e];return this}throw new Error(`Expected image to have 3 or 4 channels, but got ${this.channels}`)}async resize(e,t,{resample:s=2}={}){if(this.width===e&&this.height===t)return this;let r=_[s]??s;const n=(0,o.isNullishDimension)(e),a=(0,o.isNullishDimension)(t);if(n&&a)return this;if(n?e=t/this.height*this.width:a&&(t=e/this.width*this.height),u){const s=this.channels,o=this.toCanvas(),r=l(e,t).getContext("2d");r.drawImage(o,0,0,e,t);return new p(r.getImageData(0,0,e,t).data,e,t,4).convert(s)}{let s=this.toSharp();switch(r){case"box":case"hamming":"box"!==r&&"hamming"!==r||(console.warn(`Resampling method ${r} is not yet supported. Using bilinear instead.`),r="bilinear");case"nearest":case"bilinear":case"bicubic":s=s.affine([e/this.width,0,0,t/this.height],{interpolator:r});break;case"lanczos":s=s.resize({width:e,height:t,fit:"fill",kernel:"lanczos3"});break;default:throw new Error(`Resampling method ${r} is not supported.`)}return await d(s)}}async pad([e,t,s,o]){if(e=Math.max(e,0),t=Math.max(t,0),s=Math.max(s,0),o=Math.max(o,0),0===e&&0===t&&0===s&&0===o)return this;if(u){const r=this.channels,n=this.toCanvas(),a=this.width+e+t,i=this.height+s+o,c=l(a,i).getContext("2d");c.drawImage(n,0,0,this.width,this.height,e,s,this.width,this.height);return new p(c.getImageData(0,0,a,i).data,a,i,4).convert(r)}{const r=this.toSharp().extend({left:e,right:t,top:s,bottom:o});return await d(r)}}async crop([e,t,s,o]){if(e=Math.max(e,0),t=Math.max(t,0),s=Math.min(s,this.width-1),o=Math.min(o,this.height-1),0===e&&0===t&&s===this.width-1&&o===this.height-1)return this;const r=s-e+1,n=o-t+1;if(u){const s=this.channels,o=this.toCanvas(),a=l(r,n).getContext("2d");a.drawImage(o,e,t,r,n,0,0,r,n);return new p(a.getImageData(0,0,r,n).data,r,n,4).convert(s)}{const s=this.toSharp().extract({left:e,top:t,width:r,height:n});return await d(s)}}async center_crop(e,t){if(this.width===e&&this.height===t)return this;const s=(this.width-e)/2,o=(this.height-t)/2;if(u){const r=this.channels,n=this.toCanvas(),a=l(e,t).getContext("2d");let i=0,c=0,d=0,u=0;s>=0?i=s:d=-s,o>=0?c=o:u=-o,a.drawImage(n,i,c,e,t,d,u,e,t);return new p(a.getImageData(0,0,e,t).data,e,t,4).convert(r)}{let r=this.toSharp();if(s>=0&&o>=0)r=r.extract({left:Math.floor(s),top:Math.floor(o),width:e,height:t});else if(s<=0&&o<=0){const n=Math.floor(-o),a=Math.floor(-s);r=r.extend({top:n,left:a,right:e-this.width-a,bottom:t-this.height-n})}else{let n=[0,0],a=0;o<0?(n[0]=Math.floor(-o),n[1]=t-this.height-n[0]):a=Math.floor(o);let i=[0,0],l=0;s<0?(i[0]=Math.floor(-s),i[1]=e-this.width-i[0]):l=Math.floor(s),r=r.extend({top:n[0],bottom:n[1],left:i[0],right:i[1]}).extract({left:l,top:a,width:e,height:t})}return await d(r)}}async toBlob(e="image/png",t=1){if(!u)throw new Error("toBlob() is only supported in browser environments.");const s=this.toCanvas();return await s.convertToBlob({type:e,quality:t})}toTensor(e="CHW"){let t=new a.Tensor("uint8",new Uint8Array(this.data),[this.height,this.width,this.channels]);if("HWC"===e);else{if("CHW"!==e)throw new Error(`Unsupported channel format: ${e}`);t=t.permute(2,0,1)}return t}toCanvas(){if(!u)throw new Error("toCanvas() is only supported in browser environments.");const e=this.clone().rgba(),t=l(e.width,e.height),s=new c(e.data,e.width,e.height);return t.getContext("2d").putImageData(s,0,0),t}split(){const{data:e,width:t,height:s,channels:o}=this,r=e.constructor,n=e.length/o,a=Array.from({length:o},(()=>new r(n)));for(let t=0;t<n;++t){const s=o*t;for(let r=0;r<o;++r)a[r][t]=e[s+r]}return a.map((e=>new p(e,t,s,1)))}_update(e,t,s,o=null){return this.data=e,this.width=t,this.height=s,null!==o&&(this.channels=o),this}clone(){return new p(this.data.slice(),this.width,this.height,this.channels)}convert(e){if(this.channels===e)return this;switch(e){case 1:this.grayscale();break;case 3:this.rgb();break;case 4:this.rgba();break;default:throw new Error(`Conversion failed due to unsupported number of channels: ${this.channels}`)}return this}async save(e){if(!u){if(n.apis.IS_FS_AVAILABLE){const t=this.toSharp();return await t.toFile(e)}throw new Error("Unable to save the image because filesystem is disabled in this environment.")}{if(n.apis.IS_WEBWORKER_ENV)throw new Error("Unable to save an image from a Web Worker.");const t=e.split(".").pop().toLowerCase(),s=m.get(t)??"image/png",r=await this.toBlob(s);(0,o.saveBlob)(e,r)}}toSharp(){if(u)throw new Error("toSharp() is only supported in server-side environments.");return(0,i.default)(this.data,{raw:{width:this.width,height:this.height,channels:this.channels}})}}const h=p.read.bind(p)},"./src/utils/maths.js":(e,t,s)=>{function o(e,[t,s,o],[r,n],a="bilinear",i=!1){const l=n/o,c=r/s,d=new e.constructor(r*n*t),u=s*o,_=r*n;for(let a=0;a<r;++a)for(let r=0;r<n;++r){const i=a*n+r,m=(r+.5)/l-.5,p=(a+.5)/c-.5;let h=Math.floor(m),g=Math.floor(p);const f=Math.min(h+1,o-1),M=Math.min(g+1,s-1);h=Math.max(h,0),g=Math.max(g,0);const w=m-h,T=p-g,b=(1-w)*(1-T),x=w*(1-T),P=(1-w)*T,k=w*T,F=g*o,y=M*o,v=F+h,C=F+f,S=y+h,A=y+f;for(let s=0;s<t;++s){const t=s*u;d[s*_+i]=b*e[t+v]+x*e[t+C]+P*e[t+S]+k*e[t+A]}}return d}function r(e,t,s){const o=new Array(s.length),r=new Array(s.length);for(let e=s.length-1,n=1;e>=0;--e)r[e]=n,o[e]=t[s[e]],n*=o[e];const n=s.map(((e,t)=>r[s.indexOf(t)])),a=new e.constructor(e.length);for(let s=0;s<e.length;++s){let o=0;for(let e=t.length-1,r=s;e>=0;--e)o+=r%t[e]*n[e],r=Math.floor(r/t[e]);a[o]=e[s]}return[a,o]}function n(e){const t=u(e)[0],s=e.map((e=>Math.exp(e-t))),o=s.reduce(((e,t)=>e+t),0);return s.map((e=>e/o))}function a(e){const t=u(e)[0];let s=0;for(let o=0;o<e.length;++o)s+=Math.exp(e[o]-t);const o=Math.log(s);return e.map((e=>e-t-o))}function i(e,t){let s=0;for(let o=0;o<e.length;++o)s+=e[o]*t[o];return s}function l(e,t){return i(e,t)/(c(e)*c(t))}function c(e){return Math.sqrt(e.reduce(((e,t)=>e+t*t),0))}function d(e){if(0===e.length)throw Error("Array must not be empty");let t=e[0],s=0;for(let o=1;o<e.length;++o)e[o]<t&&(t=e[o],s=o);return[t,s]}function u(e){if(0===e.length)throw Error("Array must not be empty");let t=e[0],s=0;for(let o=1;o<e.length;++o)e[o]>t&&(t=e[o],s=o);return[t,s]}function _(e){return e>0&&!(e&e-1)}s.r(t),s.d(t,{FFT:()=>h,bankers_round:()=>M,cos_sim:()=>l,dot:()=>i,dynamic_time_warping:()=>w,interpolate_data:()=>o,log_softmax:()=>a,magnitude:()=>c,max:()=>u,medianFilter:()=>g,min:()=>d,permute_data:()=>r,round:()=>f,softmax:()=>n});class m{constructor(e){if(this.size=0|e,this.size<=1||!_(this.size))throw new Error("FFT size must be a power of two larger than 1");this._csize=e<<1,this.table=new Float64Array(2*this.size);for(let e=0;e<this.table.length;e+=2){const t=Math.PI*e/this.size;this.table[e]=Math.cos(t),this.table[e+1]=-Math.sin(t)}let t=0;for(let e=1;this.size>e;e<<=1)++t;this._width=t%2==0?t-1:t,this._bitrev=new Int32Array(1<<this._width);for(let e=0;e<this._bitrev.length;++e){this._bitrev[e]=0;for(let t=0;t<this._width;t+=2){const s=this._width-t-2;this._bitrev[e]|=(e>>>t&3)<<s}}}createComplexArray(){return new Float64Array(this._csize)}fromComplexArray(e,t){const s=t||new Array(e.length>>>1);for(let t=0;t<e.length;t+=2)s[t>>>1]=e[t];return s}toComplexArray(e,t){const s=t||this.createComplexArray();for(let t=0;t<s.length;t+=2)s[t]=e[t>>>1],s[t+1]=0;return s}transform(e,t){if(e===t)throw new Error("Input and output buffers must be different");this._transform4(e,t,1)}realTransform(e,t){if(e===t)throw new Error("Input and output buffers must be different");this._realTransform4(e,t,1)}inverseTransform(e,t){if(e===t)throw new Error("Input and output buffers must be different");this._transform4(e,t,-1);for(let t=0;t<e.length;++t)e[t]/=this.size}_transform4(e,t,s){const o=this._csize;let r,n,a=1<<this._width,i=o/a<<1;const l=this._bitrev;if(4===i)for(r=0,n=0;r<o;r+=i,++n){const s=l[n];this._singleTransform2(t,e,r,s,a)}else for(r=0,n=0;r<o;r+=i,++n){const o=l[n];this._singleTransform4(t,e,r,o,a,s)}const c=this.table;for(a>>=2;a>=2;a>>=2){i=o/a<<1;const t=i>>>2;for(r=0;r<o;r+=i){const o=r+t-1;for(let n=r,i=0;n<o;n+=2,i+=a){const o=n,r=o+t,a=r+t,l=a+t,d=e[o],u=e[o+1],_=e[r],m=e[r+1],p=e[a],h=e[a+1],g=e[l],f=e[l+1],M=c[i],w=s*c[i+1],T=_*M-m*w,b=_*w+m*M,x=c[2*i],P=s*c[2*i+1],k=p*x-h*P,F=p*P+h*x,y=c[3*i],v=s*c[3*i+1],C=g*y-f*v,S=g*v+f*y,A=d+k,E=u+F,L=d-k,I=u-F,z=T+C,V=b+S,j=s*(T-C),D=s*(b-S);e[o]=A+z,e[o+1]=E+V,e[r]=L+D,e[r+1]=I-j,e[a]=A-z,e[a+1]=E-V,e[l]=L-D,e[l+1]=I+j}}}}_singleTransform2(e,t,s,o,r){const n=e[o],a=e[o+1],i=e[o+r],l=e[o+r+1];t[s]=n+i,t[s+1]=a+l,t[s+2]=n-i,t[s+3]=a-l}_singleTransform4(e,t,s,o,r,n){const a=2*r,i=3*r,l=e[o],c=e[o+1],d=e[o+r],u=e[o+r+1],_=e[o+a],m=e[o+a+1],p=e[o+i],h=e[o+i+1],g=l+_,f=c+m,M=l-_,w=c-m,T=d+p,b=u+h,x=n*(d-p),P=n*(u-h);t[s]=g+T,t[s+1]=f+b,t[s+2]=M+P,t[s+3]=w-x,t[s+4]=g-T,t[s+5]=f-b,t[s+6]=M-P,t[s+7]=w+x}_realTransform4(e,t,s){const o=this._csize;let r,n,a=1<<this._width,i=o/a<<1;const l=this._bitrev;if(4===i)for(r=0,n=0;r<o;r+=i,++n){const s=l[n];this._singleRealTransform2(t,e,r,s>>>1,a>>>1)}else for(r=0,n=0;r<o;r+=i,++n){const o=l[n];this._singleRealTransform4(t,e,r,o>>>1,a>>>1,s)}const c=this.table;for(a>>=2;a>=2;a>>=2){i=o/a<<1;const t=i>>>1,n=t>>>1,l=n>>>1;for(r=0;r<o;r+=i)for(let o=0,i=0;o<=l;o+=2,i+=a){const a=r+o,d=a+n,u=d+n,_=u+n,m=e[a],p=e[a+1],h=e[d],g=e[d+1],f=e[u],M=e[u+1],w=e[_],T=e[_+1],b=m,x=p,P=c[i],k=s*c[i+1],F=h*P-g*k,y=h*k+g*P,v=c[2*i],C=s*c[2*i+1],S=f*v-M*C,A=f*C+M*v,E=c[3*i],L=s*c[3*i+1],I=w*E-T*L,z=w*L+T*E,V=b+S,j=x+A,D=b-S,N=x-A,O=F+I,B=y+z,G=s*(F-I),R=s*(y-z);if(e[a]=V+O,e[a+1]=j+B,e[d]=D+R,e[d+1]=N-G,0===o){e[u]=V-O,e[u+1]=j-B;continue}if(o===l)continue;const q=r+n-o,W=r+t-o;e[q]=D-s*R,e[q+1]=-N-s*G,e[W]=V-s*O,e[W+1]=s*B-j}}const d=o>>>1;for(let t=2;t<d;t+=2)e[o-t]=e[t],e[o-t+1]=-e[t+1]}_singleRealTransform2(e,t,s,o,r){const n=e[o],a=e[o+r];t[s]=n+a,t[s+1]=0,t[s+2]=n-a,t[s+3]=0}_singleRealTransform4(e,t,s,o,r,n){const a=2*r,i=3*r,l=e[o],c=e[o+r],d=e[o+a],u=e[o+i],_=l+d,m=l-d,p=c+u,h=n*(c-u);t[s]=_+p,t[s+1]=0,t[s+2]=m,t[s+3]=-h,t[s+4]=_-p,t[s+5]=0,t[s+6]=m,t[s+7]=h}}class p{constructor(e){const t=2*(e-1),s=2*(2*e-1),o=2**Math.ceil(Math.log2(s));this.bufferSize=o,this._a=t;const r=new Float64Array(s),n=new Float64Array(o);this._chirpBuffer=new Float64Array(o),this._buffer1=new Float64Array(o),this._buffer2=new Float64Array(o),this._outBuffer1=new Float64Array(o),this._outBuffer2=new Float64Array(o);const a=-2*Math.PI/e,i=Math.cos(a),l=Math.sin(a);for(let t=0;t<s>>1;++t){const s=(t+1-e)**2/2,o=Math.sqrt(i**2+l**2)**s,a=s*Math.atan2(l,i),c=2*t;r[c]=o*Math.cos(a),r[c+1]=o*Math.sin(a),n[c]=r[c],n[c+1]=-r[c+1]}this._slicedChirpBuffer=r.subarray(t,s),this._f=new m(o>>1),this._f.transform(this._chirpBuffer,n)}_transform(e,t,s){const o=this._buffer1,r=this._buffer2,n=this._outBuffer1,a=this._outBuffer2,i=this._chirpBuffer,l=this._slicedChirpBuffer,c=this._a;if(s)for(let e=0;e<l.length;e+=2){const s=e+1,r=t[e>>1];o[e]=r*l[e],o[s]=r*l[s]}else for(let e=0;e<l.length;e+=2){const s=e+1;o[e]=t[e]*l[e]-t[s]*l[s],o[s]=t[e]*l[s]+t[s]*l[e]}this._f.transform(n,o);for(let e=0;e<i.length;e+=2){const t=e+1;r[e]=n[e]*i[e]-n[t]*i[t],r[t]=n[e]*i[t]+n[t]*i[e]}this._f.inverseTransform(a,r);for(let t=0;t<a.length;t+=2){const s=a[t+c],o=a[t+c+1],r=l[t],n=l[t+1];e[t]=s*r-o*n,e[t+1]=s*n+o*r}}transform(e,t){this._transform(e,t,!1)}realTransform(e,t){this._transform(e,t,!0)}}class h{constructor(e){this.fft_length=e,this.isPowerOfTwo=_(e),this.isPowerOfTwo?(this.fft=new m(e),this.outputBufferSize=2*e):(this.fft=new p(e),this.outputBufferSize=this.fft.bufferSize)}realTransform(e,t){this.fft.realTransform(e,t)}transform(e,t){this.fft.transform(e,t)}}function g(e,t){if(t%2==0||t<=0)throw new Error("Window size must be a positive odd number");const s=new e.constructor(e.length),o=new e.constructor(t),r=Math.floor(t/2);for(let t=0;t<e.length;++t){let n=0;for(let s=-r;s<=r;++s){let r=t+s;r<0?r=Math.abs(r):r>=e.length&&(r=2*(e.length-1)-r),o[n++]=e[r]}o.sort(),s[t]=o[r]}return s}function f(e,t){const s=Math.pow(10,t);return Math.round(e*s)/s}function M(e){const t=Math.round(e);return Math.abs(e)%1==.5?t%2==0?t:t-1:t}function w(e){const t=e.length,s=e[0].length,o=[t+1,s+1],r=Array.from({length:o[0]},(()=>Array(o[1]).fill(1/0)));r[0][0]=0;const n=Array.from({length:o[0]},(()=>Array(o[1]).fill(-1)));for(let t=1;t<o[1];++t)for(let s=1;s<o[0];++s){const o=r[s-1][t-1],a=r[s-1][t],i=r[s][t-1];let l,c;o<a&&o<i?(l=o,c=0):a<o&&a<i?(l=a,c=1):(l=i,c=2),r[s][t]=e[s-1][t-1]+l,n[s][t]=c}for(let e=0;e<o[1];++e)n[0][e]=2;for(let e=0;e<o[0];++e)n[e][0]=1;let a=t,i=s,l=[],c=[];for(;a>0||i>0;)switch(l.push(a-1),c.push(i-1),n[a][i]){case 0:--a,--i;break;case 1:--a;break;case 2:--i;break;default:throw new Error(`Internal error in dynamic time warping. Unexpected trace[${a}, ${i}]. Please file a bug report.`)}return l.reverse(),c.reverse(),[l,c]}},"./src/utils/tensor.js":(e,t,s)=>{s.r(t),s.d(t,{DataTypeMap:()=>a,Tensor:()=>i,cat:()=>b,full:()=>v,full_like:()=>C,interpolate:()=>c,interpolate_4d:()=>d,layer_norm:()=>f,matmul:()=>u,mean:()=>F,mean_pooling:()=>g,ones:()=>S,ones_like:()=>A,permute:()=>l,quantize_embeddings:()=>z,rand:()=>I,rfft:()=>_,slice:()=>h,stack:()=>x,std_mean:()=>k,topk:()=>m,zeros:()=>E,zeros_like:()=>L});var o=s("./src/utils/maths.js"),r=s("./src/backends/onnx.js"),n=s("./src/ops/registry.js");const a=Object.freeze({float32:Float32Array,float16:"undefined"!=typeof Float16Array?Float16Array:Uint16Array,float64:Float64Array,string:Array,int8:Int8Array,uint8:Uint8Array,int16:Int16Array,uint16:Uint16Array,int32:Int32Array,uint32:Uint32Array,int64:BigInt64Array,uint64:BigUint64Array,bool:Uint8Array,uint4:Uint8Array,int4:Int8Array});class i{get dims(){return this.ort_tensor.dims}set dims(e){this.ort_tensor.dims=e}get type(){return this.ort_tensor.type}get data(){return this.ort_tensor.data}get size(){return this.ort_tensor.size}get location(){return this.ort_tensor.location}ort_tensor;constructor(...e){return(0,r.isONNXTensor)(e[0])?this.ort_tensor=e[0]:this.ort_tensor=new r.Tensor(e[0],e[1],e[2]),new Proxy(this,{get:(e,t)=>{if("string"==typeof t){let s=Number(t);if(Number.isInteger(s))return e._getitem(s)}return e[t]},set:(e,t,s)=>e[t]=s})}dispose(){this.ort_tensor.dispose()}*[Symbol.iterator](){const[e,...t]=this.dims;if(t.length>0){const s=t.reduce(((e,t)=>e*t));for(let o=0;o<e;++o)yield this._subarray(o,s,t)}else yield*this.data}_getitem(e){const[t,...s]=this.dims;if(e=T(e,t),s.length>0){const t=s.reduce(((e,t)=>e*t));return this._subarray(e,t,s)}return new i(this.type,[this.data[e]],s)}indexOf(e){const t=this.data;for(let s=0;s<t.length;++s)if(t[s]==e)return s;return-1}_subarray(e,t,s){const o=e*t,r=(e+1)*t,n="subarray"in this.data?this.data.subarray(o,r):this.data.slice(o,r);return new i(this.type,n,s)}item(){const e=this.data;if(1!==e.length)throw new Error(`a Tensor with ${e.length} elements cannot be converted to Scalar`);return e[0]}tolist(){return function(e,t){const s=e.length,o=t.reduce(((e,t)=>e*t));if(s!==o)throw Error(`cannot reshape array of size ${s} into shape (${t})`);let r=e;for(let e=t.length-1;e>=0;e--)r=r.reduce(((s,o)=>{let r=s[s.length-1];return r.length<t[e]?r.push(o):s.push([o]),s}),[[]]);return r[0]}(this.data,this.dims)}sigmoid(){return this.clone().sigmoid_()}sigmoid_(){const e=this.data;for(let t=0;t<e.length;++t)e[t]=1/(1+Math.exp(-e[t]));return this}map(e){return this.clone().map_(e)}map_(e){const t=this.data;for(let s=0;s<t.length;++s)t[s]=e(t[s],s,t);return this}mul(e){return this.clone().mul_(e)}mul_(e){const t=this.data;for(let s=0;s<t.length;++s)t[s]*=e;return this}div(e){return this.clone().div_(e)}div_(e){const t=this.data;for(let s=0;s<t.length;++s)t[s]/=e;return this}add(e){return this.clone().add_(e)}add_(e){const t=this.data;for(let s=0;s<t.length;++s)t[s]+=e;return this}sub(e){return this.clone().sub_(e)}sub_(e){const t=this.data;for(let s=0;s<t.length;++s)t[s]-=e;return this}clone(){return new i(this.type,this.data.slice(),this.dims.slice())}slice(...e){const t=[],s=[];for(let o=0;o<this.dims.length;++o){let r=e[o];if(null==r)s.push([0,this.dims[o]]),t.push(this.dims[o]);else if("number"==typeof r)r=T(r,this.dims[o],o),s.push([r,r+1]);else{if(!Array.isArray(r)||2!==r.length)throw new Error(`Invalid slice: ${r}`);{let[e,n]=r;if(e=null===e?0:T(e,this.dims[o],o,!1),n=null===n?this.dims[o]:T(n,this.dims[o],o,!1),e>n)throw new Error(`Invalid slice: ${r}`);const a=[Math.max(e,0),Math.min(n,this.dims[o])];s.push(a),t.push(a[1]-a[0])}}}const o=s.map((([e,t])=>t-e)),r=o.reduce(((e,t)=>e*t)),n=this.data,a=new n.constructor(r),l=this.stride();for(let e=0;e<r;++e){let t=0;for(let r=o.length-1,n=e;r>=0;--r){const e=o[r];t+=(n%e+s[r][0])*l[r],n=Math.floor(n/e)}a[e]=n[t]}return new i(this.type,a,t)}permute(...e){return l(this,e)}transpose(...e){return this.permute(...e)}sum(e=null,t=!1){return this.norm(1,e,t)}norm(e="fro",t=null,s=!1){if("fro"===e)e=2;else if("string"==typeof e)throw Error(`Unsupported norm: ${e}`);const o=this.data,r=(t,s)=>t+s**e;if(null===t){const t=o.reduce(r,0)**(1/e);return new i(this.type,[t],[])}const[n,a,l]=P(r,this,t,s);if(1!==e)for(let t=0;t<a.length;++t)a[t]=a[t]**(1/e);return new i(n,a,l)}normalize_(e=2,t=1){t=T(t,this.dims.length);const s=this.norm(e,t,!0),o=this.data,r=s.data;for(let e=0;e<o.length;++e){let s=0;for(let o=this.dims.length-1,r=e,n=1;o>=0;--o){const e=this.dims[o];if(o!==t){s+=r%e*n,n*=this.dims[o]}r=Math.floor(r/e)}o[e]/=r[s]}return this}normalize(e=2,t=1){return this.clone().normalize_(e,t)}stride(){return function(e){const t=new Array(e.length);for(let s=e.length-1,o=1;s>=0;--s)t[s]=o,o*=e[s];return t}(this.dims)}squeeze(e=null){return new i(this.type,this.data,M(this.dims,e))}squeeze_(e=null){return this.dims=M(this.dims,e),this}unsqueeze(e=null){return new i(this.type,this.data,w(this.dims,e))}unsqueeze_(e=null){return this.dims=w(this.dims,e),this}flatten_(e=0,t=-1){t=(t+this.dims.length)%this.dims.length;let s=this.dims.slice(0,e),o=this.dims.slice(e,t+1),r=this.dims.slice(t+1);return this.dims=[...s,o.reduce(((e,t)=>e*t),1),...r],this}flatten(e=0,t=-1){return this.clone().flatten_(e,t)}view(...e){let t=-1;for(let s=0;s<e.length;++s)if(-1===e[s]){if(-1!==t)throw new Error("Only one dimension can be inferred");t=s}const s=this.data;if(-1!==t){const o=e.reduce(((e,s,o)=>o!==t?e*s:e),1);e[t]=s.length/o}return new i(this.type,s,e)}neg_(){const e=this.data;for(let t=0;t<e.length;++t)e[t]=-e[t];return this}neg(){return this.clone().neg_()}gt(e){const t=new Uint8Array(this.data.length),s=this.data;for(let o=0;o<s.length;++o)t[o]=s[o]>e?1:0;return new i("bool",t,this.dims)}lt(e){const t=new Uint8Array(this.data.length),s=this.data;for(let o=0;o<s.length;++o)t[o]=s[o]<e?1:0;return new i("bool",t,this.dims)}clamp_(e,t){const s=this.data;for(let o=0;o<s.length;++o)s[o]=Math.min(Math.max(s[o],e),t);return this}clamp(e,t){return this.clone().clamp_(e,t)}round_(){const e=this.data;for(let t=0;t<e.length;++t)e[t]=Math.round(e[t]);return this}round(){return this.clone().round_()}mean(e=null,t=!1){return F(this,e,t)}min(e=null,t=!1){if(null===e){const e=(0,o.min)(this.data)[0];return new i(this.type,[e],[])}const[s,r,n]=P(((e,t)=>Math.min(e,t)),this,e,t,1/0);return new i(s,r,n)}max(e=null,t=!1){if(null===e){const e=(0,o.max)(this.data)[0];return new i(this.type,[e],[])}const[s,r,n]=P(((e,t)=>Math.max(e,t)),this,e,t,-1/0);return new i(s,r,n)}argmin(e=null,t=!1){if(null!==e)throw new Error("`dim !== null` not yet implemented.");const s=(0,o.min)(this.data)[1];return new i("int64",[BigInt(s)],[])}argmax(e=null,t=!1){if(null!==e)throw new Error("`dim !== null` not yet implemented.");const s=(0,o.max)(this.data)[1];return new i("int64",[BigInt(s)],[])}to(e){if(this.type===e)return this;if(!a.hasOwnProperty(e))throw new Error(`Unsupported type: ${e}`);let t;const s=["int64","uint64"].includes(this.type),o=["int64","uint64"].includes(e);return s&&!o?t=Number:!s&&o&&(t=BigInt),new i(e,a[e].from(this.data,t),this.dims)}}function l(e,t){const[s,r]=(0,o.permute_data)(e.data,e.dims,t);return new i(e.type,s,r)}function c(e,[t,s],r="bilinear",n=!1){const a=e.dims.at(-3)??1,l=e.dims.at(-2),c=e.dims.at(-1);let d=(0,o.interpolate_data)(e.data,[a,l,c],[t,s],r,n);return new i(e.type,d,[a,t,s])}async function d(e,{size:t=null,mode:s="bilinear"}={}){if(4!==e.dims.length)throw new Error("`interpolate_4d` currently only supports 4D input.");if(!t)throw new Error("`interpolate_4d` requires a `size` argument.");let o,r;if(2===t.length)o=[...e.dims.slice(0,2),...t];else if(3===t.length)o=[e.dims[0],...t];else{if(4!==t.length)throw new Error("`size` must be of length 2, 3, or 4.");o=t}if("nearest"===s)r=await n.TensorOpRegistry.nearest_interpolate_4d;else if("bilinear"===s)r=await n.TensorOpRegistry.bilinear_interpolate_4d;else{if("bicubic"!==s)throw new Error(`Unsupported mode: ${s}`);r=await n.TensorOpRegistry.bicubic_interpolate_4d}const a=new i("int64",new BigInt64Array(o.map(BigInt)),[o.length]);return await r({x:e,s:a})}async function u(e,t){const s=await n.TensorOpRegistry.matmul;return await s({a:e,b:t})}async function _(e,t){const s=await n.TensorOpRegistry.rfft;return await s({x:e,a:t})}async function m(e,t){const s=await n.TensorOpRegistry.top_k;return t=null==t?e.dims.at(-1):Math.min(t,e.dims.at(-1)),await s({x:e,k:new i("int64",[BigInt(t)],[1])})}const p=e=>new i("int64",e,[e.length]);async function h(e,t,s,o,r){const a=await n.TensorOpRegistry.slice;return await a({x:e,s:p(t),e:p(s),a:p(o),t:p(r??new Array(o.length).fill(1))})}function g(e,t){const s=e.data,o=t.data,r=[e.dims[0],e.dims[2]],n=new s.constructor(r[0]*r[1]),[a,l,c]=e.dims;let d=0;for(let e=0;e<a;++e){const t=e*c*l;for(let r=0;r<c;++r){let a=0,i=0;const u=e*l,_=t+r;for(let e=0;e<l;++e){const t=Number(o[u+e]);i+=t,a+=s[_+e*c]*t}const m=a/i;n[d++]=m}}return new i(e.type,n,r)}function f(e,t,{eps:s=1e-5}={}){if(2!==e.dims.length)throw new Error("`layer_norm` currently only supports 2D input.");const[o,r]=e.dims;if(1!==t.length&&t[0]!==r)throw new Error("`normalized_shape` must be a 1D array with shape `[input.dims[1]]`.");const[n,a]=k(e,1,0,!0),l=n.data,c=a.data,d=e.data,u=new d.constructor(d.length);for(let e=0;e<o;++e){const t=e*r;for(let o=0;o<r;++o){const r=t+o;u[r]=(d[r]-c[e])/(l[e]+s)}}return new i(e.type,u,e.dims)}function M(e,t){return e=e.slice(),null===t?e=e.filter((e=>1!==e)):"number"==typeof t?1===e[t]&&e.splice(t,1):Array.isArray(t)&&(e=e.filter(((e,s)=>1!==e||!t.includes(s)))),e}function w(e,t){return t=T(t,e.length+1),(e=e.slice()).splice(t,0,1),e}function T(e,t,s=null,o=!0){if(e<-t||e>=t){if(o)throw new Error(`IndexError: index ${e} is out of bounds for dimension${null===s?"":" "+s} with size ${t}`);return e<-t?0:t}return e<0&&(e=(e%t+t)%t),e}function b(e,t=0){t=T(t,e[0].dims.length);const s=e[0].dims.slice();s[t]=e.reduce(((e,s)=>e+s.dims[t]),0);const o=s.reduce(((e,t)=>e*t),1),r=new e[0].data.constructor(o),n=e[0].type;if(0===t){let t=0;for(const s of e){const e=s.data;r.set(e,t),t+=e.length}}else{let o=0;for(let n=0;n<e.length;++n){const{data:a,dims:i}=e[n];for(let e=0;e<a.length;++e){let n=0;for(let r=i.length-1,a=e,l=1;r>=0;--r){const e=i[r];let c=a%e;r===t&&(c+=o),n+=c*l,l*=s[r],a=Math.floor(a/e)}r[n]=a[e]}o+=i[t]}}return new i(n,r,s)}function x(e,t=0){return b(e.map((e=>e.unsqueeze(t))),t)}function P(e,t,s=null,o=!1,r=null){const n=t.data,a=t.dims;s=T(s,a.length);const i=a.slice();i[s]=1;const l=new n.constructor(n.length/a[s]);null!==r&&l.fill(r);for(let t=0;t<n.length;++t){let o=0;for(let e=a.length-1,r=t,n=1;e>=0;--e){const t=a[e];if(e!==s){o+=r%t*n,n*=i[e]}r=Math.floor(r/t)}l[o]=e(l[o],n[t],t,o)}return o||i.splice(s,1),[t.type,l,i]}function k(e,t=null,s=1,o=!1){const r=e.data,n=e.dims;if(null===t){const t=r.reduce(((e,t)=>e+t),0)/r.length,o=Math.sqrt(r.reduce(((e,s)=>e+(s-t)**2),0)/(r.length-s)),n=new i(e.type,[t],[]);return[new i(e.type,[o],[]),n]}const a=F(e,t=T(t,n.length),o),l=a.data,[c,d,u]=P(((e,t,s,o)=>e+(t-l[o])**2),e,t,o);for(let e=0;e<d.length;++e)d[e]=Math.sqrt(d[e]/(n[t]-s));return[new i(c,d,u),a]}function F(e,t=null,s=!1){const o=e.dims,r=e.data;if(null===t){const t=r.reduce(((e,t)=>e+t),0);return new i(e.type,[t/r.length],[])}t=T(t,o.length);const[n,a,l]=P(((e,t)=>e+t),e,t,s);if(1!==o[t])for(let e=0;e<a.length;++e)a[e]/=o[t];return new i(n,a,l)}function y(e,t,s,o){const r=e.reduce(((e,t)=>e*t),1);return new i(s,new o(r).fill(t),e)}function v(e,t){let s,o;if("number"==typeof t)s="float32",o=Float32Array;else if("bigint"==typeof t)s="int64",o=BigInt64Array;else{if("boolean"!=typeof t)throw new Error("Unsupported data type: "+typeof t);s="bool",o=Uint8Array}return y(e,t,s,o)}function C(e,t){return v(e.dims,t)}function S(e){return y(e,1n,"int64",BigInt64Array)}function A(e){return S(e.dims)}function E(e){return y(e,0n,"int64",BigInt64Array)}function L(e){return E(e.dims)}function I(e){const t=e.reduce(((e,t)=>e*t),1);return new i("float32",Float32Array.from({length:t},(()=>Math.random())),e)}function z(e,t){if(2!==e.dims.length)throw new Error("The tensor must have 2 dimensions");if(e.dims.at(-1)%8!=0)throw new Error("The last dimension of the tensor must be a multiple of 8");if(!["binary","ubinary"].includes(t))throw new Error("The precision must be either 'binary' or 'ubinary'");const s="binary"===t,o=s?"int8":"uint8",r=s?Int8Array:Uint8Array,n=e.data,a=new r(n.length/8);for(let e=0;e<n.length;++e){const t=n[e]>0?1:0,o=Math.floor(e/8),r=e%8;a[o]|=t<<7-r,s&&0===r&&(a[o]-=128)}return new i(o,a,[e.dims[0],e.dims[1]/8])}},"./src/utils/video.js":(e,t,s)=>{s.r(t),s.d(t,{RawVideo:()=>a,RawVideoFrame:()=>n,load_video:()=>i});var o=s("./src/utils/image.js"),r=s("./src/env.js");class n{constructor(e,t){this.image=e,this.timestamp=t}}class a{constructor(e,t){e.length>0&&e[0]instanceof o.RawImage&&(e=e.map(((s,o)=>new n(s,(o+1)/(e.length+1)*t)))),this.frames=e,this.duration=t}get width(){return this.frames[0].image.width}get height(){return this.frames[0].image.height}get fps(){return this.frames.length/this.duration}}async function i(e,{num_frames:t=null,fps:s=null}={}){if(!r.apis.IS_BROWSER_ENV)throw new Error("`load_video` is currently only supported in browser environments.");if(null==t&&null==s)throw new Error("Either num_frames or fps must be provided.");const i=[],l=document.createElement("video");if(l.crossOrigin="anonymous",l.muted=!0,"string"==typeof e)l.src=e;else if(e instanceof Blob)l.src=URL.createObjectURL(e);else{if(!(e instanceof HTMLVideoElement))throw new Error("Invalid URL or video element provided.");l.src=e.src}if(await new Promise((e=>l.onloadedmetadata=e)),l.seekable.start(0)===l.seekable.end(0)){const e=await fetch(l.src),t=await e.blob();l.src=URL.createObjectURL(t),await new Promise((e=>l.onloadedmetadata=e))}const c=l.duration;let d,u;null!=t?(d=t,u=1===t?0:c/(t-1)):(u=1/s,d=Math.floor(c/u));let _=[];for(let e=0;e<d;++e)_.push(1===t?c/2:e*u);const m=document.createElement("canvas");m.width=l.videoWidth,m.height=l.videoHeight;const p=m.getContext("2d",{willReadFrequently:!0});for(const e of _){l.currentTime=e,await new Promise((e=>{l.onseeked=e})),p.drawImage(l,0,0,m.width,m.height);const t=p.getImageData(0,0,m.width,m.height),s=new o.RawImage(t.data,m.width,m.height,4),r=new n(s,e);i.push(r)}return l.remove(),new a(i,c)}}},c={};function d(e){var t=c[e];if(void 0!==t)return t.exports;var s=c[e]={exports:{}};return l[e](s,s.exports,d),s.exports}i=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,d.t=function(e,t){if(1&t&&(e=this(e)),8&t)return e;if("object"==typeof e&&e){if(4&t&&e.__esModule)return e;if(16&t&&"function"==typeof e.then)return e}var s=Object.create(null);d.r(s);var o={};a=a||[null,i({}),i([]),i(i)];for(var r=2&t&&e;"object"==typeof r&&!~a.indexOf(r);r=i(r))Object.getOwnPropertyNames(r).forEach((t=>o[t]=()=>e[t]));return o.default=()=>e,d.d(s,o),s},d.d=(e,t)=>{for(var s in t)d.o(t,s)&&!d.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},d.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),d.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var u={};(()=>{d.r(u),d.d(u,{ASTFeatureExtractor:()=>m.ASTFeatureExtractor,ASTForAudioClassification:()=>s.ASTForAudioClassification,ASTModel:()=>s.ASTModel,ASTPreTrainedModel:()=>s.ASTPreTrainedModel,AlbertForMaskedLM:()=>s.AlbertForMaskedLM,AlbertForQuestionAnswering:()=>s.AlbertForQuestionAnswering,AlbertForSequenceClassification:()=>s.AlbertForSequenceClassification,AlbertModel:()=>s.AlbertModel,AlbertPreTrainedModel:()=>s.AlbertPreTrainedModel,AlbertTokenizer:()=>o.AlbertTokenizer,AudioClassificationPipeline:()=>t.AudioClassificationPipeline,AutoConfig:()=>r.AutoConfig,AutoFeatureExtractor:()=>p.AutoFeatureExtractor,AutoImageProcessor:()=>f.AutoImageProcessor,AutoModel:()=>s.AutoModel,AutoModelForAudioClassification:()=>s.AutoModelForAudioClassification,AutoModelForAudioFrameClassification:()=>s.AutoModelForAudioFrameClassification,AutoModelForAudioTextToText:()=>s.AutoModelForAudioTextToText,AutoModelForCTC:()=>s.AutoModelForCTC,AutoModelForCausalLM:()=>s.AutoModelForCausalLM,AutoModelForDepthEstimation:()=>s.AutoModelForDepthEstimation,AutoModelForDocumentQuestionAnswering:()=>s.AutoModelForDocumentQuestionAnswering,AutoModelForImageClassification:()=>s.AutoModelForImageClassification,AutoModelForImageFeatureExtraction:()=>s.AutoModelForImageFeatureExtraction,AutoModelForImageMatting:()=>s.AutoModelForImageMatting,AutoModelForImageSegmentation:()=>s.AutoModelForImageSegmentation,AutoModelForImageTextToText:()=>s.AutoModelForImageTextToText,AutoModelForImageToImage:()=>s.AutoModelForImageToImage,AutoModelForMaskGeneration:()=>s.AutoModelForMaskGeneration,AutoModelForMaskedLM:()=>s.AutoModelForMaskedLM,AutoModelForNormalEstimation:()=>s.AutoModelForNormalEstimation,AutoModelForObjectDetection:()=>s.AutoModelForObjectDetection,AutoModelForPoseEstimation:()=>s.AutoModelForPoseEstimation,AutoModelForQuestionAnswering:()=>s.AutoModelForQuestionAnswering,AutoModelForSemanticSegmentation:()=>s.AutoModelForSemanticSegmentation,AutoModelForSeq2SeqLM:()=>s.AutoModelForSeq2SeqLM,AutoModelForSequenceClassification:()=>s.AutoModelForSequenceClassification,AutoModelForSpeechSeq2Seq:()=>s.AutoModelForSpeechSeq2Seq,AutoModelForTextToSpectrogram:()=>s.AutoModelForTextToSpectrogram,AutoModelForTextToWaveform:()=>s.AutoModelForTextToWaveform,AutoModelForTokenClassification:()=>s.AutoModelForTokenClassification,AutoModelForUniversalSegmentation:()=>s.AutoModelForUniversalSegmentation,AutoModelForVision2Seq:()=>s.AutoModelForVision2Seq,AutoModelForXVector:()=>s.AutoModelForXVector,AutoModelForZeroShotObjectDetection:()=>s.AutoModelForZeroShotObjectDetection,AutoProcessor:()=>T.AutoProcessor,AutoTokenizer:()=>o.AutoTokenizer,AutomaticSpeechRecognitionPipeline:()=>t.AutomaticSpeechRecognitionPipeline,BackgroundRemovalPipeline:()=>t.BackgroundRemovalPipeline,BartForConditionalGeneration:()=>s.BartForConditionalGeneration,BartForSequenceClassification:()=>s.BartForSequenceClassification,BartModel:()=>s.BartModel,BartPretrainedModel:()=>s.BartPretrainedModel,BartTokenizer:()=>o.BartTokenizer,BaseModelOutput:()=>s.BaseModelOutput,BaseStreamer:()=>b.BaseStreamer,BeitFeatureExtractor:()=>g.BeitFeatureExtractor,BeitForImageClassification:()=>s.BeitForImageClassification,BeitModel:()=>s.BeitModel,BeitPreTrainedModel:()=>s.BeitPreTrainedModel,BertForMaskedLM:()=>s.BertForMaskedLM,BertForQuestionAnswering:()=>s.BertForQuestionAnswering,BertForSequenceClassification:()=>s.BertForSequenceClassification,BertForTokenClassification:()=>s.BertForTokenClassification,BertModel:()=>s.BertModel,BertPreTrainedModel:()=>s.BertPreTrainedModel,BertTokenizer:()=>o.BertTokenizer,BitImageProcessor:()=>g.BitImageProcessor,BlenderbotForConditionalGeneration:()=>s.BlenderbotForConditionalGeneration,BlenderbotModel:()=>s.BlenderbotModel,BlenderbotPreTrainedModel:()=>s.BlenderbotPreTrainedModel,BlenderbotSmallForConditionalGeneration:()=>s.BlenderbotSmallForConditionalGeneration,BlenderbotSmallModel:()=>s.BlenderbotSmallModel,BlenderbotSmallPreTrainedModel:()=>s.BlenderbotSmallPreTrainedModel,BlenderbotSmallTokenizer:()=>o.BlenderbotSmallTokenizer,BlenderbotTokenizer:()=>o.BlenderbotTokenizer,BloomForCausalLM:()=>s.BloomForCausalLM,BloomModel:()=>s.BloomModel,BloomPreTrainedModel:()=>s.BloomPreTrainedModel,BloomTokenizer:()=>o.BloomTokenizer,CLIPFeatureExtractor:()=>g.CLIPFeatureExtractor,CLIPImageProcessor:()=>g.CLIPImageProcessor,CLIPModel:()=>s.CLIPModel,CLIPPreTrainedModel:()=>s.CLIPPreTrainedModel,CLIPSegForImageSegmentation:()=>s.CLIPSegForImageSegmentation,CLIPSegModel:()=>s.CLIPSegModel,CLIPSegPreTrainedModel:()=>s.CLIPSegPreTrainedModel,CLIPTextModel:()=>s.CLIPTextModel,CLIPTextModelWithProjection:()=>s.CLIPTextModelWithProjection,CLIPTokenizer:()=>o.CLIPTokenizer,CLIPVisionModel:()=>s.CLIPVisionModel,CLIPVisionModelWithProjection:()=>s.CLIPVisionModelWithProjection,CamembertForMaskedLM:()=>s.CamembertForMaskedLM,CamembertForQuestionAnswering:()=>s.CamembertForQuestionAnswering,CamembertForSequenceClassification:()=>s.CamembertForSequenceClassification,CamembertForTokenClassification:()=>s.CamembertForTokenClassification,CamembertModel:()=>s.CamembertModel,CamembertPreTrainedModel:()=>s.CamembertPreTrainedModel,CamembertTokenizer:()=>o.CamembertTokenizer,CausalLMOutput:()=>s.CausalLMOutput,CausalLMOutputWithPast:()=>s.CausalLMOutputWithPast,ChineseCLIPFeatureExtractor:()=>g.ChineseCLIPFeatureExtractor,ChineseCLIPModel:()=>s.ChineseCLIPModel,ChineseCLIPPreTrainedModel:()=>s.ChineseCLIPPreTrainedModel,ClapAudioModelWithProjection:()=>s.ClapAudioModelWithProjection,ClapFeatureExtractor:()=>m.ClapFeatureExtractor,ClapModel:()=>s.ClapModel,ClapPreTrainedModel:()=>s.ClapPreTrainedModel,ClapTextModelWithProjection:()=>s.ClapTextModelWithProjection,ClassifierFreeGuidanceLogitsProcessor:()=>P.ClassifierFreeGuidanceLogitsProcessor,CodeGenForCausalLM:()=>s.CodeGenForCausalLM,CodeGenModel:()=>s.CodeGenModel,CodeGenPreTrainedModel:()=>s.CodeGenPreTrainedModel,CodeGenTokenizer:()=>o.CodeGenTokenizer,CodeLlamaTokenizer:()=>o.CodeLlamaTokenizer,CohereForCausalLM:()=>s.CohereForCausalLM,CohereModel:()=>s.CohereModel,CoherePreTrainedModel:()=>s.CoherePreTrainedModel,CohereTokenizer:()=>o.CohereTokenizer,ConvBertForMaskedLM:()=>s.ConvBertForMaskedLM,ConvBertForQuestionAnswering:()=>s.ConvBertForQuestionAnswering,ConvBertForSequenceClassification:()=>s.ConvBertForSequenceClassification,ConvBertForTokenClassification:()=>s.ConvBertForTokenClassification,ConvBertModel:()=>s.ConvBertModel,ConvBertPreTrainedModel:()=>s.ConvBertPreTrainedModel,ConvBertTokenizer:()=>o.ConvBertTokenizer,ConvNextFeatureExtractor:()=>g.ConvNextFeatureExtractor,ConvNextForImageClassification:()=>s.ConvNextForImageClassification,ConvNextImageProcessor:()=>g.ConvNextImageProcessor,ConvNextModel:()=>s.ConvNextModel,ConvNextPreTrainedModel:()=>s.ConvNextPreTrainedModel,ConvNextV2ForImageClassification:()=>s.ConvNextV2ForImageClassification,ConvNextV2Model:()=>s.ConvNextV2Model,ConvNextV2PreTrainedModel:()=>s.ConvNextV2PreTrainedModel,DPTFeatureExtractor:()=>g.DPTFeatureExtractor,DPTForDepthEstimation:()=>s.DPTForDepthEstimation,DPTImageProcessor:()=>g.DPTImageProcessor,DPTModel:()=>s.DPTModel,DPTPreTrainedModel:()=>s.DPTPreTrainedModel,DacDecoderModel:()=>s.DacDecoderModel,DacDecoderOutput:()=>s.DacDecoderOutput,DacEncoderModel:()=>s.DacEncoderModel,DacEncoderOutput:()=>s.DacEncoderOutput,DacFeatureExtractor:()=>m.DacFeatureExtractor,DacModel:()=>s.DacModel,DacPreTrainedModel:()=>s.DacPreTrainedModel,DataTypeMap:()=>l.DataTypeMap,DebertaForMaskedLM:()=>s.DebertaForMaskedLM,DebertaForQuestionAnswering:()=>s.DebertaForQuestionAnswering,DebertaForSequenceClassification:()=>s.DebertaForSequenceClassification,DebertaForTokenClassification:()=>s.DebertaForTokenClassification,DebertaModel:()=>s.DebertaModel,DebertaPreTrainedModel:()=>s.DebertaPreTrainedModel,DebertaTokenizer:()=>o.DebertaTokenizer,DebertaV2ForMaskedLM:()=>s.DebertaV2ForMaskedLM,DebertaV2ForQuestionAnswering:()=>s.DebertaV2ForQuestionAnswering,DebertaV2ForSequenceClassification:()=>s.DebertaV2ForSequenceClassification,DebertaV2ForTokenClassification:()=>s.DebertaV2ForTokenClassification,DebertaV2Model:()=>s.DebertaV2Model,DebertaV2PreTrainedModel:()=>s.DebertaV2PreTrainedModel,DebertaV2Tokenizer:()=>o.DebertaV2Tokenizer,DecisionTransformerModel:()=>s.DecisionTransformerModel,DecisionTransformerPreTrainedModel:()=>s.DecisionTransformerPreTrainedModel,DeiTFeatureExtractor:()=>g.DeiTFeatureExtractor,DeiTForImageClassification:()=>s.DeiTForImageClassification,DeiTImageProcessor:()=>g.DeiTImageProcessor,DeiTModel:()=>s.DeiTModel,DeiTPreTrainedModel:()=>s.DeiTPreTrainedModel,DepthAnythingForDepthEstimation:()=>s.DepthAnythingForDepthEstimation,DepthAnythingPreTrainedModel:()=>s.DepthAnythingPreTrainedModel,DepthEstimationPipeline:()=>t.DepthEstimationPipeline,DepthProForDepthEstimation:()=>s.DepthProForDepthEstimation,DepthProPreTrainedModel:()=>s.DepthProPreTrainedModel,DetrFeatureExtractor:()=>g.DetrFeatureExtractor,DetrForObjectDetection:()=>s.DetrForObjectDetection,DetrForSegmentation:()=>s.DetrForSegmentation,DetrImageProcessor:()=>g.DetrImageProcessor,DetrModel:()=>s.DetrModel,DetrObjectDetectionOutput:()=>s.DetrObjectDetectionOutput,DetrPreTrainedModel:()=>s.DetrPreTrainedModel,DetrSegmentationOutput:()=>s.DetrSegmentationOutput,Dinov2ForImageClassification:()=>s.Dinov2ForImageClassification,Dinov2Model:()=>s.Dinov2Model,Dinov2PreTrainedModel:()=>s.Dinov2PreTrainedModel,Dinov2WithRegistersForImageClassification:()=>s.Dinov2WithRegistersForImageClassification,Dinov2WithRegistersModel:()=>s.Dinov2WithRegistersModel,Dinov2WithRegistersPreTrainedModel:()=>s.Dinov2WithRegistersPreTrainedModel,DistilBertForMaskedLM:()=>s.DistilBertForMaskedLM,DistilBertForQuestionAnswering:()=>s.DistilBertForQuestionAnswering,DistilBertForSequenceClassification:()=>s.DistilBertForSequenceClassification,DistilBertForTokenClassification:()=>s.DistilBertForTokenClassification,DistilBertModel:()=>s.DistilBertModel,DistilBertPreTrainedModel:()=>s.DistilBertPreTrainedModel,DistilBertTokenizer:()=>o.DistilBertTokenizer,DocumentQuestionAnsweringPipeline:()=>t.DocumentQuestionAnsweringPipeline,DonutFeatureExtractor:()=>g.DonutFeatureExtractor,DonutImageProcessor:()=>g.DonutImageProcessor,DonutSwinModel:()=>s.DonutSwinModel,DonutSwinPreTrainedModel:()=>s.DonutSwinPreTrainedModel,EfficientNetForImageClassification:()=>s.EfficientNetForImageClassification,EfficientNetImageProcessor:()=>g.EfficientNetImageProcessor,EfficientNetModel:()=>s.EfficientNetModel,EfficientNetPreTrainedModel:()=>s.EfficientNetPreTrainedModel,ElectraForMaskedLM:()=>s.ElectraForMaskedLM,ElectraForQuestionAnswering:()=>s.ElectraForQuestionAnswering,ElectraForSequenceClassification:()=>s.ElectraForSequenceClassification,ElectraForTokenClassification:()=>s.ElectraForTokenClassification,ElectraModel:()=>s.ElectraModel,ElectraPreTrainedModel:()=>s.ElectraPreTrainedModel,ElectraTokenizer:()=>o.ElectraTokenizer,EncodecFeatureExtractor:()=>m.EncodecFeatureExtractor,EosTokenCriteria:()=>x.EosTokenCriteria,EsmForMaskedLM:()=>s.EsmForMaskedLM,EsmForSequenceClassification:()=>s.EsmForSequenceClassification,EsmForTokenClassification:()=>s.EsmForTokenClassification,EsmModel:()=>s.EsmModel,EsmPreTrainedModel:()=>s.EsmPreTrainedModel,EsmTokenizer:()=>o.EsmTokenizer,ExaoneForCausalLM:()=>s.ExaoneForCausalLM,ExaoneModel:()=>s.ExaoneModel,ExaonePreTrainedModel:()=>s.ExaonePreTrainedModel,FFT:()=>c.FFT,FalconForCausalLM:()=>s.FalconForCausalLM,FalconModel:()=>s.FalconModel,FalconPreTrainedModel:()=>s.FalconPreTrainedModel,FalconTokenizer:()=>o.FalconTokenizer,FastViTForImageClassification:()=>s.FastViTForImageClassification,FastViTModel:()=>s.FastViTModel,FastViTPreTrainedModel:()=>s.FastViTPreTrainedModel,FeatureExtractionPipeline:()=>t.FeatureExtractionPipeline,FeatureExtractor:()=>_.FeatureExtractor,FillMaskPipeline:()=>t.FillMaskPipeline,Florence2ForConditionalGeneration:()=>s.Florence2ForConditionalGeneration,Florence2PreTrainedModel:()=>s.Florence2PreTrainedModel,Florence2Processor:()=>w.Florence2Processor,ForcedBOSTokenLogitsProcessor:()=>P.ForcedBOSTokenLogitsProcessor,ForcedEOSTokenLogitsProcessor:()=>P.ForcedEOSTokenLogitsProcessor,GLPNFeatureExtractor:()=>g.GLPNFeatureExtractor,GLPNForDepthEstimation:()=>s.GLPNForDepthEstimation,GLPNModel:()=>s.GLPNModel,GLPNPreTrainedModel:()=>s.GLPNPreTrainedModel,GPT2LMHeadModel:()=>s.GPT2LMHeadModel,GPT2Model:()=>s.GPT2Model,GPT2PreTrainedModel:()=>s.GPT2PreTrainedModel,GPT2Tokenizer:()=>o.GPT2Tokenizer,GPTBigCodeForCausalLM:()=>s.GPTBigCodeForCausalLM,GPTBigCodeModel:()=>s.GPTBigCodeModel,GPTBigCodePreTrainedModel:()=>s.GPTBigCodePreTrainedModel,GPTJForCausalLM:()=>s.GPTJForCausalLM,GPTJModel:()=>s.GPTJModel,GPTJPreTrainedModel:()=>s.GPTJPreTrainedModel,GPTNeoForCausalLM:()=>s.GPTNeoForCausalLM,GPTNeoModel:()=>s.GPTNeoModel,GPTNeoPreTrainedModel:()=>s.GPTNeoPreTrainedModel,GPTNeoXForCausalLM:()=>s.GPTNeoXForCausalLM,GPTNeoXModel:()=>s.GPTNeoXModel,GPTNeoXPreTrainedModel:()=>s.GPTNeoXPreTrainedModel,GPTNeoXTokenizer:()=>o.GPTNeoXTokenizer,Gemma2ForCausalLM:()=>s.Gemma2ForCausalLM,Gemma2Model:()=>s.Gemma2Model,Gemma2PreTrainedModel:()=>s.Gemma2PreTrainedModel,Gemma3ForCausalLM:()=>s.Gemma3ForCausalLM,Gemma3Model:()=>s.Gemma3Model,Gemma3PreTrainedModel:()=>s.Gemma3PreTrainedModel,GemmaForCausalLM:()=>s.GemmaForCausalLM,GemmaModel:()=>s.GemmaModel,GemmaPreTrainedModel:()=>s.GemmaPreTrainedModel,GemmaTokenizer:()=>o.GemmaTokenizer,GlmForCausalLM:()=>s.GlmForCausalLM,GlmModel:()=>s.GlmModel,GlmPreTrainedModel:()=>s.GlmPreTrainedModel,GraniteForCausalLM:()=>s.GraniteForCausalLM,GraniteModel:()=>s.GraniteModel,GranitePreTrainedModel:()=>s.GranitePreTrainedModel,Grok1Tokenizer:()=>o.Grok1Tokenizer,GroundingDinoForObjectDetection:()=>s.GroundingDinoForObjectDetection,GroundingDinoImageProcessor:()=>g.GroundingDinoImageProcessor,GroundingDinoPreTrainedModel:()=>s.GroundingDinoPreTrainedModel,GroundingDinoProcessor:()=>w.GroundingDinoProcessor,GroupViTModel:()=>s.GroupViTModel,GroupViTPreTrainedModel:()=>s.GroupViTPreTrainedModel,HeliumForCausalLM:()=>s.HeliumForCausalLM,HeliumModel:()=>s.HeliumModel,HeliumPreTrainedModel:()=>s.HeliumPreTrainedModel,HerbertTokenizer:()=>o.HerbertTokenizer,HieraForImageClassification:()=>s.HieraForImageClassification,HieraModel:()=>s.HieraModel,HieraPreTrainedModel:()=>s.HieraPreTrainedModel,HubertForCTC:()=>s.HubertForCTC,HubertForSequenceClassification:()=>s.HubertForSequenceClassification,HubertModel:()=>s.HubertModel,HubertPreTrainedModel:()=>s.HubertPreTrainedModel,IJepaForImageClassification:()=>s.IJepaForImageClassification,IJepaModel:()=>s.IJepaModel,IJepaPreTrainedModel:()=>s.IJepaPreTrainedModel,Idefics3ForConditionalGeneration:()=>s.Idefics3ForConditionalGeneration,Idefics3ImageProcessor:()=>g.Idefics3ImageProcessor,Idefics3PreTrainedModel:()=>s.Idefics3PreTrainedModel,Idefics3Processor:()=>w.Idefics3Processor,ImageClassificationPipeline:()=>t.ImageClassificationPipeline,ImageFeatureExtractionPipeline:()=>t.ImageFeatureExtractionPipeline,ImageFeatureExtractor:()=>m.ImageFeatureExtractor,ImageMattingOutput:()=>s.ImageMattingOutput,ImageProcessor:()=>h.ImageProcessor,ImageSegmentationPipeline:()=>t.ImageSegmentationPipeline,ImageToImagePipeline:()=>t.ImageToImagePipeline,ImageToTextPipeline:()=>t.ImageToTextPipeline,InterruptableStoppingCriteria:()=>x.InterruptableStoppingCriteria,JAISLMHeadModel:()=>s.JAISLMHeadModel,JAISModel:()=>s.JAISModel,JAISPreTrainedModel:()=>s.JAISPreTrainedModel,JinaCLIPImageProcessor:()=>g.JinaCLIPImageProcessor,JinaCLIPModel:()=>s.JinaCLIPModel,JinaCLIPPreTrainedModel:()=>s.JinaCLIPPreTrainedModel,JinaCLIPProcessor:()=>w.JinaCLIPProcessor,JinaCLIPTextModel:()=>s.JinaCLIPTextModel,JinaCLIPVisionModel:()=>s.JinaCLIPVisionModel,LiteWhisperForConditionalGeneration:()=>s.LiteWhisperForConditionalGeneration,LlamaForCausalLM:()=>s.LlamaForCausalLM,LlamaModel:()=>s.LlamaModel,LlamaPreTrainedModel:()=>s.LlamaPreTrainedModel,LlamaTokenizer:()=>o.LlamaTokenizer,LlavaForConditionalGeneration:()=>s.LlavaForConditionalGeneration,LlavaOnevisionForConditionalGeneration:()=>s.LlavaOnevisionForConditionalGeneration,LlavaOnevisionImageProcessor:()=>g.LlavaOnevisionImageProcessor,LlavaPreTrainedModel:()=>s.LlavaPreTrainedModel,LogitsProcessor:()=>P.LogitsProcessor,LogitsProcessorList:()=>P.LogitsProcessorList,LogitsWarper:()=>P.LogitsWarper,LongT5ForConditionalGeneration:()=>s.LongT5ForConditionalGeneration,LongT5Model:()=>s.LongT5Model,LongT5PreTrainedModel:()=>s.LongT5PreTrainedModel,M2M100ForConditionalGeneration:()=>s.M2M100ForConditionalGeneration,M2M100Model:()=>s.M2M100Model,M2M100PreTrainedModel:()=>s.M2M100PreTrainedModel,M2M100Tokenizer:()=>o.M2M100Tokenizer,MBart50Tokenizer:()=>o.MBart50Tokenizer,MBartForCausalLM:()=>s.MBartForCausalLM,MBartForConditionalGeneration:()=>s.MBartForConditionalGeneration,MBartForSequenceClassification:()=>s.MBartForSequenceClassification,MBartModel:()=>s.MBartModel,MBartPreTrainedModel:()=>s.MBartPreTrainedModel,MBartTokenizer:()=>o.MBartTokenizer,MPNetForMaskedLM:()=>s.MPNetForMaskedLM,MPNetForQuestionAnswering:()=>s.MPNetForQuestionAnswering,MPNetForSequenceClassification:()=>s.MPNetForSequenceClassification,MPNetForTokenClassification:()=>s.MPNetForTokenClassification,MPNetModel:()=>s.MPNetModel,MPNetPreTrainedModel:()=>s.MPNetPreTrainedModel,MPNetTokenizer:()=>o.MPNetTokenizer,MT5ForConditionalGeneration:()=>s.MT5ForConditionalGeneration,MT5Model:()=>s.MT5Model,MT5PreTrainedModel:()=>s.MT5PreTrainedModel,MarianMTModel:()=>s.MarianMTModel,MarianModel:()=>s.MarianModel,MarianPreTrainedModel:()=>s.MarianPreTrainedModel,MarianTokenizer:()=>o.MarianTokenizer,Mask2FormerImageProcessor:()=>g.Mask2FormerImageProcessor,MaskFormerFeatureExtractor:()=>g.MaskFormerFeatureExtractor,MaskFormerForInstanceSegmentation:()=>s.MaskFormerForInstanceSegmentation,MaskFormerImageProcessor:()=>g.MaskFormerImageProcessor,MaskFormerModel:()=>s.MaskFormerModel,MaskFormerPreTrainedModel:()=>s.MaskFormerPreTrainedModel,MaskedLMOutput:()=>s.MaskedLMOutput,MaxLengthCriteria:()=>x.MaxLengthCriteria,Metric3DForDepthEstimation:()=>s.Metric3DForDepthEstimation,Metric3DPreTrainedModel:()=>s.Metric3DPreTrainedModel,Metric3Dv2ForDepthEstimation:()=>s.Metric3Dv2ForDepthEstimation,Metric3Dv2PreTrainedModel:()=>s.Metric3Dv2PreTrainedModel,MgpstrForSceneTextRecognition:()=>s.MgpstrForSceneTextRecognition,MgpstrModelOutput:()=>s.MgpstrModelOutput,MgpstrPreTrainedModel:()=>s.MgpstrPreTrainedModel,MgpstrProcessor:()=>w.MgpstrProcessor,MgpstrTokenizer:()=>o.MgpstrTokenizer,MimiDecoderModel:()=>s.MimiDecoderModel,MimiDecoderOutput:()=>s.MimiDecoderOutput,MimiEncoderModel:()=>s.MimiEncoderModel,MimiEncoderOutput:()=>s.MimiEncoderOutput,MimiModel:()=>s.MimiModel,MimiPreTrainedModel:()=>s.MimiPreTrainedModel,MinLengthLogitsProcessor:()=>P.MinLengthLogitsProcessor,MinNewTokensLengthLogitsProcessor:()=>P.MinNewTokensLengthLogitsProcessor,MistralForCausalLM:()=>s.MistralForCausalLM,MistralModel:()=>s.MistralModel,MistralPreTrainedModel:()=>s.MistralPreTrainedModel,MobileBertForMaskedLM:()=>s.MobileBertForMaskedLM,MobileBertForQuestionAnswering:()=>s.MobileBertForQuestionAnswering,MobileBertForSequenceClassification:()=>s.MobileBertForSequenceClassification,MobileBertModel:()=>s.MobileBertModel,MobileBertPreTrainedModel:()=>s.MobileBertPreTrainedModel,MobileBertTokenizer:()=>o.MobileBertTokenizer,MobileLLMForCausalLM:()=>s.MobileLLMForCausalLM,MobileLLMModel:()=>s.MobileLLMModel,MobileLLMPreTrainedModel:()=>s.MobileLLMPreTrainedModel,MobileNetV1FeatureExtractor:()=>g.MobileNetV1FeatureExtractor,MobileNetV1ForImageClassification:()=>s.MobileNetV1ForImageClassification,MobileNetV1ForSemanticSegmentation:()=>s.MobileNetV1ForSemanticSegmentation,MobileNetV1ImageProcessor:()=>g.MobileNetV1ImageProcessor,MobileNetV1Model:()=>s.MobileNetV1Model,MobileNetV1PreTrainedModel:()=>s.MobileNetV1PreTrainedModel,MobileNetV2FeatureExtractor:()=>g.MobileNetV2FeatureExtractor,MobileNetV2ForImageClassification:()=>s.MobileNetV2ForImageClassification,MobileNetV2ForSemanticSegmentation:()=>s.MobileNetV2ForSemanticSegmentation,MobileNetV2ImageProcessor:()=>g.MobileNetV2ImageProcessor,MobileNetV2Model:()=>s.MobileNetV2Model,MobileNetV2PreTrainedModel:()=>s.MobileNetV2PreTrainedModel,MobileNetV3FeatureExtractor:()=>g.MobileNetV3FeatureExtractor,MobileNetV3ForImageClassification:()=>s.MobileNetV3ForImageClassification,MobileNetV3ForSemanticSegmentation:()=>s.MobileNetV3ForSemanticSegmentation,MobileNetV3ImageProcessor:()=>g.MobileNetV3ImageProcessor,MobileNetV3Model:()=>s.MobileNetV3Model,MobileNetV3PreTrainedModel:()=>s.MobileNetV3PreTrainedModel,MobileNetV4FeatureExtractor:()=>g.MobileNetV4FeatureExtractor,MobileNetV4ForImageClassification:()=>s.MobileNetV4ForImageClassification,MobileNetV4ForSemanticSegmentation:()=>s.MobileNetV4ForSemanticSegmentation,MobileNetV4ImageProcessor:()=>g.MobileNetV4ImageProcessor,MobileNetV4Model:()=>s.MobileNetV4Model,MobileNetV4PreTrainedModel:()=>s.MobileNetV4PreTrainedModel,MobileViTFeatureExtractor:()=>g.MobileViTFeatureExtractor,MobileViTForImageClassification:()=>s.MobileViTForImageClassification,MobileViTImageProcessor:()=>g.MobileViTImageProcessor,MobileViTModel:()=>s.MobileViTModel,MobileViTPreTrainedModel:()=>s.MobileViTPreTrainedModel,MobileViTV2ForImageClassification:()=>s.MobileViTV2ForImageClassification,MobileViTV2Model:()=>s.MobileViTV2Model,MobileViTV2PreTrainedModel:()=>s.MobileViTV2PreTrainedModel,ModelOutput:()=>s.ModelOutput,ModernBertForMaskedLM:()=>s.ModernBertForMaskedLM,ModernBertForSequenceClassification:()=>s.ModernBertForSequenceClassification,ModernBertForTokenClassification:()=>s.ModernBertForTokenClassification,ModernBertModel:()=>s.ModernBertModel,ModernBertPreTrainedModel:()=>s.ModernBertPreTrainedModel,Moondream1ForConditionalGeneration:()=>s.Moondream1ForConditionalGeneration,MoonshineFeatureExtractor:()=>m.MoonshineFeatureExtractor,MoonshineForConditionalGeneration:()=>s.MoonshineForConditionalGeneration,MoonshineModel:()=>s.MoonshineModel,MoonshinePreTrainedModel:()=>s.MoonshinePreTrainedModel,MoonshineProcessor:()=>w.MoonshineProcessor,MptForCausalLM:()=>s.MptForCausalLM,MptModel:()=>s.MptModel,MptPreTrainedModel:()=>s.MptPreTrainedModel,MultiModalityCausalLM:()=>s.MultiModalityCausalLM,MultiModalityPreTrainedModel:()=>s.MultiModalityPreTrainedModel,MusicgenForCausalLM:()=>s.MusicgenForCausalLM,MusicgenForConditionalGeneration:()=>s.MusicgenForConditionalGeneration,MusicgenModel:()=>s.MusicgenModel,MusicgenPreTrainedModel:()=>s.MusicgenPreTrainedModel,NllbTokenizer:()=>o.NllbTokenizer,NoBadWordsLogitsProcessor:()=>P.NoBadWordsLogitsProcessor,NoRepeatNGramLogitsProcessor:()=>P.NoRepeatNGramLogitsProcessor,NomicBertModel:()=>s.NomicBertModel,NomicBertPreTrainedModel:()=>s.NomicBertPreTrainedModel,NougatImageProcessor:()=>g.NougatImageProcessor,NougatTokenizer:()=>o.NougatTokenizer,OPTForCausalLM:()=>s.OPTForCausalLM,OPTModel:()=>s.OPTModel,OPTPreTrainedModel:()=>s.OPTPreTrainedModel,ObjectDetectionPipeline:()=>t.ObjectDetectionPipeline,Olmo2ForCausalLM:()=>s.Olmo2ForCausalLM,Olmo2Model:()=>s.Olmo2Model,Olmo2PreTrainedModel:()=>s.Olmo2PreTrainedModel,OlmoForCausalLM:()=>s.OlmoForCausalLM,OlmoModel:()=>s.OlmoModel,OlmoPreTrainedModel:()=>s.OlmoPreTrainedModel,OpenELMForCausalLM:()=>s.OpenELMForCausalLM,OpenELMModel:()=>s.OpenELMModel,OpenELMPreTrainedModel:()=>s.OpenELMPreTrainedModel,OwlViTFeatureExtractor:()=>g.OwlViTFeatureExtractor,OwlViTForObjectDetection:()=>s.OwlViTForObjectDetection,OwlViTImageProcessor:()=>g.OwlViTImageProcessor,OwlViTModel:()=>s.OwlViTModel,OwlViTPreTrainedModel:()=>s.OwlViTPreTrainedModel,OwlViTProcessor:()=>w.OwlViTProcessor,Owlv2ForObjectDetection:()=>s.Owlv2ForObjectDetection,Owlv2ImageProcessor:()=>g.Owlv2ImageProcessor,Owlv2Model:()=>s.Owlv2Model,Owlv2PreTrainedModel:()=>s.Owlv2PreTrainedModel,PaliGemmaForConditionalGeneration:()=>s.PaliGemmaForConditionalGeneration,PaliGemmaPreTrainedModel:()=>s.PaliGemmaPreTrainedModel,PaliGemmaProcessor:()=>w.PaliGemmaProcessor,PatchTSMixerForPrediction:()=>s.PatchTSMixerForPrediction,PatchTSMixerModel:()=>s.PatchTSMixerModel,PatchTSMixerPreTrainedModel:()=>s.PatchTSMixerPreTrainedModel,PatchTSTForPrediction:()=>s.PatchTSTForPrediction,PatchTSTModel:()=>s.PatchTSTModel,PatchTSTPreTrainedModel:()=>s.PatchTSTPreTrainedModel,Phi3ForCausalLM:()=>s.Phi3ForCausalLM,Phi3Model:()=>s.Phi3Model,Phi3PreTrainedModel:()=>s.Phi3PreTrainedModel,Phi3VForCausalLM:()=>s.Phi3VForCausalLM,Phi3VImageProcessor:()=>g.Phi3VImageProcessor,Phi3VPreTrainedModel:()=>s.Phi3VPreTrainedModel,Phi3VProcessor:()=>w.Phi3VProcessor,PhiForCausalLM:()=>s.PhiForCausalLM,PhiModel:()=>s.PhiModel,PhiPreTrainedModel:()=>s.PhiPreTrainedModel,Pipeline:()=>t.Pipeline,PreTrainedModel:()=>s.PreTrainedModel,PreTrainedTokenizer:()=>o.PreTrainedTokenizer,PretrainedConfig:()=>r.PretrainedConfig,PretrainedMixin:()=>s.PretrainedMixin,Processor:()=>M.Processor,PvtForImageClassification:()=>s.PvtForImageClassification,PvtImageProcessor:()=>g.PvtImageProcessor,PvtModel:()=>s.PvtModel,PvtPreTrainedModel:()=>s.PvtPreTrainedModel,PyAnnoteFeatureExtractor:()=>m.PyAnnoteFeatureExtractor,PyAnnoteForAudioFrameClassification:()=>s.PyAnnoteForAudioFrameClassification,PyAnnoteModel:()=>s.PyAnnoteModel,PyAnnotePreTrainedModel:()=>s.PyAnnotePreTrainedModel,PyAnnoteProcessor:()=>w.PyAnnoteProcessor,QuestionAnsweringModelOutput:()=>s.QuestionAnsweringModelOutput,QuestionAnsweringPipeline:()=>t.QuestionAnsweringPipeline,Qwen2ForCausalLM:()=>s.Qwen2ForCausalLM,Qwen2Model:()=>s.Qwen2Model,Qwen2PreTrainedModel:()=>s.Qwen2PreTrainedModel,Qwen2Tokenizer:()=>o.Qwen2Tokenizer,Qwen2VLForConditionalGeneration:()=>s.Qwen2VLForConditionalGeneration,Qwen2VLImageProcessor:()=>g.Qwen2VLImageProcessor,Qwen2VLPreTrainedModel:()=>s.Qwen2VLPreTrainedModel,Qwen2VLProcessor:()=>w.Qwen2VLProcessor,RTDetrForObjectDetection:()=>s.RTDetrForObjectDetection,RTDetrImageProcessor:()=>g.RTDetrImageProcessor,RTDetrModel:()=>s.RTDetrModel,RTDetrObjectDetectionOutput:()=>s.RTDetrObjectDetectionOutput,RTDetrPreTrainedModel:()=>s.RTDetrPreTrainedModel,RawAudio:()=>n.RawAudio,RawImage:()=>a.RawImage,RawVideo:()=>i.RawVideo,RawVideoFrame:()=>i.RawVideoFrame,RepetitionPenaltyLogitsProcessor:()=>P.RepetitionPenaltyLogitsProcessor,ResNetForImageClassification:()=>s.ResNetForImageClassification,ResNetModel:()=>s.ResNetModel,ResNetPreTrainedModel:()=>s.ResNetPreTrainedModel,RoFormerForMaskedLM:()=>s.RoFormerForMaskedLM,RoFormerForQuestionAnswering:()=>s.RoFormerForQuestionAnswering,RoFormerForSequenceClassification:()=>s.RoFormerForSequenceClassification,RoFormerForTokenClassification:()=>s.RoFormerForTokenClassification,RoFormerModel:()=>s.RoFormerModel,RoFormerPreTrainedModel:()=>s.RoFormerPreTrainedModel,RoFormerTokenizer:()=>o.RoFormerTokenizer,RobertaForMaskedLM:()=>s.RobertaForMaskedLM,RobertaForQuestionAnswering:()=>s.RobertaForQuestionAnswering,RobertaForSequenceClassification:()=>s.RobertaForSequenceClassification,RobertaForTokenClassification:()=>s.RobertaForTokenClassification,RobertaModel:()=>s.RobertaModel,RobertaPreTrainedModel:()=>s.RobertaPreTrainedModel,RobertaTokenizer:()=>o.RobertaTokenizer,SamImageProcessor:()=>g.SamImageProcessor,SamImageSegmentationOutput:()=>s.SamImageSegmentationOutput,SamModel:()=>s.SamModel,SamPreTrainedModel:()=>s.SamPreTrainedModel,SamProcessor:()=>w.SamProcessor,SapiensForDepthEstimation:()=>s.SapiensForDepthEstimation,SapiensForNormalEstimation:()=>s.SapiensForNormalEstimation,SapiensForSemanticSegmentation:()=>s.SapiensForSemanticSegmentation,SapiensPreTrainedModel:()=>s.SapiensPreTrainedModel,SeamlessM4TFeatureExtractor:()=>m.SeamlessM4TFeatureExtractor,SegformerFeatureExtractor:()=>g.SegformerFeatureExtractor,SegformerForImageClassification:()=>s.SegformerForImageClassification,SegformerForSemanticSegmentation:()=>s.SegformerForSemanticSegmentation,SegformerImageProcessor:()=>g.SegformerImageProcessor,SegformerModel:()=>s.SegformerModel,SegformerPreTrainedModel:()=>s.SegformerPreTrainedModel,Seq2SeqLMOutput:()=>s.Seq2SeqLMOutput,SequenceClassifierOutput:()=>s.SequenceClassifierOutput,SiglipImageProcessor:()=>g.SiglipImageProcessor,SiglipModel:()=>s.SiglipModel,SiglipPreTrainedModel:()=>s.SiglipPreTrainedModel,SiglipTextModel:()=>s.SiglipTextModel,SiglipTokenizer:()=>o.SiglipTokenizer,SiglipVisionModel:()=>s.SiglipVisionModel,SmolVLMForConditionalGeneration:()=>s.SmolVLMForConditionalGeneration,SmolVLMImageProcessor:()=>g.SmolVLMImageProcessor,SmolVLMProcessor:()=>w.SmolVLMProcessor,SnacDecoderModel:()=>s.SnacDecoderModel,SnacEncoderModel:()=>s.SnacEncoderModel,SnacFeatureExtractor:()=>m.SnacFeatureExtractor,SnacModel:()=>s.SnacModel,SnacPreTrainedModel:()=>s.SnacPreTrainedModel,SpeechT5FeatureExtractor:()=>m.SpeechT5FeatureExtractor,SpeechT5ForSpeechToText:()=>s.SpeechT5ForSpeechToText,SpeechT5ForTextToSpeech:()=>s.SpeechT5ForTextToSpeech,SpeechT5HifiGan:()=>s.SpeechT5HifiGan,SpeechT5Model:()=>s.SpeechT5Model,SpeechT5PreTrainedModel:()=>s.SpeechT5PreTrainedModel,SpeechT5Processor:()=>w.SpeechT5Processor,SpeechT5Tokenizer:()=>o.SpeechT5Tokenizer,SqueezeBertForMaskedLM:()=>s.SqueezeBertForMaskedLM,SqueezeBertForQuestionAnswering:()=>s.SqueezeBertForQuestionAnswering,SqueezeBertForSequenceClassification:()=>s.SqueezeBertForSequenceClassification,SqueezeBertModel:()=>s.SqueezeBertModel,SqueezeBertPreTrainedModel:()=>s.SqueezeBertPreTrainedModel,SqueezeBertTokenizer:()=>o.SqueezeBertTokenizer,StableLmForCausalLM:()=>s.StableLmForCausalLM,StableLmModel:()=>s.StableLmModel,StableLmPreTrainedModel:()=>s.StableLmPreTrainedModel,Starcoder2ForCausalLM:()=>s.Starcoder2ForCausalLM,Starcoder2Model:()=>s.Starcoder2Model,Starcoder2PreTrainedModel:()=>s.Starcoder2PreTrainedModel,StoppingCriteria:()=>x.StoppingCriteria,StoppingCriteriaList:()=>x.StoppingCriteriaList,StyleTextToSpeech2Model:()=>s.StyleTextToSpeech2Model,StyleTextToSpeech2PreTrainedModel:()=>s.StyleTextToSpeech2PreTrainedModel,SummarizationPipeline:()=>t.SummarizationPipeline,SuppressTokensAtBeginLogitsProcessor:()=>P.SuppressTokensAtBeginLogitsProcessor,Swin2SRForImageSuperResolution:()=>s.Swin2SRForImageSuperResolution,Swin2SRImageProcessor:()=>g.Swin2SRImageProcessor,Swin2SRModel:()=>s.Swin2SRModel,Swin2SRPreTrainedModel:()=>s.Swin2SRPreTrainedModel,SwinForImageClassification:()=>s.SwinForImageClassification,SwinForSemanticSegmentation:()=>s.SwinForSemanticSegmentation,SwinModel:()=>s.SwinModel,SwinPreTrainedModel:()=>s.SwinPreTrainedModel,T5ForConditionalGeneration:()=>s.T5ForConditionalGeneration,T5Model:()=>s.T5Model,T5PreTrainedModel:()=>s.T5PreTrainedModel,T5Tokenizer:()=>o.T5Tokenizer,TableTransformerForObjectDetection:()=>s.TableTransformerForObjectDetection,TableTransformerModel:()=>s.TableTransformerModel,TableTransformerObjectDetectionOutput:()=>s.TableTransformerObjectDetectionOutput,TableTransformerPreTrainedModel:()=>s.TableTransformerPreTrainedModel,TemperatureLogitsWarper:()=>P.TemperatureLogitsWarper,Tensor:()=>l.Tensor,Text2TextGenerationPipeline:()=>t.Text2TextGenerationPipeline,TextClassificationPipeline:()=>t.TextClassificationPipeline,TextGenerationPipeline:()=>t.TextGenerationPipeline,TextStreamer:()=>b.TextStreamer,TextToAudioPipeline:()=>t.TextToAudioPipeline,TokenClassificationPipeline:()=>t.TokenClassificationPipeline,TokenClassifierOutput:()=>s.TokenClassifierOutput,TokenizerModel:()=>o.TokenizerModel,TopKLogitsWarper:()=>P.TopKLogitsWarper,TopPLogitsWarper:()=>P.TopPLogitsWarper,TrOCRForCausalLM:()=>s.TrOCRForCausalLM,TrOCRPreTrainedModel:()=>s.TrOCRPreTrainedModel,TranslationPipeline:()=>t.TranslationPipeline,UltravoxModel:()=>s.UltravoxModel,UltravoxPreTrainedModel:()=>s.UltravoxPreTrainedModel,UltravoxProcessor:()=>w.UltravoxProcessor,UniSpeechForCTC:()=>s.UniSpeechForCTC,UniSpeechForSequenceClassification:()=>s.UniSpeechForSequenceClassification,UniSpeechModel:()=>s.UniSpeechModel,UniSpeechPreTrainedModel:()=>s.UniSpeechPreTrainedModel,UniSpeechSatForAudioFrameClassification:()=>s.UniSpeechSatForAudioFrameClassification,UniSpeechSatForCTC:()=>s.UniSpeechSatForCTC,UniSpeechSatForSequenceClassification:()=>s.UniSpeechSatForSequenceClassification,UniSpeechSatModel:()=>s.UniSpeechSatModel,UniSpeechSatPreTrainedModel:()=>s.UniSpeechSatPreTrainedModel,VLChatProcessor:()=>w.VLChatProcessor,VLMImageProcessor:()=>g.VLMImageProcessor,ViTFeatureExtractor:()=>g.ViTFeatureExtractor,ViTForImageClassification:()=>s.ViTForImageClassification,ViTImageProcessor:()=>g.ViTImageProcessor,ViTMAEModel:()=>s.ViTMAEModel,ViTMAEPreTrainedModel:()=>s.ViTMAEPreTrainedModel,ViTMSNForImageClassification:()=>s.ViTMSNForImageClassification,ViTMSNModel:()=>s.ViTMSNModel,ViTMSNPreTrainedModel:()=>s.ViTMSNPreTrainedModel,ViTModel:()=>s.ViTModel,ViTPreTrainedModel:()=>s.ViTPreTrainedModel,VisionEncoderDecoderModel:()=>s.VisionEncoderDecoderModel,VitMatteForImageMatting:()=>s.VitMatteForImageMatting,VitMatteImageProcessor:()=>g.VitMatteImageProcessor,VitMattePreTrainedModel:()=>s.VitMattePreTrainedModel,VitPoseForPoseEstimation:()=>s.VitPoseForPoseEstimation,VitPoseImageProcessor:()=>g.VitPoseImageProcessor,VitPosePreTrainedModel:()=>s.VitPosePreTrainedModel,VitsModel:()=>s.VitsModel,VitsModelOutput:()=>s.VitsModelOutput,VitsPreTrainedModel:()=>s.VitsPreTrainedModel,VitsTokenizer:()=>o.VitsTokenizer,Wav2Vec2BertForCTC:()=>s.Wav2Vec2BertForCTC,Wav2Vec2BertForSequenceClassification:()=>s.Wav2Vec2BertForSequenceClassification,Wav2Vec2BertModel:()=>s.Wav2Vec2BertModel,Wav2Vec2BertPreTrainedModel:()=>s.Wav2Vec2BertPreTrainedModel,Wav2Vec2CTCTokenizer:()=>o.Wav2Vec2CTCTokenizer,Wav2Vec2FeatureExtractor:()=>m.Wav2Vec2FeatureExtractor,Wav2Vec2ForAudioFrameClassification:()=>s.Wav2Vec2ForAudioFrameClassification,Wav2Vec2ForCTC:()=>s.Wav2Vec2ForCTC,Wav2Vec2ForSequenceClassification:()=>s.Wav2Vec2ForSequenceClassification,Wav2Vec2Model:()=>s.Wav2Vec2Model,Wav2Vec2PreTrainedModel:()=>s.Wav2Vec2PreTrainedModel,Wav2Vec2Processor:()=>w.Wav2Vec2Processor,Wav2Vec2ProcessorWithLM:()=>w.Wav2Vec2ProcessorWithLM,WavLMForAudioFrameClassification:()=>s.WavLMForAudioFrameClassification,WavLMForCTC:()=>s.WavLMForCTC,WavLMForSequenceClassification:()=>s.WavLMForSequenceClassification,WavLMForXVector:()=>s.WavLMForXVector,WavLMModel:()=>s.WavLMModel,WavLMPreTrainedModel:()=>s.WavLMPreTrainedModel,WeSpeakerFeatureExtractor:()=>m.WeSpeakerFeatureExtractor,WeSpeakerResNetModel:()=>s.WeSpeakerResNetModel,WeSpeakerResNetPreTrainedModel:()=>s.WeSpeakerResNetPreTrainedModel,WhisperFeatureExtractor:()=>m.WhisperFeatureExtractor,WhisperForConditionalGeneration:()=>s.WhisperForConditionalGeneration,WhisperModel:()=>s.WhisperModel,WhisperPreTrainedModel:()=>s.WhisperPreTrainedModel,WhisperProcessor:()=>w.WhisperProcessor,WhisperTextStreamer:()=>b.WhisperTextStreamer,WhisperTimeStampLogitsProcessor:()=>P.WhisperTimeStampLogitsProcessor,WhisperTokenizer:()=>o.WhisperTokenizer,XLMForQuestionAnswering:()=>s.XLMForQuestionAnswering,XLMForSequenceClassification:()=>s.XLMForSequenceClassification,XLMForTokenClassification:()=>s.XLMForTokenClassification,XLMModel:()=>s.XLMModel,XLMPreTrainedModel:()=>s.XLMPreTrainedModel,XLMRobertaForMaskedLM:()=>s.XLMRobertaForMaskedLM,XLMRobertaForQuestionAnswering:()=>s.XLMRobertaForQuestionAnswering,XLMRobertaForSequenceClassification:()=>s.XLMRobertaForSequenceClassification,XLMRobertaForTokenClassification:()=>s.XLMRobertaForTokenClassification,XLMRobertaModel:()=>s.XLMRobertaModel,XLMRobertaPreTrainedModel:()=>s.XLMRobertaPreTrainedModel,XLMRobertaTokenizer:()=>o.XLMRobertaTokenizer,XLMTokenizer:()=>o.XLMTokenizer,XLMWithLMHeadModel:()=>s.XLMWithLMHeadModel,XVectorOutput:()=>s.XVectorOutput,YolosFeatureExtractor:()=>g.YolosFeatureExtractor,YolosForObjectDetection:()=>s.YolosForObjectDetection,YolosImageProcessor:()=>g.YolosImageProcessor,YolosModel:()=>s.YolosModel,YolosObjectDetectionOutput:()=>s.YolosObjectDetectionOutput,YolosPreTrainedModel:()=>s.YolosPreTrainedModel,ZeroShotAudioClassificationPipeline:()=>t.ZeroShotAudioClassificationPipeline,ZeroShotClassificationPipeline:()=>t.ZeroShotClassificationPipeline,ZeroShotImageClassificationPipeline:()=>t.ZeroShotImageClassificationPipeline,ZeroShotObjectDetectionPipeline:()=>t.ZeroShotObjectDetectionPipeline,bankers_round:()=>c.bankers_round,cat:()=>l.cat,cos_sim:()=>c.cos_sim,dot:()=>c.dot,dynamic_time_warping:()=>c.dynamic_time_warping,env:()=>e.env,full:()=>l.full,full_like:()=>l.full_like,getKeyValueShapes:()=>r.getKeyValueShapes,hamming:()=>n.hamming,hanning:()=>n.hanning,interpolate:()=>l.interpolate,interpolate_4d:()=>l.interpolate_4d,interpolate_data:()=>c.interpolate_data,is_chinese_char:()=>o.is_chinese_char,layer_norm:()=>l.layer_norm,load_image:()=>a.load_image,load_video:()=>i.load_video,log_softmax:()=>c.log_softmax,magnitude:()=>c.magnitude,matmul:()=>l.matmul,max:()=>c.max,mean:()=>l.mean,mean_pooling:()=>l.mean_pooling,medianFilter:()=>c.medianFilter,mel_filter_bank:()=>n.mel_filter_bank,min:()=>c.min,ones:()=>l.ones,ones_like:()=>l.ones_like,permute:()=>l.permute,permute_data:()=>c.permute_data,pipeline:()=>t.pipeline,quantize_embeddings:()=>l.quantize_embeddings,rand:()=>l.rand,read_audio:()=>n.read_audio,rfft:()=>l.rfft,round:()=>c.round,slice:()=>l.slice,softmax:()=>c.softmax,spectrogram:()=>n.spectrogram,stack:()=>l.stack,std_mean:()=>l.std_mean,topk:()=>l.topk,window_function:()=>n.window_function,zeros:()=>l.zeros,zeros_like:()=>l.zeros_like});var e=d("./src/env.js"),t=d("./src/pipelines.js"),s=d("./src/models.js"),o=d("./src/tokenizers.js"),r=d("./src/configs.js"),n=d("./src/utils/audio.js"),a=d("./src/utils/image.js"),i=d("./src/utils/video.js"),l=d("./src/utils/tensor.js"),c=d("./src/utils/maths.js"),_=d("./src/base/feature_extraction_utils.js"),m=d("./src/models/feature_extractors.js"),p=d("./src/models/auto/feature_extraction_auto.js"),h=d("./src/base/image_processors_utils.js"),g=d("./src/models/image_processors.js"),f=d("./src/models/auto/image_processing_auto.js"),M=d("./src/base/processing_utils.js"),w=d("./src/models/processors.js"),T=d("./src/models/auto/processing_auto.js"),b=d("./src/generation/streamers.js"),x=d("./src/generation/stopping_criteria.js"),P=d("./src/generation/logits_process.js")})();var _=u.ASTFeatureExtractor,m=u.ASTForAudioClassification,p=u.ASTModel,h=u.ASTPreTrainedModel,g=u.AlbertForMaskedLM,f=u.AlbertForQuestionAnswering,M=u.AlbertForSequenceClassification,w=u.AlbertModel,T=u.AlbertPreTrainedModel,b=u.AlbertTokenizer,x=u.AudioClassificationPipeline,P=u.AutoConfig,k=u.AutoFeatureExtractor,F=u.AutoImageProcessor,y=u.AutoModel,v=u.AutoModelForAudioClassification,C=u.AutoModelForAudioFrameClassification,S=u.AutoModelForAudioTextToText,A=u.AutoModelForCTC,E=u.AutoModelForCausalLM,L=u.AutoModelForDepthEstimation,I=u.AutoModelForDocumentQuestionAnswering,z=u.AutoModelForImageClassification,V=u.AutoModelForImageFeatureExtraction,j=u.AutoModelForImageMatting,D=u.AutoModelForImageSegmentation,N=u.AutoModelForImageTextToText,O=u.AutoModelForImageToImage,B=u.AutoModelForMaskGeneration,G=u.AutoModelForMaskedLM,R=u.AutoModelForNormalEstimation,q=u.AutoModelForObjectDetection,W=u.AutoModelForPoseEstimation,$=u.AutoModelForQuestionAnswering,U=u.AutoModelForSemanticSegmentation,X=u.AutoModelForSeq2SeqLM,Q=u.AutoModelForSequenceClassification,H=u.AutoModelForSpeechSeq2Seq,J=u.AutoModelForTextToSpectrogram,Y=u.AutoModelForTextToWaveform,K=u.AutoModelForTokenClassification,Z=u.AutoModelForUniversalSegmentation,ee=u.AutoModelForVision2Seq,te=u.AutoModelForXVector,se=u.AutoModelForZeroShotObjectDetection,oe=u.AutoProcessor,re=u.AutoTokenizer,ne=u.AutomaticSpeechRecognitionPipeline,ae=u.BackgroundRemovalPipeline,ie=u.BartForConditionalGeneration,le=u.BartForSequenceClassification,ce=u.BartModel,de=u.BartPretrainedModel,ue=u.BartTokenizer,_e=u.BaseModelOutput,me=u.BaseStreamer,pe=u.BeitFeatureExtractor,he=u.BeitForImageClassification,ge=u.BeitModel,fe=u.BeitPreTrainedModel,Me=u.BertForMaskedLM,we=u.BertForQuestionAnswering,Te=u.BertForSequenceClassification,be=u.BertForTokenClassification,xe=u.BertModel,Pe=u.BertPreTrainedModel,ke=u.BertTokenizer,Fe=u.BitImageProcessor,ye=u.BlenderbotForConditionalGeneration,ve=u.BlenderbotModel,Ce=u.BlenderbotPreTrainedModel,Se=u.BlenderbotSmallForConditionalGeneration,Ae=u.BlenderbotSmallModel,Ee=u.BlenderbotSmallPreTrainedModel,Le=u.BlenderbotSmallTokenizer,Ie=u.BlenderbotTokenizer,ze=u.BloomForCausalLM,Ve=u.BloomModel,je=u.BloomPreTrainedModel,De=u.BloomTokenizer,Ne=u.CLIPFeatureExtractor,Oe=u.CLIPImageProcessor,Be=u.CLIPModel,Ge=u.CLIPPreTrainedModel,Re=u.CLIPSegForImageSegmentation,qe=u.CLIPSegModel,We=u.CLIPSegPreTrainedModel,$e=u.CLIPTextModel,Ue=u.CLIPTextModelWithProjection,Xe=u.CLIPTokenizer,Qe=u.CLIPVisionModel,He=u.CLIPVisionModelWithProjection,Je=u.CamembertForMaskedLM,Ye=u.CamembertForQuestionAnswering,Ke=u.CamembertForSequenceClassification,Ze=u.CamembertForTokenClassification,et=u.CamembertModel,tt=u.CamembertPreTrainedModel,st=u.CamembertTokenizer,ot=u.CausalLMOutput,rt=u.CausalLMOutputWithPast,nt=u.ChineseCLIPFeatureExtractor,at=u.ChineseCLIPModel,it=u.ChineseCLIPPreTrainedModel,lt=u.ClapAudioModelWithProjection,ct=u.ClapFeatureExtractor,dt=u.ClapModel,ut=u.ClapPreTrainedModel,_t=u.ClapTextModelWithProjection,mt=u.ClassifierFreeGuidanceLogitsProcessor,pt=u.CodeGenForCausalLM,ht=u.CodeGenModel,gt=u.CodeGenPreTrainedModel,ft=u.CodeGenTokenizer,Mt=u.CodeLlamaTokenizer,wt=u.CohereForCausalLM,Tt=u.CohereModel,bt=u.CoherePreTrainedModel,xt=u.CohereTokenizer,Pt=u.ConvBertForMaskedLM,kt=u.ConvBertForQuestionAnswering,Ft=u.ConvBertForSequenceClassification,yt=u.ConvBertForTokenClassification,vt=u.ConvBertModel,Ct=u.ConvBertPreTrainedModel,St=u.ConvBertTokenizer,At=u.ConvNextFeatureExtractor,Et=u.ConvNextForImageClassification,Lt=u.ConvNextImageProcessor,It=u.ConvNextModel,zt=u.ConvNextPreTrainedModel,Vt=u.ConvNextV2ForImageClassification,jt=u.ConvNextV2Model,Dt=u.ConvNextV2PreTrainedModel,Nt=u.DPTFeatureExtractor,Ot=u.DPTForDepthEstimation,Bt=u.DPTImageProcessor,Gt=u.DPTModel,Rt=u.DPTPreTrainedModel,qt=u.DacDecoderModel,Wt=u.DacDecoderOutput,$t=u.DacEncoderModel,Ut=u.DacEncoderOutput,Xt=u.DacFeatureExtractor,Qt=u.DacModel,Ht=u.DacPreTrainedModel,Jt=u.DataTypeMap,Yt=u.DebertaForMaskedLM,Kt=u.DebertaForQuestionAnswering,Zt=u.DebertaForSequenceClassification,es=u.DebertaForTokenClassification,ts=u.DebertaModel,ss=u.DebertaPreTrainedModel,os=u.DebertaTokenizer,rs=u.DebertaV2ForMaskedLM,ns=u.DebertaV2ForQuestionAnswering,as=u.DebertaV2ForSequenceClassification,is=u.DebertaV2ForTokenClassification,ls=u.DebertaV2Model,cs=u.DebertaV2PreTrainedModel,ds=u.DebertaV2Tokenizer,us=u.DecisionTransformerModel,_s=u.DecisionTransformerPreTrainedModel,ms=u.DeiTFeatureExtractor,ps=u.DeiTForImageClassification,hs=u.DeiTImageProcessor,gs=u.DeiTModel,fs=u.DeiTPreTrainedModel,Ms=u.DepthAnythingForDepthEstimation,ws=u.DepthAnythingPreTrainedModel,Ts=u.DepthEstimationPipeline,bs=u.DepthProForDepthEstimation,xs=u.DepthProPreTrainedModel,Ps=u.DetrFeatureExtractor,ks=u.DetrForObjectDetection,Fs=u.DetrForSegmentation,ys=u.DetrImageProcessor,vs=u.DetrModel,Cs=u.DetrObjectDetectionOutput,Ss=u.DetrPreTrainedModel,As=u.DetrSegmentationOutput,Es=u.Dinov2ForImageClassification,Ls=u.Dinov2Model,Is=u.Dinov2PreTrainedModel,zs=u.Dinov2WithRegistersForImageClassification,Vs=u.Dinov2WithRegistersModel,js=u.Dinov2WithRegistersPreTrainedModel,Ds=u.DistilBertForMaskedLM,Ns=u.DistilBertForQuestionAnswering,Os=u.DistilBertForSequenceClassification,Bs=u.DistilBertForTokenClassification,Gs=u.DistilBertModel,Rs=u.DistilBertPreTrainedModel,qs=u.DistilBertTokenizer,Ws=u.DocumentQuestionAnsweringPipeline,$s=u.DonutFeatureExtractor,Us=u.DonutImageProcessor,Xs=u.DonutSwinModel,Qs=u.DonutSwinPreTrainedModel,Hs=u.EfficientNetForImageClassification,Js=u.EfficientNetImageProcessor,Ys=u.EfficientNetModel,Ks=u.EfficientNetPreTrainedModel,Zs=u.ElectraForMaskedLM,eo=u.ElectraForQuestionAnswering,to=u.ElectraForSequenceClassification,so=u.ElectraForTokenClassification,oo=u.ElectraModel,ro=u.ElectraPreTrainedModel,no=u.ElectraTokenizer,ao=u.EncodecFeatureExtractor,io=u.EosTokenCriteria,lo=u.EsmForMaskedLM,co=u.EsmForSequenceClassification,uo=u.EsmForTokenClassification,_o=u.EsmModel,mo=u.EsmPreTrainedModel,po=u.EsmTokenizer,ho=u.ExaoneForCausalLM,go=u.ExaoneModel,fo=u.ExaonePreTrainedModel,Mo=u.FFT,wo=u.FalconForCausalLM,To=u.FalconModel,bo=u.FalconPreTrainedModel,xo=u.FalconTokenizer,Po=u.FastViTForImageClassification,ko=u.FastViTModel,Fo=u.FastViTPreTrainedModel,yo=u.FeatureExtractionPipeline,vo=u.FeatureExtractor,Co=u.FillMaskPipeline,So=u.Florence2ForConditionalGeneration,Ao=u.Florence2PreTrainedModel,Eo=u.Florence2Processor,Lo=u.ForcedBOSTokenLogitsProcessor,Io=u.ForcedEOSTokenLogitsProcessor,zo=u.GLPNFeatureExtractor,Vo=u.GLPNForDepthEstimation,jo=u.GLPNModel,Do=u.GLPNPreTrainedModel,No=u.GPT2LMHeadModel,Oo=u.GPT2Model,Bo=u.GPT2PreTrainedModel,Go=u.GPT2Tokenizer,Ro=u.GPTBigCodeForCausalLM,qo=u.GPTBigCodeModel,Wo=u.GPTBigCodePreTrainedModel,$o=u.GPTJForCausalLM,Uo=u.GPTJModel,Xo=u.GPTJPreTrainedModel,Qo=u.GPTNeoForCausalLM,Ho=u.GPTNeoModel,Jo=u.GPTNeoPreTrainedModel,Yo=u.GPTNeoXForCausalLM,Ko=u.GPTNeoXModel,Zo=u.GPTNeoXPreTrainedModel,er=u.GPTNeoXTokenizer,tr=u.Gemma2ForCausalLM,sr=u.Gemma2Model,or=u.Gemma2PreTrainedModel,rr=u.Gemma3ForCausalLM,nr=u.Gemma3Model,ar=u.Gemma3PreTrainedModel,ir=u.GemmaForCausalLM,lr=u.GemmaModel,cr=u.GemmaPreTrainedModel,dr=u.GemmaTokenizer,ur=u.GlmForCausalLM,_r=u.GlmModel,mr=u.GlmPreTrainedModel,pr=u.GraniteForCausalLM,hr=u.GraniteModel,gr=u.GranitePreTrainedModel,fr=u.Grok1Tokenizer,Mr=u.GroundingDinoForObjectDetection,wr=u.GroundingDinoImageProcessor,Tr=u.GroundingDinoPreTrainedModel,br=u.GroundingDinoProcessor,xr=u.GroupViTModel,Pr=u.GroupViTPreTrainedModel,kr=u.HeliumForCausalLM,Fr=u.HeliumModel,yr=u.HeliumPreTrainedModel,vr=u.HerbertTokenizer,Cr=u.HieraForImageClassification,Sr=u.HieraModel,Ar=u.HieraPreTrainedModel,Er=u.HubertForCTC,Lr=u.HubertForSequenceClassification,Ir=u.HubertModel,zr=u.HubertPreTrainedModel,Vr=u.IJepaForImageClassification,jr=u.IJepaModel,Dr=u.IJepaPreTrainedModel,Nr=u.Idefics3ForConditionalGeneration,Or=u.Idefics3ImageProcessor,Br=u.Idefics3PreTrainedModel,Gr=u.Idefics3Processor,Rr=u.ImageClassificationPipeline,qr=u.ImageFeatureExtractionPipeline,Wr=u.ImageFeatureExtractor,$r=u.ImageMattingOutput,Ur=u.ImageProcessor,Xr=u.ImageSegmentationPipeline,Qr=u.ImageToImagePipeline,Hr=u.ImageToTextPipeline,Jr=u.InterruptableStoppingCriteria,Yr=u.JAISLMHeadModel,Kr=u.JAISModel,Zr=u.JAISPreTrainedModel,en=u.JinaCLIPImageProcessor,tn=u.JinaCLIPModel,sn=u.JinaCLIPPreTrainedModel,on=u.JinaCLIPProcessor,rn=u.JinaCLIPTextModel,nn=u.JinaCLIPVisionModel,an=u.LiteWhisperForConditionalGeneration,ln=u.LlamaForCausalLM,cn=u.LlamaModel,dn=u.LlamaPreTrainedModel,un=u.LlamaTokenizer,_n=u.LlavaForConditionalGeneration,mn=u.LlavaOnevisionForConditionalGeneration,pn=u.LlavaOnevisionImageProcessor,hn=u.LlavaPreTrainedModel,gn=u.LogitsProcessor,fn=u.LogitsProcessorList,Mn=u.LogitsWarper,wn=u.LongT5ForConditionalGeneration,Tn=u.LongT5Model,bn=u.LongT5PreTrainedModel,xn=u.M2M100ForConditionalGeneration,Pn=u.M2M100Model,kn=u.M2M100PreTrainedModel,Fn=u.M2M100Tokenizer,yn=u.MBart50Tokenizer,vn=u.MBartForCausalLM,Cn=u.MBartForConditionalGeneration,Sn=u.MBartForSequenceClassification,An=u.MBartModel,En=u.MBartPreTrainedModel,Ln=u.MBartTokenizer,In=u.MPNetForMaskedLM,zn=u.MPNetForQuestionAnswering,Vn=u.MPNetForSequenceClassification,jn=u.MPNetForTokenClassification,Dn=u.MPNetModel,Nn=u.MPNetPreTrainedModel,On=u.MPNetTokenizer,Bn=u.MT5ForConditionalGeneration,Gn=u.MT5Model,Rn=u.MT5PreTrainedModel,qn=u.MarianMTModel,Wn=u.MarianModel,$n=u.MarianPreTrainedModel,Un=u.MarianTokenizer,Xn=u.Mask2FormerImageProcessor,Qn=u.MaskFormerFeatureExtractor,Hn=u.MaskFormerForInstanceSegmentation,Jn=u.MaskFormerImageProcessor,Yn=u.MaskFormerModel,Kn=u.MaskFormerPreTrainedModel,Zn=u.MaskedLMOutput,ea=u.MaxLengthCriteria,ta=u.Metric3DForDepthEstimation,sa=u.Metric3DPreTrainedModel,oa=u.Metric3Dv2ForDepthEstimation,ra=u.Metric3Dv2PreTrainedModel,na=u.MgpstrForSceneTextRecognition,aa=u.MgpstrModelOutput,ia=u.MgpstrPreTrainedModel,la=u.MgpstrProcessor,ca=u.MgpstrTokenizer,da=u.MimiDecoderModel,ua=u.MimiDecoderOutput,_a=u.MimiEncoderModel,ma=u.MimiEncoderOutput,pa=u.MimiModel,ha=u.MimiPreTrainedModel,ga=u.MinLengthLogitsProcessor,fa=u.MinNewTokensLengthLogitsProcessor,Ma=u.MistralForCausalLM,wa=u.MistralModel,Ta=u.MistralPreTrainedModel,ba=u.MobileBertForMaskedLM,xa=u.MobileBertForQuestionAnswering,Pa=u.MobileBertForSequenceClassification,ka=u.MobileBertModel,Fa=u.MobileBertPreTrainedModel,ya=u.MobileBertTokenizer,va=u.MobileLLMForCausalLM,Ca=u.MobileLLMModel,Sa=u.MobileLLMPreTrainedModel,Aa=u.MobileNetV1FeatureExtractor,Ea=u.MobileNetV1ForImageClassification,La=u.MobileNetV1ForSemanticSegmentation,Ia=u.MobileNetV1ImageProcessor,za=u.MobileNetV1Model,Va=u.MobileNetV1PreTrainedModel,ja=u.MobileNetV2FeatureExtractor,Da=u.MobileNetV2ForImageClassification,Na=u.MobileNetV2ForSemanticSegmentation,Oa=u.MobileNetV2ImageProcessor,Ba=u.MobileNetV2Model,Ga=u.MobileNetV2PreTrainedModel,Ra=u.MobileNetV3FeatureExtractor,qa=u.MobileNetV3ForImageClassification,Wa=u.MobileNetV3ForSemanticSegmentation,$a=u.MobileNetV3ImageProcessor,Ua=u.MobileNetV3Model,Xa=u.MobileNetV3PreTrainedModel,Qa=u.MobileNetV4FeatureExtractor,Ha=u.MobileNetV4ForImageClassification,Ja=u.MobileNetV4ForSemanticSegmentation,Ya=u.MobileNetV4ImageProcessor,Ka=u.MobileNetV4Model,Za=u.MobileNetV4PreTrainedModel,ei=u.MobileViTFeatureExtractor,ti=u.MobileViTForImageClassification,si=u.MobileViTImageProcessor,oi=u.MobileViTModel,ri=u.MobileViTPreTrainedModel,ni=u.MobileViTV2ForImageClassification,ai=u.MobileViTV2Model,ii=u.MobileViTV2PreTrainedModel,li=u.ModelOutput,ci=u.ModernBertForMaskedLM,di=u.ModernBertForSequenceClassification,ui=u.ModernBertForTokenClassification,_i=u.ModernBertModel,mi=u.ModernBertPreTrainedModel,pi=u.Moondream1ForConditionalGeneration,hi=u.MoonshineFeatureExtractor,gi=u.MoonshineForConditionalGeneration,fi=u.MoonshineModel,Mi=u.MoonshinePreTrainedModel,wi=u.MoonshineProcessor,Ti=u.MptForCausalLM,bi=u.MptModel,xi=u.MptPreTrainedModel,Pi=u.MultiModalityCausalLM,ki=u.MultiModalityPreTrainedModel,Fi=u.MusicgenForCausalLM,yi=u.MusicgenForConditionalGeneration,vi=u.MusicgenModel,Ci=u.MusicgenPreTrainedModel,Si=u.NllbTokenizer,Ai=u.NoBadWordsLogitsProcessor,Ei=u.NoRepeatNGramLogitsProcessor,Li=u.NomicBertModel,Ii=u.NomicBertPreTrainedModel,zi=u.NougatImageProcessor,Vi=u.NougatTokenizer,ji=u.OPTForCausalLM,Di=u.OPTModel,Ni=u.OPTPreTrainedModel,Oi=u.ObjectDetectionPipeline,Bi=u.Olmo2ForCausalLM,Gi=u.Olmo2Model,Ri=u.Olmo2PreTrainedModel,qi=u.OlmoForCausalLM,Wi=u.OlmoModel,$i=u.OlmoPreTrainedModel,Ui=u.OpenELMForCausalLM,Xi=u.OpenELMModel,Qi=u.OpenELMPreTrainedModel,Hi=u.OwlViTFeatureExtractor,Ji=u.OwlViTForObjectDetection,Yi=u.OwlViTImageProcessor,Ki=u.OwlViTModel,Zi=u.OwlViTPreTrainedModel,el=u.OwlViTProcessor,tl=u.Owlv2ForObjectDetection,sl=u.Owlv2ImageProcessor,ol=u.Owlv2Model,rl=u.Owlv2PreTrainedModel,nl=u.PaliGemmaForConditionalGeneration,al=u.PaliGemmaPreTrainedModel,il=u.PaliGemmaProcessor,ll=u.PatchTSMixerForPrediction,cl=u.PatchTSMixerModel,dl=u.PatchTSMixerPreTrainedModel,ul=u.PatchTSTForPrediction,_l=u.PatchTSTModel,ml=u.PatchTSTPreTrainedModel,pl=u.Phi3ForCausalLM,hl=u.Phi3Model,gl=u.Phi3PreTrainedModel,fl=u.Phi3VForCausalLM,Ml=u.Phi3VImageProcessor,wl=u.Phi3VPreTrainedModel,Tl=u.Phi3VProcessor,bl=u.PhiForCausalLM,xl=u.PhiModel,Pl=u.PhiPreTrainedModel,kl=u.Pipeline,Fl=u.PreTrainedModel,yl=u.PreTrainedTokenizer,vl=u.PretrainedConfig,Cl=u.PretrainedMixin,Sl=u.Processor,Al=u.PvtForImageClassification,El=u.PvtImageProcessor,Ll=u.PvtModel,Il=u.PvtPreTrainedModel,zl=u.PyAnnoteFeatureExtractor,Vl=u.PyAnnoteForAudioFrameClassification,jl=u.PyAnnoteModel,Dl=u.PyAnnotePreTrainedModel,Nl=u.PyAnnoteProcessor,Ol=u.QuestionAnsweringModelOutput,Bl=u.QuestionAnsweringPipeline,Gl=u.Qwen2ForCausalLM,Rl=u.Qwen2Model,ql=u.Qwen2PreTrainedModel,Wl=u.Qwen2Tokenizer,$l=u.Qwen2VLForConditionalGeneration,Ul=u.Qwen2VLImageProcessor,Xl=u.Qwen2VLPreTrainedModel,Ql=u.Qwen2VLProcessor,Hl=u.RTDetrForObjectDetection,Jl=u.RTDetrImageProcessor,Yl=u.RTDetrModel,Kl=u.RTDetrObjectDetectionOutput,Zl=u.RTDetrPreTrainedModel,ec=u.RawAudio,tc=u.RawImage,sc=u.RawVideo,oc=u.RawVideoFrame,rc=u.RepetitionPenaltyLogitsProcessor,nc=u.ResNetForImageClassification,ac=u.ResNetModel,ic=u.ResNetPreTrainedModel,lc=u.RoFormerForMaskedLM,cc=u.RoFormerForQuestionAnswering,dc=u.RoFormerForSequenceClassification,uc=u.RoFormerForTokenClassification,_c=u.RoFormerModel,mc=u.RoFormerPreTrainedModel,pc=u.RoFormerTokenizer,hc=u.RobertaForMaskedLM,gc=u.RobertaForQuestionAnswering,fc=u.RobertaForSequenceClassification,Mc=u.RobertaForTokenClassification,wc=u.RobertaModel,Tc=u.RobertaPreTrainedModel,bc=u.RobertaTokenizer,xc=u.SamImageProcessor,Pc=u.SamImageSegmentationOutput,kc=u.SamModel,Fc=u.SamPreTrainedModel,yc=u.SamProcessor,vc=u.SapiensForDepthEstimation,Cc=u.SapiensForNormalEstimation,Sc=u.SapiensForSemanticSegmentation,Ac=u.SapiensPreTrainedModel,Ec=u.SeamlessM4TFeatureExtractor,Lc=u.SegformerFeatureExtractor,Ic=u.SegformerForImageClassification,zc=u.SegformerForSemanticSegmentation,Vc=u.SegformerImageProcessor,jc=u.SegformerModel,Dc=u.SegformerPreTrainedModel,Nc=u.Seq2SeqLMOutput,Oc=u.SequenceClassifierOutput,Bc=u.SiglipImageProcessor,Gc=u.SiglipModel,Rc=u.SiglipPreTrainedModel,qc=u.SiglipTextModel,Wc=u.SiglipTokenizer,$c=u.SiglipVisionModel,Uc=u.SmolVLMForConditionalGeneration,Xc=u.SmolVLMImageProcessor,Qc=u.SmolVLMProcessor,Hc=u.SnacDecoderModel,Jc=u.SnacEncoderModel,Yc=u.SnacFeatureExtractor,Kc=u.SnacModel,Zc=u.SnacPreTrainedModel,ed=u.SpeechT5FeatureExtractor,td=u.SpeechT5ForSpeechToText,sd=u.SpeechT5ForTextToSpeech,od=u.SpeechT5HifiGan,rd=u.SpeechT5Model,nd=u.SpeechT5PreTrainedModel,ad=u.SpeechT5Processor,id=u.SpeechT5Tokenizer,ld=u.SqueezeBertForMaskedLM,cd=u.SqueezeBertForQuestionAnswering,dd=u.SqueezeBertForSequenceClassification,ud=u.SqueezeBertModel,_d=u.SqueezeBertPreTrainedModel,md=u.SqueezeBertTokenizer,pd=u.StableLmForCausalLM,hd=u.StableLmModel,gd=u.StableLmPreTrainedModel,fd=u.Starcoder2ForCausalLM,Md=u.Starcoder2Model,wd=u.Starcoder2PreTrainedModel,Td=u.StoppingCriteria,bd=u.StoppingCriteriaList,xd=u.StyleTextToSpeech2Model,Pd=u.StyleTextToSpeech2PreTrainedModel,kd=u.SummarizationPipeline,Fd=u.SuppressTokensAtBeginLogitsProcessor,yd=u.Swin2SRForImageSuperResolution,vd=u.Swin2SRImageProcessor,Cd=u.Swin2SRModel,Sd=u.Swin2SRPreTrainedModel,Ad=u.SwinForImageClassification,Ed=u.SwinForSemanticSegmentation,Ld=u.SwinModel,Id=u.SwinPreTrainedModel,zd=u.T5ForConditionalGeneration,Vd=u.T5Model,jd=u.T5PreTrainedModel,Dd=u.T5Tokenizer,Nd=u.TableTransformerForObjectDetection,Od=u.TableTransformerModel,Bd=u.TableTransformerObjectDetectionOutput,Gd=u.TableTransformerPreTrainedModel,Rd=u.TemperatureLogitsWarper,qd=u.Tensor,Wd=u.Text2TextGenerationPipeline,$d=u.TextClassificationPipeline,Ud=u.TextGenerationPipeline,Xd=u.TextStreamer,Qd=u.TextToAudioPipeline,Hd=u.TokenClassificationPipeline,Jd=u.TokenClassifierOutput,Yd=u.TokenizerModel,Kd=u.TopKLogitsWarper,Zd=u.TopPLogitsWarper,eu=u.TrOCRForCausalLM,tu=u.TrOCRPreTrainedModel,su=u.TranslationPipeline,ou=u.UltravoxModel,ru=u.UltravoxPreTrainedModel,nu=u.UltravoxProcessor,au=u.UniSpeechForCTC,iu=u.UniSpeechForSequenceClassification,lu=u.UniSpeechModel,cu=u.UniSpeechPreTrainedModel,du=u.UniSpeechSatForAudioFrameClassification,uu=u.UniSpeechSatForCTC,_u=u.UniSpeechSatForSequenceClassification,mu=u.UniSpeechSatModel,pu=u.UniSpeechSatPreTrainedModel,hu=u.VLChatProcessor,gu=u.VLMImageProcessor,fu=u.ViTFeatureExtractor,Mu=u.ViTForImageClassification,wu=u.ViTImageProcessor,Tu=u.ViTMAEModel,bu=u.ViTMAEPreTrainedModel,xu=u.ViTMSNForImageClassification,Pu=u.ViTMSNModel,ku=u.ViTMSNPreTrainedModel,Fu=u.ViTModel,yu=u.ViTPreTrainedModel,vu=u.VisionEncoderDecoderModel,Cu=u.VitMatteForImageMatting,Su=u.VitMatteImageProcessor,Au=u.VitMattePreTrainedModel,Eu=u.VitPoseForPoseEstimation,Lu=u.VitPoseImageProcessor,Iu=u.VitPosePreTrainedModel,zu=u.VitsModel,Vu=u.VitsModelOutput,ju=u.VitsPreTrainedModel,Du=u.VitsTokenizer,Nu=u.Wav2Vec2BertForCTC,Ou=u.Wav2Vec2BertForSequenceClassification,Bu=u.Wav2Vec2BertModel,Gu=u.Wav2Vec2BertPreTrainedModel,Ru=u.Wav2Vec2CTCTokenizer,qu=u.Wav2Vec2FeatureExtractor,Wu=u.Wav2Vec2ForAudioFrameClassification,$u=u.Wav2Vec2ForCTC,Uu=u.Wav2Vec2ForSequenceClassification,Xu=u.Wav2Vec2Model,Qu=u.Wav2Vec2PreTrainedModel,Hu=u.Wav2Vec2Processor,Ju=u.Wav2Vec2ProcessorWithLM,Yu=u.WavLMForAudioFrameClassification,Ku=u.WavLMForCTC,Zu=u.WavLMForSequenceClassification,e_=u.WavLMForXVector,t_=u.WavLMModel,s_=u.WavLMPreTrainedModel,o_=u.WeSpeakerFeatureExtractor,r_=u.WeSpeakerResNetModel,n_=u.WeSpeakerResNetPreTrainedModel,a_=u.WhisperFeatureExtractor,i_=u.WhisperForConditionalGeneration,l_=u.WhisperModel,c_=u.WhisperPreTrainedModel,d_=u.WhisperProcessor,u_=u.WhisperTextStreamer,__=u.WhisperTimeStampLogitsProcessor,m_=u.WhisperTokenizer,p_=u.XLMForQuestionAnswering,h_=u.XLMForSequenceClassification,g_=u.XLMForTokenClassification,f_=u.XLMModel,M_=u.XLMPreTrainedModel,w_=u.XLMRobertaForMaskedLM,T_=u.XLMRobertaForQuestionAnswering,b_=u.XLMRobertaForSequenceClassification,x_=u.XLMRobertaForTokenClassification,P_=u.XLMRobertaModel,k_=u.XLMRobertaPreTrainedModel,F_=u.XLMRobertaTokenizer,y_=u.XLMTokenizer,v_=u.XLMWithLMHeadModel,C_=u.XVectorOutput,S_=u.YolosFeatureExtractor,A_=u.YolosForObjectDetection,E_=u.YolosImageProcessor,L_=u.YolosModel,I_=u.YolosObjectDetectionOutput,z_=u.YolosPreTrainedModel,V_=u.ZeroShotAudioClassificationPipeline,j_=u.ZeroShotClassificationPipeline,D_=u.ZeroShotImageClassificationPipeline,N_=u.ZeroShotObjectDetectionPipeline,O_=u.bankers_round,B_=u.cat,G_=u.cos_sim,R_=u.dot,q_=u.dynamic_time_warping,W_=u.env,$_=u.full,U_=u.full_like,X_=u.getKeyValueShapes,Q_=u.hamming,H_=u.hanning,J_=u.interpolate,Y_=u.interpolate_4d,K_=u.interpolate_data,Z_=u.is_chinese_char,em=u.layer_norm,tm=u.load_image,sm=u.load_video,om=u.log_softmax,rm=u.magnitude,nm=u.matmul,am=u.max,im=u.mean,lm=u.mean_pooling,cm=u.medianFilter,dm=u.mel_filter_bank,um=u.min,_m=u.ones,mm=u.ones_like,pm=u.permute,hm=u.permute_data,gm=u.pipeline,fm=u.quantize_embeddings,Mm=u.rand,wm=u.read_audio,Tm=u.rfft,bm=u.round,xm=u.slice,Pm=u.softmax,km=u.spectrogram,Fm=u.stack,ym=u.std_mean,vm=u.topk,Cm=u.window_function,Sm=u.zeros,Am=u.zeros_like;export{_ as ASTFeatureExtractor,m as ASTForAudioClassification,p as ASTModel,h as ASTPreTrainedModel,g as AlbertForMaskedLM,f as AlbertForQuestionAnswering,M as AlbertForSequenceClassification,w as AlbertModel,T as AlbertPreTrainedModel,b as AlbertTokenizer,x as AudioClassificationPipeline,P as AutoConfig,k as AutoFeatureExtractor,F as AutoImageProcessor,y as AutoModel,v as AutoModelForAudioClassification,C as AutoModelForAudioFrameClassification,S as AutoModelForAudioTextToText,A as AutoModelForCTC,E as AutoModelForCausalLM,L as AutoModelForDepthEstimation,I as AutoModelForDocumentQuestionAnswering,z as AutoModelForImageClassification,V as AutoModelForImageFeatureExtraction,j as AutoModelForImageMatting,D as AutoModelForImageSegmentation,N as AutoModelForImageTextToText,O as AutoModelForImageToImage,B as AutoModelForMaskGeneration,G as AutoModelForMaskedLM,R as AutoModelForNormalEstimation,q as AutoModelForObjectDetection,W as AutoModelForPoseEstimation,$ as AutoModelForQuestionAnswering,U as AutoModelForSemanticSegmentation,X as AutoModelForSeq2SeqLM,Q as AutoModelForSequenceClassification,H as AutoModelForSpeechSeq2Seq,J as AutoModelForTextToSpectrogram,Y as AutoModelForTextToWaveform,K as AutoModelForTokenClassification,Z as AutoModelForUniversalSegmentation,ee as AutoModelForVision2Seq,te as AutoModelForXVector,se as AutoModelForZeroShotObjectDetection,oe as AutoProcessor,re as AutoTokenizer,ne as AutomaticSpeechRecognitionPipeline,ae as BackgroundRemovalPipeline,ie as BartForConditionalGeneration,le as BartForSequenceClassification,ce as BartModel,de as BartPretrainedModel,ue as BartTokenizer,_e as BaseModelOutput,me as BaseStreamer,pe as BeitFeatureExtractor,he as BeitForImageClassification,ge as BeitModel,fe as BeitPreTrainedModel,Me as BertForMaskedLM,we as BertForQuestionAnswering,Te as BertForSequenceClassification,be as BertForTokenClassification,xe as BertModel,Pe as BertPreTrainedModel,ke as BertTokenizer,Fe as BitImageProcessor,ye as BlenderbotForConditionalGeneration,ve as BlenderbotModel,Ce as BlenderbotPreTrainedModel,Se as BlenderbotSmallForConditionalGeneration,Ae as BlenderbotSmallModel,Ee as BlenderbotSmallPreTrainedModel,Le as BlenderbotSmallTokenizer,Ie as BlenderbotTokenizer,ze as BloomForCausalLM,Ve as BloomModel,je as BloomPreTrainedModel,De as BloomTokenizer,Ne as CLIPFeatureExtractor,Oe as CLIPImageProcessor,Be as CLIPModel,Ge as CLIPPreTrainedModel,Re as CLIPSegForImageSegmentation,qe as CLIPSegModel,We as CLIPSegPreTrainedModel,$e as CLIPTextModel,Ue as CLIPTextModelWithProjection,Xe as CLIPTokenizer,Qe as CLIPVisionModel,He as CLIPVisionModelWithProjection,Je as CamembertForMaskedLM,Ye as CamembertForQuestionAnswering,Ke as CamembertForSequenceClassification,Ze as CamembertForTokenClassification,et as CamembertModel,tt as CamembertPreTrainedModel,st as CamembertTokenizer,ot as CausalLMOutput,rt as CausalLMOutputWithPast,nt as ChineseCLIPFeatureExtractor,at as ChineseCLIPModel,it as ChineseCLIPPreTrainedModel,lt as ClapAudioModelWithProjection,ct as ClapFeatureExtractor,dt as ClapModel,ut as ClapPreTrainedModel,_t as ClapTextModelWithProjection,mt as ClassifierFreeGuidanceLogitsProcessor,pt as CodeGenForCausalLM,ht as CodeGenModel,gt as CodeGenPreTrainedModel,ft as CodeGenTokenizer,Mt as CodeLlamaTokenizer,wt as CohereForCausalLM,Tt as CohereModel,bt as CoherePreTrainedModel,xt as CohereTokenizer,Pt as ConvBertForMaskedLM,kt as ConvBertForQuestionAnswering,Ft as ConvBertForSequenceClassification,yt as ConvBertForTokenClassification,vt as ConvBertModel,Ct as ConvBertPreTrainedModel,St as ConvBertTokenizer,At as ConvNextFeatureExtractor,Et as ConvNextForImageClassification,Lt as ConvNextImageProcessor,It as ConvNextModel,zt as ConvNextPreTrainedModel,Vt as ConvNextV2ForImageClassification,jt as ConvNextV2Model,Dt as ConvNextV2PreTrainedModel,Nt as DPTFeatureExtractor,Ot as DPTForDepthEstimation,Bt as DPTImageProcessor,Gt as DPTModel,Rt as DPTPreTrainedModel,qt as DacDecoderModel,Wt as DacDecoderOutput,$t as DacEncoderModel,Ut as DacEncoderOutput,Xt as DacFeatureExtractor,Qt as DacModel,Ht as DacPreTrainedModel,Jt as DataTypeMap,Yt as DebertaForMaskedLM,Kt as DebertaForQuestionAnswering,Zt as DebertaForSequenceClassification,es as DebertaForTokenClassification,ts as DebertaModel,ss as DebertaPreTrainedModel,os as DebertaTokenizer,rs as DebertaV2ForMaskedLM,ns as DebertaV2ForQuestionAnswering,as as DebertaV2ForSequenceClassification,is as DebertaV2ForTokenClassification,ls as DebertaV2Model,cs as DebertaV2PreTrainedModel,ds as DebertaV2Tokenizer,us as DecisionTransformerModel,_s as DecisionTransformerPreTrainedModel,ms as DeiTFeatureExtractor,ps as DeiTForImageClassification,hs as DeiTImageProcessor,gs as DeiTModel,fs as DeiTPreTrainedModel,Ms as DepthAnythingForDepthEstimation,ws as DepthAnythingPreTrainedModel,Ts as DepthEstimationPipeline,bs as DepthProForDepthEstimation,xs as DepthProPreTrainedModel,Ps as DetrFeatureExtractor,ks as DetrForObjectDetection,Fs as DetrForSegmentation,ys as DetrImageProcessor,vs as DetrModel,Cs as DetrObjectDetectionOutput,Ss as DetrPreTrainedModel,As as DetrSegmentationOutput,Es as Dinov2ForImageClassification,Ls as Dinov2Model,Is as Dinov2PreTrainedModel,zs as Dinov2WithRegistersForImageClassification,Vs as Dinov2WithRegistersModel,js as Dinov2WithRegistersPreTrainedModel,Ds as DistilBertForMaskedLM,Ns as DistilBertForQuestionAnswering,Os as DistilBertForSequenceClassification,Bs as DistilBertForTokenClassification,Gs as DistilBertModel,Rs as DistilBertPreTrainedModel,qs as DistilBertTokenizer,Ws as DocumentQuestionAnsweringPipeline,$s as DonutFeatureExtractor,Us as DonutImageProcessor,Xs as DonutSwinModel,Qs as DonutSwinPreTrainedModel,Hs as EfficientNetForImageClassification,Js as EfficientNetImageProcessor,Ys as EfficientNetModel,Ks as EfficientNetPreTrainedModel,Zs as ElectraForMaskedLM,eo as ElectraForQuestionAnswering,to as ElectraForSequenceClassification,so as ElectraForTokenClassification,oo as ElectraModel,ro as ElectraPreTrainedModel,no as ElectraTokenizer,ao as EncodecFeatureExtractor,io as EosTokenCriteria,lo as EsmForMaskedLM,co as EsmForSequenceClassification,uo as EsmForTokenClassification,_o as EsmModel,mo as EsmPreTrainedModel,po as EsmTokenizer,ho as ExaoneForCausalLM,go as ExaoneModel,fo as ExaonePreTrainedModel,Mo as FFT,wo as FalconForCausalLM,To as FalconModel,bo as FalconPreTrainedModel,xo as FalconTokenizer,Po as FastViTForImageClassification,ko as FastViTModel,Fo as FastViTPreTrainedModel,yo as FeatureExtractionPipeline,vo as FeatureExtractor,Co as FillMaskPipeline,So as Florence2ForConditionalGeneration,Ao as Florence2PreTrainedModel,Eo as Florence2Processor,Lo as ForcedBOSTokenLogitsProcessor,Io as ForcedEOSTokenLogitsProcessor,zo as GLPNFeatureExtractor,Vo as GLPNForDepthEstimation,jo as GLPNModel,Do as GLPNPreTrainedModel,No as GPT2LMHeadModel,Oo as GPT2Model,Bo as GPT2PreTrainedModel,Go as GPT2Tokenizer,Ro as GPTBigCodeForCausalLM,qo as GPTBigCodeModel,Wo as GPTBigCodePreTrainedModel,$o as GPTJForCausalLM,Uo as GPTJModel,Xo as GPTJPreTrainedModel,Qo as GPTNeoForCausalLM,Ho as GPTNeoModel,Jo as GPTNeoPreTrainedModel,Yo as GPTNeoXForCausalLM,Ko as GPTNeoXModel,Zo as GPTNeoXPreTrainedModel,er as GPTNeoXTokenizer,tr as Gemma2ForCausalLM,sr as Gemma2Model,or as Gemma2PreTrainedModel,rr as Gemma3ForCausalLM,nr as Gemma3Model,ar as Gemma3PreTrainedModel,ir as GemmaForCausalLM,lr as GemmaModel,cr as GemmaPreTrainedModel,dr as GemmaTokenizer,ur as GlmForCausalLM,_r as GlmModel,mr as GlmPreTrainedModel,pr as GraniteForCausalLM,hr as GraniteModel,gr as GranitePreTrainedModel,fr as Grok1Tokenizer,Mr as GroundingDinoForObjectDetection,wr as GroundingDinoImageProcessor,Tr as GroundingDinoPreTrainedModel,br as GroundingDinoProcessor,xr as GroupViTModel,Pr as GroupViTPreTrainedModel,kr as HeliumForCausalLM,Fr as HeliumModel,yr as HeliumPreTrainedModel,vr as HerbertTokenizer,Cr as HieraForImageClassification,Sr as HieraModel,Ar as HieraPreTrainedModel,Er as HubertForCTC,Lr as HubertForSequenceClassification,Ir as HubertModel,zr as HubertPreTrainedModel,Vr as IJepaForImageClassification,jr as IJepaModel,Dr as IJepaPreTrainedModel,Nr as Idefics3ForConditionalGeneration,Or as Idefics3ImageProcessor,Br as Idefics3PreTrainedModel,Gr as Idefics3Processor,Rr as ImageClassificationPipeline,qr as ImageFeatureExtractionPipeline,Wr as ImageFeatureExtractor,$r as ImageMattingOutput,Ur as ImageProcessor,Xr as ImageSegmentationPipeline,Qr as ImageToImagePipeline,Hr as ImageToTextPipeline,Jr as InterruptableStoppingCriteria,Yr as JAISLMHeadModel,Kr as JAISModel,Zr as JAISPreTrainedModel,en as JinaCLIPImageProcessor,tn as JinaCLIPModel,sn as JinaCLIPPreTrainedModel,on as JinaCLIPProcessor,rn as JinaCLIPTextModel,nn as JinaCLIPVisionModel,an as LiteWhisperForConditionalGeneration,ln as LlamaForCausalLM,cn as LlamaModel,dn as LlamaPreTrainedModel,un as LlamaTokenizer,_n as LlavaForConditionalGeneration,mn as LlavaOnevisionForConditionalGeneration,pn as LlavaOnevisionImageProcessor,hn as LlavaPreTrainedModel,gn as LogitsProcessor,fn as LogitsProcessorList,Mn as LogitsWarper,wn as LongT5ForConditionalGeneration,Tn as LongT5Model,bn as LongT5PreTrainedModel,xn as M2M100ForConditionalGeneration,Pn as M2M100Model,kn as M2M100PreTrainedModel,Fn as M2M100Tokenizer,yn as MBart50Tokenizer,vn as MBartForCausalLM,Cn as MBartForConditionalGeneration,Sn as MBartForSequenceClassification,An as MBartModel,En as MBartPreTrainedModel,Ln as MBartTokenizer,In as MPNetForMaskedLM,zn as MPNetForQuestionAnswering,Vn as MPNetForSequenceClassification,jn as MPNetForTokenClassification,Dn as MPNetModel,Nn as MPNetPreTrainedModel,On as MPNetTokenizer,Bn as MT5ForConditionalGeneration,Gn as MT5Model,Rn as MT5PreTrainedModel,qn as MarianMTModel,Wn as MarianModel,$n as MarianPreTrainedModel,Un as MarianTokenizer,Xn as Mask2FormerImageProcessor,Qn as MaskFormerFeatureExtractor,Hn as MaskFormerForInstanceSegmentation,Jn as MaskFormerImageProcessor,Yn as MaskFormerModel,Kn as MaskFormerPreTrainedModel,Zn as MaskedLMOutput,ea as MaxLengthCriteria,ta as Metric3DForDepthEstimation,sa as Metric3DPreTrainedModel,oa as Metric3Dv2ForDepthEstimation,ra as Metric3Dv2PreTrainedModel,na as MgpstrForSceneTextRecognition,aa as MgpstrModelOutput,ia as MgpstrPreTrainedModel,la as MgpstrProcessor,ca as MgpstrTokenizer,da as MimiDecoderModel,ua as MimiDecoderOutput,_a as MimiEncoderModel,ma as MimiEncoderOutput,pa as MimiModel,ha as MimiPreTrainedModel,ga as MinLengthLogitsProcessor,fa as MinNewTokensLengthLogitsProcessor,Ma as MistralForCausalLM,wa as MistralModel,Ta as MistralPreTrainedModel,ba as MobileBertForMaskedLM,xa as MobileBertForQuestionAnswering,Pa as MobileBertForSequenceClassification,ka as MobileBertModel,Fa as MobileBertPreTrainedModel,ya as MobileBertTokenizer,va as MobileLLMForCausalLM,Ca as MobileLLMModel,Sa as MobileLLMPreTrainedModel,Aa as MobileNetV1FeatureExtractor,Ea as MobileNetV1ForImageClassification,La as MobileNetV1ForSemanticSegmentation,Ia as MobileNetV1ImageProcessor,za as MobileNetV1Model,Va as MobileNetV1PreTrainedModel,ja as MobileNetV2FeatureExtractor,Da as MobileNetV2ForImageClassification,Na as MobileNetV2ForSemanticSegmentation,Oa as MobileNetV2ImageProcessor,Ba as MobileNetV2Model,Ga as MobileNetV2PreTrainedModel,Ra as MobileNetV3FeatureExtractor,qa as MobileNetV3ForImageClassification,Wa as MobileNetV3ForSemanticSegmentation,$a as MobileNetV3ImageProcessor,Ua as MobileNetV3Model,Xa as MobileNetV3PreTrainedModel,Qa as MobileNetV4FeatureExtractor,Ha as MobileNetV4ForImageClassification,Ja as MobileNetV4ForSemanticSegmentation,Ya as MobileNetV4ImageProcessor,Ka as MobileNetV4Model,Za as MobileNetV4PreTrainedModel,ei as MobileViTFeatureExtractor,ti as MobileViTForImageClassification,si as MobileViTImageProcessor,oi as MobileViTModel,ri as MobileViTPreTrainedModel,ni as MobileViTV2ForImageClassification,ai as MobileViTV2Model,ii as MobileViTV2PreTrainedModel,li as ModelOutput,ci as ModernBertForMaskedLM,di as ModernBertForSequenceClassification,ui as ModernBertForTokenClassification,_i as ModernBertModel,mi as ModernBertPreTrainedModel,pi as Moondream1ForConditionalGeneration,hi as MoonshineFeatureExtractor,gi as MoonshineForConditionalGeneration,fi as MoonshineModel,Mi as MoonshinePreTrainedModel,wi as MoonshineProcessor,Ti as MptForCausalLM,bi as MptModel,xi as MptPreTrainedModel,Pi as MultiModalityCausalLM,ki as MultiModalityPreTrainedModel,Fi as MusicgenForCausalLM,yi as MusicgenForConditionalGeneration,vi as MusicgenModel,Ci as MusicgenPreTrainedModel,Si as NllbTokenizer,Ai as NoBadWordsLogitsProcessor,Ei as NoRepeatNGramLogitsProcessor,Li as NomicBertModel,Ii as NomicBertPreTrainedModel,zi as NougatImageProcessor,Vi as NougatTokenizer,ji as OPTForCausalLM,Di as OPTModel,Ni as OPTPreTrainedModel,Oi as ObjectDetectionPipeline,Bi as Olmo2ForCausalLM,Gi as Olmo2Model,Ri as Olmo2PreTrainedModel,qi as OlmoForCausalLM,Wi as OlmoModel,$i as OlmoPreTrainedModel,Ui as OpenELMForCausalLM,Xi as OpenELMModel,Qi as OpenELMPreTrainedModel,Hi as OwlViTFeatureExtractor,Ji as OwlViTForObjectDetection,Yi as OwlViTImageProcessor,Ki as OwlViTModel,Zi as OwlViTPreTrainedModel,el as OwlViTProcessor,tl as Owlv2ForObjectDetection,sl as Owlv2ImageProcessor,ol as Owlv2Model,rl as Owlv2PreTrainedModel,nl as PaliGemmaForConditionalGeneration,al as PaliGemmaPreTrainedModel,il as PaliGemmaProcessor,ll as PatchTSMixerForPrediction,cl as PatchTSMixerModel,dl as PatchTSMixerPreTrainedModel,ul as PatchTSTForPrediction,_l as PatchTSTModel,ml as PatchTSTPreTrainedModel,pl as Phi3ForCausalLM,hl as Phi3Model,gl as Phi3PreTrainedModel,fl as Phi3VForCausalLM,Ml as Phi3VImageProcessor,wl as Phi3VPreTrainedModel,Tl as Phi3VProcessor,bl as PhiForCausalLM,xl as PhiModel,Pl as PhiPreTrainedModel,kl as Pipeline,Fl as PreTrainedModel,yl as PreTrainedTokenizer,vl as PretrainedConfig,Cl as PretrainedMixin,Sl as Processor,Al as PvtForImageClassification,El as PvtImageProcessor,Ll as PvtModel,Il as PvtPreTrainedModel,zl as PyAnnoteFeatureExtractor,Vl as PyAnnoteForAudioFrameClassification,jl as PyAnnoteModel,Dl as PyAnnotePreTrainedModel,Nl as PyAnnoteProcessor,Ol as QuestionAnsweringModelOutput,Bl as QuestionAnsweringPipeline,Gl as Qwen2ForCausalLM,Rl as Qwen2Model,ql as Qwen2PreTrainedModel,Wl as Qwen2Tokenizer,$l as Qwen2VLForConditionalGeneration,Ul as Qwen2VLImageProcessor,Xl as Qwen2VLPreTrainedModel,Ql as Qwen2VLProcessor,Hl as RTDetrForObjectDetection,Jl as RTDetrImageProcessor,Yl as RTDetrModel,Kl as RTDetrObjectDetectionOutput,Zl as RTDetrPreTrainedModel,ec as RawAudio,tc as RawImage,sc as RawVideo,oc as RawVideoFrame,rc as RepetitionPenaltyLogitsProcessor,nc as ResNetForImageClassification,ac as ResNetModel,ic as ResNetPreTrainedModel,lc as RoFormerForMaskedLM,cc as RoFormerForQuestionAnswering,dc as RoFormerForSequenceClassification,uc as RoFormerForTokenClassification,_c as RoFormerModel,mc as RoFormerPreTrainedModel,pc as RoFormerTokenizer,hc as RobertaForMaskedLM,gc as RobertaForQuestionAnswering,fc as RobertaForSequenceClassification,Mc as RobertaForTokenClassification,wc as RobertaModel,Tc as RobertaPreTrainedModel,bc as RobertaTokenizer,xc as SamImageProcessor,Pc as SamImageSegmentationOutput,kc as SamModel,Fc as SamPreTrainedModel,yc as SamProcessor,vc as SapiensForDepthEstimation,Cc as SapiensForNormalEstimation,Sc as SapiensForSemanticSegmentation,Ac as SapiensPreTrainedModel,Ec as SeamlessM4TFeatureExtractor,Lc as SegformerFeatureExtractor,Ic as SegformerForImageClassification,zc as SegformerForSemanticSegmentation,Vc as SegformerImageProcessor,jc as SegformerModel,Dc as SegformerPreTrainedModel,Nc as Seq2SeqLMOutput,Oc as SequenceClassifierOutput,Bc as SiglipImageProcessor,Gc as SiglipModel,Rc as SiglipPreTrainedModel,qc as SiglipTextModel,Wc as SiglipTokenizer,$c as SiglipVisionModel,Uc as SmolVLMForConditionalGeneration,Xc as SmolVLMImageProcessor,Qc as SmolVLMProcessor,Hc as SnacDecoderModel,Jc as SnacEncoderModel,Yc as SnacFeatureExtractor,Kc as SnacModel,Zc as SnacPreTrainedModel,ed as SpeechT5FeatureExtractor,td as SpeechT5ForSpeechToText,sd as SpeechT5ForTextToSpeech,od as SpeechT5HifiGan,rd as SpeechT5Model,nd as SpeechT5PreTrainedModel,ad as SpeechT5Processor,id as SpeechT5Tokenizer,ld as SqueezeBertForMaskedLM,cd as SqueezeBertForQuestionAnswering,dd as SqueezeBertForSequenceClassification,ud as SqueezeBertModel,_d as SqueezeBertPreTrainedModel,md as SqueezeBertTokenizer,pd as StableLmForCausalLM,hd as StableLmModel,gd as StableLmPreTrainedModel,fd as Starcoder2ForCausalLM,Md as Starcoder2Model,wd as Starcoder2PreTrainedModel,Td as StoppingCriteria,bd as StoppingCriteriaList,xd as StyleTextToSpeech2Model,Pd as StyleTextToSpeech2PreTrainedModel,kd as SummarizationPipeline,Fd as SuppressTokensAtBeginLogitsProcessor,yd as Swin2SRForImageSuperResolution,vd as Swin2SRImageProcessor,Cd as Swin2SRModel,Sd as Swin2SRPreTrainedModel,Ad as SwinForImageClassification,Ed as SwinForSemanticSegmentation,Ld as SwinModel,Id as SwinPreTrainedModel,zd as T5ForConditionalGeneration,Vd as T5Model,jd as T5PreTrainedModel,Dd as T5Tokenizer,Nd as TableTransformerForObjectDetection,Od as TableTransformerModel,Bd as TableTransformerObjectDetectionOutput,Gd as TableTransformerPreTrainedModel,Rd as TemperatureLogitsWarper,qd as Tensor,Wd as Text2TextGenerationPipeline,$d as TextClassificationPipeline,Ud as TextGenerationPipeline,Xd as TextStreamer,Qd as TextToAudioPipeline,Hd as TokenClassificationPipeline,Jd as TokenClassifierOutput,Yd as TokenizerModel,Kd as TopKLogitsWarper,Zd as TopPLogitsWarper,eu as TrOCRForCausalLM,tu as TrOCRPreTrainedModel,su as TranslationPipeline,ou as UltravoxModel,ru as UltravoxPreTrainedModel,nu as UltravoxProcessor,au as UniSpeechForCTC,iu as UniSpeechForSequenceClassification,lu as UniSpeechModel,cu as UniSpeechPreTrainedModel,du as UniSpeechSatForAudioFrameClassification,uu as UniSpeechSatForCTC,_u as UniSpeechSatForSequenceClassification,mu as UniSpeechSatModel,pu as UniSpeechSatPreTrainedModel,hu as VLChatProcessor,gu as VLMImageProcessor,fu as ViTFeatureExtractor,Mu as ViTForImageClassification,wu as ViTImageProcessor,Tu as ViTMAEModel,bu as ViTMAEPreTrainedModel,xu as ViTMSNForImageClassification,Pu as ViTMSNModel,ku as ViTMSNPreTrainedModel,Fu as ViTModel,yu as ViTPreTrainedModel,vu as VisionEncoderDecoderModel,Cu as VitMatteForImageMatting,Su as VitMatteImageProcessor,Au as VitMattePreTrainedModel,Eu as VitPoseForPoseEstimation,Lu as VitPoseImageProcessor,Iu as VitPosePreTrainedModel,zu as VitsModel,Vu as VitsModelOutput,ju as VitsPreTrainedModel,Du as VitsTokenizer,Nu as Wav2Vec2BertForCTC,Ou as Wav2Vec2BertForSequenceClassification,Bu as Wav2Vec2BertModel,Gu as Wav2Vec2BertPreTrainedModel,Ru as Wav2Vec2CTCTokenizer,qu as Wav2Vec2FeatureExtractor,Wu as Wav2Vec2ForAudioFrameClassification,$u as Wav2Vec2ForCTC,Uu as Wav2Vec2ForSequenceClassification,Xu as Wav2Vec2Model,Qu as Wav2Vec2PreTrainedModel,Hu as Wav2Vec2Processor,Ju as Wav2Vec2ProcessorWithLM,Yu as WavLMForAudioFrameClassification,Ku as WavLMForCTC,Zu as WavLMForSequenceClassification,e_ as WavLMForXVector,t_ as WavLMModel,s_ as WavLMPreTrainedModel,o_ as WeSpeakerFeatureExtractor,r_ as WeSpeakerResNetModel,n_ as WeSpeakerResNetPreTrainedModel,a_ as WhisperFeatureExtractor,i_ as WhisperForConditionalGeneration,l_ as WhisperModel,c_ as WhisperPreTrainedModel,d_ as WhisperProcessor,u_ as WhisperTextStreamer,__ as WhisperTimeStampLogitsProcessor,m_ as WhisperTokenizer,p_ as XLMForQuestionAnswering,h_ as XLMForSequenceClassification,g_ as XLMForTokenClassification,f_ as XLMModel,M_ as XLMPreTrainedModel,w_ as XLMRobertaForMaskedLM,T_ as XLMRobertaForQuestionAnswering,b_ as XLMRobertaForSequenceClassification,x_ as XLMRobertaForTokenClassification,P_ as XLMRobertaModel,k_ as XLMRobertaPreTrainedModel,F_ as XLMRobertaTokenizer,y_ as XLMTokenizer,v_ as XLMWithLMHeadModel,C_ as XVectorOutput,S_ as YolosFeatureExtractor,A_ as YolosForObjectDetection,E_ as YolosImageProcessor,L_ as YolosModel,I_ as YolosObjectDetectionOutput,z_ as YolosPreTrainedModel,V_ as ZeroShotAudioClassificationPipeline,j_ as ZeroShotClassificationPipeline,D_ as ZeroShotImageClassificationPipeline,N_ as ZeroShotObjectDetectionPipeline,O_ as bankers_round,B_ as cat,G_ as cos_sim,R_ as dot,q_ as dynamic_time_warping,W_ as env,$_ as full,U_ as full_like,X_ as getKeyValueShapes,Q_ as hamming,H_ as hanning,J_ as interpolate,Y_ as interpolate_4d,K_ as interpolate_data,Z_ as is_chinese_char,em as layer_norm,tm as load_image,sm as load_video,om as log_softmax,rm as magnitude,nm as matmul,am as max,im as mean,lm as mean_pooling,cm as medianFilter,dm as mel_filter_bank,um as min,_m as ones,mm as ones_like,pm as permute,hm as permute_data,gm as pipeline,fm as quantize_embeddings,Mm as rand,wm as read_audio,Tm as rfft,bm as round,xm as slice,Pm as softmax,km as spectrogram,Fm as stack,ym as std_mean,vm as topk,Cm as window_function,Sm as zeros,Am as zeros_like};
|
|
2
2
|
//# sourceMappingURL=transformers.node.min.mjs.map
|