import{S as dn,i as un,s as pn,e as o,k as d,w as Xe,t as i,M as fn,c as s,d as n,m as u,a as r,x as Re,h as c,b as p,G as t,g as l,y as Ze,L as mn,q as He,o as Me,B as Be,v as hn}from"../../../chunks/vendor-hf-doc-builder.js";import{I as cn}from"../../../chunks/IconCopyLink-hf-doc-builder.js";import{C as vn}from"../../../chunks/CodeBlock-hf-doc-builder.js";function bn(ge){let m,U,E,G,h,w,j,y,fe,D,me,K,f,he,L,ve,be,W,we,xe,Y,x,$,_e,X,ke,Ee,ye,v,$e,R,Ne,Oe,Z,Te,Ce,z,J,Je,F,N,Q,V,ee,O,ne,b,_,H,T,Se,C,M,Pe,Ae,B,Ie,te,S,je,oe,k,g,De,Le,P,q,We,se,ae,re;return y=new cn({}),N=new vn({props:{code:"aW1wb3J0JTIwJTdCJTIwZW52JTIwJTdEJTIwZnJvbSUyMCclNDB4ZW5vdmElMkZ0cmFuc2Zvcm1lcnMnJTNCJTBBY29uc29sZS5sb2coZW52LmJhY2tlbmRzLm9ubngpJTNC",highlighted:`<span class="hljs-keyword">import</span> { env } <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;@xenova/transformers&#x27;</span>;
<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(env.<span class="hljs-property">backends</span>.<span class="hljs-property">onnx</span>);`}}),T=new cn({}),{c(){m=o("meta"),U=d(),E=o("a"),G=d(),h=o("h1"),w=o("a"),j=o("span"),Xe(y.$$.fragment),fe=d(),D=o("span"),me=i("backends/onnx"),K=d(),f=o("p"),he=i(`Handler file for choosing the correct version of ONNX Runtime, based on the environment.
Ideally, we could import the `),L=o("code"),ve=i("onnxruntime-web"),be=i(" and "),W=o("code"),we=i("onnxruntime-node"),xe=i(` packages only when needed,
but dynamic imports don\u2019t seem to work with the current webpack version and/or configuration.
This is possibly due to the experimental nature of top-level await statements.
So, we just import both packages, and use the appropriate one based on the environment:`),Y=d(),x=o("ul"),$=o("li"),_e=i("When running in node, we use "),X=o("code"),ke=i("onnxruntime-node"),Ee=i("."),ye=d(),v=o("li"),$e=i("When running in the browser, we use "),R=o("code"),Ne=i("onnxruntime-web"),Oe=i(" ("),Z=o("code"),Te=i("onnxruntime-node"),Ce=i(" is not bundled)."),z=d(),J=o("p"),Je=i("This module is not directly exported, but can be accessed through the environment variables:"),F=d(),Xe(N.$$.fragment),Q=d(),V=o("hr"),ee=d(),O=o("a"),ne=d(),b=o("h2"),_=o("a"),H=o("span"),Xe(T.$$.fragment),Se=d(),C=o("span"),M=o("code"),Pe=i("backends/onnx.ONNX"),Ae=i(" : "),B=o("code"),Ie=i("module"),te=d(),S=o("p"),je=i("The ONNX runtime module."),oe=d(),k=o("p"),g=o("strong"),De=i("Kind"),Le=i(": static property of "),P=o("a"),q=o("code"),We=i("backends/onnx"),se=d(),ae=o("hr"),this.h()},l(e){const a=fn('[data-svelte="svelte-1phssyn"]',document.head);m=s(a,"META",{name:!0,content:!0}),a.forEach(n),U=u(e),E=s(e,"A",{id:!0,class:!0}),r(E).forEach(n),G=u(e),h=s(e,"H1",{class:!0});var le=r(h);w=s(le,"A",{id:!0,class:!0,href:!0});var qe=r(w);j=s(qe,"SPAN",{});var Ue=r(j);Re(y.$$.fragment,Ue),Ue.forEach(n),qe.forEach(n),fe=u(le),D=s(le,"SPAN",{});var Ge=r(D);me=c(Ge,"backends/onnx"),Ge.forEach(n),le.forEach(n),K=u(e),f=s(e,"P",{});var A=r(f);he=c(A,`Handler file for choosing the correct version of ONNX Runtime, based on the environment.
Ideally, we could import the `),L=s(A,"CODE",{});var Ke=r(L);ve=c(Ke,"onnxruntime-web"),Ke.forEach(n),be=c(A," and "),W=s(A,"CODE",{});var Ye=r(W);we=c(Ye,"onnxruntime-node"),Ye.forEach(n),xe=c(A,` packages only when needed,
but dynamic imports don\u2019t seem to work with the current webpack version and/or configuration.
This is possibly due to the experimental nature of top-level await statements.
So, we just import both packages, and use the appropriate one based on the environment:`),A.forEach(n),Y=u(e),x=s(e,"UL",{});var ie=r(x);$=s(ie,"LI",{});var ce=r($);_e=c(ce,"When running in node, we use "),X=s(ce,"CODE",{});var ze=r(X);ke=c(ze,"onnxruntime-node"),ze.forEach(n),Ee=c(ce,"."),ce.forEach(n),ye=u(ie),v=s(ie,"LI",{});var I=r(v);$e=c(I,"When running in the browser, we use "),R=s(I,"CODE",{});var Fe=r(R);Ne=c(Fe,"onnxruntime-web"),Fe.forEach(n),Oe=c(I," ("),Z=s(I,"CODE",{});var Qe=r(Z);Te=c(Qe,"onnxruntime-node"),Qe.forEach(n),Ce=c(I," is not bundled)."),I.forEach(n),ie.forEach(n),z=u(e),J=s(e,"P",{});var Ve=r(J);Je=c(Ve,"This module is not directly exported, but can be accessed through the environment variables:"),Ve.forEach(n),F=u(e),Re(N.$$.fragment,e),Q=u(e),V=s(e,"HR",{}),ee=u(e),O=s(e,"A",{id:!0,class:!0}),r(O).forEach(n),ne=u(e),b=s(e,"H2",{class:!0});var de=r(b);_=s(de,"A",{id:!0,class:!0,href:!0});var en=r(_);H=s(en,"SPAN",{});var nn=r(H);Re(T.$$.fragment,nn),nn.forEach(n),en.forEach(n),Se=u(de),C=s(de,"SPAN",{});var ue=r(C);M=s(ue,"CODE",{});var tn=r(M);Pe=c(tn,"backends/onnx.ONNX"),tn.forEach(n),Ae=c(ue," : "),B=s(ue,"CODE",{});var on=r(B);Ie=c(on,"module"),on.forEach(n),ue.forEach(n),de.forEach(n),te=u(e),S=s(e,"P",{});var sn=r(S);je=c(sn,"The ONNX runtime module."),sn.forEach(n),oe=u(e),k=s(e,"P",{});var pe=r(k);g=s(pe,"STRONG",{});var an=r(g);De=c(an,"Kind"),an.forEach(n),Le=c(pe,": static property of "),P=s(pe,"A",{href:!0});var rn=r(P);q=s(rn,"CODE",{});var ln=r(q);We=c(ln,"backends/onnx"),ln.forEach(n),rn.forEach(n),pe.forEach(n),se=u(e),ae=s(e,"HR",{}),this.h()},h(){p(m,"name","hf:doc:metadata"),p(m,"content",JSON.stringify(wn)),p(E,"id","module_backends/onnx"),p(E,"class","group"),p(w,"id","backendsonnx"),p(w,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(w,"href","#backendsonnx"),p(h,"class","relative group"),p(O,"id","module_backends/onnx.ONNX"),p(O,"class","group"),p(_,"id","backendsonnxonnx-codemodulecode"),p(_,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(_,"href","#backendsonnxonnx-codemodulecode"),p(b,"class","relative group"),p(P,"href","#module_backends/onnx")},m(e,a){t(document.head,m),l(e,U,a),l(e,E,a),l(e,G,a),l(e,h,a),t(h,w),t(w,j),Ze(y,j,null),t(h,fe),t(h,D),t(D,me),l(e,K,a),l(e,f,a),t(f,he),t(f,L),t(L,ve),t(f,be),t(f,W),t(W,we),t(f,xe),l(e,Y,a),l(e,x,a),t(x,$),t($,_e),t($,X),t(X,ke),t($,Ee),t(x,ye),t(x,v),t(v,$e),t(v,R),t(R,Ne),t(v,Oe),t(v,Z),t(Z,Te),t(v,Ce),l(e,z,a),l(e,J,a),t(J,Je),l(e,F,a),Ze(N,e,a),l(e,Q,a),l(e,V,a),l(e,ee,a),l(e,O,a),l(e,ne,a),l(e,b,a),t(b,_),t(_,H),Ze(T,H,null),t(b,Se),t(b,C),t(C,M),t(M,Pe),t(C,Ae),t(C,B),t(B,Ie),l(e,te,a),l(e,S,a),t(S,je),l(e,oe,a),l(e,k,a),t(k,g),t(g,De),t(k,Le),t(k,P),t(P,q),t(q,We),l(e,se,a),l(e,ae,a),re=!0},p:mn,i(e){re||(He(y.$$.fragment,e),He(N.$$.fragment,e),He(T.$$.fragment,e),re=!0)},o(e){Me(y.$$.fragment,e),Me(N.$$.fragment,e),Me(T.$$.fragment,e),re=!1},d(e){n(m),e&&n(U),e&&n(E),e&&n(G),e&&n(h),Be(y),e&&n(K),e&&n(f),e&&n(Y),e&&n(x),e&&n(z),e&&n(J),e&&n(F),Be(N,e),e&&n(Q),e&&n(V),e&&n(ee),e&&n(O),e&&n(ne),e&&n(b),Be(T),e&&n(te),e&&n(S),e&&n(oe),e&&n(k),e&&n(se),e&&n(ae)}}}const wn={local:"backendsonnx",sections:[{local:"backendsonnxonnx-codemodulecode",title:"`backends/onnx.ONNX` : <code>module</code>"}],title:"backends/onnx"};function xn(ge){return hn(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class yn extends dn{constructor(m){super();un(this,m,xn,bn,pn,{})}}export{yn as default,wn as metadata};
