@huggingface/transformers 3.0.0 → 3.0.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.
@@ -19,7 +19,7 @@ import*as e from"fs";import*as t from"onnxruntime-node";import*as r from"path";i
19
19
  \*************************************/()=>{},"./node_modules/@huggingface/jinja/dist/index.js":
20
20
  /*!*******************************************************!*\
21
21
  !*** ./node_modules/@huggingface/jinja/dist/index.js ***!
22
- \*******************************************************/(e,t,r)=>{r.r(t),r.d(t,{Environment:()=>Y,Interpreter:()=>J,Template:()=>ee,parse:()=>B,tokenize:()=>d});var n=Object.freeze({Text:"Text",NumericLiteral:"NumericLiteral",BooleanLiteral:"BooleanLiteral",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"}),o=Object.freeze({set:n.Set,for:n.For,in:n.In,is:n.Is,if:n.If,else:n.Else,endif:n.EndIf,elif:n.ElseIf,endfor:n.EndFor,and:n.And,or:n.Or,not:n.Not,"not in":n.NotIn,macro:n.Macro,endmacro:n.EndMacro,true:n.BooleanLiteral,false:n.BooleanLiteral,True:n.BooleanLiteral,False:n.BooleanLiteral}),s=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=[["{%",n.OpenStatement],["%}",n.CloseStatement],["{{",n.OpenExpression],["}}",n.CloseExpression],["(",n.OpenParen],[")",n.CloseParen],["{",n.OpenCurlyBracket],["}",n.CloseCurlyBracket],["[",n.OpenSquareBracket],["]",n.CloseSquareBracket],[",",n.Comma],[".",n.Dot],[":",n.Colon],["|",n.Pipe],["<=",n.ComparisonBinaryOperator],[">=",n.ComparisonBinaryOperator],["==",n.ComparisonBinaryOperator],["!=",n.ComparisonBinaryOperator],["<",n.ComparisonBinaryOperator],[">",n.ComparisonBinaryOperator],["+",n.AdditiveBinaryOperator],["-",n.AdditiveBinaryOperator],["*",n.MultiplicativeBinaryOperator],["/",n.MultiplicativeBinaryOperator],["%",n.MultiplicativeBinaryOperator],["=",n.Equals]],c=new Map([["n","\n"],["t","\t"],["r","\r"],["b","\b"],["f","\f"],["v","\v"],["'","'"],['"','"'],["\\","\\"]]);function d(e,t={}){const r=[],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 p=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++],r=c.get(e);if(void 0===r)throw new SyntaxError(`Unexpected escaped character: ${e}`);t+=r}return t};e:for(;u<d.length;){const e=r.at(-1)?.type;if(void 0===e||e===n.CloseStatement||e===n.CloseExpression){let e="";for(;u<d.length&&("{"!==d[u]||"%"!==d[u+1]&&"{"!==d[u+1]);)e+=d[u++];if(e.length>0){r.push(new s(e,n.Text));continue}}p((e=>/\s/.test(e)));const t=d[u];if("-"===t||"+"===t){const e=r.at(-1)?.type;if(e===n.Text||void 0===e)throw new SyntaxError(`Unexpected character: ${t}`);switch(e){case n.Identifier:case n.NumericLiteral:case n.BooleanLiteral:case n.StringLiteral:case n.CloseParen:case n.CloseSquareBracket:break;default:{++u;const e=p(i);r.push(new s(`${t}${e}`,e.length>0?n.NumericLiteral:n.UnaryOperator));continue}}}for(const[e,t]of l){if(d.slice(u,u+e.length)===e){r.push(new s(e,t)),u+=e.length;continue e}}if("'"!==t&&'"'!==t)if(i(t)){const e=p(i);r.push(new s(e,n.NumericLiteral))}else{if(!a(t))throw new SyntaxError(`Unexpected character: ${t}`);{const e=p(a),t=Object.hasOwn(o,e)?o[e]:n.Identifier;t===n.In&&r.at(-1)?.type===n.Not?(r.pop(),r.push(new s("not in",n.NotIn))):r.push(new s(e,t))}}else{++u;const e=p((e=>e!==t));r.push(new s(e,n.StringLiteral)),++u}}return r}var u=class{type="Statement"},p=class extends u{constructor(e){super(),this.body=e}type="Program"},h=class extends u{constructor(e,t,r){super(),this.test=e,this.body=t,this.alternate=r}type="If"},m=class extends u{constructor(e,t,r,n){super(),this.loopvar=e,this.iterable=t,this.body=r,this.defaultBlock=n}type="For"},_=class extends u{constructor(e,t){super(),this.assignee=e,this.value=t}type="Set"},f=class extends u{constructor(e,t,r){super(),this.name=e,this.args=t,this.body=r}type="Macro"},g=class extends u{type="Expression"},M=class extends g{constructor(e,t,r){super(),this.object=e,this.property=t,this.computed=r}type="MemberExpression"},w=class extends g{constructor(e,t){super(),this.callee=e,this.args=t}type="CallExpression"},T=class extends g{constructor(e){super(),this.value=e}type="Identifier"},b=class extends g{constructor(e){super(),this.value=e}type="Literal"},x=class extends b{type="NumericLiteral"},y=class extends b{type="StringLiteral"},k=class extends b{type="BooleanLiteral"},F=class extends b{type="ArrayLiteral"},P=class extends b{type="TupleLiteral"},C=class extends b{type="ObjectLiteral"},v=class extends g{constructor(e,t,r){super(),this.operator=e,this.left=t,this.right=r}type="BinaryExpression"},S=class extends g{constructor(e,t){super(),this.operand=e,this.filter=t}type="FilterExpression"},A=class extends g{constructor(e,t){super(),this.iterable=e,this.test=t}type="SelectExpression"},E=class extends g{constructor(e,t,r){super(),this.operand=e,this.negate=t,this.test=r}type="TestExpression"},L=class extends g{constructor(e,t){super(),this.operator=e,this.argument=t}type="UnaryExpression"},z=class extends g{constructor(e=void 0,t=void 0,r=void 0){super(),this.start=e,this.stop=t,this.step=r}type="SliceExpression"},I=class extends g{constructor(e,t){super(),this.key=e,this.value=t}type="KeywordArgumentExpression"};function B(e){const t=new p([]);let r=0;function o(t,n){const o=e[r++];if(!o||o.type!==t)throw new Error(`Parser Error: ${n}. ${o.type} !== ${t}.`);return o}function s(){switch(e[r].type){case n.Text:return new y(o(n.Text,"Expected text token").value);case n.OpenStatement:return function(){let t;switch(o(n.OpenStatement,"Expected opening statement token"),e[r].type){case n.Set:++r,t=l(),o(n.CloseStatement,"Expected closing statement token");break;case n.If:++r,t=c(),o(n.OpenStatement,"Expected {% token"),o(n.EndIf,"Expected endif token"),o(n.CloseStatement,"Expected %} token");break;case n.Macro:++r,t=function(){const e=q();if("Identifier"!==e.type)throw new SyntaxError("Expected identifier following macro statement");const t=V();o(n.CloseStatement,"Expected closing statement token");const r=[];for(;a(n.OpenStatement,n.EndMacro);)r.push(s());return new f(e,t,r)}(),o(n.OpenStatement,"Expected {% token"),o(n.EndMacro,"Expected endmacro token"),o(n.CloseStatement,"Expected %} token");break;case n.For:++r,t=function(){const e=d(!0);if(!(e instanceof T||e instanceof P))throw new SyntaxError(`Expected identifier/tuple for the loop variable, got ${e.type} instead`);o(n.In,"Expected `in` keyword following loop variable");const t=u();o(n.CloseStatement,"Expected closing statement token");const l=[];for(;a(n.OpenStatement,n.EndFor)&&a(n.OpenStatement,n.Else);)l.push(s());const c=[];if(i(n.OpenStatement,n.Else))for(++r,++r,o(n.CloseStatement,"Expected closing statement token");a(n.OpenStatement,n.EndFor);)c.push(s());return new m(e,t,l,c)}(),o(n.OpenStatement,"Expected {% token"),o(n.EndFor,"Expected endfor token"),o(n.CloseStatement,"Expected %} token");break;default:throw new SyntaxError(`Unknown statement type: ${e[r].type}`)}return t}();case n.OpenExpression:return function(){o(n.OpenExpression,"Expected opening expression token");const e=u();return o(n.CloseExpression,"Expected closing expression token"),e}();default:throw new SyntaxError(`Unexpected token type: ${e[r].type}`)}}function a(...t){return r+t.length<=e.length&&t.some(((t,n)=>t!==e[r+n].type))}function i(...t){return r+t.length<=e.length&&t.every(((t,n)=>t===e[r+n].type))}function l(){const e=u();if(i(n.Equals)){++r;const t=l();return new _(e,t)}return e}function c(){const t=u();o(n.CloseStatement,"Expected closing statement token");const a=[],l=[];for(;e[r]?.type!==n.OpenStatement||e[r+1]?.type!==n.ElseIf&&e[r+1]?.type!==n.Else&&e[r+1]?.type!==n.EndIf;)a.push(s());if(e[r]?.type===n.OpenStatement&&e[r+1]?.type!==n.EndIf)if(++r,i(n.ElseIf))o(n.ElseIf,"Expected elseif token"),l.push(c());else for(o(n.Else,"Expected else token"),o(n.CloseStatement,"Expected closing statement token");e[r]?.type!==n.OpenStatement||e[r+1]?.type!==n.EndIf;)l.push(s());return new h(t,a,l)}function d(e=!1){const t=e?q:u,o=[t()],s=i(n.Comma);for(;s&&(++r,o.push(t()),i(n.Comma)););return s?new P(o):o[0]}function u(){return function(){const e=g();if(i(n.If)){++r;const t=g();if(i(n.Else)){++r;const n=g();return new h(t,[e],[n])}return new A(e,t)}return e}()}function g(){let t=b();for(;i(n.Or);){const n=e[r];++r;const o=b();t=new v(n,t,o)}return t}function b(){let t=B();for(;i(n.And);){const n=e[r];++r;const o=B();t=new v(n,t,o)}return t}function B(){let t;for(;i(n.Not);){const n=e[r];++r;const o=B();t=new L(n,o)}return t??function(){let t=N();for(;i(n.ComparisonBinaryOperator)||i(n.In)||i(n.NotIn);){const n=e[r];++r;const o=N();t=new v(n,t,o)}return t}()}function N(){let t=R();for(;i(n.AdditiveBinaryOperator);){const n=e[r];++r;const o=R();t=new v(n,t,o)}return t}function D(){const t=function(){let t=q();for(;i(n.Dot)||i(n.OpenSquareBracket);){const s=e[r];let a;++r;const i=s.type!==n.Dot;if(i)a=j(),o(n.CloseSquareBracket,"Expected closing square bracket");else if(a=q(),"Identifier"!==a.type)throw new SyntaxError("Expected identifier following dot operator");t=new M(t,a,i)}return t}();return i(n.OpenParen)?O(t):t}function O(e){let t=new w(e,V());return i(n.OpenParen)&&(t=O(t)),t}function V(){o(n.OpenParen,"Expected opening parenthesis for arguments list");const e=function(){const e=[];for(;!i(n.CloseParen);){let t=u();if(i(n.Equals)){if(++r,!(t instanceof T))throw new SyntaxError("Expected identifier for keyword argument");const e=u();t=new I(t,e)}e.push(t),i(n.Comma)&&++r}return e}();return o(n.CloseParen,"Expected closing parenthesis for arguments list"),e}function j(){const e=[];let t=!1;for(;!i(n.CloseSquareBracket);)i(n.Colon)?(e.push(void 0),++r,t=!0):(e.push(u()),i(n.Colon)&&(++r,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 R(){let t=G();for(;i(n.MultiplicativeBinaryOperator);){const n=e[r];++r;const o=G();t=new v(n,t,o)}return t}function G(){let e=function(){let e=D();for(;i(n.Pipe);){++r;let t=q();if(!(t instanceof T))throw new SyntaxError("Expected identifier for the filter");i(n.OpenParen)&&(t=O(t)),e=new S(e,t)}return e}();for(;i(n.Is);){++r;const t=i(n.Not);t&&++r;let o=q();if(o instanceof k&&(o=new T(o.value.toString())),!(o instanceof T))throw new SyntaxError("Expected identifier for the test");e=new E(e,t,o)}return e}function q(){const t=e[r];switch(t.type){case n.NumericLiteral:return++r,new x(Number(t.value));case n.StringLiteral:return++r,new y(t.value);case n.BooleanLiteral:return++r,new k("true"===t.value.toLowerCase());case n.Identifier:return++r,new T(t.value);case n.OpenParen:{++r;const t=d();if(e[r].type!==n.CloseParen)throw new SyntaxError(`Expected closing parenthesis, got ${e[r].type} instead`);return++r,t}case n.OpenSquareBracket:{++r;const e=[];for(;!i(n.CloseSquareBracket);)e.push(u()),i(n.Comma)&&++r;return++r,new F(e)}case n.OpenCurlyBracket:{++r;const e=new Map;for(;!i(n.CloseCurlyBracket);){const t=u();o(n.Colon,"Expected colon between key and value in object literal");const s=u();e.set(t,s),i(n.Comma)&&++r}return++r,new C(e)}default:throw new SyntaxError(`Unexpected token: ${t.type}`)}}for(;r<e.length;)t.body.push(s());return t}function N(e,t,r=1){void 0===t&&(t=e,e=0);const n=[];for(let o=e;o<t;o+=r)n.push(o);return n}function D(e,t,r,n=1){const o=Math.sign(n);o>=0?(t=(t??=0)<0?Math.max(e.length+t,0):Math.min(t,e.length),r=(r??=e.length)<0?Math.max(e.length+r,0):Math.min(r,e.length)):(t=(t??=e.length-1)<0?Math.max(e.length+t,-1):Math.min(t,e.length-1),r=(r??=-1)<-1?Math.max(e.length+r,-1):Math.min(r,e.length-1));const s=[];for(let a=t;o*a<o*r;a+=n)s.push(e[a]);return s}function O(e){return e.replace(/\b\w/g,(e=>e.toUpperCase()))}var V=class{type="RuntimeValue";value;builtins=new Map;constructor(e=void 0){this.value=e}__bool__(){return new G(!!this.value)}},j=class extends V{type="NumericValue"},R=class extends V{type="StringValue";builtins=new Map([["upper",new X((()=>new R(this.value.toUpperCase())))],["lower",new X((()=>new R(this.value.toLowerCase())))],["strip",new X((()=>new R(this.value.trim())))],["title",new X((()=>new R(O(this.value))))],["length",new j(this.value.length)]])},G=class extends V{type="BooleanValue"},q=class extends V{type="ObjectValue";__bool__(){return new G(this.value.size>0)}builtins=new Map([["get",new X((([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 Q}))],["items",new X((()=>new $(Array.from(this.value.entries()).map((([e,t])=>new $([new R(e),t]))))))]])},W=class extends q{type="KeywordArgumentsValue"},$=class extends V{type="ArrayValue";builtins=new Map([["length",new j(this.value.length)]]);__bool__(){return new G(this.value.length>0)}},U=class extends ${type="TupleValue"},X=class extends V{type="FunctionValue"},Q=class extends V{type="NullValue"},H=class extends V{type="UndefinedValue"},Y=class{constructor(e){this.parent=e}variables=new Map([["namespace",new X((e=>{if(0===e.length)return new q(new Map);if(1!==e.length||!(e[0]instanceof q))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 X],["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],["string",e=>"StringValue"===e.type],["number",e=>"NumericValue"===e.type],["integer",e=>"NumericValue"===e.type&&Number.isInteger(e.value)],["iterable",e=>e instanceof $||e instanceof R],["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,K(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 H}catch{return new H}}},J=class{global;constructor(e){this.global=e??new Y}run(e){return this.evaluate(e,this.global)}evaluateBinaryExpression(e,t){const r=this.evaluate(e.left,t);switch(e.operator.value){case"and":return r.__bool__().value?this.evaluate(e.right,t):r;case"or":return r.__bool__().value?r:this.evaluate(e.right,t)}const n=this.evaluate(e.right,t);switch(e.operator.value){case"==":return new G(r.value==n.value);case"!=":return new G(r.value!=n.value)}if(r instanceof H||n instanceof H)throw new Error("Cannot perform operation on undefined values");if(r instanceof Q||n instanceof Q)throw new Error("Cannot perform operation on null values");if(r instanceof j&&n instanceof j)switch(e.operator.value){case"+":return new j(r.value+n.value);case"-":return new j(r.value-n.value);case"*":return new j(r.value*n.value);case"/":return new j(r.value/n.value);case"%":return new j(r.value%n.value);case"<":return new G(r.value<n.value);case">":return new G(r.value>n.value);case">=":return new G(r.value>=n.value);case"<=":return new G(r.value<=n.value)}else if(r instanceof $&&n instanceof $){if("+"===e.operator.value)return new $(r.value.concat(n.value))}else if(n instanceof $){const t=void 0!==n.value.find((e=>e.value===r.value));switch(e.operator.value){case"in":return new G(t);case"not in":return new G(!t)}}if((r instanceof R||n instanceof R)&&"+"===e.operator.value)return new R(r.value.toString()+n.value.toString());if(r instanceof R&&n instanceof R)switch(e.operator.value){case"in":return new G(n.value.includes(r.value));case"not in":return new G(!n.value.includes(r.value))}if(r instanceof R&&n instanceof q)switch(e.operator.value){case"in":return new G(n.value.has(r.value));case"not in":return new G(!n.value.has(r.value))}throw new SyntaxError(`Unknown operator "${e.operator.value}" between ${r.type} and ${n.type}`)}evaluateArguments(e,t){const r=[],n=new Map;for(const o of e)if("KeywordArgumentExpression"===o.type){const e=o;n.set(e.key.value,this.evaluate(e.value,t))}else{if(n.size>0)throw new Error("Positional arguments must come before keyword arguments");r.push(this.evaluate(o,t))}return[r,n]}evaluateFilterExpression(e,t){const r=this.evaluate(e.operand,t);if("Identifier"===e.filter.type){const t=e.filter;if("tojson"===t.value)return new R(Z(r));if(r instanceof $)switch(t.value){case"list":return r;case"first":return r.value[0];case"last":return r.value[r.value.length-1];case"length":return new j(r.value.length);case"reverse":return new $(r.value.reverse());case"sort":return new $(r.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}`)}})));default:throw new Error(`Unknown ArrayValue filter: ${t.value}`)}else if(r instanceof R)switch(t.value){case"length":return new j(r.value.length);case"upper":return new R(r.value.toUpperCase());case"lower":return new R(r.value.toLowerCase());case"title":return new R(O(r.value));case"capitalize":return new R(r.value.charAt(0).toUpperCase()+r.value.slice(1));case"trim":return new R(r.value.trim());case"indent":return new R(r.value.split("\n").map(((e,t)=>0===t||0===e.length?e:" "+e)).join("\n"));case"string":return r;default:throw new Error(`Unknown StringValue filter: ${t.value}`)}else{if(r instanceof j){if("abs"===t.value)return new j(Math.abs(r.value));throw new Error(`Unknown NumericValue filter: ${t.value}`)}if(r instanceof q)switch(t.value){case"items":return new $(Array.from(r.value.entries()).map((([e,t])=>new $([new R(e),t]))));case"length":return new j(r.value.size);default:throw new Error(`Unknown ObjectValue filter: ${t.value}`)}}throw new Error(`Cannot apply filter "${t.value}" to type: ${r.type}`)}if("CallExpression"===e.filter.type){const n=e.filter;if("Identifier"!==n.callee.type)throw new Error(`Unknown filter: ${n.callee.type}`);const o=n.callee.value;if("tojson"===o){const[,e]=this.evaluateArguments(n.args,t),o=e.get("indent")??new Q;if(!(o instanceof j||o instanceof Q))throw new Error("If set, indent must be a number");return new R(Z(r,o.value))}if(r instanceof $){switch(o){case"selectattr":{if(r.value.some((e=>!(e instanceof q))))throw new Error("`selectattr` can only be applied to array of objects");if(n.args.some((e=>"StringLiteral"!==e.type)))throw new Error("arguments of `selectattr` must be strings");const[e,o,s]=n.args.map((e=>this.evaluate(e,t)));let a;if(o){const e=t.tests.get(o.value);if(!e)throw new Error(`Unknown test: ${o.value}`);a=e}else a=(...e)=>e[0].__bool__().value;const i=r.value.filter((t=>{const r=t.value.get(e.value);return!!r&&a(r,s)}));return new $(i)}case"map":{const[,e]=this.evaluateArguments(n.args,t);if(e.has("attribute")){const t=e.get("attribute");if(!(t instanceof R))throw new Error("attribute must be a string");const n=e.get("default"),o=r.value.map((e=>{if(!(e instanceof q))throw new Error("items in map must be an object");return e.value.get(t.value)??n??new H}));return new $(o)}throw new Error("`map` expressions without `attribute` set are not currently supported.")}}throw new Error(`Unknown ArrayValue filter: ${o}`)}if(r instanceof R){if("indent"===o){const[e,o]=this.evaluateArguments(n.args,t),s=e.at(0)??o.get("width")??new j(4);if(!(s instanceof j))throw new Error("width must be a number");const a=e.at(1)??o.get("first")??new G(!1),i=e.at(2)??o.get("blank")??new G(!1),l=r.value.split("\n"),c=" ".repeat(s.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: ${o}`)}throw new Error(`Cannot apply filter "${o}" to type: ${r.type}`)}throw new Error(`Unknown filter: ${e.filter.type}`)}evaluateTestExpression(e,t){const r=this.evaluate(e.operand,t),n=t.tests.get(e.test.value);if(!n)throw new Error(`Unknown test: ${e.test.value}`);const o=n(r);return new G(e.negate?!o:o)}evaluateUnaryExpression(e,t){const r=this.evaluate(e.argument,t);if("not"===e.operator.value)return new G(!r.value);throw new SyntaxError(`Unknown operator: ${e.operator.value}`)}evalProgram(e,t){return this.evaluateBlock(e.body,t)}evaluateBlock(e,t){let r="";for(const n of e){const e=this.evaluate(n,t);"NullValue"!==e.type&&"UndefinedValue"!==e.type&&(r+=e.value)}return new R(r)}evaluateIdentifier(e,t){return t.lookupVariable(e.value)}evaluateCallExpression(e,t){const[r,n]=this.evaluateArguments(e.args,t);n.size>0&&r.push(new W(n));const o=this.evaluate(e.callee,t);if("FunctionValue"!==o.type)throw new Error(`Cannot call something that is not a function: got ${o.type}`);return o.value(r,t)}evaluateSliceExpression(e,t,r){if(!(e instanceof $||e instanceof R))throw new Error("Slice object must be an array or string");const n=this.evaluate(t.start,r),o=this.evaluate(t.stop,r),s=this.evaluate(t.step,r);if(!(n instanceof j||n instanceof H))throw new Error("Slice start must be numeric or undefined");if(!(o instanceof j||o instanceof H))throw new Error("Slice stop must be numeric or undefined");if(!(s instanceof j||s instanceof H))throw new Error("Slice step must be numeric or undefined");return e instanceof $?new $(D(e.value,n.value,o.value,s.value)):new R(D(Array.from(e.value),n.value,o.value,s.value).join(""))}evaluateMemberExpression(e,t){const r=this.evaluate(e.object,t);let n,o;if(e.computed){if("SliceExpression"===e.property.type)return this.evaluateSliceExpression(r,e.property,t);n=this.evaluate(e.property,t)}else n=new R(e.property.value);if(r instanceof q){if(!(n instanceof R))throw new Error(`Cannot access property with non-string: got ${n.type}`);o=r.value.get(n.value)??r.builtins.get(n.value)}else if(r instanceof $||r instanceof R)if(n instanceof j)o=r.value.at(n.value),r instanceof R&&(o=new R(r.value.at(n.value)));else{if(!(n instanceof R))throw new Error(`Cannot access property with non-string/non-number: got ${n.type}`);o=r.builtins.get(n.value)}else{if(!(n instanceof R))throw new Error(`Cannot access property with non-string: got ${n.type}`);o=r.builtins.get(n.value)}return o instanceof V?o:new H}evaluateSet(e,t){const r=this.evaluate(e.value,t);if("Identifier"===e.assignee.type){const n=e.assignee.value;t.setVariable(n,r)}else{if("MemberExpression"!==e.assignee.type)throw new Error(`Invalid LHS inside assignment expression: ${JSON.stringify(e.assignee)}`);{const n=e.assignee,o=this.evaluate(n.object,t);if(!(o instanceof q))throw new Error("Cannot assign to member of non-object");if("Identifier"!==n.property.type)throw new Error("Cannot assign to member with non-identifier property");o.value.set(n.property.value,r)}}return new Q}evaluateIf(e,t){const r=this.evaluate(e.test,t);return this.evaluateBlock(r.__bool__().value?e.body:e.alternate,t)}evaluateFor(e,t){const r=new Y(t);let n,o;if("SelectExpression"===e.iterable.type){const t=e.iterable;o=this.evaluate(t.iterable,r),n=t.test}else o=this.evaluate(e.iterable,r);if(!(o instanceof $))throw new Error(`Expected iterable type in for loop: got ${o.type}`);const s=[],a=[];for(let t=0;t<o.value.length;++t){const i=new Y(r),l=o.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 r=l;if(t.value.length!==r.value.length)throw new Error(`Too ${t.value.length>r.value.length?"few":"many"} items to unpack`);c=e=>{for(let n=0;n<t.value.length;++n){if("Identifier"!==t.value[n].type)throw new Error(`Cannot unpack non-identifier type: ${t.value[n].type}`);e.setVariable(t.value[n].value,r.value[n])}}}}if(n){c(i);if(!this.evaluate(n,i).__bool__().value)continue}s.push(l),a.push(c)}let i="",l=!0;for(let t=0;t<s.length;++t){const n=new Map([["index",new j(t+1)],["index0",new j(t)],["revindex",new j(s.length-t)],["revindex0",new j(s.length-t-1)],["first",new G(0===t)],["last",new G(t===s.length-1)],["length",new j(s.length)],["previtem",t>0?s[t-1]:new H],["nextitem",t<s.length-1?s[t+1]:new H]]);r.setVariable("loop",new q(n)),a[t](r);i+=this.evaluateBlock(e.body,r).value,l=!1}if(l){i+=this.evaluateBlock(e.defaultBlock,r).value}return new R(i)}evaluateMacro(e,t){return t.setVariable(e.name.value,new X(((t,r)=>{const n=new Y(r);let o;t=t.slice(),"KeywordArgumentsValue"===t.at(-1)?.type&&(o=t.pop());for(let r=0;r<e.args.length;++r){const s=e.args[r],a=t[r];if("Identifier"===s.type){const e=s;if(!a)throw new Error(`Missing positional argument: ${e.value}`);n.setVariable(e.value,a)}else{if("KeywordArgumentExpression"!==s.type)throw new Error(`Unknown argument type: ${s.type}`);{const e=s,t=a??o?.value.get(e.key.value)??this.evaluate(e.value,n);n.setVariable(e.key.value,t)}}}return this.evaluateBlock(e.body,n)}))),new Q}evaluate(e,t){if(void 0===e)return new H;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 j(Number(e.value));case"StringLiteral":return new R(e.value);case"BooleanLiteral":return new G(e.value);case"ArrayLiteral":return new $(e.value.map((e=>this.evaluate(e,t))));case"TupleLiteral":return new U(e.value.map((e=>this.evaluate(e,t))));case"ObjectLiteral":{const r=new Map;for(const[n,o]of e.value){const e=this.evaluate(n,t);if(!(e instanceof R))throw new Error(`Object keys must be strings: got ${e.type}`);r.set(e.value,this.evaluate(o,t))}return new q(r)}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 K(e){switch(typeof e){case"number":return new j(e);case"string":return new R(e);case"boolean":return new G(e);case"undefined":return new H;case"object":return null===e?new Q:Array.isArray(e)?new $(e.map(K)):new q(new Map(Object.entries(e).map((([e,t])=>[e,K(t)]))));case"function":return new X(((t,r)=>K(e(...t.map((e=>e.value)))??null)));default:throw new Error(`Cannot convert to runtime value: ${e}`)}}function Z(e,t,r){const n=r??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 r=t?" ".repeat(t):"",o="\n"+r.repeat(n),s=o+r;if("ArrayValue"===e.type){const r=e.value.map((e=>Z(e,t,n+1)));return t?`[${s}${r.join(`,${s}`)}${o}]`:`[${r.join(", ")}]`}{const r=Array.from(e.value.entries()).map((([e,r])=>{const o=`"${e}": ${Z(r,t,n+1)}`;return t?`${s}${o}`:o}));return t?`{${r.join(",")}${o}}`:`{${r.join(", ")}}`}}default:throw new Error(`Cannot convert to JSON: ${e.type}`)}}var ee=class{parsed;constructor(e){const t=d(e,{lstrip_blocks:!0,trim_blocks:!0});this.parsed=B(t)}render(e){const t=new Y;t.set("false",!1),t.set("true",!0),t.set("raise_exception",(e=>{throw new Error(e)})),t.set("range",N);for(const[r,n]of Object.entries(e))t.set(r,n);return new J(t).run(this.parsed).value}}},"./node_modules/onnxruntime-common/dist/esm/backend-impl.js":
22
+ \*******************************************************/(e,t,r)=>{r.r(t),r.d(t,{Environment:()=>Y,Interpreter:()=>J,Template:()=>ee,parse:()=>B,tokenize:()=>d});var n=Object.freeze({Text:"Text",NumericLiteral:"NumericLiteral",BooleanLiteral:"BooleanLiteral",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"}),o=Object.freeze({set:n.Set,for:n.For,in:n.In,is:n.Is,if:n.If,else:n.Else,endif:n.EndIf,elif:n.ElseIf,endfor:n.EndFor,and:n.And,or:n.Or,not:n.Not,"not in":n.NotIn,macro:n.Macro,endmacro:n.EndMacro,true:n.BooleanLiteral,false:n.BooleanLiteral,True:n.BooleanLiteral,False:n.BooleanLiteral}),s=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=[["{%",n.OpenStatement],["%}",n.CloseStatement],["{{",n.OpenExpression],["}}",n.CloseExpression],["(",n.OpenParen],[")",n.CloseParen],["{",n.OpenCurlyBracket],["}",n.CloseCurlyBracket],["[",n.OpenSquareBracket],["]",n.CloseSquareBracket],[",",n.Comma],[".",n.Dot],[":",n.Colon],["|",n.Pipe],["<=",n.ComparisonBinaryOperator],[">=",n.ComparisonBinaryOperator],["==",n.ComparisonBinaryOperator],["!=",n.ComparisonBinaryOperator],["<",n.ComparisonBinaryOperator],[">",n.ComparisonBinaryOperator],["+",n.AdditiveBinaryOperator],["-",n.AdditiveBinaryOperator],["*",n.MultiplicativeBinaryOperator],["/",n.MultiplicativeBinaryOperator],["%",n.MultiplicativeBinaryOperator],["=",n.Equals]],c=new Map([["n","\n"],["t","\t"],["r","\r"],["b","\b"],["f","\f"],["v","\v"],["'","'"],['"','"'],["\\","\\"]]);function d(e,t={}){const r=[],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 p=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++],r=c.get(e);if(void 0===r)throw new SyntaxError(`Unexpected escaped character: ${e}`);t+=r}return t};e:for(;u<d.length;){const e=r.at(-1)?.type;if(void 0===e||e===n.CloseStatement||e===n.CloseExpression){let e="";for(;u<d.length&&("{"!==d[u]||"%"!==d[u+1]&&"{"!==d[u+1]);)e+=d[u++];if(e.length>0){r.push(new s(e,n.Text));continue}}p((e=>/\s/.test(e)));const t=d[u];if("-"===t||"+"===t){const e=r.at(-1)?.type;if(e===n.Text||void 0===e)throw new SyntaxError(`Unexpected character: ${t}`);switch(e){case n.Identifier:case n.NumericLiteral:case n.BooleanLiteral:case n.StringLiteral:case n.CloseParen:case n.CloseSquareBracket:break;default:{++u;const e=p(i);r.push(new s(`${t}${e}`,e.length>0?n.NumericLiteral:n.UnaryOperator));continue}}}for(const[e,t]of l){if(d.slice(u,u+e.length)===e){r.push(new s(e,t)),u+=e.length;continue e}}if("'"!==t&&'"'!==t)if(i(t)){const e=p(i);r.push(new s(e,n.NumericLiteral))}else{if(!a(t))throw new SyntaxError(`Unexpected character: ${t}`);{const e=p(a),t=Object.hasOwn(o,e)?o[e]:n.Identifier;t===n.In&&r.at(-1)?.type===n.Not?(r.pop(),r.push(new s("not in",n.NotIn))):r.push(new s(e,t))}}else{++u;const e=p((e=>e!==t));r.push(new s(e,n.StringLiteral)),++u}}return r}var u=class{type="Statement"},p=class extends u{constructor(e){super(),this.body=e}type="Program"},h=class extends u{constructor(e,t,r){super(),this.test=e,this.body=t,this.alternate=r}type="If"},m=class extends u{constructor(e,t,r,n){super(),this.loopvar=e,this.iterable=t,this.body=r,this.defaultBlock=n}type="For"},_=class extends u{constructor(e,t){super(),this.assignee=e,this.value=t}type="Set"},f=class extends u{constructor(e,t,r){super(),this.name=e,this.args=t,this.body=r}type="Macro"},g=class extends u{type="Expression"},M=class extends g{constructor(e,t,r){super(),this.object=e,this.property=t,this.computed=r}type="MemberExpression"},w=class extends g{constructor(e,t){super(),this.callee=e,this.args=t}type="CallExpression"},T=class extends g{constructor(e){super(),this.value=e}type="Identifier"},b=class extends g{constructor(e){super(),this.value=e}type="Literal"},x=class extends b{type="NumericLiteral"},y=class extends b{type="StringLiteral"},k=class extends b{type="BooleanLiteral"},F=class extends b{type="ArrayLiteral"},P=class extends b{type="TupleLiteral"},C=class extends b{type="ObjectLiteral"},v=class extends g{constructor(e,t,r){super(),this.operator=e,this.left=t,this.right=r}type="BinaryExpression"},S=class extends g{constructor(e,t){super(),this.operand=e,this.filter=t}type="FilterExpression"},A=class extends g{constructor(e,t){super(),this.iterable=e,this.test=t}type="SelectExpression"},E=class extends g{constructor(e,t,r){super(),this.operand=e,this.negate=t,this.test=r}type="TestExpression"},L=class extends g{constructor(e,t){super(),this.operator=e,this.argument=t}type="UnaryExpression"},z=class extends g{constructor(e=void 0,t=void 0,r=void 0){super(),this.start=e,this.stop=t,this.step=r}type="SliceExpression"},I=class extends g{constructor(e,t){super(),this.key=e,this.value=t}type="KeywordArgumentExpression"};function B(e){const t=new p([]);let r=0;function o(t,n){const o=e[r++];if(!o||o.type!==t)throw new Error(`Parser Error: ${n}. ${o.type} !== ${t}.`);return o}function s(){switch(e[r].type){case n.Text:return new y(o(n.Text,"Expected text token").value);case n.OpenStatement:return function(){let t;switch(o(n.OpenStatement,"Expected opening statement token"),e[r].type){case n.Set:++r,t=l(),o(n.CloseStatement,"Expected closing statement token");break;case n.If:++r,t=c(),o(n.OpenStatement,"Expected {% token"),o(n.EndIf,"Expected endif token"),o(n.CloseStatement,"Expected %} token");break;case n.Macro:++r,t=function(){const e=q();if("Identifier"!==e.type)throw new SyntaxError("Expected identifier following macro statement");const t=V();o(n.CloseStatement,"Expected closing statement token");const r=[];for(;a(n.OpenStatement,n.EndMacro);)r.push(s());return new f(e,t,r)}(),o(n.OpenStatement,"Expected {% token"),o(n.EndMacro,"Expected endmacro token"),o(n.CloseStatement,"Expected %} token");break;case n.For:++r,t=function(){const e=d(!0);if(!(e instanceof T||e instanceof P))throw new SyntaxError(`Expected identifier/tuple for the loop variable, got ${e.type} instead`);o(n.In,"Expected `in` keyword following loop variable");const t=u();o(n.CloseStatement,"Expected closing statement token");const l=[];for(;a(n.OpenStatement,n.EndFor)&&a(n.OpenStatement,n.Else);)l.push(s());const c=[];if(i(n.OpenStatement,n.Else))for(++r,++r,o(n.CloseStatement,"Expected closing statement token");a(n.OpenStatement,n.EndFor);)c.push(s());return new m(e,t,l,c)}(),o(n.OpenStatement,"Expected {% token"),o(n.EndFor,"Expected endfor token"),o(n.CloseStatement,"Expected %} token");break;default:throw new SyntaxError(`Unknown statement type: ${e[r].type}`)}return t}();case n.OpenExpression:return function(){o(n.OpenExpression,"Expected opening expression token");const e=u();return o(n.CloseExpression,"Expected closing expression token"),e}();default:throw new SyntaxError(`Unexpected token type: ${e[r].type}`)}}function a(...t){return r+t.length<=e.length&&t.some(((t,n)=>t!==e[r+n].type))}function i(...t){return r+t.length<=e.length&&t.every(((t,n)=>t===e[r+n].type))}function l(){const e=u();if(i(n.Equals)){++r;const t=l();return new _(e,t)}return e}function c(){const t=u();o(n.CloseStatement,"Expected closing statement token");const a=[],l=[];for(;e[r]?.type!==n.OpenStatement||e[r+1]?.type!==n.ElseIf&&e[r+1]?.type!==n.Else&&e[r+1]?.type!==n.EndIf;)a.push(s());if(e[r]?.type===n.OpenStatement&&e[r+1]?.type!==n.EndIf)if(++r,i(n.ElseIf))o(n.ElseIf,"Expected elseif token"),l.push(c());else for(o(n.Else,"Expected else token"),o(n.CloseStatement,"Expected closing statement token");e[r]?.type!==n.OpenStatement||e[r+1]?.type!==n.EndIf;)l.push(s());return new h(t,a,l)}function d(e=!1){const t=e?q:u,o=[t()],s=i(n.Comma);for(;s&&(++r,o.push(t()),i(n.Comma)););return s?new P(o):o[0]}function u(){return function(){const e=g();if(i(n.If)){++r;const t=g();if(i(n.Else)){++r;const n=g();return new h(t,[e],[n])}return new A(e,t)}return e}()}function g(){let t=b();for(;i(n.Or);){const n=e[r];++r;const o=b();t=new v(n,t,o)}return t}function b(){let t=B();for(;i(n.And);){const n=e[r];++r;const o=B();t=new v(n,t,o)}return t}function B(){let t;for(;i(n.Not);){const n=e[r];++r;const o=B();t=new L(n,o)}return t??function(){let t=N();for(;i(n.ComparisonBinaryOperator)||i(n.In)||i(n.NotIn);){const n=e[r];++r;const o=N();t=new v(n,t,o)}return t}()}function N(){let t=R();for(;i(n.AdditiveBinaryOperator);){const n=e[r];++r;const o=R();t=new v(n,t,o)}return t}function D(){const t=function(){let t=q();for(;i(n.Dot)||i(n.OpenSquareBracket);){const s=e[r];let a;++r;const i=s.type!==n.Dot;if(i)a=j(),o(n.CloseSquareBracket,"Expected closing square bracket");else if(a=q(),"Identifier"!==a.type)throw new SyntaxError("Expected identifier following dot operator");t=new M(t,a,i)}return t}();return i(n.OpenParen)?O(t):t}function O(e){let t=new w(e,V());return i(n.OpenParen)&&(t=O(t)),t}function V(){o(n.OpenParen,"Expected opening parenthesis for arguments list");const e=function(){const e=[];for(;!i(n.CloseParen);){let t=u();if(i(n.Equals)){if(++r,!(t instanceof T))throw new SyntaxError("Expected identifier for keyword argument");const e=u();t=new I(t,e)}e.push(t),i(n.Comma)&&++r}return e}();return o(n.CloseParen,"Expected closing parenthesis for arguments list"),e}function j(){const e=[];let t=!1;for(;!i(n.CloseSquareBracket);)i(n.Colon)?(e.push(void 0),++r,t=!0):(e.push(u()),i(n.Colon)&&(++r,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 R(){let t=G();for(;i(n.MultiplicativeBinaryOperator);){const n=e[r];++r;const o=G();t=new v(n,t,o)}return t}function G(){let e=function(){let e=D();for(;i(n.Pipe);){++r;let t=q();if(!(t instanceof T))throw new SyntaxError("Expected identifier for the filter");i(n.OpenParen)&&(t=O(t)),e=new S(e,t)}return e}();for(;i(n.Is);){++r;const t=i(n.Not);t&&++r;let o=q();if(o instanceof k&&(o=new T(o.value.toString())),!(o instanceof T))throw new SyntaxError("Expected identifier for the test");e=new E(e,t,o)}return e}function q(){const t=e[r];switch(t.type){case n.NumericLiteral:return++r,new x(Number(t.value));case n.StringLiteral:return++r,new y(t.value);case n.BooleanLiteral:return++r,new k("true"===t.value.toLowerCase());case n.Identifier:return++r,new T(t.value);case n.OpenParen:{++r;const t=d();if(e[r].type!==n.CloseParen)throw new SyntaxError(`Expected closing parenthesis, got ${e[r].type} instead`);return++r,t}case n.OpenSquareBracket:{++r;const e=[];for(;!i(n.CloseSquareBracket);)e.push(u()),i(n.Comma)&&++r;return++r,new F(e)}case n.OpenCurlyBracket:{++r;const e=new Map;for(;!i(n.CloseCurlyBracket);){const t=u();o(n.Colon,"Expected colon between key and value in object literal");const s=u();e.set(t,s),i(n.Comma)&&++r}return++r,new C(e)}default:throw new SyntaxError(`Unexpected token: ${t.type}`)}}for(;r<e.length;)t.body.push(s());return t}function N(e,t,r=1){void 0===t&&(t=e,e=0);const n=[];for(let o=e;o<t;o+=r)n.push(o);return n}function D(e,t,r,n=1){const o=Math.sign(n);o>=0?(t=(t??=0)<0?Math.max(e.length+t,0):Math.min(t,e.length),r=(r??=e.length)<0?Math.max(e.length+r,0):Math.min(r,e.length)):(t=(t??=e.length-1)<0?Math.max(e.length+t,-1):Math.min(t,e.length-1),r=(r??=-1)<-1?Math.max(e.length+r,-1):Math.min(r,e.length-1));const s=[];for(let a=t;o*a<o*r;a+=n)s.push(e[a]);return s}function O(e){return e.replace(/\b\w/g,(e=>e.toUpperCase()))}var V=class{type="RuntimeValue";value;builtins=new Map;constructor(e=void 0){this.value=e}__bool__(){return new G(!!this.value)}},j=class extends V{type="NumericValue"},R=class extends V{type="StringValue";builtins=new Map([["upper",new X((()=>new R(this.value.toUpperCase())))],["lower",new X((()=>new R(this.value.toLowerCase())))],["strip",new X((()=>new R(this.value.trim())))],["title",new X((()=>new R(O(this.value))))],["length",new j(this.value.length)]])},G=class extends V{type="BooleanValue"},q=class extends V{type="ObjectValue";__bool__(){return new G(this.value.size>0)}builtins=new Map([["get",new X((([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 Q}))],["items",new X((()=>new W(Array.from(this.value.entries()).map((([e,t])=>new W([new R(e),t]))))))]])},$=class extends q{type="KeywordArgumentsValue"},W=class extends V{type="ArrayValue";builtins=new Map([["length",new j(this.value.length)]]);__bool__(){return new G(this.value.length>0)}},U=class extends W{type="TupleValue"},X=class extends V{type="FunctionValue"},Q=class extends V{type="NullValue"},H=class extends V{type="UndefinedValue"},Y=class{constructor(e){this.parent=e}variables=new Map([["namespace",new X((e=>{if(0===e.length)return new q(new Map);if(1!==e.length||!(e[0]instanceof q))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 X],["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],["string",e=>"StringValue"===e.type],["number",e=>"NumericValue"===e.type],["integer",e=>"NumericValue"===e.type&&Number.isInteger(e.value)],["iterable",e=>e instanceof W||e instanceof R],["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,K(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 H}catch{return new H}}},J=class{global;constructor(e){this.global=e??new Y}run(e){return this.evaluate(e,this.global)}evaluateBinaryExpression(e,t){const r=this.evaluate(e.left,t);switch(e.operator.value){case"and":return r.__bool__().value?this.evaluate(e.right,t):r;case"or":return r.__bool__().value?r:this.evaluate(e.right,t)}const n=this.evaluate(e.right,t);switch(e.operator.value){case"==":return new G(r.value==n.value);case"!=":return new G(r.value!=n.value)}if(r instanceof H||n instanceof H)throw new Error("Cannot perform operation on undefined values");if(r instanceof Q||n instanceof Q)throw new Error("Cannot perform operation on null values");if(r instanceof j&&n instanceof j)switch(e.operator.value){case"+":return new j(r.value+n.value);case"-":return new j(r.value-n.value);case"*":return new j(r.value*n.value);case"/":return new j(r.value/n.value);case"%":return new j(r.value%n.value);case"<":return new G(r.value<n.value);case">":return new G(r.value>n.value);case">=":return new G(r.value>=n.value);case"<=":return new G(r.value<=n.value)}else if(r instanceof W&&n instanceof W){if("+"===e.operator.value)return new W(r.value.concat(n.value))}else if(n instanceof W){const t=void 0!==n.value.find((e=>e.value===r.value));switch(e.operator.value){case"in":return new G(t);case"not in":return new G(!t)}}if((r instanceof R||n instanceof R)&&"+"===e.operator.value)return new R(r.value.toString()+n.value.toString());if(r instanceof R&&n instanceof R)switch(e.operator.value){case"in":return new G(n.value.includes(r.value));case"not in":return new G(!n.value.includes(r.value))}if(r instanceof R&&n instanceof q)switch(e.operator.value){case"in":return new G(n.value.has(r.value));case"not in":return new G(!n.value.has(r.value))}throw new SyntaxError(`Unknown operator "${e.operator.value}" between ${r.type} and ${n.type}`)}evaluateArguments(e,t){const r=[],n=new Map;for(const o of e)if("KeywordArgumentExpression"===o.type){const e=o;n.set(e.key.value,this.evaluate(e.value,t))}else{if(n.size>0)throw new Error("Positional arguments must come before keyword arguments");r.push(this.evaluate(o,t))}return[r,n]}evaluateFilterExpression(e,t){const r=this.evaluate(e.operand,t);if("Identifier"===e.filter.type){const t=e.filter;if("tojson"===t.value)return new R(Z(r));if(r instanceof W)switch(t.value){case"list":return r;case"first":return r.value[0];case"last":return r.value[r.value.length-1];case"length":return new j(r.value.length);case"reverse":return new W(r.value.reverse());case"sort":return new W(r.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}`)}})));default:throw new Error(`Unknown ArrayValue filter: ${t.value}`)}else if(r instanceof R)switch(t.value){case"length":return new j(r.value.length);case"upper":return new R(r.value.toUpperCase());case"lower":return new R(r.value.toLowerCase());case"title":return new R(O(r.value));case"capitalize":return new R(r.value.charAt(0).toUpperCase()+r.value.slice(1));case"trim":return new R(r.value.trim());case"indent":return new R(r.value.split("\n").map(((e,t)=>0===t||0===e.length?e:" "+e)).join("\n"));case"string":return r;default:throw new Error(`Unknown StringValue filter: ${t.value}`)}else{if(r instanceof j){if("abs"===t.value)return new j(Math.abs(r.value));throw new Error(`Unknown NumericValue filter: ${t.value}`)}if(r instanceof q)switch(t.value){case"items":return new W(Array.from(r.value.entries()).map((([e,t])=>new W([new R(e),t]))));case"length":return new j(r.value.size);default:throw new Error(`Unknown ObjectValue filter: ${t.value}`)}}throw new Error(`Cannot apply filter "${t.value}" to type: ${r.type}`)}if("CallExpression"===e.filter.type){const n=e.filter;if("Identifier"!==n.callee.type)throw new Error(`Unknown filter: ${n.callee.type}`);const o=n.callee.value;if("tojson"===o){const[,e]=this.evaluateArguments(n.args,t),o=e.get("indent")??new Q;if(!(o instanceof j||o instanceof Q))throw new Error("If set, indent must be a number");return new R(Z(r,o.value))}if(r instanceof W){switch(o){case"selectattr":{if(r.value.some((e=>!(e instanceof q))))throw new Error("`selectattr` can only be applied to array of objects");if(n.args.some((e=>"StringLiteral"!==e.type)))throw new Error("arguments of `selectattr` must be strings");const[e,o,s]=n.args.map((e=>this.evaluate(e,t)));let a;if(o){const e=t.tests.get(o.value);if(!e)throw new Error(`Unknown test: ${o.value}`);a=e}else a=(...e)=>e[0].__bool__().value;const i=r.value.filter((t=>{const r=t.value.get(e.value);return!!r&&a(r,s)}));return new W(i)}case"map":{const[,e]=this.evaluateArguments(n.args,t);if(e.has("attribute")){const t=e.get("attribute");if(!(t instanceof R))throw new Error("attribute must be a string");const n=e.get("default"),o=r.value.map((e=>{if(!(e instanceof q))throw new Error("items in map must be an object");return e.value.get(t.value)??n??new H}));return new W(o)}throw new Error("`map` expressions without `attribute` set are not currently supported.")}}throw new Error(`Unknown ArrayValue filter: ${o}`)}if(r instanceof R){if("indent"===o){const[e,o]=this.evaluateArguments(n.args,t),s=e.at(0)??o.get("width")??new j(4);if(!(s instanceof j))throw new Error("width must be a number");const a=e.at(1)??o.get("first")??new G(!1),i=e.at(2)??o.get("blank")??new G(!1),l=r.value.split("\n"),c=" ".repeat(s.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: ${o}`)}throw new Error(`Cannot apply filter "${o}" to type: ${r.type}`)}throw new Error(`Unknown filter: ${e.filter.type}`)}evaluateTestExpression(e,t){const r=this.evaluate(e.operand,t),n=t.tests.get(e.test.value);if(!n)throw new Error(`Unknown test: ${e.test.value}`);const o=n(r);return new G(e.negate?!o:o)}evaluateUnaryExpression(e,t){const r=this.evaluate(e.argument,t);if("not"===e.operator.value)return new G(!r.value);throw new SyntaxError(`Unknown operator: ${e.operator.value}`)}evalProgram(e,t){return this.evaluateBlock(e.body,t)}evaluateBlock(e,t){let r="";for(const n of e){const e=this.evaluate(n,t);"NullValue"!==e.type&&"UndefinedValue"!==e.type&&(r+=e.value)}return new R(r)}evaluateIdentifier(e,t){return t.lookupVariable(e.value)}evaluateCallExpression(e,t){const[r,n]=this.evaluateArguments(e.args,t);n.size>0&&r.push(new $(n));const o=this.evaluate(e.callee,t);if("FunctionValue"!==o.type)throw new Error(`Cannot call something that is not a function: got ${o.type}`);return o.value(r,t)}evaluateSliceExpression(e,t,r){if(!(e instanceof W||e instanceof R))throw new Error("Slice object must be an array or string");const n=this.evaluate(t.start,r),o=this.evaluate(t.stop,r),s=this.evaluate(t.step,r);if(!(n instanceof j||n instanceof H))throw new Error("Slice start must be numeric or undefined");if(!(o instanceof j||o instanceof H))throw new Error("Slice stop must be numeric or undefined");if(!(s instanceof j||s instanceof H))throw new Error("Slice step must be numeric or undefined");return e instanceof W?new W(D(e.value,n.value,o.value,s.value)):new R(D(Array.from(e.value),n.value,o.value,s.value).join(""))}evaluateMemberExpression(e,t){const r=this.evaluate(e.object,t);let n,o;if(e.computed){if("SliceExpression"===e.property.type)return this.evaluateSliceExpression(r,e.property,t);n=this.evaluate(e.property,t)}else n=new R(e.property.value);if(r instanceof q){if(!(n instanceof R))throw new Error(`Cannot access property with non-string: got ${n.type}`);o=r.value.get(n.value)??r.builtins.get(n.value)}else if(r instanceof W||r instanceof R)if(n instanceof j)o=r.value.at(n.value),r instanceof R&&(o=new R(r.value.at(n.value)));else{if(!(n instanceof R))throw new Error(`Cannot access property with non-string/non-number: got ${n.type}`);o=r.builtins.get(n.value)}else{if(!(n instanceof R))throw new Error(`Cannot access property with non-string: got ${n.type}`);o=r.builtins.get(n.value)}return o instanceof V?o:new H}evaluateSet(e,t){const r=this.evaluate(e.value,t);if("Identifier"===e.assignee.type){const n=e.assignee.value;t.setVariable(n,r)}else{if("MemberExpression"!==e.assignee.type)throw new Error(`Invalid LHS inside assignment expression: ${JSON.stringify(e.assignee)}`);{const n=e.assignee,o=this.evaluate(n.object,t);if(!(o instanceof q))throw new Error("Cannot assign to member of non-object");if("Identifier"!==n.property.type)throw new Error("Cannot assign to member with non-identifier property");o.value.set(n.property.value,r)}}return new Q}evaluateIf(e,t){const r=this.evaluate(e.test,t);return this.evaluateBlock(r.__bool__().value?e.body:e.alternate,t)}evaluateFor(e,t){const r=new Y(t);let n,o;if("SelectExpression"===e.iterable.type){const t=e.iterable;o=this.evaluate(t.iterable,r),n=t.test}else o=this.evaluate(e.iterable,r);if(!(o instanceof W))throw new Error(`Expected iterable type in for loop: got ${o.type}`);const s=[],a=[];for(let t=0;t<o.value.length;++t){const i=new Y(r),l=o.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 r=l;if(t.value.length!==r.value.length)throw new Error(`Too ${t.value.length>r.value.length?"few":"many"} items to unpack`);c=e=>{for(let n=0;n<t.value.length;++n){if("Identifier"!==t.value[n].type)throw new Error(`Cannot unpack non-identifier type: ${t.value[n].type}`);e.setVariable(t.value[n].value,r.value[n])}}}}if(n){c(i);if(!this.evaluate(n,i).__bool__().value)continue}s.push(l),a.push(c)}let i="",l=!0;for(let t=0;t<s.length;++t){const n=new Map([["index",new j(t+1)],["index0",new j(t)],["revindex",new j(s.length-t)],["revindex0",new j(s.length-t-1)],["first",new G(0===t)],["last",new G(t===s.length-1)],["length",new j(s.length)],["previtem",t>0?s[t-1]:new H],["nextitem",t<s.length-1?s[t+1]:new H]]);r.setVariable("loop",new q(n)),a[t](r);i+=this.evaluateBlock(e.body,r).value,l=!1}if(l){i+=this.evaluateBlock(e.defaultBlock,r).value}return new R(i)}evaluateMacro(e,t){return t.setVariable(e.name.value,new X(((t,r)=>{const n=new Y(r);let o;t=t.slice(),"KeywordArgumentsValue"===t.at(-1)?.type&&(o=t.pop());for(let r=0;r<e.args.length;++r){const s=e.args[r],a=t[r];if("Identifier"===s.type){const e=s;if(!a)throw new Error(`Missing positional argument: ${e.value}`);n.setVariable(e.value,a)}else{if("KeywordArgumentExpression"!==s.type)throw new Error(`Unknown argument type: ${s.type}`);{const e=s,t=a??o?.value.get(e.key.value)??this.evaluate(e.value,n);n.setVariable(e.key.value,t)}}}return this.evaluateBlock(e.body,n)}))),new Q}evaluate(e,t){if(void 0===e)return new H;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 j(Number(e.value));case"StringLiteral":return new R(e.value);case"BooleanLiteral":return new G(e.value);case"ArrayLiteral":return new W(e.value.map((e=>this.evaluate(e,t))));case"TupleLiteral":return new U(e.value.map((e=>this.evaluate(e,t))));case"ObjectLiteral":{const r=new Map;for(const[n,o]of e.value){const e=this.evaluate(n,t);if(!(e instanceof R))throw new Error(`Object keys must be strings: got ${e.type}`);r.set(e.value,this.evaluate(o,t))}return new q(r)}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 K(e){switch(typeof e){case"number":return new j(e);case"string":return new R(e);case"boolean":return new G(e);case"undefined":return new H;case"object":return null===e?new Q:Array.isArray(e)?new W(e.map(K)):new q(new Map(Object.entries(e).map((([e,t])=>[e,K(t)]))));case"function":return new X(((t,r)=>K(e(...t.map((e=>e.value)))??null)));default:throw new Error(`Cannot convert to runtime value: ${e}`)}}function Z(e,t,r){const n=r??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 r=t?" ".repeat(t):"",o="\n"+r.repeat(n),s=o+r;if("ArrayValue"===e.type){const r=e.value.map((e=>Z(e,t,n+1)));return t?`[${s}${r.join(`,${s}`)}${o}]`:`[${r.join(", ")}]`}{const r=Array.from(e.value.entries()).map((([e,r])=>{const o=`"${e}": ${Z(r,t,n+1)}`;return t?`${s}${o}`:o}));return t?`{${r.join(",")}${o}}`:`{${r.join(", ")}}`}}default:throw new Error(`Cannot convert to JSON: ${e.type}`)}}var ee=class{parsed;constructor(e){const t=d(e,{lstrip_blocks:!0,trim_blocks:!0});this.parsed=B(t)}render(e){const t=new Y;t.set("false",!1),t.set("true",!0),t.set("raise_exception",(e=>{throw new Error(e)})),t.set("range",N);for(const[r,n]of Object.entries(e))t.set(r,n);return new J(t).run(this.parsed).value}}},"./node_modules/onnxruntime-common/dist/esm/backend-impl.js":
23
23
  /*!******************************************************************!*\
24
24
  !*** ./node_modules/onnxruntime-common/dist/esm/backend-impl.js ***!
25
25
  \******************************************************************/(e,t,r)=>{r.r(t),r.d(t,{registerBackend:()=>s,resolveBackendAndExecutionProviders:()=>i});const n=new Map,o=[],s=(e,t,r)=>{if(!t||"function"!=typeof t.init||"function"!=typeof t.createInferenceSessionHandler)throw new TypeError("not a valid backend");{const s=n.get(e);if(void 0===s)n.set(e,{backend:t,priority:r});else{if(s.priority>r)return;if(s.priority===r&&s.backend!==t)throw new Error(`cannot register backend "${e}" using priority ${r}`)}if(r>=0){const t=o.indexOf(e);-1!==t&&o.splice(t,1);for(let t=0;t<o.length;t++)if(n.get(o[t]).priority<=r)return void o.splice(t,0,e);o.push(e)}}},a=async e=>{const t=n.get(e);if(!t)return"backend not found.";if(t.initialized)return t.backend;if(t.aborted)return t.error;{const r=!!t.initPromise;try{return r||(t.initPromise=t.backend.init(e)),await t.initPromise,t.initialized=!0,t.backend}catch(e){return r||(t.error=`${e}`,t.aborted=!0),t.error}finally{delete t.initPromise}}},i=async e=>{const t=e.executionProviders||[],r=t.map((e=>"string"==typeof e?e:e.name)),n=0===r.length?o:r;let s;const i=[],l=new Set;for(const e of n){const t=await a(e);"string"==typeof t?i.push({name:e,err:t}):(s||(s=t),s===t&&l.add(e))}if(!s)throw new Error(`no available backend found. ERR: ${i.map((e=>`[${e.name}] ${e.err}`)).join(", ")}`);for(const{name:e,err:t}of i)r.includes(e)&&console.warn(`removing requested execution provider "${e}" from session options because it is not available: ${t}`);const c=t.filter((e=>l.has("string"==typeof e?e:e.name)));return[s,new Proxy(e,{get:(e,t)=>"executionProviders"===t?c:Reflect.get(e,t)})]}},"./node_modules/onnxruntime-common/dist/esm/backend.js":
@@ -91,7 +91,7 @@ import*as e from"fs";import*as t from"onnxruntime-node";import*as r from"path";i
91
91
  \************************/(e,t,r)=>{r.r(t),r.d(t,{AutoConfig:()=>l,PretrainedConfig:()=>i,getKeyValueShapes:()=>a});var n=r(/*! ./utils/core.js */"./src/utils/core.js"),o=r(/*! ./utils/hub.js */"./src/utils/hub.js");function s(e){const t={};let r={};switch(e.model_type){case"llava":case"paligemma":case"florence2":r=s(e.text_config);break;case"moondream1":r=s(e.phi_config);break;case"musicgen":r=s(e.decoder);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"phi":case"phi3":case"falcon":t.num_heads="num_attention_heads",t.num_layers="num_hidden_layers",t.hidden_size="hidden_size";break;case"llama":case"granite":case"cohere":case"mistral":case"starcoder2":case"qwen2":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":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"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"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"vision-encoder-decoder":const o=s(e.decoder),a="num_decoder_layers"in o,i=(0,n.pick)(e,["model_type","is_encoder_decoder"]);return a?(i.num_decoder_layers=o.num_decoder_layers,i.num_decoder_heads=o.num_decoder_heads,i.decoder_hidden_size=o.decoder_hidden_size,i.num_encoder_layers=o.num_encoder_layers,i.num_encoder_heads=o.num_encoder_heads,i.encoder_hidden_size=o.encoder_hidden_size):(i.num_layers=o.num_layers,i.num_heads=o.num_heads,i.hidden_size=o.hidden_size),i}const o={...r,...(0,n.pick)(e,["model_type","multi_query","is_encoder_decoder"])};for(const r in t)o[r]=e[t[r]];return o}function a(e,{prefix:t="past_key_values"}={}){const r={},n=e.normalized_config;if(n.is_encoder_decoder&&"num_encoder_heads"in n&&"num_decoder_heads"in n){const e=n.encoder_dim_kv??n.encoder_hidden_size/n.num_encoder_heads,o=n.decoder_dim_kv??n.decoder_hidden_size/n.num_decoder_heads,s=[1,n.num_encoder_heads,0,e],a=[1,n.num_decoder_heads,0,o];for(let e=0;e<n.num_decoder_layers;++e)r[`${t}.${e}.encoder.key`]=s,r[`${t}.${e}.encoder.value`]=s,r[`${t}.${e}.decoder.key`]=a,r[`${t}.${e}.decoder.value`]=a}else{const e=n.num_heads,o=n.num_layers,s=n.dim_kv??n.hidden_size/(n.num_attention_heads??e);if("falcon"===n.model_type){const n=[1*e,0,s];for(let e=0;e<o;++e)r[`${t}.${e}.key`]=n,r[`${t}.${e}.value`]=n}else if(n.multi_query){const n=[1*e,0,2*s];for(let e=0;e<o;++e)r[`${t}.${e}.key_value`]=n}else if("bloom"===n.model_type){const n=[1*e,s,0],a=[1*e,0,s];for(let e=0;e<o;++e)r[`${t}.${e}.key`]=n,r[`${t}.${e}.value`]=a}else if("openelm"===n.model_type)for(let n=0;n<o;++n){const o=[1,e[n],0,s];r[`${t}.${n}.key`]=o,r[`${t}.${n}.value`]=o}else{const n=[1,e,0,s];for(let e=0;e<o;++e)r[`${t}.${e}.key`]=n,r[`${t}.${e}.value`]=n}}return r}class i{model_type=null;is_encoder_decoder=!1;max_position_embeddings;"transformers.js_config";constructor(e){Object.assign(this,e),this.normalized_config=s(this)}static async from_pretrained(e,{progress_callback:t=null,config:r=null,cache_dir:n=null,local_files_only:s=!1,revision:a="main"}={}){!r||r instanceof i||(r=new i(r));const l=r??await async function(e,t){return await(0,o.getModelJSON)(e,"config.json",!0,t)}(e,{progress_callback:t,config:r,cache_dir:n,local_files_only:s,revision:a});return new this(l)}}class l{static async from_pretrained(...e){return i.from_pretrained(...e)}}},"./src/env.js":
92
92
  /*!********************!*\
93
93
  !*** ./src/env.js ***!
94
- \********************/(e,t,r)=>{r.r(t),r.d(t,{apis:()=>_,env:()=>T});var n=r(/*! fs */"fs"),o=r(/*! path */"path"),s=r(/*! url */"url");const a="undefined"!=typeof self,i=a&&"DedicatedWorkerGlobalScope"===self.constructor.name,l=a&&"caches"in self,c="undefined"!=typeof navigator&&"gpu"in navigator,d="undefined"!=typeof navigator&&"ml"in navigator,u="undefined"!=typeof process,p=u&&"node"===process?.release?.name,h=!b(n.default),m=!b(o.default),_=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:p,IS_FS_AVAILABLE:h,IS_PATH_AVAILABLE:m}),f=h&&m,g=f?o.default.dirname(o.default.dirname(s.default.fileURLToPath(import.meta.url))):"./",M=f?o.default.join(g,"/.cache/"):null,w="/models/",T={version:"3.0.0",backends:{onnx:{}},allowRemoteModels:!0,remoteHost:"https://huggingface.co/",remotePathTemplate:"{model}/resolve/{revision}/",allowLocalModels:!a,localModelPath:f?o.default.join(g,w):w,useFS:h,useBrowserCache:l,useFSCache:h,cacheDir:M,useCustomCache:!1,customCache:null};function b(e){return 0===Object.keys(e).length}},"./src/generation/configuration_utils.js":
94
+ \********************/(e,t,r)=>{r.r(t),r.d(t,{apis:()=>_,env:()=>T});var n=r(/*! fs */"fs"),o=r(/*! path */"path"),s=r(/*! url */"url");const a="undefined"!=typeof self,i=a&&"DedicatedWorkerGlobalScope"===self.constructor.name,l=a&&"caches"in self,c="undefined"!=typeof navigator&&"gpu"in navigator,d="undefined"!=typeof navigator&&"ml"in navigator,u="undefined"!=typeof process,p=u&&"node"===process?.release?.name,h=!b(n.default),m=!b(o.default),_=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:p,IS_FS_AVAILABLE:h,IS_PATH_AVAILABLE:m}),f=h&&m,g=f?o.default.dirname(o.default.dirname(s.default.fileURLToPath(import.meta.url))):"./",M=f?o.default.join(g,"/.cache/"):null,w="/models/",T={version:"3.0.1",backends:{onnx:{}},allowRemoteModels:!0,remoteHost:"https://huggingface.co/",remotePathTemplate:"{model}/resolve/{revision}/",allowLocalModels:!a,localModelPath:f?o.default.join(g,w):w,useFS:h,useBrowserCache:l,useFSCache:h,cacheDir:M,useCustomCache:!1,customCache:null};function b(e){return 0===Object.keys(e).length}},"./src/generation/configuration_utils.js":
95
95
  /*!***********************************************!*\
96
96
  !*** ./src/generation/configuration_utils.js ***!
97
97
  \***********************************************/(e,t,r)=>{r.r(t),r.d(t,{GenerationConfig:()=>o});var n=r(/*! ../utils/core.js */"./src/utils/core.js");class o{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;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,n.pick)(e,Object.getOwnPropertyNames(this)))}}},"./src/generation/logits_process.js":
@@ -109,7 +109,7 @@ import*as e from"fs";import*as t from"onnxruntime-node";import*as r from"path";i
109
109
  \*************************************/(e,t,r)=>{r.r(t),r.d(t,{BaseStreamer:()=>a,TextStreamer:()=>l,WhisperTextStreamer:()=>c});var n=r(/*! ../utils/core.js */"./src/utils/core.js"),o=r(/*! ../tokenizers.js */"./src/tokenizers.js"),s=r(/*! ../env.js */"./src/env.js");class a{put(e){throw Error("Not implemented")}end(){throw Error("Not implemented")}}const i=s.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:r=null,token_callback_function:n=null,decode_kwargs:o={},...s}={}){super(),this.tokenizer=e,this.skip_prompt=t,this.callback_function=r??i,this.token_callback_function=n,this.decode_kwargs={...o,...s},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");if(this.skip_prompt&&this.next_tokens_are_prompt)return void(this.next_tokens_are_prompt=!1);const t=e[0];this.token_callback_function?.(t),this.token_cache=(0,n.mergeArrays)(this.token_cache,t);const r=this.tokenizer.decode(this.token_cache,this.decode_kwargs);let s;r.endsWith("\n")?(s=r.slice(this.print_len),this.token_cache=[],this.print_len=0):r.length>0&&(0,o.is_chinese_char)(r.charCodeAt(r.length-1))?(s=r.slice(this.print_len),this.print_len+=s.length):(s=r.slice(this.print_len,r.lastIndexOf(" ")+1),this.print_len+=s.length),this.on_finalized_text(s,!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&&s.apis.IS_PROCESS_AVAILABLE&&this.callback_function?.("\n")}}class c extends l{constructor(e,{skip_prompt:t=!1,callback_function:r=null,token_callback_function:n=null,on_chunk_start:o=null,on_chunk_end:s=null,on_finalize:a=null,time_precision:i=.02,skip_special_tokens:l=!0,decode_kwargs:c={}}={}){super(e,{skip_prompt:t,callback_function:r,token_callback_function:n,decode_kwargs:{skip_special_tokens:l,...c}}),this.timestamp_begin=e.timestamp_begin,this.on_chunk_start=o,this.on_chunk_end=s,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 r=Number(t[0])-this.timestamp_begin;if(r>=0){const t=r*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":
110
110
  /*!***********************!*\
111
111
  !*** ./src/models.js ***!
112
- \***********************/(e,t,r)=>{r.r(t),r.d(t,{ASTForAudioClassification:()=>or,ASTModel:()=>nr,ASTPreTrainedModel:()=>rr,AlbertForMaskedLM:()=>ht,AlbertForQuestionAnswering:()=>pt,AlbertForSequenceClassification:()=>ut,AlbertModel:()=>dt,AlbertPreTrainedModel:()=>ct,AutoModel:()=>Oi,AutoModelForAudioClassification:()=>nl,AutoModelForAudioFrameClassification:()=>sl,AutoModelForCTC:()=>rl,AutoModelForCausalLM:()=>$i,AutoModelForDepthEstimation:()=>cl,AutoModelForDocumentQuestionAnswering:()=>al,AutoModelForImageClassification:()=>Hi,AutoModelForImageFeatureExtraction:()=>ul,AutoModelForImageMatting:()=>il,AutoModelForImageSegmentation:()=>Yi,AutoModelForImageToImage:()=>ll,AutoModelForMaskGeneration:()=>tl,AutoModelForMaskedLM:()=>Ui,AutoModelForNormalEstimation:()=>dl,AutoModelForObjectDetection:()=>Zi,AutoModelForQuestionAnswering:()=>Xi,AutoModelForSemanticSegmentation:()=>Ji,AutoModelForSeq2SeqLM:()=>Ri,AutoModelForSequenceClassification:()=>Vi,AutoModelForSpeechSeq2Seq:()=>Gi,AutoModelForTextToSpectrogram:()=>qi,AutoModelForTextToWaveform:()=>Wi,AutoModelForTokenClassification:()=>ji,AutoModelForUniversalSegmentation:()=>Ki,AutoModelForVision2Seq:()=>Qi,AutoModelForXVector:()=>ol,AutoModelForZeroShotObjectDetection:()=>el,BartForConditionalGeneration:()=>Ft,BartForSequenceClassification:()=>Pt,BartModel:()=>kt,BartPretrainedModel:()=>yt,BaseModelOutput:()=>$,BeitForImageClassification:()=>po,BeitModel:()=>uo,BeitPreTrainedModel:()=>co,BertForMaskedLM:()=>Q,BertForQuestionAnswering:()=>J,BertForSequenceClassification:()=>H,BertForTokenClassification:()=>Y,BertModel:()=>X,BertPreTrainedModel:()=>U,BlenderbotForConditionalGeneration:()=>It,BlenderbotModel:()=>zt,BlenderbotPreTrainedModel:()=>Lt,BlenderbotSmallForConditionalGeneration:()=>Dt,BlenderbotSmallModel:()=>Nt,BlenderbotSmallPreTrainedModel:()=>Bt,BloomForCausalLM:()=>Pn,BloomModel:()=>Fn,BloomPreTrainedModel:()=>kn,CLIPModel:()=>_r,CLIPPreTrainedModel:()=>mr,CLIPSegForImageSegmentation:()=>vr,CLIPSegModel:()=>Cr,CLIPSegPreTrainedModel:()=>Pr,CLIPTextModel:()=>fr,CLIPTextModelWithProjection:()=>gr,CLIPVisionModel:()=>Mr,CLIPVisionModelWithProjection:()=>wr,CamembertForMaskedLM:()=>Te,CamembertForQuestionAnswering:()=>ye,CamembertForSequenceClassification:()=>be,CamembertForTokenClassification:()=>xe,CamembertModel:()=>we,CamembertPreTrainedModel:()=>Me,CausalLMOutput:()=>Ml,CausalLMOutputWithPast:()=>wl,ChineseCLIPModel:()=>Fr,ChineseCLIPPreTrainedModel:()=>kr,ClapAudioModelWithProjection:()=>Ca,ClapModel:()=>Fa,ClapPreTrainedModel:()=>ka,ClapTextModelWithProjection:()=>Pa,CodeGenForCausalLM:()=>Hr,CodeGenModel:()=>Qr,CodeGenPreTrainedModel:()=>Xr,CohereForCausalLM:()=>on,CohereModel:()=>nn,CoherePreTrainedModel:()=>rn,ConvBertForMaskedLM:()=>le,ConvBertForQuestionAnswering:()=>ue,ConvBertForSequenceClassification:()=>ce,ConvBertForTokenClassification:()=>de,ConvBertModel:()=>ie,ConvBertPreTrainedModel:()=>ae,ConvNextForImageClassification:()=>cs,ConvNextModel:()=>ls,ConvNextPreTrainedModel:()=>is,ConvNextV2ForImageClassification:()=>ps,ConvNextV2Model:()=>us,ConvNextV2PreTrainedModel:()=>ds,DPTForDepthEstimation:()=>Wo,DPTModel:()=>qo,DPTPreTrainedModel:()=>Go,DebertaForMaskedLM:()=>Pe,DebertaForQuestionAnswering:()=>Se,DebertaForSequenceClassification:()=>Ce,DebertaForTokenClassification:()=>ve,DebertaModel:()=>Fe,DebertaPreTrainedModel:()=>ke,DebertaV2ForMaskedLM:()=>Le,DebertaV2ForQuestionAnswering:()=>Be,DebertaV2ForSequenceClassification:()=>ze,DebertaV2ForTokenClassification:()=>Ie,DebertaV2Model:()=>Ee,DebertaV2PreTrainedModel:()=>Ae,DecisionTransformerModel:()=>ni,DecisionTransformerPreTrainedModel:()=>ri,DeiTForImageClassification:()=>So,DeiTModel:()=>vo,DeiTPreTrainedModel:()=>Co,DepthAnythingForDepthEstimation:()=>Uo,DepthAnythingPreTrainedModel:()=>$o,DepthProForDepthEstimation:()=>Ko,DepthProPreTrainedModel:()=>Jo,DetrForObjectDetection:()=>_o,DetrForSegmentation:()=>fo,DetrModel:()=>mo,DetrObjectDetectionOutput:()=>go,DetrPreTrainedModel:()=>ho,DetrSegmentationOutput:()=>Mo,Dinov2ForImageClassification:()=>_s,Dinov2Model:()=>ms,Dinov2PreTrainedModel:()=>hs,DistilBertForMaskedLM:()=>Re,DistilBertForQuestionAnswering:()=>je,DistilBertForSequenceClassification:()=>Oe,DistilBertForTokenClassification:()=>Ve,DistilBertModel:()=>De,DistilBertPreTrainedModel:()=>Ne,DonutSwinModel:()=>as,DonutSwinPreTrainedModel:()=>ss,EfficientNetForImageClassification:()=>Va,EfficientNetModel:()=>Oa,EfficientNetPreTrainedModel:()=>Da,ElectraForMaskedLM:()=>me,ElectraForQuestionAnswering:()=>ge,ElectraForSequenceClassification:()=>_e,ElectraForTokenClassification:()=>fe,ElectraModel:()=>he,ElectraPreTrainedModel:()=>pe,EsmForMaskedLM:()=>We,EsmForSequenceClassification:()=>$e,EsmForTokenClassification:()=>Ue,EsmModel:()=>qe,EsmPreTrainedModel:()=>Ge,FalconForCausalLM:()=>ya,FalconModel:()=>xa,FalconPreTrainedModel:()=>ba,FastViTForImageClassification:()=>Qn,FastViTModel:()=>Xn,FastViTPreTrainedModel:()=>Un,Florence2ForConditionalGeneration:()=>hr,Florence2PreTrainedModel:()=>pr,GLPNForDepthEstimation:()=>os,GLPNModel:()=>ns,GLPNPreTrainedModel:()=>rs,GPT2LMHeadModel:()=>Er,GPT2Model:()=>Ar,GPT2PreTrainedModel:()=>Sr,GPTBigCodeForCausalLM:()=>Ur,GPTBigCodeModel:()=>$r,GPTBigCodePreTrainedModel:()=>Wr,GPTJForCausalLM:()=>qr,GPTJModel:()=>Gr,GPTJPreTrainedModel:()=>Rr,GPTNeoForCausalLM:()=>Dr,GPTNeoModel:()=>Nr,GPTNeoPreTrainedModel:()=>Br,GPTNeoXForCausalLM:()=>jr,GPTNeoXModel:()=>Vr,GPTNeoXPreTrainedModel:()=>Or,Gemma2ForCausalLM:()=>un,Gemma2Model:()=>dn,Gemma2PreTrainedModel:()=>cn,GemmaForCausalLM:()=>ln,GemmaModel:()=>an,GemmaPreTrainedModel:()=>sn,GraniteForCausalLM:()=>tn,GraniteModel:()=>en,GranitePreTrainedModel:()=>Zr,GroupViTModel:()=>$n,GroupViTPreTrainedModel:()=>Wn,HieraForImageClassification:()=>Lo,HieraModel:()=>Eo,HieraPreTrainedModel:()=>Ao,HubertForCTC:()=>ea,HubertForSequenceClassification:()=>ta,HubertModel:()=>Zs,HubertPreTrainedModel:()=>Ks,ImageMattingOutput:()=>Tl,JAISLMHeadModel:()=>Ir,JAISModel:()=>zr,JAISPreTrainedModel:()=>Lr,LlamaForCausalLM:()=>Kr,LlamaModel:()=>Jr,LlamaPreTrainedModel:()=>Yr,LlavaForConditionalGeneration:()=>dr,LlavaPreTrainedModel:()=>cr,LongT5ForConditionalGeneration:()=>wt,LongT5Model:()=>Mt,LongT5PreTrainedModel:()=>gt,M2M100ForConditionalGeneration:()=>vs,M2M100Model:()=>Cs,M2M100PreTrainedModel:()=>Ps,MBartForCausalLM:()=>Et,MBartForConditionalGeneration:()=>St,MBartForSequenceClassification:()=>At,MBartModel:()=>vt,MBartPreTrainedModel:()=>Ct,MPNetForMaskedLM:()=>et,MPNetForQuestionAnswering:()=>nt,MPNetForSequenceClassification:()=>tt,MPNetForTokenClassification:()=>rt,MPNetModel:()=>Ze,MPNetPreTrainedModel:()=>Ke,MT5ForConditionalGeneration:()=>xt,MT5Model:()=>bt,MT5PreTrainedModel:()=>Tt,MarianMTModel:()=>Fs,MarianModel:()=>ks,MarianPreTrainedModel:()=>ys,MaskFormerForInstanceSegmentation:()=>ts,MaskFormerModel:()=>es,MaskFormerPreTrainedModel:()=>Zo,MaskedLMOutput:()=>fl,MistralForCausalLM:()=>ga,MistralModel:()=>fa,MistralPreTrainedModel:()=>_a,MobileBertForMaskedLM:()=>He,MobileBertForQuestionAnswering:()=>Je,MobileBertForSequenceClassification:()=>Ye,MobileBertModel:()=>Qe,MobileBertPreTrainedModel:()=>Xe,MobileNetV1ForImageClassification:()=>Ua,MobileNetV1Model:()=>$a,MobileNetV1PreTrainedModel:()=>Wa,MobileNetV2ForImageClassification:()=>Ha,MobileNetV2Model:()=>Qa,MobileNetV2PreTrainedModel:()=>Xa,MobileNetV3ForImageClassification:()=>Ka,MobileNetV3Model:()=>Ja,MobileNetV3PreTrainedModel:()=>Ya,MobileNetV4ForImageClassification:()=>ti,MobileNetV4Model:()=>ei,MobileNetV4PreTrainedModel:()=>Za,MobileViTForImageClassification:()=>Zn,MobileViTModel:()=>Kn,MobileViTPreTrainedModel:()=>Jn,MobileViTV2ForImageClassification:()=>ro,MobileViTV2Model:()=>to,MobileViTV2PreTrainedModel:()=>eo,ModelOutput:()=>W,Moondream1ForConditionalGeneration:()=>ur,MptForCausalLM:()=>Sn,MptModel:()=>vn,MptPreTrainedModel:()=>Cn,MusicgenForCausalLM:()=>Ga,MusicgenForConditionalGeneration:()=>qa,MusicgenModel:()=>Ra,MusicgenPreTrainedModel:()=>ja,NomicBertModel:()=>Z,NomicBertPreTrainedModel:()=>K,OPTForCausalLM:()=>Ln,OPTModel:()=>En,OPTPreTrainedModel:()=>An,OpenELMForCausalLM:()=>mn,OpenELMModel:()=>hn,OpenELMPreTrainedModel:()=>pn,OwlViTForObjectDetection:()=>so,OwlViTModel:()=>oo,OwlViTPreTrainedModel:()=>no,Owlv2ForObjectDetection:()=>lo,Owlv2Model:()=>io,Owlv2PreTrainedModel:()=>ao,Phi3ForCausalLM:()=>yn,Phi3Model:()=>xn,Phi3PreTrainedModel:()=>bn,PhiForCausalLM:()=>Tn,PhiModel:()=>wn,PhiPreTrainedModel:()=>Mn,PreTrainedModel:()=>q,PretrainedMixin:()=>oi,PvtForImageClassification:()=>On,PvtModel:()=>Dn,PvtPreTrainedModel:()=>Nn,PyAnnoteForAudioFrameClassification:()=>Ns,PyAnnoteModel:()=>Bs,PyAnnotePreTrainedModel:()=>Is,QuestionAnsweringModelOutput:()=>gl,Qwen2ForCausalLM:()=>gn,Qwen2Model:()=>fn,Qwen2PreTrainedModel:()=>_n,RTDetrForObjectDetection:()=>bo,RTDetrModel:()=>To,RTDetrObjectDetectionOutput:()=>xo,RTDetrPreTrainedModel:()=>wo,ResNetForImageClassification:()=>Bo,ResNetModel:()=>Io,ResNetPreTrainedModel:()=>zo,RoFormerForMaskedLM:()=>re,RoFormerForQuestionAnswering:()=>se,RoFormerForSequenceClassification:()=>ne,RoFormerForTokenClassification:()=>oe,RoFormerModel:()=>te,RoFormerPreTrainedModel:()=>ee,RobertaForMaskedLM:()=>jt,RobertaForQuestionAnswering:()=>qt,RobertaForSequenceClassification:()=>Rt,RobertaForTokenClassification:()=>Gt,RobertaModel:()=>Vt,RobertaPreTrainedModel:()=>Ot,SamImageSegmentationOutput:()=>xs,SamModel:()=>bs,SamPreTrainedModel:()=>Ts,SapiensForDepthEstimation:()=>Ho,SapiensForNormalEstimation:()=>Yo,SapiensForSemanticSegmentation:()=>Qo,SapiensPreTrainedModel:()=>Xo,SegformerForImageClassification:()=>La,SegformerForSemanticSegmentation:()=>za,SegformerModel:()=>Ea,SegformerPreTrainedModel:()=>Aa,Seq2SeqLMOutput:()=>pl,SequenceClassifierOutput:()=>hl,SiglipModel:()=>br,SiglipPreTrainedModel:()=>Tr,SiglipTextModel:()=>xr,SiglipVisionModel:()=>yr,SpeechT5ForSpeechToText:()=>da,SpeechT5ForTextToSpeech:()=>ua,SpeechT5HifiGan:()=>pa,SpeechT5Model:()=>ca,SpeechT5PreTrainedModel:()=>la,SqueezeBertForMaskedLM:()=>at,SqueezeBertForQuestionAnswering:()=>lt,SqueezeBertForSequenceClassification:()=>it,SqueezeBertModel:()=>st,SqueezeBertPreTrainedModel:()=>ot,StableLmForCausalLM:()=>Na,StableLmModel:()=>Ba,StableLmPreTrainedModel:()=>Ia,Starcoder2ForCausalLM:()=>Ta,Starcoder2Model:()=>wa,Starcoder2PreTrainedModel:()=>Ma,Swin2SRForImageSuperResolution:()=>Ro,Swin2SRModel:()=>jo,Swin2SRPreTrainedModel:()=>Vo,SwinForImageClassification:()=>Oo,SwinModel:()=>Do,SwinPreTrainedModel:()=>No,T5ForConditionalGeneration:()=>ft,T5Model:()=>_t,T5PreTrainedModel:()=>mt,TableTransformerForObjectDetection:()=>Fo,TableTransformerModel:()=>ko,TableTransformerObjectDetectionOutput:()=>Po,TableTransformerPreTrainedModel:()=>yo,TokenClassifierOutput:()=>_l,TrOCRForCausalLM:()=>ma,TrOCRPreTrainedModel:()=>ha,UniSpeechForCTC:()=>Rs,UniSpeechForSequenceClassification:()=>Gs,UniSpeechModel:()=>js,UniSpeechPreTrainedModel:()=>Vs,UniSpeechSatForAudioFrameClassification:()=>Xs,UniSpeechSatForCTC:()=>$s,UniSpeechSatForSequenceClassification:()=>Us,UniSpeechSatModel:()=>Ws,UniSpeechSatPreTrainedModel:()=>qs,ViTForImageClassification:()=>Bn,ViTMAEModel:()=>jn,ViTMAEPreTrainedModel:()=>Vn,ViTMSNForImageClassification:()=>qn,ViTMSNModel:()=>Gn,ViTMSNPreTrainedModel:()=>Rn,ViTModel:()=>In,ViTPreTrainedModel:()=>zn,VisionEncoderDecoderModel:()=>lr,VitMatteForImageMatting:()=>Yn,VitMattePreTrainedModel:()=>Hn,VitsModel:()=>Sa,VitsModelOutput:()=>bl,VitsPreTrainedModel:()=>va,Wav2Vec2BertForCTC:()=>Ys,Wav2Vec2BertForSequenceClassification:()=>Js,Wav2Vec2BertModel:()=>Hs,Wav2Vec2BertPreTrainedModel:()=>Qs,Wav2Vec2ForAudioFrameClassification:()=>zs,Wav2Vec2ForCTC:()=>Es,Wav2Vec2ForSequenceClassification:()=>Ls,Wav2Vec2Model:()=>As,Wav2Vec2PreTrainedModel:()=>Ss,WavLMForAudioFrameClassification:()=>ia,WavLMForCTC:()=>oa,WavLMForSequenceClassification:()=>sa,WavLMForXVector:()=>aa,WavLMModel:()=>na,WavLMPreTrainedModel:()=>ra,WeSpeakerResNetModel:()=>Os,WeSpeakerResNetPreTrainedModel:()=>Ds,WhisperForConditionalGeneration:()=>ir,WhisperModel:()=>ar,WhisperPreTrainedModel:()=>sr,XLMForQuestionAnswering:()=>Ht,XLMForSequenceClassification:()=>Xt,XLMForTokenClassification:()=>Qt,XLMModel:()=>$t,XLMPreTrainedModel:()=>Wt,XLMRobertaForMaskedLM:()=>Kt,XLMRobertaForQuestionAnswering:()=>tr,XLMRobertaForSequenceClassification:()=>Zt,XLMRobertaForTokenClassification:()=>er,XLMRobertaModel:()=>Jt,XLMRobertaPreTrainedModel:()=>Yt,XLMWithLMHeadModel:()=>Ut,XVectorOutput:()=>ml,YolosForObjectDetection:()=>Ms,YolosModel:()=>gs,YolosObjectDetectionOutput:()=>ws,YolosPreTrainedModel:()=>fs});var n=r(/*! ./configs.js */"./src/configs.js"),o=r(/*! ./backends/onnx.js */"./src/backends/onnx.js"),s=r(/*! ./utils/dtypes.js */"./src/utils/dtypes.js"),a=r(/*! ./utils/generic.js */"./src/utils/generic.js"),i=r(/*! ./utils/core.js */"./src/utils/core.js"),l=r(/*! ./utils/hub.js */"./src/utils/hub.js"),c=r(/*! ./utils/constants.js */"./src/utils/constants.js"),d=r(/*! ./generation/logits_process.js */"./src/generation/logits_process.js"),u=r(/*! ./generation/configuration_utils.js */"./src/generation/configuration_utils.js"),p=r(/*! ./utils/tensor.js */"./src/utils/tensor.js"),h=r(/*! ./utils/maths.js */"./src/utils/maths.js"),m=r(/*! ./generation/stopping_criteria.js */"./src/generation/stopping_criteria.js"),_=r(/*! ./generation/logits_sampler.js */"./src/generation/logits_sampler.js"),f=r(/*! ./env.js */"./src/env.js"),g=r(/*! ./models/whisper/generation_whisper.js */"./src/models/whisper/generation_whisper.js"),M=r(/*! ./models/whisper/common_whisper.js */"./src/models/whisper/common_whisper.js");const w=0,T=1,b=2,x=3,y=4,k=5,F=6,P=7,C=new Map,v=new Map,S=new Map;async function A(e,t,r){return Object.fromEntries(await Promise.all(Object.keys(t).map((async a=>{const{buffer:i,session_options:c,session_config:d}=await async function(e,t,r){const a=r.config?.["transformers.js_config"]??{};let i=r.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,o.deviceToExecutionProviders)(c);let u=r.dtype??a.dtype;"string"!=typeof u&&(u&&u.hasOwnProperty(t)?u=u[t]:(u=s.DEFAULT_DEVICE_DTYPE_MAPPING[c]??s.DATA_TYPES.fp32,console.warn(`dtype not specified for "${t}". Using the default dtype (${u}) for this device (${c}).`)));const p=u;if(!s.DEFAULT_DTYPE_SUFFIX_MAPPING.hasOwnProperty(p))throw new Error(`Invalid dtype: ${p}. Should be one of: ${Object.keys(s.DATA_TYPES).join(", ")}`);if(p===s.DATA_TYPES.fp16&&"webgpu"===c&&!await(0,s.isWebGpuFp16Supported)())throw new Error(`The device (${c}) does not support fp16.`);const h=a.kv_cache_dtype?"string"==typeof a.kv_cache_dtype?a.kv_cache_dtype:a.kv_cache_dtype[p]??"float32":void 0;if(h&&!["float32","float16"].includes(h))throw new Error(`Invalid kv_cache_dtype: ${h}. Should be one of: float32, float16`);const m={dtype:p,kv_cache_dtype:h},_=s.DEFAULT_DTYPE_SUFFIX_MAPPING[p],g=`${r.subfolder??""}/${t}${_}.onnx`,M={...r.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,r),b=r.use_external_data_format??a.use_external_data_format;let x=[];if(b&&(!0===b||"object"==typeof b&&b.hasOwnProperty(t)&&!0===b[t])){if(f.apis.IS_NODE_ENV)throw new Error("External data format is not yet supported in Node.js");const n=`${t}${_}.onnx_data`,o=`${r.subfolder??""}/${n}`;x.push(new Promise((async(t,s)=>{const a=await(0,l.getModelFile)(e,o,!0,r);t({path:n,data:a})})))}else void 0!==M.externalData&&(x=M.externalData.map((async t=>{if("string"==typeof t.data){const n=await(0,l.getModelFile)(e,t.data,!0,r);return{...t,data:n}}return t})));if(x.length>0&&(M.externalData=await Promise.all(x)),"webgpu"===c){const e=(0,n.getKeyValueShapes)(r.config,{prefix:"present"});if(Object.keys(e).length>0&&!(0,o.isONNXProxy)()){const t={};for(const r in e)t[r]="gpu-buffer";M.preferredOutputLocation=t}}return{buffer:await T,session_options:M,session_config:m}}(e,t[a],r);return[a,await(0,o.createInferenceSession)(i,c,d)]}))))}async function E(e,t,r){return Object.fromEntries(await Promise.all(Object.keys(t).map((async n=>[n,await(0,l.getModelJSON)(e,t[n],!1,r)]))))}async function L(e,t){const r=function(e,t){const r=Object.create(null),n=[];for(const s of e.inputNames){const e=t[s];e instanceof p.Tensor?r[s]=(0,o.isONNXProxy)()?e.clone():e:n.push(s)}if(n.length>0)throw new Error(`An error occurred during model execution: "Missing the following inputs: ${n.join(", ")}.`);const s=Object.keys(t).length,a=e.inputNames.length;if(s>a){let r=Object.keys(t).filter((t=>!e.inputNames.includes(t)));console.warn(`WARNING: Too many inputs were provided (${s} > ${a}). The following inputs will be ignored: "${r.join(", ")}".`)}return r}(e,t);try{const t=Object.fromEntries(Object.entries(r).map((([e,t])=>[e,t.ort_tensor])));let n=await e.run(t);return n=z(n),n}catch(e){throw console.error(`An error occurred during model execution: "${e}".`),console.error("Inputs given to model:",r),e}}function z(e){for(let t in e)(0,o.isONNXTensor)(e[t])?e[t]=new p.Tensor(e[t]):"object"==typeof e[t]&&z(e[t]);return e}function I(e){if(e instanceof p.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 p.Tensor("int64",BigInt64Array.from(e.flat().map((e=>BigInt(e)))),[e.length,e[0].length])}return new p.Tensor("int64",BigInt64Array.from(e.map((e=>BigInt(e)))),[1,e.length])}function B(e){return new p.Tensor("bool",[e],[1])}async function N(e,t){let{encoder_outputs:r,input_ids:n,decoder_input_ids:o,...s}=t;if(!r){const n=(0,i.pick)(t,e.sessions.model.inputNames);r=(await D(e,n)).last_hidden_state}s.input_ids=o,s.encoder_hidden_states=r,e.sessions.decoder_model_merged.inputNames.includes("encoder_attention_mask")&&(s.encoder_attention_mask=t.attention_mask);return await O(e,s,!0)}async function D(e,t){const r=e.sessions.model,n=(0,i.pick)(t,r.inputNames);if(r.inputNames.includes("inputs_embeds")&&!n.inputs_embeds){if(!t.input_ids)throw new Error("Both `input_ids` and `inputs_embeds` are missing in the model inputs.");n.inputs_embeds=await e.encode_text({input_ids:t.input_ids})}return r.inputNames.includes("token_type_ids")&&!n.token_type_ids&&(n.token_type_ids=new p.Tensor("int64",new BigInt64Array(n.input_ids.data.length),n.input_ids.dims)),await L(r,n)}async function O(e,t,r=!1){const n=e.sessions[r?"decoder_model_merged":"model"],{past_key_values:o,...s}=t;n.inputNames.includes("use_cache_branch")&&(s.use_cache_branch=B(!!o)),n.inputNames.includes("position_ids")&&s.attention_mask&&!s.position_ids&&(s.position_ids=function(e,t=null){const{input_ids:r,inputs_embeds:n,attention_mask:o}=e,[s,a]=o.dims,i=new BigInt64Array(o.data.length);for(let e=0;e<s;++e){const t=e*a;let r=BigInt(0);for(let e=0;e<a;++e){const n=t+e;0n===o.data[n]?i[n]=BigInt(1):(i[n]=r,r+=o.data[n])}}let l=new p.Tensor("int64",i,o.dims);if(t){const e=-(r??n).dims.at(1);l=l.slice(null,[e,null])}return l}(s,o)),e.addPastKeyValues(s,o);const a=(0,i.pick)(s,n.inputNames);return await L(n,a)}async function V(e,{input_ids:t=null,attention_mask:r=null,pixel_values:n=null,position_ids:o=null,inputs_embeds:s=null,past_key_values:a=null,generation_config:i=null,logits_processor:l=null,...c}){if(!s)if(s=await e.encode_text({input_ids:t}),n&&1!==t.dims[1]){const o=await e.encode_image({pixel_values:n});({inputs_embeds:s,attention_mask:r}=e._merge_input_ids_with_image_features({image_features:o,inputs_embeds:s,input_ids:t,attention_mask:r}))}else if(a&&n&&1===t.dims[1]){const e=t.dims[1],n=Object.values(a)[0].dims.at(-2);r=(0,p.cat)([(0,p.ones)([t.dims[0],n]),r.slice(null,[r.dims[1]-e,r.dims[1]])],1)}return await O(e,{inputs_embeds:s,past_key_values:a,attention_mask:r,position_ids:o,generation_config:i,logits_processor:l},!0)}function j(e,t,r,n){if(r.past_key_values){const t=Object.values(r.past_key_values)[0].dims.at(-2),{input_ids:n,attention_mask:o}=r;if(o&&o.dims[1]>n.dims[1]);else if(t<n.dims[1])r.input_ids=n.slice(null,[t,null]);else if(null!=e.config.image_token_index&&n.data.some((t=>t==e.config.image_token_index))){const o=e.config.num_image_tokens;if(!o)throw new Error("`num_image_tokens` is missing in the model configuration.");const s=n.dims[1]-(t-o);r.input_ids=n.slice(null,[-s,null]),r.attention_mask=(0,p.ones)([1,t+s])}}return r}function R(e,t,r,n){return r.past_key_values&&(t=t.map((e=>[e.at(-1)]))),{...r,decoder_input_ids:I(t)}}function G(e,...t){return e.config.is_encoder_decoder?R(e,...t):j(e,...t)}class q extends a.Callable{main_input_name="input_ids";forward_params=["input_ids","attention_mask"];constructor(e,t,r){super(),this.config=e,this.sessions=t,this.configs=r;const n=S.get(this.constructor),o=C.get(n);switch(this.can_generate=!1,this._forward=null,this._prepare_inputs_for_generation=null,o){case y:this.can_generate=!0,this._forward=O,this._prepare_inputs_for_generation=j;break;case b:case x:case P:this.can_generate=!0,this._forward=N,this._prepare_inputs_for_generation=R;break;case T:this._forward=N;break;case F:this.can_generate=!0,this._forward=V,this._prepare_inputs_for_generation=G;break;default:this._forward=D}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:r=null,cache_dir:o=null,local_files_only:s=!1,revision:a="main",model_file_name:i=null,subfolder:l="onnx",device:d=null,dtype:u=null,use_external_data_format:p=null,session_options:h={}}={}){let m={progress_callback:t,config:r,cache_dir:o,local_files_only:s,revision:a,model_file_name:i,subfolder:l,device:d,dtype:u,use_external_data_format:p,session_options:h};const _=S.get(this),f=C.get(_);let g;if(r=m.config=await n.AutoConfig.from_pretrained(e,m),f===y)g=await Promise.all([A(e,{model:m.model_file_name??"model"},m),E(e,{generation_config:"generation_config.json"},m)]);else if(f===b||f===x)g=await Promise.all([A(e,{model:"encoder_model",decoder_model_merged:"decoder_model_merged"},m),E(e,{generation_config:"generation_config.json"},m)]);else if(f===k)g=await Promise.all([A(e,{model:"vision_encoder",prompt_encoder_mask_decoder:"prompt_encoder_mask_decoder"},m)]);else if(f===T)g=await Promise.all([A(e,{model:"encoder_model",decoder_model_merged:"decoder_model_merged"},m)]);else if(f===F){const t={embed_tokens:"embed_tokens",vision_encoder:"vision_encoder",decoder_model_merged:"decoder_model_merged"};r.is_encoder_decoder&&(t.model="encoder_model"),g=await Promise.all([A(e,t,m),E(e,{generation_config:"generation_config.json"},m)])}else f===P?g=await Promise.all([A(e,{model:"text_encoder",decoder_model_merged:"decoder_model_merged",encodec_decode:"encodec_decode"},m),E(e,{generation_config:"generation_config.json"},m)]):(f!==w&&console.warn(`Model type for '${_??r?.model_type}' not found, assuming encoder-only architecture. Please report this at ${c.GITHUB_ISSUE_URL}.`),g=await Promise.all([A(e,{model:m.model_file_name??"model"},m)]));return new this(r,...g)}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,r=null){const n=new d.LogitsProcessorList;if(null!==e.repetition_penalty&&1!==e.repetition_penalty&&n.push(new d.RepetitionPenaltyLogitsProcessor(e.repetition_penalty)),null!==e.no_repeat_ngram_size&&e.no_repeat_ngram_size>0&&n.push(new d.NoRepeatNGramLogitsProcessor(e.no_repeat_ngram_size)),null!==e.bad_words_ids&&n.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&&n.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&&n.push(new d.MinNewTokensLengthLogitsProcessor(t,e.min_new_tokens,e.eos_token_id)),null!==e.forced_bos_token_id&&n.push(new d.ForcedBOSTokenLogitsProcessor(e.forced_bos_token_id)),null!==e.forced_eos_token_id&&n.push(new d.ForcedEOSTokenLogitsProcessor(e.max_length,e.forced_eos_token_id)),null!==e.begin_suppress_tokens){const r=t>1||null===e.forced_bos_token_id?t:t+1;n.push(new d.SuppressTokensAtBeginLogitsProcessor(e.begin_suppress_tokens,r))}return null!==e.guidance_scale&&e.guidance_scale>1&&n.push(new d.ClassifierFreeGuidanceLogitsProcessor(e.guidance_scale)),null!==r&&n.extend(r),n}_prepare_generation_config(e,t,r=u.GenerationConfig){const n={...this.config};for(const e of["decoder","generator","text_config"])e in n&&Object.assign(n,n[e]);const o=new r(n);return Object.assign(o,this.generation_config??{}),e&&Object.assign(o,e),t&&Object.assign(o,(0,i.pick)(t,Object.getOwnPropertyNames(o))),o}_get_stopping_criteria(e,t=null){const r=new m.StoppingCriteriaList;return null!==e.max_length&&r.push(new m.MaxLengthCriteria(e.max_length,this.config.max_position_embeddings??null)),null!==e.eos_token_id&&r.push(new m.EosTokenCriteria(e.eos_token_id)),t&&r.extend(t),r}_validate_model_class(){if(!this.can_generate){const e=[mi,gi,hi,li],t=S.get(this.constructor),r=new Set,n=this.config.model_type;for(const t of e){const e=t.get(n);e&&r.add(e[0])}let o=`The current model class (${t}) is not compatible with \`.generate()\`, as it doesn't have a language model head.`;throw r.size>0&&(o+=` Please use the following class instead: ${[...r].join(", ")}`),Error(o)}}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:r,is_encoder_decoder:n}){return r.past_key_values=this.getPastKeyValues(t,r.past_key_values),r.input_ids=new p.Tensor("int64",e.flat(),[e.length,1]),n||(r.attention_mask=(0,p.cat)([r.attention_mask,(0,p.ones)([r.attention_mask.dims[0],1])],1)),r.position_ids=null,r}_prepare_model_inputs({inputs:e,bos_token_id:t,model_kwargs:r}){const n=(0,i.pick)(r,this.forward_params),o=this.main_input_name;if(o in n){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 n[o]=e;return{inputs_tensor:n[o],model_inputs:n,model_input_name:o}}async _prepare_encoder_decoder_kwargs_for_generation({inputs_tensor:e,model_inputs:t,model_input_name:r,generation_config:n}){if(this.sessions.model.inputNames.includes("inputs_embeds")&&!t.inputs_embeds&&"_prepare_inputs_embeds"in this){const{input_ids:e,pixel_values:r,attention_mask:n,...o}=t,s=await this._prepare_inputs_embeds(t);t={...o,...(0,i.pick)(s,["inputs_embeds","attention_mask"])}}let{last_hidden_state:o}=await D(this,t);if(null!==n.guidance_scale&&n.guidance_scale>1)o=(0,p.cat)([o,(0,p.full_like)(o,0)],0),"attention_mask"in t&&(t.attention_mask=(0,p.cat)([t.attention_mask,(0,p.zeros_like)(t.attention_mask)],0));else if(t.decoder_input_ids){const e=I(t.decoder_input_ids).dims[0];if(e!==o.dims[0]){if(1!==o.dims[0])throw new Error(`The encoder outputs have a different batch size (${o.dims[0]}) than the decoder inputs (${e}).`);o=(0,p.cat)(Array.from({length:e},(()=>o)),0)}}return t.encoder_outputs=o,t}_prepare_decoder_input_ids_for_generation({batch_size:e,model_input_name:t,model_kwargs:r,decoder_start_token_id:n,bos_token_id:o,generation_config:s}){let{decoder_input_ids:a,...i}=r;if(a)Array.isArray(a[0])||(a=Array.from({length:e},(()=>a)));else if(n??=o,"musicgen"===this.config.model_type)a=Array.from({length:e*this.config.decoder.num_codebooks},(()=>[n]));else if(Array.isArray(n)){if(n.length!==e)throw new Error(`\`decoder_start_token_id\` expcted to have length ${e} but got ${n.length}`);a=n}else a=Array.from({length:e},(()=>[n]));return a=I(a),r.decoder_attention_mask=(0,p.ones_like)(a),{input_ids:a,model_inputs:i}}async generate({inputs:e=null,generation_config:t=null,logits_processor:r=null,stopping_criteria:n=null,streamer:o=null,...s}){this._validate_model_class(),t=this._prepare_generation_config(t,s);let{inputs_tensor:a,model_inputs:i,model_input_name:l}=this._prepare_model_inputs({inputs:e,model_kwargs:s});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 h=this._get_logits_processor(t,u,r),m=this._get_stopping_criteria(t,n),f=i[l].dims.at(0),g=_.LogitsSampler.getSampler(t),M=new Array(f).fill(0),w=d.tolist();let T;o&&o.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=h(w,T.logits.slice(null,-1,null)),r=[];for(let t=0;t<e.dims.at(0);++t){const n=e[t],o=await g(n);for(const[e,n]of o){const o=BigInt(e);M[t]+=n,w[t].push(o),r.push([o]);break}}o&&o.put(r);if(m(w).every((e=>e)))break;i=this._update_model_kwargs_for_generation({generated_input_ids:r,outputs:T,model_inputs:i,is_encoder_decoder:c})}o&&o.end();const x=this.getPastKeyValues(T,i.past_key_values,!0),y=new p.Tensor("int64",w.flat(),[w.length,w[0].length]);if(t.return_dict_in_generate)return{sequences:y,past_key_values:x,...b};for(const e of Object.values(T))"gpu-buffer"===e.location&&e.dispose();return y}getPastKeyValues(e,t,r=!1){const n=Object.create(null);for(const o in e)if(o.startsWith("present")){const s=o.replace("present","past_key_values"),a=o.includes("encoder");if(n[s]=a&&t?t[s]:e[o],t&&(!a||r)){const e=t[s];"gpu-buffer"===e.location&&e.dispose()}}return n}getAttentions(e){const t={};for(const r of["cross_attentions","encoder_attentions","decoder_attentions"])for(const n in e)n.startsWith(r)&&(r in t||(t[r]=[]),t[r].push(e[n]));return t}addPastKeyValues(e,t){if(t)Object.assign(e,t);else{const t=this.sessions.decoder_model_merged??this.sessions.model,r=t?.config?.kv_cache_dtype??"float32",o="float16"===r?new Uint16Array:[],s=(0,n.getKeyValueShapes)(this.config);for(const t in s)e[t]=new p.Tensor(r,o,s[t])}}async encode_image({pixel_values:e}){const t=(await L(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 L(this.sessions.embed_tokens,{input_ids:e})).inputs_embeds}}class W{}class $ extends W{constructor({last_hidden_state:e,hidden_states:t=null,attentions:r=null}){super(),this.last_hidden_state=e,this.hidden_states=t,this.attentions=r}}class U extends q{}class X extends U{}class Q extends U{async _call(e){return new fl(await super._call(e))}}class H extends U{async _call(e){return new hl(await super._call(e))}}class Y extends U{async _call(e){return new _l(await super._call(e))}}class J extends U{async _call(e){return new gl(await super._call(e))}}class K extends q{}class Z extends K{}class ee extends q{}class te extends ee{}class re extends ee{async _call(e){return new fl(await super._call(e))}}class ne extends ee{async _call(e){return new hl(await super._call(e))}}class oe extends ee{async _call(e){return new _l(await super._call(e))}}class se extends ee{async _call(e){return new gl(await super._call(e))}}class ae extends q{}class ie extends ae{}class le extends ae{async _call(e){return new fl(await super._call(e))}}class ce extends ae{async _call(e){return new hl(await super._call(e))}}class de extends ae{async _call(e){return new _l(await super._call(e))}}class ue extends ae{async _call(e){return new gl(await super._call(e))}}class pe extends q{}class he extends pe{}class me extends pe{async _call(e){return new fl(await super._call(e))}}class _e extends pe{async _call(e){return new hl(await super._call(e))}}class fe extends pe{async _call(e){return new _l(await super._call(e))}}class ge extends pe{async _call(e){return new gl(await super._call(e))}}class Me extends q{}class we extends Me{}class Te extends Me{async _call(e){return new fl(await super._call(e))}}class be extends Me{async _call(e){return new hl(await super._call(e))}}class xe extends Me{async _call(e){return new _l(await super._call(e))}}class ye extends Me{async _call(e){return new gl(await super._call(e))}}class ke extends q{}class Fe extends ke{}class Pe extends ke{async _call(e){return new fl(await super._call(e))}}class Ce extends ke{async _call(e){return new hl(await super._call(e))}}class ve extends ke{async _call(e){return new _l(await super._call(e))}}class Se extends ke{async _call(e){return new gl(await super._call(e))}}class Ae extends q{}class Ee extends Ae{}class Le extends Ae{async _call(e){return new fl(await super._call(e))}}class ze extends Ae{async _call(e){return new hl(await super._call(e))}}class Ie extends Ae{async _call(e){return new _l(await super._call(e))}}class Be extends Ae{async _call(e){return new gl(await super._call(e))}}class Ne extends q{}class De extends Ne{}class Oe extends Ne{async _call(e){return new hl(await super._call(e))}}class Ve extends Ne{async _call(e){return new _l(await super._call(e))}}class je extends Ne{async _call(e){return new gl(await super._call(e))}}class Re extends Ne{async _call(e){return new fl(await super._call(e))}}class Ge extends q{}class qe extends Ge{}class We extends Ge{async _call(e){return new fl(await super._call(e))}}class $e extends Ge{async _call(e){return new hl(await super._call(e))}}class Ue extends Ge{async _call(e){return new _l(await super._call(e))}}class Xe extends q{}class Qe extends Xe{}class He extends Xe{async _call(e){return new fl(await super._call(e))}}class Ye extends Xe{async _call(e){return new hl(await super._call(e))}}class Je extends Xe{async _call(e){return new gl(await super._call(e))}}class Ke extends q{}class Ze extends Ke{}class et extends Ke{async _call(e){return new fl(await super._call(e))}}class tt extends Ke{async _call(e){return new hl(await super._call(e))}}class rt extends Ke{async _call(e){return new _l(await super._call(e))}}class nt extends Ke{async _call(e){return new gl(await super._call(e))}}class ot extends q{}class st extends ot{}class at extends ot{async _call(e){return new fl(await super._call(e))}}class it extends ot{async _call(e){return new hl(await super._call(e))}}class lt extends ot{async _call(e){return new gl(await super._call(e))}}class ct extends q{}class dt extends ct{}class ut extends ct{async _call(e){return new hl(await super._call(e))}}class pt extends ct{async _call(e){return new gl(await super._call(e))}}class ht extends ct{async _call(e){return new fl(await super._call(e))}}class mt extends q{forward_params=["input_ids","attention_mask","encoder_outputs","decoder_input_ids","decoder_attention_mask","past_key_values"]}class _t extends mt{}class ft extends mt{}class gt extends q{}class Mt extends gt{}class wt extends gt{}class Tt extends q{}class bt extends Tt{}class xt extends Tt{}class yt extends q{}class kt extends yt{}class Ft extends yt{}class Pt extends yt{async _call(e){return new hl(await super._call(e))}}class Ct extends q{}class vt extends Ct{}class St extends Ct{}class At extends Ct{async _call(e){return new hl(await super._call(e))}}class Et extends Ct{}class Lt extends q{}class zt extends Lt{}class It extends Lt{}class Bt extends q{}class Nt extends Bt{}class Dt extends Bt{}class Ot extends q{}class Vt extends Ot{}class jt extends Ot{async _call(e){return new fl(await super._call(e))}}class Rt extends Ot{async _call(e){return new hl(await super._call(e))}}class Gt extends Ot{async _call(e){return new _l(await super._call(e))}}class qt extends Ot{async _call(e){return new gl(await super._call(e))}}class Wt extends q{}class $t extends Wt{}class Ut extends Wt{async _call(e){return new fl(await super._call(e))}}class Xt extends Wt{async _call(e){return new hl(await super._call(e))}}class Qt extends Wt{async _call(e){return new _l(await super._call(e))}}class Ht extends Wt{async _call(e){return new gl(await super._call(e))}}class Yt extends q{}class Jt extends Yt{}class Kt extends Yt{async _call(e){return new fl(await super._call(e))}}class Zt extends Yt{async _call(e){return new hl(await super._call(e))}}class er extends Yt{async _call(e){return new _l(await super._call(e))}}class tr extends Yt{async _call(e){return new gl(await super._call(e))}}class rr extends q{}class nr extends rr{}class or extends rr{}class sr extends q{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 ar extends sr{}class ir extends sr{_prepare_generation_config(e,t){return super._prepare_generation_config(e,t,g.WhisperGenerationConfig)}_retrieve_init_tokens(e){const t=[e.decoder_start_token_id];let r=e.language;const n=e.task;if(e.is_multilingual){r||(console.warn("No language specified - defaulting to English (en)."),r="en");const o=`<|${(0,M.whisper_language_to_code)(r)}|>`;t.push(e.lang_to_id[o]),t.push(e.task_to_id[n??"transcribe"])}else if(r||n)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:r=null,stopping_criteria:n=null,...o}){t=this._prepare_generation_config(t,o);const s=o.decoder_input_ids??this._retrieve_init_tokens(t);if(t.return_timestamps&&(r??=new d.LogitsProcessorList,r.push(new d.WhisperTimeStampLogitsProcessor(t,s))),t.begin_suppress_tokens&&(r??=new d.LogitsProcessorList,r.push(new d.SuppressTokensAtBeginLogitsProcessor(t.begin_suppress_tokens,s.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:r,decoder_input_ids:s,...o});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,r=null,n=.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==r&&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 o=this.config.median_filter_width;void 0===o&&(console.warn("Model config has no `median_filter_width`, using default value of 7."),o=7);const s=e.cross_attentions,a=Array.from({length:this.config.decoder_layers},((e,t)=>(0,p.cat)(s.map((e=>e[t])),2))),l=(0,p.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 r?a[e].slice(null,t,null,[0,r]):a[e].slice(null,t)}))).transpose(1,0,2,3),[c,d]=(0,p.std_mean)(l,-2,0,!0),u=l.clone();for(let e=0;e<u.dims[0];++e){const t=u[e];for(let r=0;r<t.dims[0];++r){const n=t[r],s=c[e][r][0].data,a=d[e][r][0].data;for(let e=0;e<n.dims[0];++e){let t=n[e].data;for(let e=0;e<t.length;++e)t[e]=(t[e]-a[e])/s[e];t.set((0,h.medianFilter)(t,o))}}}const m=[(0,p.mean)(u,1)],_=e.sequences.dims,f=new p.Tensor("float32",new Float32Array(_[0]*_[1]),_);for(let e=0;e<_[0];++e){const t=m[e].neg().squeeze_(0),[r,o]=(0,h.dynamic_time_warping)(t.tolist()),s=Array.from({length:r.length-1},((e,t)=>r[t+1]-r[t])),a=(0,i.mergeArrays)([1],s).map((e=>!!e)),l=[];for(let e=0;e<a.length;++e)a[e]&&l.push(o[e]*n);f[e].data.set(l,1)}return f}}class lr extends q{main_input_name="pixel_values";forward_params=["pixel_values","input_ids","encoder_hidden_states","past_key_values"]}class cr extends q{forward_params=["input_ids","pixel_values","attention_mask","position_ids","past_key_values"]}class dr extends cr{_merge_input_ids_with_image_features({inputs_embeds:e,image_features:t,input_ids:r,attention_mask:n}){const o=this.config.image_token_index,s=r.tolist().map((e=>e.findIndex((e=>e==o)))),a=s.every((e=>-1===e)),i=s.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:n};const l=[],c=[];for(let r=0;r<s.length;++r){const o=s[r],a=e[r],i=t[r],d=n[r];l.push((0,p.cat)([a.slice([0,o]),i,a.slice([o+1,a.dims[0]])],0)),c.push((0,p.cat)([d.slice([0,o]),(0,p.ones)([i.dims[0]]),d.slice([o+1,d.dims[0]])],0))}return{inputs_embeds:(0,p.stack)(l,0),attention_mask:(0,p.stack)(c,0)}}}class ur extends dr{}class pr extends q{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 hr extends pr{_merge_input_ids_with_image_features({inputs_embeds:e,image_features:t,input_ids:r,attention_mask:n}){return{inputs_embeds:(0,p.cat)([t,e],1),attention_mask:(0,p.cat)([(0,p.ones)(t.dims.slice(0,2)),n],1)}}async _prepare_inputs_embeds({input_ids:e,pixel_values:t,inputs_embeds:r,attention_mask:n}){if(!e&&!t)throw new Error("Either `input_ids` or `pixel_values` should be provided.");let o,s;return e&&(o=await this.encode_text({input_ids:e})),t&&(s=await this.encode_image({pixel_values:t})),o&&s?({inputs_embeds:r,attention_mask:n}=this._merge_input_ids_with_image_features({inputs_embeds:o,image_features:s,input_ids:e,attention_mask:n})):r=o||s,{inputs_embeds:r,attention_mask:n}}async forward({input_ids:e,pixel_values:t,attention_mask:r,decoder_input_ids:n,decoder_attention_mask:o,encoder_outputs:s,past_key_values:a,inputs_embeds:i,decoder_inputs_embeds:l}){if(i||({inputs_embeds:i,attention_mask:r}=await this._prepare_inputs_embeds({input_ids:e,pixel_values:t,inputs_embeds:i,attention_mask:r})),!s){let{last_hidden_state:e}=await D(this,{inputs_embeds:i,attention_mask:r});s=e}if(!l){if(!n)throw new Error("Either `decoder_input_ids` or `decoder_inputs_embeds` should be provided.");l=await this.encode_text({input_ids:n})}const c={inputs_embeds:l,attention_mask:o,encoder_attention_mask:r,encoder_hidden_states:s,past_key_values:a};return await O(this,c,!0)}}class mr extends q{}class _r extends mr{}class fr extends mr{static async from_pretrained(e,t={}){return t.model_file_name??="text_model",super.from_pretrained(e,t)}}class gr extends mr{static async from_pretrained(e,t={}){return t.model_file_name??="text_model",super.from_pretrained(e,t)}}class Mr extends mr{static async from_pretrained(e,t={}){return t.model_file_name??="vision_model",super.from_pretrained(e,t)}}class wr extends mr{static async from_pretrained(e,t={}){return t.model_file_name??="vision_model",super.from_pretrained(e,t)}}class Tr extends q{}class br extends Tr{}class xr extends Tr{static async from_pretrained(e,t={}){return t.model_file_name??="text_model",super.from_pretrained(e,t)}}class yr extends mr{static async from_pretrained(e,t={}){return t.model_file_name??="vision_model",super.from_pretrained(e,t)}}class kr extends q{}class Fr extends kr{}class Pr extends q{}class Cr extends Pr{}class vr extends Pr{}class Sr extends q{}class Ar extends Sr{}class Er extends Sr{}class Lr extends q{}class zr extends Lr{}class Ir extends Lr{}class Br extends q{}class Nr extends Br{}class Dr extends Br{}class Or extends q{}class Vr extends Or{}class jr extends Or{}class Rr extends q{}class Gr extends Rr{}class qr extends Rr{}class Wr extends q{}class $r extends Wr{}class Ur extends Wr{}class Xr extends q{}class Qr extends Xr{}class Hr extends Xr{}class Yr extends q{}class Jr extends Yr{}class Kr extends Yr{}class Zr extends q{}class en extends Zr{}class tn extends Zr{}class rn extends q{}class nn extends rn{}class on extends rn{}class sn extends q{}class an extends sn{}class ln extends sn{}class cn extends q{}class dn extends cn{}class un extends cn{}class pn extends q{}class hn extends pn{}class mn extends pn{}class _n extends q{}class fn extends _n{}class gn extends _n{}class Mn extends q{}class wn extends Mn{}class Tn extends Mn{}class bn extends q{}class xn extends bn{}class yn extends bn{}class kn extends q{}class Fn extends kn{}class Pn extends kn{}class Cn extends q{}class vn extends Cn{}class Sn extends Cn{}class An extends q{}class En extends An{}class Ln extends An{}class zn extends q{}class In extends zn{}class Bn extends zn{async _call(e){return new hl(await super._call(e))}}class Nn extends q{}class Dn extends Nn{}class On extends Nn{async _call(e){return new hl(await super._call(e))}}class Vn extends q{}class jn extends Vn{}class Rn extends q{}class Gn extends Rn{}class qn extends Rn{async _call(e){return new hl(await super._call(e))}}class Wn extends q{}class $n extends Wn{}class Un extends q{}class Xn extends Un{}class Qn extends Un{async _call(e){return new hl(await super._call(e))}}class Hn extends q{}class Yn extends Hn{async _call(e){return new Tl(await super._call(e))}}class Jn extends q{}class Kn extends Jn{}class Zn extends Jn{async _call(e){return new hl(await super._call(e))}}class eo extends q{}class to extends eo{}class ro extends eo{async _call(e){return new hl(await super._call(e))}}class no extends q{}class oo extends no{}class so extends no{}class ao extends q{}class io extends ao{}class lo extends ao{}class co extends q{}class uo extends co{}class po extends co{async _call(e){return new hl(await super._call(e))}}class ho extends q{}class mo extends ho{}class _o extends ho{async _call(e){return new go(await super._call(e))}}class fo extends ho{async _call(e){return new Mo(await super._call(e))}}class go extends W{constructor({logits:e,pred_boxes:t}){super(),this.logits=e,this.pred_boxes=t}}class Mo extends W{constructor({logits:e,pred_boxes:t,pred_masks:r}){super(),this.logits=e,this.pred_boxes=t,this.pred_masks=r}}class wo extends q{}class To extends wo{}class bo extends wo{async _call(e){return new xo(await super._call(e))}}class xo extends W{constructor({logits:e,pred_boxes:t}){super(),this.logits=e,this.pred_boxes=t}}class yo extends q{}class ko extends yo{}class Fo extends yo{async _call(e){return new Po(await super._call(e))}}class Po extends go{}class Co extends q{}class vo extends Co{}class So extends Co{async _call(e){return new hl(await super._call(e))}}class Ao extends q{}class Eo extends Ao{}class Lo extends Ao{async _call(e){return new hl(await super._call(e))}}class zo extends q{}class Io extends zo{}class Bo extends zo{async _call(e){return new hl(await super._call(e))}}class No extends q{}class Do extends No{}class Oo extends No{async _call(e){return new hl(await super._call(e))}}class Vo extends q{}class jo extends Vo{}class Ro extends Vo{}class Go extends q{}class qo extends Go{}class Wo extends Go{}class $o extends q{}class Uo extends $o{}class Xo extends q{}class Qo extends Xo{}class Ho extends Xo{}class Yo extends Xo{}class Jo extends q{}class Ko extends Jo{}class Zo extends q{}class es extends Zo{}class ts extends Zo{}class rs extends q{}class ns extends rs{}class os extends rs{}class ss extends q{}class as extends ss{}class is extends q{}class ls extends is{}class cs extends is{async _call(e){return new hl(await super._call(e))}}class ds extends q{}class us extends ds{}class ps extends ds{async _call(e){return new hl(await super._call(e))}}class hs extends q{}class ms extends hs{}class _s extends hs{async _call(e){return new hl(await super._call(e))}}class fs extends q{}class gs extends fs{}class Ms extends fs{async _call(e){return new ws(await super._call(e))}}class ws extends W{constructor({logits:e,pred_boxes:t}){super(),this.logits=e,this.pred_boxes=t}}class Ts extends q{}class bs extends Ts{async get_image_embeddings({pixel_values:e}){return await D(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),r=t.reduce(((e,t)=>e*t),1);e.input_labels=new p.Tensor("int64",new BigInt64Array(r).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 L(this.sessions.prompt_encoder_mask_decoder,t)}async _call(e){return new xs(await super._call(e))}}class xs extends W{constructor({iou_scores:e,pred_masks:t}){super(),this.iou_scores=e,this.pred_masks=t}}class ys extends q{}class ks extends ys{}class Fs extends ys{}class Ps extends q{}class Cs extends Ps{}class vs extends Ps{}class Ss extends q{}class As extends Ss{}class Es extends Ss{async _call(e){return new Ml(await super._call(e))}}class Ls extends Ss{async _call(e){return new hl(await super._call(e))}}class zs extends Ss{async _call(e){return new _l(await super._call(e))}}class Is extends q{}class Bs extends Is{}class Ns extends Is{async _call(e){return new _l(await super._call(e))}}class Ds extends q{}class Os extends Ds{}class Vs extends q{}class js extends Vs{}class Rs extends Vs{async _call(e){return new Ml(await super._call(e))}}class Gs extends Vs{async _call(e){return new hl(await super._call(e))}}class qs extends q{}class Ws extends qs{}class $s extends qs{async _call(e){return new Ml(await super._call(e))}}class Us extends qs{async _call(e){return new hl(await super._call(e))}}class Xs extends qs{async _call(e){return new _l(await super._call(e))}}class Qs extends q{}class Hs extends Qs{}class Ys extends Qs{async _call(e){return new Ml(await super._call(e))}}class Js extends Qs{async _call(e){return new hl(await super._call(e))}}class Ks extends q{}class Zs extends Ss{}class ea extends Ss{async _call(e){return new Ml(await super._call(e))}}class ta extends Ss{async _call(e){return new hl(await super._call(e))}}class ra extends q{}class na extends ra{}class oa extends ra{async _call(e){return new Ml(await super._call(e))}}class sa extends ra{async _call(e){return new hl(await super._call(e))}}class aa extends ra{async _call(e){return new ml(await super._call(e))}}class ia extends ra{async _call(e){return new _l(await super._call(e))}}class la extends q{}class ca extends la{}class da extends la{}class ua extends la{async generate_speech(e,t,{threshold:r=.5,minlenratio:n=0,maxlenratio:o=20,vocoder:s=null}={}){const a={input_ids:e},{encoder_outputs:i,encoder_attention_mask:l}=await D(this,a),c=i.dims[1]/this.config.reduction_factor,d=Math.floor(c*o),u=Math.floor(c*n),h=this.config.num_mel_bins;let m=[],_=null,f=null,g=0;for(;;){++g;const e=B(!!f);let n;n=f?f.output_sequence_out:new p.Tensor("float32",new Float32Array(h),[1,1,h]);let o={use_cache_branch:e,output_sequence:n,encoder_attention_mask:l,speaker_embeddings:t,encoder_hidden_states:i};this.addPastKeyValues(o,_),f=await L(this.sessions.decoder_model_merged,o),_=this.getPastKeyValues(f,_);const{prob:s,spectrum:a}=f;if(m.push(a),g>=u&&(Array.from(s.data).filter((e=>e>=r)).length>0||g>=d))break}const M=(0,p.cat)(m),{waveform:w}=await L(s.sessions.model,{spectrogram:M});return{spectrogram:M,waveform:w}}}class pa extends q{main_input_name="spectrogram"}class ha extends q{}class ma extends ha{}class _a extends q{}class fa extends _a{}class ga extends _a{}class Ma extends q{}class wa extends Ma{}class Ta extends Ma{}class ba extends q{}class xa extends ba{}class ya extends ba{}class ka extends q{}class Fa extends ka{}class Pa extends ka{static async from_pretrained(e,t={}){return t.model_file_name??="text_model",super.from_pretrained(e,t)}}class Ca extends ka{static async from_pretrained(e,t={}){return t.model_file_name??="audio_model",super.from_pretrained(e,t)}}class va extends q{}class Sa extends va{async _call(e){return new bl(await super._call(e))}}class Aa extends q{}class Ea extends Aa{}class La extends Aa{}class za extends Aa{}class Ia extends q{}class Ba extends Ia{}class Na extends Ia{}class Da extends q{}class Oa extends Da{}class Va extends Da{async _call(e){return new hl(await super._call(e))}}class ja extends q{}class Ra extends ja{}class Ga extends ja{}class qa extends q{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,r]=e.dims,n=this.config.decoder.num_codebooks,o=r-n;let s=0;for(let t=0;t<e.size;++t){if(e.data[t]===this.config.decoder.pad_token_id)continue;const a=t%r-Math.floor(t/r)%n;a>0&&a<=o&&(e.data[s++]=e.data[t])}const a=Math.floor(t/n),i=s/(a*n);return new p.Tensor(e.type,e.data.slice(0,s),[a,n,i])}prepare_inputs_for_generation(e,t,r){let n=structuredClone(e);for(let e=0;e<n.length;++e)for(let t=0;t<n[e].length;++t)e%this.config.decoder.num_codebooks>=t&&(n[e][t]=BigInt(this.config.decoder.pad_token_id));null!==r.guidance_scale&&r.guidance_scale>1&&(n=n.concat(n));return super.prepare_inputs_for_generation(n,t,r)}async generate(e){const t=await super.generate(e),r=this._apply_and_filter_by_delay_pattern_mask(t).unsqueeze_(0),{audio_values:n}=await L(this.sessions.encodec_decode,{audio_codes:r});return n}}class Wa extends q{}class $a extends Wa{}class Ua extends Wa{async _call(e){return new hl(await super._call(e))}}class Xa extends q{}class Qa extends Xa{}class Ha extends Xa{async _call(e){return new hl(await super._call(e))}}class Ya extends q{}class Ja extends Ya{}class Ka extends Ya{async _call(e){return new hl(await super._call(e))}}class Za extends q{}class ei extends Za{}class ti extends Za{async _call(e){return new hl(await super._call(e))}}class ri extends q{}class ni extends ri{}class oi{static MODEL_CLASS_MAPPINGS=null;static BASE_IF_FAIL=!1;static async from_pretrained(e,{progress_callback:t=null,config:r=null,cache_dir:o=null,local_files_only:s=!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:p={}}={}){const h={progress_callback:t,config:r,cache_dir:o,local_files_only:s,revision:a,model_file_name:i,subfolder:l,device:c,dtype:d,use_external_data_format:u,session_options:p};if(h.config=await n.AutoConfig.from_pretrained(e,h),!this.MODEL_CLASS_MAPPINGS)throw new Error("`MODEL_CLASS_MAPPINGS` not implemented for this type of `AutoClass`: "+this.name);for(const t of this.MODEL_CLASS_MAPPINGS){const r=t.get(h.config.model_type);if(r)return await r[1].from_pretrained(e,h)}if(this.BASE_IF_FAIL)return console.warn(`Unknown model class "${h.config.model_type}", attempting to construct from base class.`),await q.from_pretrained(e,h);throw Error(`Unsupported model type: ${h.config.model_type}`)}}const si=new Map([["bert",["BertModel",X]],["nomic_bert",["NomicBertModel",Z]],["roformer",["RoFormerModel",te]],["electra",["ElectraModel",he]],["esm",["EsmModel",qe]],["convbert",["ConvBertModel",ie]],["camembert",["CamembertModel",we]],["deberta",["DebertaModel",Fe]],["deberta-v2",["DebertaV2Model",Ee]],["mpnet",["MPNetModel",Ze]],["albert",["AlbertModel",dt]],["distilbert",["DistilBertModel",De]],["roberta",["RobertaModel",Vt]],["xlm",["XLMModel",$t]],["xlm-roberta",["XLMRobertaModel",Jt]],["clap",["ClapModel",Fa]],["clip",["CLIPModel",_r]],["clipseg",["CLIPSegModel",Cr]],["chinese_clip",["ChineseCLIPModel",Fr]],["siglip",["SiglipModel",br]],["mobilebert",["MobileBertModel",Qe]],["squeezebert",["SqueezeBertModel",st]],["wav2vec2",["Wav2Vec2Model",As]],["wav2vec2-bert",["Wav2Vec2BertModel",Hs]],["unispeech",["UniSpeechModel",js]],["unispeech-sat",["UniSpeechSatModel",Ws]],["hubert",["HubertModel",Zs]],["wavlm",["WavLMModel",na]],["audio-spectrogram-transformer",["ASTModel",nr]],["vits",["VitsModel",Sa]],["pyannote",["PyAnnoteModel",Bs]],["wespeaker-resnet",["WeSpeakerResNetModel",Os]],["detr",["DetrModel",mo]],["rt_detr",["RTDetrModel",To]],["table-transformer",["TableTransformerModel",ko]],["vit",["ViTModel",In]],["pvt",["PvtModel",Dn]],["vit_msn",["ViTMSNModel",Gn]],["vit_mae",["ViTMAEModel",jn]],["groupvit",["GroupViTModel",$n]],["fastvit",["FastViTModel",Xn]],["mobilevit",["MobileViTModel",Kn]],["mobilevitv2",["MobileViTV2Model",to]],["owlvit",["OwlViTModel",oo]],["owlv2",["Owlv2Model",io]],["beit",["BeitModel",uo]],["deit",["DeiTModel",vo]],["hiera",["HieraModel",Eo]],["convnext",["ConvNextModel",ls]],["convnextv2",["ConvNextV2Model",us]],["dinov2",["Dinov2Model",ms]],["resnet",["ResNetModel",Io]],["swin",["SwinModel",Do]],["swin2sr",["Swin2SRModel",jo]],["donut-swin",["DonutSwinModel",as]],["yolos",["YolosModel",gs]],["dpt",["DPTModel",qo]],["glpn",["GLPNModel",ns]],["hifigan",["SpeechT5HifiGan",pa]],["efficientnet",["EfficientNetModel",Oa]],["decision_transformer",["DecisionTransformerModel",ni]],["mobilenet_v1",["MobileNetV1Model",$a]],["mobilenet_v2",["MobileNetV2Model",Qa]],["mobilenet_v3",["MobileNetV3Model",Ja]],["mobilenet_v4",["MobileNetV4Model",ei]],["maskformer",["MaskFormerModel",es]]]),ai=new Map([["t5",["T5Model",_t]],["longt5",["LongT5Model",Mt]],["mt5",["MT5Model",bt]],["bart",["BartModel",kt]],["mbart",["MBartModel",vt]],["marian",["MarianModel",ks]],["whisper",["WhisperModel",ar]],["m2m_100",["M2M100Model",Cs]],["blenderbot",["BlenderbotModel",zt]],["blenderbot-small",["BlenderbotSmallModel",Nt]]]),ii=new Map([["bloom",["BloomModel",Fn]],["jais",["JAISModel",zr]],["gpt2",["GPT2Model",Ar]],["gptj",["GPTJModel",Gr]],["gpt_bigcode",["GPTBigCodeModel",$r]],["gpt_neo",["GPTNeoModel",Nr]],["gpt_neox",["GPTNeoXModel",Vr]],["codegen",["CodeGenModel",Qr]],["llama",["LlamaModel",Jr]],["granite",["GraniteModel",en]],["cohere",["CohereModel",nn]],["gemma",["GemmaModel",an]],["gemma2",["Gemma2Model",dn]],["openelm",["OpenELMModel",hn]],["qwen2",["Qwen2Model",fn]],["phi",["PhiModel",wn]],["phi3",["Phi3Model",xn]],["mpt",["MptModel",vn]],["opt",["OPTModel",En]],["mistral",["MistralModel",fa]],["starcoder2",["Starcoder2Model",wa]],["falcon",["FalconModel",xa]],["stablelm",["StableLmModel",Ba]]]),li=new Map([["speecht5",["SpeechT5ForSpeechToText",da]],["whisper",["WhisperForConditionalGeneration",ir]]]),ci=new Map([["speecht5",["SpeechT5ForTextToSpeech",ua]]]),di=new Map([["vits",["VitsModel",Sa]],["musicgen",["MusicgenForConditionalGeneration",qa]]]),ui=new Map([["bert",["BertForSequenceClassification",H]],["roformer",["RoFormerForSequenceClassification",ne]],["electra",["ElectraForSequenceClassification",_e]],["esm",["EsmForSequenceClassification",$e]],["convbert",["ConvBertForSequenceClassification",ce]],["camembert",["CamembertForSequenceClassification",be]],["deberta",["DebertaForSequenceClassification",Ce]],["deberta-v2",["DebertaV2ForSequenceClassification",ze]],["mpnet",["MPNetForSequenceClassification",tt]],["albert",["AlbertForSequenceClassification",ut]],["distilbert",["DistilBertForSequenceClassification",Oe]],["roberta",["RobertaForSequenceClassification",Rt]],["xlm",["XLMForSequenceClassification",Xt]],["xlm-roberta",["XLMRobertaForSequenceClassification",Zt]],["bart",["BartForSequenceClassification",Pt]],["mbart",["MBartForSequenceClassification",At]],["mobilebert",["MobileBertForSequenceClassification",Ye]],["squeezebert",["SqueezeBertForSequenceClassification",it]]]),pi=new Map([["bert",["BertForTokenClassification",Y]],["roformer",["RoFormerForTokenClassification",oe]],["electra",["ElectraForTokenClassification",fe]],["esm",["EsmForTokenClassification",Ue]],["convbert",["ConvBertForTokenClassification",de]],["camembert",["CamembertForTokenClassification",xe]],["deberta",["DebertaForTokenClassification",ve]],["deberta-v2",["DebertaV2ForTokenClassification",Ie]],["mpnet",["MPNetForTokenClassification",rt]],["distilbert",["DistilBertForTokenClassification",Ve]],["roberta",["RobertaForTokenClassification",Gt]],["xlm",["XLMForTokenClassification",Qt]],["xlm-roberta",["XLMRobertaForTokenClassification",er]]]),hi=new Map([["t5",["T5ForConditionalGeneration",ft]],["longt5",["LongT5ForConditionalGeneration",wt]],["mt5",["MT5ForConditionalGeneration",xt]],["bart",["BartForConditionalGeneration",Ft]],["mbart",["MBartForConditionalGeneration",St]],["marian",["MarianMTModel",Fs]],["m2m_100",["M2M100ForConditionalGeneration",vs]],["blenderbot",["BlenderbotForConditionalGeneration",It]],["blenderbot-small",["BlenderbotSmallForConditionalGeneration",Dt]]]),mi=new Map([["bloom",["BloomForCausalLM",Pn]],["gpt2",["GPT2LMHeadModel",Er]],["jais",["JAISLMHeadModel",Ir]],["gptj",["GPTJForCausalLM",qr]],["gpt_bigcode",["GPTBigCodeForCausalLM",Ur]],["gpt_neo",["GPTNeoForCausalLM",Dr]],["gpt_neox",["GPTNeoXForCausalLM",jr]],["codegen",["CodeGenForCausalLM",Hr]],["llama",["LlamaForCausalLM",Kr]],["granite",["GraniteForCausalLM",tn]],["cohere",["CohereForCausalLM",on]],["gemma",["GemmaForCausalLM",ln]],["gemma2",["Gemma2ForCausalLM",un]],["openelm",["OpenELMForCausalLM",mn]],["qwen2",["Qwen2ForCausalLM",gn]],["phi",["PhiForCausalLM",Tn]],["phi3",["Phi3ForCausalLM",yn]],["mpt",["MptForCausalLM",Sn]],["opt",["OPTForCausalLM",Ln]],["mbart",["MBartForCausalLM",Et]],["mistral",["MistralForCausalLM",ga]],["starcoder2",["Starcoder2ForCausalLM",Ta]],["falcon",["FalconForCausalLM",ya]],["trocr",["TrOCRForCausalLM",ma]],["stablelm",["StableLmForCausalLM",Na]]]),_i=new Map([["bert",["BertForMaskedLM",Q]],["roformer",["RoFormerForMaskedLM",re]],["electra",["ElectraForMaskedLM",me]],["esm",["EsmForMaskedLM",We]],["convbert",["ConvBertForMaskedLM",le]],["camembert",["CamembertForMaskedLM",Te]],["deberta",["DebertaForMaskedLM",Pe]],["deberta-v2",["DebertaV2ForMaskedLM",Le]],["mpnet",["MPNetForMaskedLM",et]],["albert",["AlbertForMaskedLM",ht]],["distilbert",["DistilBertForMaskedLM",Re]],["roberta",["RobertaForMaskedLM",jt]],["xlm",["XLMWithLMHeadModel",Ut]],["xlm-roberta",["XLMRobertaForMaskedLM",Kt]],["mobilebert",["MobileBertForMaskedLM",He]],["squeezebert",["SqueezeBertForMaskedLM",at]]]),fi=new Map([["bert",["BertForQuestionAnswering",J]],["roformer",["RoFormerForQuestionAnswering",se]],["electra",["ElectraForQuestionAnswering",ge]],["convbert",["ConvBertForQuestionAnswering",ue]],["camembert",["CamembertForQuestionAnswering",ye]],["deberta",["DebertaForQuestionAnswering",Se]],["deberta-v2",["DebertaV2ForQuestionAnswering",Be]],["mpnet",["MPNetForQuestionAnswering",nt]],["albert",["AlbertForQuestionAnswering",pt]],["distilbert",["DistilBertForQuestionAnswering",je]],["roberta",["RobertaForQuestionAnswering",qt]],["xlm",["XLMForQuestionAnswering",Ht]],["xlm-roberta",["XLMRobertaForQuestionAnswering",tr]],["mobilebert",["MobileBertForQuestionAnswering",Je]],["squeezebert",["SqueezeBertForQuestionAnswering",lt]]]),gi=new Map([["vision-encoder-decoder",["VisionEncoderDecoderModel",lr]]]),Mi=new Map([["llava",["LlavaForConditionalGeneration",dr]],["moondream1",["Moondream1ForConditionalGeneration",ur]],["florence2",["Florence2ForConditionalGeneration",hr]]]),wi=new Map([["vision-encoder-decoder",["VisionEncoderDecoderModel",lr]]]),Ti=new Map([["vit",["ViTForImageClassification",Bn]],["pvt",["PvtForImageClassification",On]],["vit_msn",["ViTMSNForImageClassification",qn]],["fastvit",["FastViTForImageClassification",Qn]],["mobilevit",["MobileViTForImageClassification",Zn]],["mobilevitv2",["MobileViTV2ForImageClassification",ro]],["beit",["BeitForImageClassification",po]],["deit",["DeiTForImageClassification",So]],["hiera",["HieraForImageClassification",Lo]],["convnext",["ConvNextForImageClassification",cs]],["convnextv2",["ConvNextV2ForImageClassification",ps]],["dinov2",["Dinov2ForImageClassification",_s]],["resnet",["ResNetForImageClassification",Bo]],["swin",["SwinForImageClassification",Oo]],["segformer",["SegformerForImageClassification",La]],["efficientnet",["EfficientNetForImageClassification",Va]],["mobilenet_v1",["MobileNetV1ForImageClassification",Ua]],["mobilenet_v2",["MobileNetV2ForImageClassification",Ha]],["mobilenet_v3",["MobileNetV3ForImageClassification",Ka]],["mobilenet_v4",["MobileNetV4ForImageClassification",ti]]]),bi=new Map([["detr",["DetrForObjectDetection",_o]],["rt_detr",["RTDetrForObjectDetection",bo]],["table-transformer",["TableTransformerForObjectDetection",Fo]],["yolos",["YolosForObjectDetection",Ms]]]),xi=new Map([["owlvit",["OwlViTForObjectDetection",so]],["owlv2",["Owlv2ForObjectDetection",lo]]]),yi=new Map([["detr",["DetrForSegmentation",fo]],["clipseg",["CLIPSegForImageSegmentation",vr]]]),ki=new Map([["segformer",["SegformerForSemanticSegmentation",za]],["sapiens",["SapiensForSemanticSegmentation",Qo]]]),Fi=new Map([["detr",["DetrForSegmentation",fo]],["maskformer",["MaskFormerForInstanceSegmentation",ts]]]),Pi=new Map([["sam",["SamModel",bs]]]),Ci=new Map([["wav2vec2",["Wav2Vec2ForCTC",Es]],["wav2vec2-bert",["Wav2Vec2BertForCTC",Ys]],["unispeech",["UniSpeechForCTC",Rs]],["unispeech-sat",["UniSpeechSatForCTC",$s]],["wavlm",["WavLMForCTC",oa]],["hubert",["HubertForCTC",ea]]]),vi=new Map([["wav2vec2",["Wav2Vec2ForSequenceClassification",Ls]],["wav2vec2-bert",["Wav2Vec2BertForSequenceClassification",Js]],["unispeech",["UniSpeechForSequenceClassification",Gs]],["unispeech-sat",["UniSpeechSatForSequenceClassification",Us]],["wavlm",["WavLMForSequenceClassification",sa]],["hubert",["HubertForSequenceClassification",ta]],["audio-spectrogram-transformer",["ASTForAudioClassification",or]]]),Si=new Map([["wavlm",["WavLMForXVector",aa]]]),Ai=new Map([["unispeech-sat",["UniSpeechSatForAudioFrameClassification",Xs]],["wavlm",["WavLMForAudioFrameClassification",ia]],["wav2vec2",["Wav2Vec2ForAudioFrameClassification",zs]],["pyannote",["PyAnnoteForAudioFrameClassification",Ns]]]),Ei=new Map([["vitmatte",["VitMatteForImageMatting",Yn]]]),Li=new Map([["swin2sr",["Swin2SRForImageSuperResolution",Ro]]]),zi=new Map([["dpt",["DPTForDepthEstimation",Wo]],["depth_anything",["DepthAnythingForDepthEstimation",Uo]],["glpn",["GLPNForDepthEstimation",os]],["sapiens",["SapiensForDepthEstimation",Ho]],["depth_pro",["DepthProForDepthEstimation",Ko]]]),Ii=new Map([["sapiens",["SapiensForNormalEstimation",Yo]]]),Bi=new Map([["clip",["CLIPVisionModelWithProjection",wr]],["siglip",["SiglipVisionModel",yr]]]),Ni=[[si,w],[ai,T],[ii,y],[ui,w],[pi,w],[hi,b],[li,b],[mi,y],[_i,w],[fi,w],[gi,x],[Mi,F],[Ti,w],[yi,w],[Fi,w],[ki,w],[Ei,w],[Li,w],[zi,w],[Ii,w],[bi,w],[xi,w],[Pi,k],[Ci,w],[vi,w],[ci,b],[di,w],[Si,w],[Ai,w],[Bi,w]];for(const[e,t]of Ni)for(const[r,n]of e.values())C.set(r,t),S.set(n,r),v.set(r,n);const Di=[["MusicgenForConditionalGeneration",qa,P],["CLIPTextModelWithProjection",gr,w],["SiglipTextModel",xr,w],["ClapTextModelWithProjection",Pa,w],["ClapAudioModelWithProjection",Ca,w]];for(const[e,t,r]of Di)C.set(e,r),S.set(t,e),v.set(e,t);class Oi extends oi{static MODEL_CLASS_MAPPINGS=Ni.map((e=>e[0]));static BASE_IF_FAIL=!0}class Vi extends oi{static MODEL_CLASS_MAPPINGS=[ui]}class ji extends oi{static MODEL_CLASS_MAPPINGS=[pi]}class Ri extends oi{static MODEL_CLASS_MAPPINGS=[hi]}class Gi extends oi{static MODEL_CLASS_MAPPINGS=[li]}class qi extends oi{static MODEL_CLASS_MAPPINGS=[ci]}class Wi extends oi{static MODEL_CLASS_MAPPINGS=[di]}class $i extends oi{static MODEL_CLASS_MAPPINGS=[mi]}class Ui extends oi{static MODEL_CLASS_MAPPINGS=[_i]}class Xi extends oi{static MODEL_CLASS_MAPPINGS=[fi]}class Qi extends oi{static MODEL_CLASS_MAPPINGS=[gi]}class Hi extends oi{static MODEL_CLASS_MAPPINGS=[Ti]}class Yi extends oi{static MODEL_CLASS_MAPPINGS=[yi]}class Ji extends oi{static MODEL_CLASS_MAPPINGS=[ki]}class Ki extends oi{static MODEL_CLASS_MAPPINGS=[Fi]}class Zi extends oi{static MODEL_CLASS_MAPPINGS=[bi]}class el extends oi{static MODEL_CLASS_MAPPINGS=[xi]}class tl extends oi{static MODEL_CLASS_MAPPINGS=[Pi]}class rl extends oi{static MODEL_CLASS_MAPPINGS=[Ci]}class nl extends oi{static MODEL_CLASS_MAPPINGS=[vi]}class ol extends oi{static MODEL_CLASS_MAPPINGS=[Si]}class sl extends oi{static MODEL_CLASS_MAPPINGS=[Ai]}class al extends oi{static MODEL_CLASS_MAPPINGS=[wi]}class il extends oi{static MODEL_CLASS_MAPPINGS=[Ei]}class ll extends oi{static MODEL_CLASS_MAPPINGS=[Li]}class cl extends oi{static MODEL_CLASS_MAPPINGS=[zi]}class dl extends oi{static MODEL_CLASS_MAPPINGS=[Ii]}class ul extends oi{static MODEL_CLASS_MAPPINGS=[Bi]}class pl extends W{constructor({logits:e,past_key_values:t,encoder_outputs:r,decoder_attentions:n=null,cross_attentions:o=null}){super(),this.logits=e,this.past_key_values=t,this.encoder_outputs=r,this.decoder_attentions=n,this.cross_attentions=o}}class hl extends W{constructor({logits:e}){super(),this.logits=e}}class ml extends W{constructor({logits:e,embeddings:t}){super(),this.logits=e,this.embeddings=t}}class _l extends W{constructor({logits:e}){super(),this.logits=e}}class fl extends W{constructor({logits:e}){super(),this.logits=e}}class gl extends W{constructor({start_logits:e,end_logits:t}){super(),this.start_logits=e,this.end_logits=t}}class Ml extends W{constructor({logits:e}){super(),this.logits=e}}class wl extends W{constructor({logits:e,past_key_values:t}){super(),this.logits=e,this.past_key_values=t}}class Tl extends W{constructor({alphas:e}){super(),this.alphas=e}}class bl extends W{constructor({waveform:e,spectrogram:t}){super(),this.waveform=e,this.spectrogram=t}}},"./src/models/whisper/common_whisper.js":
112
+ \***********************/(e,t,r)=>{r.r(t),r.d(t,{ASTForAudioClassification:()=>or,ASTModel:()=>nr,ASTPreTrainedModel:()=>rr,AlbertForMaskedLM:()=>ht,AlbertForQuestionAnswering:()=>pt,AlbertForSequenceClassification:()=>ut,AlbertModel:()=>dt,AlbertPreTrainedModel:()=>ct,AutoModel:()=>Oi,AutoModelForAudioClassification:()=>nl,AutoModelForAudioFrameClassification:()=>sl,AutoModelForCTC:()=>rl,AutoModelForCausalLM:()=>Wi,AutoModelForDepthEstimation:()=>cl,AutoModelForDocumentQuestionAnswering:()=>al,AutoModelForImageClassification:()=>Hi,AutoModelForImageFeatureExtraction:()=>ul,AutoModelForImageMatting:()=>il,AutoModelForImageSegmentation:()=>Yi,AutoModelForImageToImage:()=>ll,AutoModelForMaskGeneration:()=>tl,AutoModelForMaskedLM:()=>Ui,AutoModelForNormalEstimation:()=>dl,AutoModelForObjectDetection:()=>Zi,AutoModelForQuestionAnswering:()=>Xi,AutoModelForSemanticSegmentation:()=>Ji,AutoModelForSeq2SeqLM:()=>Ri,AutoModelForSequenceClassification:()=>Vi,AutoModelForSpeechSeq2Seq:()=>Gi,AutoModelForTextToSpectrogram:()=>qi,AutoModelForTextToWaveform:()=>$i,AutoModelForTokenClassification:()=>ji,AutoModelForUniversalSegmentation:()=>Ki,AutoModelForVision2Seq:()=>Qi,AutoModelForXVector:()=>ol,AutoModelForZeroShotObjectDetection:()=>el,BartForConditionalGeneration:()=>Ft,BartForSequenceClassification:()=>Pt,BartModel:()=>kt,BartPretrainedModel:()=>yt,BaseModelOutput:()=>W,BeitForImageClassification:()=>po,BeitModel:()=>uo,BeitPreTrainedModel:()=>co,BertForMaskedLM:()=>Q,BertForQuestionAnswering:()=>J,BertForSequenceClassification:()=>H,BertForTokenClassification:()=>Y,BertModel:()=>X,BertPreTrainedModel:()=>U,BlenderbotForConditionalGeneration:()=>It,BlenderbotModel:()=>zt,BlenderbotPreTrainedModel:()=>Lt,BlenderbotSmallForConditionalGeneration:()=>Dt,BlenderbotSmallModel:()=>Nt,BlenderbotSmallPreTrainedModel:()=>Bt,BloomForCausalLM:()=>Pn,BloomModel:()=>Fn,BloomPreTrainedModel:()=>kn,CLIPModel:()=>_r,CLIPPreTrainedModel:()=>mr,CLIPSegForImageSegmentation:()=>vr,CLIPSegModel:()=>Cr,CLIPSegPreTrainedModel:()=>Pr,CLIPTextModel:()=>fr,CLIPTextModelWithProjection:()=>gr,CLIPVisionModel:()=>Mr,CLIPVisionModelWithProjection:()=>wr,CamembertForMaskedLM:()=>Te,CamembertForQuestionAnswering:()=>ye,CamembertForSequenceClassification:()=>be,CamembertForTokenClassification:()=>xe,CamembertModel:()=>we,CamembertPreTrainedModel:()=>Me,CausalLMOutput:()=>Ml,CausalLMOutputWithPast:()=>wl,ChineseCLIPModel:()=>Fr,ChineseCLIPPreTrainedModel:()=>kr,ClapAudioModelWithProjection:()=>Ca,ClapModel:()=>Fa,ClapPreTrainedModel:()=>ka,ClapTextModelWithProjection:()=>Pa,CodeGenForCausalLM:()=>Hr,CodeGenModel:()=>Qr,CodeGenPreTrainedModel:()=>Xr,CohereForCausalLM:()=>on,CohereModel:()=>nn,CoherePreTrainedModel:()=>rn,ConvBertForMaskedLM:()=>le,ConvBertForQuestionAnswering:()=>ue,ConvBertForSequenceClassification:()=>ce,ConvBertForTokenClassification:()=>de,ConvBertModel:()=>ie,ConvBertPreTrainedModel:()=>ae,ConvNextForImageClassification:()=>cs,ConvNextModel:()=>ls,ConvNextPreTrainedModel:()=>is,ConvNextV2ForImageClassification:()=>ps,ConvNextV2Model:()=>us,ConvNextV2PreTrainedModel:()=>ds,DPTForDepthEstimation:()=>$o,DPTModel:()=>qo,DPTPreTrainedModel:()=>Go,DebertaForMaskedLM:()=>Pe,DebertaForQuestionAnswering:()=>Se,DebertaForSequenceClassification:()=>Ce,DebertaForTokenClassification:()=>ve,DebertaModel:()=>Fe,DebertaPreTrainedModel:()=>ke,DebertaV2ForMaskedLM:()=>Le,DebertaV2ForQuestionAnswering:()=>Be,DebertaV2ForSequenceClassification:()=>ze,DebertaV2ForTokenClassification:()=>Ie,DebertaV2Model:()=>Ee,DebertaV2PreTrainedModel:()=>Ae,DecisionTransformerModel:()=>ni,DecisionTransformerPreTrainedModel:()=>ri,DeiTForImageClassification:()=>So,DeiTModel:()=>vo,DeiTPreTrainedModel:()=>Co,DepthAnythingForDepthEstimation:()=>Uo,DepthAnythingPreTrainedModel:()=>Wo,DepthProForDepthEstimation:()=>Ko,DepthProPreTrainedModel:()=>Jo,DetrForObjectDetection:()=>_o,DetrForSegmentation:()=>fo,DetrModel:()=>mo,DetrObjectDetectionOutput:()=>go,DetrPreTrainedModel:()=>ho,DetrSegmentationOutput:()=>Mo,Dinov2ForImageClassification:()=>_s,Dinov2Model:()=>ms,Dinov2PreTrainedModel:()=>hs,DistilBertForMaskedLM:()=>Re,DistilBertForQuestionAnswering:()=>je,DistilBertForSequenceClassification:()=>Oe,DistilBertForTokenClassification:()=>Ve,DistilBertModel:()=>De,DistilBertPreTrainedModel:()=>Ne,DonutSwinModel:()=>as,DonutSwinPreTrainedModel:()=>ss,EfficientNetForImageClassification:()=>Va,EfficientNetModel:()=>Oa,EfficientNetPreTrainedModel:()=>Da,ElectraForMaskedLM:()=>me,ElectraForQuestionAnswering:()=>ge,ElectraForSequenceClassification:()=>_e,ElectraForTokenClassification:()=>fe,ElectraModel:()=>he,ElectraPreTrainedModel:()=>pe,EsmForMaskedLM:()=>$e,EsmForSequenceClassification:()=>We,EsmForTokenClassification:()=>Ue,EsmModel:()=>qe,EsmPreTrainedModel:()=>Ge,FalconForCausalLM:()=>ya,FalconModel:()=>xa,FalconPreTrainedModel:()=>ba,FastViTForImageClassification:()=>Qn,FastViTModel:()=>Xn,FastViTPreTrainedModel:()=>Un,Florence2ForConditionalGeneration:()=>hr,Florence2PreTrainedModel:()=>pr,GLPNForDepthEstimation:()=>os,GLPNModel:()=>ns,GLPNPreTrainedModel:()=>rs,GPT2LMHeadModel:()=>Er,GPT2Model:()=>Ar,GPT2PreTrainedModel:()=>Sr,GPTBigCodeForCausalLM:()=>Ur,GPTBigCodeModel:()=>Wr,GPTBigCodePreTrainedModel:()=>$r,GPTJForCausalLM:()=>qr,GPTJModel:()=>Gr,GPTJPreTrainedModel:()=>Rr,GPTNeoForCausalLM:()=>Dr,GPTNeoModel:()=>Nr,GPTNeoPreTrainedModel:()=>Br,GPTNeoXForCausalLM:()=>jr,GPTNeoXModel:()=>Vr,GPTNeoXPreTrainedModel:()=>Or,Gemma2ForCausalLM:()=>un,Gemma2Model:()=>dn,Gemma2PreTrainedModel:()=>cn,GemmaForCausalLM:()=>ln,GemmaModel:()=>an,GemmaPreTrainedModel:()=>sn,GraniteForCausalLM:()=>tn,GraniteModel:()=>en,GranitePreTrainedModel:()=>Zr,GroupViTModel:()=>Wn,GroupViTPreTrainedModel:()=>$n,HieraForImageClassification:()=>Lo,HieraModel:()=>Eo,HieraPreTrainedModel:()=>Ao,HubertForCTC:()=>ea,HubertForSequenceClassification:()=>ta,HubertModel:()=>Zs,HubertPreTrainedModel:()=>Ks,ImageMattingOutput:()=>Tl,JAISLMHeadModel:()=>Ir,JAISModel:()=>zr,JAISPreTrainedModel:()=>Lr,LlamaForCausalLM:()=>Kr,LlamaModel:()=>Jr,LlamaPreTrainedModel:()=>Yr,LlavaForConditionalGeneration:()=>dr,LlavaPreTrainedModel:()=>cr,LongT5ForConditionalGeneration:()=>wt,LongT5Model:()=>Mt,LongT5PreTrainedModel:()=>gt,M2M100ForConditionalGeneration:()=>vs,M2M100Model:()=>Cs,M2M100PreTrainedModel:()=>Ps,MBartForCausalLM:()=>Et,MBartForConditionalGeneration:()=>St,MBartForSequenceClassification:()=>At,MBartModel:()=>vt,MBartPreTrainedModel:()=>Ct,MPNetForMaskedLM:()=>et,MPNetForQuestionAnswering:()=>nt,MPNetForSequenceClassification:()=>tt,MPNetForTokenClassification:()=>rt,MPNetModel:()=>Ze,MPNetPreTrainedModel:()=>Ke,MT5ForConditionalGeneration:()=>xt,MT5Model:()=>bt,MT5PreTrainedModel:()=>Tt,MarianMTModel:()=>Fs,MarianModel:()=>ks,MarianPreTrainedModel:()=>ys,MaskFormerForInstanceSegmentation:()=>ts,MaskFormerModel:()=>es,MaskFormerPreTrainedModel:()=>Zo,MaskedLMOutput:()=>fl,MistralForCausalLM:()=>ga,MistralModel:()=>fa,MistralPreTrainedModel:()=>_a,MobileBertForMaskedLM:()=>He,MobileBertForQuestionAnswering:()=>Je,MobileBertForSequenceClassification:()=>Ye,MobileBertModel:()=>Qe,MobileBertPreTrainedModel:()=>Xe,MobileNetV1ForImageClassification:()=>Ua,MobileNetV1Model:()=>Wa,MobileNetV1PreTrainedModel:()=>$a,MobileNetV2ForImageClassification:()=>Ha,MobileNetV2Model:()=>Qa,MobileNetV2PreTrainedModel:()=>Xa,MobileNetV3ForImageClassification:()=>Ka,MobileNetV3Model:()=>Ja,MobileNetV3PreTrainedModel:()=>Ya,MobileNetV4ForImageClassification:()=>ti,MobileNetV4Model:()=>ei,MobileNetV4PreTrainedModel:()=>Za,MobileViTForImageClassification:()=>Zn,MobileViTModel:()=>Kn,MobileViTPreTrainedModel:()=>Jn,MobileViTV2ForImageClassification:()=>ro,MobileViTV2Model:()=>to,MobileViTV2PreTrainedModel:()=>eo,ModelOutput:()=>$,Moondream1ForConditionalGeneration:()=>ur,MptForCausalLM:()=>Sn,MptModel:()=>vn,MptPreTrainedModel:()=>Cn,MusicgenForCausalLM:()=>Ga,MusicgenForConditionalGeneration:()=>qa,MusicgenModel:()=>Ra,MusicgenPreTrainedModel:()=>ja,NomicBertModel:()=>Z,NomicBertPreTrainedModel:()=>K,OPTForCausalLM:()=>Ln,OPTModel:()=>En,OPTPreTrainedModel:()=>An,OpenELMForCausalLM:()=>mn,OpenELMModel:()=>hn,OpenELMPreTrainedModel:()=>pn,OwlViTForObjectDetection:()=>so,OwlViTModel:()=>oo,OwlViTPreTrainedModel:()=>no,Owlv2ForObjectDetection:()=>lo,Owlv2Model:()=>io,Owlv2PreTrainedModel:()=>ao,Phi3ForCausalLM:()=>yn,Phi3Model:()=>xn,Phi3PreTrainedModel:()=>bn,PhiForCausalLM:()=>Tn,PhiModel:()=>wn,PhiPreTrainedModel:()=>Mn,PreTrainedModel:()=>q,PretrainedMixin:()=>oi,PvtForImageClassification:()=>On,PvtModel:()=>Dn,PvtPreTrainedModel:()=>Nn,PyAnnoteForAudioFrameClassification:()=>Ns,PyAnnoteModel:()=>Bs,PyAnnotePreTrainedModel:()=>Is,QuestionAnsweringModelOutput:()=>gl,Qwen2ForCausalLM:()=>gn,Qwen2Model:()=>fn,Qwen2PreTrainedModel:()=>_n,RTDetrForObjectDetection:()=>bo,RTDetrModel:()=>To,RTDetrObjectDetectionOutput:()=>xo,RTDetrPreTrainedModel:()=>wo,ResNetForImageClassification:()=>Bo,ResNetModel:()=>Io,ResNetPreTrainedModel:()=>zo,RoFormerForMaskedLM:()=>re,RoFormerForQuestionAnswering:()=>se,RoFormerForSequenceClassification:()=>ne,RoFormerForTokenClassification:()=>oe,RoFormerModel:()=>te,RoFormerPreTrainedModel:()=>ee,RobertaForMaskedLM:()=>jt,RobertaForQuestionAnswering:()=>qt,RobertaForSequenceClassification:()=>Rt,RobertaForTokenClassification:()=>Gt,RobertaModel:()=>Vt,RobertaPreTrainedModel:()=>Ot,SamImageSegmentationOutput:()=>xs,SamModel:()=>bs,SamPreTrainedModel:()=>Ts,SapiensForDepthEstimation:()=>Ho,SapiensForNormalEstimation:()=>Yo,SapiensForSemanticSegmentation:()=>Qo,SapiensPreTrainedModel:()=>Xo,SegformerForImageClassification:()=>La,SegformerForSemanticSegmentation:()=>za,SegformerModel:()=>Ea,SegformerPreTrainedModel:()=>Aa,Seq2SeqLMOutput:()=>pl,SequenceClassifierOutput:()=>hl,SiglipModel:()=>br,SiglipPreTrainedModel:()=>Tr,SiglipTextModel:()=>xr,SiglipVisionModel:()=>yr,SpeechT5ForSpeechToText:()=>da,SpeechT5ForTextToSpeech:()=>ua,SpeechT5HifiGan:()=>pa,SpeechT5Model:()=>ca,SpeechT5PreTrainedModel:()=>la,SqueezeBertForMaskedLM:()=>at,SqueezeBertForQuestionAnswering:()=>lt,SqueezeBertForSequenceClassification:()=>it,SqueezeBertModel:()=>st,SqueezeBertPreTrainedModel:()=>ot,StableLmForCausalLM:()=>Na,StableLmModel:()=>Ba,StableLmPreTrainedModel:()=>Ia,Starcoder2ForCausalLM:()=>Ta,Starcoder2Model:()=>wa,Starcoder2PreTrainedModel:()=>Ma,Swin2SRForImageSuperResolution:()=>Ro,Swin2SRModel:()=>jo,Swin2SRPreTrainedModel:()=>Vo,SwinForImageClassification:()=>Oo,SwinModel:()=>Do,SwinPreTrainedModel:()=>No,T5ForConditionalGeneration:()=>ft,T5Model:()=>_t,T5PreTrainedModel:()=>mt,TableTransformerForObjectDetection:()=>Fo,TableTransformerModel:()=>ko,TableTransformerObjectDetectionOutput:()=>Po,TableTransformerPreTrainedModel:()=>yo,TokenClassifierOutput:()=>_l,TrOCRForCausalLM:()=>ma,TrOCRPreTrainedModel:()=>ha,UniSpeechForCTC:()=>Rs,UniSpeechForSequenceClassification:()=>Gs,UniSpeechModel:()=>js,UniSpeechPreTrainedModel:()=>Vs,UniSpeechSatForAudioFrameClassification:()=>Xs,UniSpeechSatForCTC:()=>Ws,UniSpeechSatForSequenceClassification:()=>Us,UniSpeechSatModel:()=>$s,UniSpeechSatPreTrainedModel:()=>qs,ViTForImageClassification:()=>Bn,ViTMAEModel:()=>jn,ViTMAEPreTrainedModel:()=>Vn,ViTMSNForImageClassification:()=>qn,ViTMSNModel:()=>Gn,ViTMSNPreTrainedModel:()=>Rn,ViTModel:()=>In,ViTPreTrainedModel:()=>zn,VisionEncoderDecoderModel:()=>lr,VitMatteForImageMatting:()=>Yn,VitMattePreTrainedModel:()=>Hn,VitsModel:()=>Sa,VitsModelOutput:()=>bl,VitsPreTrainedModel:()=>va,Wav2Vec2BertForCTC:()=>Ys,Wav2Vec2BertForSequenceClassification:()=>Js,Wav2Vec2BertModel:()=>Hs,Wav2Vec2BertPreTrainedModel:()=>Qs,Wav2Vec2ForAudioFrameClassification:()=>zs,Wav2Vec2ForCTC:()=>Es,Wav2Vec2ForSequenceClassification:()=>Ls,Wav2Vec2Model:()=>As,Wav2Vec2PreTrainedModel:()=>Ss,WavLMForAudioFrameClassification:()=>ia,WavLMForCTC:()=>oa,WavLMForSequenceClassification:()=>sa,WavLMForXVector:()=>aa,WavLMModel:()=>na,WavLMPreTrainedModel:()=>ra,WeSpeakerResNetModel:()=>Os,WeSpeakerResNetPreTrainedModel:()=>Ds,WhisperForConditionalGeneration:()=>ir,WhisperModel:()=>ar,WhisperPreTrainedModel:()=>sr,XLMForQuestionAnswering:()=>Ht,XLMForSequenceClassification:()=>Xt,XLMForTokenClassification:()=>Qt,XLMModel:()=>Wt,XLMPreTrainedModel:()=>$t,XLMRobertaForMaskedLM:()=>Kt,XLMRobertaForQuestionAnswering:()=>tr,XLMRobertaForSequenceClassification:()=>Zt,XLMRobertaForTokenClassification:()=>er,XLMRobertaModel:()=>Jt,XLMRobertaPreTrainedModel:()=>Yt,XLMWithLMHeadModel:()=>Ut,XVectorOutput:()=>ml,YolosForObjectDetection:()=>Ms,YolosModel:()=>gs,YolosObjectDetectionOutput:()=>ws,YolosPreTrainedModel:()=>fs});var n=r(/*! ./configs.js */"./src/configs.js"),o=r(/*! ./backends/onnx.js */"./src/backends/onnx.js"),s=r(/*! ./utils/dtypes.js */"./src/utils/dtypes.js"),a=r(/*! ./utils/generic.js */"./src/utils/generic.js"),i=r(/*! ./utils/core.js */"./src/utils/core.js"),l=r(/*! ./utils/hub.js */"./src/utils/hub.js"),c=r(/*! ./utils/constants.js */"./src/utils/constants.js"),d=r(/*! ./generation/logits_process.js */"./src/generation/logits_process.js"),u=r(/*! ./generation/configuration_utils.js */"./src/generation/configuration_utils.js"),p=r(/*! ./utils/tensor.js */"./src/utils/tensor.js"),h=r(/*! ./utils/maths.js */"./src/utils/maths.js"),m=r(/*! ./generation/stopping_criteria.js */"./src/generation/stopping_criteria.js"),_=r(/*! ./generation/logits_sampler.js */"./src/generation/logits_sampler.js"),f=r(/*! ./env.js */"./src/env.js"),g=r(/*! ./models/whisper/generation_whisper.js */"./src/models/whisper/generation_whisper.js"),M=r(/*! ./models/whisper/common_whisper.js */"./src/models/whisper/common_whisper.js");const w=0,T=1,b=2,x=3,y=4,k=5,F=6,P=7,C=new Map,v=new Map,S=new Map;async function A(e,t,r){return Object.fromEntries(await Promise.all(Object.keys(t).map((async a=>{const{buffer:i,session_options:c,session_config:d}=await async function(e,t,r){const a=r.config?.["transformers.js_config"]??{};let i=r.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,o.deviceToExecutionProviders)(c);let u=r.dtype??a.dtype;"string"!=typeof u&&(u&&u.hasOwnProperty(t)?u=u[t]:(u=s.DEFAULT_DEVICE_DTYPE_MAPPING[c]??s.DATA_TYPES.fp32,console.warn(`dtype not specified for "${t}". Using the default dtype (${u}) for this device (${c}).`)));const p=u;if(!s.DEFAULT_DTYPE_SUFFIX_MAPPING.hasOwnProperty(p))throw new Error(`Invalid dtype: ${p}. Should be one of: ${Object.keys(s.DATA_TYPES).join(", ")}`);if(p===s.DATA_TYPES.fp16&&"webgpu"===c&&!await(0,s.isWebGpuFp16Supported)())throw new Error(`The device (${c}) does not support fp16.`);const h=a.kv_cache_dtype?"string"==typeof a.kv_cache_dtype?a.kv_cache_dtype:a.kv_cache_dtype[p]??"float32":void 0;if(h&&!["float32","float16"].includes(h))throw new Error(`Invalid kv_cache_dtype: ${h}. Should be one of: float32, float16`);const m={dtype:p,kv_cache_dtype:h},_=s.DEFAULT_DTYPE_SUFFIX_MAPPING[p],g=`${r.subfolder??""}/${t}${_}.onnx`,M={...r.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,r),b=r.use_external_data_format??a.use_external_data_format;let x=[];if(b&&(!0===b||"object"==typeof b&&b.hasOwnProperty(t)&&!0===b[t])){if(f.apis.IS_NODE_ENV)throw new Error("External data format is not yet supported in Node.js");const n=`${t}${_}.onnx_data`,o=`${r.subfolder??""}/${n}`;x.push(new Promise((async(t,s)=>{const a=await(0,l.getModelFile)(e,o,!0,r);t({path:n,data:a})})))}else void 0!==M.externalData&&(x=M.externalData.map((async t=>{if("string"==typeof t.data){const n=await(0,l.getModelFile)(e,t.data,!0,r);return{...t,data:n}}return t})));if(x.length>0&&(M.externalData=await Promise.all(x)),"webgpu"===c){const e=(0,n.getKeyValueShapes)(r.config,{prefix:"present"});if(Object.keys(e).length>0&&!(0,o.isONNXProxy)()){const t={};for(const r in e)t[r]="gpu-buffer";M.preferredOutputLocation=t}}return{buffer:await T,session_options:M,session_config:m}}(e,t[a],r);return[a,await(0,o.createInferenceSession)(i,c,d)]}))))}async function E(e,t,r){return Object.fromEntries(await Promise.all(Object.keys(t).map((async n=>[n,await(0,l.getModelJSON)(e,t[n],!1,r)]))))}async function L(e,t){const r=function(e,t){const r=Object.create(null),n=[];for(const s of e.inputNames){const e=t[s];e instanceof p.Tensor?r[s]=(0,o.isONNXProxy)()?e.clone():e:n.push(s)}if(n.length>0)throw new Error(`An error occurred during model execution: "Missing the following inputs: ${n.join(", ")}.`);const s=Object.keys(t).length,a=e.inputNames.length;if(s>a){let r=Object.keys(t).filter((t=>!e.inputNames.includes(t)));console.warn(`WARNING: Too many inputs were provided (${s} > ${a}). The following inputs will be ignored: "${r.join(", ")}".`)}return r}(e,t);try{const t=Object.fromEntries(Object.entries(r).map((([e,t])=>[e,t.ort_tensor])));let n=await e.run(t);return n=z(n),n}catch(e){throw console.error(`An error occurred during model execution: "${e}".`),console.error("Inputs given to model:",r),e}}function z(e){for(let t in e)(0,o.isONNXTensor)(e[t])?e[t]=new p.Tensor(e[t]):"object"==typeof e[t]&&z(e[t]);return e}function I(e){if(e instanceof p.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 p.Tensor("int64",BigInt64Array.from(e.flat().map((e=>BigInt(e)))),[e.length,e[0].length])}return new p.Tensor("int64",BigInt64Array.from(e.map((e=>BigInt(e)))),[1,e.length])}function B(e){return new p.Tensor("bool",[e],[1])}async function N(e,t){let{encoder_outputs:r,input_ids:n,decoder_input_ids:o,...s}=t;if(!r){const n=(0,i.pick)(t,e.sessions.model.inputNames);r=(await D(e,n)).last_hidden_state}s.input_ids=o,s.encoder_hidden_states=r,e.sessions.decoder_model_merged.inputNames.includes("encoder_attention_mask")&&(s.encoder_attention_mask=t.attention_mask);return await O(e,s,!0)}async function D(e,t){const r=e.sessions.model,n=(0,i.pick)(t,r.inputNames);if(r.inputNames.includes("inputs_embeds")&&!n.inputs_embeds){if(!t.input_ids)throw new Error("Both `input_ids` and `inputs_embeds` are missing in the model inputs.");n.inputs_embeds=await e.encode_text({input_ids:t.input_ids})}return r.inputNames.includes("token_type_ids")&&!n.token_type_ids&&(n.token_type_ids=new p.Tensor("int64",new BigInt64Array(n.input_ids.data.length),n.input_ids.dims)),await L(r,n)}async function O(e,t,r=!1){const n=e.sessions[r?"decoder_model_merged":"model"],{past_key_values:o,...s}=t;n.inputNames.includes("use_cache_branch")&&(s.use_cache_branch=B(!!o)),n.inputNames.includes("position_ids")&&s.attention_mask&&!s.position_ids&&(s.position_ids=function(e,t=null){const{input_ids:r,inputs_embeds:n,attention_mask:o}=e,[s,a]=o.dims,i=new BigInt64Array(o.data.length);for(let e=0;e<s;++e){const t=e*a;let r=BigInt(0);for(let e=0;e<a;++e){const n=t+e;0n===o.data[n]?i[n]=BigInt(1):(i[n]=r,r+=o.data[n])}}let l=new p.Tensor("int64",i,o.dims);if(t){const e=-(r??n).dims.at(1);l=l.slice(null,[e,null])}return l}(s,o)),e.addPastKeyValues(s,o);const a=(0,i.pick)(s,n.inputNames);return await L(n,a)}async function V(e,{input_ids:t=null,attention_mask:r=null,pixel_values:n=null,position_ids:o=null,inputs_embeds:s=null,past_key_values:a=null,generation_config:i=null,logits_processor:l=null,...c}){if(!s)if(s=await e.encode_text({input_ids:t}),n&&1!==t.dims[1]){const o=await e.encode_image({pixel_values:n});({inputs_embeds:s,attention_mask:r}=e._merge_input_ids_with_image_features({image_features:o,inputs_embeds:s,input_ids:t,attention_mask:r}))}else if(a&&n&&1===t.dims[1]){const e=t.dims[1],n=Object.values(a)[0].dims.at(-2);r=(0,p.cat)([(0,p.ones)([t.dims[0],n]),r.slice(null,[r.dims[1]-e,r.dims[1]])],1)}return await O(e,{inputs_embeds:s,past_key_values:a,attention_mask:r,position_ids:o,generation_config:i,logits_processor:l},!0)}function j(e,t,r,n){if(r.past_key_values){const t=Object.values(r.past_key_values)[0].dims.at(-2),{input_ids:n,attention_mask:o}=r;if(o&&o.dims[1]>n.dims[1]);else if(t<n.dims[1])r.input_ids=n.slice(null,[t,null]);else if(null!=e.config.image_token_index&&n.data.some((t=>t==e.config.image_token_index))){const o=e.config.num_image_tokens;if(!o)throw new Error("`num_image_tokens` is missing in the model configuration.");const s=n.dims[1]-(t-o);r.input_ids=n.slice(null,[-s,null]),r.attention_mask=(0,p.ones)([1,t+s])}}return r}function R(e,t,r,n){return r.past_key_values&&(t=t.map((e=>[e.at(-1)]))),{...r,decoder_input_ids:I(t)}}function G(e,...t){return e.config.is_encoder_decoder?R(e,...t):j(e,...t)}class q extends a.Callable{main_input_name="input_ids";forward_params=["input_ids","attention_mask"];constructor(e,t,r){super(),this.config=e,this.sessions=t,this.configs=r;const n=S.get(this.constructor),o=C.get(n);switch(this.can_generate=!1,this._forward=null,this._prepare_inputs_for_generation=null,o){case y:this.can_generate=!0,this._forward=O,this._prepare_inputs_for_generation=j;break;case b:case x:case P:this.can_generate=!0,this._forward=N,this._prepare_inputs_for_generation=R;break;case T:this._forward=N;break;case F:this.can_generate=!0,this._forward=V,this._prepare_inputs_for_generation=G;break;default:this._forward=D}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:r=null,cache_dir:o=null,local_files_only:s=!1,revision:a="main",model_file_name:i=null,subfolder:l="onnx",device:d=null,dtype:u=null,use_external_data_format:p=null,session_options:h={}}={}){let m={progress_callback:t,config:r,cache_dir:o,local_files_only:s,revision:a,model_file_name:i,subfolder:l,device:d,dtype:u,use_external_data_format:p,session_options:h};const _=S.get(this),f=C.get(_);let g;if(r=m.config=await n.AutoConfig.from_pretrained(e,m),f===y)g=await Promise.all([A(e,{model:m.model_file_name??"model"},m),E(e,{generation_config:"generation_config.json"},m)]);else if(f===b||f===x)g=await Promise.all([A(e,{model:"encoder_model",decoder_model_merged:"decoder_model_merged"},m),E(e,{generation_config:"generation_config.json"},m)]);else if(f===k)g=await Promise.all([A(e,{model:"vision_encoder",prompt_encoder_mask_decoder:"prompt_encoder_mask_decoder"},m)]);else if(f===T)g=await Promise.all([A(e,{model:"encoder_model",decoder_model_merged:"decoder_model_merged"},m)]);else if(f===F){const t={embed_tokens:"embed_tokens",vision_encoder:"vision_encoder",decoder_model_merged:"decoder_model_merged"};r.is_encoder_decoder&&(t.model="encoder_model"),g=await Promise.all([A(e,t,m),E(e,{generation_config:"generation_config.json"},m)])}else f===P?g=await Promise.all([A(e,{model:"text_encoder",decoder_model_merged:"decoder_model_merged",encodec_decode:"encodec_decode"},m),E(e,{generation_config:"generation_config.json"},m)]):(f!==w&&console.warn(`Model type for '${_??r?.model_type}' not found, assuming encoder-only architecture. Please report this at ${c.GITHUB_ISSUE_URL}.`),g=await Promise.all([A(e,{model:m.model_file_name??"model"},m)]));return new this(r,...g)}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,r=null){const n=new d.LogitsProcessorList;if(null!==e.repetition_penalty&&1!==e.repetition_penalty&&n.push(new d.RepetitionPenaltyLogitsProcessor(e.repetition_penalty)),null!==e.no_repeat_ngram_size&&e.no_repeat_ngram_size>0&&n.push(new d.NoRepeatNGramLogitsProcessor(e.no_repeat_ngram_size)),null!==e.bad_words_ids&&n.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&&n.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&&n.push(new d.MinNewTokensLengthLogitsProcessor(t,e.min_new_tokens,e.eos_token_id)),null!==e.forced_bos_token_id&&n.push(new d.ForcedBOSTokenLogitsProcessor(e.forced_bos_token_id)),null!==e.forced_eos_token_id&&n.push(new d.ForcedEOSTokenLogitsProcessor(e.max_length,e.forced_eos_token_id)),null!==e.begin_suppress_tokens){const r=t>1||null===e.forced_bos_token_id?t:t+1;n.push(new d.SuppressTokensAtBeginLogitsProcessor(e.begin_suppress_tokens,r))}return null!==e.guidance_scale&&e.guidance_scale>1&&n.push(new d.ClassifierFreeGuidanceLogitsProcessor(e.guidance_scale)),null!==r&&n.extend(r),n}_prepare_generation_config(e,t,r=u.GenerationConfig){const n={...this.config};for(const e of["decoder","generator","text_config"])e in n&&Object.assign(n,n[e]);const o=new r(n);return Object.assign(o,this.generation_config??{}),e&&Object.assign(o,e),t&&Object.assign(o,(0,i.pick)(t,Object.getOwnPropertyNames(o))),o}_get_stopping_criteria(e,t=null){const r=new m.StoppingCriteriaList;return null!==e.max_length&&r.push(new m.MaxLengthCriteria(e.max_length,this.config.max_position_embeddings??null)),null!==e.eos_token_id&&r.push(new m.EosTokenCriteria(e.eos_token_id)),t&&r.extend(t),r}_validate_model_class(){if(!this.can_generate){const e=[mi,gi,hi,li],t=S.get(this.constructor),r=new Set,n=this.config.model_type;for(const t of e){const e=t.get(n);e&&r.add(e[0])}let o=`The current model class (${t}) is not compatible with \`.generate()\`, as it doesn't have a language model head.`;throw r.size>0&&(o+=` Please use the following class instead: ${[...r].join(", ")}`),Error(o)}}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:r,is_encoder_decoder:n}){return r.past_key_values=this.getPastKeyValues(t,r.past_key_values),r.input_ids=new p.Tensor("int64",e.flat(),[e.length,1]),n||(r.attention_mask=(0,p.cat)([r.attention_mask,(0,p.ones)([r.attention_mask.dims[0],1])],1)),r.position_ids=null,r}_prepare_model_inputs({inputs:e,bos_token_id:t,model_kwargs:r}){const n=(0,i.pick)(r,this.forward_params),o=this.main_input_name;if(o in n){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 n[o]=e;return{inputs_tensor:n[o],model_inputs:n,model_input_name:o}}async _prepare_encoder_decoder_kwargs_for_generation({inputs_tensor:e,model_inputs:t,model_input_name:r,generation_config:n}){if(this.sessions.model.inputNames.includes("inputs_embeds")&&!t.inputs_embeds&&"_prepare_inputs_embeds"in this){const{input_ids:e,pixel_values:r,attention_mask:n,...o}=t,s=await this._prepare_inputs_embeds(t);t={...o,...(0,i.pick)(s,["inputs_embeds","attention_mask"])}}let{last_hidden_state:o}=await D(this,t);if(null!==n.guidance_scale&&n.guidance_scale>1)o=(0,p.cat)([o,(0,p.full_like)(o,0)],0),"attention_mask"in t&&(t.attention_mask=(0,p.cat)([t.attention_mask,(0,p.zeros_like)(t.attention_mask)],0));else if(t.decoder_input_ids){const e=I(t.decoder_input_ids).dims[0];if(e!==o.dims[0]){if(1!==o.dims[0])throw new Error(`The encoder outputs have a different batch size (${o.dims[0]}) than the decoder inputs (${e}).`);o=(0,p.cat)(Array.from({length:e},(()=>o)),0)}}return t.encoder_outputs=o,t}_prepare_decoder_input_ids_for_generation({batch_size:e,model_input_name:t,model_kwargs:r,decoder_start_token_id:n,bos_token_id:o,generation_config:s}){let{decoder_input_ids:a,...i}=r;if(!(a instanceof p.Tensor)){if(a)Array.isArray(a[0])||(a=Array.from({length:e},(()=>a)));else if(n??=o,"musicgen"===this.config.model_type)a=Array.from({length:e*this.config.decoder.num_codebooks},(()=>[n]));else if(Array.isArray(n)){if(n.length!==e)throw new Error(`\`decoder_start_token_id\` expcted to have length ${e} but got ${n.length}`);a=n}else a=Array.from({length:e},(()=>[n]));a=I(a)}return r.decoder_attention_mask=(0,p.ones_like)(a),{input_ids:a,model_inputs:i}}async generate({inputs:e=null,generation_config:t=null,logits_processor:r=null,stopping_criteria:n=null,streamer:o=null,...s}){this._validate_model_class(),t=this._prepare_generation_config(t,s);let{inputs_tensor:a,model_inputs:i,model_input_name:l}=this._prepare_model_inputs({inputs:e,model_kwargs:s});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 h=this._get_logits_processor(t,u,r),m=this._get_stopping_criteria(t,n),f=i[l].dims.at(0),g=_.LogitsSampler.getSampler(t),M=new Array(f).fill(0),w=d.tolist();let T;o&&o.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=h(w,T.logits.slice(null,-1,null)),r=[];for(let t=0;t<e.dims.at(0);++t){const n=e[t],o=await g(n);for(const[e,n]of o){const o=BigInt(e);M[t]+=n,w[t].push(o),r.push([o]);break}}o&&o.put(r);if(m(w).every((e=>e)))break;i=this._update_model_kwargs_for_generation({generated_input_ids:r,outputs:T,model_inputs:i,is_encoder_decoder:c})}o&&o.end();const x=this.getPastKeyValues(T,i.past_key_values,!0),y=new p.Tensor("int64",w.flat(),[w.length,w[0].length]);if(t.return_dict_in_generate)return{sequences:y,past_key_values:x,...b};for(const e of Object.values(T))"gpu-buffer"===e.location&&e.dispose();return y}getPastKeyValues(e,t,r=!1){const n=Object.create(null);for(const o in e)if(o.startsWith("present")){const s=o.replace("present","past_key_values"),a=o.includes("encoder");if(n[s]=a&&t?t[s]:e[o],t&&(!a||r)){const e=t[s];"gpu-buffer"===e.location&&e.dispose()}}return n}getAttentions(e){const t={};for(const r of["cross_attentions","encoder_attentions","decoder_attentions"])for(const n in e)n.startsWith(r)&&(r in t||(t[r]=[]),t[r].push(e[n]));return t}addPastKeyValues(e,t){if(t)Object.assign(e,t);else{const t=this.sessions.decoder_model_merged??this.sessions.model,r=t?.config?.kv_cache_dtype??"float32",o="float16"===r?new Uint16Array:[],s=(0,n.getKeyValueShapes)(this.config);for(const t in s)e[t]=new p.Tensor(r,o,s[t])}}async encode_image({pixel_values:e}){const t=(await L(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 L(this.sessions.embed_tokens,{input_ids:e})).inputs_embeds}}class ${}class W extends ${constructor({last_hidden_state:e,hidden_states:t=null,attentions:r=null}){super(),this.last_hidden_state=e,this.hidden_states=t,this.attentions=r}}class U extends q{}class X extends U{}class Q extends U{async _call(e){return new fl(await super._call(e))}}class H extends U{async _call(e){return new hl(await super._call(e))}}class Y extends U{async _call(e){return new _l(await super._call(e))}}class J extends U{async _call(e){return new gl(await super._call(e))}}class K extends q{}class Z extends K{}class ee extends q{}class te extends ee{}class re extends ee{async _call(e){return new fl(await super._call(e))}}class ne extends ee{async _call(e){return new hl(await super._call(e))}}class oe extends ee{async _call(e){return new _l(await super._call(e))}}class se extends ee{async _call(e){return new gl(await super._call(e))}}class ae extends q{}class ie extends ae{}class le extends ae{async _call(e){return new fl(await super._call(e))}}class ce extends ae{async _call(e){return new hl(await super._call(e))}}class de extends ae{async _call(e){return new _l(await super._call(e))}}class ue extends ae{async _call(e){return new gl(await super._call(e))}}class pe extends q{}class he extends pe{}class me extends pe{async _call(e){return new fl(await super._call(e))}}class _e extends pe{async _call(e){return new hl(await super._call(e))}}class fe extends pe{async _call(e){return new _l(await super._call(e))}}class ge extends pe{async _call(e){return new gl(await super._call(e))}}class Me extends q{}class we extends Me{}class Te extends Me{async _call(e){return new fl(await super._call(e))}}class be extends Me{async _call(e){return new hl(await super._call(e))}}class xe extends Me{async _call(e){return new _l(await super._call(e))}}class ye extends Me{async _call(e){return new gl(await super._call(e))}}class ke extends q{}class Fe extends ke{}class Pe extends ke{async _call(e){return new fl(await super._call(e))}}class Ce extends ke{async _call(e){return new hl(await super._call(e))}}class ve extends ke{async _call(e){return new _l(await super._call(e))}}class Se extends ke{async _call(e){return new gl(await super._call(e))}}class Ae extends q{}class Ee extends Ae{}class Le extends Ae{async _call(e){return new fl(await super._call(e))}}class ze extends Ae{async _call(e){return new hl(await super._call(e))}}class Ie extends Ae{async _call(e){return new _l(await super._call(e))}}class Be extends Ae{async _call(e){return new gl(await super._call(e))}}class Ne extends q{}class De extends Ne{}class Oe extends Ne{async _call(e){return new hl(await super._call(e))}}class Ve extends Ne{async _call(e){return new _l(await super._call(e))}}class je extends Ne{async _call(e){return new gl(await super._call(e))}}class Re extends Ne{async _call(e){return new fl(await super._call(e))}}class Ge extends q{}class qe extends Ge{}class $e extends Ge{async _call(e){return new fl(await super._call(e))}}class We extends Ge{async _call(e){return new hl(await super._call(e))}}class Ue extends Ge{async _call(e){return new _l(await super._call(e))}}class Xe extends q{}class Qe extends Xe{}class He extends Xe{async _call(e){return new fl(await super._call(e))}}class Ye extends Xe{async _call(e){return new hl(await super._call(e))}}class Je extends Xe{async _call(e){return new gl(await super._call(e))}}class Ke extends q{}class Ze extends Ke{}class et extends Ke{async _call(e){return new fl(await super._call(e))}}class tt extends Ke{async _call(e){return new hl(await super._call(e))}}class rt extends Ke{async _call(e){return new _l(await super._call(e))}}class nt extends Ke{async _call(e){return new gl(await super._call(e))}}class ot extends q{}class st extends ot{}class at extends ot{async _call(e){return new fl(await super._call(e))}}class it extends ot{async _call(e){return new hl(await super._call(e))}}class lt extends ot{async _call(e){return new gl(await super._call(e))}}class ct extends q{}class dt extends ct{}class ut extends ct{async _call(e){return new hl(await super._call(e))}}class pt extends ct{async _call(e){return new gl(await super._call(e))}}class ht extends ct{async _call(e){return new fl(await super._call(e))}}class mt extends q{forward_params=["input_ids","attention_mask","encoder_outputs","decoder_input_ids","decoder_attention_mask","past_key_values"]}class _t extends mt{}class ft extends mt{}class gt extends q{}class Mt extends gt{}class wt extends gt{}class Tt extends q{}class bt extends Tt{}class xt extends Tt{}class yt extends q{}class kt extends yt{}class Ft extends yt{}class Pt extends yt{async _call(e){return new hl(await super._call(e))}}class Ct extends q{}class vt extends Ct{}class St extends Ct{}class At extends Ct{async _call(e){return new hl(await super._call(e))}}class Et extends Ct{}class Lt extends q{}class zt extends Lt{}class It extends Lt{}class Bt extends q{}class Nt extends Bt{}class Dt extends Bt{}class Ot extends q{}class Vt extends Ot{}class jt extends Ot{async _call(e){return new fl(await super._call(e))}}class Rt extends Ot{async _call(e){return new hl(await super._call(e))}}class Gt extends Ot{async _call(e){return new _l(await super._call(e))}}class qt extends Ot{async _call(e){return new gl(await super._call(e))}}class $t extends q{}class Wt extends $t{}class Ut extends $t{async _call(e){return new fl(await super._call(e))}}class Xt extends $t{async _call(e){return new hl(await super._call(e))}}class Qt extends $t{async _call(e){return new _l(await super._call(e))}}class Ht extends $t{async _call(e){return new gl(await super._call(e))}}class Yt extends q{}class Jt extends Yt{}class Kt extends Yt{async _call(e){return new fl(await super._call(e))}}class Zt extends Yt{async _call(e){return new hl(await super._call(e))}}class er extends Yt{async _call(e){return new _l(await super._call(e))}}class tr extends Yt{async _call(e){return new gl(await super._call(e))}}class rr extends q{}class nr extends rr{}class or extends rr{}class sr extends q{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 ar extends sr{}class ir extends sr{_prepare_generation_config(e,t){return super._prepare_generation_config(e,t,g.WhisperGenerationConfig)}_retrieve_init_tokens(e){const t=[e.decoder_start_token_id];let r=e.language;const n=e.task;if(e.is_multilingual){r||(console.warn("No language specified - defaulting to English (en)."),r="en");const o=`<|${(0,M.whisper_language_to_code)(r)}|>`;t.push(e.lang_to_id[o]),t.push(e.task_to_id[n??"transcribe"])}else if(r||n)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:r=null,stopping_criteria:n=null,...o}){t=this._prepare_generation_config(t,o);const s=o.decoder_input_ids??this._retrieve_init_tokens(t);if(t.return_timestamps&&(r??=new d.LogitsProcessorList,r.push(new d.WhisperTimeStampLogitsProcessor(t,s))),t.begin_suppress_tokens&&(r??=new d.LogitsProcessorList,r.push(new d.SuppressTokensAtBeginLogitsProcessor(t.begin_suppress_tokens,s.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:r,decoder_input_ids:s,...o});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,r=null,n=.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==r&&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 o=this.config.median_filter_width;void 0===o&&(console.warn("Model config has no `median_filter_width`, using default value of 7."),o=7);const s=e.cross_attentions,a=Array.from({length:this.config.decoder_layers},((e,t)=>(0,p.cat)(s.map((e=>e[t])),2))),l=(0,p.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 r?a[e].slice(null,t,null,[0,r]):a[e].slice(null,t)}))).transpose(1,0,2,3),[c,d]=(0,p.std_mean)(l,-2,0,!0),u=l.clone();for(let e=0;e<u.dims[0];++e){const t=u[e];for(let r=0;r<t.dims[0];++r){const n=t[r],s=c[e][r][0].data,a=d[e][r][0].data;for(let e=0;e<n.dims[0];++e){let t=n[e].data;for(let e=0;e<t.length;++e)t[e]=(t[e]-a[e])/s[e];t.set((0,h.medianFilter)(t,o))}}}const m=[(0,p.mean)(u,1)],_=e.sequences.dims,f=new p.Tensor("float32",new Float32Array(_[0]*_[1]),_);for(let e=0;e<_[0];++e){const t=m[e].neg().squeeze_(0),[r,o]=(0,h.dynamic_time_warping)(t.tolist()),s=Array.from({length:r.length-1},((e,t)=>r[t+1]-r[t])),a=(0,i.mergeArrays)([1],s).map((e=>!!e)),l=[];for(let e=0;e<a.length;++e)a[e]&&l.push(o[e]*n);f[e].data.set(l,1)}return f}}class lr extends q{main_input_name="pixel_values";forward_params=["pixel_values","decoder_input_ids","encoder_hidden_states","past_key_values"]}class cr extends q{forward_params=["input_ids","pixel_values","attention_mask","position_ids","past_key_values"]}class dr extends cr{_merge_input_ids_with_image_features({inputs_embeds:e,image_features:t,input_ids:r,attention_mask:n}){const o=this.config.image_token_index,s=r.tolist().map((e=>e.findIndex((e=>e==o)))),a=s.every((e=>-1===e)),i=s.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:n};const l=[],c=[];for(let r=0;r<s.length;++r){const o=s[r],a=e[r],i=t[r],d=n[r];l.push((0,p.cat)([a.slice([0,o]),i,a.slice([o+1,a.dims[0]])],0)),c.push((0,p.cat)([d.slice([0,o]),(0,p.ones)([i.dims[0]]),d.slice([o+1,d.dims[0]])],0))}return{inputs_embeds:(0,p.stack)(l,0),attention_mask:(0,p.stack)(c,0)}}}class ur extends dr{}class pr extends q{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 hr extends pr{_merge_input_ids_with_image_features({inputs_embeds:e,image_features:t,input_ids:r,attention_mask:n}){return{inputs_embeds:(0,p.cat)([t,e],1),attention_mask:(0,p.cat)([(0,p.ones)(t.dims.slice(0,2)),n],1)}}async _prepare_inputs_embeds({input_ids:e,pixel_values:t,inputs_embeds:r,attention_mask:n}){if(!e&&!t)throw new Error("Either `input_ids` or `pixel_values` should be provided.");let o,s;return e&&(o=await this.encode_text({input_ids:e})),t&&(s=await this.encode_image({pixel_values:t})),o&&s?({inputs_embeds:r,attention_mask:n}=this._merge_input_ids_with_image_features({inputs_embeds:o,image_features:s,input_ids:e,attention_mask:n})):r=o||s,{inputs_embeds:r,attention_mask:n}}async forward({input_ids:e,pixel_values:t,attention_mask:r,decoder_input_ids:n,decoder_attention_mask:o,encoder_outputs:s,past_key_values:a,inputs_embeds:i,decoder_inputs_embeds:l}){if(i||({inputs_embeds:i,attention_mask:r}=await this._prepare_inputs_embeds({input_ids:e,pixel_values:t,inputs_embeds:i,attention_mask:r})),!s){let{last_hidden_state:e}=await D(this,{inputs_embeds:i,attention_mask:r});s=e}if(!l){if(!n)throw new Error("Either `decoder_input_ids` or `decoder_inputs_embeds` should be provided.");l=await this.encode_text({input_ids:n})}const c={inputs_embeds:l,attention_mask:o,encoder_attention_mask:r,encoder_hidden_states:s,past_key_values:a};return await O(this,c,!0)}}class mr extends q{}class _r extends mr{}class fr extends mr{static async from_pretrained(e,t={}){return t.model_file_name??="text_model",super.from_pretrained(e,t)}}class gr extends mr{static async from_pretrained(e,t={}){return t.model_file_name??="text_model",super.from_pretrained(e,t)}}class Mr extends mr{static async from_pretrained(e,t={}){return t.model_file_name??="vision_model",super.from_pretrained(e,t)}}class wr extends mr{static async from_pretrained(e,t={}){return t.model_file_name??="vision_model",super.from_pretrained(e,t)}}class Tr extends q{}class br extends Tr{}class xr extends Tr{static async from_pretrained(e,t={}){return t.model_file_name??="text_model",super.from_pretrained(e,t)}}class yr extends mr{static async from_pretrained(e,t={}){return t.model_file_name??="vision_model",super.from_pretrained(e,t)}}class kr extends q{}class Fr extends kr{}class Pr extends q{}class Cr extends Pr{}class vr extends Pr{}class Sr extends q{}class Ar extends Sr{}class Er extends Sr{}class Lr extends q{}class zr extends Lr{}class Ir extends Lr{}class Br extends q{}class Nr extends Br{}class Dr extends Br{}class Or extends q{}class Vr extends Or{}class jr extends Or{}class Rr extends q{}class Gr extends Rr{}class qr extends Rr{}class $r extends q{}class Wr extends $r{}class Ur extends $r{}class Xr extends q{}class Qr extends Xr{}class Hr extends Xr{}class Yr extends q{}class Jr extends Yr{}class Kr extends Yr{}class Zr extends q{}class en extends Zr{}class tn extends Zr{}class rn extends q{}class nn extends rn{}class on extends rn{}class sn extends q{}class an extends sn{}class ln extends sn{}class cn extends q{}class dn extends cn{}class un extends cn{}class pn extends q{}class hn extends pn{}class mn extends pn{}class _n extends q{}class fn extends _n{}class gn extends _n{}class Mn extends q{}class wn extends Mn{}class Tn extends Mn{}class bn extends q{}class xn extends bn{}class yn extends bn{}class kn extends q{}class Fn extends kn{}class Pn extends kn{}class Cn extends q{}class vn extends Cn{}class Sn extends Cn{}class An extends q{}class En extends An{}class Ln extends An{}class zn extends q{}class In extends zn{}class Bn extends zn{async _call(e){return new hl(await super._call(e))}}class Nn extends q{}class Dn extends Nn{}class On extends Nn{async _call(e){return new hl(await super._call(e))}}class Vn extends q{}class jn extends Vn{}class Rn extends q{}class Gn extends Rn{}class qn extends Rn{async _call(e){return new hl(await super._call(e))}}class $n extends q{}class Wn extends $n{}class Un extends q{}class Xn extends Un{}class Qn extends Un{async _call(e){return new hl(await super._call(e))}}class Hn extends q{}class Yn extends Hn{async _call(e){return new Tl(await super._call(e))}}class Jn extends q{}class Kn extends Jn{}class Zn extends Jn{async _call(e){return new hl(await super._call(e))}}class eo extends q{}class to extends eo{}class ro extends eo{async _call(e){return new hl(await super._call(e))}}class no extends q{}class oo extends no{}class so extends no{}class ao extends q{}class io extends ao{}class lo extends ao{}class co extends q{}class uo extends co{}class po extends co{async _call(e){return new hl(await super._call(e))}}class ho extends q{}class mo extends ho{}class _o extends ho{async _call(e){return new go(await super._call(e))}}class fo extends ho{async _call(e){return new Mo(await super._call(e))}}class go extends ${constructor({logits:e,pred_boxes:t}){super(),this.logits=e,this.pred_boxes=t}}class Mo extends ${constructor({logits:e,pred_boxes:t,pred_masks:r}){super(),this.logits=e,this.pred_boxes=t,this.pred_masks=r}}class wo extends q{}class To extends wo{}class bo extends wo{async _call(e){return new xo(await super._call(e))}}class xo extends ${constructor({logits:e,pred_boxes:t}){super(),this.logits=e,this.pred_boxes=t}}class yo extends q{}class ko extends yo{}class Fo extends yo{async _call(e){return new Po(await super._call(e))}}class Po extends go{}class Co extends q{}class vo extends Co{}class So extends Co{async _call(e){return new hl(await super._call(e))}}class Ao extends q{}class Eo extends Ao{}class Lo extends Ao{async _call(e){return new hl(await super._call(e))}}class zo extends q{}class Io extends zo{}class Bo extends zo{async _call(e){return new hl(await super._call(e))}}class No extends q{}class Do extends No{}class Oo extends No{async _call(e){return new hl(await super._call(e))}}class Vo extends q{}class jo extends Vo{}class Ro extends Vo{}class Go extends q{}class qo extends Go{}class $o extends Go{}class Wo extends q{}class Uo extends Wo{}class Xo extends q{}class Qo extends Xo{}class Ho extends Xo{}class Yo extends Xo{}class Jo extends q{}class Ko extends Jo{}class Zo extends q{}class es extends Zo{}class ts extends Zo{}class rs extends q{}class ns extends rs{}class os extends rs{}class ss extends q{}class as extends ss{}class is extends q{}class ls extends is{}class cs extends is{async _call(e){return new hl(await super._call(e))}}class ds extends q{}class us extends ds{}class ps extends ds{async _call(e){return new hl(await super._call(e))}}class hs extends q{}class ms extends hs{}class _s extends hs{async _call(e){return new hl(await super._call(e))}}class fs extends q{}class gs extends fs{}class Ms extends fs{async _call(e){return new ws(await super._call(e))}}class ws extends ${constructor({logits:e,pred_boxes:t}){super(),this.logits=e,this.pred_boxes=t}}class Ts extends q{}class bs extends Ts{async get_image_embeddings({pixel_values:e}){return await D(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),r=t.reduce(((e,t)=>e*t),1);e.input_labels=new p.Tensor("int64",new BigInt64Array(r).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 L(this.sessions.prompt_encoder_mask_decoder,t)}async _call(e){return new xs(await super._call(e))}}class xs extends ${constructor({iou_scores:e,pred_masks:t}){super(),this.iou_scores=e,this.pred_masks=t}}class ys extends q{}class ks extends ys{}class Fs extends ys{}class Ps extends q{}class Cs extends Ps{}class vs extends Ps{}class Ss extends q{}class As extends Ss{}class Es extends Ss{async _call(e){return new Ml(await super._call(e))}}class Ls extends Ss{async _call(e){return new hl(await super._call(e))}}class zs extends Ss{async _call(e){return new _l(await super._call(e))}}class Is extends q{}class Bs extends Is{}class Ns extends Is{async _call(e){return new _l(await super._call(e))}}class Ds extends q{}class Os extends Ds{}class Vs extends q{}class js extends Vs{}class Rs extends Vs{async _call(e){return new Ml(await super._call(e))}}class Gs extends Vs{async _call(e){return new hl(await super._call(e))}}class qs extends q{}class $s extends qs{}class Ws extends qs{async _call(e){return new Ml(await super._call(e))}}class Us extends qs{async _call(e){return new hl(await super._call(e))}}class Xs extends qs{async _call(e){return new _l(await super._call(e))}}class Qs extends q{}class Hs extends Qs{}class Ys extends Qs{async _call(e){return new Ml(await super._call(e))}}class Js extends Qs{async _call(e){return new hl(await super._call(e))}}class Ks extends q{}class Zs extends Ss{}class ea extends Ss{async _call(e){return new Ml(await super._call(e))}}class ta extends Ss{async _call(e){return new hl(await super._call(e))}}class ra extends q{}class na extends ra{}class oa extends ra{async _call(e){return new Ml(await super._call(e))}}class sa extends ra{async _call(e){return new hl(await super._call(e))}}class aa extends ra{async _call(e){return new ml(await super._call(e))}}class ia extends ra{async _call(e){return new _l(await super._call(e))}}class la extends q{}class ca extends la{}class da extends la{}class ua extends la{async generate_speech(e,t,{threshold:r=.5,minlenratio:n=0,maxlenratio:o=20,vocoder:s=null}={}){const a={input_ids:e},{encoder_outputs:i,encoder_attention_mask:l}=await D(this,a),c=i.dims[1]/this.config.reduction_factor,d=Math.floor(c*o),u=Math.floor(c*n),h=this.config.num_mel_bins;let m=[],_=null,f=null,g=0;for(;;){++g;const e=B(!!f);let n;n=f?f.output_sequence_out:new p.Tensor("float32",new Float32Array(h),[1,1,h]);let o={use_cache_branch:e,output_sequence:n,encoder_attention_mask:l,speaker_embeddings:t,encoder_hidden_states:i};this.addPastKeyValues(o,_),f=await L(this.sessions.decoder_model_merged,o),_=this.getPastKeyValues(f,_);const{prob:s,spectrum:a}=f;if(m.push(a),g>=u&&(Array.from(s.data).filter((e=>e>=r)).length>0||g>=d))break}const M=(0,p.cat)(m),{waveform:w}=await L(s.sessions.model,{spectrogram:M});return{spectrogram:M,waveform:w}}}class pa extends q{main_input_name="spectrogram"}class ha extends q{}class ma extends ha{}class _a extends q{}class fa extends _a{}class ga extends _a{}class Ma extends q{}class wa extends Ma{}class Ta extends Ma{}class ba extends q{}class xa extends ba{}class ya extends ba{}class ka extends q{}class Fa extends ka{}class Pa extends ka{static async from_pretrained(e,t={}){return t.model_file_name??="text_model",super.from_pretrained(e,t)}}class Ca extends ka{static async from_pretrained(e,t={}){return t.model_file_name??="audio_model",super.from_pretrained(e,t)}}class va extends q{}class Sa extends va{async _call(e){return new bl(await super._call(e))}}class Aa extends q{}class Ea extends Aa{}class La extends Aa{}class za extends Aa{}class Ia extends q{}class Ba extends Ia{}class Na extends Ia{}class Da extends q{}class Oa extends Da{}class Va extends Da{async _call(e){return new hl(await super._call(e))}}class ja extends q{}class Ra extends ja{}class Ga extends ja{}class qa extends q{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,r]=e.dims,n=this.config.decoder.num_codebooks,o=r-n;let s=0;for(let t=0;t<e.size;++t){if(e.data[t]===this.config.decoder.pad_token_id)continue;const a=t%r-Math.floor(t/r)%n;a>0&&a<=o&&(e.data[s++]=e.data[t])}const a=Math.floor(t/n),i=s/(a*n);return new p.Tensor(e.type,e.data.slice(0,s),[a,n,i])}prepare_inputs_for_generation(e,t,r){let n=structuredClone(e);for(let e=0;e<n.length;++e)for(let t=0;t<n[e].length;++t)e%this.config.decoder.num_codebooks>=t&&(n[e][t]=BigInt(this.config.decoder.pad_token_id));null!==r.guidance_scale&&r.guidance_scale>1&&(n=n.concat(n));return super.prepare_inputs_for_generation(n,t,r)}async generate(e){const t=await super.generate(e),r=this._apply_and_filter_by_delay_pattern_mask(t).unsqueeze_(0),{audio_values:n}=await L(this.sessions.encodec_decode,{audio_codes:r});return n}}class $a extends q{}class Wa extends $a{}class Ua extends $a{async _call(e){return new hl(await super._call(e))}}class Xa extends q{}class Qa extends Xa{}class Ha extends Xa{async _call(e){return new hl(await super._call(e))}}class Ya extends q{}class Ja extends Ya{}class Ka extends Ya{async _call(e){return new hl(await super._call(e))}}class Za extends q{}class ei extends Za{}class ti extends Za{async _call(e){return new hl(await super._call(e))}}class ri extends q{}class ni extends ri{}class oi{static MODEL_CLASS_MAPPINGS=null;static BASE_IF_FAIL=!1;static async from_pretrained(e,{progress_callback:t=null,config:r=null,cache_dir:o=null,local_files_only:s=!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:p={}}={}){const h={progress_callback:t,config:r,cache_dir:o,local_files_only:s,revision:a,model_file_name:i,subfolder:l,device:c,dtype:d,use_external_data_format:u,session_options:p};if(h.config=await n.AutoConfig.from_pretrained(e,h),!this.MODEL_CLASS_MAPPINGS)throw new Error("`MODEL_CLASS_MAPPINGS` not implemented for this type of `AutoClass`: "+this.name);for(const t of this.MODEL_CLASS_MAPPINGS){const r=t.get(h.config.model_type);if(r)return await r[1].from_pretrained(e,h)}if(this.BASE_IF_FAIL)return console.warn(`Unknown model class "${h.config.model_type}", attempting to construct from base class.`),await q.from_pretrained(e,h);throw Error(`Unsupported model type: ${h.config.model_type}`)}}const si=new Map([["bert",["BertModel",X]],["nomic_bert",["NomicBertModel",Z]],["roformer",["RoFormerModel",te]],["electra",["ElectraModel",he]],["esm",["EsmModel",qe]],["convbert",["ConvBertModel",ie]],["camembert",["CamembertModel",we]],["deberta",["DebertaModel",Fe]],["deberta-v2",["DebertaV2Model",Ee]],["mpnet",["MPNetModel",Ze]],["albert",["AlbertModel",dt]],["distilbert",["DistilBertModel",De]],["roberta",["RobertaModel",Vt]],["xlm",["XLMModel",Wt]],["xlm-roberta",["XLMRobertaModel",Jt]],["clap",["ClapModel",Fa]],["clip",["CLIPModel",_r]],["clipseg",["CLIPSegModel",Cr]],["chinese_clip",["ChineseCLIPModel",Fr]],["siglip",["SiglipModel",br]],["mobilebert",["MobileBertModel",Qe]],["squeezebert",["SqueezeBertModel",st]],["wav2vec2",["Wav2Vec2Model",As]],["wav2vec2-bert",["Wav2Vec2BertModel",Hs]],["unispeech",["UniSpeechModel",js]],["unispeech-sat",["UniSpeechSatModel",$s]],["hubert",["HubertModel",Zs]],["wavlm",["WavLMModel",na]],["audio-spectrogram-transformer",["ASTModel",nr]],["vits",["VitsModel",Sa]],["pyannote",["PyAnnoteModel",Bs]],["wespeaker-resnet",["WeSpeakerResNetModel",Os]],["detr",["DetrModel",mo]],["rt_detr",["RTDetrModel",To]],["table-transformer",["TableTransformerModel",ko]],["vit",["ViTModel",In]],["pvt",["PvtModel",Dn]],["vit_msn",["ViTMSNModel",Gn]],["vit_mae",["ViTMAEModel",jn]],["groupvit",["GroupViTModel",Wn]],["fastvit",["FastViTModel",Xn]],["mobilevit",["MobileViTModel",Kn]],["mobilevitv2",["MobileViTV2Model",to]],["owlvit",["OwlViTModel",oo]],["owlv2",["Owlv2Model",io]],["beit",["BeitModel",uo]],["deit",["DeiTModel",vo]],["hiera",["HieraModel",Eo]],["convnext",["ConvNextModel",ls]],["convnextv2",["ConvNextV2Model",us]],["dinov2",["Dinov2Model",ms]],["resnet",["ResNetModel",Io]],["swin",["SwinModel",Do]],["swin2sr",["Swin2SRModel",jo]],["donut-swin",["DonutSwinModel",as]],["yolos",["YolosModel",gs]],["dpt",["DPTModel",qo]],["glpn",["GLPNModel",ns]],["hifigan",["SpeechT5HifiGan",pa]],["efficientnet",["EfficientNetModel",Oa]],["decision_transformer",["DecisionTransformerModel",ni]],["mobilenet_v1",["MobileNetV1Model",Wa]],["mobilenet_v2",["MobileNetV2Model",Qa]],["mobilenet_v3",["MobileNetV3Model",Ja]],["mobilenet_v4",["MobileNetV4Model",ei]],["maskformer",["MaskFormerModel",es]]]),ai=new Map([["t5",["T5Model",_t]],["longt5",["LongT5Model",Mt]],["mt5",["MT5Model",bt]],["bart",["BartModel",kt]],["mbart",["MBartModel",vt]],["marian",["MarianModel",ks]],["whisper",["WhisperModel",ar]],["m2m_100",["M2M100Model",Cs]],["blenderbot",["BlenderbotModel",zt]],["blenderbot-small",["BlenderbotSmallModel",Nt]]]),ii=new Map([["bloom",["BloomModel",Fn]],["jais",["JAISModel",zr]],["gpt2",["GPT2Model",Ar]],["gptj",["GPTJModel",Gr]],["gpt_bigcode",["GPTBigCodeModel",Wr]],["gpt_neo",["GPTNeoModel",Nr]],["gpt_neox",["GPTNeoXModel",Vr]],["codegen",["CodeGenModel",Qr]],["llama",["LlamaModel",Jr]],["granite",["GraniteModel",en]],["cohere",["CohereModel",nn]],["gemma",["GemmaModel",an]],["gemma2",["Gemma2Model",dn]],["openelm",["OpenELMModel",hn]],["qwen2",["Qwen2Model",fn]],["phi",["PhiModel",wn]],["phi3",["Phi3Model",xn]],["mpt",["MptModel",vn]],["opt",["OPTModel",En]],["mistral",["MistralModel",fa]],["starcoder2",["Starcoder2Model",wa]],["falcon",["FalconModel",xa]],["stablelm",["StableLmModel",Ba]]]),li=new Map([["speecht5",["SpeechT5ForSpeechToText",da]],["whisper",["WhisperForConditionalGeneration",ir]]]),ci=new Map([["speecht5",["SpeechT5ForTextToSpeech",ua]]]),di=new Map([["vits",["VitsModel",Sa]],["musicgen",["MusicgenForConditionalGeneration",qa]]]),ui=new Map([["bert",["BertForSequenceClassification",H]],["roformer",["RoFormerForSequenceClassification",ne]],["electra",["ElectraForSequenceClassification",_e]],["esm",["EsmForSequenceClassification",We]],["convbert",["ConvBertForSequenceClassification",ce]],["camembert",["CamembertForSequenceClassification",be]],["deberta",["DebertaForSequenceClassification",Ce]],["deberta-v2",["DebertaV2ForSequenceClassification",ze]],["mpnet",["MPNetForSequenceClassification",tt]],["albert",["AlbertForSequenceClassification",ut]],["distilbert",["DistilBertForSequenceClassification",Oe]],["roberta",["RobertaForSequenceClassification",Rt]],["xlm",["XLMForSequenceClassification",Xt]],["xlm-roberta",["XLMRobertaForSequenceClassification",Zt]],["bart",["BartForSequenceClassification",Pt]],["mbart",["MBartForSequenceClassification",At]],["mobilebert",["MobileBertForSequenceClassification",Ye]],["squeezebert",["SqueezeBertForSequenceClassification",it]]]),pi=new Map([["bert",["BertForTokenClassification",Y]],["roformer",["RoFormerForTokenClassification",oe]],["electra",["ElectraForTokenClassification",fe]],["esm",["EsmForTokenClassification",Ue]],["convbert",["ConvBertForTokenClassification",de]],["camembert",["CamembertForTokenClassification",xe]],["deberta",["DebertaForTokenClassification",ve]],["deberta-v2",["DebertaV2ForTokenClassification",Ie]],["mpnet",["MPNetForTokenClassification",rt]],["distilbert",["DistilBertForTokenClassification",Ve]],["roberta",["RobertaForTokenClassification",Gt]],["xlm",["XLMForTokenClassification",Qt]],["xlm-roberta",["XLMRobertaForTokenClassification",er]]]),hi=new Map([["t5",["T5ForConditionalGeneration",ft]],["longt5",["LongT5ForConditionalGeneration",wt]],["mt5",["MT5ForConditionalGeneration",xt]],["bart",["BartForConditionalGeneration",Ft]],["mbart",["MBartForConditionalGeneration",St]],["marian",["MarianMTModel",Fs]],["m2m_100",["M2M100ForConditionalGeneration",vs]],["blenderbot",["BlenderbotForConditionalGeneration",It]],["blenderbot-small",["BlenderbotSmallForConditionalGeneration",Dt]]]),mi=new Map([["bloom",["BloomForCausalLM",Pn]],["gpt2",["GPT2LMHeadModel",Er]],["jais",["JAISLMHeadModel",Ir]],["gptj",["GPTJForCausalLM",qr]],["gpt_bigcode",["GPTBigCodeForCausalLM",Ur]],["gpt_neo",["GPTNeoForCausalLM",Dr]],["gpt_neox",["GPTNeoXForCausalLM",jr]],["codegen",["CodeGenForCausalLM",Hr]],["llama",["LlamaForCausalLM",Kr]],["granite",["GraniteForCausalLM",tn]],["cohere",["CohereForCausalLM",on]],["gemma",["GemmaForCausalLM",ln]],["gemma2",["Gemma2ForCausalLM",un]],["openelm",["OpenELMForCausalLM",mn]],["qwen2",["Qwen2ForCausalLM",gn]],["phi",["PhiForCausalLM",Tn]],["phi3",["Phi3ForCausalLM",yn]],["mpt",["MptForCausalLM",Sn]],["opt",["OPTForCausalLM",Ln]],["mbart",["MBartForCausalLM",Et]],["mistral",["MistralForCausalLM",ga]],["starcoder2",["Starcoder2ForCausalLM",Ta]],["falcon",["FalconForCausalLM",ya]],["trocr",["TrOCRForCausalLM",ma]],["stablelm",["StableLmForCausalLM",Na]]]),_i=new Map([["bert",["BertForMaskedLM",Q]],["roformer",["RoFormerForMaskedLM",re]],["electra",["ElectraForMaskedLM",me]],["esm",["EsmForMaskedLM",$e]],["convbert",["ConvBertForMaskedLM",le]],["camembert",["CamembertForMaskedLM",Te]],["deberta",["DebertaForMaskedLM",Pe]],["deberta-v2",["DebertaV2ForMaskedLM",Le]],["mpnet",["MPNetForMaskedLM",et]],["albert",["AlbertForMaskedLM",ht]],["distilbert",["DistilBertForMaskedLM",Re]],["roberta",["RobertaForMaskedLM",jt]],["xlm",["XLMWithLMHeadModel",Ut]],["xlm-roberta",["XLMRobertaForMaskedLM",Kt]],["mobilebert",["MobileBertForMaskedLM",He]],["squeezebert",["SqueezeBertForMaskedLM",at]]]),fi=new Map([["bert",["BertForQuestionAnswering",J]],["roformer",["RoFormerForQuestionAnswering",se]],["electra",["ElectraForQuestionAnswering",ge]],["convbert",["ConvBertForQuestionAnswering",ue]],["camembert",["CamembertForQuestionAnswering",ye]],["deberta",["DebertaForQuestionAnswering",Se]],["deberta-v2",["DebertaV2ForQuestionAnswering",Be]],["mpnet",["MPNetForQuestionAnswering",nt]],["albert",["AlbertForQuestionAnswering",pt]],["distilbert",["DistilBertForQuestionAnswering",je]],["roberta",["RobertaForQuestionAnswering",qt]],["xlm",["XLMForQuestionAnswering",Ht]],["xlm-roberta",["XLMRobertaForQuestionAnswering",tr]],["mobilebert",["MobileBertForQuestionAnswering",Je]],["squeezebert",["SqueezeBertForQuestionAnswering",lt]]]),gi=new Map([["vision-encoder-decoder",["VisionEncoderDecoderModel",lr]]]),Mi=new Map([["llava",["LlavaForConditionalGeneration",dr]],["moondream1",["Moondream1ForConditionalGeneration",ur]],["florence2",["Florence2ForConditionalGeneration",hr]]]),wi=new Map([["vision-encoder-decoder",["VisionEncoderDecoderModel",lr]]]),Ti=new Map([["vit",["ViTForImageClassification",Bn]],["pvt",["PvtForImageClassification",On]],["vit_msn",["ViTMSNForImageClassification",qn]],["fastvit",["FastViTForImageClassification",Qn]],["mobilevit",["MobileViTForImageClassification",Zn]],["mobilevitv2",["MobileViTV2ForImageClassification",ro]],["beit",["BeitForImageClassification",po]],["deit",["DeiTForImageClassification",So]],["hiera",["HieraForImageClassification",Lo]],["convnext",["ConvNextForImageClassification",cs]],["convnextv2",["ConvNextV2ForImageClassification",ps]],["dinov2",["Dinov2ForImageClassification",_s]],["resnet",["ResNetForImageClassification",Bo]],["swin",["SwinForImageClassification",Oo]],["segformer",["SegformerForImageClassification",La]],["efficientnet",["EfficientNetForImageClassification",Va]],["mobilenet_v1",["MobileNetV1ForImageClassification",Ua]],["mobilenet_v2",["MobileNetV2ForImageClassification",Ha]],["mobilenet_v3",["MobileNetV3ForImageClassification",Ka]],["mobilenet_v4",["MobileNetV4ForImageClassification",ti]]]),bi=new Map([["detr",["DetrForObjectDetection",_o]],["rt_detr",["RTDetrForObjectDetection",bo]],["table-transformer",["TableTransformerForObjectDetection",Fo]],["yolos",["YolosForObjectDetection",Ms]]]),xi=new Map([["owlvit",["OwlViTForObjectDetection",so]],["owlv2",["Owlv2ForObjectDetection",lo]]]),yi=new Map([["detr",["DetrForSegmentation",fo]],["clipseg",["CLIPSegForImageSegmentation",vr]]]),ki=new Map([["segformer",["SegformerForSemanticSegmentation",za]],["sapiens",["SapiensForSemanticSegmentation",Qo]]]),Fi=new Map([["detr",["DetrForSegmentation",fo]],["maskformer",["MaskFormerForInstanceSegmentation",ts]]]),Pi=new Map([["sam",["SamModel",bs]]]),Ci=new Map([["wav2vec2",["Wav2Vec2ForCTC",Es]],["wav2vec2-bert",["Wav2Vec2BertForCTC",Ys]],["unispeech",["UniSpeechForCTC",Rs]],["unispeech-sat",["UniSpeechSatForCTC",Ws]],["wavlm",["WavLMForCTC",oa]],["hubert",["HubertForCTC",ea]]]),vi=new Map([["wav2vec2",["Wav2Vec2ForSequenceClassification",Ls]],["wav2vec2-bert",["Wav2Vec2BertForSequenceClassification",Js]],["unispeech",["UniSpeechForSequenceClassification",Gs]],["unispeech-sat",["UniSpeechSatForSequenceClassification",Us]],["wavlm",["WavLMForSequenceClassification",sa]],["hubert",["HubertForSequenceClassification",ta]],["audio-spectrogram-transformer",["ASTForAudioClassification",or]]]),Si=new Map([["wavlm",["WavLMForXVector",aa]]]),Ai=new Map([["unispeech-sat",["UniSpeechSatForAudioFrameClassification",Xs]],["wavlm",["WavLMForAudioFrameClassification",ia]],["wav2vec2",["Wav2Vec2ForAudioFrameClassification",zs]],["pyannote",["PyAnnoteForAudioFrameClassification",Ns]]]),Ei=new Map([["vitmatte",["VitMatteForImageMatting",Yn]]]),Li=new Map([["swin2sr",["Swin2SRForImageSuperResolution",Ro]]]),zi=new Map([["dpt",["DPTForDepthEstimation",$o]],["depth_anything",["DepthAnythingForDepthEstimation",Uo]],["glpn",["GLPNForDepthEstimation",os]],["sapiens",["SapiensForDepthEstimation",Ho]],["depth_pro",["DepthProForDepthEstimation",Ko]]]),Ii=new Map([["sapiens",["SapiensForNormalEstimation",Yo]]]),Bi=new Map([["clip",["CLIPVisionModelWithProjection",wr]],["siglip",["SiglipVisionModel",yr]]]),Ni=[[si,w],[ai,T],[ii,y],[ui,w],[pi,w],[hi,b],[li,b],[mi,y],[_i,w],[fi,w],[gi,x],[Mi,F],[Ti,w],[yi,w],[Fi,w],[ki,w],[Ei,w],[Li,w],[zi,w],[Ii,w],[bi,w],[xi,w],[Pi,k],[Ci,w],[vi,w],[ci,b],[di,w],[Si,w],[Ai,w],[Bi,w]];for(const[e,t]of Ni)for(const[r,n]of e.values())C.set(r,t),S.set(n,r),v.set(r,n);const Di=[["MusicgenForConditionalGeneration",qa,P],["CLIPTextModelWithProjection",gr,w],["SiglipTextModel",xr,w],["ClapTextModelWithProjection",Pa,w],["ClapAudioModelWithProjection",Ca,w]];for(const[e,t,r]of Di)C.set(e,r),S.set(t,e),v.set(e,t);class Oi extends oi{static MODEL_CLASS_MAPPINGS=Ni.map((e=>e[0]));static BASE_IF_FAIL=!0}class Vi extends oi{static MODEL_CLASS_MAPPINGS=[ui]}class ji extends oi{static MODEL_CLASS_MAPPINGS=[pi]}class Ri extends oi{static MODEL_CLASS_MAPPINGS=[hi]}class Gi extends oi{static MODEL_CLASS_MAPPINGS=[li]}class qi extends oi{static MODEL_CLASS_MAPPINGS=[ci]}class $i extends oi{static MODEL_CLASS_MAPPINGS=[di]}class Wi extends oi{static MODEL_CLASS_MAPPINGS=[mi]}class Ui extends oi{static MODEL_CLASS_MAPPINGS=[_i]}class Xi extends oi{static MODEL_CLASS_MAPPINGS=[fi]}class Qi extends oi{static MODEL_CLASS_MAPPINGS=[gi]}class Hi extends oi{static MODEL_CLASS_MAPPINGS=[Ti]}class Yi extends oi{static MODEL_CLASS_MAPPINGS=[yi]}class Ji extends oi{static MODEL_CLASS_MAPPINGS=[ki]}class Ki extends oi{static MODEL_CLASS_MAPPINGS=[Fi]}class Zi extends oi{static MODEL_CLASS_MAPPINGS=[bi]}class el extends oi{static MODEL_CLASS_MAPPINGS=[xi]}class tl extends oi{static MODEL_CLASS_MAPPINGS=[Pi]}class rl extends oi{static MODEL_CLASS_MAPPINGS=[Ci]}class nl extends oi{static MODEL_CLASS_MAPPINGS=[vi]}class ol extends oi{static MODEL_CLASS_MAPPINGS=[Si]}class sl extends oi{static MODEL_CLASS_MAPPINGS=[Ai]}class al extends oi{static MODEL_CLASS_MAPPINGS=[wi]}class il extends oi{static MODEL_CLASS_MAPPINGS=[Ei]}class ll extends oi{static MODEL_CLASS_MAPPINGS=[Li]}class cl extends oi{static MODEL_CLASS_MAPPINGS=[zi]}class dl extends oi{static MODEL_CLASS_MAPPINGS=[Ii]}class ul extends oi{static MODEL_CLASS_MAPPINGS=[Bi]}class pl extends ${constructor({logits:e,past_key_values:t,encoder_outputs:r,decoder_attentions:n=null,cross_attentions:o=null}){super(),this.logits=e,this.past_key_values=t,this.encoder_outputs=r,this.decoder_attentions=n,this.cross_attentions=o}}class hl extends ${constructor({logits:e}){super(),this.logits=e}}class ml extends ${constructor({logits:e,embeddings:t}){super(),this.logits=e,this.embeddings=t}}class _l extends ${constructor({logits:e}){super(),this.logits=e}}class fl extends ${constructor({logits:e}){super(),this.logits=e}}class gl extends ${constructor({start_logits:e,end_logits:t}){super(),this.start_logits=e,this.end_logits=t}}class Ml extends ${constructor({logits:e}){super(),this.logits=e}}class wl extends ${constructor({logits:e,past_key_values:t}){super(),this.logits=e,this.past_key_values=t}}class Tl extends ${constructor({alphas:e}){super(),this.alphas=e}}class bl extends ${constructor({waveform:e,spectrogram:t}){super(),this.waveform=e,this.spectrogram=t}}},"./src/models/whisper/common_whisper.js":
113
113
  /*!**********************************************!*\
114
114
  !*** ./src/models/whisper/common_whisper.js ***!
115
115
  \**********************************************/(e,t,r)=>{r.r(t),r.d(t,{WHISPER_LANGUAGE_MAPPING:()=>o,WHISPER_TO_LANGUAGE_CODE_MAPPING:()=>s,whisper_language_to_code:()=>a});const n=[["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"]],o=new Map(n),s=new Map([...n.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=s.get(e);if(void 0===t){if(!o.has(e)){const t=2===e.length?o.keys():o.values();throw new Error(`Language "${e}" is not supported. Must be one of: ${JSON.stringify(t)}`)}t=e}return t}},"./src/models/whisper/generation_whisper.js":
@@ -121,13 +121,13 @@ import*as e from"fs";import*as t from"onnxruntime-node";import*as r from"path";i
121
121
  \*****************************/(e,t,r)=>{r.r(t),r.d(t,{TensorOpRegistry:()=>a});var n=r(/*! ../backends/onnx.js */"./src/backends/onnx.js"),o=r(/*! ../utils/tensor.js */"./src/utils/tensor.js");const s=async(e,t,r)=>{const s=await(0,n.createInferenceSession)(new Uint8Array(e),t);return async e=>{const t=Object.fromEntries(Object.entries(e).map((([e,t])=>[e,t.ort_tensor]))),n=await s.run(t);return Array.isArray(r)?r.map((e=>new o.Tensor(n[e]))):new o.Tensor(n[r])}};class a{static session_options={};static get bilinear_interpolate_4d(){return this._bilinear_interpolate_4d||(this._bilinear_interpolate_4d=s([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=s([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=s([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=s([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=s([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=s([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}}},"./src/pipelines.js":
122
122
  /*!**************************!*\
123
123
  !*** ./src/pipelines.js ***!
124
- \**************************/(e,t,r)=>{r.r(t),r.d(t,{AudioClassificationPipeline:()=>v,AutomaticSpeechRecognitionPipeline:()=>A,DepthEstimationPipeline:()=>j,DocumentQuestionAnsweringPipeline:()=>D,FeatureExtractionPipeline:()=>P,FillMaskPipeline:()=>w,ImageClassificationPipeline:()=>L,ImageFeatureExtractionPipeline:()=>C,ImageSegmentationPipeline:()=>z,ImageToImagePipeline:()=>V,ImageToTextPipeline:()=>E,ObjectDetectionPipeline:()=>B,Pipeline:()=>_,QuestionAnsweringPipeline:()=>M,SummarizationPipeline:()=>b,Text2TextGenerationPipeline:()=>T,TextClassificationPipeline:()=>f,TextGenerationPipeline:()=>k,TextToAudioPipeline:()=>O,TokenClassificationPipeline:()=>g,TranslationPipeline:()=>x,ZeroShotAudioClassificationPipeline:()=>S,ZeroShotClassificationPipeline:()=>F,ZeroShotImageClassificationPipeline:()=>I,ZeroShotObjectDetectionPipeline:()=>N,pipeline:()=>q});var n=r(/*! ./tokenizers.js */"./src/tokenizers.js"),o=r(/*! ./models.js */"./src/models.js"),s=r(/*! ./processors.js */"./src/processors.js"),a=r(/*! ./utils/generic.js */"./src/utils/generic.js"),i=r(/*! ./utils/core.js */"./src/utils/core.js"),l=r(/*! ./utils/maths.js */"./src/utils/maths.js"),c=r(/*! ./utils/audio.js */"./src/utils/audio.js"),d=r(/*! ./utils/tensor.js */"./src/utils/tensor.js"),u=r(/*! ./utils/image.js */"./src/utils/image.js");async function p(e){return Array.isArray(e)||(e=[e]),await Promise.all(e.map((e=>u.RawImage.read(e))))}async function h(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[r,n,o,s]=e;return{xmin:r,ymin:n,xmax:o,ymax:s}}class _ extends a.Callable{constructor({task:e,model:t,tokenizer:r=null,processor:n=null}){super(),this.task=e,this.model=t,this.tokenizer=r,this.processor=n}async dispose(){await this.model.dispose()}}class f extends _{constructor(e){super(e)}async _call(e,{top_k:t=1}={}){const r=this.tokenizer(e,{padding:!0,truncation:!0}),n=await this.model(r),o="multi_label_classification"===this.model.config.problem_type?e=>e.sigmoid():e=>new d.Tensor("float32",(0,l.softmax)(e.data),e.dims),s=this.model.config.id2label,a=[];for(const e of n.logits){const r=o(e),n=await(0,d.topk)(r,t),i=n[0].tolist(),l=n[1].tolist().map(((e,t)=>({label:s?s[e]:`LABEL_${e}`,score:i[t]})));1===t?a.push(...l):a.push(l)}return Array.isArray(e)||1===t?a:a[0]}}class g extends _{constructor(e){super(e)}async _call(e,{ignore_labels:t=["O"]}={}){const r=Array.isArray(e),n=this.tokenizer(r?e:[e],{padding:!0,truncation:!0}),o=(await this.model(n)).logits,s=this.model.config.id2label,a=[];for(let e=0;e<o.dims[0];++e){const r=n.input_ids[e],i=o[e],c=[];for(let e=0;e<i.dims[0];++e){const n=i[e],o=(0,l.max)(n.data)[1],a=s?s[o]:`LABEL_${o}`;if(t.includes(a))continue;const d=this.tokenizer.decode([r[e].item()],{skip_special_tokens:!0});if(""===d)continue;const u=(0,l.softmax)(n.data);c.push({entity:a,score:u[o],index:e,word:d})}a.push(c)}return r?a:a[0]}}class M extends _{constructor(e){super(e)}async _call(e,t,{top_k:r=1}={}){const n=this.tokenizer(e,{text_pair:t,padding:!0,truncation:!0}),{start_logits:o,end_logits:s}=await this.model(n),a=n.input_ids.tolist(),c=n.attention_mask.tolist(),d=this.tokenizer.all_special_ids,u=[];for(let e=0;e<o.dims[0];++e){const t=a[e],n=t.findIndex((e=>e==this.tokenizer.sep_token_id)),p=(c[e].map(((e,r)=>1==e&&(0===r||r>n&&-1===d.findIndex((e=>e==t[r]))))),o[e].tolist()),h=s[e].tolist();for(let r=1;r<p.length;++r)(0==c[e]||r<=n||-1!==d.findIndex((e=>e==t[r])))&&(p[r]=-1/0,h[r]=-1/0);const m=(0,l.softmax)(p).map(((e,t)=>[e,t])),_=(0,l.softmax)(h).map(((e,t)=>[e,t]));m[0][0]=0,_[0][0]=0;const f=(0,i.product)(m,_).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(f.length,r);++e){const[r,n,o]=f[e],s=t.slice(r,n+1),a=this.tokenizer.decode(s,{skip_special_tokens:!0});u.push({answer:a,score:o})}}return 1===r?u[0]:u}}class w extends _{constructor(e){super(e)}async _call(e,{top_k:t=5}={}){const r=this.tokenizer(e,{padding:!0,truncation:!0}),{logits:n}=await this.model(r),o=[],s=r.input_ids.tolist();for(let e=0;e<s.length;++e){const r=s[e],a=r.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=n[e][a],c=await(0,d.topk)(new d.Tensor("float32",(0,l.softmax)(i.data),i.dims),t),u=c[0].tolist(),p=c[1].tolist();o.push(p.map(((e,t)=>{const n=r.slice();return n[a]=e,{score:u[t],token:Number(e),token_str:this.tokenizer.model.vocab[e],sequence:this.tokenizer.decode(n,{skip_special_tokens:!0})}})))}return Array.isArray(e)?o:o[0]}}class T extends _{_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 r=this.model.config.task_specific_params;r&&r[this.task]&&r[this.task].prefix&&(e=e.map((e=>r[this.task].prefix+e)));const n=this.tokenizer,o={padding:!0,truncation:!0};let s;s=this instanceof x&&"_build_translation_inputs"in n?n._build_translation_inputs(e,o,t):n(e,o);const a=await this.model.generate({...s,...t});return n.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 y(e){return Array.isArray(e)&&e.every((e=>"role"in e&&"content"in e))}class k extends _{constructor(e){super(e)}async _call(e,t={}){let r,n=!1,o=!1;if("string"==typeof e)r=e=[e];else if(Array.isArray(e)&&e.every((e=>"string"==typeof e)))n=!0,r=e;else{if(y(e))e=[e];else{if(!Array.isArray(e)||!e.every(y))throw new Error("Input must be a string, an array of strings, a Chat, or an array of Chats");n=!0}o=!0,r=e.map((e=>this.tokenizer.apply_chat_template(e,{tokenize:!1,add_generation_prompt:!0})))}const s=t.add_special_tokens??!1,a=!o&&(t.return_full_text??!0);this.tokenizer.padding_side="left";const i=this.tokenizer(r,{add_special_tokens:s,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 r=Math.floor(t/l.dims[0]*e.length);d&&(c[t]=c[t].slice(d[r])),u[r].push({generated_text:o?[...e[r],{role:"assistant",content:c[t]}]:c[t]})}return n||1!==u.length?u:u[0]}}class F extends _{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:r="This example is {}.",multi_label:n=!1}={}){const o=Array.isArray(e);o||(e=[e]),Array.isArray(t)||(t=[t]);const s=t.map((e=>r.replace("{}",e))),a=n||1===t.length,i=[];for(const r of e){const e=[];for(const t of s){const n=this.tokenizer(r,{text_pair:t,padding:!0,truncation:!0}),o=await this.model(n);a?e.push([o.logits.data[this.contradiction_id],o.logits.data[this.entailment_id]]):e.push(o.logits.data[this.entailment_id])}const n=(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:r,labels:n.map((e=>t[e[1]])),scores:n.map((e=>e[0]))})}return o?i:i[0]}}class P extends _{constructor(e){super(e)}async _call(e,{pooling:t="none",normalize:r=!1,quantize:n=!1,precision:o="binary"}={}){const s=this.tokenizer(e,{padding:!0,truncation:!0}),a=await this.model(s);let i=a.last_hidden_state??a.logits??a.token_embeddings;if("none"===t);else if("mean"===t)i=(0,d.mean_pooling)(i,s.attention_mask);else{if("cls"!==t)throw Error(`Pooling method '${t}' not supported.`);i=i.slice(null,0)}return r&&(i=i.normalize(2,-1)),n&&(i=(0,d.quantize_embeddings)(i,o)),i}}class C extends _{constructor(e){super(e)}async _call(e,{pool:t=null}={}){const r=await p(e),{pixel_values:n}=await this.processor(r),o=await this.model({pixel_values:n});let s;if(t){if(!("pooler_output"in o))throw Error("No pooled output was returned. Make sure the model has a 'pooler' layer when using the 'pool' option.");s=o.pooler_output}else s=o.last_hidden_state??o.logits??o.image_embeds;return s}}class v extends _{constructor(e){super(e)}async _call(e,{top_k:t=5}={}){const r=this.processor.feature_extractor.config.sampling_rate,n=await h(e,r),o=this.model.config.id2label,s=[];for(const e of n){const r=await this.processor(e),n=(await this.model(r)).logits[0],a=await(0,d.topk)(new d.Tensor("float32",(0,l.softmax)(n.data),n.dims),t),i=a[0].tolist(),c=a[1].tolist().map(((e,t)=>({label:o?o[e]:`LABEL_${e}`,score:i[t]})));s.push(c)}return Array.isArray(e)?s:s[0]}}class S extends _{constructor(e){super(e)}async _call(e,t,{hypothesis_template:r="This is a sound of {}."}={}){const n=!Array.isArray(e);n&&(e=[e]);const o=t.map((e=>r.replace("{}",e))),s=this.tokenizer(o,{padding:!0,truncation:!0}),a=this.processor.feature_extractor.config.sampling_rate,i=await h(e,a),c=[];for(const e of i){const r=await this.processor(e),n=await this.model({...s,...r}),o=(0,l.softmax)(n.logits_per_audio.data);c.push([...o].map(((e,r)=>({score:e,label:t[r]}))))}return n?c[0]:c}}class A extends _{constructor(e){super(e)}async _call(e,t={}){switch(this.model.config.model_type){case"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);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 r=!Array.isArray(e);r&&(e=[e]);const n=this.processor.feature_extractor.config.sampling_rate,o=await h(e,n),s=[];for(const e of o){const t=await this.processor(e),r=(await this.model(t)).logits[0],n=[];for(const e of r)n.push((0,l.max)(e.data)[1]);const o=this.tokenizer.decode(n);s.push({text:o})}return r?s[0]:s}async _call_whisper(e,t){const r=t.return_timestamps??!1,n=t.chunk_length_s??0,o=t.force_full_sequences??!1;let s=t.stride_length_s??null;const a={...t};"word"===r&&(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,p=await h(e,u),m=[];for(const e of p){let t=[];if(n>0){if(null===s)s=n/6;else if(n<=s)throw Error("`chunk_length_s` must be larger than `stride_length_s`.");const r=u*n,o=u*s,a=r-2*o;let i=0;for(;;){const n=i+r,s=e.subarray(i,n),l=await this.processor(s),c=0===i,d=n>=e.length;if(t.push({stride:[s.length,c?0:o,d?0:o],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"===r?(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,p]=this.tokenizer._decode_asr(t,{time_precision:c,return_timestamps:r,force_full_sequences:o});m.push({text:i,...p})}return i?m[0]:m}}class E extends _{constructor(e){super(e)}async _call(e,t={}){const r=Array.isArray(e),n=await p(e),{pixel_values:o}=await this.processor(n),s=[];for(const e of o){e.dims=[1,...e.dims];const r=await this.model.generate({inputs:e,...t}),n=this.tokenizer.batch_decode(r,{skip_special_tokens:!0}).map((e=>({generated_text:e.trim()})));s.push(n)}return r?s:s[0]}}class L extends _{constructor(e){super(e)}async _call(e,{top_k:t=5}={}){const r=await p(e),{pixel_values:n}=await this.processor(r),o=await this.model({pixel_values:n}),s=this.model.config.id2label,a=[];for(const e of o.logits){const r=await(0,d.topk)(new d.Tensor("float32",(0,l.softmax)(e.data),e.dims),t),n=r[0].tolist(),o=r[1].tolist().map(((e,t)=>({label:s?s[e]:`LABEL_${e}`,score:n[t]})));a.push(o)}return Array.isArray(e)?a:a[0]}}class z extends _{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:r=.5,overlap_mask_area_threshold:n=.8,label_ids_to_fuse:o=null,target_sizes:s=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 p(e),l=i.map((e=>[e.height,e.width])),{pixel_values:c,pixel_mask:d}=await this.processor(i),h=await this.model({pixel_values:c,pixel_mask:d});let m=null;if(null!==a)m=this.subtasks_mapping[a];else for(let[e,t]of Object.entries(this.subtasks_mapping))if(t in this.processor.feature_extractor){m=this.processor.feature_extractor[t].bind(this.processor.feature_extractor),a=e;break}const _=this.model.config.id2label,f=[];if("panoptic"===a||"instance"===a){const e=m(h,t,r,n,o,s??l)[0],a=e.segmentation;for(const t of e.segments_info){const e=new Uint8ClampedArray(a.data.length);for(let r=0;r<a.data.length;++r)a.data[r]===t.id&&(e[r]=255);const r=new u.RawImage(e,a.dims[1],a.dims[0],1);f.push({score:t.score,label:_[t.label_id],mask:r})}}else{if("semantic"!==a)throw Error(`Subtask ${a} not supported.`);{const{segmentation:e,labels:t}=m(h,s??l)[0];for(const r of t){const t=new Uint8ClampedArray(e.data.length);for(let n=0;n<e.data.length;++n)e.data[n]===r&&(t[n]=255);const n=new u.RawImage(t,e.dims[1],e.dims[0],1);f.push({score:null,label:_[r],mask:n})}}}return f}}class I extends _{constructor(e){super(e)}async _call(e,t,{hypothesis_template:r="This is a photo of {}"}={}){const n=Array.isArray(e),o=await p(e),s=t.map((e=>r.replace("{}",e))),a=this.tokenizer(s,{padding:"siglip"!==this.model.config.model_type||"max_length",truncation:!0}),{pixel_values:i}=await this.processor(o),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 r=[...d(e)].map(((e,r)=>({score:e,label:t[r]})));r.sort(((e,t)=>t.score-e.score)),u.push(r)}return n?u:u[0]}}class B extends _{constructor(e){super(e)}async _call(e,{threshold:t=.9,percentage:r=!1}={}){const n=Array.isArray(e);if(n&&1!==e.length)throw Error("Object detection pipeline currently only supports a batch size of 1.");const o=await p(e),s=r?null:o.map((e=>[e.height,e.width])),{pixel_values:a,pixel_mask:i}=await this.processor(o),l=await this.model({pixel_values:a,pixel_mask:i}),c=this.processor.feature_extractor.post_process_object_detection(l,t,s),d=this.model.config.id2label,u=c.map((e=>e.boxes.map(((t,n)=>({score:e.scores[n],label:d[e.classes[n]],box:m(t,!r)})))));return n?u:u[0]}}class N extends _{constructor(e){super(e)}async _call(e,t,{threshold:r=.1,top_k:n=null,percentage:o=!1}={}){const s=Array.isArray(e),a=await p(e),i=this.tokenizer(t,{padding:!0,truncation:!0}),l=await this.processor(a),c=[];for(let e=0;e<a.length;++e){const s=a[e],d=o?null:[[s.height,s.width]],u=l.pixel_values[e].unsqueeze_(0),p=await this.model({...i,pixel_values:u}),h=this.processor.feature_extractor.post_process_object_detection(p,r,d,!0)[0];let _=h.boxes.map(((e,r)=>({score:h.scores[r],label:t[h.classes[r]],box:m(e,!o)}))).sort(((e,t)=>t.score-e.score));null!==n&&(_=_.slice(0,n)),c.push(_)}return s?c:c[0]}}class D extends _{constructor(e){super(e)}async _call(e,t,r={}){throw new Error("This pipeline is not yet supported in Transformers.js v3.")}}class O extends _{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:r}=await this.model(t),n=this.model.config.sampling_rate;return{audio:r.data,sampling_rate:n}}async _call_text_to_spectrogram(e,{speaker_embeddings:t}){if(this.vocoder||(console.log("No vocoder specified, using default HifiGan vocoder."),this.vocoder=await o.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:r}=this.tokenizer(e,{padding:!0,truncation:!0}),{waveform:n}=await this.model.generate_speech(r,t,{vocoder:this.vocoder}),s=this.processor.feature_extractor.config.sampling_rate;return{audio:n.data,sampling_rate:s}}}class V extends _{constructor(e){super(e)}async _call(e){const t=await p(e),r=await this.processor(t),n=await this.model(r),o=[];for(const e of n.reconstruction){const t=e.squeeze().clamp_(0,1).mul_(255).round_().to("uint8");o.push(u.RawImage.fromTensor(t))}return o.length>1?o:o[0]}}class j extends _{constructor(e){super(e)}async _call(e){const t=await p(e),r=await this.processor(t),{predicted_depth:n}=await this.model(r),o=[];for(let e=0;e<t.length;++e){const r=(0,d.interpolate)(n[e],t[e].size.reverse(),"bilinear",!1),s=r.mul_(255/(0,l.max)(r.data)[0]).to("uint8");o.push({predicted_depth:n[e],depth:u.RawImage.fromTensor(s)})}return o.length>1?o:o[0]}}const R=Object.freeze({"text-classification":{tokenizer:n.AutoTokenizer,pipeline:f,model:o.AutoModelForSequenceClassification,default:{model:"Xenova/distilbert-base-uncased-finetuned-sst-2-english"},type:"text"},"token-classification":{tokenizer:n.AutoTokenizer,pipeline:g,model:o.AutoModelForTokenClassification,default:{model:"Xenova/bert-base-multilingual-cased-ner-hrl"},type:"text"},"question-answering":{tokenizer:n.AutoTokenizer,pipeline:M,model:o.AutoModelForQuestionAnswering,default:{model:"Xenova/distilbert-base-cased-distilled-squad"},type:"text"},"fill-mask":{tokenizer:n.AutoTokenizer,pipeline:w,model:o.AutoModelForMaskedLM,default:{model:"Xenova/bert-base-uncased"},type:"text"},summarization:{tokenizer:n.AutoTokenizer,pipeline:b,model:o.AutoModelForSeq2SeqLM,default:{model:"Xenova/distilbart-cnn-6-6"},type:"text"},translation:{tokenizer:n.AutoTokenizer,pipeline:x,model:o.AutoModelForSeq2SeqLM,default:{model:"Xenova/t5-small"},type:"text"},"text2text-generation":{tokenizer:n.AutoTokenizer,pipeline:T,model:o.AutoModelForSeq2SeqLM,default:{model:"Xenova/flan-t5-small"},type:"text"},"text-generation":{tokenizer:n.AutoTokenizer,pipeline:k,model:o.AutoModelForCausalLM,default:{model:"Xenova/gpt2"},type:"text"},"zero-shot-classification":{tokenizer:n.AutoTokenizer,pipeline:F,model:o.AutoModelForSequenceClassification,default:{model:"Xenova/distilbert-base-uncased-mnli"},type:"text"},"audio-classification":{pipeline:v,model:o.AutoModelForAudioClassification,processor:s.AutoProcessor,default:{model:"Xenova/wav2vec2-base-superb-ks"},type:"audio"},"zero-shot-audio-classification":{tokenizer:n.AutoTokenizer,pipeline:S,model:o.AutoModel,processor:s.AutoProcessor,default:{model:"Xenova/clap-htsat-unfused"},type:"multimodal"},"automatic-speech-recognition":{tokenizer:n.AutoTokenizer,pipeline:A,model:[o.AutoModelForSpeechSeq2Seq,o.AutoModelForCTC],processor:s.AutoProcessor,default:{model:"Xenova/whisper-tiny.en"},type:"multimodal"},"text-to-audio":{tokenizer:n.AutoTokenizer,pipeline:O,model:[o.AutoModelForTextToWaveform,o.AutoModelForTextToSpectrogram],processor:[s.AutoProcessor,null],default:{model:"Xenova/speecht5_tts"},type:"text"},"image-to-text":{tokenizer:n.AutoTokenizer,pipeline:E,model:o.AutoModelForVision2Seq,processor:s.AutoProcessor,default:{model:"Xenova/vit-gpt2-image-captioning"},type:"multimodal"},"image-classification":{pipeline:L,model:o.AutoModelForImageClassification,processor:s.AutoProcessor,default:{model:"Xenova/vit-base-patch16-224"},type:"multimodal"},"image-segmentation":{pipeline:z,model:[o.AutoModelForImageSegmentation,o.AutoModelForSemanticSegmentation,o.AutoModelForUniversalSegmentation],processor:s.AutoProcessor,default:{model:"Xenova/detr-resnet-50-panoptic"},type:"multimodal"},"zero-shot-image-classification":{tokenizer:n.AutoTokenizer,pipeline:I,model:o.AutoModel,processor:s.AutoProcessor,default:{model:"Xenova/clip-vit-base-patch32"},type:"multimodal"},"object-detection":{pipeline:B,model:o.AutoModelForObjectDetection,processor:s.AutoProcessor,default:{model:"Xenova/detr-resnet-50"},type:"multimodal"},"zero-shot-object-detection":{tokenizer:n.AutoTokenizer,pipeline:N,model:o.AutoModelForZeroShotObjectDetection,processor:s.AutoProcessor,default:{model:"Xenova/owlvit-base-patch32"},type:"multimodal"},"document-question-answering":{tokenizer:n.AutoTokenizer,pipeline:D,model:o.AutoModelForDocumentQuestionAnswering,processor:s.AutoProcessor,default:{model:"Xenova/donut-base-finetuned-docvqa"},type:"multimodal"},"image-to-image":{pipeline:V,model:o.AutoModelForImageToImage,processor:s.AutoProcessor,default:{model:"Xenova/swin2SR-classical-sr-x2-64"},type:"image"},"depth-estimation":{pipeline:j,model:o.AutoModelForDepthEstimation,processor:s.AutoProcessor,default:{model:"Xenova/dpt-large"},type:"image"},"feature-extraction":{tokenizer:n.AutoTokenizer,pipeline:P,model:o.AutoModel,default:{model:"Xenova/all-MiniLM-L6-v2"},type:"text"},"image-feature-extraction":{processor:s.AutoProcessor,pipeline:C,model:[o.AutoModelForImageFeatureExtraction,o.AutoModel],default:{model:"Xenova/vit-base-patch16-224-in21k"},type:"image"}}),G=Object.freeze({"sentiment-analysis":"text-classification",ner:"token-classification",asr:"automatic-speech-recognition","text-to-speech":"text-to-audio",embeddings:"feature-extraction"});async function q(e,t=null,{progress_callback:r=null,config:n=null,cache_dir:o=null,local_files_only:s=!1,revision:a="main",device:l=null,dtype:c=null,model_file_name:d=null,session_options:u={}}={}){e=G[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:r,config:n,cache_dir:o,local_files_only:s,revision:a,device:l,dtype:c,model_file_name:d,session_options:u},m=new Map([["tokenizer",p.tokenizer],["model",p.model],["processor",p.processor]]),_=await async function(e,t,r){const n=Object.create(null),o=[];for(const[s,a]of e.entries()){if(!a)continue;let e;e=Array.isArray(a)?new Promise((async(e,n)=>{let o;for(const s of a){if(null===s)return void e(null);try{return void e(await s.from_pretrained(t,r))}catch(e){if(e.message?.includes("Unsupported model type"))o=e;else{if(!e.message?.includes("Could not locate file"))return void n(e);o=e}}}n(o)})):a.from_pretrained(t,r),n[s]=e,o.push(e)}await Promise.all(o);for(const[e,t]of Object.entries(n))n[e]=await t;return n}(m,t,h);_.task=e,(0,i.dispatchCallback)(r,{status:"ready",task:e,model:t});return new(0,p.pipeline)(_)}},"./src/processors.js":
124
+ \**************************/(e,t,r)=>{r.r(t),r.d(t,{AudioClassificationPipeline:()=>v,AutomaticSpeechRecognitionPipeline:()=>A,DepthEstimationPipeline:()=>j,DocumentQuestionAnsweringPipeline:()=>D,FeatureExtractionPipeline:()=>P,FillMaskPipeline:()=>w,ImageClassificationPipeline:()=>L,ImageFeatureExtractionPipeline:()=>C,ImageSegmentationPipeline:()=>z,ImageToImagePipeline:()=>V,ImageToTextPipeline:()=>E,ObjectDetectionPipeline:()=>B,Pipeline:()=>_,QuestionAnsweringPipeline:()=>M,SummarizationPipeline:()=>b,Text2TextGenerationPipeline:()=>T,TextClassificationPipeline:()=>f,TextGenerationPipeline:()=>k,TextToAudioPipeline:()=>O,TokenClassificationPipeline:()=>g,TranslationPipeline:()=>x,ZeroShotAudioClassificationPipeline:()=>S,ZeroShotClassificationPipeline:()=>F,ZeroShotImageClassificationPipeline:()=>I,ZeroShotObjectDetectionPipeline:()=>N,pipeline:()=>q});var n=r(/*! ./tokenizers.js */"./src/tokenizers.js"),o=r(/*! ./models.js */"./src/models.js"),s=r(/*! ./processors.js */"./src/processors.js"),a=r(/*! ./utils/generic.js */"./src/utils/generic.js"),i=r(/*! ./utils/core.js */"./src/utils/core.js"),l=r(/*! ./utils/maths.js */"./src/utils/maths.js"),c=r(/*! ./utils/audio.js */"./src/utils/audio.js"),d=r(/*! ./utils/tensor.js */"./src/utils/tensor.js"),u=r(/*! ./utils/image.js */"./src/utils/image.js");async function p(e){return Array.isArray(e)||(e=[e]),await Promise.all(e.map((e=>u.RawImage.read(e))))}async function h(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[r,n,o,s]=e;return{xmin:r,ymin:n,xmax:o,ymax:s}}class _ extends a.Callable{constructor({task:e,model:t,tokenizer:r=null,processor:n=null}){super(),this.task=e,this.model=t,this.tokenizer=r,this.processor=n}async dispose(){await this.model.dispose()}}class f extends _{constructor(e){super(e)}async _call(e,{top_k:t=1}={}){const r=this.tokenizer(e,{padding:!0,truncation:!0}),n=await this.model(r),o="multi_label_classification"===this.model.config.problem_type?e=>e.sigmoid():e=>new d.Tensor("float32",(0,l.softmax)(e.data),e.dims),s=this.model.config.id2label,a=[];for(const e of n.logits){const r=o(e),n=await(0,d.topk)(r,t),i=n[0].tolist(),l=n[1].tolist().map(((e,t)=>({label:s?s[e]:`LABEL_${e}`,score:i[t]})));1===t?a.push(...l):a.push(l)}return Array.isArray(e)||1===t?a:a[0]}}class g extends _{constructor(e){super(e)}async _call(e,{ignore_labels:t=["O"]}={}){const r=Array.isArray(e),n=this.tokenizer(r?e:[e],{padding:!0,truncation:!0}),o=(await this.model(n)).logits,s=this.model.config.id2label,a=[];for(let e=0;e<o.dims[0];++e){const r=n.input_ids[e],i=o[e],c=[];for(let e=0;e<i.dims[0];++e){const n=i[e],o=(0,l.max)(n.data)[1],a=s?s[o]:`LABEL_${o}`;if(t.includes(a))continue;const d=this.tokenizer.decode([r[e].item()],{skip_special_tokens:!0});if(""===d)continue;const u=(0,l.softmax)(n.data);c.push({entity:a,score:u[o],index:e,word:d})}a.push(c)}return r?a:a[0]}}class M extends _{constructor(e){super(e)}async _call(e,t,{top_k:r=1}={}){const n=this.tokenizer(e,{text_pair:t,padding:!0,truncation:!0}),{start_logits:o,end_logits:s}=await this.model(n),a=n.input_ids.tolist(),c=n.attention_mask.tolist(),d=this.tokenizer.all_special_ids,u=[];for(let e=0;e<o.dims[0];++e){const t=a[e],n=t.findIndex((e=>e==this.tokenizer.sep_token_id)),p=(c[e].map(((e,r)=>1==e&&(0===r||r>n&&-1===d.findIndex((e=>e==t[r]))))),o[e].tolist()),h=s[e].tolist();for(let r=1;r<p.length;++r)(0==c[e]||r<=n||-1!==d.findIndex((e=>e==t[r])))&&(p[r]=-1/0,h[r]=-1/0);const m=(0,l.softmax)(p).map(((e,t)=>[e,t])),_=(0,l.softmax)(h).map(((e,t)=>[e,t]));m[0][0]=0,_[0][0]=0;const f=(0,i.product)(m,_).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(f.length,r);++e){const[r,n,o]=f[e],s=t.slice(r,n+1),a=this.tokenizer.decode(s,{skip_special_tokens:!0});u.push({answer:a,score:o})}}return 1===r?u[0]:u}}class w extends _{constructor(e){super(e)}async _call(e,{top_k:t=5}={}){const r=this.tokenizer(e,{padding:!0,truncation:!0}),{logits:n}=await this.model(r),o=[],s=r.input_ids.tolist();for(let e=0;e<s.length;++e){const r=s[e],a=r.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=n[e][a],c=await(0,d.topk)(new d.Tensor("float32",(0,l.softmax)(i.data),i.dims),t),u=c[0].tolist(),p=c[1].tolist();o.push(p.map(((e,t)=>{const n=r.slice();return n[a]=e,{score:u[t],token:Number(e),token_str:this.tokenizer.model.vocab[e],sequence:this.tokenizer.decode(n,{skip_special_tokens:!0})}})))}return Array.isArray(e)?o:o[0]}}class T extends _{_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 r=this.model.config.task_specific_params;r&&r[this.task]&&r[this.task].prefix&&(e=e.map((e=>r[this.task].prefix+e)));const n=this.tokenizer,o={padding:!0,truncation:!0};let s;s=this instanceof x&&"_build_translation_inputs"in n?n._build_translation_inputs(e,o,t):n(e,o);const a=await this.model.generate({...s,...t});return n.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 y(e){return Array.isArray(e)&&e.every((e=>"role"in e&&"content"in e))}class k extends _{constructor(e){super(e)}async _call(e,t={}){let r,n=!1,o=!1;if("string"==typeof e)r=e=[e];else if(Array.isArray(e)&&e.every((e=>"string"==typeof e)))n=!0,r=e;else{if(y(e))e=[e];else{if(!Array.isArray(e)||!e.every(y))throw new Error("Input must be a string, an array of strings, a Chat, or an array of Chats");n=!0}o=!0,r=e.map((e=>this.tokenizer.apply_chat_template(e,{tokenize:!1,add_generation_prompt:!0})))}const s=t.add_special_tokens??!1,a=!o&&(t.return_full_text??!0);this.tokenizer.padding_side="left";const i=this.tokenizer(r,{add_special_tokens:s,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 r=Math.floor(t/l.dims[0]*e.length);d&&(c[t]=c[t].slice(d[r])),u[r].push({generated_text:o?[...e[r],{role:"assistant",content:c[t]}]:c[t]})}return n||1!==u.length?u:u[0]}}class F extends _{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:r="This example is {}.",multi_label:n=!1}={}){const o=Array.isArray(e);o||(e=[e]),Array.isArray(t)||(t=[t]);const s=t.map((e=>r.replace("{}",e))),a=n||1===t.length,i=[];for(const r of e){const e=[];for(const t of s){const n=this.tokenizer(r,{text_pair:t,padding:!0,truncation:!0}),o=await this.model(n);a?e.push([o.logits.data[this.contradiction_id],o.logits.data[this.entailment_id]]):e.push(o.logits.data[this.entailment_id])}const n=(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:r,labels:n.map((e=>t[e[1]])),scores:n.map((e=>e[0]))})}return o?i:i[0]}}class P extends _{constructor(e){super(e)}async _call(e,{pooling:t="none",normalize:r=!1,quantize:n=!1,precision:o="binary"}={}){const s=this.tokenizer(e,{padding:!0,truncation:!0}),a=await this.model(s);let i=a.last_hidden_state??a.logits??a.token_embeddings;if("none"===t);else if("mean"===t)i=(0,d.mean_pooling)(i,s.attention_mask);else{if("cls"!==t)throw Error(`Pooling method '${t}' not supported.`);i=i.slice(null,0)}return r&&(i=i.normalize(2,-1)),n&&(i=(0,d.quantize_embeddings)(i,o)),i}}class C extends _{constructor(e){super(e)}async _call(e,{pool:t=null}={}){const r=await p(e),{pixel_values:n}=await this.processor(r),o=await this.model({pixel_values:n});let s;if(t){if(!("pooler_output"in o))throw Error("No pooled output was returned. Make sure the model has a 'pooler' layer when using the 'pool' option.");s=o.pooler_output}else s=o.last_hidden_state??o.logits??o.image_embeds;return s}}class v extends _{constructor(e){super(e)}async _call(e,{top_k:t=5}={}){const r=this.processor.feature_extractor.config.sampling_rate,n=await h(e,r),o=this.model.config.id2label,s=[];for(const e of n){const r=await this.processor(e),n=(await this.model(r)).logits[0],a=await(0,d.topk)(new d.Tensor("float32",(0,l.softmax)(n.data),n.dims),t),i=a[0].tolist(),c=a[1].tolist().map(((e,t)=>({label:o?o[e]:`LABEL_${e}`,score:i[t]})));s.push(c)}return Array.isArray(e)?s:s[0]}}class S extends _{constructor(e){super(e)}async _call(e,t,{hypothesis_template:r="This is a sound of {}."}={}){const n=!Array.isArray(e);n&&(e=[e]);const o=t.map((e=>r.replace("{}",e))),s=this.tokenizer(o,{padding:!0,truncation:!0}),a=this.processor.feature_extractor.config.sampling_rate,i=await h(e,a),c=[];for(const e of i){const r=await this.processor(e),n=await this.model({...s,...r}),o=(0,l.softmax)(n.logits_per_audio.data);c.push([...o].map(((e,r)=>({score:e,label:t[r]}))))}return n?c[0]:c}}class A extends _{constructor(e){super(e)}async _call(e,t={}){switch(this.model.config.model_type){case"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);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 r=!Array.isArray(e);r&&(e=[e]);const n=this.processor.feature_extractor.config.sampling_rate,o=await h(e,n),s=[];for(const e of o){const t=await this.processor(e),r=(await this.model(t)).logits[0],n=[];for(const e of r)n.push((0,l.max)(e.data)[1]);const o=this.tokenizer.decode(n);s.push({text:o})}return r?s[0]:s}async _call_whisper(e,t){const r=t.return_timestamps??!1,n=t.chunk_length_s??0,o=t.force_full_sequences??!1;let s=t.stride_length_s??null;const a={...t};"word"===r&&(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,p=await h(e,u),m=[];for(const e of p){let t=[];if(n>0){if(null===s)s=n/6;else if(n<=s)throw Error("`chunk_length_s` must be larger than `stride_length_s`.");const r=u*n,o=u*s,a=r-2*o;let i=0;for(;;){const n=i+r,s=e.subarray(i,n),l=await this.processor(s),c=0===i,d=n>=e.length;if(t.push({stride:[s.length,c?0:o,d?0:o],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"===r?(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,p]=this.tokenizer._decode_asr(t,{time_precision:c,return_timestamps:r,force_full_sequences:o});m.push({text:i,...p})}return i?m[0]:m}}class E extends _{constructor(e){super(e)}async _call(e,t={}){const r=Array.isArray(e),n=await p(e),{pixel_values:o}=await this.processor(n),s=[];for(const e of o){e.dims=[1,...e.dims];const r=await this.model.generate({inputs:e,...t}),n=this.tokenizer.batch_decode(r,{skip_special_tokens:!0}).map((e=>({generated_text:e.trim()})));s.push(n)}return r?s:s[0]}}class L extends _{constructor(e){super(e)}async _call(e,{top_k:t=5}={}){const r=await p(e),{pixel_values:n}=await this.processor(r),o=await this.model({pixel_values:n}),s=this.model.config.id2label,a=[];for(const e of o.logits){const r=await(0,d.topk)(new d.Tensor("float32",(0,l.softmax)(e.data),e.dims),t),n=r[0].tolist(),o=r[1].tolist().map(((e,t)=>({label:s?s[e]:`LABEL_${e}`,score:n[t]})));a.push(o)}return Array.isArray(e)?a:a[0]}}class z extends _{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:r=.5,overlap_mask_area_threshold:n=.8,label_ids_to_fuse:o=null,target_sizes:s=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 p(e),l=i.map((e=>[e.height,e.width])),{pixel_values:c,pixel_mask:d}=await this.processor(i),h=await this.model({pixel_values:c,pixel_mask:d});let m=null;if(null!==a)m=this.subtasks_mapping[a];else for(let[e,t]of Object.entries(this.subtasks_mapping))if(t in this.processor.feature_extractor){m=this.processor.feature_extractor[t].bind(this.processor.feature_extractor),a=e;break}const _=this.model.config.id2label,f=[];if("panoptic"===a||"instance"===a){const e=m(h,t,r,n,o,s??l)[0],a=e.segmentation;for(const t of e.segments_info){const e=new Uint8ClampedArray(a.data.length);for(let r=0;r<a.data.length;++r)a.data[r]===t.id&&(e[r]=255);const r=new u.RawImage(e,a.dims[1],a.dims[0],1);f.push({score:t.score,label:_[t.label_id],mask:r})}}else{if("semantic"!==a)throw Error(`Subtask ${a} not supported.`);{const{segmentation:e,labels:t}=m(h,s??l)[0];for(const r of t){const t=new Uint8ClampedArray(e.data.length);for(let n=0;n<e.data.length;++n)e.data[n]===r&&(t[n]=255);const n=new u.RawImage(t,e.dims[1],e.dims[0],1);f.push({score:null,label:_[r],mask:n})}}}return f}}class I extends _{constructor(e){super(e)}async _call(e,t,{hypothesis_template:r="This is a photo of {}"}={}){const n=Array.isArray(e),o=await p(e),s=t.map((e=>r.replace("{}",e))),a=this.tokenizer(s,{padding:"siglip"!==this.model.config.model_type||"max_length",truncation:!0}),{pixel_values:i}=await this.processor(o),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 r=[...d(e)].map(((e,r)=>({score:e,label:t[r]})));r.sort(((e,t)=>t.score-e.score)),u.push(r)}return n?u:u[0]}}class B extends _{constructor(e){super(e)}async _call(e,{threshold:t=.9,percentage:r=!1}={}){const n=Array.isArray(e);if(n&&1!==e.length)throw Error("Object detection pipeline currently only supports a batch size of 1.");const o=await p(e),s=r?null:o.map((e=>[e.height,e.width])),{pixel_values:a,pixel_mask:i}=await this.processor(o),l=await this.model({pixel_values:a,pixel_mask:i}),c=this.processor.feature_extractor.post_process_object_detection(l,t,s),d=this.model.config.id2label,u=c.map((e=>e.boxes.map(((t,n)=>({score:e.scores[n],label:d[e.classes[n]],box:m(t,!r)})))));return n?u:u[0]}}class N extends _{constructor(e){super(e)}async _call(e,t,{threshold:r=.1,top_k:n=null,percentage:o=!1}={}){const s=Array.isArray(e),a=await p(e),i=this.tokenizer(t,{padding:!0,truncation:!0}),l=await this.processor(a),c=[];for(let e=0;e<a.length;++e){const s=a[e],d=o?null:[[s.height,s.width]],u=l.pixel_values[e].unsqueeze_(0),p=await this.model({...i,pixel_values:u}),h=this.processor.feature_extractor.post_process_object_detection(p,r,d,!0)[0];let _=h.boxes.map(((e,r)=>({score:h.scores[r],label:t[h.classes[r]],box:m(e,!o)}))).sort(((e,t)=>t.score-e.score));null!==n&&(_=_.slice(0,n)),c.push(_)}return s?c:c[0]}}class D extends _{constructor(e){super(e)}async _call(e,t,r={}){const n=(await p(e))[0],{pixel_values:o}=await this.processor(n),s=`<s_docvqa><s_question>${t}</s_question><s_answer>`,a=this.tokenizer(s,{add_special_tokens:!1,padding:!0,truncation:!0}).input_ids,i=await this.model.generate({inputs:o,max_length:this.model.config.decoder.max_position_embeddings,decoder_input_ids:a,...r}),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 _{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:r}=await this.model(t),n=this.model.config.sampling_rate;return{audio:r.data,sampling_rate:n}}async _call_text_to_spectrogram(e,{speaker_embeddings:t}){if(this.vocoder||(console.log("No vocoder specified, using default HifiGan vocoder."),this.vocoder=await o.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:r}=this.tokenizer(e,{padding:!0,truncation:!0}),{waveform:n}=await this.model.generate_speech(r,t,{vocoder:this.vocoder}),s=this.processor.feature_extractor.config.sampling_rate;return{audio:n.data,sampling_rate:s}}}class V extends _{constructor(e){super(e)}async _call(e){const t=await p(e),r=await this.processor(t),n=await this.model(r),o=[];for(const e of n.reconstruction){const t=e.squeeze().clamp_(0,1).mul_(255).round_().to("uint8");o.push(u.RawImage.fromTensor(t))}return o.length>1?o:o[0]}}class j extends _{constructor(e){super(e)}async _call(e){const t=await p(e),r=await this.processor(t),{predicted_depth:n}=await this.model(r),o=[];for(let e=0;e<t.length;++e){const r=(0,d.interpolate)(n[e],t[e].size.reverse(),"bilinear",!1),s=r.mul_(255/(0,l.max)(r.data)[0]).to("uint8");o.push({predicted_depth:n[e],depth:u.RawImage.fromTensor(s)})}return o.length>1?o:o[0]}}const R=Object.freeze({"text-classification":{tokenizer:n.AutoTokenizer,pipeline:f,model:o.AutoModelForSequenceClassification,default:{model:"Xenova/distilbert-base-uncased-finetuned-sst-2-english"},type:"text"},"token-classification":{tokenizer:n.AutoTokenizer,pipeline:g,model:o.AutoModelForTokenClassification,default:{model:"Xenova/bert-base-multilingual-cased-ner-hrl"},type:"text"},"question-answering":{tokenizer:n.AutoTokenizer,pipeline:M,model:o.AutoModelForQuestionAnswering,default:{model:"Xenova/distilbert-base-cased-distilled-squad"},type:"text"},"fill-mask":{tokenizer:n.AutoTokenizer,pipeline:w,model:o.AutoModelForMaskedLM,default:{model:"Xenova/bert-base-uncased"},type:"text"},summarization:{tokenizer:n.AutoTokenizer,pipeline:b,model:o.AutoModelForSeq2SeqLM,default:{model:"Xenova/distilbart-cnn-6-6"},type:"text"},translation:{tokenizer:n.AutoTokenizer,pipeline:x,model:o.AutoModelForSeq2SeqLM,default:{model:"Xenova/t5-small"},type:"text"},"text2text-generation":{tokenizer:n.AutoTokenizer,pipeline:T,model:o.AutoModelForSeq2SeqLM,default:{model:"Xenova/flan-t5-small"},type:"text"},"text-generation":{tokenizer:n.AutoTokenizer,pipeline:k,model:o.AutoModelForCausalLM,default:{model:"Xenova/gpt2"},type:"text"},"zero-shot-classification":{tokenizer:n.AutoTokenizer,pipeline:F,model:o.AutoModelForSequenceClassification,default:{model:"Xenova/distilbert-base-uncased-mnli"},type:"text"},"audio-classification":{pipeline:v,model:o.AutoModelForAudioClassification,processor:s.AutoProcessor,default:{model:"Xenova/wav2vec2-base-superb-ks"},type:"audio"},"zero-shot-audio-classification":{tokenizer:n.AutoTokenizer,pipeline:S,model:o.AutoModel,processor:s.AutoProcessor,default:{model:"Xenova/clap-htsat-unfused"},type:"multimodal"},"automatic-speech-recognition":{tokenizer:n.AutoTokenizer,pipeline:A,model:[o.AutoModelForSpeechSeq2Seq,o.AutoModelForCTC],processor:s.AutoProcessor,default:{model:"Xenova/whisper-tiny.en"},type:"multimodal"},"text-to-audio":{tokenizer:n.AutoTokenizer,pipeline:O,model:[o.AutoModelForTextToWaveform,o.AutoModelForTextToSpectrogram],processor:[s.AutoProcessor,null],default:{model:"Xenova/speecht5_tts"},type:"text"},"image-to-text":{tokenizer:n.AutoTokenizer,pipeline:E,model:o.AutoModelForVision2Seq,processor:s.AutoProcessor,default:{model:"Xenova/vit-gpt2-image-captioning"},type:"multimodal"},"image-classification":{pipeline:L,model:o.AutoModelForImageClassification,processor:s.AutoProcessor,default:{model:"Xenova/vit-base-patch16-224"},type:"multimodal"},"image-segmentation":{pipeline:z,model:[o.AutoModelForImageSegmentation,o.AutoModelForSemanticSegmentation,o.AutoModelForUniversalSegmentation],processor:s.AutoProcessor,default:{model:"Xenova/detr-resnet-50-panoptic"},type:"multimodal"},"zero-shot-image-classification":{tokenizer:n.AutoTokenizer,pipeline:I,model:o.AutoModel,processor:s.AutoProcessor,default:{model:"Xenova/clip-vit-base-patch32"},type:"multimodal"},"object-detection":{pipeline:B,model:o.AutoModelForObjectDetection,processor:s.AutoProcessor,default:{model:"Xenova/detr-resnet-50"},type:"multimodal"},"zero-shot-object-detection":{tokenizer:n.AutoTokenizer,pipeline:N,model:o.AutoModelForZeroShotObjectDetection,processor:s.AutoProcessor,default:{model:"Xenova/owlvit-base-patch32"},type:"multimodal"},"document-question-answering":{tokenizer:n.AutoTokenizer,pipeline:D,model:o.AutoModelForDocumentQuestionAnswering,processor:s.AutoProcessor,default:{model:"Xenova/donut-base-finetuned-docvqa"},type:"multimodal"},"image-to-image":{pipeline:V,model:o.AutoModelForImageToImage,processor:s.AutoProcessor,default:{model:"Xenova/swin2SR-classical-sr-x2-64"},type:"image"},"depth-estimation":{pipeline:j,model:o.AutoModelForDepthEstimation,processor:s.AutoProcessor,default:{model:"Xenova/dpt-large"},type:"image"},"feature-extraction":{tokenizer:n.AutoTokenizer,pipeline:P,model:o.AutoModel,default:{model:"Xenova/all-MiniLM-L6-v2"},type:"text"},"image-feature-extraction":{processor:s.AutoProcessor,pipeline:C,model:[o.AutoModelForImageFeatureExtraction,o.AutoModel],default:{model:"Xenova/vit-base-patch16-224-in21k"},type:"image"}}),G=Object.freeze({"sentiment-analysis":"text-classification",ner:"token-classification",asr:"automatic-speech-recognition","text-to-speech":"text-to-audio",embeddings:"feature-extraction"});async function q(e,t=null,{progress_callback:r=null,config:n=null,cache_dir:o=null,local_files_only:s=!1,revision:a="main",device:l=null,dtype:c=null,model_file_name:d=null,session_options:u={}}={}){e=G[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:r,config:n,cache_dir:o,local_files_only:s,revision:a,device:l,dtype:c,model_file_name:d,session_options:u},m=new Map([["tokenizer",p.tokenizer],["model",p.model],["processor",p.processor]]),_=await async function(e,t,r){const n=Object.create(null),o=[];for(const[s,a]of e.entries()){if(!a)continue;let e;e=Array.isArray(a)?new Promise((async(e,n)=>{let o;for(const s of a){if(null===s)return void e(null);try{return void e(await s.from_pretrained(t,r))}catch(e){if(e.message?.includes("Unsupported model type"))o=e;else{if(!e.message?.includes("Could not locate file"))return void n(e);o=e}}}n(o)})):a.from_pretrained(t,r),n[s]=e,o.push(e)}await Promise.all(o);for(const[e,t]of Object.entries(n))n[e]=await t;return n}(m,t,h);_.task=e,(0,i.dispatchCallback)(r,{status:"ready",task:e,model:t});return new(0,p.pipeline)(_)}},"./src/processors.js":
125
125
  /*!***************************!*\
126
126
  !*** ./src/processors.js ***!
127
- \***************************/(e,t,r)=>{r.r(t),r.d(t,{ASTFeatureExtractor:()=>se,AutoProcessor:()=>Me,BeitFeatureExtractor:()=>X,BitImageProcessor:()=>P,CLIPFeatureExtractor:()=>v,CLIPImageProcessor:()=>S,ChineseCLIPFeatureExtractor:()=>A,ClapFeatureExtractor:()=>ae,ConvNextFeatureExtractor:()=>L,ConvNextImageProcessor:()=>z,DPTFeatureExtractor:()=>k,DPTImageProcessor:()=>F,DeiTFeatureExtractor:()=>U,DetrFeatureExtractor:()=>Y,DonutFeatureExtractor:()=>Q,EfficientNetImageProcessor:()=>N,FeatureExtractor:()=>w,Florence2Processor:()=>ge,GLPNFeatureExtractor:()=>C,ImageFeatureExtractor:()=>T,MaskFormerFeatureExtractor:()=>J,MobileNetV1FeatureExtractor:()=>D,MobileNetV2FeatureExtractor:()=>O,MobileNetV3FeatureExtractor:()=>V,MobileNetV4FeatureExtractor:()=>j,MobileViTFeatureExtractor:()=>R,MobileViTImageProcessor:()=>G,NougatImageProcessor:()=>H,OwlViTFeatureExtractor:()=>q,OwlViTProcessor:()=>fe,Owlv2ImageProcessor:()=>W,Processor:()=>de,PvtImageProcessor:()=>y,PyAnnoteFeatureExtractor:()=>ie,PyAnnoteProcessor:()=>me,RTDetrImageProcessor:()=>$,SamImageProcessor:()=>Z,SamProcessor:()=>ue,SapiensFeatureExtractor:()=>b,SeamlessM4TFeatureExtractor:()=>oe,SegformerFeatureExtractor:()=>x,SiglipImageProcessor:()=>E,SpeechT5FeatureExtractor:()=>ce,SpeechT5Processor:()=>_e,Swin2SRImageProcessor:()=>ee,ViTFeatureExtractor:()=>I,ViTImageProcessor:()=>B,VitMatteImageProcessor:()=>te,Wav2Vec2FeatureExtractor:()=>ne,Wav2Vec2ProcessorWithLM:()=>he,WeSpeakerFeatureExtractor:()=>le,WhisperFeatureExtractor:()=>re,WhisperProcessor:()=>pe,YolosFeatureExtractor:()=>K});var n=r(/*! ./utils/generic.js */"./src/utils/generic.js"),o=r(/*! ./utils/core.js */"./src/utils/core.js"),s=r(/*! ./utils/hub.js */"./src/utils/hub.js"),a=r(/*! ./utils/maths.js */"./src/utils/maths.js"),i=r(/*! ./utils/tensor.js */"./src/utils/tensor.js"),l=(r(/*! ./utils/image.js */"./src/utils/image.js"),r(/*! ./utils/audio.js */"./src/utils/audio.js"));function c([e,t,r,n]){return[e-r/2,t-n/2,e+r/2,t+n/2]}function d(e,t=.5,r=null,n=!1){const o=e.logits,s=e.pred_boxes,[i,l,d]=o.dims;if(null!==r&&r.length!==i)throw Error("Make sure that you pass in as many target sizes as the batch dimension of the logits");let u=[];for(let e=0;e<i;++e){let i=null!==r?r[e]:null,p={boxes:[],classes:[],scores:[]},h=o[e],m=s[e];for(let e=0;e<l;++e){let r,o=h[e],s=[];if(n){r=o.sigmoid().data;for(let e=0;e<r.length;++e)r[e]>t&&s.push(e)}else{let e=(0,a.max)(o.data)[1];if(e===d-1)continue;if(r=(0,a.softmax)(o.data),r[e]<t)continue;s.push(e)}for(const t of s){let n=m[e].data;n=c(n),null!==i&&(n=n.map(((e,t)=>e*i[(t+1)%2]))),p.boxes.push(n),p.classes.push(t),p.scores.push(r[t])}}u.push(p)}return u}function u(e,t=null){const r=e.logits,n=r.dims[0];if(null!==t&&t.length!==n)throw Error("Make sure that you pass in as many target sizes as the batch dimension of the logits");const o=[];for(let e=0;e<n;++e){const n=null!==t?t[e]:null;let s=r[e];null!==n&&(s=(0,i.interpolate)(s,n,"bilinear",!1));const[a,l]=n??s.dims.slice(-2),c=new i.Tensor("int32",new Int32Array(a*l),[a,l]),d=s[0].data,u=c.data;for(let e=1;e<s.dims[0];++e){const t=s[e].data;for(let r=0;r<t.length;++r)t[r]>d[r]&&(d[r]=t[r],u[r]=e)}const p=new Array(s.dims[0]);for(let e=0;e<u.length;++e){const t=u[e];p[t]=t}const h=p.filter((e=>void 0!==e));o.push({segmentation:c,labels:h})}return o}function p(e,t,r,n){const o=[],s=[],i=[];for(let l=0;l<e.dims[0];++l){const c=e[l],d=t[l],u=(0,a.max)(c.data)[1];if(u===n)continue;const p=(0,a.softmax)(c.data)[u];p>r&&(o.push(d),s.push(p),i.push(u))}return[o,s,i]}function h(e,t,r,n=.5,o=.8){const s=[];let a=0,i=0;const l=t[r].data;for(let t=0;t<e.length;++t)e[t]===r&&(s.push(t),++a),l[t]>=n&&++i;let c=a>0&&i>0;if(c){c=a/i>o}return[c,s]}function m(e,t,r,n,o,s=null,a=null){const[l,c]=a??e[0].dims,d=new i.Tensor("int32",new Int32Array(l*c),[l,c]),u=[];if(null!==a)for(let t=0;t<e.length;++t)e[t]=(0,i.interpolate)(e[t],a,"bilinear",!1);const p=new Int32Array(e[0].data.length),m=new Float32Array(e[0].data.length);for(let r=0;r<e.length;++r){let n=t[r];const o=e[r].data;for(let e=0;e<o.length;++e)o[e]*=n,o[e]>m[e]&&(p[e]=r,m[e]=o[e])}let _=0;const f=d.data;for(let s=0;s<r.length;++s){const a=r[s],[i,l]=h(p,e,s,n,o);if(i){++_;for(const e of l)f[e]=_;u.push({id:_,label_id:a,score:t[s]})}}return[d,u]}function _(e,t=.5,r=.5,n=.8,o=null,s=null){null===o&&(console.warn("`label_ids_to_fuse` unset. No instance will be fused."),o=new Set);const a=e.class_queries_logits??e.logits,l=(e.masks_queries_logits??e.pred_masks).sigmoid();let[c,d,u]=a.dims;if(u-=1,null!==s&&s.length!==c)throw Error("Make sure that you pass in as many target sizes as the batch dimension of the logits");let h=[];for(let e=0;e<c;++e){let c=null!==s?s[e]:null,d=a[e],_=l[e],[f,g,M]=p(d,_,t,u);if(0===M.length){let[e,t]=c??_.dims.slice(-2),r=new i.Tensor("int32",new Int32Array(e*t).fill(-1),[e,t]);h.push({segmentation:r,segments_info:[]});continue}let[w,T]=m(f,g,M,r,n,o,c);h.push({segmentation:w,segments_info:T})}return h}function f(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.`)}function g(e,t,r=0,n=null){const o=e/t;let s=(0,a.bankers_round)(o)*t;return null!==n&&s>n&&(s=Math.floor(o)*t),s<r&&(s=Math.ceil(o)*t),s}function M([e,t],r){return[Math.max(Math.floor(e/r),1)*r,Math.max(Math.floor(t/r),1)*r]}class w extends n.Callable{constructor(e){super(),this.config=e}}class T extends w{constructor(e){super(e),this.image_mean=this.config.image_mean??this.config.mean,this.image_std=this.config.image_std??this.config.std,this.resample=this.config.resample??2,this.do_rescale=this.config.do_rescale??!0,this.rescale_factor=this.config.rescale_factor??1/255,this.do_normalize=this.config.do_normalize,this.do_resize=this.config.do_resize,this.do_thumbnail=this.config.do_thumbnail,this.size=this.config.size,this.size_divisibility=this.config.size_divisibility??this.config.size_divisor,this.do_center_crop=this.config.do_center_crop,this.crop_size=this.config.crop_size,this.do_convert_rgb=this.config.do_convert_rgb??!0,this.do_crop_margin=this.config.do_crop_margin,this.pad_size=this.config.pad_size,this.do_pad=this.config.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=this.config.do_flip_channel_order??!1}async thumbnail(e,t,r=2){const n=e.height,o=e.width,s=t.height,a=t.width;let i=Math.min(n,s),l=Math.min(o,a);return i===n&&l===o?e:(n>o?l=Math.floor(o*i/n):o>n&&(i=Math.floor(n*l/o)),await e.resize(l,i,{resample:r}))}async crop_margin(e,t=200){const r=e.clone().grayscale(),n=(0,a.min)(r.data)[0],o=(0,a.max)(r.data)[0]-n;if(0===o)return e;const s=t/255;let i=r.width,l=r.height,c=0,d=0;const u=r.data;for(let e=0;e<r.height;++e){const t=e*r.width;for(let a=0;a<r.width;++a)(u[t+a]-n)/o<s&&(i=Math.min(i,a),l=Math.min(l,e),c=Math.max(c,a),d=Math.max(d,e))}return e=await e.crop([i,l,c,d])}pad_image(e,t,r,{mode:n="constant",center:s=!1,constant_values:a=0}={}){const[i,l,c]=t;let d,u;if("number"==typeof r?(d=r,u=r):(d=r.width,u=r.height),d!==l||u!==i){const r=new Float32Array(d*u*c);if(Array.isArray(a))for(let e=0;e<r.length;++e)r[e]=a[e%c];else 0!==a&&r.fill(a);const[p,h]=s?[Math.floor((d-l)/2),Math.floor((u-i)/2)]:[0,0];for(let t=0;t<i;++t){const n=(t+h)*d,o=t*l;for(let t=0;t<l;++t){const s=(n+t+p)*c,a=(o+t)*c;for(let t=0;t<c;++t)r[s+t]=e[a+t]}}if("symmetric"===n){if(s)throw new Error("`center` padding is not supported when `mode` is set to `symmetric`.");const t=i-1,n=l-1;for(let s=0;s<u;++s){const a=s*d,u=(0,o.calculateReflectOffset)(s,t)*l;for(let t=0;t<d;++t){if(s<i&&t<l)continue;const d=(a+t)*c,p=(u+(0,o.calculateReflectOffset)(t,n))*c;for(let t=0;t<c;++t)r[d+t]=e[p+t]}}}e=r,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[r,n]=e.size;let o,s;if(this.do_thumbnail){const{height:e,width:r}=t;o=Math.min(e,r)}else Number.isInteger(t)?(o=t,s=this.config.max_size??o):void 0!==t&&(o=t.shortest_edge,s=t.longest_edge);if(void 0!==o||void 0!==s){const e=void 0===o?1:Math.max(o/r,o/n),t=r*e,a=n*e,i=void 0===s?1:Math.min(s/t,s/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]=M([l,c],this.size_divisibility)),[l,c]}if(void 0!==t&&void 0!==t.width&&void 0!==t.height){let e=t.width,o=t.height;if(this.config.keep_aspect_ratio&&this.config.ensure_multiple_of){let t=o/n,s=e/r;Math.abs(1-s)<Math.abs(1-t)?t=s:s=t,o=g(t*n,this.config.ensure_multiple_of),e=g(s*r,this.config.ensure_multiple_of)}return[e,o]}if(void 0!==this.size_divisibility)return M([r,n],this.size_divisibility);throw new Error(`Could not resize image due to unsupported \`this.size\` option in config: ${JSON.stringify(t)}`)}async resize(e){const[t,r]=this.get_resize_output_image_size(e,this.size);return await e.resize(t,r,{resample:this.resample})}async preprocess(e,{do_normalize:t=null,do_pad:r=null,do_convert_rgb:n=null,do_convert_grayscale:o=null,do_flip_channel_order:s=null}={}){this.do_crop_margin&&(e=await this.crop_margin(e));const[a,l]=e.size;if(n??this.do_convert_rgb?e=e.rgb():o&&(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,r;Number.isInteger(this.crop_size)?(t=this.crop_size,r=this.crop_size):(t=this.crop_size.width,r=this.crop_size.height),e=await e.center_crop(t,r)}const c=[e.height,e.width];let d=Float32Array.from(e.data),u=[e.height,e.width,e.channels];if(this.do_rescale&&this.rescale(d),t??this.do_normalize){let t=this.image_mean;Array.isArray(this.image_mean)||(t=new Array(e.channels).fill(t));let r=this.image_std;if(Array.isArray(this.image_std)||(r=new Array(e.channels).fill(t)),t.length!==e.channels||r.length!==e.channels)throw new Error(`When set to arrays, the length of \`image_mean\` (${t.length}) and \`image_std\` (${r.length}) must match the number of channels in the image (${e.channels}).`);for(let n=0;n<d.length;n+=e.channels)for(let o=0;o<e.channels;++o)d[n+o]=(d[n+o]-t[o])/r[o]}if(r??this.do_pad)if(this.pad_size){const t=this.pad_image(d,[e.height,e.width,e.channels],this.pad_size);[d,u]=t}else if(this.size_divisibility){const[e,t]=M([u[1],u[0]],this.size_divisibility);[d,u]=this.pad_image(d,u,{width:e,height:t})}if(s??this.do_flip_channel_order){if(3!==u[2])throw new Error("Flipping channel order is only supported for RGB images.");for(let e=0;e<d.length;e+=3){const t=d[e];d[e]=d[e+2],d[e+2]=t}}return{original_size:[l,a],reshaped_input_size:c,pixel_values:new i.Tensor("float32",d,u).permute(2,0,1)}}async _call(e,...t){Array.isArray(e)||(e=[e]);const r=await Promise.all(e.map((e=>this.preprocess(e))));return{pixel_values:(0,i.stack)(r.map((e=>e.pixel_values)),0),original_sizes:r.map((e=>e.original_size)),reshaped_input_sizes:r.map((e=>e.reshaped_input_size))}}}class b extends T{post_process_semantic_segmentation(...e){return u(...e)}}class x extends T{post_process_semantic_segmentation(...e){return u(...e)}}class y extends T{}class k extends T{}class F extends k{}class P extends T{}class C extends T{}class v extends T{}class S extends v{}class A extends T{}class E extends T{}class L extends T{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 r=Math.floor(t/this.crop_pct),[n,o]=this.get_resize_output_image_size(e,{shortest_edge:r});e=await e.resize(n,o,{resample:this.resample}),e=await e.center_crop(t,t)}else e=await e.resize(t,t,{resample:this.resample});return e}}class z extends L{}class I extends T{}class B extends T{}class N extends T{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)))}}class D extends T{}class O extends T{}class V extends T{}class j extends T{}class R extends T{}class G extends R{}class q extends T{post_process_object_detection(...e){return d(...e)}}class W extends q{}class $ extends T{post_process_object_detection(...e){return d(...e)}}class U extends T{}class X extends T{}class Q extends T{pad_image(e,t,r,n={}){const[o,s,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,r,{center:!0,constant_values:c,...n})}}class H extends Q{}class Y extends T{async _call(e){const t=await super._call(e),r=[t.pixel_values.dims[0],64,64],n=(0,i.full)(r,1n);return{...t,pixel_mask:n}}post_process_object_detection(...e){return d(...e)}post_process_panoptic_segmentation(...e){return _(...e)}post_process_instance_segmentation(){throw Error("Not implemented yet")}}class J extends T{post_process_panoptic_segmentation(...e){return _(...e)}post_process_instance_segmentation(){throw Error("Not implemented yet")}}class K extends T{post_process_object_detection(...e){return d(...e)}}class Z extends T{reshape_input_points(e,t,r,n=!1){e=structuredClone(e);let s=(0,o.calculateDimensions)(e);if(3===s.length)n||(s=[1,...s]),e=[e];else if(4!==s.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 n=0;n<e.length;++n){let o=t[n],s=r[n],a=[s[0]/o[0],s[1]/o[1]];for(let t=0;t<e[n].length;++t)for(let r=0;r<e[n][t].length;++r)for(let o=0;o<e[n][t][r].length;++o)e[n][t][r][o]*=a[o%2]}return new i.Tensor("float32",Float32Array.from(e.flat(1/0)),s)}add_input_labels(e,t){let r=(0,o.calculateDimensions)(e);if(2===r.length)r=[1,...r],e=[e];else if(3!==r.length)throw Error("The input_points must be a 4D tensor of shape `batch_size`, `point_batch_size`, `nb_points_per_image`, `2`.");if(r.some(((e,r)=>e!==t.dims[r])))throw Error(`The first ${r.length} dimensions of 'input_points' and 'input_labels' must be the same.`);return new i.Tensor("int64",e.flat(1/0).map(BigInt),r)}async _call(e,{input_points:t=null,input_labels:r=null,input_boxes:n=null}={}){const o=await super._call(e);if(t&&(o.input_points=this.reshape_input_points(t,o.original_sizes,o.reshaped_input_sizes)),r){if(!o.input_points)throw Error("`input_points` must be provided if `input_labels` are provided.");o.input_labels=this.add_input_labels(r,o.input_points)}return n&&(o.input_boxes=this.reshape_input_points(n,o.original_sizes,o.reshaped_input_sizes,!0)),o}async post_process_masks(e,t,r,{mask_threshold:n=0,binarize:o=!0,pad_size:s=null}={}){const a=[],l=[(s=s??this.pad_size).height,s.width];for(let s=0;s<t.length;++s){const c=t[s],d=r[s];let u=await(0,i.interpolate_4d)(e[s],{mode:"bilinear",size:l});if(u=u.slice(null,null,[0,d[0]],[0,d[1]]),u=await(0,i.interpolate_4d)(u,{mode:"bilinear",size:c}),o){const e=u.data,t=new Uint8Array(e.length);for(let r=0;r<e.length;++r)e[r]>n&&(t[r]=1);u=new i.Tensor("bool",t,u.dims)}a.push(u)}return a}generate_crop_boxes(e,t,{crop_n_layers:r=0,overlap_ratio:n=512/1500,points_per_crop:o=32,crop_n_points_downscale_factor:s=1}={}){}}class ee extends T{pad_image(e,t,r,n={}){const[o,s,a]=t;return super.pad_image(e,t,{width:s+(r-s%r)%r,height:o+(r-o%r)%r},{mode:"symmetric",center:!1,constant_values:-1,...n})}}class te extends T{async _call(e,t){Array.isArray(e)||(e=[e]),Array.isArray(t)||(t=[t]);const r=await Promise.all(e.map((e=>this.preprocess(e)))),n=await Promise.all(t.map((e=>this.preprocess(e,{do_normalize:!1,do_convert_rgb:!1,do_convert_grayscale:!0}))));return{pixel_values:(0,i.stack)(r.map(((e,t)=>(0,i.cat)([e.pixel_values,n[t].pixel_values],0))),0),original_sizes:r.map((e=>e.original_size)),reshaped_input_sizes:r.map((e=>e.reshaped_input_size))}}}class re extends w{constructor(e){super(e),this.config.mel_filters??=(0,l.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,l.window_function)(this.config.n_fft,"hann")}async _extract_fbank_features(e){const t=await(0,l.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:this.config.nb_max_frames}),r=t.data,n=(0,a.max)(r)[0];for(let e=0;e<r.length;++e)r[e]=(Math.max(r[e],n-8)+4)/4;return t}async _call(e){let t;f(e,"WhisperFeatureExtractor"),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`."),t=e.slice(0,this.config.n_samples)):(t=new Float32Array(this.config.n_samples),t.set(e));return{input_features:(await this._extract_fbank_features(t)).unsqueeze_(0)}}}class ne extends w{_zero_mean_unit_var_norm(e){const t=e.reduce(((e,t)=>e+t),0)/e.length,r=e.reduce(((e,r)=>e+(r-t)**2),0)/e.length;return e.map((e=>(e-t)/Math.sqrt(r+1e-7)))}async _call(e){f(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 r=[1,t.length];return{input_values:new i.Tensor("float32",t,r),attention_mask:new i.Tensor("int64",new BigInt64Array(t.length).fill(1n),r)}}}class oe extends w{constructor(e){super(e);const t=this.config.sampling_rate,r=(0,l.mel_filter_bank)(256,this.config.num_mel_bins,20,Math.floor(t/2),t,null,"kaldi",!0);for(let e=0;e<r.length;++e)r[e].push(0);this.mel_filters=r,this.window=(0,l.window_function)(400,"povey",{periodic:!1})}async _extract_fbank_features(e,t){return e=e.map((e=>32768*e)),(0,l.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:r=2,do_normalize_per_mel_bins:n=!0,return_attention_mask:o=!0}={}){f(e,"SeamlessM4TFeatureExtractor");let s,a=await this._extract_fbank_features(e,this.config.max_length);if(n){const[e,t]=a.dims,r=a.data;for(let n=0;n<t;++n){let o=0;for(let s=0;s<e;++s)o+=r[s*t+n];const s=o/e;let a=0;for(let o=0;o<e;++o)a+=(r[o*t+n]-s)**2;a/=e-1;const i=Math.sqrt(a+1e-7);for(let o=0;o<e;++o){const e=o*t+n;r[e]=(r[e]-s)/i}}}if(t){const[e,t]=a.dims,n=a.data,l=e%r;if(l>0){const r=new Float32Array(t*(e+l));r.set(n),r.fill(this.config.padding_value,n.length);const c=e+l;a=new i.Tensor(a.type,r,[c,t]),o&&(s=new i.Tensor("int64",new BigInt64Array(c),[1,c]),s.data.fill(1n,0,e))}}const[l,c]=a.dims,d=this.config.stride;if(0!==l%d)throw new Error(`The number of frames (${l}) must be a multiple of the stride (${d}).`);const u=a.view(1,Math.floor(l/d),c*d),p={input_features:u};if(o){const e=u.dims[1],t=new BigInt64Array(e);if(s){const e=s.data;for(let r=1,n=0;r<l;r+=d,++n)t[n]=e[r]}else t.fill(1n);p.attention_mask=new i.Tensor("int64",t,[1,e])}return p}}class se extends w{constructor(e){super(e);const t=this.config.sampling_rate,r=(0,l.mel_filter_bank)(256,this.config.num_mel_bins,20,Math.floor(t/2),t,null,"kaldi",!0);for(let e=0;e<r.length;++e)r[e].push(0);this.mel_filters=r,this.window=(0,l.window_function)(400,"hann",{periodic:!1}),this.mean=this.config.mean,this.std=this.config.std}async _extract_fbank_features(e,t){return(0,l.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){f(e,"ASTFeatureExtractor");const t=await this._extract_fbank_features(e,this.config.max_length);if(this.config.do_normalize){const e=2*this.std,r=t.data;for(let t=0;t<r.length;++t)r[t]=(r[t]-this.mean)/e}return{input_values:t.unsqueeze_(0)}}}class ae extends w{constructor(e){super(e),this.mel_filters=(0,l.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,l.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,l.window_function)(this.config.fft_window_size,"hann")}async _get_input_mel(e,t,r,n){let o,s=!1;const a=e.length-t;if(a>0){if("rand_trunc"!==r)throw new Error(`Truncation strategy "${r}" not implemented`);{s=!0;const r=Math.floor(Math.random()*(a+1));e=e.subarray(r,r+t),o=await this._extract_fbank_features(e,this.mel_filters_slaney,this.config.nb_max_samples)}}else{if(a<0){let r=new Float64Array(t);if(r.set(e),"repeat"===n)for(let n=e.length;n<t;n+=e.length)r.set(e.subarray(0,Math.min(e.length,t-n)),n);else if("repeatpad"===n)for(let t=e.length;t<-a;t+=e.length)r.set(e,t);e=r}if("fusion"===r)throw new Error(`Truncation strategy "${r}" not implemented`);o=await this._extract_fbank_features(e,this.mel_filters_slaney,this.config.nb_max_samples)}return o.unsqueeze_(0)}async _extract_fbank_features(e,t,r=null){return(0,l.spectrogram)(e,this.window,this.config.fft_window_size,this.config.hop_length,{power:2,mel_filters:t,log_mel:"dB",max_num_frames:r,do_pad:!1,transpose:!0})}async _call(e,{max_length:t=null}={}){f(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)}}}class ie extends w{async _call(e){f(e,"PyAnnoteFeatureExtractor"),e instanceof Float64Array&&(e=new Float32Array(e));const t=[1,1,e.length];return{input_values:new i.Tensor("float32",e,t)}}samples_to_frames(e){return(e-this.config.offset)/this.config.step}post_process_speaker_diarization(e,t){const r=t/this.samples_to_frames(t)/this.config.sampling_rate,n=[];for(const t of e.tolist()){const e=[];let o=-1;for(let r=0;r<t.length;++r){const n=(0,a.softmax)(t[r]),[s,i]=(0,a.max)(n),[l,c]=[r,r+1];i!==o?(o=i,e.push({id:i,start:l,end:c,score:s})):(e.at(-1).end=c,e.at(-1).score+=s)}n.push(e.map((({id:e,start:t,end:n,score:o})=>({id:e,start:t*r,end:n*r,confidence:o/(n-t)}))))}return n}}class le extends w{constructor(e){super(e);const t=this.config.sampling_rate,r=(0,l.mel_filter_bank)(256,this.config.num_mel_bins,20,Math.floor(t/2),t,null,"kaldi",!0);for(let e=0;e<r.length;++e)r[e].push(0);this.mel_filters=r,this.window=(0,l.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,l.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){f(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,r=t.data,[n,o,s]=t.dims;for(let t=0;t<n;++t){const n=t*o*s,a=t*s;for(let t=0;t<o;++t){const o=n+t*s;for(let t=0;t<s;++t)r[o+t]-=e[a+t]}}}return{input_features:t}}}class ce extends w{}class de extends n.Callable{constructor(e){super(),this.feature_extractor=e}async _call(e,...t){return await this.feature_extractor(e,...t)}}class ue extends de{async _call(...e){return await this.feature_extractor(...e)}post_process_masks(...e){return this.feature_extractor.post_process_masks(...e)}reshape_input_points(...e){return this.feature_extractor.reshape_input_points(...e)}}class pe extends de{async _call(e){return await this.feature_extractor(e)}}class he extends de{async _call(e){return await this.feature_extractor(e)}}class me extends de{async _call(e){return await this.feature_extractor(e)}post_process_speaker_diarization(...e){return this.feature_extractor.post_process_speaker_diarization(...e)}}class _e extends de{async _call(e){return await this.feature_extractor(e)}}class fe extends de{}class ge extends de{constructor(e){super(e);const{tasks_answer_post_processing_type:t,task_prompts_without_inputs:r,task_prompts_with_input:n}=e.config;this.tasks_answer_post_processing_type=new Map(Object.entries(t??{})),this.task_prompts_without_inputs=new Map(Object.entries(r??{})),this.task_prompts_with_input=new Map(Object.entries(n??{})),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 r of e)if(this.task_prompts_without_inputs.has(r))t.push(this.task_prompts_without_inputs.get(r));else{for(const[e,n]of this.task_prompts_with_input)if(r.includes(e)){t.push(n.replaceAll("{input}",r).replaceAll(e,""));break}t.length!==e.length&&t.push(r)}return t}post_process_generation(e,t,r){const n=this.tasks_answer_post_processing_type.get(t)??"pure_text";let o;switch(e=e.replaceAll("<s>","").replaceAll("</s>",""),n){case"pure_text":o=e;break;case"description_with_bboxes":case"bboxes":case"phrase_grounding":case"ocr":const s="ocr"===n?"quad_boxes":"bboxes",a=e.matchAll(this.regexes[s]),i=[],l=[];for(const[e,t,...n]of a)i.push(t?t.trim():i.at(-1)??""),l.push(n.map(((e,t)=>(Number(e)+.5)/this.size_per_bin*r[t%2])));o={labels:i,[s]:l};break;default:throw new Error(`Task "${t}" (of type "${n}") not yet implemented.`)}return{[t]:o}}}class Me{static FEATURE_EXTRACTOR_CLASS_MAPPING={ImageFeatureExtractor:T,WhisperFeatureExtractor:re,ViTFeatureExtractor:I,MobileViTFeatureExtractor:R,MobileViTImageProcessor:G,MobileNetV1FeatureExtractor:D,MobileNetV2FeatureExtractor:O,MobileNetV3FeatureExtractor:V,MobileNetV4FeatureExtractor:j,OwlViTFeatureExtractor:q,Owlv2ImageProcessor:W,CLIPFeatureExtractor:v,CLIPImageProcessor:S,Florence2Processor:ge,ChineseCLIPFeatureExtractor:A,SiglipImageProcessor:E,ConvNextFeatureExtractor:L,ConvNextImageProcessor:z,SegformerFeatureExtractor:x,SapiensFeatureExtractor:b,BitImageProcessor:P,DPTImageProcessor:F,DPTFeatureExtractor:k,PvtImageProcessor:y,GLPNFeatureExtractor:C,BeitFeatureExtractor:X,DeiTFeatureExtractor:U,DetrFeatureExtractor:Y,RTDetrImageProcessor:$,MaskFormerFeatureExtractor:J,YolosFeatureExtractor:K,DonutFeatureExtractor:Q,NougatImageProcessor:H,EfficientNetImageProcessor:N,ViTImageProcessor:B,VitMatteImageProcessor:te,SamImageProcessor:Z,Swin2SRImageProcessor:ee,Wav2Vec2FeatureExtractor:ne,SeamlessM4TFeatureExtractor:oe,SpeechT5FeatureExtractor:ce,ASTFeatureExtractor:se,ClapFeatureExtractor:ae,PyAnnoteFeatureExtractor:ie,WeSpeakerFeatureExtractor:le};static PROCESSOR_CLASS_MAPPING={WhisperProcessor:pe,Wav2Vec2ProcessorWithLM:he,PyAnnoteProcessor:me,SamProcessor:ue,SpeechT5Processor:_e,OwlViTProcessor:fe,Florence2Processor:ge};static async from_pretrained(e,{progress_callback:t=null,config:r=null,cache_dir:n=null,local_files_only:o=!1,revision:a="main"}={}){let i=r??await(0,s.getModelJSON)(e,"preprocessor_config.json",!0,{progress_callback:t,config:r,cache_dir:n,local_files_only:o,revision:a}),l=i.feature_extractor_type??i.image_processor_type,c=this.FEATURE_EXTRACTOR_CLASS_MAPPING[l];if(!c){if(void 0===i.size)throw new Error(`Unknown Feature Extractor type: ${l}`);console.warn(`Feature extractor type "${l}" not found, assuming ImageFeatureExtractor due to size parameter in config.`),c=T}return new(this.PROCESSOR_CLASS_MAPPING[i.processor_class]??de)(new c(i))}}},"./src/tokenizers.js":
127
+ \***************************/(e,t,r)=>{r.r(t),r.d(t,{ASTFeatureExtractor:()=>ae,AutoProcessor:()=>we,BeitFeatureExtractor:()=>X,BitImageProcessor:()=>P,CLIPFeatureExtractor:()=>v,CLIPImageProcessor:()=>S,ChineseCLIPFeatureExtractor:()=>A,ClapFeatureExtractor:()=>ie,ConvNextFeatureExtractor:()=>L,ConvNextImageProcessor:()=>z,DPTFeatureExtractor:()=>k,DPTImageProcessor:()=>F,DeiTFeatureExtractor:()=>U,DetrFeatureExtractor:()=>J,DonutFeatureExtractor:()=>Q,DonutImageProcessor:()=>H,EfficientNetImageProcessor:()=>N,FeatureExtractor:()=>w,Florence2Processor:()=>Me,GLPNFeatureExtractor:()=>C,ImageFeatureExtractor:()=>T,MaskFormerFeatureExtractor:()=>K,MobileNetV1FeatureExtractor:()=>D,MobileNetV2FeatureExtractor:()=>O,MobileNetV3FeatureExtractor:()=>V,MobileNetV4FeatureExtractor:()=>j,MobileViTFeatureExtractor:()=>R,MobileViTImageProcessor:()=>G,NougatImageProcessor:()=>Y,OwlViTFeatureExtractor:()=>q,OwlViTProcessor:()=>ge,Owlv2ImageProcessor:()=>$,Processor:()=>ue,PvtImageProcessor:()=>y,PyAnnoteFeatureExtractor:()=>le,PyAnnoteProcessor:()=>_e,RTDetrImageProcessor:()=>W,SamImageProcessor:()=>ee,SamProcessor:()=>pe,SapiensFeatureExtractor:()=>b,SeamlessM4TFeatureExtractor:()=>se,SegformerFeatureExtractor:()=>x,SiglipImageProcessor:()=>E,SpeechT5FeatureExtractor:()=>de,SpeechT5Processor:()=>fe,Swin2SRImageProcessor:()=>te,ViTFeatureExtractor:()=>I,ViTImageProcessor:()=>B,VitMatteImageProcessor:()=>re,Wav2Vec2FeatureExtractor:()=>oe,Wav2Vec2ProcessorWithLM:()=>me,WeSpeakerFeatureExtractor:()=>ce,WhisperFeatureExtractor:()=>ne,WhisperProcessor:()=>he,YolosFeatureExtractor:()=>Z});var n=r(/*! ./utils/generic.js */"./src/utils/generic.js"),o=r(/*! ./utils/core.js */"./src/utils/core.js"),s=r(/*! ./utils/hub.js */"./src/utils/hub.js"),a=r(/*! ./utils/maths.js */"./src/utils/maths.js"),i=r(/*! ./utils/tensor.js */"./src/utils/tensor.js"),l=(r(/*! ./utils/image.js */"./src/utils/image.js"),r(/*! ./utils/audio.js */"./src/utils/audio.js"));function c([e,t,r,n]){return[e-r/2,t-n/2,e+r/2,t+n/2]}function d(e,t=.5,r=null,n=!1){const o=e.logits,s=e.pred_boxes,[i,l,d]=o.dims;if(null!==r&&r.length!==i)throw Error("Make sure that you pass in as many target sizes as the batch dimension of the logits");let u=[];for(let e=0;e<i;++e){let i=null!==r?r[e]:null,p={boxes:[],classes:[],scores:[]},h=o[e],m=s[e];for(let e=0;e<l;++e){let r,o=h[e],s=[];if(n){r=o.sigmoid().data;for(let e=0;e<r.length;++e)r[e]>t&&s.push(e)}else{let e=(0,a.max)(o.data)[1];if(e===d-1)continue;if(r=(0,a.softmax)(o.data),r[e]<t)continue;s.push(e)}for(const t of s){let n=m[e].data;n=c(n),null!==i&&(n=n.map(((e,t)=>e*i[(t+1)%2]))),p.boxes.push(n),p.classes.push(t),p.scores.push(r[t])}}u.push(p)}return u}function u(e,t=null){const r=e.logits,n=r.dims[0];if(null!==t&&t.length!==n)throw Error("Make sure that you pass in as many target sizes as the batch dimension of the logits");const o=[];for(let e=0;e<n;++e){const n=null!==t?t[e]:null;let s=r[e];null!==n&&(s=(0,i.interpolate)(s,n,"bilinear",!1));const[a,l]=n??s.dims.slice(-2),c=new i.Tensor("int32",new Int32Array(a*l),[a,l]),d=s[0].data,u=c.data;for(let e=1;e<s.dims[0];++e){const t=s[e].data;for(let r=0;r<t.length;++r)t[r]>d[r]&&(d[r]=t[r],u[r]=e)}const p=new Array(s.dims[0]);for(let e=0;e<u.length;++e){const t=u[e];p[t]=t}const h=p.filter((e=>void 0!==e));o.push({segmentation:c,labels:h})}return o}function p(e,t,r,n){const o=[],s=[],i=[];for(let l=0;l<e.dims[0];++l){const c=e[l],d=t[l],u=(0,a.max)(c.data)[1];if(u===n)continue;const p=(0,a.softmax)(c.data)[u];p>r&&(o.push(d),s.push(p),i.push(u))}return[o,s,i]}function h(e,t,r,n=.5,o=.8){const s=[];let a=0,i=0;const l=t[r].data;for(let t=0;t<e.length;++t)e[t]===r&&(s.push(t),++a),l[t]>=n&&++i;let c=a>0&&i>0;if(c){c=a/i>o}return[c,s]}function m(e,t,r,n,o,s=null,a=null){const[l,c]=a??e[0].dims,d=new i.Tensor("int32",new Int32Array(l*c),[l,c]),u=[];if(null!==a)for(let t=0;t<e.length;++t)e[t]=(0,i.interpolate)(e[t],a,"bilinear",!1);const p=new Int32Array(e[0].data.length),m=new Float32Array(e[0].data.length);for(let r=0;r<e.length;++r){let n=t[r];const o=e[r].data;for(let e=0;e<o.length;++e)o[e]*=n,o[e]>m[e]&&(p[e]=r,m[e]=o[e])}let _=0;const f=d.data;for(let s=0;s<r.length;++s){const a=r[s],[i,l]=h(p,e,s,n,o);if(i){++_;for(const e of l)f[e]=_;u.push({id:_,label_id:a,score:t[s]})}}return[d,u]}function _(e,t=.5,r=.5,n=.8,o=null,s=null){null===o&&(console.warn("`label_ids_to_fuse` unset. No instance will be fused."),o=new Set);const a=e.class_queries_logits??e.logits,l=(e.masks_queries_logits??e.pred_masks).sigmoid();let[c,d,u]=a.dims;if(u-=1,null!==s&&s.length!==c)throw Error("Make sure that you pass in as many target sizes as the batch dimension of the logits");let h=[];for(let e=0;e<c;++e){let c=null!==s?s[e]:null,d=a[e],_=l[e],[f,g,M]=p(d,_,t,u);if(0===M.length){let[e,t]=c??_.dims.slice(-2),r=new i.Tensor("int32",new Int32Array(e*t).fill(-1),[e,t]);h.push({segmentation:r,segments_info:[]});continue}let[w,T]=m(f,g,M,r,n,o,c);h.push({segmentation:w,segments_info:T})}return h}function f(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.`)}function g(e,t,r=0,n=null){const o=e/t;let s=(0,a.bankers_round)(o)*t;return null!==n&&s>n&&(s=Math.floor(o)*t),s<r&&(s=Math.ceil(o)*t),s}function M([e,t],r){return[Math.max(Math.floor(e/r),1)*r,Math.max(Math.floor(t/r),1)*r]}class w extends n.Callable{constructor(e){super(),this.config=e}}class T extends w{constructor(e){super(e),this.image_mean=this.config.image_mean??this.config.mean,this.image_std=this.config.image_std??this.config.std,this.resample=this.config.resample??2,this.do_rescale=this.config.do_rescale??!0,this.rescale_factor=this.config.rescale_factor??1/255,this.do_normalize=this.config.do_normalize,this.do_resize=this.config.do_resize,this.do_thumbnail=this.config.do_thumbnail,this.size=this.config.size,this.size_divisibility=this.config.size_divisibility??this.config.size_divisor,this.do_center_crop=this.config.do_center_crop,this.crop_size=this.config.crop_size,this.do_convert_rgb=this.config.do_convert_rgb??!0,this.do_crop_margin=this.config.do_crop_margin,this.pad_size=this.config.pad_size,this.do_pad=this.config.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=this.config.do_flip_channel_order??!1}async thumbnail(e,t,r=2){const n=e.height,o=e.width,s=t.height,a=t.width;let i=Math.min(n,s),l=Math.min(o,a);return i===n&&l===o?e:(n>o?l=Math.floor(o*i/n):o>n&&(i=Math.floor(n*l/o)),await e.resize(l,i,{resample:r}))}async crop_margin(e,t=200){const r=e.clone().grayscale(),n=(0,a.min)(r.data)[0],o=(0,a.max)(r.data)[0]-n;if(0===o)return e;const s=t/255;let i=r.width,l=r.height,c=0,d=0;const u=r.data;for(let e=0;e<r.height;++e){const t=e*r.width;for(let a=0;a<r.width;++a)(u[t+a]-n)/o<s&&(i=Math.min(i,a),l=Math.min(l,e),c=Math.max(c,a),d=Math.max(d,e))}return e=await e.crop([i,l,c,d])}pad_image(e,t,r,{mode:n="constant",center:s=!1,constant_values:a=0}={}){const[i,l,c]=t;let d,u;if("number"==typeof r?(d=r,u=r):(d=r.width,u=r.height),d!==l||u!==i){const r=new Float32Array(d*u*c);if(Array.isArray(a))for(let e=0;e<r.length;++e)r[e]=a[e%c];else 0!==a&&r.fill(a);const[p,h]=s?[Math.floor((d-l)/2),Math.floor((u-i)/2)]:[0,0];for(let t=0;t<i;++t){const n=(t+h)*d,o=t*l;for(let t=0;t<l;++t){const s=(n+t+p)*c,a=(o+t)*c;for(let t=0;t<c;++t)r[s+t]=e[a+t]}}if("symmetric"===n){if(s)throw new Error("`center` padding is not supported when `mode` is set to `symmetric`.");const t=i-1,n=l-1;for(let s=0;s<u;++s){const a=s*d,u=(0,o.calculateReflectOffset)(s,t)*l;for(let t=0;t<d;++t){if(s<i&&t<l)continue;const d=(a+t)*c,p=(u+(0,o.calculateReflectOffset)(t,n))*c;for(let t=0;t<c;++t)r[d+t]=e[p+t]}}}e=r,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[r,n]=e.size;let o,s;if(this.do_thumbnail){const{height:e,width:r}=t;o=Math.min(e,r)}else Number.isInteger(t)?(o=t,s=this.config.max_size??o):void 0!==t&&(o=t.shortest_edge,s=t.longest_edge);if(void 0!==o||void 0!==s){const e=void 0===o?1:Math.max(o/r,o/n),t=r*e,a=n*e,i=void 0===s?1:Math.min(s/t,s/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]=M([l,c],this.size_divisibility)),[l,c]}if(void 0!==t&&void 0!==t.width&&void 0!==t.height){let e=t.width,o=t.height;if(this.config.keep_aspect_ratio&&this.config.ensure_multiple_of){let t=o/n,s=e/r;Math.abs(1-s)<Math.abs(1-t)?t=s:s=t,o=g(t*n,this.config.ensure_multiple_of),e=g(s*r,this.config.ensure_multiple_of)}return[e,o]}if(void 0!==this.size_divisibility)return M([r,n],this.size_divisibility);throw new Error(`Could not resize image due to unsupported \`this.size\` option in config: ${JSON.stringify(t)}`)}async resize(e){const[t,r]=this.get_resize_output_image_size(e,this.size);return await e.resize(t,r,{resample:this.resample})}async preprocess(e,{do_normalize:t=null,do_pad:r=null,do_convert_rgb:n=null,do_convert_grayscale:o=null,do_flip_channel_order:s=null}={}){this.do_crop_margin&&(e=await this.crop_margin(e));const[a,l]=e.size;if(n??this.do_convert_rgb?e=e.rgb():o&&(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,r;Number.isInteger(this.crop_size)?(t=this.crop_size,r=this.crop_size):(t=this.crop_size.width,r=this.crop_size.height),e=await e.center_crop(t,r)}const c=[e.height,e.width];let d=Float32Array.from(e.data),u=[e.height,e.width,e.channels];if(this.do_rescale&&this.rescale(d),t??this.do_normalize){let t=this.image_mean;Array.isArray(this.image_mean)||(t=new Array(e.channels).fill(t));let r=this.image_std;if(Array.isArray(this.image_std)||(r=new Array(e.channels).fill(t)),t.length!==e.channels||r.length!==e.channels)throw new Error(`When set to arrays, the length of \`image_mean\` (${t.length}) and \`image_std\` (${r.length}) must match the number of channels in the image (${e.channels}).`);for(let n=0;n<d.length;n+=e.channels)for(let o=0;o<e.channels;++o)d[n+o]=(d[n+o]-t[o])/r[o]}if(r??this.do_pad)if(this.pad_size){const t=this.pad_image(d,[e.height,e.width,e.channels],this.pad_size);[d,u]=t}else if(this.size_divisibility){const[e,t]=M([u[1],u[0]],this.size_divisibility);[d,u]=this.pad_image(d,u,{width:e,height:t})}if(s??this.do_flip_channel_order){if(3!==u[2])throw new Error("Flipping channel order is only supported for RGB images.");for(let e=0;e<d.length;e+=3){const t=d[e];d[e]=d[e+2],d[e+2]=t}}return{original_size:[l,a],reshaped_input_size:c,pixel_values:new i.Tensor("float32",d,u).permute(2,0,1)}}async _call(e,...t){Array.isArray(e)||(e=[e]);const r=await Promise.all(e.map((e=>this.preprocess(e))));return{pixel_values:(0,i.stack)(r.map((e=>e.pixel_values)),0),original_sizes:r.map((e=>e.original_size)),reshaped_input_sizes:r.map((e=>e.reshaped_input_size))}}}class b extends T{post_process_semantic_segmentation(...e){return u(...e)}}class x extends T{post_process_semantic_segmentation(...e){return u(...e)}}class y extends T{}class k extends T{}class F extends k{}class P extends T{}class C extends T{}class v extends T{}class S extends v{}class A extends T{}class E extends T{}class L extends T{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 r=Math.floor(t/this.crop_pct),[n,o]=this.get_resize_output_image_size(e,{shortest_edge:r});e=await e.resize(n,o,{resample:this.resample}),e=await e.center_crop(t,t)}else e=await e.resize(t,t,{resample:this.resample});return e}}class z extends L{}class I extends T{}class B extends T{}class N extends T{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)))}}class D extends T{}class O extends T{}class V extends T{}class j extends T{}class R extends T{}class G extends R{}class q extends T{post_process_object_detection(...e){return d(...e)}}class $ extends q{}class W extends T{post_process_object_detection(...e){return d(...e)}}class U extends T{}class X extends T{}class Q extends T{pad_image(e,t,r,n={}){const[o,s,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,r,{center:!0,constant_values:c,...n})}}class H extends Q{}class Y extends Q{}class J extends T{async _call(e){const t=await super._call(e),r=[t.pixel_values.dims[0],64,64],n=(0,i.full)(r,1n);return{...t,pixel_mask:n}}post_process_object_detection(...e){return d(...e)}post_process_panoptic_segmentation(...e){return _(...e)}post_process_instance_segmentation(){throw Error("Not implemented yet")}}class K extends T{post_process_panoptic_segmentation(...e){return _(...e)}post_process_instance_segmentation(){throw Error("Not implemented yet")}}class Z extends T{post_process_object_detection(...e){return d(...e)}}class ee extends T{reshape_input_points(e,t,r,n=!1){e=structuredClone(e);let s=(0,o.calculateDimensions)(e);if(3===s.length)n||(s=[1,...s]),e=[e];else if(4!==s.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 n=0;n<e.length;++n){let o=t[n],s=r[n],a=[s[0]/o[0],s[1]/o[1]];for(let t=0;t<e[n].length;++t)for(let r=0;r<e[n][t].length;++r)for(let o=0;o<e[n][t][r].length;++o)e[n][t][r][o]*=a[o%2]}return new i.Tensor("float32",Float32Array.from(e.flat(1/0)),s)}add_input_labels(e,t){let r=(0,o.calculateDimensions)(e);if(2===r.length)r=[1,...r],e=[e];else if(3!==r.length)throw Error("The input_points must be a 4D tensor of shape `batch_size`, `point_batch_size`, `nb_points_per_image`, `2`.");if(r.some(((e,r)=>e!==t.dims[r])))throw Error(`The first ${r.length} dimensions of 'input_points' and 'input_labels' must be the same.`);return new i.Tensor("int64",e.flat(1/0).map(BigInt),r)}async _call(e,{input_points:t=null,input_labels:r=null,input_boxes:n=null}={}){const o=await super._call(e);if(t&&(o.input_points=this.reshape_input_points(t,o.original_sizes,o.reshaped_input_sizes)),r){if(!o.input_points)throw Error("`input_points` must be provided if `input_labels` are provided.");o.input_labels=this.add_input_labels(r,o.input_points)}return n&&(o.input_boxes=this.reshape_input_points(n,o.original_sizes,o.reshaped_input_sizes,!0)),o}async post_process_masks(e,t,r,{mask_threshold:n=0,binarize:o=!0,pad_size:s=null}={}){const a=[],l=[(s=s??this.pad_size).height,s.width];for(let s=0;s<t.length;++s){const c=t[s],d=r[s];let u=await(0,i.interpolate_4d)(e[s],{mode:"bilinear",size:l});if(u=u.slice(null,null,[0,d[0]],[0,d[1]]),u=await(0,i.interpolate_4d)(u,{mode:"bilinear",size:c}),o){const e=u.data,t=new Uint8Array(e.length);for(let r=0;r<e.length;++r)e[r]>n&&(t[r]=1);u=new i.Tensor("bool",t,u.dims)}a.push(u)}return a}generate_crop_boxes(e,t,{crop_n_layers:r=0,overlap_ratio:n=512/1500,points_per_crop:o=32,crop_n_points_downscale_factor:s=1}={}){}}class te extends T{pad_image(e,t,r,n={}){const[o,s,a]=t;return super.pad_image(e,t,{width:s+(r-s%r)%r,height:o+(r-o%r)%r},{mode:"symmetric",center:!1,constant_values:-1,...n})}}class re extends T{async _call(e,t){Array.isArray(e)||(e=[e]),Array.isArray(t)||(t=[t]);const r=await Promise.all(e.map((e=>this.preprocess(e)))),n=await Promise.all(t.map((e=>this.preprocess(e,{do_normalize:!1,do_convert_rgb:!1,do_convert_grayscale:!0}))));return{pixel_values:(0,i.stack)(r.map(((e,t)=>(0,i.cat)([e.pixel_values,n[t].pixel_values],0))),0),original_sizes:r.map((e=>e.original_size)),reshaped_input_sizes:r.map((e=>e.reshaped_input_size))}}}class ne extends w{constructor(e){super(e),this.config.mel_filters??=(0,l.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,l.window_function)(this.config.n_fft,"hann")}async _extract_fbank_features(e){const t=await(0,l.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:this.config.nb_max_frames}),r=t.data,n=(0,a.max)(r)[0];for(let e=0;e<r.length;++e)r[e]=(Math.max(r[e],n-8)+4)/4;return t}async _call(e){let t;f(e,"WhisperFeatureExtractor"),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`."),t=e.slice(0,this.config.n_samples)):(t=new Float32Array(this.config.n_samples),t.set(e));return{input_features:(await this._extract_fbank_features(t)).unsqueeze_(0)}}}class oe extends w{_zero_mean_unit_var_norm(e){const t=e.reduce(((e,t)=>e+t),0)/e.length,r=e.reduce(((e,r)=>e+(r-t)**2),0)/e.length;return e.map((e=>(e-t)/Math.sqrt(r+1e-7)))}async _call(e){f(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 r=[1,t.length];return{input_values:new i.Tensor("float32",t,r),attention_mask:new i.Tensor("int64",new BigInt64Array(t.length).fill(1n),r)}}}class se extends w{constructor(e){super(e);const t=this.config.sampling_rate,r=(0,l.mel_filter_bank)(256,this.config.num_mel_bins,20,Math.floor(t/2),t,null,"kaldi",!0);for(let e=0;e<r.length;++e)r[e].push(0);this.mel_filters=r,this.window=(0,l.window_function)(400,"povey",{periodic:!1})}async _extract_fbank_features(e,t){return e=e.map((e=>32768*e)),(0,l.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:r=2,do_normalize_per_mel_bins:n=!0,return_attention_mask:o=!0}={}){f(e,"SeamlessM4TFeatureExtractor");let s,a=await this._extract_fbank_features(e,this.config.max_length);if(n){const[e,t]=a.dims,r=a.data;for(let n=0;n<t;++n){let o=0;for(let s=0;s<e;++s)o+=r[s*t+n];const s=o/e;let a=0;for(let o=0;o<e;++o)a+=(r[o*t+n]-s)**2;a/=e-1;const i=Math.sqrt(a+1e-7);for(let o=0;o<e;++o){const e=o*t+n;r[e]=(r[e]-s)/i}}}if(t){const[e,t]=a.dims,n=a.data,l=e%r;if(l>0){const r=new Float32Array(t*(e+l));r.set(n),r.fill(this.config.padding_value,n.length);const c=e+l;a=new i.Tensor(a.type,r,[c,t]),o&&(s=new i.Tensor("int64",new BigInt64Array(c),[1,c]),s.data.fill(1n,0,e))}}const[l,c]=a.dims,d=this.config.stride;if(0!==l%d)throw new Error(`The number of frames (${l}) must be a multiple of the stride (${d}).`);const u=a.view(1,Math.floor(l/d),c*d),p={input_features:u};if(o){const e=u.dims[1],t=new BigInt64Array(e);if(s){const e=s.data;for(let r=1,n=0;r<l;r+=d,++n)t[n]=e[r]}else t.fill(1n);p.attention_mask=new i.Tensor("int64",t,[1,e])}return p}}class ae extends w{constructor(e){super(e);const t=this.config.sampling_rate,r=(0,l.mel_filter_bank)(256,this.config.num_mel_bins,20,Math.floor(t/2),t,null,"kaldi",!0);for(let e=0;e<r.length;++e)r[e].push(0);this.mel_filters=r,this.window=(0,l.window_function)(400,"hann",{periodic:!1}),this.mean=this.config.mean,this.std=this.config.std}async _extract_fbank_features(e,t){return(0,l.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){f(e,"ASTFeatureExtractor");const t=await this._extract_fbank_features(e,this.config.max_length);if(this.config.do_normalize){const e=2*this.std,r=t.data;for(let t=0;t<r.length;++t)r[t]=(r[t]-this.mean)/e}return{input_values:t.unsqueeze_(0)}}}class ie extends w{constructor(e){super(e),this.mel_filters=(0,l.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,l.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,l.window_function)(this.config.fft_window_size,"hann")}async _get_input_mel(e,t,r,n){let o,s=!1;const a=e.length-t;if(a>0){if("rand_trunc"!==r)throw new Error(`Truncation strategy "${r}" not implemented`);{s=!0;const r=Math.floor(Math.random()*(a+1));e=e.subarray(r,r+t),o=await this._extract_fbank_features(e,this.mel_filters_slaney,this.config.nb_max_samples)}}else{if(a<0){let r=new Float64Array(t);if(r.set(e),"repeat"===n)for(let n=e.length;n<t;n+=e.length)r.set(e.subarray(0,Math.min(e.length,t-n)),n);else if("repeatpad"===n)for(let t=e.length;t<-a;t+=e.length)r.set(e,t);e=r}if("fusion"===r)throw new Error(`Truncation strategy "${r}" not implemented`);o=await this._extract_fbank_features(e,this.mel_filters_slaney,this.config.nb_max_samples)}return o.unsqueeze_(0)}async _extract_fbank_features(e,t,r=null){return(0,l.spectrogram)(e,this.window,this.config.fft_window_size,this.config.hop_length,{power:2,mel_filters:t,log_mel:"dB",max_num_frames:r,do_pad:!1,transpose:!0})}async _call(e,{max_length:t=null}={}){f(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)}}}class le extends w{async _call(e){f(e,"PyAnnoteFeatureExtractor"),e instanceof Float64Array&&(e=new Float32Array(e));const t=[1,1,e.length];return{input_values:new i.Tensor("float32",e,t)}}samples_to_frames(e){return(e-this.config.offset)/this.config.step}post_process_speaker_diarization(e,t){const r=t/this.samples_to_frames(t)/this.config.sampling_rate,n=[];for(const t of e.tolist()){const e=[];let o=-1;for(let r=0;r<t.length;++r){const n=(0,a.softmax)(t[r]),[s,i]=(0,a.max)(n),[l,c]=[r,r+1];i!==o?(o=i,e.push({id:i,start:l,end:c,score:s})):(e.at(-1).end=c,e.at(-1).score+=s)}n.push(e.map((({id:e,start:t,end:n,score:o})=>({id:e,start:t*r,end:n*r,confidence:o/(n-t)}))))}return n}}class ce extends w{constructor(e){super(e);const t=this.config.sampling_rate,r=(0,l.mel_filter_bank)(256,this.config.num_mel_bins,20,Math.floor(t/2),t,null,"kaldi",!0);for(let e=0;e<r.length;++e)r[e].push(0);this.mel_filters=r,this.window=(0,l.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,l.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){f(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,r=t.data,[n,o,s]=t.dims;for(let t=0;t<n;++t){const n=t*o*s,a=t*s;for(let t=0;t<o;++t){const o=n+t*s;for(let t=0;t<s;++t)r[o+t]-=e[a+t]}}}return{input_features:t}}}class de extends w{}class ue extends n.Callable{constructor(e){super(),this.feature_extractor=e}async _call(e,...t){return await this.feature_extractor(e,...t)}}class pe extends ue{async _call(...e){return await this.feature_extractor(...e)}post_process_masks(...e){return this.feature_extractor.post_process_masks(...e)}reshape_input_points(...e){return this.feature_extractor.reshape_input_points(...e)}}class he extends ue{async _call(e){return await this.feature_extractor(e)}}class me extends ue{async _call(e){return await this.feature_extractor(e)}}class _e extends ue{async _call(e){return await this.feature_extractor(e)}post_process_speaker_diarization(...e){return this.feature_extractor.post_process_speaker_diarization(...e)}}class fe extends ue{async _call(e){return await this.feature_extractor(e)}}class ge extends ue{}class Me extends ue{constructor(e){super(e);const{tasks_answer_post_processing_type:t,task_prompts_without_inputs:r,task_prompts_with_input:n}=e.config;this.tasks_answer_post_processing_type=new Map(Object.entries(t??{})),this.task_prompts_without_inputs=new Map(Object.entries(r??{})),this.task_prompts_with_input=new Map(Object.entries(n??{})),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 r of e)if(this.task_prompts_without_inputs.has(r))t.push(this.task_prompts_without_inputs.get(r));else{for(const[e,n]of this.task_prompts_with_input)if(r.includes(e)){t.push(n.replaceAll("{input}",r).replaceAll(e,""));break}t.length!==e.length&&t.push(r)}return t}post_process_generation(e,t,r){const n=this.tasks_answer_post_processing_type.get(t)??"pure_text";let o;switch(e=e.replaceAll("<s>","").replaceAll("</s>",""),n){case"pure_text":o=e;break;case"description_with_bboxes":case"bboxes":case"phrase_grounding":case"ocr":const s="ocr"===n?"quad_boxes":"bboxes",a=e.matchAll(this.regexes[s]),i=[],l=[];for(const[e,t,...n]of a)i.push(t?t.trim():i.at(-1)??""),l.push(n.map(((e,t)=>(Number(e)+.5)/this.size_per_bin*r[t%2])));o={labels:i,[s]:l};break;default:throw new Error(`Task "${t}" (of type "${n}") not yet implemented.`)}return{[t]:o}}}class we{static FEATURE_EXTRACTOR_CLASS_MAPPING={ImageFeatureExtractor:T,WhisperFeatureExtractor:ne,ViTFeatureExtractor:I,MobileViTFeatureExtractor:R,MobileViTImageProcessor:G,MobileNetV1FeatureExtractor:D,MobileNetV2FeatureExtractor:O,MobileNetV3FeatureExtractor:V,MobileNetV4FeatureExtractor:j,OwlViTFeatureExtractor:q,Owlv2ImageProcessor:$,CLIPFeatureExtractor:v,CLIPImageProcessor:S,Florence2Processor:Me,ChineseCLIPFeatureExtractor:A,SiglipImageProcessor:E,ConvNextFeatureExtractor:L,ConvNextImageProcessor:z,SegformerFeatureExtractor:x,SapiensFeatureExtractor:b,BitImageProcessor:P,DPTImageProcessor:F,DPTFeatureExtractor:k,PvtImageProcessor:y,GLPNFeatureExtractor:C,BeitFeatureExtractor:X,DeiTFeatureExtractor:U,DetrFeatureExtractor:J,RTDetrImageProcessor:W,MaskFormerFeatureExtractor:K,YolosFeatureExtractor:Z,DonutFeatureExtractor:Q,DonutImageProcessor:H,NougatImageProcessor:Y,EfficientNetImageProcessor:N,ViTImageProcessor:B,VitMatteImageProcessor:re,SamImageProcessor:ee,Swin2SRImageProcessor:te,Wav2Vec2FeatureExtractor:oe,SeamlessM4TFeatureExtractor:se,SpeechT5FeatureExtractor:de,ASTFeatureExtractor:ae,ClapFeatureExtractor:ie,PyAnnoteFeatureExtractor:le,WeSpeakerFeatureExtractor:ce};static PROCESSOR_CLASS_MAPPING={WhisperProcessor:he,Wav2Vec2ProcessorWithLM:me,PyAnnoteProcessor:_e,SamProcessor:pe,SpeechT5Processor:fe,OwlViTProcessor:ge,Florence2Processor:Me};static async from_pretrained(e,{progress_callback:t=null,config:r=null,cache_dir:n=null,local_files_only:o=!1,revision:a="main"}={}){let i=r??await(0,s.getModelJSON)(e,"preprocessor_config.json",!0,{progress_callback:t,config:r,cache_dir:n,local_files_only:o,revision:a}),l=i.feature_extractor_type??i.image_processor_type,c=this.FEATURE_EXTRACTOR_CLASS_MAPPING[l];if(!c){if(void 0===i.size)throw new Error(`Unknown Feature Extractor type: ${l}`);console.warn(`Feature extractor type "${l}" not found, assuming ImageFeatureExtractor due to size parameter in config.`),c=T}return new(this.PROCESSOR_CLASS_MAPPING[i.processor_class]??ue)(new c(i))}}},"./src/tokenizers.js":
128
128
  /*!***************************!*\
129
129
  !*** ./src/tokenizers.js ***!
130
- \***************************/(e,t,r)=>{r.r(t),r.d(t,{AlbertTokenizer:()=>xe,AutoTokenizer:()=>ht,BartTokenizer:()=>Ne,BertTokenizer:()=>be,BlenderbotSmallTokenizer:()=>lt,BlenderbotTokenizer:()=>it,BloomTokenizer:()=>je,CLIPTokenizer:()=>nt,CamembertTokenizer:()=>Ee,CodeGenTokenizer:()=>rt,CodeLlamaTokenizer:()=>qe,CohereTokenizer:()=>pt,ConvBertTokenizer:()=>ve,DebertaTokenizer:()=>Fe,DebertaV2Tokenizer:()=>Pe,DistilBertTokenizer:()=>Ae,ElectraTokenizer:()=>ze,EsmTokenizer:()=>Qe,FalconTokenizer:()=>Ue,GPT2Tokenizer:()=>Be,GPTNeoXTokenizer:()=>Xe,GemmaTokenizer:()=>Ye,Grok1Tokenizer:()=>Je,HerbertTokenizer:()=>Ce,LlamaTokenizer:()=>Ge,M2M100Tokenizer:()=>et,MBart50Tokenizer:()=>Oe,MBartTokenizer:()=>De,MPNetTokenizer:()=>$e,MarianTokenizer:()=>st,MobileBertTokenizer:()=>ye,NllbTokenizer:()=>Ze,NougatTokenizer:()=>dt,PreTrainedTokenizer:()=>Te,Qwen2Tokenizer:()=>He,RoFormerTokenizer:()=>Se,RobertaTokenizer:()=>Ve,SiglipTokenizer:()=>ot,SpeechT5Tokenizer:()=>ct,SqueezeBertTokenizer:()=>ke,T5Tokenizer:()=>Ie,TokenizerModel:()=>y,VitsTokenizer:()=>ut,Wav2Vec2CTCTokenizer:()=>at,WhisperTokenizer:()=>tt,XLMRobertaTokenizer:()=>We,XLMTokenizer:()=>Le,is_chinese_char:()=>g});var n=r(/*! ./utils/generic.js */"./src/utils/generic.js"),o=r(/*! ./utils/core.js */"./src/utils/core.js"),s=r(/*! ./utils/hub.js */"./src/utils/hub.js"),a=r(/*! ./utils/maths.js */"./src/utils/maths.js"),i=r(/*! ./utils/tensor.js */"./src/utils/tensor.js"),l=r(/*! ./utils/data-structures.js */"./src/utils/data-structures.js"),c=r(/*! @huggingface/jinja */"./node_modules/@huggingface/jinja/dist/index.js"),d=r(/*! ./models/whisper/common_whisper.js */"./src/models/whisper/common_whisper.js");r(/*! ./utils/constants.js */"./src/utils/constants.js");async function u(e,t){const r=await Promise.all([(0,s.getModelJSON)(e,"tokenizer.json",!0,t),(0,s.getModelJSON)(e,"tokenizer_config.json",!0,t)]);return null!==t.legacy&&(r[1].legacy=t.legacy),r}function p(e,t=!0){if(void 0!==e.Regex){let t=e.Regex.replace(/\\([#&~])/g,"$1");for(const[e,r]of b)t=t.replaceAll(e,r);return new RegExp(t,"gu")}if(void 0!==e.String){const r=(0,o.escapeRegExp)(e.String);return new RegExp(t?r:`(${r})`,"gu")}return console.warn("Unknown pattern type:",e),null}function h(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 _(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 f(e){return e.replace(/\p{M}/gu,"")}function g(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 y extends n.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 v(e);default:if(e.vocab)return Array.isArray(e.vocab)?new F(e,...t):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,r){const n=[];let o=0;for(;o<e.length;)if(n.push(e[o]),(t.get(e[o])??r)===r)for(;++o<e.length&&(t.get(e[o])??r)===r;)t.get(n.at(-1))!==r&&(n[n.length-1]+=e[o]);else++o;return n}(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 y{constructor(e){super(e),this.tokens_to_ids=h(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 r of e){const e=[...r];if(e.length>this.max_input_chars_per_word){t.push(this.unk_token);continue}let n=!1,o=0;const s=[];for(;o<e.length;){let t=e.length,r=null;for(;o<t;){let n=e.slice(o,t).join("");if(o>0&&(n=this.config.continuing_subword_prefix+n),this.tokens_to_ids.has(n)){r=n;break}--t}if(null===r){n=!0;break}s.push(r),o=t}n?t.push(this.unk_token):t.push(...s)}return t}}class F extends y{constructor(e,t){super(e);const r=e.vocab.length;this.vocab=new Array(r),this.scores=new Array(r);for(let t=0;t<r;++t){const r=e.vocab[t];this.vocab[t]=r[0],this.scores[t]=r[1]}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 r=0;for(;r<t.length;){let n=!1;const s=[],a=t.slice(r).join(""),i=this.trie.commonPrefixSearch(a);for(const t of i){s.push(t);const a=this.tokens_to_ids.get(t),i=this.scores[a],l=(0,o.len)(t);e.insert(r,l,i,a),n||1!==l||(n=!0)}n||e.insert(r,1,this.unk_score,this.unk_token_id),r+=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 r of e){const e=this.tokenize(r);t.push(...e)}return t}}const P=(()=>{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 r=0;for(let n=0;n<256;++n)e.includes(n)||(e.push(n),t.push(256+r),r+=1);const n=t.map((e=>String.fromCharCode(e)));return Object.fromEntries(e.map(((e,t)=>[e,n[t]])))})(),C=(0,o.reverseDictionary)(P);class v extends y{constructor(e){super(e),this.tokens_to_ids=h(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 r=Array.from(e);this.end_of_word_suffix&&(r[r.length-1]+=this.end_of_word_suffix);let n=[];if(r.length>1){const e=new l.PriorityQueue(((e,t)=>e.score<t.score));let t={token:r[0],bias:0,prev:null,next:null},o=t;for(let t=1;t<r.length;++t){const n={bias:t/r.length,token:r[t],prev:o,next:null};o.next=n,this._add_node(e,o),o=n}for(;!e.isEmpty();){const r=e.pop();if(r.deleted||!r.next||r.next.deleted)continue;if(r.deleted=!0,r.next.deleted=!0,r.prev){const e={...r.prev};r.prev.deleted=!0,r.prev=e,e.prev?e.prev.next=e:t=e}const n={token:r.token+r.next.token,bias:r.bias,prev:r.prev,next:r.next.next};n.prev?(n.prev.next=n,this._add_node(e,n.prev)):t=n,n.next&&(n.next.prev=n,this._add_node(e,n))}for(let e=t;null!==e;e=e.next)n.push(e.token)}else n=r;if(this.continuing_subword_suffix)for(let e=0;e<n.length-1;++e)n[e]+=this.continuing_subword_suffix;return this.cache.set(e,n),n}_add_node(e,t){const r=this.bpe_ranks.get(JSON.stringify([t.token,t.next.token]));void 0!==r&&(t.score=r+t.bias,e.push(t))}encode(e){const t=[];for(const r of e){if(this.ignore_merges&&this.tokens_to_ids.has(r)){t.push(r);continue}const e=this.bpe(r);for(const r of e)if(this.tokens_to_ids.has(r))t.push(r);else if(this.byte_fallback){const e=Array.from(this.text_encoder.encode(r)).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 y{constructor(e,t){super(e),this.tokens_to_ids=h(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 n.Callable{constructor(e){super(),this.config=e}static fromConfig(e){if(null===e)return null;switch(e.type){case"BertNormalizer":return new j(e);case"Precompiled":return new pe(e);case"Sequence":return new V(e);case"Replace":return new E(e);case"NFC":return new L(e);case"NFKC":return new z(e);case"NFKD":return new I(e);case"Strip":return new B(e);case"StripAccents":return new N(e);case"Lowercase":return new D(e);case"Prepend":return new O(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=p(this.config.pattern);return null===t?e:e.replaceAll(t,this.config.content)}}class L extends A{normalize(e){return e=e.normalize("NFC")}}class z extends A{normalize(e){return e=e.normalize("NFKC")}}class I extends A{normalize(e){return e=e.normalize("NFKD")}}class B 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=f(e)}}class D extends A{normalize(e){return e=e.toLowerCase()}}class O extends A{normalize(e){return e=this.config.prepend+e}}class V 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 j extends A{_tokenize_chinese_chars(e){const t=[];for(let r=0;r<e.length;++r){const n=e[r];g(n.charCodeAt(0))?(t.push(" "),t.push(n),t.push(" ")):t.push(n)}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 r of e){const e=r.charCodeAt(0);0===e||65533===e||this._is_control(r)||(/^\s$/.test(r)?t.push(" "):t.push(r))}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 R extends n.Callable{static fromConfig(e){if(null===e)return null;switch(e.type){case"BertPreTokenizer":return new G(e);case"Sequence":return new he(e);case"Whitespace":return new me(e);case"WhitespaceSplit":return new _e(e);case"Metaspace":return new de(e);case"ByteLevel":return new q(e);case"Split":return new W(e);case"Punctuation":return new $(e);case"Digits":return new U(e);case"Replace":return new fe(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 G extends R{constructor(e){super(),this.pattern=new RegExp(`[^\\s${M}]+|[${M}]`,"gu")}pre_tokenize_text(e,t){return e.trim().match(this.pattern)||[]}}class q extends R{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=P,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 W extends R{constructor(e){super(),this.config=e,this.pattern=p(this.config.pattern,this.config.invert)}pre_tokenize_text(e,t){return null===this.pattern?[]:this.config.invert?e.match(this.pattern)||[]:function(e,t){const r=[];let n=0;for(const o of e.matchAll(t)){const t=o[0];n<o.index&&r.push(e.slice(n,o.index)),t.length>0&&r.push(t),n=o.index+t.length}return n<e.length&&r.push(e.slice(n)),r}(e,this.pattern)}}class $ extends R{constructor(e){super(),this.config=e,this.pattern=new RegExp(`[^${M}]+|[${M}]+`,"gu")}pre_tokenize_text(e,t){return e.match(this.pattern)||[]}}class U extends R{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 X extends n.Callable{constructor(e){super(),this.config=e}static fromConfig(e){if(null===e)return null;switch(e.type){case"TemplateProcessing":return new Y(e);case"ByteLevel":return new J(e);case"RobertaProcessing":return new H(e);case"BertProcessing":return new Q(e);case"Sequence":return new K(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 Q extends X{constructor(e){super(e),this.cls=e.cls[0],this.sep=e.sep[0]}post_process(e,t=null,{add_special_tokens:r=!0}={}){r&&(e=(0,o.mergeArrays)([this.cls],e,[this.sep]));let n=new Array(e.length).fill(0);if(null!==t){const s=r&&this instanceof H?[this.sep]:[],a=r?[this.sep]:[];e=(0,o.mergeArrays)(e,s,t,a),n=(0,o.mergeArrays)(n,new Array(t.length+s.length+a.length).fill(1))}return{tokens:e,token_type_ids:n}}}class H extends Q{}class Y extends X{constructor(e){super(e),this.single=e.single,this.pair=e.pair}post_process(e,t=null,{add_special_tokens:r=!0}={}){const n=null===t?this.single:this.pair;let s=[],a=[];for(const i of n)"SpecialToken"in i?r&&(s.push(i.SpecialToken.id),a.push(i.SpecialToken.type_id)):"Sequence"in i&&("A"===i.Sequence.id?(s=(0,o.mergeArrays)(s,e),a=(0,o.mergeArrays)(a,new Array(e.length).fill(i.Sequence.type_id))):"B"===i.Sequence.id&&(s=(0,o.mergeArrays)(s,t),a=(0,o.mergeArrays)(a,new Array(t.length).fill(i.Sequence.type_id))));return{tokens:s,token_type_ids:a}}}class J extends X{post_process(e,t=null){return t&&(e=(0,o.mergeArrays)(e,t)),{tokens:e}}}class K extends X{constructor(e){super(e),this.processors=e.processors.map((e=>X.fromConfig(e)))}post_process(e,t=null,r={}){let n;for(const o of this.processors)if(o instanceof J){if(e=o.post_process(e).tokens,t){t=o.post_process(t).tokens}}else{const s=o.post_process(e,t,r);e=s.tokens,n=s.token_type_ids}return{tokens:e,token_type_ids:n}}}class Z extends n.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 oe(e);case"Metaspace":return new ue(e);case"ByteLevel":return new se(e);case"Replace":return new ee(e);case"ByteFallback":return new te(e);case"Fuse":return new re(e);case"Strip":return new ne(e);case"Sequence":return new ie(e);case"CTC":return new ae(e);case"BPEDecoder":return new le(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 ee extends Z{decode_chain(e){const t=p(this.config.pattern);return null===t?e:e.map((e=>e.replaceAll(t,this.config.content)))}}class te extends Z{constructor(e){super(e),this.text_decoder=new TextDecoder}decode_chain(e){const t=[];let r=[];for(const n of e){let e=null;if(6===n.length&&n.startsWith("<0x")&&n.endsWith(">")){const t=parseInt(n.slice(3,5),16);isNaN(t)||(e=t)}if(null!==e)r.push(e);else{if(r.length>0){const e=this.text_decoder.decode(Uint8Array.from(r));t.push(e),r=[]}t.push(n)}}if(r.length>0){const e=this.text_decoder.decode(Uint8Array.from(r));t.push(e),r=[]}return t}}class re extends Z{decode_chain(e){return[e.join("")]}}class ne extends Z{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 r=0;r<this.start&&e[r]===this.content;++r)t=r+1;let r=e.length;for(let t=0;t<this.stop;++t){const n=e.length-t-1;if(e[n]!==this.content)break;r=n}return e.slice(t,r)}))}}class oe extends Z{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=_(e)),e)))}}class se extends Z{constructor(e){super(e),this.byte_decoder=C,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(""),r=new Uint8Array([...t].map((e=>this.byte_decoder[e])));return this.text_decoder.decode(r)}decode_chain(e){const t=[];let r=[];for(const n of e)void 0!==this.added_tokens.find((e=>e.content===n))?(r.length>0&&(t.push(this.convert_tokens_to_string(r)),r=[]),t.push(n)):r.push(n);return r.length>0&&t.push(this.convert_tokens_to_string(r)),t}}class ae extends Z{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 r=1;r<e.length;++r)e[r]!==t.at(-1)&&t.push(e[r]);let r=t.filter((e=>e!==this.pad_token)).join("");return this.cleanup&&(r=_(r).replaceAll(this.word_delimiter_token," ").trim()),r}decode_chain(e){return[this.convert_tokens_to_string(e)]}}class ie extends Z{constructor(e){super(e),this.decoders=e.decoders.map((e=>Z.fromConfig(e)))}decode_chain(e){return this.decoders.reduce(((e,t)=>t.decode_chain(e)),e)}}class le extends Z{constructor(e){super(e),this.suffix=this.config.suffix}decode_chain(e){return e.map(((t,r)=>t.replaceAll(this.suffix,r===e.length-1?"":" ")))}}class ce extends Z{decode_chain(e){let t="";for(let r=1;r<e.length;r+=2)t+=e[r];return[t]}}class de extends R{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 r=e.replaceAll(" ",this.strRep);return this.addPrefixSpace&&!r.startsWith(this.replacement)&&("always"===this.prepend_scheme||"first"===this.prepend_scheme&&0===t)&&(r=this.strRep+r),[r]}}class ue extends Z{constructor(e){super(e),this.addPrefixSpace=e.add_prefix_space,this.replacement=e.replacement}decode_chain(e){const t=[];for(let r=0;r<e.length;++r){let n=e[r].replaceAll(this.replacement," ");this.addPrefixSpace&&0==r&&n.startsWith(" ")&&(n=n.substring(1)),t.push(n)}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 R{constructor(e){super(),this.tokenizers=e.pretokenizers.map((e=>R.fromConfig(e)))}pre_tokenize_text(e,t){return this.tokenizers.reduce(((e,r)=>r.pre_tokenize(e,t)),[e])}}class me extends R{constructor(e){super()}pre_tokenize_text(e,t){return e.match(/\w+|[^\w\s]+/g)||[]}}class _e extends R{constructor(e){super()}pre_tokenize_text(e,t){return function(e){return e.match(/\S+/g)||[]}(e)}}class fe extends R{constructor(e){super(),this.config=e,this.pattern=p(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 ge=["bos_token","eos_token","unk_token","sep_token","pad_token","cls_token","mask_token"];function Me(e,t,r,n){for(const s of Object.keys(e)){const a=t-e[s].length,i=r(s),l=new Array(a).fill(i);e[s]="right"===n?(0,o.mergeArrays)(e[s],l):(0,o.mergeArrays)(l,e[s])}}function we(e,t){for(const r of Object.keys(e))e[r].length=t}class Te extends n.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=R.fromConfig(e.pre_tokenizer),this.model=y.fromConfig(e.model,t),this.post_processor=X.fromConfig(e.post_processor),this.decoder=Z.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,o.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.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:r}of this.chat_template){if("string"!=typeof t||"string"!=typeof r)throw new Error('Chat template must be a list of objects with "name" and "template" properties');e[t]=r}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:r=null,cache_dir:n=null,local_files_only:o=!1,revision:s="main",legacy:a=null}={}){return new this(...await u(e,{progress_callback:t,config:r,cache_dir:n,local_files_only:o,revision:s,legacy:a}))}_call(e,{text_pair:t=null,add_special_tokens:r=!0,padding:n=!1,truncation:o=null,max_length:s=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,n)=>this._encode_plus(e,{text_pair:t[n],add_special_tokens:r,return_token_type_ids:c})))}else u=e.map((e=>this._encode_plus(e,{add_special_tokens:r,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:r,return_token_type_ids:c})]}if(null===s?s="max_length"===n?this.model_max_length:(0,a.max)(u.map((e=>e.input_ids.length)))[0]:o||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."),s=Math.min(s,this.model_max_length??1/0),n||o)for(let e=0;e<u.length;++e)u[e].input_ids.length!==s&&(u[e].input_ids.length>s?o&&we(u[e],s):n&&Me(u[e],s,(e=>"input_ids"===e?this.pad_token_id:0),this.padding_side));const p={};if(l){if((!n||!o)&&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]))p[t]=new i.Tensor("int64",BigInt64Array.from(u.flatMap((e=>e[t])).map(BigInt)),e)}else{for(const e of Object.keys(u[0]))p[e]=u.map((t=>t[e]));if(!d)for(const e of Object.keys(p))p[e]=p[e][0]}return p}_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 f(e.toLowerCase())}(e)),null!==this.normalizer&&(e=this.normalizer(e)),0===e.length)return[];const r=null!==this.pre_tokenizer?this.pre_tokenizer(e,{section_index:t}):[e];return this.model(r)}})).flat();return t}_encode_plus(e,{text_pair:t=null,add_special_tokens:r=!0,return_token_type_ids:n=null}={}){const{tokens:o,token_type_ids:s}=this._tokenize_helper(e,{pair:t,add_special_tokens:r}),a=this.model.convert_tokens_to_ids(o),i={input_ids:a,attention_mask:new Array(a.length).fill(1)};return(n??this.return_token_type_ids)&&s&&(i.token_type_ids=s),i}_tokenize_helper(e,{pair:t=null,add_special_tokens:r=!1}={}){const n=this._encode_text(e),s=this._encode_text(t);return this.post_processor?this.post_processor(n,s,{add_special_tokens:r}):{tokens:(0,o.mergeArrays)(n??[],s??[])}}tokenize(e,{pair:t=null,add_special_tokens:r=!1}={}){return this._tokenize_helper(e,{pair:t,add_special_tokens:r}).tokens}encode(e,{text_pair:t=null,add_special_tokens:r=!0,return_token_type_ids:n=null}={}){return this._encode_plus(e,{text_pair:t,add_special_tokens:r,return_token_type_ids:n}).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,o.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:r=null}){let n=this.model.convert_ids_to_tokens(e);t&&(n=n.filter((e=>!this.special_tokens.includes(e))));let o=this.decoder?this.decoder(n):n.join(" ");return this.decoder&&this.decoder.end_of_word_suffix&&(o=o.replaceAll(this.decoder.end_of_word_suffix," "),t&&(o=o.trim())),(r??this.clean_up_tokenization_spaces)&&(o=_(o)),o}get_chat_template({chat_template:e=null,tools:t=null}={}){if(this.chat_template&&"object"==typeof this.chat_template){const r=this.chat_template;if(null!==e&&Object.hasOwn(r,e))e=r[e];else if(null===e)if(null!==t&&"tool_use"in r)e=r.tool_use;else{if(!("default"in r))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(r).sort()}.`);e=r.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:r=null,chat_template:n=null,add_generation_prompt:o=!1,tokenize:s=!0,padding:a=!1,truncation:i=!1,max_length:l=null,return_tensor:d=!0,return_dict:u=!1,tokenizer_kwargs:p={},...h}={}){if("string"!=typeof(n=this.get_chat_template({chat_template:n,tools:t})))throw Error("chat_template must be a string, but got "+typeof n);let m=this._compiled_template_cache.get(n);void 0===m&&(m=new c.Template(n),this._compiled_template_cache.set(n,m));const _=Object.create(null);for(const e of ge){const t=this.getToken(e);t&&(_[e]=t)}const f=m.render({messages:e,add_generation_prompt:o,tools:t,documents:r,..._,...h});if(s){const e=this._call(f,{add_special_tokens:!1,padding:a,truncation:i,max_length:l,return_tensor:d,...p});return u?e:e.input_ids}return f}}class be extends Te{return_token_type_ids=!0}class xe extends Te{return_token_type_ids=!0}class ye extends Te{return_token_type_ids=!0}class ke extends Te{return_token_type_ids=!0}class Fe extends Te{return_token_type_ids=!0}class Pe extends Te{return_token_type_ids=!0}class Ce extends Te{return_token_type_ids=!0}class ve extends Te{return_token_type_ids=!0}class Se extends Te{return_token_type_ids=!0}class Ae extends Te{}class Ee extends Te{}class Le extends Te{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 ze extends Te{return_token_type_ids=!0}class Ie extends Te{}class Be extends Te{}class Ne extends Te{}class De extends Te{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,r){return Ke(this,e,t,r)}}class Oe extends De{}class Ve extends Te{}class je extends Te{}const Re="▁";class Ge extends Te{padding_side="left";constructor(e,t){super(e,t),this.legacy=t.legacy??!0,this.legacy||(this.normalizer=null,this.pre_tokenizer=new de({replacement:Re,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(Re+e.replaceAll(Re," "));return t.length>1&&t[0]===Re&&this.special_tokens.includes(t[1])&&(t=t.slice(1)),t}}class qe extends Te{}class We extends Te{}class $e extends Te{}class Ue extends Te{}class Xe extends Te{}class Qe extends Te{}class He extends Te{}class Ye extends Te{}class Je extends Te{}function Ke(e,t,r,n){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 o=n.src_lang,s=n.tgt_lang;if(!e.language_codes.includes(s))throw new Error(`Target language code "${s}" is not valid. Must be one of: {${e.language_codes.join(", ")}}`);if(void 0!==o){if(!e.language_codes.includes(o))throw new Error(`Source language code "${o}" 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(o);break}}return n.forced_bos_token_id=e.model.convert_tokens_to_ids([e.lang_to_token(s)])[0],e._call(t,r)}class Ze extends Te{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,r){return Ke(this,e,t,r)}}class et extends Te{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,r){return Ke(this,e,t,r)}}class tt extends Te{get timestamp_begin(){return this.model.convert_tokens_to_ids(["<|notimestamps|>"])[0]+1}_decode_asr(e,{return_timestamps:t=!1,return_language:r=!1,time_precision:n=null,force_full_sequences:o=!0}={}){if(null===n)throw Error("Must specify time_precision");let s=null;const i="word"===t;function l(){return{language:s,timestamp:[null,null],text:""}}const c=[];let u=l(),p=0;const h=this.timestamp_begin;let m=[],_=[],f=!1,g=null;const M=new Set(this.all_special_ids);for(const r of e){const e=r.tokens,o=i?r.token_timestamps:null;let T=null,b=h;if("stride"in r){const[t,o,s]=r.stride;if(p-=o,g=t-s,o&&(b=o/n+h),s)for(let t=e.length-1;t>=0;--t){const r=Number(e[t]);if(r>=h){if(null!==T&&(r-h)*n<g)break;T=r}}}let x=[],y=[];for(let r=0;r<e.length;++r){const g=Number(e[r]);if(M.has(g)){const e=this.decode([g]),r=d.WHISPER_LANGUAGE_MAPPING.get(e.slice(2,-2));if(void 0!==r){if(null!==s&&r!==s&&!t){m.push(x);const e=this.findLongestCommonSequence(m)[0],t=this.decode(e);u.text=t,c.push(u),m=[],x=[],u=l()}s=u.language=r}}else if(g>=h){const e=(g-h)*n+p,t=(0,a.round)(e,2);if(null!==T&&g>=T)f=!0;else if(f||m.length>0&&g<b)f=!1;else if(null===u.timestamp[0])u.timestamp[0]=t;else if(t===u.timestamp[0]);else{u.timestamp[1]=t,m.push(x),i&&_.push(y);const[e,r]=this.findLongestCommonSequence(m,_),n=this.decode(e);u.text=n,i&&(u.words=this.collateWordTimestamps(e,r,s)),c.push(u),m=[],x=[],_=[],y=[],u=l()}}else if(x.push(g),i){let e,t=(0,a.round)(o[r]+p,2);if(r+1<o.length){e=(0,a.round)(o[r+1]+p,2);const s=this.decode([g]);w.test(s)&&(e=(0,a.round)(Math.min(t+n,e),2))}else e=null;y.push([t,e])}}if("stride"in r){const[e,t,n]=r.stride;p+=e-n}x.length>0?(m.push(x),i&&_.push(y)):m.every((e=>0===e.length))&&(u=l(),m=[],x=[],_=[],y=[])}if(m.length>0){if(o&&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,r]=this.findLongestCommonSequence(m,_),n=this.decode(e);u.text=n,i&&(u.words=this.collateWordTimestamps(e,r,s)),c.push(u)}let T=Object.create(null);const b=c.map((e=>e.text)).join("");if(t||r){for(let e=0;e<c.length;++e){const n=c[e];t||delete n.timestamp,r||delete n.language}if(i){const e=[];for(const t of c)for(const r of t.words)e.push(r);T={chunks:e}}else T={chunks:c}}return[b,T]}findLongestCommonSequence(e,t=null){let r=e[0],n=r.length,o=[];const s=Array.isArray(t)&&t.length>0;let a=s?[]:null,i=s?t[0]:null;for(let l=1;l<e.length;++l){const c=e[l];let d=0,u=[n,n,0,0];const p=c.length;for(let e=1;e<n+p;++e){const o=Math.max(0,n-e),a=Math.min(n,n+p-e),h=r.slice(o,a),m=Math.max(0,e-n),_=Math.min(p,e),f=c.slice(m,_);if(h.length!==f.length)throw new Error("There is a bug within whisper `decode_asr` function, please report it. Dropping to prevent bad inference.");let g;g=s?h.filter(((e,r)=>e===f[r]&&i[o+r]<=t[l][m+r])).length:h.filter(((e,t)=>e===f[t])).length;const M=g/e+e/1e4;g>1&&M>d&&(d=M,u=[o,a,m,_])}const[h,m,_,f]=u,g=Math.floor((m+h)/2),M=Math.floor((f+_)/2);o.push(...r.slice(0,g)),r=c.slice(M),n=r.length,s&&(a.push(...i.slice(0,g)),i=t[l].slice(M))}return o.push(...r),s?(a.push(...i),[o,a]):[o,[]]}collateWordTimestamps(e,t,r){const[n,o,s]=this.combineTokensIntoWords(e,r),a=[];for(let e=0;e<n.length;++e){const r=s[e];a.push({text:n[e],timestamp:[t[r.at(0)][0],t[r.at(-1)][1]]})}return a}combineTokensIntoWords(e,t,r="\"'“¡¿([{-",n="\"'.。,,!!??::”)]}、"){let o,s,a;return["chinese","japanese","thai","lao","myanmar"].includes(t=t??"english")?[o,s,a]=this.splitTokensOnUnicode(e):[o,s,a]=this.splitTokensOnSpaces(e),this.mergePunctuations(o,s,a,r,n)}decode(e,t){let r;return t?.decode_with_timestamps?(e instanceof i.Tensor&&(e=m(e)),r=this.decodeWithTimestamps(e,t)):r=super.decode(e,t),r}decodeWithTimestamps(e,t){const r=t?.time_precision??.02,n=Array.from(this.all_special_ids).at(-1)+1;let o=[[]];for(let t of e)if(t=Number(t),t>=n){const e=((t-n)*r).toFixed(2);o.push(`<|${e}|>`),o.push([])}else o[o.length-1].push(t);return o=o.map((e=>"string"==typeof e?e:super.decode(e,t))),o.join("")}splitTokensOnUnicode(e){const t=this.decode(e,{decode_with_timestamps:!0}),r=[],n=[],o=[];let s=[],a=[],i=0;for(let l=0;l<e.length;++l){const c=e[l];s.push(c),a.push(l);const d=this.decode(s,{decode_with_timestamps:!0});d.includes("�")&&"�"!==t[i+d.indexOf("�")]||(r.push(d),n.push(s),o.push(a),s=[],a=[],i+=d.length)}return[r,n,o]}splitTokensOnSpaces(e){const[t,r,n]=this.splitTokensOnUnicode(e),o=[],s=[],a=[],i=new RegExp(`^[${M}]$`,"gu");for(let e=0;e<t.length;++e){const l=t[e],c=r[e],d=n[e],u=c[0]>=this.model.tokens_to_ids.get("<|endoftext|>"),p=l.startsWith(" "),h=l.trim(),m=i.test(h);if(u||p||m||0===o.length)o.push(l),s.push(c),a.push(d);else{const e=o.length-1;o[e]+=l,s[e].push(...c),a[e].push(...d)}}return[o,s,a]}mergePunctuations(e,t,r,n,s){const a=structuredClone(e),i=structuredClone(t),l=structuredClone(r);let c=a.length-2,d=a.length-1;for(;c>=0;)a[c].startsWith(" ")&&n.includes(a[c].trim())?(a[d]=a[c]+a[d],i[d]=(0,o.mergeArrays)(i[c],i[d]),l[d]=(0,o.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(" ")&&s.includes(a[d])?(a[c]+=a[d],i[c]=(0,o.mergeArrays)(i[c],i[d]),l[c]=(0,o.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 Te{}class nt extends Te{}class ot extends Te{}class st extends Te{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,...r]=e.trim().split(this.languageRegex);if(0===r.length)return super._encode_text(t);if(2===r.length){const[e,t]=r;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,o.mergeArrays)([e],super._encode_text(t))}}}class at extends Te{}class it extends Te{}class lt extends Te{}class ct extends Te{}class dt extends Te{}class ut extends Te{constructor(e,t){super(e,t),this.decoder=new ce({})}}class pt extends Te{}class ht{static TOKENIZER_CLASS_MAPPING={T5Tokenizer:Ie,DistilBertTokenizer:Ae,CamembertTokenizer:Ee,DebertaTokenizer:Fe,DebertaV2Tokenizer:Pe,BertTokenizer:be,HerbertTokenizer:Ce,ConvBertTokenizer:ve,RoFormerTokenizer:Se,XLMTokenizer:Le,ElectraTokenizer:ze,MobileBertTokenizer:ye,SqueezeBertTokenizer:ke,AlbertTokenizer:xe,GPT2Tokenizer:Be,BartTokenizer:Ne,MBartTokenizer:De,MBart50Tokenizer:Oe,RobertaTokenizer:Ve,WhisperTokenizer:tt,CodeGenTokenizer:rt,CLIPTokenizer:nt,SiglipTokenizer:ot,MarianTokenizer:st,BloomTokenizer:je,NllbTokenizer:Ze,M2M100Tokenizer:et,LlamaTokenizer:Ge,CodeLlamaTokenizer:qe,XLMRobertaTokenizer:We,MPNetTokenizer:$e,FalconTokenizer:Ue,GPTNeoXTokenizer:Xe,EsmTokenizer:Qe,Wav2Vec2CTCTokenizer:at,BlenderbotTokenizer:it,BlenderbotSmallTokenizer:lt,SpeechT5Tokenizer:ct,NougatTokenizer:dt,VitsTokenizer:ut,Qwen2Tokenizer:He,GemmaTokenizer:Ye,Grok1Tokenizer:Je,CohereTokenizer:pt,PreTrainedTokenizer:Te};static async from_pretrained(e,{progress_callback:t=null,config:r=null,cache_dir:n=null,local_files_only:o=!1,revision:s="main",legacy:a=null}={}){const[i,l]=await u(e,{progress_callback:t,config:r,cache_dir:n,local_files_only:o,revision:s,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=Te),new d(i,l)}}},"./src/utils/audio.js":
130
+ \***************************/(e,t,r)=>{r.r(t),r.d(t,{AlbertTokenizer:()=>xe,AutoTokenizer:()=>ht,BartTokenizer:()=>Ne,BertTokenizer:()=>be,BlenderbotSmallTokenizer:()=>lt,BlenderbotTokenizer:()=>it,BloomTokenizer:()=>je,CLIPTokenizer:()=>nt,CamembertTokenizer:()=>Ee,CodeGenTokenizer:()=>rt,CodeLlamaTokenizer:()=>qe,CohereTokenizer:()=>pt,ConvBertTokenizer:()=>ve,DebertaTokenizer:()=>Fe,DebertaV2Tokenizer:()=>Pe,DistilBertTokenizer:()=>Ae,ElectraTokenizer:()=>ze,EsmTokenizer:()=>Qe,FalconTokenizer:()=>Ue,GPT2Tokenizer:()=>Be,GPTNeoXTokenizer:()=>Xe,GemmaTokenizer:()=>Ye,Grok1Tokenizer:()=>Je,HerbertTokenizer:()=>Ce,LlamaTokenizer:()=>Ge,M2M100Tokenizer:()=>et,MBart50Tokenizer:()=>Oe,MBartTokenizer:()=>De,MPNetTokenizer:()=>We,MarianTokenizer:()=>st,MobileBertTokenizer:()=>ye,NllbTokenizer:()=>Ze,NougatTokenizer:()=>dt,PreTrainedTokenizer:()=>Te,Qwen2Tokenizer:()=>He,RoFormerTokenizer:()=>Se,RobertaTokenizer:()=>Ve,SiglipTokenizer:()=>ot,SpeechT5Tokenizer:()=>ct,SqueezeBertTokenizer:()=>ke,T5Tokenizer:()=>Ie,TokenizerModel:()=>y,VitsTokenizer:()=>ut,Wav2Vec2CTCTokenizer:()=>at,WhisperTokenizer:()=>tt,XLMRobertaTokenizer:()=>$e,XLMTokenizer:()=>Le,is_chinese_char:()=>g});var n=r(/*! ./utils/generic.js */"./src/utils/generic.js"),o=r(/*! ./utils/core.js */"./src/utils/core.js"),s=r(/*! ./utils/hub.js */"./src/utils/hub.js"),a=r(/*! ./utils/maths.js */"./src/utils/maths.js"),i=r(/*! ./utils/tensor.js */"./src/utils/tensor.js"),l=r(/*! ./utils/data-structures.js */"./src/utils/data-structures.js"),c=r(/*! @huggingface/jinja */"./node_modules/@huggingface/jinja/dist/index.js"),d=r(/*! ./models/whisper/common_whisper.js */"./src/models/whisper/common_whisper.js");r(/*! ./utils/constants.js */"./src/utils/constants.js");async function u(e,t){const r=await Promise.all([(0,s.getModelJSON)(e,"tokenizer.json",!0,t),(0,s.getModelJSON)(e,"tokenizer_config.json",!0,t)]);return null!==t.legacy&&(r[1].legacy=t.legacy),r}function p(e,t=!0){if(void 0!==e.Regex){let t=e.Regex.replace(/\\([#&~])/g,"$1");for(const[e,r]of b)t=t.replaceAll(e,r);return new RegExp(t,"gu")}if(void 0!==e.String){const r=(0,o.escapeRegExp)(e.String);return new RegExp(t?r:`(${r})`,"gu")}return console.warn("Unknown pattern type:",e),null}function h(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 _(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 f(e){return e.replace(/\p{M}/gu,"")}function g(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 y extends n.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 v(e);default:if(e.vocab)return Array.isArray(e.vocab)?new F(e,...t):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,r){const n=[];let o=0;for(;o<e.length;)if(n.push(e[o]),(t.get(e[o])??r)===r)for(;++o<e.length&&(t.get(e[o])??r)===r;)t.get(n.at(-1))!==r&&(n[n.length-1]+=e[o]);else++o;return n}(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 y{constructor(e){super(e),this.tokens_to_ids=h(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 r of e){const e=[...r];if(e.length>this.max_input_chars_per_word){t.push(this.unk_token);continue}let n=!1,o=0;const s=[];for(;o<e.length;){let t=e.length,r=null;for(;o<t;){let n=e.slice(o,t).join("");if(o>0&&(n=this.config.continuing_subword_prefix+n),this.tokens_to_ids.has(n)){r=n;break}--t}if(null===r){n=!0;break}s.push(r),o=t}n?t.push(this.unk_token):t.push(...s)}return t}}class F extends y{constructor(e,t){super(e);const r=e.vocab.length;this.vocab=new Array(r),this.scores=new Array(r);for(let t=0;t<r;++t){const r=e.vocab[t];this.vocab[t]=r[0],this.scores[t]=r[1]}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 r=0;for(;r<t.length;){let n=!1;const s=[],a=t.slice(r).join(""),i=this.trie.commonPrefixSearch(a);for(const t of i){s.push(t);const a=this.tokens_to_ids.get(t),i=this.scores[a],l=(0,o.len)(t);e.insert(r,l,i,a),n||1!==l||(n=!0)}n||e.insert(r,1,this.unk_score,this.unk_token_id),r+=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 r of e){const e=this.tokenize(r);t.push(...e)}return t}}const P=(()=>{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 r=0;for(let n=0;n<256;++n)e.includes(n)||(e.push(n),t.push(256+r),r+=1);const n=t.map((e=>String.fromCharCode(e)));return Object.fromEntries(e.map(((e,t)=>[e,n[t]])))})(),C=(0,o.reverseDictionary)(P);class v extends y{constructor(e){super(e),this.tokens_to_ids=h(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 r=Array.from(e);this.end_of_word_suffix&&(r[r.length-1]+=this.end_of_word_suffix);let n=[];if(r.length>1){const e=new l.PriorityQueue(((e,t)=>e.score<t.score));let t={token:r[0],bias:0,prev:null,next:null},o=t;for(let t=1;t<r.length;++t){const n={bias:t/r.length,token:r[t],prev:o,next:null};o.next=n,this._add_node(e,o),o=n}for(;!e.isEmpty();){const r=e.pop();if(r.deleted||!r.next||r.next.deleted)continue;if(r.deleted=!0,r.next.deleted=!0,r.prev){const e={...r.prev};r.prev.deleted=!0,r.prev=e,e.prev?e.prev.next=e:t=e}const n={token:r.token+r.next.token,bias:r.bias,prev:r.prev,next:r.next.next};n.prev?(n.prev.next=n,this._add_node(e,n.prev)):t=n,n.next&&(n.next.prev=n,this._add_node(e,n))}for(let e=t;null!==e;e=e.next)n.push(e.token)}else n=r;if(this.continuing_subword_suffix)for(let e=0;e<n.length-1;++e)n[e]+=this.continuing_subword_suffix;return this.cache.set(e,n),n}_add_node(e,t){const r=this.bpe_ranks.get(JSON.stringify([t.token,t.next.token]));void 0!==r&&(t.score=r+t.bias,e.push(t))}encode(e){const t=[];for(const r of e){if(this.ignore_merges&&this.tokens_to_ids.has(r)){t.push(r);continue}const e=this.bpe(r);for(const r of e)if(this.tokens_to_ids.has(r))t.push(r);else if(this.byte_fallback){const e=Array.from(this.text_encoder.encode(r)).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 y{constructor(e,t){super(e),this.tokens_to_ids=h(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 n.Callable{constructor(e){super(),this.config=e}static fromConfig(e){if(null===e)return null;switch(e.type){case"BertNormalizer":return new j(e);case"Precompiled":return new pe(e);case"Sequence":return new V(e);case"Replace":return new E(e);case"NFC":return new L(e);case"NFKC":return new z(e);case"NFKD":return new I(e);case"Strip":return new B(e);case"StripAccents":return new N(e);case"Lowercase":return new D(e);case"Prepend":return new O(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=p(this.config.pattern);return null===t?e:e.replaceAll(t,this.config.content)}}class L extends A{normalize(e){return e=e.normalize("NFC")}}class z extends A{normalize(e){return e=e.normalize("NFKC")}}class I extends A{normalize(e){return e=e.normalize("NFKD")}}class B 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=f(e)}}class D extends A{normalize(e){return e=e.toLowerCase()}}class O extends A{normalize(e){return e=this.config.prepend+e}}class V 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 j extends A{_tokenize_chinese_chars(e){const t=[];for(let r=0;r<e.length;++r){const n=e[r];g(n.charCodeAt(0))?(t.push(" "),t.push(n),t.push(" ")):t.push(n)}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 r of e){const e=r.charCodeAt(0);0===e||65533===e||this._is_control(r)||(/^\s$/.test(r)?t.push(" "):t.push(r))}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 R extends n.Callable{static fromConfig(e){if(null===e)return null;switch(e.type){case"BertPreTokenizer":return new G(e);case"Sequence":return new he(e);case"Whitespace":return new me(e);case"WhitespaceSplit":return new _e(e);case"Metaspace":return new de(e);case"ByteLevel":return new q(e);case"Split":return new $(e);case"Punctuation":return new W(e);case"Digits":return new U(e);case"Replace":return new fe(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 G extends R{constructor(e){super(),this.pattern=new RegExp(`[^\\s${M}]+|[${M}]`,"gu")}pre_tokenize_text(e,t){return e.trim().match(this.pattern)||[]}}class q extends R{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=P,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 $ extends R{constructor(e){super(),this.config=e,this.pattern=p(this.config.pattern,this.config.invert)}pre_tokenize_text(e,t){return null===this.pattern?[]:this.config.invert?e.match(this.pattern)||[]:function(e,t){const r=[];let n=0;for(const o of e.matchAll(t)){const t=o[0];n<o.index&&r.push(e.slice(n,o.index)),t.length>0&&r.push(t),n=o.index+t.length}return n<e.length&&r.push(e.slice(n)),r}(e,this.pattern)}}class W extends R{constructor(e){super(),this.config=e,this.pattern=new RegExp(`[^${M}]+|[${M}]+`,"gu")}pre_tokenize_text(e,t){return e.match(this.pattern)||[]}}class U extends R{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 X extends n.Callable{constructor(e){super(),this.config=e}static fromConfig(e){if(null===e)return null;switch(e.type){case"TemplateProcessing":return new Y(e);case"ByteLevel":return new J(e);case"RobertaProcessing":return new H(e);case"BertProcessing":return new Q(e);case"Sequence":return new K(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 Q extends X{constructor(e){super(e),this.cls=e.cls[0],this.sep=e.sep[0]}post_process(e,t=null,{add_special_tokens:r=!0}={}){r&&(e=(0,o.mergeArrays)([this.cls],e,[this.sep]));let n=new Array(e.length).fill(0);if(null!==t){const s=r&&this instanceof H?[this.sep]:[],a=r?[this.sep]:[];e=(0,o.mergeArrays)(e,s,t,a),n=(0,o.mergeArrays)(n,new Array(t.length+s.length+a.length).fill(1))}return{tokens:e,token_type_ids:n}}}class H extends Q{}class Y extends X{constructor(e){super(e),this.single=e.single,this.pair=e.pair}post_process(e,t=null,{add_special_tokens:r=!0}={}){const n=null===t?this.single:this.pair;let s=[],a=[];for(const i of n)"SpecialToken"in i?r&&(s.push(i.SpecialToken.id),a.push(i.SpecialToken.type_id)):"Sequence"in i&&("A"===i.Sequence.id?(s=(0,o.mergeArrays)(s,e),a=(0,o.mergeArrays)(a,new Array(e.length).fill(i.Sequence.type_id))):"B"===i.Sequence.id&&(s=(0,o.mergeArrays)(s,t),a=(0,o.mergeArrays)(a,new Array(t.length).fill(i.Sequence.type_id))));return{tokens:s,token_type_ids:a}}}class J extends X{post_process(e,t=null){return t&&(e=(0,o.mergeArrays)(e,t)),{tokens:e}}}class K extends X{constructor(e){super(e),this.processors=e.processors.map((e=>X.fromConfig(e)))}post_process(e,t=null,r={}){let n;for(const o of this.processors)if(o instanceof J){if(e=o.post_process(e).tokens,t){t=o.post_process(t).tokens}}else{const s=o.post_process(e,t,r);e=s.tokens,n=s.token_type_ids}return{tokens:e,token_type_ids:n}}}class Z extends n.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 oe(e);case"Metaspace":return new ue(e);case"ByteLevel":return new se(e);case"Replace":return new ee(e);case"ByteFallback":return new te(e);case"Fuse":return new re(e);case"Strip":return new ne(e);case"Sequence":return new ie(e);case"CTC":return new ae(e);case"BPEDecoder":return new le(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 ee extends Z{decode_chain(e){const t=p(this.config.pattern);return null===t?e:e.map((e=>e.replaceAll(t,this.config.content)))}}class te extends Z{constructor(e){super(e),this.text_decoder=new TextDecoder}decode_chain(e){const t=[];let r=[];for(const n of e){let e=null;if(6===n.length&&n.startsWith("<0x")&&n.endsWith(">")){const t=parseInt(n.slice(3,5),16);isNaN(t)||(e=t)}if(null!==e)r.push(e);else{if(r.length>0){const e=this.text_decoder.decode(Uint8Array.from(r));t.push(e),r=[]}t.push(n)}}if(r.length>0){const e=this.text_decoder.decode(Uint8Array.from(r));t.push(e),r=[]}return t}}class re extends Z{decode_chain(e){return[e.join("")]}}class ne extends Z{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 r=0;r<this.start&&e[r]===this.content;++r)t=r+1;let r=e.length;for(let t=0;t<this.stop;++t){const n=e.length-t-1;if(e[n]!==this.content)break;r=n}return e.slice(t,r)}))}}class oe extends Z{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=_(e)),e)))}}class se extends Z{constructor(e){super(e),this.byte_decoder=C,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(""),r=new Uint8Array([...t].map((e=>this.byte_decoder[e])));return this.text_decoder.decode(r)}decode_chain(e){const t=[];let r=[];for(const n of e)void 0!==this.added_tokens.find((e=>e.content===n))?(r.length>0&&(t.push(this.convert_tokens_to_string(r)),r=[]),t.push(n)):r.push(n);return r.length>0&&t.push(this.convert_tokens_to_string(r)),t}}class ae extends Z{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 r=1;r<e.length;++r)e[r]!==t.at(-1)&&t.push(e[r]);let r=t.filter((e=>e!==this.pad_token)).join("");return this.cleanup&&(r=_(r).replaceAll(this.word_delimiter_token," ").trim()),r}decode_chain(e){return[this.convert_tokens_to_string(e)]}}class ie extends Z{constructor(e){super(e),this.decoders=e.decoders.map((e=>Z.fromConfig(e)))}decode_chain(e){return this.decoders.reduce(((e,t)=>t.decode_chain(e)),e)}}class le extends Z{constructor(e){super(e),this.suffix=this.config.suffix}decode_chain(e){return e.map(((t,r)=>t.replaceAll(this.suffix,r===e.length-1?"":" ")))}}class ce extends Z{decode_chain(e){let t="";for(let r=1;r<e.length;r+=2)t+=e[r];return[t]}}class de extends R{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 r=e.replaceAll(" ",this.strRep);return this.addPrefixSpace&&!r.startsWith(this.replacement)&&("always"===this.prepend_scheme||"first"===this.prepend_scheme&&0===t)&&(r=this.strRep+r),[r]}}class ue extends Z{constructor(e){super(e),this.addPrefixSpace=e.add_prefix_space,this.replacement=e.replacement}decode_chain(e){const t=[];for(let r=0;r<e.length;++r){let n=e[r].replaceAll(this.replacement," ");this.addPrefixSpace&&0==r&&n.startsWith(" ")&&(n=n.substring(1)),t.push(n)}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 R{constructor(e){super(),this.tokenizers=e.pretokenizers.map((e=>R.fromConfig(e)))}pre_tokenize_text(e,t){return this.tokenizers.reduce(((e,r)=>r.pre_tokenize(e,t)),[e])}}class me extends R{constructor(e){super()}pre_tokenize_text(e,t){return e.match(/\w+|[^\w\s]+/g)||[]}}class _e extends R{constructor(e){super()}pre_tokenize_text(e,t){return function(e){return e.match(/\S+/g)||[]}(e)}}class fe extends R{constructor(e){super(),this.config=e,this.pattern=p(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 ge=["bos_token","eos_token","unk_token","sep_token","pad_token","cls_token","mask_token"];function Me(e,t,r,n){for(const s of Object.keys(e)){const a=t-e[s].length,i=r(s),l=new Array(a).fill(i);e[s]="right"===n?(0,o.mergeArrays)(e[s],l):(0,o.mergeArrays)(l,e[s])}}function we(e,t){for(const r of Object.keys(e))e[r].length=t}class Te extends n.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=R.fromConfig(e.pre_tokenizer),this.model=y.fromConfig(e.model,t),this.post_processor=X.fromConfig(e.post_processor),this.decoder=Z.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,o.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.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:r}of this.chat_template){if("string"!=typeof t||"string"!=typeof r)throw new Error('Chat template must be a list of objects with "name" and "template" properties');e[t]=r}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:r=null,cache_dir:n=null,local_files_only:o=!1,revision:s="main",legacy:a=null}={}){return new this(...await u(e,{progress_callback:t,config:r,cache_dir:n,local_files_only:o,revision:s,legacy:a}))}_call(e,{text_pair:t=null,add_special_tokens:r=!0,padding:n=!1,truncation:o=null,max_length:s=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,n)=>this._encode_plus(e,{text_pair:t[n],add_special_tokens:r,return_token_type_ids:c})))}else u=e.map((e=>this._encode_plus(e,{add_special_tokens:r,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:r,return_token_type_ids:c})]}if(null===s?s="max_length"===n?this.model_max_length:(0,a.max)(u.map((e=>e.input_ids.length)))[0]:o||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."),s=Math.min(s,this.model_max_length??1/0),n||o)for(let e=0;e<u.length;++e)u[e].input_ids.length!==s&&(u[e].input_ids.length>s?o&&we(u[e],s):n&&Me(u[e],s,(e=>"input_ids"===e?this.pad_token_id:0),this.padding_side));const p={};if(l){if((!n||!o)&&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]))p[t]=new i.Tensor("int64",BigInt64Array.from(u.flatMap((e=>e[t])).map(BigInt)),e)}else{for(const e of Object.keys(u[0]))p[e]=u.map((t=>t[e]));if(!d)for(const e of Object.keys(p))p[e]=p[e][0]}return p}_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 f(e.toLowerCase())}(e)),null!==this.normalizer&&(e=this.normalizer(e)),0===e.length)return[];const r=null!==this.pre_tokenizer?this.pre_tokenizer(e,{section_index:t}):[e];return this.model(r)}})).flat();return t}_encode_plus(e,{text_pair:t=null,add_special_tokens:r=!0,return_token_type_ids:n=null}={}){const{tokens:o,token_type_ids:s}=this._tokenize_helper(e,{pair:t,add_special_tokens:r}),a=this.model.convert_tokens_to_ids(o),i={input_ids:a,attention_mask:new Array(a.length).fill(1)};return(n??this.return_token_type_ids)&&s&&(i.token_type_ids=s),i}_tokenize_helper(e,{pair:t=null,add_special_tokens:r=!1}={}){const n=this._encode_text(e),s=this._encode_text(t);return this.post_processor?this.post_processor(n,s,{add_special_tokens:r}):{tokens:(0,o.mergeArrays)(n??[],s??[])}}tokenize(e,{pair:t=null,add_special_tokens:r=!1}={}){return this._tokenize_helper(e,{pair:t,add_special_tokens:r}).tokens}encode(e,{text_pair:t=null,add_special_tokens:r=!0,return_token_type_ids:n=null}={}){return this._encode_plus(e,{text_pair:t,add_special_tokens:r,return_token_type_ids:n}).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,o.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:r=null}){let n=this.model.convert_ids_to_tokens(e);t&&(n=n.filter((e=>!this.special_tokens.includes(e))));let o=this.decoder?this.decoder(n):n.join(" ");return this.decoder&&this.decoder.end_of_word_suffix&&(o=o.replaceAll(this.decoder.end_of_word_suffix," "),t&&(o=o.trim())),(r??this.clean_up_tokenization_spaces)&&(o=_(o)),o}get_chat_template({chat_template:e=null,tools:t=null}={}){if(this.chat_template&&"object"==typeof this.chat_template){const r=this.chat_template;if(null!==e&&Object.hasOwn(r,e))e=r[e];else if(null===e)if(null!==t&&"tool_use"in r)e=r.tool_use;else{if(!("default"in r))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(r).sort()}.`);e=r.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:r=null,chat_template:n=null,add_generation_prompt:o=!1,tokenize:s=!0,padding:a=!1,truncation:i=!1,max_length:l=null,return_tensor:d=!0,return_dict:u=!1,tokenizer_kwargs:p={},...h}={}){if("string"!=typeof(n=this.get_chat_template({chat_template:n,tools:t})))throw Error("chat_template must be a string, but got "+typeof n);let m=this._compiled_template_cache.get(n);void 0===m&&(m=new c.Template(n),this._compiled_template_cache.set(n,m));const _=Object.create(null);for(const e of ge){const t=this.getToken(e);t&&(_[e]=t)}const f=m.render({messages:e,add_generation_prompt:o,tools:t,documents:r,..._,...h});if(s){const e=this._call(f,{add_special_tokens:!1,padding:a,truncation:i,max_length:l,return_tensor:d,...p});return u?e:e.input_ids}return f}}class be extends Te{return_token_type_ids=!0}class xe extends Te{return_token_type_ids=!0}class ye extends Te{return_token_type_ids=!0}class ke extends Te{return_token_type_ids=!0}class Fe extends Te{return_token_type_ids=!0}class Pe extends Te{return_token_type_ids=!0}class Ce extends Te{return_token_type_ids=!0}class ve extends Te{return_token_type_ids=!0}class Se extends Te{return_token_type_ids=!0}class Ae extends Te{}class Ee extends Te{}class Le extends Te{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 ze extends Te{return_token_type_ids=!0}class Ie extends Te{}class Be extends Te{}class Ne extends Te{}class De extends Te{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,r){return Ke(this,e,t,r)}}class Oe extends De{}class Ve extends Te{}class je extends Te{}const Re="▁";class Ge extends Te{padding_side="left";constructor(e,t){super(e,t),this.legacy=t.legacy??!0,this.legacy||(this.normalizer=null,this.pre_tokenizer=new de({replacement:Re,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(Re+e.replaceAll(Re," "));return t.length>1&&t[0]===Re&&this.special_tokens.includes(t[1])&&(t=t.slice(1)),t}}class qe extends Te{}class $e extends Te{}class We extends Te{}class Ue extends Te{}class Xe extends Te{}class Qe extends Te{}class He extends Te{}class Ye extends Te{}class Je extends Te{}function Ke(e,t,r,n){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 o=n.src_lang,s=n.tgt_lang;if(!e.language_codes.includes(s))throw new Error(`Target language code "${s}" is not valid. Must be one of: {${e.language_codes.join(", ")}}`);if(void 0!==o){if(!e.language_codes.includes(o))throw new Error(`Source language code "${o}" 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(o);break}}return n.forced_bos_token_id=e.model.convert_tokens_to_ids([e.lang_to_token(s)])[0],e._call(t,r)}class Ze extends Te{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,r){return Ke(this,e,t,r)}}class et extends Te{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,r){return Ke(this,e,t,r)}}class tt extends Te{get timestamp_begin(){return this.model.convert_tokens_to_ids(["<|notimestamps|>"])[0]+1}_decode_asr(e,{return_timestamps:t=!1,return_language:r=!1,time_precision:n=null,force_full_sequences:o=!0}={}){if(null===n)throw Error("Must specify time_precision");let s=null;const i="word"===t;function l(){return{language:s,timestamp:[null,null],text:""}}const c=[];let u=l(),p=0;const h=this.timestamp_begin;let m=[],_=[],f=!1,g=null;const M=new Set(this.all_special_ids);for(const r of e){const e=r.tokens,o=i?r.token_timestamps:null;let T=null,b=h;if("stride"in r){const[t,o,s]=r.stride;if(p-=o,g=t-s,o&&(b=o/n+h),s)for(let t=e.length-1;t>=0;--t){const r=Number(e[t]);if(r>=h){if(null!==T&&(r-h)*n<g)break;T=r}}}let x=[],y=[];for(let r=0;r<e.length;++r){const g=Number(e[r]);if(M.has(g)){const e=this.decode([g]),r=d.WHISPER_LANGUAGE_MAPPING.get(e.slice(2,-2));if(void 0!==r){if(null!==s&&r!==s&&!t){m.push(x);const e=this.findLongestCommonSequence(m)[0],t=this.decode(e);u.text=t,c.push(u),m=[],x=[],u=l()}s=u.language=r}}else if(g>=h){const e=(g-h)*n+p,t=(0,a.round)(e,2);if(null!==T&&g>=T)f=!0;else if(f||m.length>0&&g<b)f=!1;else if(null===u.timestamp[0])u.timestamp[0]=t;else if(t===u.timestamp[0]);else{u.timestamp[1]=t,m.push(x),i&&_.push(y);const[e,r]=this.findLongestCommonSequence(m,_),n=this.decode(e);u.text=n,i&&(u.words=this.collateWordTimestamps(e,r,s)),c.push(u),m=[],x=[],_=[],y=[],u=l()}}else if(x.push(g),i){let e,t=(0,a.round)(o[r]+p,2);if(r+1<o.length){e=(0,a.round)(o[r+1]+p,2);const s=this.decode([g]);w.test(s)&&(e=(0,a.round)(Math.min(t+n,e),2))}else e=null;y.push([t,e])}}if("stride"in r){const[e,t,n]=r.stride;p+=e-n}x.length>0?(m.push(x),i&&_.push(y)):m.every((e=>0===e.length))&&(u=l(),m=[],x=[],_=[],y=[])}if(m.length>0){if(o&&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,r]=this.findLongestCommonSequence(m,_),n=this.decode(e);u.text=n,i&&(u.words=this.collateWordTimestamps(e,r,s)),c.push(u)}let T=Object.create(null);const b=c.map((e=>e.text)).join("");if(t||r){for(let e=0;e<c.length;++e){const n=c[e];t||delete n.timestamp,r||delete n.language}if(i){const e=[];for(const t of c)for(const r of t.words)e.push(r);T={chunks:e}}else T={chunks:c}}return[b,T]}findLongestCommonSequence(e,t=null){let r=e[0],n=r.length,o=[];const s=Array.isArray(t)&&t.length>0;let a=s?[]:null,i=s?t[0]:null;for(let l=1;l<e.length;++l){const c=e[l];let d=0,u=[n,n,0,0];const p=c.length;for(let e=1;e<n+p;++e){const o=Math.max(0,n-e),a=Math.min(n,n+p-e),h=r.slice(o,a),m=Math.max(0,e-n),_=Math.min(p,e),f=c.slice(m,_);if(h.length!==f.length)throw new Error("There is a bug within whisper `decode_asr` function, please report it. Dropping to prevent bad inference.");let g;g=s?h.filter(((e,r)=>e===f[r]&&i[o+r]<=t[l][m+r])).length:h.filter(((e,t)=>e===f[t])).length;const M=g/e+e/1e4;g>1&&M>d&&(d=M,u=[o,a,m,_])}const[h,m,_,f]=u,g=Math.floor((m+h)/2),M=Math.floor((f+_)/2);o.push(...r.slice(0,g)),r=c.slice(M),n=r.length,s&&(a.push(...i.slice(0,g)),i=t[l].slice(M))}return o.push(...r),s?(a.push(...i),[o,a]):[o,[]]}collateWordTimestamps(e,t,r){const[n,o,s]=this.combineTokensIntoWords(e,r),a=[];for(let e=0;e<n.length;++e){const r=s[e];a.push({text:n[e],timestamp:[t[r.at(0)][0],t[r.at(-1)][1]]})}return a}combineTokensIntoWords(e,t,r="\"'“¡¿([{-",n="\"'.。,,!!??::”)]}、"){let o,s,a;return["chinese","japanese","thai","lao","myanmar"].includes(t=t??"english")?[o,s,a]=this.splitTokensOnUnicode(e):[o,s,a]=this.splitTokensOnSpaces(e),this.mergePunctuations(o,s,a,r,n)}decode(e,t){let r;return t?.decode_with_timestamps?(e instanceof i.Tensor&&(e=m(e)),r=this.decodeWithTimestamps(e,t)):r=super.decode(e,t),r}decodeWithTimestamps(e,t){const r=t?.time_precision??.02,n=Array.from(this.all_special_ids).at(-1)+1;let o=[[]];for(let t of e)if(t=Number(t),t>=n){const e=((t-n)*r).toFixed(2);o.push(`<|${e}|>`),o.push([])}else o[o.length-1].push(t);return o=o.map((e=>"string"==typeof e?e:super.decode(e,t))),o.join("")}splitTokensOnUnicode(e){const t=this.decode(e,{decode_with_timestamps:!0}),r=[],n=[],o=[];let s=[],a=[],i=0;for(let l=0;l<e.length;++l){const c=e[l];s.push(c),a.push(l);const d=this.decode(s,{decode_with_timestamps:!0});d.includes("�")&&"�"!==t[i+d.indexOf("�")]||(r.push(d),n.push(s),o.push(a),s=[],a=[],i+=d.length)}return[r,n,o]}splitTokensOnSpaces(e){const[t,r,n]=this.splitTokensOnUnicode(e),o=[],s=[],a=[],i=new RegExp(`^[${M}]$`,"gu");for(let e=0;e<t.length;++e){const l=t[e],c=r[e],d=n[e],u=c[0]>=this.model.tokens_to_ids.get("<|endoftext|>"),p=l.startsWith(" "),h=l.trim(),m=i.test(h);if(u||p||m||0===o.length)o.push(l),s.push(c),a.push(d);else{const e=o.length-1;o[e]+=l,s[e].push(...c),a[e].push(...d)}}return[o,s,a]}mergePunctuations(e,t,r,n,s){const a=structuredClone(e),i=structuredClone(t),l=structuredClone(r);let c=a.length-2,d=a.length-1;for(;c>=0;)a[c].startsWith(" ")&&n.includes(a[c].trim())?(a[d]=a[c]+a[d],i[d]=(0,o.mergeArrays)(i[c],i[d]),l[d]=(0,o.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(" ")&&s.includes(a[d])?(a[c]+=a[d],i[c]=(0,o.mergeArrays)(i[c],i[d]),l[c]=(0,o.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 Te{}class nt extends Te{}class ot extends Te{}class st extends Te{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,...r]=e.trim().split(this.languageRegex);if(0===r.length)return super._encode_text(t);if(2===r.length){const[e,t]=r;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,o.mergeArrays)([e],super._encode_text(t))}}}class at extends Te{}class it extends Te{}class lt extends Te{}class ct extends Te{}class dt extends Te{}class ut extends Te{constructor(e,t){super(e,t),this.decoder=new ce({})}}class pt extends Te{}class ht{static TOKENIZER_CLASS_MAPPING={T5Tokenizer:Ie,DistilBertTokenizer:Ae,CamembertTokenizer:Ee,DebertaTokenizer:Fe,DebertaV2Tokenizer:Pe,BertTokenizer:be,HerbertTokenizer:Ce,ConvBertTokenizer:ve,RoFormerTokenizer:Se,XLMTokenizer:Le,ElectraTokenizer:ze,MobileBertTokenizer:ye,SqueezeBertTokenizer:ke,AlbertTokenizer:xe,GPT2Tokenizer:Be,BartTokenizer:Ne,MBartTokenizer:De,MBart50Tokenizer:Oe,RobertaTokenizer:Ve,WhisperTokenizer:tt,CodeGenTokenizer:rt,CLIPTokenizer:nt,SiglipTokenizer:ot,MarianTokenizer:st,BloomTokenizer:je,NllbTokenizer:Ze,M2M100Tokenizer:et,LlamaTokenizer:Ge,CodeLlamaTokenizer:qe,XLMRobertaTokenizer:$e,MPNetTokenizer:We,FalconTokenizer:Ue,GPTNeoXTokenizer:Xe,EsmTokenizer:Qe,Wav2Vec2CTCTokenizer:at,BlenderbotTokenizer:it,BlenderbotSmallTokenizer:lt,SpeechT5Tokenizer:ct,NougatTokenizer:dt,VitsTokenizer:ut,Qwen2Tokenizer:He,GemmaTokenizer:Ye,Grok1Tokenizer:Je,CohereTokenizer:pt,PreTrainedTokenizer:Te};static async from_pretrained(e,{progress_callback:t=null,config:r=null,cache_dir:n=null,local_files_only:o=!1,revision:s="main",legacy:a=null}={}){const[i,l]=await u(e,{progress_callback:t,config:r,cache_dir:n,local_files_only:o,revision:s,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=Te),new d(i,l)}}},"./src/utils/audio.js":
131
131
  /*!****************************!*\
132
132
  !*** ./src/utils/audio.js ***!
133
133
  \****************************/(e,t,r)=>{r.r(t),r.d(t,{hamming:()=>d,hanning:()=>c,mel_filter_bank:()=>_,read_audio:()=>i,spectrogram:()=>g,window_function:()=>M});var n=r(/*! ./hub.js */"./src/utils/hub.js"),o=r(/*! ./maths.js */"./src/utils/maths.js"),s=r(/*! ./core.js */"./src/utils/core.js"),a=r(/*! ./tensor.js */"./src/utils/tensor.js");async function i(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 r=await(await(0,n.getFile)(e)).arrayBuffer(),o=new AudioContext({sampleRate:t});void 0===t&&console.warn(`No sampling rate provided, using default of ${o.sampleRate}Hz.`);const s=await o.decodeAudioData(r);let a;if(2===s.numberOfChannels){const e=Math.sqrt(2),t=s.getChannelData(0),r=s.getChannelData(1);a=new Float32Array(t.length);for(let n=0;n<s.length;++n)a[n]=e*(t[n]+r[n])/2}else a=s.getChannelData(0);return a}function l(e,t){if(e<1)return new Float64Array;if(1===e)return new Float64Array([1]);const r=1-t,n=2*Math.PI/(e-1),o=new Float64Array(e);for(let s=0;s<e;++s)o[s]=t-r*Math.cos(s*n);return o}function c(e){return l(e,.5)}function d(e){return l(e,.54)}const u={htk:e=>2595*Math.log10(1+e/700),kaldi:e=>1127*Math.log(1+e/700),slaney:(e,t=1e3,r=15,n=27/Math.log(6.4))=>e>=t?r+Math.log(e/t)*n:3*e/200};function p(e,t="htk"){const r=u[t];if(!r)throw new Error('mel_scale should be one of "htk", "slaney" or "kaldi".');return"number"==typeof e?r(e):e.map((e=>r(e)))}const h={htk:e=>700*(10**(e/2595)-1),kaldi:e=>700*(Math.exp(e/1127)-1),slaney:(e,t=1e3,r=15,n=Math.log(6.4)/27)=>e>=r?t*Math.exp(n*(e-r)):200*e/3};function m(e,t,r){const n=(t-e)/(r-1);return Float64Array.from({length:r},((t,r)=>e+n*r))}function _(e,t,r,n,o,s=null,a="htk",i=!1){if(null!==s&&"slaney"!==s)throw new Error('norm must be one of null or "slaney"');const l=m(p(r,a),p(n,a),t+2);let c,d=function(e,t="htk"){const r=h[t];if(!r)throw new Error('mel_scale should be one of "htk", "slaney" or "kaldi".');return"number"==typeof e?r(e):e.map((e=>r(e)))}(l,a);if(i){const t=o/(2*e);c=p(Float64Array.from({length:e},((e,r)=>r*t)),a),d=l}else c=m(0,Math.floor(o/2),e);const u=function(e,t){const r=Float64Array.from({length:t.length-1},((e,r)=>t[r+1]-t[r])),n=Array.from({length:e.length},(()=>new Array(t.length)));for(let r=0;r<e.length;++r){const o=n[r];for(let n=0;n<t.length;++n)o[n]=t[n]-e[r]}const o=t.length-2,s=Array.from({length:o},(()=>new Array(e.length)));for(let t=0;t<e.length;++t){const e=n[t];for(let n=0;n<o;++n){const o=-e[n]/r[n],a=e[n+2]/r[n+1];s[n][t]=Math.max(0,Math.min(o,a))}}return s}(c,d);if(null!==s&&"slaney"===s)for(let r=0;r<t;++r){const t=u[r],n=2/(d[r+2]-d[r]);for(let r=0;r<e;++r)t[r]*=n}return u}function f(e,t,r,n,s){if(r<=0)throw new Error("reference must be greater than zero");if(n<=0)throw new Error("min_value must be greater than zero");r=Math.max(n,r);const a=Math.log10(r);for(let r=0;r<e.length;++r)e[r]=t*Math.log10(Math.max(n,e[r])-a);if(null!==s){if(s<=0)throw new Error("db_range must be greater than zero");const t=(0,o.max)(e)[0]-s;for(let r=0;r<e.length;++r)e[r]=Math.max(e[r],t)}return e}async function g(e,t,r,n,{fft_length:i=null,power:l=1,center:c=!0,pad_mode:d="reflect",onesided:u=!0,preemphasis:p=null,mel_filters:h=null,mel_floor:m=1e-10,log_mel:_=null,reference:g=1,min_value:M=1e-10,db_range:w=null,remove_dc_offset:T=null,min_num_frames:b=null,max_num_frames:x=null,do_pad:y=!0,transpose:k=!1}={}){const F=t.length;if(null===i&&(i=r),r>i)throw Error(`frame_length (${r}) may not be larger than fft_length (${i})`);if(F!==r)throw new Error(`Length of the window (${F}) must equal frame_length (${r})`);if(n<=0)throw new Error("hop_length must be greater than zero");if(null===l&&null!==h)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((i-1)/2)+1;e=function(e,t,r){const n=new e.constructor(e.length+t+r),o=e.length-1;for(let r=0;r<e.length;++r)n[t+r]=e[r];for(let r=1;r<=t;++r)n[t-r]=e[(0,s.calculateReflectOffset)(r,o)];for(let a=1;a<=r;++a)n[o+t+a]=e[(0,s.calculateReflectOffset)(o-a,o)];return n}(e,t,t)}let P=Math.floor(1+Math.floor((e.length-r)/n));null!==b&&P<b&&(P=b);const C=u?Math.floor(i/2)+1:i;let v=P,S=P;null!==x&&(x>P?y&&(S=x):S=v=x);const A=new o.FFT(i),E=new Float64Array(i),L=new Float64Array(A.outputBufferSize),z=new Float32Array(C*S);for(let o=0;o<v;++o){const s=o*n,a=Math.min(e.length-s,r);a!==r&&E.fill(0,0,r);for(let t=0;t<a;++t)E[t]=e[s+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!==p){for(let e=a-1;e>=1;--e)E[e]-=p*E[e-1];E[0]*=1-p}for(let e=0;e<t.length;++e)E[e]*=t[e];A.realTransform(L,E);for(let e=0;e<C;++e){const t=e<<1;z[e*S+o]=L[t]**2+L[t+1]**2}}if(null!==l&&2!==l){const e=2/l;for(let t=0;t<z.length;++t)z[t]**=e}const I=h.length;let B=await(0,a.matmul)(new a.Tensor("float32",h.flat(),[I,C]),new a.Tensor("float32",z,[C,S]));k&&(B=B.transpose(1,0));const N=B.data;for(let e=0;e<N.length;++e)N[e]=Math.max(m,N[e]);if(null!==l&&null!==_){const e=Math.min(N.length,v*I);switch(_){case"log":for(let t=0;t<e;++t)N[t]=Math.log(N[t]);break;case"log10":for(let t=0;t<e;++t)N[t]=Math.log10(N[t]);break;case"dB":if(1===l)!function(e,t=1,r=1e-5,n=null){f(e,20,t,r,n)}(N,g,M,w);else{if(2!==l)throw new Error(`Cannot use log_mel option '${_}' with power ${l}`);!function(e,t=1,r=1e-10,n=null){f(e,10,t,r,n)}(N,g,M,w)}break;default:throw new Error(`log_mel must be one of null, 'log', 'log10' or 'dB'. Got '${_}'`)}}return B}function M(e,t,{periodic:r=!0,frame_length:n=null,center:o=!0}={}){const s=r?e+1:e;let a;switch(t){case"boxcar":a=new Float64Array(s).fill(1);break;case"hann":case"hann_window":a=c(s);break;case"hamming":a=d(s);break;case"povey":a=c(s).map((e=>Math.pow(e,.85)));break;default:throw new Error(`Unknown window type ${t}.`)}if(r&&(a=a.subarray(0,e)),null===n)return a;if(e>n)throw new Error(`Length of the window (${e}) may not be larger than frame_length (${n})`);return a}},"./src/utils/constants.js":
@@ -157,11 +157,11 @@ import*as e from"fs";import*as t from"onnxruntime-node";import*as r from"path";i
157
157
  \****************************/(e,t,r)=>{r.r(t),r.d(t,{RawImage:()=>m});var n=r(/*! ./hub.js */"./src/utils/hub.js"),o=r(/*! ../env.js */"./src/env.js"),s=r(/*! ./tensor.js */"./src/utils/tensor.js"),a=r(/*! sharp */"sharp");const i="undefined"!=typeof self,l=i&&"DedicatedWorkerGlobalScope"===self.constructor.name;let c,d,u;if(i)c=(e,t)=>{if(!self.OffscreenCanvas)throw new Error("OffscreenCanvas not supported by this browser.");return new self.OffscreenCanvas(e,t)},u=self.createImageBitmap,d=self.ImageData;else{if(!a.default)throw new Error("Unable to load image processing library.");u=async e=>{const t=(await e.metadata()).channels,{data:r,info:n}=await e.rotate().raw().toBuffer({resolveWithObject:!0}),o=new m(new Uint8ClampedArray(r),n.width,n.height,n.channels);return void 0!==t&&t!==n.channels&&o.convert(t),o}}const p={0:"nearest",1:"lanczos",2:"bilinear",3:"bicubic",4:"box",5:"hamming"},h=new Map([["png","image/png"],["jpg","image/jpeg"],["jpeg","image/jpeg"],["gif","image/gif"]]);class m{constructor(e,t,r,n){this.data=e,this.width=t,this.height=r,this.channels=n}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(!i)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,n.getFile)(e);if(200!==t.status)throw new Error(`Unable to read image from "${e}" (${t.status} ${t.statusText})`);const r=await t.blob();return this.fromBlob(r)}static async fromBlob(e){if(i){const t=await u(e),r=c(t.width,t.height).getContext("2d");return r.drawImage(t,0,0),new this(r.getImageData(0,0,t.width,t.height).data,t.width,t.height,4)}{const t=(0,a.default)(await e.arrayBuffer());return await u(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,r=0;t<this.data.length;t+=this.channels){const n=this.data[t],o=this.data[t+1],s=this.data[t+2];e[r++]=Math.round(.2989*n+.587*o+.114*s)}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,r=0;t<this.data.length;++t)e[r++]=this.data[t],e[r++]=this.data[t],e[r++]=this.data[t];break;case 4:for(let t=0,r=0;t<this.data.length;t+=4)e[r++]=this.data[t],e[r++]=this.data[t+1],e[r++]=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,r=0;t<this.data.length;++t)e[r++]=this.data[t],e[r++]=this.data[t],e[r++]=this.data[t],e[r++]=255;break;case 3:for(let t=0,r=0;t<this.data.length;t+=3)e[r++]=this.data[t],e[r++]=this.data[t+1],e[r++]=this.data[t+2],e[r++]=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)}async resize(e,t,{resample:r=2}={}){let n=p[r]??r;if(i){const r=this.channels,n=this.toCanvas(),o=c(e,t).getContext("2d");o.drawImage(n,0,0,e,t);return new m(o.getImageData(0,0,e,t).data,e,t,4).convert(r)}{let r=this.toSharp();switch(n){case"box":case"hamming":"box"!==n&&"hamming"!==n||(console.warn(`Resampling method ${n} is not yet supported. Using bilinear instead.`),n="bilinear");case"nearest":case"bilinear":case"bicubic":r=r.affine([e/this.width,0,0,t/this.height],{interpolator:n});break;case"lanczos":r=r.resize({width:e,height:t,fit:"fill",kernel:"lanczos3"});break;default:throw new Error(`Resampling method ${n} is not supported.`)}return await u(r)}}async pad([e,t,r,n]){if(e=Math.max(e,0),t=Math.max(t,0),r=Math.max(r,0),n=Math.max(n,0),0===e&&0===t&&0===r&&0===n)return this;if(i){const o=this.channels,s=this.toCanvas(),a=this.width+e+t,i=this.height+r+n,l=c(a,i).getContext("2d");l.drawImage(s,0,0,this.width,this.height,e,r,a,i);return new m(l.getImageData(0,0,a,i).data,a,i,4).convert(o)}{const o=this.toSharp().extend({left:e,right:t,top:r,bottom:n});return await u(o)}}async crop([e,t,r,n]){if(e=Math.max(e,0),t=Math.max(t,0),r=Math.min(r,this.width-1),n=Math.min(n,this.height-1),0===e&&0===t&&r===this.width-1&&n===this.height-1)return this;const o=r-e+1,s=n-t+1;if(i){const r=this.channels,n=this.toCanvas(),a=c(o,s).getContext("2d");a.drawImage(n,e,t,o,s,0,0,o,s);return new m(a.getImageData(0,0,o,s).data,o,s,4).convert(r)}{const r=this.toSharp().extract({left:e,top:t,width:o,height:s});return await u(r)}}async center_crop(e,t){if(this.width===e&&this.height===t)return this;const r=(this.width-e)/2,n=(this.height-t)/2;if(i){const o=this.channels,s=this.toCanvas(),a=c(e,t).getContext("2d");let i=0,l=0,d=0,u=0;r>=0?i=r:d=-r,n>=0?l=n:u=-n,a.drawImage(s,i,l,e,t,d,u,e,t);return new m(a.getImageData(0,0,e,t).data,e,t,4).convert(o)}{let o=this.toSharp();if(r>=0&&n>=0)o=o.extract({left:Math.floor(r),top:Math.floor(n),width:e,height:t});else if(r<=0&&n<=0){const s=Math.floor(-n),a=Math.floor(-r);o=o.extend({top:s,left:a,right:e-this.width-a,bottom:t-this.height-s})}else{let s=[0,0],a=0;n<0?(s[0]=Math.floor(-n),s[1]=t-this.height-s[0]):a=Math.floor(n);let i=[0,0],l=0;r<0?(i[0]=Math.floor(-r),i[1]=e-this.width-i[0]):l=Math.floor(r),o=o.extend({top:s[0],bottom:s[1],left:i[0],right:i[1]}).extract({left:l,top:a,width:e,height:t})}return await u(o)}}async toBlob(e="image/png",t=1){if(!i)throw new Error("toBlob() is only supported in browser environments.");const r=this.toCanvas();return await r.convertToBlob({type:e,quality:t})}toTensor(e="CHW"){let t=new s.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(!i)throw new Error("toCanvas() is only supported in browser environments.");const e=this.clone().rgba(),t=c(e.width,e.height),r=new d(e.data,e.width,e.height);return t.getContext("2d").putImageData(r,0,0),t}_update(e,t,r,n=null){return this.data=e,this.width=t,this.height=r,null!==n&&(this.channels=n),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(!i){if(o.env.useFS){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(l)throw new Error("Unable to save an image from a Web Worker.");const t=e.split(".").pop().toLowerCase(),r=h.get(t)??"image/png",n=await this.toBlob(r),o=URL.createObjectURL(n),s=document.createElement("a");s.href=o,s.download=e,s.click(),s.remove()}}toSharp(){if(i)throw new Error("toSharp() is only supported in server-side environments.");return(0,a.default)(this.data,{raw:{width:this.width,height:this.height,channels:this.channels}})}}},"./src/utils/maths.js":
158
158
  /*!****************************!*\
159
159
  !*** ./src/utils/maths.js ***!
160
- \****************************/(e,t,r)=>{function n(e,[t,r,n],[o,s],a="bilinear",i=!1){const l=s/n,c=o/r,d=new e.constructor(o*s*t),u=r*n,p=o*s;for(let a=0;a<o;++a)for(let o=0;o<s;++o){const i=a*s+o,h=(o+.5)/l-.5,m=(a+.5)/c-.5;let _=Math.floor(h),f=Math.floor(m);const g=Math.min(_+1,n-1),M=Math.min(f+1,r-1);_=Math.max(_,0),f=Math.max(f,0);const w=h-_,T=m-f,b=(1-w)*(1-T),x=w*(1-T),y=(1-w)*T,k=w*T,F=f*n,P=M*n,C=F+_,v=F+g,S=P+_,A=P+g;for(let r=0;r<t;++r){const t=r*u;d[r*p+i]=b*e[t+C]+x*e[t+v]+y*e[t+S]+k*e[t+A]}}return d}function o(e,t,r){const n=new Array(r.length),o=new Array(r.length);for(let e=r.length-1,s=1;e>=0;--e)o[e]=s,n[e]=t[r[e]],s*=n[e];const s=r.map(((e,t)=>o[r.indexOf(t)])),a=new e.constructor(e.length);for(let r=0;r<e.length;++r){let n=0;for(let e=t.length-1,o=r;e>=0;--e)n+=o%t[e]*s[e],o=Math.floor(o/t[e]);a[n]=e[r]}return[a,n]}function s(e){const t=u(e)[0],r=e.map((e=>Math.exp(e-t))),n=r.reduce(((e,t)=>e+t),0);return r.map((e=>e/n))}function a(e){const t=u(e)[0];let r=0;for(let n=0;n<e.length;++n)r+=Math.exp(e[n]-t);const n=Math.log(r);return e.map((e=>e-t-n))}function i(e,t){let r=0;for(let n=0;n<e.length;++n)r+=e[n]*t[n];return r}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],r=0;for(let n=1;n<e.length;++n)e[n]<t&&(t=e[n],r=n);return[t,r]}function u(e){if(0===e.length)throw Error("Array must not be empty");let t=e[0],r=0;for(let n=1;n<e.length;++n)e[n]>t&&(t=e[n],r=n);return[Number(t),r]}function p(e){return e>0&&!(e&e-1)}r.r(t),r.d(t,{FFT:()=>_,bankers_round:()=>M,cos_sim:()=>l,dot:()=>i,dynamic_time_warping:()=>w,interpolate_data:()=>n,log_softmax:()=>a,magnitude:()=>c,max:()=>u,medianFilter:()=>f,min:()=>d,permute_data:()=>o,round:()=>g,softmax:()=>s});class h{constructor(e){if(this.size=0|e,this.size<=1||!p(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 r=this._width-t-2;this._bitrev[e]|=(e>>>t&3)<<r}}}createComplexArray(){return new Float64Array(this._csize)}fromComplexArray(e,t){const r=t||new Array(e.length>>>1);for(let t=0;t<e.length;t+=2)r[t>>>1]=e[t];return r}toComplexArray(e,t){const r=t||this.createComplexArray();for(let t=0;t<r.length;t+=2)r[t]=e[t>>>1],r[t+1]=0;return r}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,r){const n=this._csize;let o,s,a=1<<this._width,i=n/a<<1;const l=this._bitrev;if(4===i)for(o=0,s=0;o<n;o+=i,++s){const r=l[s];this._singleTransform2(t,e,o,r,a)}else for(o=0,s=0;o<n;o+=i,++s){const n=l[s];this._singleTransform4(t,e,o,n,a,r)}const c=this.table;for(a>>=2;a>=2;a>>=2){i=n/a<<1;const t=i>>>2;for(o=0;o<n;o+=i){const n=o+t-1;for(let s=o,i=0;s<n;s+=2,i+=a){const n=s,o=n+t,a=o+t,l=a+t,d=e[n],u=e[n+1],p=e[o],h=e[o+1],m=e[a],_=e[a+1],f=e[l],g=e[l+1],M=c[i],w=r*c[i+1],T=p*M-h*w,b=p*w+h*M,x=c[2*i],y=r*c[2*i+1],k=m*x-_*y,F=m*y+_*x,P=c[3*i],C=r*c[3*i+1],v=f*P-g*C,S=f*C+g*P,A=d+k,E=u+F,L=d-k,z=u-F,I=T+v,B=b+S,N=r*(T-v),D=r*(b-S);e[n]=A+I,e[n+1]=E+B,e[o]=L+D,e[o+1]=z-N,e[a]=A-I,e[a+1]=E-B,e[l]=L-D,e[l+1]=z+N}}}}_singleTransform2(e,t,r,n,o){const s=e[n],a=e[n+1],i=e[n+o],l=e[n+o+1];t[r]=s+i,t[r+1]=a+l,t[r+2]=s-i,t[r+3]=a-l}_singleTransform4(e,t,r,n,o,s){const a=2*o,i=3*o,l=e[n],c=e[n+1],d=e[n+o],u=e[n+o+1],p=e[n+a],h=e[n+a+1],m=e[n+i],_=e[n+i+1],f=l+p,g=c+h,M=l-p,w=c-h,T=d+m,b=u+_,x=s*(d-m),y=s*(u-_);t[r]=f+T,t[r+1]=g+b,t[r+2]=M+y,t[r+3]=w-x,t[r+4]=f-T,t[r+5]=g-b,t[r+6]=M-y,t[r+7]=w+x}_realTransform4(e,t,r){const n=this._csize;let o,s,a=1<<this._width,i=n/a<<1;const l=this._bitrev;if(4===i)for(o=0,s=0;o<n;o+=i,++s){const r=l[s];this._singleRealTransform2(t,e,o,r>>>1,a>>>1)}else for(o=0,s=0;o<n;o+=i,++s){const n=l[s];this._singleRealTransform4(t,e,o,n>>>1,a>>>1,r)}const c=this.table;for(a>>=2;a>=2;a>>=2){i=n/a<<1;const t=i>>>1,s=t>>>1,l=s>>>1;for(o=0;o<n;o+=i)for(let n=0,i=0;n<=l;n+=2,i+=a){const a=o+n,d=a+s,u=d+s,p=u+s,h=e[a],m=e[a+1],_=e[d],f=e[d+1],g=e[u],M=e[u+1],w=e[p],T=e[p+1],b=h,x=m,y=c[i],k=r*c[i+1],F=_*y-f*k,P=_*k+f*y,C=c[2*i],v=r*c[2*i+1],S=g*C-M*v,A=g*v+M*C,E=c[3*i],L=r*c[3*i+1],z=w*E-T*L,I=w*L+T*E,B=b+S,N=x+A,D=b-S,O=x-A,V=F+z,j=P+I,R=r*(F-z),G=r*(P-I);if(e[a]=B+V,e[a+1]=N+j,e[d]=D+G,e[d+1]=O-R,0===n){e[u]=B-V,e[u+1]=N-j;continue}if(n===l)continue;const q=o+s-n,W=o+t-n;e[q]=D-r*G,e[q+1]=-O-r*R,e[W]=B-r*V,e[W+1]=r*j-N}}const d=n>>>1;for(let t=2;t<d;t+=2)e[n-t]=e[t],e[n-t+1]=-e[t+1]}_singleRealTransform2(e,t,r,n,o){const s=e[n],a=e[n+o];t[r]=s+a,t[r+1]=0,t[r+2]=s-a,t[r+3]=0}_singleRealTransform4(e,t,r,n,o,s){const a=2*o,i=3*o,l=e[n],c=e[n+o],d=e[n+a],u=e[n+i],p=l+d,h=l-d,m=c+u,_=s*(c-u);t[r]=p+m,t[r+1]=0,t[r+2]=h,t[r+3]=-_,t[r+4]=p-m,t[r+5]=0,t[r+6]=h,t[r+7]=_}}class m{constructor(e){const t=2*(e-1),r=2*(2*e-1),n=2**Math.ceil(Math.log2(r));this.bufferSize=n,this._a=t;const o=new Float64Array(r),s=new Float64Array(n);this._chirpBuffer=new Float64Array(n),this._buffer1=new Float64Array(n),this._buffer2=new Float64Array(n),this._outBuffer1=new Float64Array(n),this._outBuffer2=new Float64Array(n);const a=-2*Math.PI/e,i=Math.cos(a),l=Math.sin(a);for(let t=0;t<r>>1;++t){const r=(t+1-e)**2/2,n=Math.sqrt(i**2+l**2)**r,a=r*Math.atan2(l,i),c=2*t;o[c]=n*Math.cos(a),o[c+1]=n*Math.sin(a),s[c]=o[c],s[c+1]=-o[c+1]}this._slicedChirpBuffer=o.subarray(t,r),this._f=new h(n>>1),this._f.transform(this._chirpBuffer,s)}_transform(e,t,r){const n=this._buffer1,o=this._buffer2,s=this._outBuffer1,a=this._outBuffer2,i=this._chirpBuffer,l=this._slicedChirpBuffer,c=this._a;if(r)for(let e=0;e<l.length;e+=2){const r=e+1,o=t[e>>1];n[e]=o*l[e],n[r]=o*l[r]}else for(let e=0;e<l.length;e+=2){const r=e+1;n[e]=t[e]*l[e]-t[r]*l[r],n[r]=t[e]*l[r]+t[r]*l[e]}this._f.transform(s,n);for(let e=0;e<i.length;e+=2){const t=e+1;o[e]=s[e]*i[e]-s[t]*i[t],o[t]=s[e]*i[t]+s[t]*i[e]}this._f.inverseTransform(a,o);for(let t=0;t<a.length;t+=2){const r=a[t+c],n=a[t+c+1],o=l[t],s=l[t+1];e[t]=r*o-n*s,e[t+1]=r*s+n*o}}transform(e,t){this._transform(e,t,!1)}realTransform(e,t){this._transform(e,t,!0)}}class _{constructor(e){this.fft_length=e,this.isPowerOfTwo=p(e),this.isPowerOfTwo?(this.fft=new h(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 f(e,t){if(t%2==0||t<=0)throw new Error("Window size must be a positive odd number");const r=new e.constructor(e.length),n=new e.constructor(t),o=Math.floor(t/2);for(let t=0;t<e.length;++t){let s=0;for(let r=-o;r<=o;++r){let o=t+r;o<0?o=Math.abs(o):o>=e.length&&(o=2*(e.length-1)-o),n[s++]=e[o]}n.sort(),r[t]=n[o]}return r}function g(e,t){const r=Math.pow(10,t);return Math.round(e*r)/r}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,r=e[0].length,n=[t+1,r+1],o=Array.from({length:n[0]},(()=>Array(n[1]).fill(1/0)));o[0][0]=0;const s=Array.from({length:n[0]},(()=>Array(n[1]).fill(-1)));for(let t=1;t<n[1];++t)for(let r=1;r<n[0];++r){const n=o[r-1][t-1],a=o[r-1][t],i=o[r][t-1];let l,c;n<a&&n<i?(l=n,c=0):a<n&&a<i?(l=a,c=1):(l=i,c=2),o[r][t]=e[r-1][t-1]+l,s[r][t]=c}for(let e=0;e<n[1];++e)s[0][e]=2;for(let e=0;e<n[0];++e)s[e][0]=1;let a=t,i=r,l=[],c=[];for(;a>0||i>0;)switch(l.push(a-1),c.push(i-1),s[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":
160
+ \****************************/(e,t,r)=>{function n(e,[t,r,n],[o,s],a="bilinear",i=!1){const l=s/n,c=o/r,d=new e.constructor(o*s*t),u=r*n,p=o*s;for(let a=0;a<o;++a)for(let o=0;o<s;++o){const i=a*s+o,h=(o+.5)/l-.5,m=(a+.5)/c-.5;let _=Math.floor(h),f=Math.floor(m);const g=Math.min(_+1,n-1),M=Math.min(f+1,r-1);_=Math.max(_,0),f=Math.max(f,0);const w=h-_,T=m-f,b=(1-w)*(1-T),x=w*(1-T),y=(1-w)*T,k=w*T,F=f*n,P=M*n,C=F+_,v=F+g,S=P+_,A=P+g;for(let r=0;r<t;++r){const t=r*u;d[r*p+i]=b*e[t+C]+x*e[t+v]+y*e[t+S]+k*e[t+A]}}return d}function o(e,t,r){const n=new Array(r.length),o=new Array(r.length);for(let e=r.length-1,s=1;e>=0;--e)o[e]=s,n[e]=t[r[e]],s*=n[e];const s=r.map(((e,t)=>o[r.indexOf(t)])),a=new e.constructor(e.length);for(let r=0;r<e.length;++r){let n=0;for(let e=t.length-1,o=r;e>=0;--e)n+=o%t[e]*s[e],o=Math.floor(o/t[e]);a[n]=e[r]}return[a,n]}function s(e){const t=u(e)[0],r=e.map((e=>Math.exp(e-t))),n=r.reduce(((e,t)=>e+t),0);return r.map((e=>e/n))}function a(e){const t=u(e)[0];let r=0;for(let n=0;n<e.length;++n)r+=Math.exp(e[n]-t);const n=Math.log(r);return e.map((e=>e-t-n))}function i(e,t){let r=0;for(let n=0;n<e.length;++n)r+=e[n]*t[n];return r}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],r=0;for(let n=1;n<e.length;++n)e[n]<t&&(t=e[n],r=n);return[t,r]}function u(e){if(0===e.length)throw Error("Array must not be empty");let t=e[0],r=0;for(let n=1;n<e.length;++n)e[n]>t&&(t=e[n],r=n);return[Number(t),r]}function p(e){return e>0&&!(e&e-1)}r.r(t),r.d(t,{FFT:()=>_,bankers_round:()=>M,cos_sim:()=>l,dot:()=>i,dynamic_time_warping:()=>w,interpolate_data:()=>n,log_softmax:()=>a,magnitude:()=>c,max:()=>u,medianFilter:()=>f,min:()=>d,permute_data:()=>o,round:()=>g,softmax:()=>s});class h{constructor(e){if(this.size=0|e,this.size<=1||!p(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 r=this._width-t-2;this._bitrev[e]|=(e>>>t&3)<<r}}}createComplexArray(){return new Float64Array(this._csize)}fromComplexArray(e,t){const r=t||new Array(e.length>>>1);for(let t=0;t<e.length;t+=2)r[t>>>1]=e[t];return r}toComplexArray(e,t){const r=t||this.createComplexArray();for(let t=0;t<r.length;t+=2)r[t]=e[t>>>1],r[t+1]=0;return r}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,r){const n=this._csize;let o,s,a=1<<this._width,i=n/a<<1;const l=this._bitrev;if(4===i)for(o=0,s=0;o<n;o+=i,++s){const r=l[s];this._singleTransform2(t,e,o,r,a)}else for(o=0,s=0;o<n;o+=i,++s){const n=l[s];this._singleTransform4(t,e,o,n,a,r)}const c=this.table;for(a>>=2;a>=2;a>>=2){i=n/a<<1;const t=i>>>2;for(o=0;o<n;o+=i){const n=o+t-1;for(let s=o,i=0;s<n;s+=2,i+=a){const n=s,o=n+t,a=o+t,l=a+t,d=e[n],u=e[n+1],p=e[o],h=e[o+1],m=e[a],_=e[a+1],f=e[l],g=e[l+1],M=c[i],w=r*c[i+1],T=p*M-h*w,b=p*w+h*M,x=c[2*i],y=r*c[2*i+1],k=m*x-_*y,F=m*y+_*x,P=c[3*i],C=r*c[3*i+1],v=f*P-g*C,S=f*C+g*P,A=d+k,E=u+F,L=d-k,z=u-F,I=T+v,B=b+S,N=r*(T-v),D=r*(b-S);e[n]=A+I,e[n+1]=E+B,e[o]=L+D,e[o+1]=z-N,e[a]=A-I,e[a+1]=E-B,e[l]=L-D,e[l+1]=z+N}}}}_singleTransform2(e,t,r,n,o){const s=e[n],a=e[n+1],i=e[n+o],l=e[n+o+1];t[r]=s+i,t[r+1]=a+l,t[r+2]=s-i,t[r+3]=a-l}_singleTransform4(e,t,r,n,o,s){const a=2*o,i=3*o,l=e[n],c=e[n+1],d=e[n+o],u=e[n+o+1],p=e[n+a],h=e[n+a+1],m=e[n+i],_=e[n+i+1],f=l+p,g=c+h,M=l-p,w=c-h,T=d+m,b=u+_,x=s*(d-m),y=s*(u-_);t[r]=f+T,t[r+1]=g+b,t[r+2]=M+y,t[r+3]=w-x,t[r+4]=f-T,t[r+5]=g-b,t[r+6]=M-y,t[r+7]=w+x}_realTransform4(e,t,r){const n=this._csize;let o,s,a=1<<this._width,i=n/a<<1;const l=this._bitrev;if(4===i)for(o=0,s=0;o<n;o+=i,++s){const r=l[s];this._singleRealTransform2(t,e,o,r>>>1,a>>>1)}else for(o=0,s=0;o<n;o+=i,++s){const n=l[s];this._singleRealTransform4(t,e,o,n>>>1,a>>>1,r)}const c=this.table;for(a>>=2;a>=2;a>>=2){i=n/a<<1;const t=i>>>1,s=t>>>1,l=s>>>1;for(o=0;o<n;o+=i)for(let n=0,i=0;n<=l;n+=2,i+=a){const a=o+n,d=a+s,u=d+s,p=u+s,h=e[a],m=e[a+1],_=e[d],f=e[d+1],g=e[u],M=e[u+1],w=e[p],T=e[p+1],b=h,x=m,y=c[i],k=r*c[i+1],F=_*y-f*k,P=_*k+f*y,C=c[2*i],v=r*c[2*i+1],S=g*C-M*v,A=g*v+M*C,E=c[3*i],L=r*c[3*i+1],z=w*E-T*L,I=w*L+T*E,B=b+S,N=x+A,D=b-S,O=x-A,V=F+z,j=P+I,R=r*(F-z),G=r*(P-I);if(e[a]=B+V,e[a+1]=N+j,e[d]=D+G,e[d+1]=O-R,0===n){e[u]=B-V,e[u+1]=N-j;continue}if(n===l)continue;const q=o+s-n,$=o+t-n;e[q]=D-r*G,e[q+1]=-O-r*R,e[$]=B-r*V,e[$+1]=r*j-N}}const d=n>>>1;for(let t=2;t<d;t+=2)e[n-t]=e[t],e[n-t+1]=-e[t+1]}_singleRealTransform2(e,t,r,n,o){const s=e[n],a=e[n+o];t[r]=s+a,t[r+1]=0,t[r+2]=s-a,t[r+3]=0}_singleRealTransform4(e,t,r,n,o,s){const a=2*o,i=3*o,l=e[n],c=e[n+o],d=e[n+a],u=e[n+i],p=l+d,h=l-d,m=c+u,_=s*(c-u);t[r]=p+m,t[r+1]=0,t[r+2]=h,t[r+3]=-_,t[r+4]=p-m,t[r+5]=0,t[r+6]=h,t[r+7]=_}}class m{constructor(e){const t=2*(e-1),r=2*(2*e-1),n=2**Math.ceil(Math.log2(r));this.bufferSize=n,this._a=t;const o=new Float64Array(r),s=new Float64Array(n);this._chirpBuffer=new Float64Array(n),this._buffer1=new Float64Array(n),this._buffer2=new Float64Array(n),this._outBuffer1=new Float64Array(n),this._outBuffer2=new Float64Array(n);const a=-2*Math.PI/e,i=Math.cos(a),l=Math.sin(a);for(let t=0;t<r>>1;++t){const r=(t+1-e)**2/2,n=Math.sqrt(i**2+l**2)**r,a=r*Math.atan2(l,i),c=2*t;o[c]=n*Math.cos(a),o[c+1]=n*Math.sin(a),s[c]=o[c],s[c+1]=-o[c+1]}this._slicedChirpBuffer=o.subarray(t,r),this._f=new h(n>>1),this._f.transform(this._chirpBuffer,s)}_transform(e,t,r){const n=this._buffer1,o=this._buffer2,s=this._outBuffer1,a=this._outBuffer2,i=this._chirpBuffer,l=this._slicedChirpBuffer,c=this._a;if(r)for(let e=0;e<l.length;e+=2){const r=e+1,o=t[e>>1];n[e]=o*l[e],n[r]=o*l[r]}else for(let e=0;e<l.length;e+=2){const r=e+1;n[e]=t[e]*l[e]-t[r]*l[r],n[r]=t[e]*l[r]+t[r]*l[e]}this._f.transform(s,n);for(let e=0;e<i.length;e+=2){const t=e+1;o[e]=s[e]*i[e]-s[t]*i[t],o[t]=s[e]*i[t]+s[t]*i[e]}this._f.inverseTransform(a,o);for(let t=0;t<a.length;t+=2){const r=a[t+c],n=a[t+c+1],o=l[t],s=l[t+1];e[t]=r*o-n*s,e[t+1]=r*s+n*o}}transform(e,t){this._transform(e,t,!1)}realTransform(e,t){this._transform(e,t,!0)}}class _{constructor(e){this.fft_length=e,this.isPowerOfTwo=p(e),this.isPowerOfTwo?(this.fft=new h(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 f(e,t){if(t%2==0||t<=0)throw new Error("Window size must be a positive odd number");const r=new e.constructor(e.length),n=new e.constructor(t),o=Math.floor(t/2);for(let t=0;t<e.length;++t){let s=0;for(let r=-o;r<=o;++r){let o=t+r;o<0?o=Math.abs(o):o>=e.length&&(o=2*(e.length-1)-o),n[s++]=e[o]}n.sort(),r[t]=n[o]}return r}function g(e,t){const r=Math.pow(10,t);return Math.round(e*r)/r}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,r=e[0].length,n=[t+1,r+1],o=Array.from({length:n[0]},(()=>Array(n[1]).fill(1/0)));o[0][0]=0;const s=Array.from({length:n[0]},(()=>Array(n[1]).fill(-1)));for(let t=1;t<n[1];++t)for(let r=1;r<n[0];++r){const n=o[r-1][t-1],a=o[r-1][t],i=o[r][t-1];let l,c;n<a&&n<i?(l=n,c=0):a<n&&a<i?(l=a,c=1):(l=i,c=2),o[r][t]=e[r-1][t-1]+l,s[r][t]=c}for(let e=0;e<n[1];++e)s[0][e]=2;for(let e=0;e<n[0];++e)s[e][0]=1;let a=t,i=r,l=[],c=[];for(;a>0||i>0;)switch(l.push(a-1),c.push(i-1),s[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":
161
161
  /*!*****************************!*\
162
162
  !*** ./src/utils/tensor.js ***!
163
163
  \*****************************/(e,t,r)=>{r.r(t),r.d(t,{Tensor:()=>i,cat:()=>w,full:()=>k,full_like:()=>F,interpolate:()=>c,interpolate_4d:()=>d,layer_norm:()=>_,matmul:()=>u,mean:()=>x,mean_pooling:()=>m,ones:()=>P,ones_like:()=>C,permute:()=>l,quantize_embeddings:()=>A,rfft:()=>p,stack:()=>T,std_mean:()=>b,topk:()=>h,zeros:()=>v,zeros_like:()=>S});var n=r(/*! ./maths.js */"./src/utils/maths.js"),o=r(/*! ../backends/onnx.js */"./src/backends/onnx.js"),s=r(/*! ../ops/registry.js */"./src/ops/registry.js");const a=Object.freeze({float32:Float32Array,float16:Uint16Array,float64:Float64Array,string:Array,int8:Int8Array,uint8:Uint8Array,int16:Int16Array,uint16:Uint16Array,int32:Int32Array,uint32:Uint32Array,int64:BigInt64Array,uint64:BigUint64Array,bool:Uint8Array});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,o.isONNXTensor)(e[0])?this.ort_tensor=e[0]:this.ort_tensor=new o.Tensor(e[0],e[1],e[2]),new Proxy(this,{get:(e,t)=>{if("string"==typeof t){let r=Number(t);if(Number.isInteger(r))return e._getitem(r)}return e[t]},set:(e,t,r)=>e[t]=r})}dispose(){this.ort_tensor.dispose()}*[Symbol.iterator](){const[e,...t]=this.dims;if(t.length>0){const r=t.reduce(((e,t)=>e*t));for(let n=0;n<e;++n)yield this._subarray(n,r,t)}else yield*this.data}_getitem(e){const[t,...r]=this.dims;if(e=M(e,t),r.length>0){const t=r.reduce(((e,t)=>e*t));return this._subarray(e,t,r)}return new i(this.type,[this.data[e]],r)}indexOf(e){const t=this.data;for(let r=0;r<t.length;++r)if(t[r]==e)return r;return-1}_subarray(e,t,r){const n=e*t,o=(e+1)*t,s="subarray"in this.data?this.data.subarray(n,o):this.data.slice(n,o);return new i(this.type,s,r)}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 r=e.length,n=t.reduce(((e,t)=>e*t));if(r!==n)throw Error(`cannot reshape array of size ${r} into shape (${t})`);let o=e;for(let e=t.length-1;e>=0;e--)o=o.reduce(((r,n)=>{let o=r[r.length-1];return o.length<t[e]?o.push(n):r.push([n]),r}),[[]]);return o[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 r=0;r<t.length;++r)t[r]=e(t[r],r,t);return this}mul(e){return this.clone().mul_(e)}mul_(e){const t=this.data;for(let r=0;r<t.length;++r)t[r]*=e;return this}div(e){return this.clone().div_(e)}div_(e){const t=this.data;for(let r=0;r<t.length;++r)t[r]/=e;return this}add(e){return this.clone().add_(e)}add_(e){const t=this.data;for(let r=0;r<t.length;++r)t[r]+=e;return this}sub(e){return this.clone().sub_(e)}sub_(e){const t=this.data;for(let r=0;r<t.length;++r)t[r]-=e;return this}clone(){return new i(this.type,this.data.slice(),this.dims.slice())}slice(...e){const t=[],r=[];for(let n=0;n<this.dims.length;++n){let o=e[n];if(null==o)r.push([0,this.dims[n]]),t.push(this.dims[n]);else if("number"==typeof o)o=M(o,this.dims[n],n),r.push([o,o+1]);else{if(!Array.isArray(o)||2!==o.length)throw new Error(`Invalid slice: ${o}`);{let[e,s]=o;if(e=null===e?0:M(e,this.dims[n],n,!1),s=null===s?this.dims[n]:M(s,this.dims[n],n,!1),e>s)throw new Error(`Invalid slice: ${o}`);const a=[Math.max(e,0),Math.min(s,this.dims[n])];r.push(a),t.push(a[1]-a[0])}}}const n=r.map((([e,t])=>t-e)),o=n.reduce(((e,t)=>e*t)),s=this.data,a=new s.constructor(o),l=this.stride();for(let e=0;e<o;++e){let t=0;for(let o=n.length-1,s=e;o>=0;--o){const e=n[o];t+=(s%e+r[o][0])*l[o],s=Math.floor(s/e)}a[e]=s[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,r=!1){if("fro"===e)e=2;else if("string"==typeof e)throw Error(`Unsupported norm: ${e}`);const n=this.data;if(null===t){let t=n.reduce(((t,r)=>t+r**e),0)**(1/e);return new i(this.type,[t],[])}t=M(t,this.dims.length);const o=this.dims.slice();o[t]=1;const s=new n.constructor(n.length/this.dims[t]);for(let r=0;r<n.length;++r){let a=0;for(let e=this.dims.length-1,n=r,s=1;e>=0;--e){const r=this.dims[e];if(e!==t){a+=n%r*s,s*=o[e]}n=Math.floor(n/r)}s[a]+=n[r]**e}if(1!==e)for(let t=0;t<s.length;++t)s[t]=s[t]**(1/e);return r||o.splice(t,1),new i(this.type,s,o)}normalize_(e=2,t=1){t=M(t,this.dims.length);const r=this.norm(e,t,!0),n=this.data,o=r.data;for(let e=0;e<n.length;++e){let r=0;for(let n=this.dims.length-1,o=e,s=1;n>=0;--n){const e=this.dims[n];if(n!==t){r+=o%e*s,s*=this.dims[n]}o=Math.floor(o/e)}n[e]/=o[r]}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 r=e.length-1,n=1;r>=0;--r)t[r]=n,n*=e[r];return t}(this.dims)}squeeze(e=null){return new i(this.type,this.data,f(this.dims,e))}squeeze_(e=null){return this.dims=f(this.dims,e),this}unsqueeze(e=null){return new i(this.type,this.data,g(this.dims,e))}unsqueeze_(e=null){return this.dims=g(this.dims,e),this}flatten_(e=0,t=-1){t=(t+this.dims.length)%this.dims.length;let r=this.dims.slice(0,e),n=this.dims.slice(e,t+1),o=this.dims.slice(t+1);return this.dims=[...r,n.reduce(((e,t)=>e*t),1),...o],this}flatten(e=0,t=-1){return this.clone().flatten_(e,t)}view(...e){let t=-1;for(let r=0;r<e.length;++r)if(-1===e[r]){if(-1!==t)throw new Error("Only one dimension can be inferred");t=r}const r=this.data;if(-1!==t){const n=e.reduce(((e,r,n)=>n!==t?e*r:e),1);e[t]=r.length/n}return new i(this.type,r,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_()}clamp_(e,t){const r=this.data;for(let n=0;n<r.length;++n)r[n]=Math.min(Math.max(r[n],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 x(this,e,t)}to(e){if(this.type===e)return this;if(!a.hasOwnProperty(e))throw new Error(`Unsupported type: ${e}`);return new i(e,a[e].from(this.data),this.dims)}}function l(e,t){const[r,o]=(0,n.permute_data)(e.data,e.dims,t);return new i(e.type,r,o)}function c(e,[t,r],o="bilinear",s=!1){const a=e.dims.at(-3)??1,l=e.dims.at(-2),c=e.dims.at(-1);let d=(0,n.interpolate_data)(e.data,[a,l,c],[t,r],o,s);return new i(e.type,d,[a,t,r])}async function d(e,{size:t=null,mode:r="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 n,o;if(2===t.length)n=[...e.dims.slice(0,2),...t];else if(3===t.length)n=[e.dims[0],...t];else{if(4!==t.length)throw new Error("`size` must be of length 2, 3, or 4.");n=t}if("bilinear"===r)o=await s.TensorOpRegistry.bilinear_interpolate_4d;else{if("bicubic"!==r)throw new Error(`Unsupported mode: ${r}`);o=await s.TensorOpRegistry.bicubic_interpolate_4d}const a=new i("int64",new BigInt64Array(n.map(BigInt)),[n.length]);return await o({x:e,s:a})}async function u(e,t){const r=await s.TensorOpRegistry.matmul;return await r({a:e,b:t})}async function p(e,t){const r=await s.TensorOpRegistry.rfft;return await r({x:e,a:t})}async function h(e,t){const r=await s.TensorOpRegistry.top_k;return t=null===t?e.dims.at(-1):Math.min(t,e.dims.at(-1)),await r({x:e,k:new i("int64",[BigInt(t)],[1])})}function m(e,t){const r=e.data,n=t.data,o=[e.dims[0],e.dims[2]],s=new r.constructor(o[0]*o[1]),[a,l,c]=e.dims;let d=0;for(let e=0;e<a;++e){const t=e*c*l;for(let o=0;o<c;++o){let a=0,i=0;const u=e*l,p=t+o;for(let e=0;e<l;++e){const t=Number(n[u+e]);i+=t,a+=r[p+e*c]*t}const h=a/i;s[d++]=h}}return new i(e.type,s,o)}function _(e,t,{eps:r=1e-5}={}){if(2!==e.dims.length)throw new Error("`layer_norm` currently only supports 2D input.");const[n,o]=e.dims;if(1!==t.length&&t[0]!==o)throw new Error("`normalized_shape` must be a 1D array with shape `[input.dims[1]]`.");const[s,a]=b(e,1,0,!0),l=s.data,c=a.data,d=e.data,u=new d.constructor(d.length);for(let e=0;e<n;++e){const t=e*o;for(let n=0;n<o;++n){const o=t+n;u[o]=(d[o]-c[e])/(l[e]+r)}}return new i(e.type,u,e.dims)}function f(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,r)=>1!==e||!t.includes(r)))),e}function g(e,t){return t=M(t,e.length+1),(e=e.slice()).splice(t,0,1),e}function M(e,t,r=null,n=!0){if(n&&(e<-t||e>=t))throw new Error(`IndexError: index ${e} is out of bounds for dimension${null===r?"":" "+r} with size ${t}`);return e<0&&(e=(e%t+t)%t),e}function w(e,t=0){t=M(t,e[0].dims.length);const r=e[0].dims.slice();r[t]=e.reduce(((e,r)=>e+r.dims[t]),0);const n=r.reduce(((e,t)=>e*t),1),o=new e[0].data.constructor(n),s=e[0].type;if(0===t){let t=0;for(const r of e){const e=r.data;o.set(e,t),t+=e.length}}else{let n=0;for(let s=0;s<e.length;++s){const{data:a,dims:i}=e[s];for(let e=0;e<a.length;++e){let s=0;for(let o=i.length-1,a=e,l=1;o>=0;--o){const e=i[o];let c=a%e;o===t&&(c+=n),s+=c*l,l*=r[o],a=Math.floor(a/e)}o[s]=a[e]}n+=i[t]}}return new i(s,o,r)}function T(e,t=0){return w(e.map((e=>e.unsqueeze(t))),t)}function b(e,t=null,r=1,n=!1){const o=e.data,s=e.dims;if(null===t){const t=o.reduce(((e,t)=>e+t),0)/o.length,n=Math.sqrt(o.reduce(((e,r)=>e+(r-t)**2),0)/(o.length-r)),s=new i(e.type,[t],[]);return[new i(e.type,[n],[]),s]}const a=x(e,t=M(t,s.length),n),l=a.data,c=s.slice();c[t]=1;const d=new o.constructor(o.length/s[t]);for(let e=0;e<o.length;++e){let r=0;for(let n=s.length-1,o=e,a=1;n>=0;--n){const e=s[n];if(n!==t){r+=o%e*a,a*=c[n]}o=Math.floor(o/e)}d[r]+=(o[e]-l[r])**2}for(let e=0;e<d.length;++e)d[e]=Math.sqrt(d[e]/(s[t]-r));n||c.splice(t,1);return[new i(e.type,d,c),a]}function x(e,t=null,r=!1){const n=e.data;if(null===t){const t=n.reduce(((e,t)=>e+t),0);return new i(e.type,[t/n.length],[])}const o=e.dims;t=M(t,o.length);const s=o.slice();s[t]=1;const a=new n.constructor(n.length/o[t]);for(let e=0;e<n.length;++e){let r=0;for(let n=o.length-1,a=e,i=1;n>=0;--n){const e=o[n];if(n!==t){r+=a%e*i,i*=s[n]}a=Math.floor(a/e)}a[r]+=n[e]}if(1!==o[t])for(let e=0;e<a.length;++e)a[e]=a[e]/o[t];return r||s.splice(t,1),new i(e.type,a,s)}function y(e,t,r,n){const o=e.reduce(((e,t)=>e*t),1);return new i(r,new n(o).fill(t),e)}function k(e,t){let r,n;if("number"==typeof t)r="float32",n=Float32Array;else{if("bigint"!=typeof t)throw new Error("Unsupported data type: "+typeof t);r="int64",n=BigInt64Array}return y(e,t,r,n)}function F(e,t){return k(e.dims,t)}function P(e){return y(e,1n,"int64",BigInt64Array)}function C(e){return P(e.dims)}function v(e){return y(e,0n,"int64",BigInt64Array)}function S(e){return v(e.dims)}function A(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 r="binary"===t,n=r?"int8":"uint8",o=r?Int8Array:Uint8Array,s=e.data,a=new o(s.length/8);for(let e=0;e<s.length;++e){const t=s[e]>0?1:0,n=Math.floor(e/8),o=e%8;a[n]|=t<<7-o,r&&0===o&&(a[n]-=128)}return new i(n,a,[e.dims[0],e.dims[1]/8])}}},l={};function c(e){var t=l[e];if(void 0!==t)return t.exports;var r=l[e]={exports:{}};return i[e](r,r.exports,c),r.exports}a=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,c.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 r=Object.create(null);c.r(r);var n={};s=s||[null,a({}),a([]),a(a)];for(var o=2&t&&e;"object"==typeof o&&!~s.indexOf(o);o=a(o))Object.getOwnPropertyNames(o).forEach((t=>n[t]=()=>e[t]));return n.default=()=>e,c.d(r,n),r},c.d=(e,t)=>{for(var r in t)c.o(t,r)&&!c.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},c.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),c.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var d={};
164
164
  /*!*****************************!*\
165
165
  !*** ./src/transformers.js ***!
166
- \*****************************/c.r(d),c.d(d,{ASTFeatureExtractor:()=>_.ASTFeatureExtractor,ASTForAudioClassification:()=>h.ASTForAudioClassification,ASTModel:()=>h.ASTModel,ASTPreTrainedModel:()=>h.ASTPreTrainedModel,AlbertForMaskedLM:()=>h.AlbertForMaskedLM,AlbertForQuestionAnswering:()=>h.AlbertForQuestionAnswering,AlbertForSequenceClassification:()=>h.AlbertForSequenceClassification,AlbertModel:()=>h.AlbertModel,AlbertPreTrainedModel:()=>h.AlbertPreTrainedModel,AlbertTokenizer:()=>m.AlbertTokenizer,AudioClassificationPipeline:()=>p.AudioClassificationPipeline,AutoConfig:()=>f.AutoConfig,AutoModel:()=>h.AutoModel,AutoModelForAudioClassification:()=>h.AutoModelForAudioClassification,AutoModelForAudioFrameClassification:()=>h.AutoModelForAudioFrameClassification,AutoModelForCTC:()=>h.AutoModelForCTC,AutoModelForCausalLM:()=>h.AutoModelForCausalLM,AutoModelForDepthEstimation:()=>h.AutoModelForDepthEstimation,AutoModelForDocumentQuestionAnswering:()=>h.AutoModelForDocumentQuestionAnswering,AutoModelForImageClassification:()=>h.AutoModelForImageClassification,AutoModelForImageFeatureExtraction:()=>h.AutoModelForImageFeatureExtraction,AutoModelForImageMatting:()=>h.AutoModelForImageMatting,AutoModelForImageSegmentation:()=>h.AutoModelForImageSegmentation,AutoModelForImageToImage:()=>h.AutoModelForImageToImage,AutoModelForMaskGeneration:()=>h.AutoModelForMaskGeneration,AutoModelForMaskedLM:()=>h.AutoModelForMaskedLM,AutoModelForNormalEstimation:()=>h.AutoModelForNormalEstimation,AutoModelForObjectDetection:()=>h.AutoModelForObjectDetection,AutoModelForQuestionAnswering:()=>h.AutoModelForQuestionAnswering,AutoModelForSemanticSegmentation:()=>h.AutoModelForSemanticSegmentation,AutoModelForSeq2SeqLM:()=>h.AutoModelForSeq2SeqLM,AutoModelForSequenceClassification:()=>h.AutoModelForSequenceClassification,AutoModelForSpeechSeq2Seq:()=>h.AutoModelForSpeechSeq2Seq,AutoModelForTextToSpectrogram:()=>h.AutoModelForTextToSpectrogram,AutoModelForTextToWaveform:()=>h.AutoModelForTextToWaveform,AutoModelForTokenClassification:()=>h.AutoModelForTokenClassification,AutoModelForUniversalSegmentation:()=>h.AutoModelForUniversalSegmentation,AutoModelForVision2Seq:()=>h.AutoModelForVision2Seq,AutoModelForXVector:()=>h.AutoModelForXVector,AutoModelForZeroShotObjectDetection:()=>h.AutoModelForZeroShotObjectDetection,AutoProcessor:()=>_.AutoProcessor,AutoTokenizer:()=>m.AutoTokenizer,AutomaticSpeechRecognitionPipeline:()=>p.AutomaticSpeechRecognitionPipeline,BartForConditionalGeneration:()=>h.BartForConditionalGeneration,BartForSequenceClassification:()=>h.BartForSequenceClassification,BartModel:()=>h.BartModel,BartPretrainedModel:()=>h.BartPretrainedModel,BartTokenizer:()=>m.BartTokenizer,BaseModelOutput:()=>h.BaseModelOutput,BaseStreamer:()=>b.BaseStreamer,BeitFeatureExtractor:()=>_.BeitFeatureExtractor,BeitForImageClassification:()=>h.BeitForImageClassification,BeitModel:()=>h.BeitModel,BeitPreTrainedModel:()=>h.BeitPreTrainedModel,BertForMaskedLM:()=>h.BertForMaskedLM,BertForQuestionAnswering:()=>h.BertForQuestionAnswering,BertForSequenceClassification:()=>h.BertForSequenceClassification,BertForTokenClassification:()=>h.BertForTokenClassification,BertModel:()=>h.BertModel,BertPreTrainedModel:()=>h.BertPreTrainedModel,BertTokenizer:()=>m.BertTokenizer,BitImageProcessor:()=>_.BitImageProcessor,BlenderbotForConditionalGeneration:()=>h.BlenderbotForConditionalGeneration,BlenderbotModel:()=>h.BlenderbotModel,BlenderbotPreTrainedModel:()=>h.BlenderbotPreTrainedModel,BlenderbotSmallForConditionalGeneration:()=>h.BlenderbotSmallForConditionalGeneration,BlenderbotSmallModel:()=>h.BlenderbotSmallModel,BlenderbotSmallPreTrainedModel:()=>h.BlenderbotSmallPreTrainedModel,BlenderbotSmallTokenizer:()=>m.BlenderbotSmallTokenizer,BlenderbotTokenizer:()=>m.BlenderbotTokenizer,BloomForCausalLM:()=>h.BloomForCausalLM,BloomModel:()=>h.BloomModel,BloomPreTrainedModel:()=>h.BloomPreTrainedModel,BloomTokenizer:()=>m.BloomTokenizer,CLIPFeatureExtractor:()=>_.CLIPFeatureExtractor,CLIPImageProcessor:()=>_.CLIPImageProcessor,CLIPModel:()=>h.CLIPModel,CLIPPreTrainedModel:()=>h.CLIPPreTrainedModel,CLIPSegForImageSegmentation:()=>h.CLIPSegForImageSegmentation,CLIPSegModel:()=>h.CLIPSegModel,CLIPSegPreTrainedModel:()=>h.CLIPSegPreTrainedModel,CLIPTextModel:()=>h.CLIPTextModel,CLIPTextModelWithProjection:()=>h.CLIPTextModelWithProjection,CLIPTokenizer:()=>m.CLIPTokenizer,CLIPVisionModel:()=>h.CLIPVisionModel,CLIPVisionModelWithProjection:()=>h.CLIPVisionModelWithProjection,CamembertForMaskedLM:()=>h.CamembertForMaskedLM,CamembertForQuestionAnswering:()=>h.CamembertForQuestionAnswering,CamembertForSequenceClassification:()=>h.CamembertForSequenceClassification,CamembertForTokenClassification:()=>h.CamembertForTokenClassification,CamembertModel:()=>h.CamembertModel,CamembertPreTrainedModel:()=>h.CamembertPreTrainedModel,CamembertTokenizer:()=>m.CamembertTokenizer,CausalLMOutput:()=>h.CausalLMOutput,CausalLMOutputWithPast:()=>h.CausalLMOutputWithPast,ChineseCLIPFeatureExtractor:()=>_.ChineseCLIPFeatureExtractor,ChineseCLIPModel:()=>h.ChineseCLIPModel,ChineseCLIPPreTrainedModel:()=>h.ChineseCLIPPreTrainedModel,ClapAudioModelWithProjection:()=>h.ClapAudioModelWithProjection,ClapFeatureExtractor:()=>_.ClapFeatureExtractor,ClapModel:()=>h.ClapModel,ClapPreTrainedModel:()=>h.ClapPreTrainedModel,ClapTextModelWithProjection:()=>h.ClapTextModelWithProjection,CodeGenForCausalLM:()=>h.CodeGenForCausalLM,CodeGenModel:()=>h.CodeGenModel,CodeGenPreTrainedModel:()=>h.CodeGenPreTrainedModel,CodeGenTokenizer:()=>m.CodeGenTokenizer,CodeLlamaTokenizer:()=>m.CodeLlamaTokenizer,CohereForCausalLM:()=>h.CohereForCausalLM,CohereModel:()=>h.CohereModel,CoherePreTrainedModel:()=>h.CoherePreTrainedModel,CohereTokenizer:()=>m.CohereTokenizer,ConvBertForMaskedLM:()=>h.ConvBertForMaskedLM,ConvBertForQuestionAnswering:()=>h.ConvBertForQuestionAnswering,ConvBertForSequenceClassification:()=>h.ConvBertForSequenceClassification,ConvBertForTokenClassification:()=>h.ConvBertForTokenClassification,ConvBertModel:()=>h.ConvBertModel,ConvBertPreTrainedModel:()=>h.ConvBertPreTrainedModel,ConvBertTokenizer:()=>m.ConvBertTokenizer,ConvNextFeatureExtractor:()=>_.ConvNextFeatureExtractor,ConvNextForImageClassification:()=>h.ConvNextForImageClassification,ConvNextImageProcessor:()=>_.ConvNextImageProcessor,ConvNextModel:()=>h.ConvNextModel,ConvNextPreTrainedModel:()=>h.ConvNextPreTrainedModel,ConvNextV2ForImageClassification:()=>h.ConvNextV2ForImageClassification,ConvNextV2Model:()=>h.ConvNextV2Model,ConvNextV2PreTrainedModel:()=>h.ConvNextV2PreTrainedModel,DPTFeatureExtractor:()=>_.DPTFeatureExtractor,DPTForDepthEstimation:()=>h.DPTForDepthEstimation,DPTImageProcessor:()=>_.DPTImageProcessor,DPTModel:()=>h.DPTModel,DPTPreTrainedModel:()=>h.DPTPreTrainedModel,DebertaForMaskedLM:()=>h.DebertaForMaskedLM,DebertaForQuestionAnswering:()=>h.DebertaForQuestionAnswering,DebertaForSequenceClassification:()=>h.DebertaForSequenceClassification,DebertaForTokenClassification:()=>h.DebertaForTokenClassification,DebertaModel:()=>h.DebertaModel,DebertaPreTrainedModel:()=>h.DebertaPreTrainedModel,DebertaTokenizer:()=>m.DebertaTokenizer,DebertaV2ForMaskedLM:()=>h.DebertaV2ForMaskedLM,DebertaV2ForQuestionAnswering:()=>h.DebertaV2ForQuestionAnswering,DebertaV2ForSequenceClassification:()=>h.DebertaV2ForSequenceClassification,DebertaV2ForTokenClassification:()=>h.DebertaV2ForTokenClassification,DebertaV2Model:()=>h.DebertaV2Model,DebertaV2PreTrainedModel:()=>h.DebertaV2PreTrainedModel,DebertaV2Tokenizer:()=>m.DebertaV2Tokenizer,DecisionTransformerModel:()=>h.DecisionTransformerModel,DecisionTransformerPreTrainedModel:()=>h.DecisionTransformerPreTrainedModel,DeiTFeatureExtractor:()=>_.DeiTFeatureExtractor,DeiTForImageClassification:()=>h.DeiTForImageClassification,DeiTModel:()=>h.DeiTModel,DeiTPreTrainedModel:()=>h.DeiTPreTrainedModel,DepthAnythingForDepthEstimation:()=>h.DepthAnythingForDepthEstimation,DepthAnythingPreTrainedModel:()=>h.DepthAnythingPreTrainedModel,DepthEstimationPipeline:()=>p.DepthEstimationPipeline,DepthProForDepthEstimation:()=>h.DepthProForDepthEstimation,DepthProPreTrainedModel:()=>h.DepthProPreTrainedModel,DetrFeatureExtractor:()=>_.DetrFeatureExtractor,DetrForObjectDetection:()=>h.DetrForObjectDetection,DetrForSegmentation:()=>h.DetrForSegmentation,DetrModel:()=>h.DetrModel,DetrObjectDetectionOutput:()=>h.DetrObjectDetectionOutput,DetrPreTrainedModel:()=>h.DetrPreTrainedModel,DetrSegmentationOutput:()=>h.DetrSegmentationOutput,Dinov2ForImageClassification:()=>h.Dinov2ForImageClassification,Dinov2Model:()=>h.Dinov2Model,Dinov2PreTrainedModel:()=>h.Dinov2PreTrainedModel,DistilBertForMaskedLM:()=>h.DistilBertForMaskedLM,DistilBertForQuestionAnswering:()=>h.DistilBertForQuestionAnswering,DistilBertForSequenceClassification:()=>h.DistilBertForSequenceClassification,DistilBertForTokenClassification:()=>h.DistilBertForTokenClassification,DistilBertModel:()=>h.DistilBertModel,DistilBertPreTrainedModel:()=>h.DistilBertPreTrainedModel,DistilBertTokenizer:()=>m.DistilBertTokenizer,DocumentQuestionAnsweringPipeline:()=>p.DocumentQuestionAnsweringPipeline,DonutFeatureExtractor:()=>_.DonutFeatureExtractor,DonutSwinModel:()=>h.DonutSwinModel,DonutSwinPreTrainedModel:()=>h.DonutSwinPreTrainedModel,EfficientNetForImageClassification:()=>h.EfficientNetForImageClassification,EfficientNetImageProcessor:()=>_.EfficientNetImageProcessor,EfficientNetModel:()=>h.EfficientNetModel,EfficientNetPreTrainedModel:()=>h.EfficientNetPreTrainedModel,ElectraForMaskedLM:()=>h.ElectraForMaskedLM,ElectraForQuestionAnswering:()=>h.ElectraForQuestionAnswering,ElectraForSequenceClassification:()=>h.ElectraForSequenceClassification,ElectraForTokenClassification:()=>h.ElectraForTokenClassification,ElectraModel:()=>h.ElectraModel,ElectraPreTrainedModel:()=>h.ElectraPreTrainedModel,ElectraTokenizer:()=>m.ElectraTokenizer,EosTokenCriteria:()=>x.EosTokenCriteria,EsmForMaskedLM:()=>h.EsmForMaskedLM,EsmForSequenceClassification:()=>h.EsmForSequenceClassification,EsmForTokenClassification:()=>h.EsmForTokenClassification,EsmModel:()=>h.EsmModel,EsmPreTrainedModel:()=>h.EsmPreTrainedModel,EsmTokenizer:()=>m.EsmTokenizer,FFT:()=>T.FFT,FalconForCausalLM:()=>h.FalconForCausalLM,FalconModel:()=>h.FalconModel,FalconPreTrainedModel:()=>h.FalconPreTrainedModel,FalconTokenizer:()=>m.FalconTokenizer,FastViTForImageClassification:()=>h.FastViTForImageClassification,FastViTModel:()=>h.FastViTModel,FastViTPreTrainedModel:()=>h.FastViTPreTrainedModel,FeatureExtractionPipeline:()=>p.FeatureExtractionPipeline,FeatureExtractor:()=>_.FeatureExtractor,FillMaskPipeline:()=>p.FillMaskPipeline,Florence2ForConditionalGeneration:()=>h.Florence2ForConditionalGeneration,Florence2PreTrainedModel:()=>h.Florence2PreTrainedModel,Florence2Processor:()=>_.Florence2Processor,GLPNFeatureExtractor:()=>_.GLPNFeatureExtractor,GLPNForDepthEstimation:()=>h.GLPNForDepthEstimation,GLPNModel:()=>h.GLPNModel,GLPNPreTrainedModel:()=>h.GLPNPreTrainedModel,GPT2LMHeadModel:()=>h.GPT2LMHeadModel,GPT2Model:()=>h.GPT2Model,GPT2PreTrainedModel:()=>h.GPT2PreTrainedModel,GPT2Tokenizer:()=>m.GPT2Tokenizer,GPTBigCodeForCausalLM:()=>h.GPTBigCodeForCausalLM,GPTBigCodeModel:()=>h.GPTBigCodeModel,GPTBigCodePreTrainedModel:()=>h.GPTBigCodePreTrainedModel,GPTJForCausalLM:()=>h.GPTJForCausalLM,GPTJModel:()=>h.GPTJModel,GPTJPreTrainedModel:()=>h.GPTJPreTrainedModel,GPTNeoForCausalLM:()=>h.GPTNeoForCausalLM,GPTNeoModel:()=>h.GPTNeoModel,GPTNeoPreTrainedModel:()=>h.GPTNeoPreTrainedModel,GPTNeoXForCausalLM:()=>h.GPTNeoXForCausalLM,GPTNeoXModel:()=>h.GPTNeoXModel,GPTNeoXPreTrainedModel:()=>h.GPTNeoXPreTrainedModel,GPTNeoXTokenizer:()=>m.GPTNeoXTokenizer,Gemma2ForCausalLM:()=>h.Gemma2ForCausalLM,Gemma2Model:()=>h.Gemma2Model,Gemma2PreTrainedModel:()=>h.Gemma2PreTrainedModel,GemmaForCausalLM:()=>h.GemmaForCausalLM,GemmaModel:()=>h.GemmaModel,GemmaPreTrainedModel:()=>h.GemmaPreTrainedModel,GemmaTokenizer:()=>m.GemmaTokenizer,GraniteForCausalLM:()=>h.GraniteForCausalLM,GraniteModel:()=>h.GraniteModel,GranitePreTrainedModel:()=>h.GranitePreTrainedModel,Grok1Tokenizer:()=>m.Grok1Tokenizer,GroupViTModel:()=>h.GroupViTModel,GroupViTPreTrainedModel:()=>h.GroupViTPreTrainedModel,HerbertTokenizer:()=>m.HerbertTokenizer,HieraForImageClassification:()=>h.HieraForImageClassification,HieraModel:()=>h.HieraModel,HieraPreTrainedModel:()=>h.HieraPreTrainedModel,HubertForCTC:()=>h.HubertForCTC,HubertForSequenceClassification:()=>h.HubertForSequenceClassification,HubertModel:()=>h.HubertModel,HubertPreTrainedModel:()=>h.HubertPreTrainedModel,ImageClassificationPipeline:()=>p.ImageClassificationPipeline,ImageFeatureExtractionPipeline:()=>p.ImageFeatureExtractionPipeline,ImageFeatureExtractor:()=>_.ImageFeatureExtractor,ImageMattingOutput:()=>h.ImageMattingOutput,ImageSegmentationPipeline:()=>p.ImageSegmentationPipeline,ImageToImagePipeline:()=>p.ImageToImagePipeline,ImageToTextPipeline:()=>p.ImageToTextPipeline,InterruptableStoppingCriteria:()=>x.InterruptableStoppingCriteria,JAISLMHeadModel:()=>h.JAISLMHeadModel,JAISModel:()=>h.JAISModel,JAISPreTrainedModel:()=>h.JAISPreTrainedModel,LlamaForCausalLM:()=>h.LlamaForCausalLM,LlamaModel:()=>h.LlamaModel,LlamaPreTrainedModel:()=>h.LlamaPreTrainedModel,LlamaTokenizer:()=>m.LlamaTokenizer,LlavaForConditionalGeneration:()=>h.LlavaForConditionalGeneration,LlavaPreTrainedModel:()=>h.LlavaPreTrainedModel,LongT5ForConditionalGeneration:()=>h.LongT5ForConditionalGeneration,LongT5Model:()=>h.LongT5Model,LongT5PreTrainedModel:()=>h.LongT5PreTrainedModel,M2M100ForConditionalGeneration:()=>h.M2M100ForConditionalGeneration,M2M100Model:()=>h.M2M100Model,M2M100PreTrainedModel:()=>h.M2M100PreTrainedModel,M2M100Tokenizer:()=>m.M2M100Tokenizer,MBart50Tokenizer:()=>m.MBart50Tokenizer,MBartForCausalLM:()=>h.MBartForCausalLM,MBartForConditionalGeneration:()=>h.MBartForConditionalGeneration,MBartForSequenceClassification:()=>h.MBartForSequenceClassification,MBartModel:()=>h.MBartModel,MBartPreTrainedModel:()=>h.MBartPreTrainedModel,MBartTokenizer:()=>m.MBartTokenizer,MPNetForMaskedLM:()=>h.MPNetForMaskedLM,MPNetForQuestionAnswering:()=>h.MPNetForQuestionAnswering,MPNetForSequenceClassification:()=>h.MPNetForSequenceClassification,MPNetForTokenClassification:()=>h.MPNetForTokenClassification,MPNetModel:()=>h.MPNetModel,MPNetPreTrainedModel:()=>h.MPNetPreTrainedModel,MPNetTokenizer:()=>m.MPNetTokenizer,MT5ForConditionalGeneration:()=>h.MT5ForConditionalGeneration,MT5Model:()=>h.MT5Model,MT5PreTrainedModel:()=>h.MT5PreTrainedModel,MarianMTModel:()=>h.MarianMTModel,MarianModel:()=>h.MarianModel,MarianPreTrainedModel:()=>h.MarianPreTrainedModel,MarianTokenizer:()=>m.MarianTokenizer,MaskFormerFeatureExtractor:()=>_.MaskFormerFeatureExtractor,MaskFormerForInstanceSegmentation:()=>h.MaskFormerForInstanceSegmentation,MaskFormerModel:()=>h.MaskFormerModel,MaskFormerPreTrainedModel:()=>h.MaskFormerPreTrainedModel,MaskedLMOutput:()=>h.MaskedLMOutput,MaxLengthCriteria:()=>x.MaxLengthCriteria,MistralForCausalLM:()=>h.MistralForCausalLM,MistralModel:()=>h.MistralModel,MistralPreTrainedModel:()=>h.MistralPreTrainedModel,MobileBertForMaskedLM:()=>h.MobileBertForMaskedLM,MobileBertForQuestionAnswering:()=>h.MobileBertForQuestionAnswering,MobileBertForSequenceClassification:()=>h.MobileBertForSequenceClassification,MobileBertModel:()=>h.MobileBertModel,MobileBertPreTrainedModel:()=>h.MobileBertPreTrainedModel,MobileBertTokenizer:()=>m.MobileBertTokenizer,MobileNetV1FeatureExtractor:()=>_.MobileNetV1FeatureExtractor,MobileNetV1ForImageClassification:()=>h.MobileNetV1ForImageClassification,MobileNetV1Model:()=>h.MobileNetV1Model,MobileNetV1PreTrainedModel:()=>h.MobileNetV1PreTrainedModel,MobileNetV2FeatureExtractor:()=>_.MobileNetV2FeatureExtractor,MobileNetV2ForImageClassification:()=>h.MobileNetV2ForImageClassification,MobileNetV2Model:()=>h.MobileNetV2Model,MobileNetV2PreTrainedModel:()=>h.MobileNetV2PreTrainedModel,MobileNetV3FeatureExtractor:()=>_.MobileNetV3FeatureExtractor,MobileNetV3ForImageClassification:()=>h.MobileNetV3ForImageClassification,MobileNetV3Model:()=>h.MobileNetV3Model,MobileNetV3PreTrainedModel:()=>h.MobileNetV3PreTrainedModel,MobileNetV4FeatureExtractor:()=>_.MobileNetV4FeatureExtractor,MobileNetV4ForImageClassification:()=>h.MobileNetV4ForImageClassification,MobileNetV4Model:()=>h.MobileNetV4Model,MobileNetV4PreTrainedModel:()=>h.MobileNetV4PreTrainedModel,MobileViTFeatureExtractor:()=>_.MobileViTFeatureExtractor,MobileViTForImageClassification:()=>h.MobileViTForImageClassification,MobileViTImageProcessor:()=>_.MobileViTImageProcessor,MobileViTModel:()=>h.MobileViTModel,MobileViTPreTrainedModel:()=>h.MobileViTPreTrainedModel,MobileViTV2ForImageClassification:()=>h.MobileViTV2ForImageClassification,MobileViTV2Model:()=>h.MobileViTV2Model,MobileViTV2PreTrainedModel:()=>h.MobileViTV2PreTrainedModel,ModelOutput:()=>h.ModelOutput,Moondream1ForConditionalGeneration:()=>h.Moondream1ForConditionalGeneration,MptForCausalLM:()=>h.MptForCausalLM,MptModel:()=>h.MptModel,MptPreTrainedModel:()=>h.MptPreTrainedModel,MusicgenForCausalLM:()=>h.MusicgenForCausalLM,MusicgenForConditionalGeneration:()=>h.MusicgenForConditionalGeneration,MusicgenModel:()=>h.MusicgenModel,MusicgenPreTrainedModel:()=>h.MusicgenPreTrainedModel,NllbTokenizer:()=>m.NllbTokenizer,NomicBertModel:()=>h.NomicBertModel,NomicBertPreTrainedModel:()=>h.NomicBertPreTrainedModel,NougatImageProcessor:()=>_.NougatImageProcessor,NougatTokenizer:()=>m.NougatTokenizer,OPTForCausalLM:()=>h.OPTForCausalLM,OPTModel:()=>h.OPTModel,OPTPreTrainedModel:()=>h.OPTPreTrainedModel,ObjectDetectionPipeline:()=>p.ObjectDetectionPipeline,OpenELMForCausalLM:()=>h.OpenELMForCausalLM,OpenELMModel:()=>h.OpenELMModel,OpenELMPreTrainedModel:()=>h.OpenELMPreTrainedModel,OwlViTFeatureExtractor:()=>_.OwlViTFeatureExtractor,OwlViTForObjectDetection:()=>h.OwlViTForObjectDetection,OwlViTModel:()=>h.OwlViTModel,OwlViTPreTrainedModel:()=>h.OwlViTPreTrainedModel,OwlViTProcessor:()=>_.OwlViTProcessor,Owlv2ForObjectDetection:()=>h.Owlv2ForObjectDetection,Owlv2ImageProcessor:()=>_.Owlv2ImageProcessor,Owlv2Model:()=>h.Owlv2Model,Owlv2PreTrainedModel:()=>h.Owlv2PreTrainedModel,Phi3ForCausalLM:()=>h.Phi3ForCausalLM,Phi3Model:()=>h.Phi3Model,Phi3PreTrainedModel:()=>h.Phi3PreTrainedModel,PhiForCausalLM:()=>h.PhiForCausalLM,PhiModel:()=>h.PhiModel,PhiPreTrainedModel:()=>h.PhiPreTrainedModel,Pipeline:()=>p.Pipeline,PreTrainedModel:()=>h.PreTrainedModel,PreTrainedTokenizer:()=>m.PreTrainedTokenizer,PretrainedConfig:()=>f.PretrainedConfig,PretrainedMixin:()=>h.PretrainedMixin,Processor:()=>_.Processor,PvtForImageClassification:()=>h.PvtForImageClassification,PvtImageProcessor:()=>_.PvtImageProcessor,PvtModel:()=>h.PvtModel,PvtPreTrainedModel:()=>h.PvtPreTrainedModel,PyAnnoteFeatureExtractor:()=>_.PyAnnoteFeatureExtractor,PyAnnoteForAudioFrameClassification:()=>h.PyAnnoteForAudioFrameClassification,PyAnnoteModel:()=>h.PyAnnoteModel,PyAnnotePreTrainedModel:()=>h.PyAnnotePreTrainedModel,PyAnnoteProcessor:()=>_.PyAnnoteProcessor,QuestionAnsweringModelOutput:()=>h.QuestionAnsweringModelOutput,QuestionAnsweringPipeline:()=>p.QuestionAnsweringPipeline,Qwen2ForCausalLM:()=>h.Qwen2ForCausalLM,Qwen2Model:()=>h.Qwen2Model,Qwen2PreTrainedModel:()=>h.Qwen2PreTrainedModel,Qwen2Tokenizer:()=>m.Qwen2Tokenizer,RTDetrForObjectDetection:()=>h.RTDetrForObjectDetection,RTDetrImageProcessor:()=>_.RTDetrImageProcessor,RTDetrModel:()=>h.RTDetrModel,RTDetrObjectDetectionOutput:()=>h.RTDetrObjectDetectionOutput,RTDetrPreTrainedModel:()=>h.RTDetrPreTrainedModel,RawImage:()=>M.RawImage,ResNetForImageClassification:()=>h.ResNetForImageClassification,ResNetModel:()=>h.ResNetModel,ResNetPreTrainedModel:()=>h.ResNetPreTrainedModel,RoFormerForMaskedLM:()=>h.RoFormerForMaskedLM,RoFormerForQuestionAnswering:()=>h.RoFormerForQuestionAnswering,RoFormerForSequenceClassification:()=>h.RoFormerForSequenceClassification,RoFormerForTokenClassification:()=>h.RoFormerForTokenClassification,RoFormerModel:()=>h.RoFormerModel,RoFormerPreTrainedModel:()=>h.RoFormerPreTrainedModel,RoFormerTokenizer:()=>m.RoFormerTokenizer,RobertaForMaskedLM:()=>h.RobertaForMaskedLM,RobertaForQuestionAnswering:()=>h.RobertaForQuestionAnswering,RobertaForSequenceClassification:()=>h.RobertaForSequenceClassification,RobertaForTokenClassification:()=>h.RobertaForTokenClassification,RobertaModel:()=>h.RobertaModel,RobertaPreTrainedModel:()=>h.RobertaPreTrainedModel,RobertaTokenizer:()=>m.RobertaTokenizer,SamImageProcessor:()=>_.SamImageProcessor,SamImageSegmentationOutput:()=>h.SamImageSegmentationOutput,SamModel:()=>h.SamModel,SamPreTrainedModel:()=>h.SamPreTrainedModel,SamProcessor:()=>_.SamProcessor,SapiensFeatureExtractor:()=>_.SapiensFeatureExtractor,SapiensForDepthEstimation:()=>h.SapiensForDepthEstimation,SapiensForNormalEstimation:()=>h.SapiensForNormalEstimation,SapiensForSemanticSegmentation:()=>h.SapiensForSemanticSegmentation,SapiensPreTrainedModel:()=>h.SapiensPreTrainedModel,SeamlessM4TFeatureExtractor:()=>_.SeamlessM4TFeatureExtractor,SegformerFeatureExtractor:()=>_.SegformerFeatureExtractor,SegformerForImageClassification:()=>h.SegformerForImageClassification,SegformerForSemanticSegmentation:()=>h.SegformerForSemanticSegmentation,SegformerModel:()=>h.SegformerModel,SegformerPreTrainedModel:()=>h.SegformerPreTrainedModel,Seq2SeqLMOutput:()=>h.Seq2SeqLMOutput,SequenceClassifierOutput:()=>h.SequenceClassifierOutput,SiglipImageProcessor:()=>_.SiglipImageProcessor,SiglipModel:()=>h.SiglipModel,SiglipPreTrainedModel:()=>h.SiglipPreTrainedModel,SiglipTextModel:()=>h.SiglipTextModel,SiglipTokenizer:()=>m.SiglipTokenizer,SiglipVisionModel:()=>h.SiglipVisionModel,SpeechT5FeatureExtractor:()=>_.SpeechT5FeatureExtractor,SpeechT5ForSpeechToText:()=>h.SpeechT5ForSpeechToText,SpeechT5ForTextToSpeech:()=>h.SpeechT5ForTextToSpeech,SpeechT5HifiGan:()=>h.SpeechT5HifiGan,SpeechT5Model:()=>h.SpeechT5Model,SpeechT5PreTrainedModel:()=>h.SpeechT5PreTrainedModel,SpeechT5Processor:()=>_.SpeechT5Processor,SpeechT5Tokenizer:()=>m.SpeechT5Tokenizer,SqueezeBertForMaskedLM:()=>h.SqueezeBertForMaskedLM,SqueezeBertForQuestionAnswering:()=>h.SqueezeBertForQuestionAnswering,SqueezeBertForSequenceClassification:()=>h.SqueezeBertForSequenceClassification,SqueezeBertModel:()=>h.SqueezeBertModel,SqueezeBertPreTrainedModel:()=>h.SqueezeBertPreTrainedModel,SqueezeBertTokenizer:()=>m.SqueezeBertTokenizer,StableLmForCausalLM:()=>h.StableLmForCausalLM,StableLmModel:()=>h.StableLmModel,StableLmPreTrainedModel:()=>h.StableLmPreTrainedModel,Starcoder2ForCausalLM:()=>h.Starcoder2ForCausalLM,Starcoder2Model:()=>h.Starcoder2Model,Starcoder2PreTrainedModel:()=>h.Starcoder2PreTrainedModel,StoppingCriteria:()=>x.StoppingCriteria,StoppingCriteriaList:()=>x.StoppingCriteriaList,SummarizationPipeline:()=>p.SummarizationPipeline,Swin2SRForImageSuperResolution:()=>h.Swin2SRForImageSuperResolution,Swin2SRImageProcessor:()=>_.Swin2SRImageProcessor,Swin2SRModel:()=>h.Swin2SRModel,Swin2SRPreTrainedModel:()=>h.Swin2SRPreTrainedModel,SwinForImageClassification:()=>h.SwinForImageClassification,SwinModel:()=>h.SwinModel,SwinPreTrainedModel:()=>h.SwinPreTrainedModel,T5ForConditionalGeneration:()=>h.T5ForConditionalGeneration,T5Model:()=>h.T5Model,T5PreTrainedModel:()=>h.T5PreTrainedModel,T5Tokenizer:()=>m.T5Tokenizer,TableTransformerForObjectDetection:()=>h.TableTransformerForObjectDetection,TableTransformerModel:()=>h.TableTransformerModel,TableTransformerObjectDetectionOutput:()=>h.TableTransformerObjectDetectionOutput,TableTransformerPreTrainedModel:()=>h.TableTransformerPreTrainedModel,Tensor:()=>w.Tensor,Text2TextGenerationPipeline:()=>p.Text2TextGenerationPipeline,TextClassificationPipeline:()=>p.TextClassificationPipeline,TextGenerationPipeline:()=>p.TextGenerationPipeline,TextStreamer:()=>b.TextStreamer,TextToAudioPipeline:()=>p.TextToAudioPipeline,TokenClassificationPipeline:()=>p.TokenClassificationPipeline,TokenClassifierOutput:()=>h.TokenClassifierOutput,TokenizerModel:()=>m.TokenizerModel,TrOCRForCausalLM:()=>h.TrOCRForCausalLM,TrOCRPreTrainedModel:()=>h.TrOCRPreTrainedModel,TranslationPipeline:()=>p.TranslationPipeline,UniSpeechForCTC:()=>h.UniSpeechForCTC,UniSpeechForSequenceClassification:()=>h.UniSpeechForSequenceClassification,UniSpeechModel:()=>h.UniSpeechModel,UniSpeechPreTrainedModel:()=>h.UniSpeechPreTrainedModel,UniSpeechSatForAudioFrameClassification:()=>h.UniSpeechSatForAudioFrameClassification,UniSpeechSatForCTC:()=>h.UniSpeechSatForCTC,UniSpeechSatForSequenceClassification:()=>h.UniSpeechSatForSequenceClassification,UniSpeechSatModel:()=>h.UniSpeechSatModel,UniSpeechSatPreTrainedModel:()=>h.UniSpeechSatPreTrainedModel,ViTFeatureExtractor:()=>_.ViTFeatureExtractor,ViTForImageClassification:()=>h.ViTForImageClassification,ViTImageProcessor:()=>_.ViTImageProcessor,ViTMAEModel:()=>h.ViTMAEModel,ViTMAEPreTrainedModel:()=>h.ViTMAEPreTrainedModel,ViTMSNForImageClassification:()=>h.ViTMSNForImageClassification,ViTMSNModel:()=>h.ViTMSNModel,ViTMSNPreTrainedModel:()=>h.ViTMSNPreTrainedModel,ViTModel:()=>h.ViTModel,ViTPreTrainedModel:()=>h.ViTPreTrainedModel,VisionEncoderDecoderModel:()=>h.VisionEncoderDecoderModel,VitMatteForImageMatting:()=>h.VitMatteForImageMatting,VitMatteImageProcessor:()=>_.VitMatteImageProcessor,VitMattePreTrainedModel:()=>h.VitMattePreTrainedModel,VitsModel:()=>h.VitsModel,VitsModelOutput:()=>h.VitsModelOutput,VitsPreTrainedModel:()=>h.VitsPreTrainedModel,VitsTokenizer:()=>m.VitsTokenizer,Wav2Vec2BertForCTC:()=>h.Wav2Vec2BertForCTC,Wav2Vec2BertForSequenceClassification:()=>h.Wav2Vec2BertForSequenceClassification,Wav2Vec2BertModel:()=>h.Wav2Vec2BertModel,Wav2Vec2BertPreTrainedModel:()=>h.Wav2Vec2BertPreTrainedModel,Wav2Vec2CTCTokenizer:()=>m.Wav2Vec2CTCTokenizer,Wav2Vec2FeatureExtractor:()=>_.Wav2Vec2FeatureExtractor,Wav2Vec2ForAudioFrameClassification:()=>h.Wav2Vec2ForAudioFrameClassification,Wav2Vec2ForCTC:()=>h.Wav2Vec2ForCTC,Wav2Vec2ForSequenceClassification:()=>h.Wav2Vec2ForSequenceClassification,Wav2Vec2Model:()=>h.Wav2Vec2Model,Wav2Vec2PreTrainedModel:()=>h.Wav2Vec2PreTrainedModel,Wav2Vec2ProcessorWithLM:()=>_.Wav2Vec2ProcessorWithLM,WavLMForAudioFrameClassification:()=>h.WavLMForAudioFrameClassification,WavLMForCTC:()=>h.WavLMForCTC,WavLMForSequenceClassification:()=>h.WavLMForSequenceClassification,WavLMForXVector:()=>h.WavLMForXVector,WavLMModel:()=>h.WavLMModel,WavLMPreTrainedModel:()=>h.WavLMPreTrainedModel,WeSpeakerFeatureExtractor:()=>_.WeSpeakerFeatureExtractor,WeSpeakerResNetModel:()=>h.WeSpeakerResNetModel,WeSpeakerResNetPreTrainedModel:()=>h.WeSpeakerResNetPreTrainedModel,WhisperFeatureExtractor:()=>_.WhisperFeatureExtractor,WhisperForConditionalGeneration:()=>h.WhisperForConditionalGeneration,WhisperModel:()=>h.WhisperModel,WhisperPreTrainedModel:()=>h.WhisperPreTrainedModel,WhisperProcessor:()=>_.WhisperProcessor,WhisperTextStreamer:()=>b.WhisperTextStreamer,WhisperTokenizer:()=>m.WhisperTokenizer,XLMForQuestionAnswering:()=>h.XLMForQuestionAnswering,XLMForSequenceClassification:()=>h.XLMForSequenceClassification,XLMForTokenClassification:()=>h.XLMForTokenClassification,XLMModel:()=>h.XLMModel,XLMPreTrainedModel:()=>h.XLMPreTrainedModel,XLMRobertaForMaskedLM:()=>h.XLMRobertaForMaskedLM,XLMRobertaForQuestionAnswering:()=>h.XLMRobertaForQuestionAnswering,XLMRobertaForSequenceClassification:()=>h.XLMRobertaForSequenceClassification,XLMRobertaForTokenClassification:()=>h.XLMRobertaForTokenClassification,XLMRobertaModel:()=>h.XLMRobertaModel,XLMRobertaPreTrainedModel:()=>h.XLMRobertaPreTrainedModel,XLMRobertaTokenizer:()=>m.XLMRobertaTokenizer,XLMTokenizer:()=>m.XLMTokenizer,XLMWithLMHeadModel:()=>h.XLMWithLMHeadModel,XVectorOutput:()=>h.XVectorOutput,YolosFeatureExtractor:()=>_.YolosFeatureExtractor,YolosForObjectDetection:()=>h.YolosForObjectDetection,YolosModel:()=>h.YolosModel,YolosObjectDetectionOutput:()=>h.YolosObjectDetectionOutput,YolosPreTrainedModel:()=>h.YolosPreTrainedModel,ZeroShotAudioClassificationPipeline:()=>p.ZeroShotAudioClassificationPipeline,ZeroShotClassificationPipeline:()=>p.ZeroShotClassificationPipeline,ZeroShotImageClassificationPipeline:()=>p.ZeroShotImageClassificationPipeline,ZeroShotObjectDetectionPipeline:()=>p.ZeroShotObjectDetectionPipeline,bankers_round:()=>T.bankers_round,cat:()=>w.cat,cos_sim:()=>T.cos_sim,dot:()=>T.dot,dynamic_time_warping:()=>T.dynamic_time_warping,env:()=>u.env,full:()=>w.full,full_like:()=>w.full_like,getKeyValueShapes:()=>f.getKeyValueShapes,hamming:()=>g.hamming,hanning:()=>g.hanning,interpolate:()=>w.interpolate,interpolate_4d:()=>w.interpolate_4d,interpolate_data:()=>T.interpolate_data,is_chinese_char:()=>m.is_chinese_char,layer_norm:()=>w.layer_norm,log_softmax:()=>T.log_softmax,magnitude:()=>T.magnitude,matmul:()=>w.matmul,max:()=>T.max,mean:()=>w.mean,mean_pooling:()=>w.mean_pooling,medianFilter:()=>T.medianFilter,mel_filter_bank:()=>g.mel_filter_bank,min:()=>T.min,ones:()=>w.ones,ones_like:()=>w.ones_like,permute:()=>w.permute,permute_data:()=>T.permute_data,pipeline:()=>p.pipeline,quantize_embeddings:()=>w.quantize_embeddings,read_audio:()=>g.read_audio,rfft:()=>w.rfft,round:()=>T.round,softmax:()=>T.softmax,spectrogram:()=>g.spectrogram,stack:()=>w.stack,std_mean:()=>w.std_mean,topk:()=>w.topk,window_function:()=>g.window_function,zeros:()=>w.zeros,zeros_like:()=>w.zeros_like});var u=c(/*! ./env.js */"./src/env.js"),p=c(/*! ./pipelines.js */"./src/pipelines.js"),h=c(/*! ./models.js */"./src/models.js"),m=c(/*! ./tokenizers.js */"./src/tokenizers.js"),_=c(/*! ./processors.js */"./src/processors.js"),f=c(/*! ./configs.js */"./src/configs.js"),g=c(/*! ./utils/audio.js */"./src/utils/audio.js"),M=c(/*! ./utils/image.js */"./src/utils/image.js"),w=c(/*! ./utils/tensor.js */"./src/utils/tensor.js"),T=c(/*! ./utils/maths.js */"./src/utils/maths.js"),b=c(/*! ./generation/streamers.js */"./src/generation/streamers.js"),x=c(/*! ./generation/stopping_criteria.js */"./src/generation/stopping_criteria.js"),y=d.ASTFeatureExtractor,k=d.ASTForAudioClassification,F=d.ASTModel,P=d.ASTPreTrainedModel,C=d.AlbertForMaskedLM,v=d.AlbertForQuestionAnswering,S=d.AlbertForSequenceClassification,A=d.AlbertModel,E=d.AlbertPreTrainedModel,L=d.AlbertTokenizer,z=d.AudioClassificationPipeline,I=d.AutoConfig,B=d.AutoModel,N=d.AutoModelForAudioClassification,D=d.AutoModelForAudioFrameClassification,O=d.AutoModelForCTC,V=d.AutoModelForCausalLM,j=d.AutoModelForDepthEstimation,R=d.AutoModelForDocumentQuestionAnswering,G=d.AutoModelForImageClassification,q=d.AutoModelForImageFeatureExtraction,W=d.AutoModelForImageMatting,$=d.AutoModelForImageSegmentation,U=d.AutoModelForImageToImage,X=d.AutoModelForMaskGeneration,Q=d.AutoModelForMaskedLM,H=d.AutoModelForNormalEstimation,Y=d.AutoModelForObjectDetection,J=d.AutoModelForQuestionAnswering,K=d.AutoModelForSemanticSegmentation,Z=d.AutoModelForSeq2SeqLM,ee=d.AutoModelForSequenceClassification,te=d.AutoModelForSpeechSeq2Seq,re=d.AutoModelForTextToSpectrogram,ne=d.AutoModelForTextToWaveform,oe=d.AutoModelForTokenClassification,se=d.AutoModelForUniversalSegmentation,ae=d.AutoModelForVision2Seq,ie=d.AutoModelForXVector,le=d.AutoModelForZeroShotObjectDetection,ce=d.AutoProcessor,de=d.AutoTokenizer,ue=d.AutomaticSpeechRecognitionPipeline,pe=d.BartForConditionalGeneration,he=d.BartForSequenceClassification,me=d.BartModel,_e=d.BartPretrainedModel,fe=d.BartTokenizer,ge=d.BaseModelOutput,Me=d.BaseStreamer,we=d.BeitFeatureExtractor,Te=d.BeitForImageClassification,be=d.BeitModel,xe=d.BeitPreTrainedModel,ye=d.BertForMaskedLM,ke=d.BertForQuestionAnswering,Fe=d.BertForSequenceClassification,Pe=d.BertForTokenClassification,Ce=d.BertModel,ve=d.BertPreTrainedModel,Se=d.BertTokenizer,Ae=d.BitImageProcessor,Ee=d.BlenderbotForConditionalGeneration,Le=d.BlenderbotModel,ze=d.BlenderbotPreTrainedModel,Ie=d.BlenderbotSmallForConditionalGeneration,Be=d.BlenderbotSmallModel,Ne=d.BlenderbotSmallPreTrainedModel,De=d.BlenderbotSmallTokenizer,Oe=d.BlenderbotTokenizer,Ve=d.BloomForCausalLM,je=d.BloomModel,Re=d.BloomPreTrainedModel,Ge=d.BloomTokenizer,qe=d.CLIPFeatureExtractor,We=d.CLIPImageProcessor,$e=d.CLIPModel,Ue=d.CLIPPreTrainedModel,Xe=d.CLIPSegForImageSegmentation,Qe=d.CLIPSegModel,He=d.CLIPSegPreTrainedModel,Ye=d.CLIPTextModel,Je=d.CLIPTextModelWithProjection,Ke=d.CLIPTokenizer,Ze=d.CLIPVisionModel,et=d.CLIPVisionModelWithProjection,tt=d.CamembertForMaskedLM,rt=d.CamembertForQuestionAnswering,nt=d.CamembertForSequenceClassification,ot=d.CamembertForTokenClassification,st=d.CamembertModel,at=d.CamembertPreTrainedModel,it=d.CamembertTokenizer,lt=d.CausalLMOutput,ct=d.CausalLMOutputWithPast,dt=d.ChineseCLIPFeatureExtractor,ut=d.ChineseCLIPModel,pt=d.ChineseCLIPPreTrainedModel,ht=d.ClapAudioModelWithProjection,mt=d.ClapFeatureExtractor,_t=d.ClapModel,ft=d.ClapPreTrainedModel,gt=d.ClapTextModelWithProjection,Mt=d.CodeGenForCausalLM,wt=d.CodeGenModel,Tt=d.CodeGenPreTrainedModel,bt=d.CodeGenTokenizer,xt=d.CodeLlamaTokenizer,yt=d.CohereForCausalLM,kt=d.CohereModel,Ft=d.CoherePreTrainedModel,Pt=d.CohereTokenizer,Ct=d.ConvBertForMaskedLM,vt=d.ConvBertForQuestionAnswering,St=d.ConvBertForSequenceClassification,At=d.ConvBertForTokenClassification,Et=d.ConvBertModel,Lt=d.ConvBertPreTrainedModel,zt=d.ConvBertTokenizer,It=d.ConvNextFeatureExtractor,Bt=d.ConvNextForImageClassification,Nt=d.ConvNextImageProcessor,Dt=d.ConvNextModel,Ot=d.ConvNextPreTrainedModel,Vt=d.ConvNextV2ForImageClassification,jt=d.ConvNextV2Model,Rt=d.ConvNextV2PreTrainedModel,Gt=d.DPTFeatureExtractor,qt=d.DPTForDepthEstimation,Wt=d.DPTImageProcessor,$t=d.DPTModel,Ut=d.DPTPreTrainedModel,Xt=d.DebertaForMaskedLM,Qt=d.DebertaForQuestionAnswering,Ht=d.DebertaForSequenceClassification,Yt=d.DebertaForTokenClassification,Jt=d.DebertaModel,Kt=d.DebertaPreTrainedModel,Zt=d.DebertaTokenizer,er=d.DebertaV2ForMaskedLM,tr=d.DebertaV2ForQuestionAnswering,rr=d.DebertaV2ForSequenceClassification,nr=d.DebertaV2ForTokenClassification,or=d.DebertaV2Model,sr=d.DebertaV2PreTrainedModel,ar=d.DebertaV2Tokenizer,ir=d.DecisionTransformerModel,lr=d.DecisionTransformerPreTrainedModel,cr=d.DeiTFeatureExtractor,dr=d.DeiTForImageClassification,ur=d.DeiTModel,pr=d.DeiTPreTrainedModel,hr=d.DepthAnythingForDepthEstimation,mr=d.DepthAnythingPreTrainedModel,_r=d.DepthEstimationPipeline,fr=d.DepthProForDepthEstimation,gr=d.DepthProPreTrainedModel,Mr=d.DetrFeatureExtractor,wr=d.DetrForObjectDetection,Tr=d.DetrForSegmentation,br=d.DetrModel,xr=d.DetrObjectDetectionOutput,yr=d.DetrPreTrainedModel,kr=d.DetrSegmentationOutput,Fr=d.Dinov2ForImageClassification,Pr=d.Dinov2Model,Cr=d.Dinov2PreTrainedModel,vr=d.DistilBertForMaskedLM,Sr=d.DistilBertForQuestionAnswering,Ar=d.DistilBertForSequenceClassification,Er=d.DistilBertForTokenClassification,Lr=d.DistilBertModel,zr=d.DistilBertPreTrainedModel,Ir=d.DistilBertTokenizer,Br=d.DocumentQuestionAnsweringPipeline,Nr=d.DonutFeatureExtractor,Dr=d.DonutSwinModel,Or=d.DonutSwinPreTrainedModel,Vr=d.EfficientNetForImageClassification,jr=d.EfficientNetImageProcessor,Rr=d.EfficientNetModel,Gr=d.EfficientNetPreTrainedModel,qr=d.ElectraForMaskedLM,Wr=d.ElectraForQuestionAnswering,$r=d.ElectraForSequenceClassification,Ur=d.ElectraForTokenClassification,Xr=d.ElectraModel,Qr=d.ElectraPreTrainedModel,Hr=d.ElectraTokenizer,Yr=d.EosTokenCriteria,Jr=d.EsmForMaskedLM,Kr=d.EsmForSequenceClassification,Zr=d.EsmForTokenClassification,en=d.EsmModel,tn=d.EsmPreTrainedModel,rn=d.EsmTokenizer,nn=d.FFT,on=d.FalconForCausalLM,sn=d.FalconModel,an=d.FalconPreTrainedModel,ln=d.FalconTokenizer,cn=d.FastViTForImageClassification,dn=d.FastViTModel,un=d.FastViTPreTrainedModel,pn=d.FeatureExtractionPipeline,hn=d.FeatureExtractor,mn=d.FillMaskPipeline,_n=d.Florence2ForConditionalGeneration,fn=d.Florence2PreTrainedModel,gn=d.Florence2Processor,Mn=d.GLPNFeatureExtractor,wn=d.GLPNForDepthEstimation,Tn=d.GLPNModel,bn=d.GLPNPreTrainedModel,xn=d.GPT2LMHeadModel,yn=d.GPT2Model,kn=d.GPT2PreTrainedModel,Fn=d.GPT2Tokenizer,Pn=d.GPTBigCodeForCausalLM,Cn=d.GPTBigCodeModel,vn=d.GPTBigCodePreTrainedModel,Sn=d.GPTJForCausalLM,An=d.GPTJModel,En=d.GPTJPreTrainedModel,Ln=d.GPTNeoForCausalLM,zn=d.GPTNeoModel,In=d.GPTNeoPreTrainedModel,Bn=d.GPTNeoXForCausalLM,Nn=d.GPTNeoXModel,Dn=d.GPTNeoXPreTrainedModel,On=d.GPTNeoXTokenizer,Vn=d.Gemma2ForCausalLM,jn=d.Gemma2Model,Rn=d.Gemma2PreTrainedModel,Gn=d.GemmaForCausalLM,qn=d.GemmaModel,Wn=d.GemmaPreTrainedModel,$n=d.GemmaTokenizer,Un=d.GraniteForCausalLM,Xn=d.GraniteModel,Qn=d.GranitePreTrainedModel,Hn=d.Grok1Tokenizer,Yn=d.GroupViTModel,Jn=d.GroupViTPreTrainedModel,Kn=d.HerbertTokenizer,Zn=d.HieraForImageClassification,eo=d.HieraModel,to=d.HieraPreTrainedModel,ro=d.HubertForCTC,no=d.HubertForSequenceClassification,oo=d.HubertModel,so=d.HubertPreTrainedModel,ao=d.ImageClassificationPipeline,io=d.ImageFeatureExtractionPipeline,lo=d.ImageFeatureExtractor,co=d.ImageMattingOutput,uo=d.ImageSegmentationPipeline,po=d.ImageToImagePipeline,ho=d.ImageToTextPipeline,mo=d.InterruptableStoppingCriteria,_o=d.JAISLMHeadModel,fo=d.JAISModel,go=d.JAISPreTrainedModel,Mo=d.LlamaForCausalLM,wo=d.LlamaModel,To=d.LlamaPreTrainedModel,bo=d.LlamaTokenizer,xo=d.LlavaForConditionalGeneration,yo=d.LlavaPreTrainedModel,ko=d.LongT5ForConditionalGeneration,Fo=d.LongT5Model,Po=d.LongT5PreTrainedModel,Co=d.M2M100ForConditionalGeneration,vo=d.M2M100Model,So=d.M2M100PreTrainedModel,Ao=d.M2M100Tokenizer,Eo=d.MBart50Tokenizer,Lo=d.MBartForCausalLM,zo=d.MBartForConditionalGeneration,Io=d.MBartForSequenceClassification,Bo=d.MBartModel,No=d.MBartPreTrainedModel,Do=d.MBartTokenizer,Oo=d.MPNetForMaskedLM,Vo=d.MPNetForQuestionAnswering,jo=d.MPNetForSequenceClassification,Ro=d.MPNetForTokenClassification,Go=d.MPNetModel,qo=d.MPNetPreTrainedModel,Wo=d.MPNetTokenizer,$o=d.MT5ForConditionalGeneration,Uo=d.MT5Model,Xo=d.MT5PreTrainedModel,Qo=d.MarianMTModel,Ho=d.MarianModel,Yo=d.MarianPreTrainedModel,Jo=d.MarianTokenizer,Ko=d.MaskFormerFeatureExtractor,Zo=d.MaskFormerForInstanceSegmentation,es=d.MaskFormerModel,ts=d.MaskFormerPreTrainedModel,rs=d.MaskedLMOutput,ns=d.MaxLengthCriteria,os=d.MistralForCausalLM,ss=d.MistralModel,as=d.MistralPreTrainedModel,is=d.MobileBertForMaskedLM,ls=d.MobileBertForQuestionAnswering,cs=d.MobileBertForSequenceClassification,ds=d.MobileBertModel,us=d.MobileBertPreTrainedModel,ps=d.MobileBertTokenizer,hs=d.MobileNetV1FeatureExtractor,ms=d.MobileNetV1ForImageClassification,_s=d.MobileNetV1Model,fs=d.MobileNetV1PreTrainedModel,gs=d.MobileNetV2FeatureExtractor,Ms=d.MobileNetV2ForImageClassification,ws=d.MobileNetV2Model,Ts=d.MobileNetV2PreTrainedModel,bs=d.MobileNetV3FeatureExtractor,xs=d.MobileNetV3ForImageClassification,ys=d.MobileNetV3Model,ks=d.MobileNetV3PreTrainedModel,Fs=d.MobileNetV4FeatureExtractor,Ps=d.MobileNetV4ForImageClassification,Cs=d.MobileNetV4Model,vs=d.MobileNetV4PreTrainedModel,Ss=d.MobileViTFeatureExtractor,As=d.MobileViTForImageClassification,Es=d.MobileViTImageProcessor,Ls=d.MobileViTModel,zs=d.MobileViTPreTrainedModel,Is=d.MobileViTV2ForImageClassification,Bs=d.MobileViTV2Model,Ns=d.MobileViTV2PreTrainedModel,Ds=d.ModelOutput,Os=d.Moondream1ForConditionalGeneration,Vs=d.MptForCausalLM,js=d.MptModel,Rs=d.MptPreTrainedModel,Gs=d.MusicgenForCausalLM,qs=d.MusicgenForConditionalGeneration,Ws=d.MusicgenModel,$s=d.MusicgenPreTrainedModel,Us=d.NllbTokenizer,Xs=d.NomicBertModel,Qs=d.NomicBertPreTrainedModel,Hs=d.NougatImageProcessor,Ys=d.NougatTokenizer,Js=d.OPTForCausalLM,Ks=d.OPTModel,Zs=d.OPTPreTrainedModel,ea=d.ObjectDetectionPipeline,ta=d.OpenELMForCausalLM,ra=d.OpenELMModel,na=d.OpenELMPreTrainedModel,oa=d.OwlViTFeatureExtractor,sa=d.OwlViTForObjectDetection,aa=d.OwlViTModel,ia=d.OwlViTPreTrainedModel,la=d.OwlViTProcessor,ca=d.Owlv2ForObjectDetection,da=d.Owlv2ImageProcessor,ua=d.Owlv2Model,pa=d.Owlv2PreTrainedModel,ha=d.Phi3ForCausalLM,ma=d.Phi3Model,_a=d.Phi3PreTrainedModel,fa=d.PhiForCausalLM,ga=d.PhiModel,Ma=d.PhiPreTrainedModel,wa=d.Pipeline,Ta=d.PreTrainedModel,ba=d.PreTrainedTokenizer,xa=d.PretrainedConfig,ya=d.PretrainedMixin,ka=d.Processor,Fa=d.PvtForImageClassification,Pa=d.PvtImageProcessor,Ca=d.PvtModel,va=d.PvtPreTrainedModel,Sa=d.PyAnnoteFeatureExtractor,Aa=d.PyAnnoteForAudioFrameClassification,Ea=d.PyAnnoteModel,La=d.PyAnnotePreTrainedModel,za=d.PyAnnoteProcessor,Ia=d.QuestionAnsweringModelOutput,Ba=d.QuestionAnsweringPipeline,Na=d.Qwen2ForCausalLM,Da=d.Qwen2Model,Oa=d.Qwen2PreTrainedModel,Va=d.Qwen2Tokenizer,ja=d.RTDetrForObjectDetection,Ra=d.RTDetrImageProcessor,Ga=d.RTDetrModel,qa=d.RTDetrObjectDetectionOutput,Wa=d.RTDetrPreTrainedModel,$a=d.RawImage,Ua=d.ResNetForImageClassification,Xa=d.ResNetModel,Qa=d.ResNetPreTrainedModel,Ha=d.RoFormerForMaskedLM,Ya=d.RoFormerForQuestionAnswering,Ja=d.RoFormerForSequenceClassification,Ka=d.RoFormerForTokenClassification,Za=d.RoFormerModel,ei=d.RoFormerPreTrainedModel,ti=d.RoFormerTokenizer,ri=d.RobertaForMaskedLM,ni=d.RobertaForQuestionAnswering,oi=d.RobertaForSequenceClassification,si=d.RobertaForTokenClassification,ai=d.RobertaModel,ii=d.RobertaPreTrainedModel,li=d.RobertaTokenizer,ci=d.SamImageProcessor,di=d.SamImageSegmentationOutput,ui=d.SamModel,pi=d.SamPreTrainedModel,hi=d.SamProcessor,mi=d.SapiensFeatureExtractor,_i=d.SapiensForDepthEstimation,fi=d.SapiensForNormalEstimation,gi=d.SapiensForSemanticSegmentation,Mi=d.SapiensPreTrainedModel,wi=d.SeamlessM4TFeatureExtractor,Ti=d.SegformerFeatureExtractor,bi=d.SegformerForImageClassification,xi=d.SegformerForSemanticSegmentation,yi=d.SegformerModel,ki=d.SegformerPreTrainedModel,Fi=d.Seq2SeqLMOutput,Pi=d.SequenceClassifierOutput,Ci=d.SiglipImageProcessor,vi=d.SiglipModel,Si=d.SiglipPreTrainedModel,Ai=d.SiglipTextModel,Ei=d.SiglipTokenizer,Li=d.SiglipVisionModel,zi=d.SpeechT5FeatureExtractor,Ii=d.SpeechT5ForSpeechToText,Bi=d.SpeechT5ForTextToSpeech,Ni=d.SpeechT5HifiGan,Di=d.SpeechT5Model,Oi=d.SpeechT5PreTrainedModel,Vi=d.SpeechT5Processor,ji=d.SpeechT5Tokenizer,Ri=d.SqueezeBertForMaskedLM,Gi=d.SqueezeBertForQuestionAnswering,qi=d.SqueezeBertForSequenceClassification,Wi=d.SqueezeBertModel,$i=d.SqueezeBertPreTrainedModel,Ui=d.SqueezeBertTokenizer,Xi=d.StableLmForCausalLM,Qi=d.StableLmModel,Hi=d.StableLmPreTrainedModel,Yi=d.Starcoder2ForCausalLM,Ji=d.Starcoder2Model,Ki=d.Starcoder2PreTrainedModel,Zi=d.StoppingCriteria,el=d.StoppingCriteriaList,tl=d.SummarizationPipeline,rl=d.Swin2SRForImageSuperResolution,nl=d.Swin2SRImageProcessor,ol=d.Swin2SRModel,sl=d.Swin2SRPreTrainedModel,al=d.SwinForImageClassification,il=d.SwinModel,ll=d.SwinPreTrainedModel,cl=d.T5ForConditionalGeneration,dl=d.T5Model,ul=d.T5PreTrainedModel,pl=d.T5Tokenizer,hl=d.TableTransformerForObjectDetection,ml=d.TableTransformerModel,_l=d.TableTransformerObjectDetectionOutput,fl=d.TableTransformerPreTrainedModel,gl=d.Tensor,Ml=d.Text2TextGenerationPipeline,wl=d.TextClassificationPipeline,Tl=d.TextGenerationPipeline,bl=d.TextStreamer,xl=d.TextToAudioPipeline,yl=d.TokenClassificationPipeline,kl=d.TokenClassifierOutput,Fl=d.TokenizerModel,Pl=d.TrOCRForCausalLM,Cl=d.TrOCRPreTrainedModel,vl=d.TranslationPipeline,Sl=d.UniSpeechForCTC,Al=d.UniSpeechForSequenceClassification,El=d.UniSpeechModel,Ll=d.UniSpeechPreTrainedModel,zl=d.UniSpeechSatForAudioFrameClassification,Il=d.UniSpeechSatForCTC,Bl=d.UniSpeechSatForSequenceClassification,Nl=d.UniSpeechSatModel,Dl=d.UniSpeechSatPreTrainedModel,Ol=d.ViTFeatureExtractor,Vl=d.ViTForImageClassification,jl=d.ViTImageProcessor,Rl=d.ViTMAEModel,Gl=d.ViTMAEPreTrainedModel,ql=d.ViTMSNForImageClassification,Wl=d.ViTMSNModel,$l=d.ViTMSNPreTrainedModel,Ul=d.ViTModel,Xl=d.ViTPreTrainedModel,Ql=d.VisionEncoderDecoderModel,Hl=d.VitMatteForImageMatting,Yl=d.VitMatteImageProcessor,Jl=d.VitMattePreTrainedModel,Kl=d.VitsModel,Zl=d.VitsModelOutput,ec=d.VitsPreTrainedModel,tc=d.VitsTokenizer,rc=d.Wav2Vec2BertForCTC,nc=d.Wav2Vec2BertForSequenceClassification,oc=d.Wav2Vec2BertModel,sc=d.Wav2Vec2BertPreTrainedModel,ac=d.Wav2Vec2CTCTokenizer,ic=d.Wav2Vec2FeatureExtractor,lc=d.Wav2Vec2ForAudioFrameClassification,cc=d.Wav2Vec2ForCTC,dc=d.Wav2Vec2ForSequenceClassification,uc=d.Wav2Vec2Model,pc=d.Wav2Vec2PreTrainedModel,hc=d.Wav2Vec2ProcessorWithLM,mc=d.WavLMForAudioFrameClassification,_c=d.WavLMForCTC,fc=d.WavLMForSequenceClassification,gc=d.WavLMForXVector,Mc=d.WavLMModel,wc=d.WavLMPreTrainedModel,Tc=d.WeSpeakerFeatureExtractor,bc=d.WeSpeakerResNetModel,xc=d.WeSpeakerResNetPreTrainedModel,yc=d.WhisperFeatureExtractor,kc=d.WhisperForConditionalGeneration,Fc=d.WhisperModel,Pc=d.WhisperPreTrainedModel,Cc=d.WhisperProcessor,vc=d.WhisperTextStreamer,Sc=d.WhisperTokenizer,Ac=d.XLMForQuestionAnswering,Ec=d.XLMForSequenceClassification,Lc=d.XLMForTokenClassification,zc=d.XLMModel,Ic=d.XLMPreTrainedModel,Bc=d.XLMRobertaForMaskedLM,Nc=d.XLMRobertaForQuestionAnswering,Dc=d.XLMRobertaForSequenceClassification,Oc=d.XLMRobertaForTokenClassification,Vc=d.XLMRobertaModel,jc=d.XLMRobertaPreTrainedModel,Rc=d.XLMRobertaTokenizer,Gc=d.XLMTokenizer,qc=d.XLMWithLMHeadModel,Wc=d.XVectorOutput,$c=d.YolosFeatureExtractor,Uc=d.YolosForObjectDetection,Xc=d.YolosModel,Qc=d.YolosObjectDetectionOutput,Hc=d.YolosPreTrainedModel,Yc=d.ZeroShotAudioClassificationPipeline,Jc=d.ZeroShotClassificationPipeline,Kc=d.ZeroShotImageClassificationPipeline,Zc=d.ZeroShotObjectDetectionPipeline,ed=d.bankers_round,td=d.cat,rd=d.cos_sim,nd=d.dot,od=d.dynamic_time_warping,sd=d.env,ad=d.full,id=d.full_like,ld=d.getKeyValueShapes,cd=d.hamming,dd=d.hanning,ud=d.interpolate,pd=d.interpolate_4d,hd=d.interpolate_data,md=d.is_chinese_char,_d=d.layer_norm,fd=d.log_softmax,gd=d.magnitude,Md=d.matmul,wd=d.max,Td=d.mean,bd=d.mean_pooling,xd=d.medianFilter,yd=d.mel_filter_bank,kd=d.min,Fd=d.ones,Pd=d.ones_like,Cd=d.permute,vd=d.permute_data,Sd=d.pipeline,Ad=d.quantize_embeddings,Ed=d.read_audio,Ld=d.rfft,zd=d.round,Id=d.softmax,Bd=d.spectrogram,Nd=d.stack,Dd=d.std_mean,Od=d.topk,Vd=d.window_function,jd=d.zeros,Rd=d.zeros_like;export{y as ASTFeatureExtractor,k as ASTForAudioClassification,F as ASTModel,P as ASTPreTrainedModel,C as AlbertForMaskedLM,v as AlbertForQuestionAnswering,S as AlbertForSequenceClassification,A as AlbertModel,E as AlbertPreTrainedModel,L as AlbertTokenizer,z as AudioClassificationPipeline,I as AutoConfig,B as AutoModel,N as AutoModelForAudioClassification,D as AutoModelForAudioFrameClassification,O as AutoModelForCTC,V as AutoModelForCausalLM,j as AutoModelForDepthEstimation,R as AutoModelForDocumentQuestionAnswering,G as AutoModelForImageClassification,q as AutoModelForImageFeatureExtraction,W as AutoModelForImageMatting,$ as AutoModelForImageSegmentation,U as AutoModelForImageToImage,X as AutoModelForMaskGeneration,Q as AutoModelForMaskedLM,H as AutoModelForNormalEstimation,Y as AutoModelForObjectDetection,J as AutoModelForQuestionAnswering,K as AutoModelForSemanticSegmentation,Z as AutoModelForSeq2SeqLM,ee as AutoModelForSequenceClassification,te as AutoModelForSpeechSeq2Seq,re as AutoModelForTextToSpectrogram,ne as AutoModelForTextToWaveform,oe as AutoModelForTokenClassification,se as AutoModelForUniversalSegmentation,ae as AutoModelForVision2Seq,ie as AutoModelForXVector,le as AutoModelForZeroShotObjectDetection,ce as AutoProcessor,de as AutoTokenizer,ue as AutomaticSpeechRecognitionPipeline,pe as BartForConditionalGeneration,he as BartForSequenceClassification,me as BartModel,_e as BartPretrainedModel,fe as BartTokenizer,ge as BaseModelOutput,Me as BaseStreamer,we as BeitFeatureExtractor,Te as BeitForImageClassification,be as BeitModel,xe as BeitPreTrainedModel,ye as BertForMaskedLM,ke as BertForQuestionAnswering,Fe as BertForSequenceClassification,Pe as BertForTokenClassification,Ce as BertModel,ve as BertPreTrainedModel,Se as BertTokenizer,Ae as BitImageProcessor,Ee as BlenderbotForConditionalGeneration,Le as BlenderbotModel,ze as BlenderbotPreTrainedModel,Ie as BlenderbotSmallForConditionalGeneration,Be as BlenderbotSmallModel,Ne as BlenderbotSmallPreTrainedModel,De as BlenderbotSmallTokenizer,Oe as BlenderbotTokenizer,Ve as BloomForCausalLM,je as BloomModel,Re as BloomPreTrainedModel,Ge as BloomTokenizer,qe as CLIPFeatureExtractor,We as CLIPImageProcessor,$e as CLIPModel,Ue as CLIPPreTrainedModel,Xe as CLIPSegForImageSegmentation,Qe as CLIPSegModel,He as CLIPSegPreTrainedModel,Ye as CLIPTextModel,Je as CLIPTextModelWithProjection,Ke as CLIPTokenizer,Ze as CLIPVisionModel,et as CLIPVisionModelWithProjection,tt as CamembertForMaskedLM,rt as CamembertForQuestionAnswering,nt as CamembertForSequenceClassification,ot as CamembertForTokenClassification,st as CamembertModel,at as CamembertPreTrainedModel,it as CamembertTokenizer,lt as CausalLMOutput,ct as CausalLMOutputWithPast,dt as ChineseCLIPFeatureExtractor,ut as ChineseCLIPModel,pt as ChineseCLIPPreTrainedModel,ht as ClapAudioModelWithProjection,mt as ClapFeatureExtractor,_t as ClapModel,ft as ClapPreTrainedModel,gt as ClapTextModelWithProjection,Mt as CodeGenForCausalLM,wt as CodeGenModel,Tt as CodeGenPreTrainedModel,bt as CodeGenTokenizer,xt as CodeLlamaTokenizer,yt as CohereForCausalLM,kt as CohereModel,Ft as CoherePreTrainedModel,Pt as CohereTokenizer,Ct as ConvBertForMaskedLM,vt as ConvBertForQuestionAnswering,St as ConvBertForSequenceClassification,At as ConvBertForTokenClassification,Et as ConvBertModel,Lt as ConvBertPreTrainedModel,zt as ConvBertTokenizer,It as ConvNextFeatureExtractor,Bt as ConvNextForImageClassification,Nt as ConvNextImageProcessor,Dt as ConvNextModel,Ot as ConvNextPreTrainedModel,Vt as ConvNextV2ForImageClassification,jt as ConvNextV2Model,Rt as ConvNextV2PreTrainedModel,Gt as DPTFeatureExtractor,qt as DPTForDepthEstimation,Wt as DPTImageProcessor,$t as DPTModel,Ut as DPTPreTrainedModel,Xt as DebertaForMaskedLM,Qt as DebertaForQuestionAnswering,Ht as DebertaForSequenceClassification,Yt as DebertaForTokenClassification,Jt as DebertaModel,Kt as DebertaPreTrainedModel,Zt as DebertaTokenizer,er as DebertaV2ForMaskedLM,tr as DebertaV2ForQuestionAnswering,rr as DebertaV2ForSequenceClassification,nr as DebertaV2ForTokenClassification,or as DebertaV2Model,sr as DebertaV2PreTrainedModel,ar as DebertaV2Tokenizer,ir as DecisionTransformerModel,lr as DecisionTransformerPreTrainedModel,cr as DeiTFeatureExtractor,dr as DeiTForImageClassification,ur as DeiTModel,pr as DeiTPreTrainedModel,hr as DepthAnythingForDepthEstimation,mr as DepthAnythingPreTrainedModel,_r as DepthEstimationPipeline,fr as DepthProForDepthEstimation,gr as DepthProPreTrainedModel,Mr as DetrFeatureExtractor,wr as DetrForObjectDetection,Tr as DetrForSegmentation,br as DetrModel,xr as DetrObjectDetectionOutput,yr as DetrPreTrainedModel,kr as DetrSegmentationOutput,Fr as Dinov2ForImageClassification,Pr as Dinov2Model,Cr as Dinov2PreTrainedModel,vr as DistilBertForMaskedLM,Sr as DistilBertForQuestionAnswering,Ar as DistilBertForSequenceClassification,Er as DistilBertForTokenClassification,Lr as DistilBertModel,zr as DistilBertPreTrainedModel,Ir as DistilBertTokenizer,Br as DocumentQuestionAnsweringPipeline,Nr as DonutFeatureExtractor,Dr as DonutSwinModel,Or as DonutSwinPreTrainedModel,Vr as EfficientNetForImageClassification,jr as EfficientNetImageProcessor,Rr as EfficientNetModel,Gr as EfficientNetPreTrainedModel,qr as ElectraForMaskedLM,Wr as ElectraForQuestionAnswering,$r as ElectraForSequenceClassification,Ur as ElectraForTokenClassification,Xr as ElectraModel,Qr as ElectraPreTrainedModel,Hr as ElectraTokenizer,Yr as EosTokenCriteria,Jr as EsmForMaskedLM,Kr as EsmForSequenceClassification,Zr as EsmForTokenClassification,en as EsmModel,tn as EsmPreTrainedModel,rn as EsmTokenizer,nn as FFT,on as FalconForCausalLM,sn as FalconModel,an as FalconPreTrainedModel,ln as FalconTokenizer,cn as FastViTForImageClassification,dn as FastViTModel,un as FastViTPreTrainedModel,pn as FeatureExtractionPipeline,hn as FeatureExtractor,mn as FillMaskPipeline,_n as Florence2ForConditionalGeneration,fn as Florence2PreTrainedModel,gn as Florence2Processor,Mn as GLPNFeatureExtractor,wn as GLPNForDepthEstimation,Tn as GLPNModel,bn as GLPNPreTrainedModel,xn as GPT2LMHeadModel,yn as GPT2Model,kn as GPT2PreTrainedModel,Fn as GPT2Tokenizer,Pn as GPTBigCodeForCausalLM,Cn as GPTBigCodeModel,vn as GPTBigCodePreTrainedModel,Sn as GPTJForCausalLM,An as GPTJModel,En as GPTJPreTrainedModel,Ln as GPTNeoForCausalLM,zn as GPTNeoModel,In as GPTNeoPreTrainedModel,Bn as GPTNeoXForCausalLM,Nn as GPTNeoXModel,Dn as GPTNeoXPreTrainedModel,On as GPTNeoXTokenizer,Vn as Gemma2ForCausalLM,jn as Gemma2Model,Rn as Gemma2PreTrainedModel,Gn as GemmaForCausalLM,qn as GemmaModel,Wn as GemmaPreTrainedModel,$n as GemmaTokenizer,Un as GraniteForCausalLM,Xn as GraniteModel,Qn as GranitePreTrainedModel,Hn as Grok1Tokenizer,Yn as GroupViTModel,Jn as GroupViTPreTrainedModel,Kn as HerbertTokenizer,Zn as HieraForImageClassification,eo as HieraModel,to as HieraPreTrainedModel,ro as HubertForCTC,no as HubertForSequenceClassification,oo as HubertModel,so as HubertPreTrainedModel,ao as ImageClassificationPipeline,io as ImageFeatureExtractionPipeline,lo as ImageFeatureExtractor,co as ImageMattingOutput,uo as ImageSegmentationPipeline,po as ImageToImagePipeline,ho as ImageToTextPipeline,mo as InterruptableStoppingCriteria,_o as JAISLMHeadModel,fo as JAISModel,go as JAISPreTrainedModel,Mo as LlamaForCausalLM,wo as LlamaModel,To as LlamaPreTrainedModel,bo as LlamaTokenizer,xo as LlavaForConditionalGeneration,yo as LlavaPreTrainedModel,ko as LongT5ForConditionalGeneration,Fo as LongT5Model,Po as LongT5PreTrainedModel,Co as M2M100ForConditionalGeneration,vo as M2M100Model,So as M2M100PreTrainedModel,Ao as M2M100Tokenizer,Eo as MBart50Tokenizer,Lo as MBartForCausalLM,zo as MBartForConditionalGeneration,Io as MBartForSequenceClassification,Bo as MBartModel,No as MBartPreTrainedModel,Do as MBartTokenizer,Oo as MPNetForMaskedLM,Vo as MPNetForQuestionAnswering,jo as MPNetForSequenceClassification,Ro as MPNetForTokenClassification,Go as MPNetModel,qo as MPNetPreTrainedModel,Wo as MPNetTokenizer,$o as MT5ForConditionalGeneration,Uo as MT5Model,Xo as MT5PreTrainedModel,Qo as MarianMTModel,Ho as MarianModel,Yo as MarianPreTrainedModel,Jo as MarianTokenizer,Ko as MaskFormerFeatureExtractor,Zo as MaskFormerForInstanceSegmentation,es as MaskFormerModel,ts as MaskFormerPreTrainedModel,rs as MaskedLMOutput,ns as MaxLengthCriteria,os as MistralForCausalLM,ss as MistralModel,as as MistralPreTrainedModel,is as MobileBertForMaskedLM,ls as MobileBertForQuestionAnswering,cs as MobileBertForSequenceClassification,ds as MobileBertModel,us as MobileBertPreTrainedModel,ps as MobileBertTokenizer,hs as MobileNetV1FeatureExtractor,ms as MobileNetV1ForImageClassification,_s as MobileNetV1Model,fs as MobileNetV1PreTrainedModel,gs as MobileNetV2FeatureExtractor,Ms as MobileNetV2ForImageClassification,ws as MobileNetV2Model,Ts as MobileNetV2PreTrainedModel,bs as MobileNetV3FeatureExtractor,xs as MobileNetV3ForImageClassification,ys as MobileNetV3Model,ks as MobileNetV3PreTrainedModel,Fs as MobileNetV4FeatureExtractor,Ps as MobileNetV4ForImageClassification,Cs as MobileNetV4Model,vs as MobileNetV4PreTrainedModel,Ss as MobileViTFeatureExtractor,As as MobileViTForImageClassification,Es as MobileViTImageProcessor,Ls as MobileViTModel,zs as MobileViTPreTrainedModel,Is as MobileViTV2ForImageClassification,Bs as MobileViTV2Model,Ns as MobileViTV2PreTrainedModel,Ds as ModelOutput,Os as Moondream1ForConditionalGeneration,Vs as MptForCausalLM,js as MptModel,Rs as MptPreTrainedModel,Gs as MusicgenForCausalLM,qs as MusicgenForConditionalGeneration,Ws as MusicgenModel,$s as MusicgenPreTrainedModel,Us as NllbTokenizer,Xs as NomicBertModel,Qs as NomicBertPreTrainedModel,Hs as NougatImageProcessor,Ys as NougatTokenizer,Js as OPTForCausalLM,Ks as OPTModel,Zs as OPTPreTrainedModel,ea as ObjectDetectionPipeline,ta as OpenELMForCausalLM,ra as OpenELMModel,na as OpenELMPreTrainedModel,oa as OwlViTFeatureExtractor,sa as OwlViTForObjectDetection,aa as OwlViTModel,ia as OwlViTPreTrainedModel,la as OwlViTProcessor,ca as Owlv2ForObjectDetection,da as Owlv2ImageProcessor,ua as Owlv2Model,pa as Owlv2PreTrainedModel,ha as Phi3ForCausalLM,ma as Phi3Model,_a as Phi3PreTrainedModel,fa as PhiForCausalLM,ga as PhiModel,Ma as PhiPreTrainedModel,wa as Pipeline,Ta as PreTrainedModel,ba as PreTrainedTokenizer,xa as PretrainedConfig,ya as PretrainedMixin,ka as Processor,Fa as PvtForImageClassification,Pa as PvtImageProcessor,Ca as PvtModel,va as PvtPreTrainedModel,Sa as PyAnnoteFeatureExtractor,Aa as PyAnnoteForAudioFrameClassification,Ea as PyAnnoteModel,La as PyAnnotePreTrainedModel,za as PyAnnoteProcessor,Ia as QuestionAnsweringModelOutput,Ba as QuestionAnsweringPipeline,Na as Qwen2ForCausalLM,Da as Qwen2Model,Oa as Qwen2PreTrainedModel,Va as Qwen2Tokenizer,ja as RTDetrForObjectDetection,Ra as RTDetrImageProcessor,Ga as RTDetrModel,qa as RTDetrObjectDetectionOutput,Wa as RTDetrPreTrainedModel,$a as RawImage,Ua as ResNetForImageClassification,Xa as ResNetModel,Qa as ResNetPreTrainedModel,Ha as RoFormerForMaskedLM,Ya as RoFormerForQuestionAnswering,Ja as RoFormerForSequenceClassification,Ka as RoFormerForTokenClassification,Za as RoFormerModel,ei as RoFormerPreTrainedModel,ti as RoFormerTokenizer,ri as RobertaForMaskedLM,ni as RobertaForQuestionAnswering,oi as RobertaForSequenceClassification,si as RobertaForTokenClassification,ai as RobertaModel,ii as RobertaPreTrainedModel,li as RobertaTokenizer,ci as SamImageProcessor,di as SamImageSegmentationOutput,ui as SamModel,pi as SamPreTrainedModel,hi as SamProcessor,mi as SapiensFeatureExtractor,_i as SapiensForDepthEstimation,fi as SapiensForNormalEstimation,gi as SapiensForSemanticSegmentation,Mi as SapiensPreTrainedModel,wi as SeamlessM4TFeatureExtractor,Ti as SegformerFeatureExtractor,bi as SegformerForImageClassification,xi as SegformerForSemanticSegmentation,yi as SegformerModel,ki as SegformerPreTrainedModel,Fi as Seq2SeqLMOutput,Pi as SequenceClassifierOutput,Ci as SiglipImageProcessor,vi as SiglipModel,Si as SiglipPreTrainedModel,Ai as SiglipTextModel,Ei as SiglipTokenizer,Li as SiglipVisionModel,zi as SpeechT5FeatureExtractor,Ii as SpeechT5ForSpeechToText,Bi as SpeechT5ForTextToSpeech,Ni as SpeechT5HifiGan,Di as SpeechT5Model,Oi as SpeechT5PreTrainedModel,Vi as SpeechT5Processor,ji as SpeechT5Tokenizer,Ri as SqueezeBertForMaskedLM,Gi as SqueezeBertForQuestionAnswering,qi as SqueezeBertForSequenceClassification,Wi as SqueezeBertModel,$i as SqueezeBertPreTrainedModel,Ui as SqueezeBertTokenizer,Xi as StableLmForCausalLM,Qi as StableLmModel,Hi as StableLmPreTrainedModel,Yi as Starcoder2ForCausalLM,Ji as Starcoder2Model,Ki as Starcoder2PreTrainedModel,Zi as StoppingCriteria,el as StoppingCriteriaList,tl as SummarizationPipeline,rl as Swin2SRForImageSuperResolution,nl as Swin2SRImageProcessor,ol as Swin2SRModel,sl as Swin2SRPreTrainedModel,al as SwinForImageClassification,il as SwinModel,ll as SwinPreTrainedModel,cl as T5ForConditionalGeneration,dl as T5Model,ul as T5PreTrainedModel,pl as T5Tokenizer,hl as TableTransformerForObjectDetection,ml as TableTransformerModel,_l as TableTransformerObjectDetectionOutput,fl as TableTransformerPreTrainedModel,gl as Tensor,Ml as Text2TextGenerationPipeline,wl as TextClassificationPipeline,Tl as TextGenerationPipeline,bl as TextStreamer,xl as TextToAudioPipeline,yl as TokenClassificationPipeline,kl as TokenClassifierOutput,Fl as TokenizerModel,Pl as TrOCRForCausalLM,Cl as TrOCRPreTrainedModel,vl as TranslationPipeline,Sl as UniSpeechForCTC,Al as UniSpeechForSequenceClassification,El as UniSpeechModel,Ll as UniSpeechPreTrainedModel,zl as UniSpeechSatForAudioFrameClassification,Il as UniSpeechSatForCTC,Bl as UniSpeechSatForSequenceClassification,Nl as UniSpeechSatModel,Dl as UniSpeechSatPreTrainedModel,Ol as ViTFeatureExtractor,Vl as ViTForImageClassification,jl as ViTImageProcessor,Rl as ViTMAEModel,Gl as ViTMAEPreTrainedModel,ql as ViTMSNForImageClassification,Wl as ViTMSNModel,$l as ViTMSNPreTrainedModel,Ul as ViTModel,Xl as ViTPreTrainedModel,Ql as VisionEncoderDecoderModel,Hl as VitMatteForImageMatting,Yl as VitMatteImageProcessor,Jl as VitMattePreTrainedModel,Kl as VitsModel,Zl as VitsModelOutput,ec as VitsPreTrainedModel,tc as VitsTokenizer,rc as Wav2Vec2BertForCTC,nc as Wav2Vec2BertForSequenceClassification,oc as Wav2Vec2BertModel,sc as Wav2Vec2BertPreTrainedModel,ac as Wav2Vec2CTCTokenizer,ic as Wav2Vec2FeatureExtractor,lc as Wav2Vec2ForAudioFrameClassification,cc as Wav2Vec2ForCTC,dc as Wav2Vec2ForSequenceClassification,uc as Wav2Vec2Model,pc as Wav2Vec2PreTrainedModel,hc as Wav2Vec2ProcessorWithLM,mc as WavLMForAudioFrameClassification,_c as WavLMForCTC,fc as WavLMForSequenceClassification,gc as WavLMForXVector,Mc as WavLMModel,wc as WavLMPreTrainedModel,Tc as WeSpeakerFeatureExtractor,bc as WeSpeakerResNetModel,xc as WeSpeakerResNetPreTrainedModel,yc as WhisperFeatureExtractor,kc as WhisperForConditionalGeneration,Fc as WhisperModel,Pc as WhisperPreTrainedModel,Cc as WhisperProcessor,vc as WhisperTextStreamer,Sc as WhisperTokenizer,Ac as XLMForQuestionAnswering,Ec as XLMForSequenceClassification,Lc as XLMForTokenClassification,zc as XLMModel,Ic as XLMPreTrainedModel,Bc as XLMRobertaForMaskedLM,Nc as XLMRobertaForQuestionAnswering,Dc as XLMRobertaForSequenceClassification,Oc as XLMRobertaForTokenClassification,Vc as XLMRobertaModel,jc as XLMRobertaPreTrainedModel,Rc as XLMRobertaTokenizer,Gc as XLMTokenizer,qc as XLMWithLMHeadModel,Wc as XVectorOutput,$c as YolosFeatureExtractor,Uc as YolosForObjectDetection,Xc as YolosModel,Qc as YolosObjectDetectionOutput,Hc as YolosPreTrainedModel,Yc as ZeroShotAudioClassificationPipeline,Jc as ZeroShotClassificationPipeline,Kc as ZeroShotImageClassificationPipeline,Zc as ZeroShotObjectDetectionPipeline,ed as bankers_round,td as cat,rd as cos_sim,nd as dot,od as dynamic_time_warping,sd as env,ad as full,id as full_like,ld as getKeyValueShapes,cd as hamming,dd as hanning,ud as interpolate,pd as interpolate_4d,hd as interpolate_data,md as is_chinese_char,_d as layer_norm,fd as log_softmax,gd as magnitude,Md as matmul,wd as max,Td as mean,bd as mean_pooling,xd as medianFilter,yd as mel_filter_bank,kd as min,Fd as ones,Pd as ones_like,Cd as permute,vd as permute_data,Sd as pipeline,Ad as quantize_embeddings,Ed as read_audio,Ld as rfft,zd as round,Id as softmax,Bd as spectrogram,Nd as stack,Dd as std_mean,Od as topk,Vd as window_function,jd as zeros,Rd as zeros_like};
166
+ \*****************************/c.r(d),c.d(d,{ASTFeatureExtractor:()=>_.ASTFeatureExtractor,ASTForAudioClassification:()=>h.ASTForAudioClassification,ASTModel:()=>h.ASTModel,ASTPreTrainedModel:()=>h.ASTPreTrainedModel,AlbertForMaskedLM:()=>h.AlbertForMaskedLM,AlbertForQuestionAnswering:()=>h.AlbertForQuestionAnswering,AlbertForSequenceClassification:()=>h.AlbertForSequenceClassification,AlbertModel:()=>h.AlbertModel,AlbertPreTrainedModel:()=>h.AlbertPreTrainedModel,AlbertTokenizer:()=>m.AlbertTokenizer,AudioClassificationPipeline:()=>p.AudioClassificationPipeline,AutoConfig:()=>f.AutoConfig,AutoModel:()=>h.AutoModel,AutoModelForAudioClassification:()=>h.AutoModelForAudioClassification,AutoModelForAudioFrameClassification:()=>h.AutoModelForAudioFrameClassification,AutoModelForCTC:()=>h.AutoModelForCTC,AutoModelForCausalLM:()=>h.AutoModelForCausalLM,AutoModelForDepthEstimation:()=>h.AutoModelForDepthEstimation,AutoModelForDocumentQuestionAnswering:()=>h.AutoModelForDocumentQuestionAnswering,AutoModelForImageClassification:()=>h.AutoModelForImageClassification,AutoModelForImageFeatureExtraction:()=>h.AutoModelForImageFeatureExtraction,AutoModelForImageMatting:()=>h.AutoModelForImageMatting,AutoModelForImageSegmentation:()=>h.AutoModelForImageSegmentation,AutoModelForImageToImage:()=>h.AutoModelForImageToImage,AutoModelForMaskGeneration:()=>h.AutoModelForMaskGeneration,AutoModelForMaskedLM:()=>h.AutoModelForMaskedLM,AutoModelForNormalEstimation:()=>h.AutoModelForNormalEstimation,AutoModelForObjectDetection:()=>h.AutoModelForObjectDetection,AutoModelForQuestionAnswering:()=>h.AutoModelForQuestionAnswering,AutoModelForSemanticSegmentation:()=>h.AutoModelForSemanticSegmentation,AutoModelForSeq2SeqLM:()=>h.AutoModelForSeq2SeqLM,AutoModelForSequenceClassification:()=>h.AutoModelForSequenceClassification,AutoModelForSpeechSeq2Seq:()=>h.AutoModelForSpeechSeq2Seq,AutoModelForTextToSpectrogram:()=>h.AutoModelForTextToSpectrogram,AutoModelForTextToWaveform:()=>h.AutoModelForTextToWaveform,AutoModelForTokenClassification:()=>h.AutoModelForTokenClassification,AutoModelForUniversalSegmentation:()=>h.AutoModelForUniversalSegmentation,AutoModelForVision2Seq:()=>h.AutoModelForVision2Seq,AutoModelForXVector:()=>h.AutoModelForXVector,AutoModelForZeroShotObjectDetection:()=>h.AutoModelForZeroShotObjectDetection,AutoProcessor:()=>_.AutoProcessor,AutoTokenizer:()=>m.AutoTokenizer,AutomaticSpeechRecognitionPipeline:()=>p.AutomaticSpeechRecognitionPipeline,BartForConditionalGeneration:()=>h.BartForConditionalGeneration,BartForSequenceClassification:()=>h.BartForSequenceClassification,BartModel:()=>h.BartModel,BartPretrainedModel:()=>h.BartPretrainedModel,BartTokenizer:()=>m.BartTokenizer,BaseModelOutput:()=>h.BaseModelOutput,BaseStreamer:()=>b.BaseStreamer,BeitFeatureExtractor:()=>_.BeitFeatureExtractor,BeitForImageClassification:()=>h.BeitForImageClassification,BeitModel:()=>h.BeitModel,BeitPreTrainedModel:()=>h.BeitPreTrainedModel,BertForMaskedLM:()=>h.BertForMaskedLM,BertForQuestionAnswering:()=>h.BertForQuestionAnswering,BertForSequenceClassification:()=>h.BertForSequenceClassification,BertForTokenClassification:()=>h.BertForTokenClassification,BertModel:()=>h.BertModel,BertPreTrainedModel:()=>h.BertPreTrainedModel,BertTokenizer:()=>m.BertTokenizer,BitImageProcessor:()=>_.BitImageProcessor,BlenderbotForConditionalGeneration:()=>h.BlenderbotForConditionalGeneration,BlenderbotModel:()=>h.BlenderbotModel,BlenderbotPreTrainedModel:()=>h.BlenderbotPreTrainedModel,BlenderbotSmallForConditionalGeneration:()=>h.BlenderbotSmallForConditionalGeneration,BlenderbotSmallModel:()=>h.BlenderbotSmallModel,BlenderbotSmallPreTrainedModel:()=>h.BlenderbotSmallPreTrainedModel,BlenderbotSmallTokenizer:()=>m.BlenderbotSmallTokenizer,BlenderbotTokenizer:()=>m.BlenderbotTokenizer,BloomForCausalLM:()=>h.BloomForCausalLM,BloomModel:()=>h.BloomModel,BloomPreTrainedModel:()=>h.BloomPreTrainedModel,BloomTokenizer:()=>m.BloomTokenizer,CLIPFeatureExtractor:()=>_.CLIPFeatureExtractor,CLIPImageProcessor:()=>_.CLIPImageProcessor,CLIPModel:()=>h.CLIPModel,CLIPPreTrainedModel:()=>h.CLIPPreTrainedModel,CLIPSegForImageSegmentation:()=>h.CLIPSegForImageSegmentation,CLIPSegModel:()=>h.CLIPSegModel,CLIPSegPreTrainedModel:()=>h.CLIPSegPreTrainedModel,CLIPTextModel:()=>h.CLIPTextModel,CLIPTextModelWithProjection:()=>h.CLIPTextModelWithProjection,CLIPTokenizer:()=>m.CLIPTokenizer,CLIPVisionModel:()=>h.CLIPVisionModel,CLIPVisionModelWithProjection:()=>h.CLIPVisionModelWithProjection,CamembertForMaskedLM:()=>h.CamembertForMaskedLM,CamembertForQuestionAnswering:()=>h.CamembertForQuestionAnswering,CamembertForSequenceClassification:()=>h.CamembertForSequenceClassification,CamembertForTokenClassification:()=>h.CamembertForTokenClassification,CamembertModel:()=>h.CamembertModel,CamembertPreTrainedModel:()=>h.CamembertPreTrainedModel,CamembertTokenizer:()=>m.CamembertTokenizer,CausalLMOutput:()=>h.CausalLMOutput,CausalLMOutputWithPast:()=>h.CausalLMOutputWithPast,ChineseCLIPFeatureExtractor:()=>_.ChineseCLIPFeatureExtractor,ChineseCLIPModel:()=>h.ChineseCLIPModel,ChineseCLIPPreTrainedModel:()=>h.ChineseCLIPPreTrainedModel,ClapAudioModelWithProjection:()=>h.ClapAudioModelWithProjection,ClapFeatureExtractor:()=>_.ClapFeatureExtractor,ClapModel:()=>h.ClapModel,ClapPreTrainedModel:()=>h.ClapPreTrainedModel,ClapTextModelWithProjection:()=>h.ClapTextModelWithProjection,CodeGenForCausalLM:()=>h.CodeGenForCausalLM,CodeGenModel:()=>h.CodeGenModel,CodeGenPreTrainedModel:()=>h.CodeGenPreTrainedModel,CodeGenTokenizer:()=>m.CodeGenTokenizer,CodeLlamaTokenizer:()=>m.CodeLlamaTokenizer,CohereForCausalLM:()=>h.CohereForCausalLM,CohereModel:()=>h.CohereModel,CoherePreTrainedModel:()=>h.CoherePreTrainedModel,CohereTokenizer:()=>m.CohereTokenizer,ConvBertForMaskedLM:()=>h.ConvBertForMaskedLM,ConvBertForQuestionAnswering:()=>h.ConvBertForQuestionAnswering,ConvBertForSequenceClassification:()=>h.ConvBertForSequenceClassification,ConvBertForTokenClassification:()=>h.ConvBertForTokenClassification,ConvBertModel:()=>h.ConvBertModel,ConvBertPreTrainedModel:()=>h.ConvBertPreTrainedModel,ConvBertTokenizer:()=>m.ConvBertTokenizer,ConvNextFeatureExtractor:()=>_.ConvNextFeatureExtractor,ConvNextForImageClassification:()=>h.ConvNextForImageClassification,ConvNextImageProcessor:()=>_.ConvNextImageProcessor,ConvNextModel:()=>h.ConvNextModel,ConvNextPreTrainedModel:()=>h.ConvNextPreTrainedModel,ConvNextV2ForImageClassification:()=>h.ConvNextV2ForImageClassification,ConvNextV2Model:()=>h.ConvNextV2Model,ConvNextV2PreTrainedModel:()=>h.ConvNextV2PreTrainedModel,DPTFeatureExtractor:()=>_.DPTFeatureExtractor,DPTForDepthEstimation:()=>h.DPTForDepthEstimation,DPTImageProcessor:()=>_.DPTImageProcessor,DPTModel:()=>h.DPTModel,DPTPreTrainedModel:()=>h.DPTPreTrainedModel,DebertaForMaskedLM:()=>h.DebertaForMaskedLM,DebertaForQuestionAnswering:()=>h.DebertaForQuestionAnswering,DebertaForSequenceClassification:()=>h.DebertaForSequenceClassification,DebertaForTokenClassification:()=>h.DebertaForTokenClassification,DebertaModel:()=>h.DebertaModel,DebertaPreTrainedModel:()=>h.DebertaPreTrainedModel,DebertaTokenizer:()=>m.DebertaTokenizer,DebertaV2ForMaskedLM:()=>h.DebertaV2ForMaskedLM,DebertaV2ForQuestionAnswering:()=>h.DebertaV2ForQuestionAnswering,DebertaV2ForSequenceClassification:()=>h.DebertaV2ForSequenceClassification,DebertaV2ForTokenClassification:()=>h.DebertaV2ForTokenClassification,DebertaV2Model:()=>h.DebertaV2Model,DebertaV2PreTrainedModel:()=>h.DebertaV2PreTrainedModel,DebertaV2Tokenizer:()=>m.DebertaV2Tokenizer,DecisionTransformerModel:()=>h.DecisionTransformerModel,DecisionTransformerPreTrainedModel:()=>h.DecisionTransformerPreTrainedModel,DeiTFeatureExtractor:()=>_.DeiTFeatureExtractor,DeiTForImageClassification:()=>h.DeiTForImageClassification,DeiTModel:()=>h.DeiTModel,DeiTPreTrainedModel:()=>h.DeiTPreTrainedModel,DepthAnythingForDepthEstimation:()=>h.DepthAnythingForDepthEstimation,DepthAnythingPreTrainedModel:()=>h.DepthAnythingPreTrainedModel,DepthEstimationPipeline:()=>p.DepthEstimationPipeline,DepthProForDepthEstimation:()=>h.DepthProForDepthEstimation,DepthProPreTrainedModel:()=>h.DepthProPreTrainedModel,DetrFeatureExtractor:()=>_.DetrFeatureExtractor,DetrForObjectDetection:()=>h.DetrForObjectDetection,DetrForSegmentation:()=>h.DetrForSegmentation,DetrModel:()=>h.DetrModel,DetrObjectDetectionOutput:()=>h.DetrObjectDetectionOutput,DetrPreTrainedModel:()=>h.DetrPreTrainedModel,DetrSegmentationOutput:()=>h.DetrSegmentationOutput,Dinov2ForImageClassification:()=>h.Dinov2ForImageClassification,Dinov2Model:()=>h.Dinov2Model,Dinov2PreTrainedModel:()=>h.Dinov2PreTrainedModel,DistilBertForMaskedLM:()=>h.DistilBertForMaskedLM,DistilBertForQuestionAnswering:()=>h.DistilBertForQuestionAnswering,DistilBertForSequenceClassification:()=>h.DistilBertForSequenceClassification,DistilBertForTokenClassification:()=>h.DistilBertForTokenClassification,DistilBertModel:()=>h.DistilBertModel,DistilBertPreTrainedModel:()=>h.DistilBertPreTrainedModel,DistilBertTokenizer:()=>m.DistilBertTokenizer,DocumentQuestionAnsweringPipeline:()=>p.DocumentQuestionAnsweringPipeline,DonutFeatureExtractor:()=>_.DonutFeatureExtractor,DonutImageProcessor:()=>_.DonutImageProcessor,DonutSwinModel:()=>h.DonutSwinModel,DonutSwinPreTrainedModel:()=>h.DonutSwinPreTrainedModel,EfficientNetForImageClassification:()=>h.EfficientNetForImageClassification,EfficientNetImageProcessor:()=>_.EfficientNetImageProcessor,EfficientNetModel:()=>h.EfficientNetModel,EfficientNetPreTrainedModel:()=>h.EfficientNetPreTrainedModel,ElectraForMaskedLM:()=>h.ElectraForMaskedLM,ElectraForQuestionAnswering:()=>h.ElectraForQuestionAnswering,ElectraForSequenceClassification:()=>h.ElectraForSequenceClassification,ElectraForTokenClassification:()=>h.ElectraForTokenClassification,ElectraModel:()=>h.ElectraModel,ElectraPreTrainedModel:()=>h.ElectraPreTrainedModel,ElectraTokenizer:()=>m.ElectraTokenizer,EosTokenCriteria:()=>x.EosTokenCriteria,EsmForMaskedLM:()=>h.EsmForMaskedLM,EsmForSequenceClassification:()=>h.EsmForSequenceClassification,EsmForTokenClassification:()=>h.EsmForTokenClassification,EsmModel:()=>h.EsmModel,EsmPreTrainedModel:()=>h.EsmPreTrainedModel,EsmTokenizer:()=>m.EsmTokenizer,FFT:()=>T.FFT,FalconForCausalLM:()=>h.FalconForCausalLM,FalconModel:()=>h.FalconModel,FalconPreTrainedModel:()=>h.FalconPreTrainedModel,FalconTokenizer:()=>m.FalconTokenizer,FastViTForImageClassification:()=>h.FastViTForImageClassification,FastViTModel:()=>h.FastViTModel,FastViTPreTrainedModel:()=>h.FastViTPreTrainedModel,FeatureExtractionPipeline:()=>p.FeatureExtractionPipeline,FeatureExtractor:()=>_.FeatureExtractor,FillMaskPipeline:()=>p.FillMaskPipeline,Florence2ForConditionalGeneration:()=>h.Florence2ForConditionalGeneration,Florence2PreTrainedModel:()=>h.Florence2PreTrainedModel,Florence2Processor:()=>_.Florence2Processor,GLPNFeatureExtractor:()=>_.GLPNFeatureExtractor,GLPNForDepthEstimation:()=>h.GLPNForDepthEstimation,GLPNModel:()=>h.GLPNModel,GLPNPreTrainedModel:()=>h.GLPNPreTrainedModel,GPT2LMHeadModel:()=>h.GPT2LMHeadModel,GPT2Model:()=>h.GPT2Model,GPT2PreTrainedModel:()=>h.GPT2PreTrainedModel,GPT2Tokenizer:()=>m.GPT2Tokenizer,GPTBigCodeForCausalLM:()=>h.GPTBigCodeForCausalLM,GPTBigCodeModel:()=>h.GPTBigCodeModel,GPTBigCodePreTrainedModel:()=>h.GPTBigCodePreTrainedModel,GPTJForCausalLM:()=>h.GPTJForCausalLM,GPTJModel:()=>h.GPTJModel,GPTJPreTrainedModel:()=>h.GPTJPreTrainedModel,GPTNeoForCausalLM:()=>h.GPTNeoForCausalLM,GPTNeoModel:()=>h.GPTNeoModel,GPTNeoPreTrainedModel:()=>h.GPTNeoPreTrainedModel,GPTNeoXForCausalLM:()=>h.GPTNeoXForCausalLM,GPTNeoXModel:()=>h.GPTNeoXModel,GPTNeoXPreTrainedModel:()=>h.GPTNeoXPreTrainedModel,GPTNeoXTokenizer:()=>m.GPTNeoXTokenizer,Gemma2ForCausalLM:()=>h.Gemma2ForCausalLM,Gemma2Model:()=>h.Gemma2Model,Gemma2PreTrainedModel:()=>h.Gemma2PreTrainedModel,GemmaForCausalLM:()=>h.GemmaForCausalLM,GemmaModel:()=>h.GemmaModel,GemmaPreTrainedModel:()=>h.GemmaPreTrainedModel,GemmaTokenizer:()=>m.GemmaTokenizer,GraniteForCausalLM:()=>h.GraniteForCausalLM,GraniteModel:()=>h.GraniteModel,GranitePreTrainedModel:()=>h.GranitePreTrainedModel,Grok1Tokenizer:()=>m.Grok1Tokenizer,GroupViTModel:()=>h.GroupViTModel,GroupViTPreTrainedModel:()=>h.GroupViTPreTrainedModel,HerbertTokenizer:()=>m.HerbertTokenizer,HieraForImageClassification:()=>h.HieraForImageClassification,HieraModel:()=>h.HieraModel,HieraPreTrainedModel:()=>h.HieraPreTrainedModel,HubertForCTC:()=>h.HubertForCTC,HubertForSequenceClassification:()=>h.HubertForSequenceClassification,HubertModel:()=>h.HubertModel,HubertPreTrainedModel:()=>h.HubertPreTrainedModel,ImageClassificationPipeline:()=>p.ImageClassificationPipeline,ImageFeatureExtractionPipeline:()=>p.ImageFeatureExtractionPipeline,ImageFeatureExtractor:()=>_.ImageFeatureExtractor,ImageMattingOutput:()=>h.ImageMattingOutput,ImageSegmentationPipeline:()=>p.ImageSegmentationPipeline,ImageToImagePipeline:()=>p.ImageToImagePipeline,ImageToTextPipeline:()=>p.ImageToTextPipeline,InterruptableStoppingCriteria:()=>x.InterruptableStoppingCriteria,JAISLMHeadModel:()=>h.JAISLMHeadModel,JAISModel:()=>h.JAISModel,JAISPreTrainedModel:()=>h.JAISPreTrainedModel,LlamaForCausalLM:()=>h.LlamaForCausalLM,LlamaModel:()=>h.LlamaModel,LlamaPreTrainedModel:()=>h.LlamaPreTrainedModel,LlamaTokenizer:()=>m.LlamaTokenizer,LlavaForConditionalGeneration:()=>h.LlavaForConditionalGeneration,LlavaPreTrainedModel:()=>h.LlavaPreTrainedModel,LongT5ForConditionalGeneration:()=>h.LongT5ForConditionalGeneration,LongT5Model:()=>h.LongT5Model,LongT5PreTrainedModel:()=>h.LongT5PreTrainedModel,M2M100ForConditionalGeneration:()=>h.M2M100ForConditionalGeneration,M2M100Model:()=>h.M2M100Model,M2M100PreTrainedModel:()=>h.M2M100PreTrainedModel,M2M100Tokenizer:()=>m.M2M100Tokenizer,MBart50Tokenizer:()=>m.MBart50Tokenizer,MBartForCausalLM:()=>h.MBartForCausalLM,MBartForConditionalGeneration:()=>h.MBartForConditionalGeneration,MBartForSequenceClassification:()=>h.MBartForSequenceClassification,MBartModel:()=>h.MBartModel,MBartPreTrainedModel:()=>h.MBartPreTrainedModel,MBartTokenizer:()=>m.MBartTokenizer,MPNetForMaskedLM:()=>h.MPNetForMaskedLM,MPNetForQuestionAnswering:()=>h.MPNetForQuestionAnswering,MPNetForSequenceClassification:()=>h.MPNetForSequenceClassification,MPNetForTokenClassification:()=>h.MPNetForTokenClassification,MPNetModel:()=>h.MPNetModel,MPNetPreTrainedModel:()=>h.MPNetPreTrainedModel,MPNetTokenizer:()=>m.MPNetTokenizer,MT5ForConditionalGeneration:()=>h.MT5ForConditionalGeneration,MT5Model:()=>h.MT5Model,MT5PreTrainedModel:()=>h.MT5PreTrainedModel,MarianMTModel:()=>h.MarianMTModel,MarianModel:()=>h.MarianModel,MarianPreTrainedModel:()=>h.MarianPreTrainedModel,MarianTokenizer:()=>m.MarianTokenizer,MaskFormerFeatureExtractor:()=>_.MaskFormerFeatureExtractor,MaskFormerForInstanceSegmentation:()=>h.MaskFormerForInstanceSegmentation,MaskFormerModel:()=>h.MaskFormerModel,MaskFormerPreTrainedModel:()=>h.MaskFormerPreTrainedModel,MaskedLMOutput:()=>h.MaskedLMOutput,MaxLengthCriteria:()=>x.MaxLengthCriteria,MistralForCausalLM:()=>h.MistralForCausalLM,MistralModel:()=>h.MistralModel,MistralPreTrainedModel:()=>h.MistralPreTrainedModel,MobileBertForMaskedLM:()=>h.MobileBertForMaskedLM,MobileBertForQuestionAnswering:()=>h.MobileBertForQuestionAnswering,MobileBertForSequenceClassification:()=>h.MobileBertForSequenceClassification,MobileBertModel:()=>h.MobileBertModel,MobileBertPreTrainedModel:()=>h.MobileBertPreTrainedModel,MobileBertTokenizer:()=>m.MobileBertTokenizer,MobileNetV1FeatureExtractor:()=>_.MobileNetV1FeatureExtractor,MobileNetV1ForImageClassification:()=>h.MobileNetV1ForImageClassification,MobileNetV1Model:()=>h.MobileNetV1Model,MobileNetV1PreTrainedModel:()=>h.MobileNetV1PreTrainedModel,MobileNetV2FeatureExtractor:()=>_.MobileNetV2FeatureExtractor,MobileNetV2ForImageClassification:()=>h.MobileNetV2ForImageClassification,MobileNetV2Model:()=>h.MobileNetV2Model,MobileNetV2PreTrainedModel:()=>h.MobileNetV2PreTrainedModel,MobileNetV3FeatureExtractor:()=>_.MobileNetV3FeatureExtractor,MobileNetV3ForImageClassification:()=>h.MobileNetV3ForImageClassification,MobileNetV3Model:()=>h.MobileNetV3Model,MobileNetV3PreTrainedModel:()=>h.MobileNetV3PreTrainedModel,MobileNetV4FeatureExtractor:()=>_.MobileNetV4FeatureExtractor,MobileNetV4ForImageClassification:()=>h.MobileNetV4ForImageClassification,MobileNetV4Model:()=>h.MobileNetV4Model,MobileNetV4PreTrainedModel:()=>h.MobileNetV4PreTrainedModel,MobileViTFeatureExtractor:()=>_.MobileViTFeatureExtractor,MobileViTForImageClassification:()=>h.MobileViTForImageClassification,MobileViTImageProcessor:()=>_.MobileViTImageProcessor,MobileViTModel:()=>h.MobileViTModel,MobileViTPreTrainedModel:()=>h.MobileViTPreTrainedModel,MobileViTV2ForImageClassification:()=>h.MobileViTV2ForImageClassification,MobileViTV2Model:()=>h.MobileViTV2Model,MobileViTV2PreTrainedModel:()=>h.MobileViTV2PreTrainedModel,ModelOutput:()=>h.ModelOutput,Moondream1ForConditionalGeneration:()=>h.Moondream1ForConditionalGeneration,MptForCausalLM:()=>h.MptForCausalLM,MptModel:()=>h.MptModel,MptPreTrainedModel:()=>h.MptPreTrainedModel,MusicgenForCausalLM:()=>h.MusicgenForCausalLM,MusicgenForConditionalGeneration:()=>h.MusicgenForConditionalGeneration,MusicgenModel:()=>h.MusicgenModel,MusicgenPreTrainedModel:()=>h.MusicgenPreTrainedModel,NllbTokenizer:()=>m.NllbTokenizer,NomicBertModel:()=>h.NomicBertModel,NomicBertPreTrainedModel:()=>h.NomicBertPreTrainedModel,NougatImageProcessor:()=>_.NougatImageProcessor,NougatTokenizer:()=>m.NougatTokenizer,OPTForCausalLM:()=>h.OPTForCausalLM,OPTModel:()=>h.OPTModel,OPTPreTrainedModel:()=>h.OPTPreTrainedModel,ObjectDetectionPipeline:()=>p.ObjectDetectionPipeline,OpenELMForCausalLM:()=>h.OpenELMForCausalLM,OpenELMModel:()=>h.OpenELMModel,OpenELMPreTrainedModel:()=>h.OpenELMPreTrainedModel,OwlViTFeatureExtractor:()=>_.OwlViTFeatureExtractor,OwlViTForObjectDetection:()=>h.OwlViTForObjectDetection,OwlViTModel:()=>h.OwlViTModel,OwlViTPreTrainedModel:()=>h.OwlViTPreTrainedModel,OwlViTProcessor:()=>_.OwlViTProcessor,Owlv2ForObjectDetection:()=>h.Owlv2ForObjectDetection,Owlv2ImageProcessor:()=>_.Owlv2ImageProcessor,Owlv2Model:()=>h.Owlv2Model,Owlv2PreTrainedModel:()=>h.Owlv2PreTrainedModel,Phi3ForCausalLM:()=>h.Phi3ForCausalLM,Phi3Model:()=>h.Phi3Model,Phi3PreTrainedModel:()=>h.Phi3PreTrainedModel,PhiForCausalLM:()=>h.PhiForCausalLM,PhiModel:()=>h.PhiModel,PhiPreTrainedModel:()=>h.PhiPreTrainedModel,Pipeline:()=>p.Pipeline,PreTrainedModel:()=>h.PreTrainedModel,PreTrainedTokenizer:()=>m.PreTrainedTokenizer,PretrainedConfig:()=>f.PretrainedConfig,PretrainedMixin:()=>h.PretrainedMixin,Processor:()=>_.Processor,PvtForImageClassification:()=>h.PvtForImageClassification,PvtImageProcessor:()=>_.PvtImageProcessor,PvtModel:()=>h.PvtModel,PvtPreTrainedModel:()=>h.PvtPreTrainedModel,PyAnnoteFeatureExtractor:()=>_.PyAnnoteFeatureExtractor,PyAnnoteForAudioFrameClassification:()=>h.PyAnnoteForAudioFrameClassification,PyAnnoteModel:()=>h.PyAnnoteModel,PyAnnotePreTrainedModel:()=>h.PyAnnotePreTrainedModel,PyAnnoteProcessor:()=>_.PyAnnoteProcessor,QuestionAnsweringModelOutput:()=>h.QuestionAnsweringModelOutput,QuestionAnsweringPipeline:()=>p.QuestionAnsweringPipeline,Qwen2ForCausalLM:()=>h.Qwen2ForCausalLM,Qwen2Model:()=>h.Qwen2Model,Qwen2PreTrainedModel:()=>h.Qwen2PreTrainedModel,Qwen2Tokenizer:()=>m.Qwen2Tokenizer,RTDetrForObjectDetection:()=>h.RTDetrForObjectDetection,RTDetrImageProcessor:()=>_.RTDetrImageProcessor,RTDetrModel:()=>h.RTDetrModel,RTDetrObjectDetectionOutput:()=>h.RTDetrObjectDetectionOutput,RTDetrPreTrainedModel:()=>h.RTDetrPreTrainedModel,RawImage:()=>M.RawImage,ResNetForImageClassification:()=>h.ResNetForImageClassification,ResNetModel:()=>h.ResNetModel,ResNetPreTrainedModel:()=>h.ResNetPreTrainedModel,RoFormerForMaskedLM:()=>h.RoFormerForMaskedLM,RoFormerForQuestionAnswering:()=>h.RoFormerForQuestionAnswering,RoFormerForSequenceClassification:()=>h.RoFormerForSequenceClassification,RoFormerForTokenClassification:()=>h.RoFormerForTokenClassification,RoFormerModel:()=>h.RoFormerModel,RoFormerPreTrainedModel:()=>h.RoFormerPreTrainedModel,RoFormerTokenizer:()=>m.RoFormerTokenizer,RobertaForMaskedLM:()=>h.RobertaForMaskedLM,RobertaForQuestionAnswering:()=>h.RobertaForQuestionAnswering,RobertaForSequenceClassification:()=>h.RobertaForSequenceClassification,RobertaForTokenClassification:()=>h.RobertaForTokenClassification,RobertaModel:()=>h.RobertaModel,RobertaPreTrainedModel:()=>h.RobertaPreTrainedModel,RobertaTokenizer:()=>m.RobertaTokenizer,SamImageProcessor:()=>_.SamImageProcessor,SamImageSegmentationOutput:()=>h.SamImageSegmentationOutput,SamModel:()=>h.SamModel,SamPreTrainedModel:()=>h.SamPreTrainedModel,SamProcessor:()=>_.SamProcessor,SapiensFeatureExtractor:()=>_.SapiensFeatureExtractor,SapiensForDepthEstimation:()=>h.SapiensForDepthEstimation,SapiensForNormalEstimation:()=>h.SapiensForNormalEstimation,SapiensForSemanticSegmentation:()=>h.SapiensForSemanticSegmentation,SapiensPreTrainedModel:()=>h.SapiensPreTrainedModel,SeamlessM4TFeatureExtractor:()=>_.SeamlessM4TFeatureExtractor,SegformerFeatureExtractor:()=>_.SegformerFeatureExtractor,SegformerForImageClassification:()=>h.SegformerForImageClassification,SegformerForSemanticSegmentation:()=>h.SegformerForSemanticSegmentation,SegformerModel:()=>h.SegformerModel,SegformerPreTrainedModel:()=>h.SegformerPreTrainedModel,Seq2SeqLMOutput:()=>h.Seq2SeqLMOutput,SequenceClassifierOutput:()=>h.SequenceClassifierOutput,SiglipImageProcessor:()=>_.SiglipImageProcessor,SiglipModel:()=>h.SiglipModel,SiglipPreTrainedModel:()=>h.SiglipPreTrainedModel,SiglipTextModel:()=>h.SiglipTextModel,SiglipTokenizer:()=>m.SiglipTokenizer,SiglipVisionModel:()=>h.SiglipVisionModel,SpeechT5FeatureExtractor:()=>_.SpeechT5FeatureExtractor,SpeechT5ForSpeechToText:()=>h.SpeechT5ForSpeechToText,SpeechT5ForTextToSpeech:()=>h.SpeechT5ForTextToSpeech,SpeechT5HifiGan:()=>h.SpeechT5HifiGan,SpeechT5Model:()=>h.SpeechT5Model,SpeechT5PreTrainedModel:()=>h.SpeechT5PreTrainedModel,SpeechT5Processor:()=>_.SpeechT5Processor,SpeechT5Tokenizer:()=>m.SpeechT5Tokenizer,SqueezeBertForMaskedLM:()=>h.SqueezeBertForMaskedLM,SqueezeBertForQuestionAnswering:()=>h.SqueezeBertForQuestionAnswering,SqueezeBertForSequenceClassification:()=>h.SqueezeBertForSequenceClassification,SqueezeBertModel:()=>h.SqueezeBertModel,SqueezeBertPreTrainedModel:()=>h.SqueezeBertPreTrainedModel,SqueezeBertTokenizer:()=>m.SqueezeBertTokenizer,StableLmForCausalLM:()=>h.StableLmForCausalLM,StableLmModel:()=>h.StableLmModel,StableLmPreTrainedModel:()=>h.StableLmPreTrainedModel,Starcoder2ForCausalLM:()=>h.Starcoder2ForCausalLM,Starcoder2Model:()=>h.Starcoder2Model,Starcoder2PreTrainedModel:()=>h.Starcoder2PreTrainedModel,StoppingCriteria:()=>x.StoppingCriteria,StoppingCriteriaList:()=>x.StoppingCriteriaList,SummarizationPipeline:()=>p.SummarizationPipeline,Swin2SRForImageSuperResolution:()=>h.Swin2SRForImageSuperResolution,Swin2SRImageProcessor:()=>_.Swin2SRImageProcessor,Swin2SRModel:()=>h.Swin2SRModel,Swin2SRPreTrainedModel:()=>h.Swin2SRPreTrainedModel,SwinForImageClassification:()=>h.SwinForImageClassification,SwinModel:()=>h.SwinModel,SwinPreTrainedModel:()=>h.SwinPreTrainedModel,T5ForConditionalGeneration:()=>h.T5ForConditionalGeneration,T5Model:()=>h.T5Model,T5PreTrainedModel:()=>h.T5PreTrainedModel,T5Tokenizer:()=>m.T5Tokenizer,TableTransformerForObjectDetection:()=>h.TableTransformerForObjectDetection,TableTransformerModel:()=>h.TableTransformerModel,TableTransformerObjectDetectionOutput:()=>h.TableTransformerObjectDetectionOutput,TableTransformerPreTrainedModel:()=>h.TableTransformerPreTrainedModel,Tensor:()=>w.Tensor,Text2TextGenerationPipeline:()=>p.Text2TextGenerationPipeline,TextClassificationPipeline:()=>p.TextClassificationPipeline,TextGenerationPipeline:()=>p.TextGenerationPipeline,TextStreamer:()=>b.TextStreamer,TextToAudioPipeline:()=>p.TextToAudioPipeline,TokenClassificationPipeline:()=>p.TokenClassificationPipeline,TokenClassifierOutput:()=>h.TokenClassifierOutput,TokenizerModel:()=>m.TokenizerModel,TrOCRForCausalLM:()=>h.TrOCRForCausalLM,TrOCRPreTrainedModel:()=>h.TrOCRPreTrainedModel,TranslationPipeline:()=>p.TranslationPipeline,UniSpeechForCTC:()=>h.UniSpeechForCTC,UniSpeechForSequenceClassification:()=>h.UniSpeechForSequenceClassification,UniSpeechModel:()=>h.UniSpeechModel,UniSpeechPreTrainedModel:()=>h.UniSpeechPreTrainedModel,UniSpeechSatForAudioFrameClassification:()=>h.UniSpeechSatForAudioFrameClassification,UniSpeechSatForCTC:()=>h.UniSpeechSatForCTC,UniSpeechSatForSequenceClassification:()=>h.UniSpeechSatForSequenceClassification,UniSpeechSatModel:()=>h.UniSpeechSatModel,UniSpeechSatPreTrainedModel:()=>h.UniSpeechSatPreTrainedModel,ViTFeatureExtractor:()=>_.ViTFeatureExtractor,ViTForImageClassification:()=>h.ViTForImageClassification,ViTImageProcessor:()=>_.ViTImageProcessor,ViTMAEModel:()=>h.ViTMAEModel,ViTMAEPreTrainedModel:()=>h.ViTMAEPreTrainedModel,ViTMSNForImageClassification:()=>h.ViTMSNForImageClassification,ViTMSNModel:()=>h.ViTMSNModel,ViTMSNPreTrainedModel:()=>h.ViTMSNPreTrainedModel,ViTModel:()=>h.ViTModel,ViTPreTrainedModel:()=>h.ViTPreTrainedModel,VisionEncoderDecoderModel:()=>h.VisionEncoderDecoderModel,VitMatteForImageMatting:()=>h.VitMatteForImageMatting,VitMatteImageProcessor:()=>_.VitMatteImageProcessor,VitMattePreTrainedModel:()=>h.VitMattePreTrainedModel,VitsModel:()=>h.VitsModel,VitsModelOutput:()=>h.VitsModelOutput,VitsPreTrainedModel:()=>h.VitsPreTrainedModel,VitsTokenizer:()=>m.VitsTokenizer,Wav2Vec2BertForCTC:()=>h.Wav2Vec2BertForCTC,Wav2Vec2BertForSequenceClassification:()=>h.Wav2Vec2BertForSequenceClassification,Wav2Vec2BertModel:()=>h.Wav2Vec2BertModel,Wav2Vec2BertPreTrainedModel:()=>h.Wav2Vec2BertPreTrainedModel,Wav2Vec2CTCTokenizer:()=>m.Wav2Vec2CTCTokenizer,Wav2Vec2FeatureExtractor:()=>_.Wav2Vec2FeatureExtractor,Wav2Vec2ForAudioFrameClassification:()=>h.Wav2Vec2ForAudioFrameClassification,Wav2Vec2ForCTC:()=>h.Wav2Vec2ForCTC,Wav2Vec2ForSequenceClassification:()=>h.Wav2Vec2ForSequenceClassification,Wav2Vec2Model:()=>h.Wav2Vec2Model,Wav2Vec2PreTrainedModel:()=>h.Wav2Vec2PreTrainedModel,Wav2Vec2ProcessorWithLM:()=>_.Wav2Vec2ProcessorWithLM,WavLMForAudioFrameClassification:()=>h.WavLMForAudioFrameClassification,WavLMForCTC:()=>h.WavLMForCTC,WavLMForSequenceClassification:()=>h.WavLMForSequenceClassification,WavLMForXVector:()=>h.WavLMForXVector,WavLMModel:()=>h.WavLMModel,WavLMPreTrainedModel:()=>h.WavLMPreTrainedModel,WeSpeakerFeatureExtractor:()=>_.WeSpeakerFeatureExtractor,WeSpeakerResNetModel:()=>h.WeSpeakerResNetModel,WeSpeakerResNetPreTrainedModel:()=>h.WeSpeakerResNetPreTrainedModel,WhisperFeatureExtractor:()=>_.WhisperFeatureExtractor,WhisperForConditionalGeneration:()=>h.WhisperForConditionalGeneration,WhisperModel:()=>h.WhisperModel,WhisperPreTrainedModel:()=>h.WhisperPreTrainedModel,WhisperProcessor:()=>_.WhisperProcessor,WhisperTextStreamer:()=>b.WhisperTextStreamer,WhisperTokenizer:()=>m.WhisperTokenizer,XLMForQuestionAnswering:()=>h.XLMForQuestionAnswering,XLMForSequenceClassification:()=>h.XLMForSequenceClassification,XLMForTokenClassification:()=>h.XLMForTokenClassification,XLMModel:()=>h.XLMModel,XLMPreTrainedModel:()=>h.XLMPreTrainedModel,XLMRobertaForMaskedLM:()=>h.XLMRobertaForMaskedLM,XLMRobertaForQuestionAnswering:()=>h.XLMRobertaForQuestionAnswering,XLMRobertaForSequenceClassification:()=>h.XLMRobertaForSequenceClassification,XLMRobertaForTokenClassification:()=>h.XLMRobertaForTokenClassification,XLMRobertaModel:()=>h.XLMRobertaModel,XLMRobertaPreTrainedModel:()=>h.XLMRobertaPreTrainedModel,XLMRobertaTokenizer:()=>m.XLMRobertaTokenizer,XLMTokenizer:()=>m.XLMTokenizer,XLMWithLMHeadModel:()=>h.XLMWithLMHeadModel,XVectorOutput:()=>h.XVectorOutput,YolosFeatureExtractor:()=>_.YolosFeatureExtractor,YolosForObjectDetection:()=>h.YolosForObjectDetection,YolosModel:()=>h.YolosModel,YolosObjectDetectionOutput:()=>h.YolosObjectDetectionOutput,YolosPreTrainedModel:()=>h.YolosPreTrainedModel,ZeroShotAudioClassificationPipeline:()=>p.ZeroShotAudioClassificationPipeline,ZeroShotClassificationPipeline:()=>p.ZeroShotClassificationPipeline,ZeroShotImageClassificationPipeline:()=>p.ZeroShotImageClassificationPipeline,ZeroShotObjectDetectionPipeline:()=>p.ZeroShotObjectDetectionPipeline,bankers_round:()=>T.bankers_round,cat:()=>w.cat,cos_sim:()=>T.cos_sim,dot:()=>T.dot,dynamic_time_warping:()=>T.dynamic_time_warping,env:()=>u.env,full:()=>w.full,full_like:()=>w.full_like,getKeyValueShapes:()=>f.getKeyValueShapes,hamming:()=>g.hamming,hanning:()=>g.hanning,interpolate:()=>w.interpolate,interpolate_4d:()=>w.interpolate_4d,interpolate_data:()=>T.interpolate_data,is_chinese_char:()=>m.is_chinese_char,layer_norm:()=>w.layer_norm,log_softmax:()=>T.log_softmax,magnitude:()=>T.magnitude,matmul:()=>w.matmul,max:()=>T.max,mean:()=>w.mean,mean_pooling:()=>w.mean_pooling,medianFilter:()=>T.medianFilter,mel_filter_bank:()=>g.mel_filter_bank,min:()=>T.min,ones:()=>w.ones,ones_like:()=>w.ones_like,permute:()=>w.permute,permute_data:()=>T.permute_data,pipeline:()=>p.pipeline,quantize_embeddings:()=>w.quantize_embeddings,read_audio:()=>g.read_audio,rfft:()=>w.rfft,round:()=>T.round,softmax:()=>T.softmax,spectrogram:()=>g.spectrogram,stack:()=>w.stack,std_mean:()=>w.std_mean,topk:()=>w.topk,window_function:()=>g.window_function,zeros:()=>w.zeros,zeros_like:()=>w.zeros_like});var u=c(/*! ./env.js */"./src/env.js"),p=c(/*! ./pipelines.js */"./src/pipelines.js"),h=c(/*! ./models.js */"./src/models.js"),m=c(/*! ./tokenizers.js */"./src/tokenizers.js"),_=c(/*! ./processors.js */"./src/processors.js"),f=c(/*! ./configs.js */"./src/configs.js"),g=c(/*! ./utils/audio.js */"./src/utils/audio.js"),M=c(/*! ./utils/image.js */"./src/utils/image.js"),w=c(/*! ./utils/tensor.js */"./src/utils/tensor.js"),T=c(/*! ./utils/maths.js */"./src/utils/maths.js"),b=c(/*! ./generation/streamers.js */"./src/generation/streamers.js"),x=c(/*! ./generation/stopping_criteria.js */"./src/generation/stopping_criteria.js"),y=d.ASTFeatureExtractor,k=d.ASTForAudioClassification,F=d.ASTModel,P=d.ASTPreTrainedModel,C=d.AlbertForMaskedLM,v=d.AlbertForQuestionAnswering,S=d.AlbertForSequenceClassification,A=d.AlbertModel,E=d.AlbertPreTrainedModel,L=d.AlbertTokenizer,z=d.AudioClassificationPipeline,I=d.AutoConfig,B=d.AutoModel,N=d.AutoModelForAudioClassification,D=d.AutoModelForAudioFrameClassification,O=d.AutoModelForCTC,V=d.AutoModelForCausalLM,j=d.AutoModelForDepthEstimation,R=d.AutoModelForDocumentQuestionAnswering,G=d.AutoModelForImageClassification,q=d.AutoModelForImageFeatureExtraction,$=d.AutoModelForImageMatting,W=d.AutoModelForImageSegmentation,U=d.AutoModelForImageToImage,X=d.AutoModelForMaskGeneration,Q=d.AutoModelForMaskedLM,H=d.AutoModelForNormalEstimation,Y=d.AutoModelForObjectDetection,J=d.AutoModelForQuestionAnswering,K=d.AutoModelForSemanticSegmentation,Z=d.AutoModelForSeq2SeqLM,ee=d.AutoModelForSequenceClassification,te=d.AutoModelForSpeechSeq2Seq,re=d.AutoModelForTextToSpectrogram,ne=d.AutoModelForTextToWaveform,oe=d.AutoModelForTokenClassification,se=d.AutoModelForUniversalSegmentation,ae=d.AutoModelForVision2Seq,ie=d.AutoModelForXVector,le=d.AutoModelForZeroShotObjectDetection,ce=d.AutoProcessor,de=d.AutoTokenizer,ue=d.AutomaticSpeechRecognitionPipeline,pe=d.BartForConditionalGeneration,he=d.BartForSequenceClassification,me=d.BartModel,_e=d.BartPretrainedModel,fe=d.BartTokenizer,ge=d.BaseModelOutput,Me=d.BaseStreamer,we=d.BeitFeatureExtractor,Te=d.BeitForImageClassification,be=d.BeitModel,xe=d.BeitPreTrainedModel,ye=d.BertForMaskedLM,ke=d.BertForQuestionAnswering,Fe=d.BertForSequenceClassification,Pe=d.BertForTokenClassification,Ce=d.BertModel,ve=d.BertPreTrainedModel,Se=d.BertTokenizer,Ae=d.BitImageProcessor,Ee=d.BlenderbotForConditionalGeneration,Le=d.BlenderbotModel,ze=d.BlenderbotPreTrainedModel,Ie=d.BlenderbotSmallForConditionalGeneration,Be=d.BlenderbotSmallModel,Ne=d.BlenderbotSmallPreTrainedModel,De=d.BlenderbotSmallTokenizer,Oe=d.BlenderbotTokenizer,Ve=d.BloomForCausalLM,je=d.BloomModel,Re=d.BloomPreTrainedModel,Ge=d.BloomTokenizer,qe=d.CLIPFeatureExtractor,$e=d.CLIPImageProcessor,We=d.CLIPModel,Ue=d.CLIPPreTrainedModel,Xe=d.CLIPSegForImageSegmentation,Qe=d.CLIPSegModel,He=d.CLIPSegPreTrainedModel,Ye=d.CLIPTextModel,Je=d.CLIPTextModelWithProjection,Ke=d.CLIPTokenizer,Ze=d.CLIPVisionModel,et=d.CLIPVisionModelWithProjection,tt=d.CamembertForMaskedLM,rt=d.CamembertForQuestionAnswering,nt=d.CamembertForSequenceClassification,ot=d.CamembertForTokenClassification,st=d.CamembertModel,at=d.CamembertPreTrainedModel,it=d.CamembertTokenizer,lt=d.CausalLMOutput,ct=d.CausalLMOutputWithPast,dt=d.ChineseCLIPFeatureExtractor,ut=d.ChineseCLIPModel,pt=d.ChineseCLIPPreTrainedModel,ht=d.ClapAudioModelWithProjection,mt=d.ClapFeatureExtractor,_t=d.ClapModel,ft=d.ClapPreTrainedModel,gt=d.ClapTextModelWithProjection,Mt=d.CodeGenForCausalLM,wt=d.CodeGenModel,Tt=d.CodeGenPreTrainedModel,bt=d.CodeGenTokenizer,xt=d.CodeLlamaTokenizer,yt=d.CohereForCausalLM,kt=d.CohereModel,Ft=d.CoherePreTrainedModel,Pt=d.CohereTokenizer,Ct=d.ConvBertForMaskedLM,vt=d.ConvBertForQuestionAnswering,St=d.ConvBertForSequenceClassification,At=d.ConvBertForTokenClassification,Et=d.ConvBertModel,Lt=d.ConvBertPreTrainedModel,zt=d.ConvBertTokenizer,It=d.ConvNextFeatureExtractor,Bt=d.ConvNextForImageClassification,Nt=d.ConvNextImageProcessor,Dt=d.ConvNextModel,Ot=d.ConvNextPreTrainedModel,Vt=d.ConvNextV2ForImageClassification,jt=d.ConvNextV2Model,Rt=d.ConvNextV2PreTrainedModel,Gt=d.DPTFeatureExtractor,qt=d.DPTForDepthEstimation,$t=d.DPTImageProcessor,Wt=d.DPTModel,Ut=d.DPTPreTrainedModel,Xt=d.DebertaForMaskedLM,Qt=d.DebertaForQuestionAnswering,Ht=d.DebertaForSequenceClassification,Yt=d.DebertaForTokenClassification,Jt=d.DebertaModel,Kt=d.DebertaPreTrainedModel,Zt=d.DebertaTokenizer,er=d.DebertaV2ForMaskedLM,tr=d.DebertaV2ForQuestionAnswering,rr=d.DebertaV2ForSequenceClassification,nr=d.DebertaV2ForTokenClassification,or=d.DebertaV2Model,sr=d.DebertaV2PreTrainedModel,ar=d.DebertaV2Tokenizer,ir=d.DecisionTransformerModel,lr=d.DecisionTransformerPreTrainedModel,cr=d.DeiTFeatureExtractor,dr=d.DeiTForImageClassification,ur=d.DeiTModel,pr=d.DeiTPreTrainedModel,hr=d.DepthAnythingForDepthEstimation,mr=d.DepthAnythingPreTrainedModel,_r=d.DepthEstimationPipeline,fr=d.DepthProForDepthEstimation,gr=d.DepthProPreTrainedModel,Mr=d.DetrFeatureExtractor,wr=d.DetrForObjectDetection,Tr=d.DetrForSegmentation,br=d.DetrModel,xr=d.DetrObjectDetectionOutput,yr=d.DetrPreTrainedModel,kr=d.DetrSegmentationOutput,Fr=d.Dinov2ForImageClassification,Pr=d.Dinov2Model,Cr=d.Dinov2PreTrainedModel,vr=d.DistilBertForMaskedLM,Sr=d.DistilBertForQuestionAnswering,Ar=d.DistilBertForSequenceClassification,Er=d.DistilBertForTokenClassification,Lr=d.DistilBertModel,zr=d.DistilBertPreTrainedModel,Ir=d.DistilBertTokenizer,Br=d.DocumentQuestionAnsweringPipeline,Nr=d.DonutFeatureExtractor,Dr=d.DonutImageProcessor,Or=d.DonutSwinModel,Vr=d.DonutSwinPreTrainedModel,jr=d.EfficientNetForImageClassification,Rr=d.EfficientNetImageProcessor,Gr=d.EfficientNetModel,qr=d.EfficientNetPreTrainedModel,$r=d.ElectraForMaskedLM,Wr=d.ElectraForQuestionAnswering,Ur=d.ElectraForSequenceClassification,Xr=d.ElectraForTokenClassification,Qr=d.ElectraModel,Hr=d.ElectraPreTrainedModel,Yr=d.ElectraTokenizer,Jr=d.EosTokenCriteria,Kr=d.EsmForMaskedLM,Zr=d.EsmForSequenceClassification,en=d.EsmForTokenClassification,tn=d.EsmModel,rn=d.EsmPreTrainedModel,nn=d.EsmTokenizer,on=d.FFT,sn=d.FalconForCausalLM,an=d.FalconModel,ln=d.FalconPreTrainedModel,cn=d.FalconTokenizer,dn=d.FastViTForImageClassification,un=d.FastViTModel,pn=d.FastViTPreTrainedModel,hn=d.FeatureExtractionPipeline,mn=d.FeatureExtractor,_n=d.FillMaskPipeline,fn=d.Florence2ForConditionalGeneration,gn=d.Florence2PreTrainedModel,Mn=d.Florence2Processor,wn=d.GLPNFeatureExtractor,Tn=d.GLPNForDepthEstimation,bn=d.GLPNModel,xn=d.GLPNPreTrainedModel,yn=d.GPT2LMHeadModel,kn=d.GPT2Model,Fn=d.GPT2PreTrainedModel,Pn=d.GPT2Tokenizer,Cn=d.GPTBigCodeForCausalLM,vn=d.GPTBigCodeModel,Sn=d.GPTBigCodePreTrainedModel,An=d.GPTJForCausalLM,En=d.GPTJModel,Ln=d.GPTJPreTrainedModel,zn=d.GPTNeoForCausalLM,In=d.GPTNeoModel,Bn=d.GPTNeoPreTrainedModel,Nn=d.GPTNeoXForCausalLM,Dn=d.GPTNeoXModel,On=d.GPTNeoXPreTrainedModel,Vn=d.GPTNeoXTokenizer,jn=d.Gemma2ForCausalLM,Rn=d.Gemma2Model,Gn=d.Gemma2PreTrainedModel,qn=d.GemmaForCausalLM,$n=d.GemmaModel,Wn=d.GemmaPreTrainedModel,Un=d.GemmaTokenizer,Xn=d.GraniteForCausalLM,Qn=d.GraniteModel,Hn=d.GranitePreTrainedModel,Yn=d.Grok1Tokenizer,Jn=d.GroupViTModel,Kn=d.GroupViTPreTrainedModel,Zn=d.HerbertTokenizer,eo=d.HieraForImageClassification,to=d.HieraModel,ro=d.HieraPreTrainedModel,no=d.HubertForCTC,oo=d.HubertForSequenceClassification,so=d.HubertModel,ao=d.HubertPreTrainedModel,io=d.ImageClassificationPipeline,lo=d.ImageFeatureExtractionPipeline,co=d.ImageFeatureExtractor,uo=d.ImageMattingOutput,po=d.ImageSegmentationPipeline,ho=d.ImageToImagePipeline,mo=d.ImageToTextPipeline,_o=d.InterruptableStoppingCriteria,fo=d.JAISLMHeadModel,go=d.JAISModel,Mo=d.JAISPreTrainedModel,wo=d.LlamaForCausalLM,To=d.LlamaModel,bo=d.LlamaPreTrainedModel,xo=d.LlamaTokenizer,yo=d.LlavaForConditionalGeneration,ko=d.LlavaPreTrainedModel,Fo=d.LongT5ForConditionalGeneration,Po=d.LongT5Model,Co=d.LongT5PreTrainedModel,vo=d.M2M100ForConditionalGeneration,So=d.M2M100Model,Ao=d.M2M100PreTrainedModel,Eo=d.M2M100Tokenizer,Lo=d.MBart50Tokenizer,zo=d.MBartForCausalLM,Io=d.MBartForConditionalGeneration,Bo=d.MBartForSequenceClassification,No=d.MBartModel,Do=d.MBartPreTrainedModel,Oo=d.MBartTokenizer,Vo=d.MPNetForMaskedLM,jo=d.MPNetForQuestionAnswering,Ro=d.MPNetForSequenceClassification,Go=d.MPNetForTokenClassification,qo=d.MPNetModel,$o=d.MPNetPreTrainedModel,Wo=d.MPNetTokenizer,Uo=d.MT5ForConditionalGeneration,Xo=d.MT5Model,Qo=d.MT5PreTrainedModel,Ho=d.MarianMTModel,Yo=d.MarianModel,Jo=d.MarianPreTrainedModel,Ko=d.MarianTokenizer,Zo=d.MaskFormerFeatureExtractor,es=d.MaskFormerForInstanceSegmentation,ts=d.MaskFormerModel,rs=d.MaskFormerPreTrainedModel,ns=d.MaskedLMOutput,os=d.MaxLengthCriteria,ss=d.MistralForCausalLM,as=d.MistralModel,is=d.MistralPreTrainedModel,ls=d.MobileBertForMaskedLM,cs=d.MobileBertForQuestionAnswering,ds=d.MobileBertForSequenceClassification,us=d.MobileBertModel,ps=d.MobileBertPreTrainedModel,hs=d.MobileBertTokenizer,ms=d.MobileNetV1FeatureExtractor,_s=d.MobileNetV1ForImageClassification,fs=d.MobileNetV1Model,gs=d.MobileNetV1PreTrainedModel,Ms=d.MobileNetV2FeatureExtractor,ws=d.MobileNetV2ForImageClassification,Ts=d.MobileNetV2Model,bs=d.MobileNetV2PreTrainedModel,xs=d.MobileNetV3FeatureExtractor,ys=d.MobileNetV3ForImageClassification,ks=d.MobileNetV3Model,Fs=d.MobileNetV3PreTrainedModel,Ps=d.MobileNetV4FeatureExtractor,Cs=d.MobileNetV4ForImageClassification,vs=d.MobileNetV4Model,Ss=d.MobileNetV4PreTrainedModel,As=d.MobileViTFeatureExtractor,Es=d.MobileViTForImageClassification,Ls=d.MobileViTImageProcessor,zs=d.MobileViTModel,Is=d.MobileViTPreTrainedModel,Bs=d.MobileViTV2ForImageClassification,Ns=d.MobileViTV2Model,Ds=d.MobileViTV2PreTrainedModel,Os=d.ModelOutput,Vs=d.Moondream1ForConditionalGeneration,js=d.MptForCausalLM,Rs=d.MptModel,Gs=d.MptPreTrainedModel,qs=d.MusicgenForCausalLM,$s=d.MusicgenForConditionalGeneration,Ws=d.MusicgenModel,Us=d.MusicgenPreTrainedModel,Xs=d.NllbTokenizer,Qs=d.NomicBertModel,Hs=d.NomicBertPreTrainedModel,Ys=d.NougatImageProcessor,Js=d.NougatTokenizer,Ks=d.OPTForCausalLM,Zs=d.OPTModel,ea=d.OPTPreTrainedModel,ta=d.ObjectDetectionPipeline,ra=d.OpenELMForCausalLM,na=d.OpenELMModel,oa=d.OpenELMPreTrainedModel,sa=d.OwlViTFeatureExtractor,aa=d.OwlViTForObjectDetection,ia=d.OwlViTModel,la=d.OwlViTPreTrainedModel,ca=d.OwlViTProcessor,da=d.Owlv2ForObjectDetection,ua=d.Owlv2ImageProcessor,pa=d.Owlv2Model,ha=d.Owlv2PreTrainedModel,ma=d.Phi3ForCausalLM,_a=d.Phi3Model,fa=d.Phi3PreTrainedModel,ga=d.PhiForCausalLM,Ma=d.PhiModel,wa=d.PhiPreTrainedModel,Ta=d.Pipeline,ba=d.PreTrainedModel,xa=d.PreTrainedTokenizer,ya=d.PretrainedConfig,ka=d.PretrainedMixin,Fa=d.Processor,Pa=d.PvtForImageClassification,Ca=d.PvtImageProcessor,va=d.PvtModel,Sa=d.PvtPreTrainedModel,Aa=d.PyAnnoteFeatureExtractor,Ea=d.PyAnnoteForAudioFrameClassification,La=d.PyAnnoteModel,za=d.PyAnnotePreTrainedModel,Ia=d.PyAnnoteProcessor,Ba=d.QuestionAnsweringModelOutput,Na=d.QuestionAnsweringPipeline,Da=d.Qwen2ForCausalLM,Oa=d.Qwen2Model,Va=d.Qwen2PreTrainedModel,ja=d.Qwen2Tokenizer,Ra=d.RTDetrForObjectDetection,Ga=d.RTDetrImageProcessor,qa=d.RTDetrModel,$a=d.RTDetrObjectDetectionOutput,Wa=d.RTDetrPreTrainedModel,Ua=d.RawImage,Xa=d.ResNetForImageClassification,Qa=d.ResNetModel,Ha=d.ResNetPreTrainedModel,Ya=d.RoFormerForMaskedLM,Ja=d.RoFormerForQuestionAnswering,Ka=d.RoFormerForSequenceClassification,Za=d.RoFormerForTokenClassification,ei=d.RoFormerModel,ti=d.RoFormerPreTrainedModel,ri=d.RoFormerTokenizer,ni=d.RobertaForMaskedLM,oi=d.RobertaForQuestionAnswering,si=d.RobertaForSequenceClassification,ai=d.RobertaForTokenClassification,ii=d.RobertaModel,li=d.RobertaPreTrainedModel,ci=d.RobertaTokenizer,di=d.SamImageProcessor,ui=d.SamImageSegmentationOutput,pi=d.SamModel,hi=d.SamPreTrainedModel,mi=d.SamProcessor,_i=d.SapiensFeatureExtractor,fi=d.SapiensForDepthEstimation,gi=d.SapiensForNormalEstimation,Mi=d.SapiensForSemanticSegmentation,wi=d.SapiensPreTrainedModel,Ti=d.SeamlessM4TFeatureExtractor,bi=d.SegformerFeatureExtractor,xi=d.SegformerForImageClassification,yi=d.SegformerForSemanticSegmentation,ki=d.SegformerModel,Fi=d.SegformerPreTrainedModel,Pi=d.Seq2SeqLMOutput,Ci=d.SequenceClassifierOutput,vi=d.SiglipImageProcessor,Si=d.SiglipModel,Ai=d.SiglipPreTrainedModel,Ei=d.SiglipTextModel,Li=d.SiglipTokenizer,zi=d.SiglipVisionModel,Ii=d.SpeechT5FeatureExtractor,Bi=d.SpeechT5ForSpeechToText,Ni=d.SpeechT5ForTextToSpeech,Di=d.SpeechT5HifiGan,Oi=d.SpeechT5Model,Vi=d.SpeechT5PreTrainedModel,ji=d.SpeechT5Processor,Ri=d.SpeechT5Tokenizer,Gi=d.SqueezeBertForMaskedLM,qi=d.SqueezeBertForQuestionAnswering,$i=d.SqueezeBertForSequenceClassification,Wi=d.SqueezeBertModel,Ui=d.SqueezeBertPreTrainedModel,Xi=d.SqueezeBertTokenizer,Qi=d.StableLmForCausalLM,Hi=d.StableLmModel,Yi=d.StableLmPreTrainedModel,Ji=d.Starcoder2ForCausalLM,Ki=d.Starcoder2Model,Zi=d.Starcoder2PreTrainedModel,el=d.StoppingCriteria,tl=d.StoppingCriteriaList,rl=d.SummarizationPipeline,nl=d.Swin2SRForImageSuperResolution,ol=d.Swin2SRImageProcessor,sl=d.Swin2SRModel,al=d.Swin2SRPreTrainedModel,il=d.SwinForImageClassification,ll=d.SwinModel,cl=d.SwinPreTrainedModel,dl=d.T5ForConditionalGeneration,ul=d.T5Model,pl=d.T5PreTrainedModel,hl=d.T5Tokenizer,ml=d.TableTransformerForObjectDetection,_l=d.TableTransformerModel,fl=d.TableTransformerObjectDetectionOutput,gl=d.TableTransformerPreTrainedModel,Ml=d.Tensor,wl=d.Text2TextGenerationPipeline,Tl=d.TextClassificationPipeline,bl=d.TextGenerationPipeline,xl=d.TextStreamer,yl=d.TextToAudioPipeline,kl=d.TokenClassificationPipeline,Fl=d.TokenClassifierOutput,Pl=d.TokenizerModel,Cl=d.TrOCRForCausalLM,vl=d.TrOCRPreTrainedModel,Sl=d.TranslationPipeline,Al=d.UniSpeechForCTC,El=d.UniSpeechForSequenceClassification,Ll=d.UniSpeechModel,zl=d.UniSpeechPreTrainedModel,Il=d.UniSpeechSatForAudioFrameClassification,Bl=d.UniSpeechSatForCTC,Nl=d.UniSpeechSatForSequenceClassification,Dl=d.UniSpeechSatModel,Ol=d.UniSpeechSatPreTrainedModel,Vl=d.ViTFeatureExtractor,jl=d.ViTForImageClassification,Rl=d.ViTImageProcessor,Gl=d.ViTMAEModel,ql=d.ViTMAEPreTrainedModel,$l=d.ViTMSNForImageClassification,Wl=d.ViTMSNModel,Ul=d.ViTMSNPreTrainedModel,Xl=d.ViTModel,Ql=d.ViTPreTrainedModel,Hl=d.VisionEncoderDecoderModel,Yl=d.VitMatteForImageMatting,Jl=d.VitMatteImageProcessor,Kl=d.VitMattePreTrainedModel,Zl=d.VitsModel,ec=d.VitsModelOutput,tc=d.VitsPreTrainedModel,rc=d.VitsTokenizer,nc=d.Wav2Vec2BertForCTC,oc=d.Wav2Vec2BertForSequenceClassification,sc=d.Wav2Vec2BertModel,ac=d.Wav2Vec2BertPreTrainedModel,ic=d.Wav2Vec2CTCTokenizer,lc=d.Wav2Vec2FeatureExtractor,cc=d.Wav2Vec2ForAudioFrameClassification,dc=d.Wav2Vec2ForCTC,uc=d.Wav2Vec2ForSequenceClassification,pc=d.Wav2Vec2Model,hc=d.Wav2Vec2PreTrainedModel,mc=d.Wav2Vec2ProcessorWithLM,_c=d.WavLMForAudioFrameClassification,fc=d.WavLMForCTC,gc=d.WavLMForSequenceClassification,Mc=d.WavLMForXVector,wc=d.WavLMModel,Tc=d.WavLMPreTrainedModel,bc=d.WeSpeakerFeatureExtractor,xc=d.WeSpeakerResNetModel,yc=d.WeSpeakerResNetPreTrainedModel,kc=d.WhisperFeatureExtractor,Fc=d.WhisperForConditionalGeneration,Pc=d.WhisperModel,Cc=d.WhisperPreTrainedModel,vc=d.WhisperProcessor,Sc=d.WhisperTextStreamer,Ac=d.WhisperTokenizer,Ec=d.XLMForQuestionAnswering,Lc=d.XLMForSequenceClassification,zc=d.XLMForTokenClassification,Ic=d.XLMModel,Bc=d.XLMPreTrainedModel,Nc=d.XLMRobertaForMaskedLM,Dc=d.XLMRobertaForQuestionAnswering,Oc=d.XLMRobertaForSequenceClassification,Vc=d.XLMRobertaForTokenClassification,jc=d.XLMRobertaModel,Rc=d.XLMRobertaPreTrainedModel,Gc=d.XLMRobertaTokenizer,qc=d.XLMTokenizer,$c=d.XLMWithLMHeadModel,Wc=d.XVectorOutput,Uc=d.YolosFeatureExtractor,Xc=d.YolosForObjectDetection,Qc=d.YolosModel,Hc=d.YolosObjectDetectionOutput,Yc=d.YolosPreTrainedModel,Jc=d.ZeroShotAudioClassificationPipeline,Kc=d.ZeroShotClassificationPipeline,Zc=d.ZeroShotImageClassificationPipeline,ed=d.ZeroShotObjectDetectionPipeline,td=d.bankers_round,rd=d.cat,nd=d.cos_sim,od=d.dot,sd=d.dynamic_time_warping,ad=d.env,id=d.full,ld=d.full_like,cd=d.getKeyValueShapes,dd=d.hamming,ud=d.hanning,pd=d.interpolate,hd=d.interpolate_4d,md=d.interpolate_data,_d=d.is_chinese_char,fd=d.layer_norm,gd=d.log_softmax,Md=d.magnitude,wd=d.matmul,Td=d.max,bd=d.mean,xd=d.mean_pooling,yd=d.medianFilter,kd=d.mel_filter_bank,Fd=d.min,Pd=d.ones,Cd=d.ones_like,vd=d.permute,Sd=d.permute_data,Ad=d.pipeline,Ed=d.quantize_embeddings,Ld=d.read_audio,zd=d.rfft,Id=d.round,Bd=d.softmax,Nd=d.spectrogram,Dd=d.stack,Od=d.std_mean,Vd=d.topk,jd=d.window_function,Rd=d.zeros,Gd=d.zeros_like;export{y as ASTFeatureExtractor,k as ASTForAudioClassification,F as ASTModel,P as ASTPreTrainedModel,C as AlbertForMaskedLM,v as AlbertForQuestionAnswering,S as AlbertForSequenceClassification,A as AlbertModel,E as AlbertPreTrainedModel,L as AlbertTokenizer,z as AudioClassificationPipeline,I as AutoConfig,B as AutoModel,N as AutoModelForAudioClassification,D as AutoModelForAudioFrameClassification,O as AutoModelForCTC,V as AutoModelForCausalLM,j as AutoModelForDepthEstimation,R as AutoModelForDocumentQuestionAnswering,G as AutoModelForImageClassification,q as AutoModelForImageFeatureExtraction,$ as AutoModelForImageMatting,W as AutoModelForImageSegmentation,U as AutoModelForImageToImage,X as AutoModelForMaskGeneration,Q as AutoModelForMaskedLM,H as AutoModelForNormalEstimation,Y as AutoModelForObjectDetection,J as AutoModelForQuestionAnswering,K as AutoModelForSemanticSegmentation,Z as AutoModelForSeq2SeqLM,ee as AutoModelForSequenceClassification,te as AutoModelForSpeechSeq2Seq,re as AutoModelForTextToSpectrogram,ne as AutoModelForTextToWaveform,oe as AutoModelForTokenClassification,se as AutoModelForUniversalSegmentation,ae as AutoModelForVision2Seq,ie as AutoModelForXVector,le as AutoModelForZeroShotObjectDetection,ce as AutoProcessor,de as AutoTokenizer,ue as AutomaticSpeechRecognitionPipeline,pe as BartForConditionalGeneration,he as BartForSequenceClassification,me as BartModel,_e as BartPretrainedModel,fe as BartTokenizer,ge as BaseModelOutput,Me as BaseStreamer,we as BeitFeatureExtractor,Te as BeitForImageClassification,be as BeitModel,xe as BeitPreTrainedModel,ye as BertForMaskedLM,ke as BertForQuestionAnswering,Fe as BertForSequenceClassification,Pe as BertForTokenClassification,Ce as BertModel,ve as BertPreTrainedModel,Se as BertTokenizer,Ae as BitImageProcessor,Ee as BlenderbotForConditionalGeneration,Le as BlenderbotModel,ze as BlenderbotPreTrainedModel,Ie as BlenderbotSmallForConditionalGeneration,Be as BlenderbotSmallModel,Ne as BlenderbotSmallPreTrainedModel,De as BlenderbotSmallTokenizer,Oe as BlenderbotTokenizer,Ve as BloomForCausalLM,je as BloomModel,Re as BloomPreTrainedModel,Ge as BloomTokenizer,qe as CLIPFeatureExtractor,$e as CLIPImageProcessor,We as CLIPModel,Ue as CLIPPreTrainedModel,Xe as CLIPSegForImageSegmentation,Qe as CLIPSegModel,He as CLIPSegPreTrainedModel,Ye as CLIPTextModel,Je as CLIPTextModelWithProjection,Ke as CLIPTokenizer,Ze as CLIPVisionModel,et as CLIPVisionModelWithProjection,tt as CamembertForMaskedLM,rt as CamembertForQuestionAnswering,nt as CamembertForSequenceClassification,ot as CamembertForTokenClassification,st as CamembertModel,at as CamembertPreTrainedModel,it as CamembertTokenizer,lt as CausalLMOutput,ct as CausalLMOutputWithPast,dt as ChineseCLIPFeatureExtractor,ut as ChineseCLIPModel,pt as ChineseCLIPPreTrainedModel,ht as ClapAudioModelWithProjection,mt as ClapFeatureExtractor,_t as ClapModel,ft as ClapPreTrainedModel,gt as ClapTextModelWithProjection,Mt as CodeGenForCausalLM,wt as CodeGenModel,Tt as CodeGenPreTrainedModel,bt as CodeGenTokenizer,xt as CodeLlamaTokenizer,yt as CohereForCausalLM,kt as CohereModel,Ft as CoherePreTrainedModel,Pt as CohereTokenizer,Ct as ConvBertForMaskedLM,vt as ConvBertForQuestionAnswering,St as ConvBertForSequenceClassification,At as ConvBertForTokenClassification,Et as ConvBertModel,Lt as ConvBertPreTrainedModel,zt as ConvBertTokenizer,It as ConvNextFeatureExtractor,Bt as ConvNextForImageClassification,Nt as ConvNextImageProcessor,Dt as ConvNextModel,Ot as ConvNextPreTrainedModel,Vt as ConvNextV2ForImageClassification,jt as ConvNextV2Model,Rt as ConvNextV2PreTrainedModel,Gt as DPTFeatureExtractor,qt as DPTForDepthEstimation,$t as DPTImageProcessor,Wt as DPTModel,Ut as DPTPreTrainedModel,Xt as DebertaForMaskedLM,Qt as DebertaForQuestionAnswering,Ht as DebertaForSequenceClassification,Yt as DebertaForTokenClassification,Jt as DebertaModel,Kt as DebertaPreTrainedModel,Zt as DebertaTokenizer,er as DebertaV2ForMaskedLM,tr as DebertaV2ForQuestionAnswering,rr as DebertaV2ForSequenceClassification,nr as DebertaV2ForTokenClassification,or as DebertaV2Model,sr as DebertaV2PreTrainedModel,ar as DebertaV2Tokenizer,ir as DecisionTransformerModel,lr as DecisionTransformerPreTrainedModel,cr as DeiTFeatureExtractor,dr as DeiTForImageClassification,ur as DeiTModel,pr as DeiTPreTrainedModel,hr as DepthAnythingForDepthEstimation,mr as DepthAnythingPreTrainedModel,_r as DepthEstimationPipeline,fr as DepthProForDepthEstimation,gr as DepthProPreTrainedModel,Mr as DetrFeatureExtractor,wr as DetrForObjectDetection,Tr as DetrForSegmentation,br as DetrModel,xr as DetrObjectDetectionOutput,yr as DetrPreTrainedModel,kr as DetrSegmentationOutput,Fr as Dinov2ForImageClassification,Pr as Dinov2Model,Cr as Dinov2PreTrainedModel,vr as DistilBertForMaskedLM,Sr as DistilBertForQuestionAnswering,Ar as DistilBertForSequenceClassification,Er as DistilBertForTokenClassification,Lr as DistilBertModel,zr as DistilBertPreTrainedModel,Ir as DistilBertTokenizer,Br as DocumentQuestionAnsweringPipeline,Nr as DonutFeatureExtractor,Dr as DonutImageProcessor,Or as DonutSwinModel,Vr as DonutSwinPreTrainedModel,jr as EfficientNetForImageClassification,Rr as EfficientNetImageProcessor,Gr as EfficientNetModel,qr as EfficientNetPreTrainedModel,$r as ElectraForMaskedLM,Wr as ElectraForQuestionAnswering,Ur as ElectraForSequenceClassification,Xr as ElectraForTokenClassification,Qr as ElectraModel,Hr as ElectraPreTrainedModel,Yr as ElectraTokenizer,Jr as EosTokenCriteria,Kr as EsmForMaskedLM,Zr as EsmForSequenceClassification,en as EsmForTokenClassification,tn as EsmModel,rn as EsmPreTrainedModel,nn as EsmTokenizer,on as FFT,sn as FalconForCausalLM,an as FalconModel,ln as FalconPreTrainedModel,cn as FalconTokenizer,dn as FastViTForImageClassification,un as FastViTModel,pn as FastViTPreTrainedModel,hn as FeatureExtractionPipeline,mn as FeatureExtractor,_n as FillMaskPipeline,fn as Florence2ForConditionalGeneration,gn as Florence2PreTrainedModel,Mn as Florence2Processor,wn as GLPNFeatureExtractor,Tn as GLPNForDepthEstimation,bn as GLPNModel,xn as GLPNPreTrainedModel,yn as GPT2LMHeadModel,kn as GPT2Model,Fn as GPT2PreTrainedModel,Pn as GPT2Tokenizer,Cn as GPTBigCodeForCausalLM,vn as GPTBigCodeModel,Sn as GPTBigCodePreTrainedModel,An as GPTJForCausalLM,En as GPTJModel,Ln as GPTJPreTrainedModel,zn as GPTNeoForCausalLM,In as GPTNeoModel,Bn as GPTNeoPreTrainedModel,Nn as GPTNeoXForCausalLM,Dn as GPTNeoXModel,On as GPTNeoXPreTrainedModel,Vn as GPTNeoXTokenizer,jn as Gemma2ForCausalLM,Rn as Gemma2Model,Gn as Gemma2PreTrainedModel,qn as GemmaForCausalLM,$n as GemmaModel,Wn as GemmaPreTrainedModel,Un as GemmaTokenizer,Xn as GraniteForCausalLM,Qn as GraniteModel,Hn as GranitePreTrainedModel,Yn as Grok1Tokenizer,Jn as GroupViTModel,Kn as GroupViTPreTrainedModel,Zn as HerbertTokenizer,eo as HieraForImageClassification,to as HieraModel,ro as HieraPreTrainedModel,no as HubertForCTC,oo as HubertForSequenceClassification,so as HubertModel,ao as HubertPreTrainedModel,io as ImageClassificationPipeline,lo as ImageFeatureExtractionPipeline,co as ImageFeatureExtractor,uo as ImageMattingOutput,po as ImageSegmentationPipeline,ho as ImageToImagePipeline,mo as ImageToTextPipeline,_o as InterruptableStoppingCriteria,fo as JAISLMHeadModel,go as JAISModel,Mo as JAISPreTrainedModel,wo as LlamaForCausalLM,To as LlamaModel,bo as LlamaPreTrainedModel,xo as LlamaTokenizer,yo as LlavaForConditionalGeneration,ko as LlavaPreTrainedModel,Fo as LongT5ForConditionalGeneration,Po as LongT5Model,Co as LongT5PreTrainedModel,vo as M2M100ForConditionalGeneration,So as M2M100Model,Ao as M2M100PreTrainedModel,Eo as M2M100Tokenizer,Lo as MBart50Tokenizer,zo as MBartForCausalLM,Io as MBartForConditionalGeneration,Bo as MBartForSequenceClassification,No as MBartModel,Do as MBartPreTrainedModel,Oo as MBartTokenizer,Vo as MPNetForMaskedLM,jo as MPNetForQuestionAnswering,Ro as MPNetForSequenceClassification,Go as MPNetForTokenClassification,qo as MPNetModel,$o as MPNetPreTrainedModel,Wo as MPNetTokenizer,Uo as MT5ForConditionalGeneration,Xo as MT5Model,Qo as MT5PreTrainedModel,Ho as MarianMTModel,Yo as MarianModel,Jo as MarianPreTrainedModel,Ko as MarianTokenizer,Zo as MaskFormerFeatureExtractor,es as MaskFormerForInstanceSegmentation,ts as MaskFormerModel,rs as MaskFormerPreTrainedModel,ns as MaskedLMOutput,os as MaxLengthCriteria,ss as MistralForCausalLM,as as MistralModel,is as MistralPreTrainedModel,ls as MobileBertForMaskedLM,cs as MobileBertForQuestionAnswering,ds as MobileBertForSequenceClassification,us as MobileBertModel,ps as MobileBertPreTrainedModel,hs as MobileBertTokenizer,ms as MobileNetV1FeatureExtractor,_s as MobileNetV1ForImageClassification,fs as MobileNetV1Model,gs as MobileNetV1PreTrainedModel,Ms as MobileNetV2FeatureExtractor,ws as MobileNetV2ForImageClassification,Ts as MobileNetV2Model,bs as MobileNetV2PreTrainedModel,xs as MobileNetV3FeatureExtractor,ys as MobileNetV3ForImageClassification,ks as MobileNetV3Model,Fs as MobileNetV3PreTrainedModel,Ps as MobileNetV4FeatureExtractor,Cs as MobileNetV4ForImageClassification,vs as MobileNetV4Model,Ss as MobileNetV4PreTrainedModel,As as MobileViTFeatureExtractor,Es as MobileViTForImageClassification,Ls as MobileViTImageProcessor,zs as MobileViTModel,Is as MobileViTPreTrainedModel,Bs as MobileViTV2ForImageClassification,Ns as MobileViTV2Model,Ds as MobileViTV2PreTrainedModel,Os as ModelOutput,Vs as Moondream1ForConditionalGeneration,js as MptForCausalLM,Rs as MptModel,Gs as MptPreTrainedModel,qs as MusicgenForCausalLM,$s as MusicgenForConditionalGeneration,Ws as MusicgenModel,Us as MusicgenPreTrainedModel,Xs as NllbTokenizer,Qs as NomicBertModel,Hs as NomicBertPreTrainedModel,Ys as NougatImageProcessor,Js as NougatTokenizer,Ks as OPTForCausalLM,Zs as OPTModel,ea as OPTPreTrainedModel,ta as ObjectDetectionPipeline,ra as OpenELMForCausalLM,na as OpenELMModel,oa as OpenELMPreTrainedModel,sa as OwlViTFeatureExtractor,aa as OwlViTForObjectDetection,ia as OwlViTModel,la as OwlViTPreTrainedModel,ca as OwlViTProcessor,da as Owlv2ForObjectDetection,ua as Owlv2ImageProcessor,pa as Owlv2Model,ha as Owlv2PreTrainedModel,ma as Phi3ForCausalLM,_a as Phi3Model,fa as Phi3PreTrainedModel,ga as PhiForCausalLM,Ma as PhiModel,wa as PhiPreTrainedModel,Ta as Pipeline,ba as PreTrainedModel,xa as PreTrainedTokenizer,ya as PretrainedConfig,ka as PretrainedMixin,Fa as Processor,Pa as PvtForImageClassification,Ca as PvtImageProcessor,va as PvtModel,Sa as PvtPreTrainedModel,Aa as PyAnnoteFeatureExtractor,Ea as PyAnnoteForAudioFrameClassification,La as PyAnnoteModel,za as PyAnnotePreTrainedModel,Ia as PyAnnoteProcessor,Ba as QuestionAnsweringModelOutput,Na as QuestionAnsweringPipeline,Da as Qwen2ForCausalLM,Oa as Qwen2Model,Va as Qwen2PreTrainedModel,ja as Qwen2Tokenizer,Ra as RTDetrForObjectDetection,Ga as RTDetrImageProcessor,qa as RTDetrModel,$a as RTDetrObjectDetectionOutput,Wa as RTDetrPreTrainedModel,Ua as RawImage,Xa as ResNetForImageClassification,Qa as ResNetModel,Ha as ResNetPreTrainedModel,Ya as RoFormerForMaskedLM,Ja as RoFormerForQuestionAnswering,Ka as RoFormerForSequenceClassification,Za as RoFormerForTokenClassification,ei as RoFormerModel,ti as RoFormerPreTrainedModel,ri as RoFormerTokenizer,ni as RobertaForMaskedLM,oi as RobertaForQuestionAnswering,si as RobertaForSequenceClassification,ai as RobertaForTokenClassification,ii as RobertaModel,li as RobertaPreTrainedModel,ci as RobertaTokenizer,di as SamImageProcessor,ui as SamImageSegmentationOutput,pi as SamModel,hi as SamPreTrainedModel,mi as SamProcessor,_i as SapiensFeatureExtractor,fi as SapiensForDepthEstimation,gi as SapiensForNormalEstimation,Mi as SapiensForSemanticSegmentation,wi as SapiensPreTrainedModel,Ti as SeamlessM4TFeatureExtractor,bi as SegformerFeatureExtractor,xi as SegformerForImageClassification,yi as SegformerForSemanticSegmentation,ki as SegformerModel,Fi as SegformerPreTrainedModel,Pi as Seq2SeqLMOutput,Ci as SequenceClassifierOutput,vi as SiglipImageProcessor,Si as SiglipModel,Ai as SiglipPreTrainedModel,Ei as SiglipTextModel,Li as SiglipTokenizer,zi as SiglipVisionModel,Ii as SpeechT5FeatureExtractor,Bi as SpeechT5ForSpeechToText,Ni as SpeechT5ForTextToSpeech,Di as SpeechT5HifiGan,Oi as SpeechT5Model,Vi as SpeechT5PreTrainedModel,ji as SpeechT5Processor,Ri as SpeechT5Tokenizer,Gi as SqueezeBertForMaskedLM,qi as SqueezeBertForQuestionAnswering,$i as SqueezeBertForSequenceClassification,Wi as SqueezeBertModel,Ui as SqueezeBertPreTrainedModel,Xi as SqueezeBertTokenizer,Qi as StableLmForCausalLM,Hi as StableLmModel,Yi as StableLmPreTrainedModel,Ji as Starcoder2ForCausalLM,Ki as Starcoder2Model,Zi as Starcoder2PreTrainedModel,el as StoppingCriteria,tl as StoppingCriteriaList,rl as SummarizationPipeline,nl as Swin2SRForImageSuperResolution,ol as Swin2SRImageProcessor,sl as Swin2SRModel,al as Swin2SRPreTrainedModel,il as SwinForImageClassification,ll as SwinModel,cl as SwinPreTrainedModel,dl as T5ForConditionalGeneration,ul as T5Model,pl as T5PreTrainedModel,hl as T5Tokenizer,ml as TableTransformerForObjectDetection,_l as TableTransformerModel,fl as TableTransformerObjectDetectionOutput,gl as TableTransformerPreTrainedModel,Ml as Tensor,wl as Text2TextGenerationPipeline,Tl as TextClassificationPipeline,bl as TextGenerationPipeline,xl as TextStreamer,yl as TextToAudioPipeline,kl as TokenClassificationPipeline,Fl as TokenClassifierOutput,Pl as TokenizerModel,Cl as TrOCRForCausalLM,vl as TrOCRPreTrainedModel,Sl as TranslationPipeline,Al as UniSpeechForCTC,El as UniSpeechForSequenceClassification,Ll as UniSpeechModel,zl as UniSpeechPreTrainedModel,Il as UniSpeechSatForAudioFrameClassification,Bl as UniSpeechSatForCTC,Nl as UniSpeechSatForSequenceClassification,Dl as UniSpeechSatModel,Ol as UniSpeechSatPreTrainedModel,Vl as ViTFeatureExtractor,jl as ViTForImageClassification,Rl as ViTImageProcessor,Gl as ViTMAEModel,ql as ViTMAEPreTrainedModel,$l as ViTMSNForImageClassification,Wl as ViTMSNModel,Ul as ViTMSNPreTrainedModel,Xl as ViTModel,Ql as ViTPreTrainedModel,Hl as VisionEncoderDecoderModel,Yl as VitMatteForImageMatting,Jl as VitMatteImageProcessor,Kl as VitMattePreTrainedModel,Zl as VitsModel,ec as VitsModelOutput,tc as VitsPreTrainedModel,rc as VitsTokenizer,nc as Wav2Vec2BertForCTC,oc as Wav2Vec2BertForSequenceClassification,sc as Wav2Vec2BertModel,ac as Wav2Vec2BertPreTrainedModel,ic as Wav2Vec2CTCTokenizer,lc as Wav2Vec2FeatureExtractor,cc as Wav2Vec2ForAudioFrameClassification,dc as Wav2Vec2ForCTC,uc as Wav2Vec2ForSequenceClassification,pc as Wav2Vec2Model,hc as Wav2Vec2PreTrainedModel,mc as Wav2Vec2ProcessorWithLM,_c as WavLMForAudioFrameClassification,fc as WavLMForCTC,gc as WavLMForSequenceClassification,Mc as WavLMForXVector,wc as WavLMModel,Tc as WavLMPreTrainedModel,bc as WeSpeakerFeatureExtractor,xc as WeSpeakerResNetModel,yc as WeSpeakerResNetPreTrainedModel,kc as WhisperFeatureExtractor,Fc as WhisperForConditionalGeneration,Pc as WhisperModel,Cc as WhisperPreTrainedModel,vc as WhisperProcessor,Sc as WhisperTextStreamer,Ac as WhisperTokenizer,Ec as XLMForQuestionAnswering,Lc as XLMForSequenceClassification,zc as XLMForTokenClassification,Ic as XLMModel,Bc as XLMPreTrainedModel,Nc as XLMRobertaForMaskedLM,Dc as XLMRobertaForQuestionAnswering,Oc as XLMRobertaForSequenceClassification,Vc as XLMRobertaForTokenClassification,jc as XLMRobertaModel,Rc as XLMRobertaPreTrainedModel,Gc as XLMRobertaTokenizer,qc as XLMTokenizer,$c as XLMWithLMHeadModel,Wc as XVectorOutput,Uc as YolosFeatureExtractor,Xc as YolosForObjectDetection,Qc as YolosModel,Hc as YolosObjectDetectionOutput,Yc as YolosPreTrainedModel,Jc as ZeroShotAudioClassificationPipeline,Kc as ZeroShotClassificationPipeline,Zc as ZeroShotImageClassificationPipeline,ed as ZeroShotObjectDetectionPipeline,td as bankers_round,rd as cat,nd as cos_sim,od as dot,sd as dynamic_time_warping,ad as env,id as full,ld as full_like,cd as getKeyValueShapes,dd as hamming,ud as hanning,pd as interpolate,hd as interpolate_4d,md as interpolate_data,_d as is_chinese_char,fd as layer_norm,gd as log_softmax,Md as magnitude,wd as matmul,Td as max,bd as mean,xd as mean_pooling,yd as medianFilter,kd as mel_filter_bank,Fd as min,Pd as ones,Cd as ones_like,vd as permute,Sd as permute_data,Ad as pipeline,Ed as quantize_embeddings,Ld as read_audio,zd as rfft,Id as round,Bd as softmax,Nd as spectrogram,Dd as stack,Od as std_mean,Vd as topk,jd as window_function,Rd as zeros,Gd as zeros_like};
167
167
  //# sourceMappingURL=transformers.min.mjs.map