Buckets:

rtrm's picture
download
raw
28.6 kB
<meta charset="utf-8" /><meta name="hf:doc:metadata" content="{&quot;title&quot;:&quot;backends/onnx&quot;,&quot;local&quot;:&quot;backendsonnx&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;backends/onnx.deviceToExecutionProviders([device]) ⇒ <code> Array. < ONNXExecutionProviders > </code>&quot;,&quot;local&quot;:&quot;backendsonnxdevicetoexecutionprovidersdevice--code-array--onnxexecutionproviders--code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;backends/onnx.createInferenceSession(buffer, session_options, session_config) ⇒ <code> * </code>&quot;,&quot;local&quot;:&quot;backendsonnxcreateinferencesessionbuffer-sessionoptions-sessionconfig--code--code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;backends/onnx.isONNXTensor(x) ⇒ <code> boolean </code>&quot;,&quot;local&quot;:&quot;backendsonnxisonnxtensorx--code-boolean-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;backends/onnx.isONNXProxy() ⇒ <code> boolean </code>&quot;,&quot;local&quot;:&quot;backendsonnxisonnxproxy--code-boolean-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;backends/onnx~defaultDevices : <code> Array. < ONNXExecutionProviders > </code>&quot;,&quot;local&quot;:&quot;backendsonnxdefaultdevices--code-array--onnxexecutionproviders--code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;backends/onnx~wasmInitPromise : <code> Promise < any > </code> | <code> null </code>&quot;,&quot;local&quot;:&quot;backendsonnxwasminitpromise--code-promise--any--code--code-null-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;backends/onnx~DEVICE_TO_EXECUTION_PROVIDER_MAPPING : <code> * </code>&quot;,&quot;local&quot;:&quot;backendsonnxdevicetoexecutionprovidermapping--code--code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;backends/onnx~supportedDevices : <code> * </code>&quot;,&quot;local&quot;:&quot;backendsonnxsupporteddevices--code--code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;backends/onnx~ONNX_ENV : <code> * </code>&quot;,&quot;local&quot;:&quot;backendsonnxonnxenv--code--code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;backends/onnx~ONNXExecutionProviders : <code> * </code>&quot;,&quot;local&quot;:&quot;backendsonnxonnxexecutionproviders--code--code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2}],&quot;depth&quot;:1}">
<link href="/docs/transformers.js/pr_1113/en/_app/immutable/assets/0.e3b0c442.css" rel="modulepreload">
<link rel="modulepreload" href="/docs/transformers.js/pr_1113/en/_app/immutable/entry/start.88a6e140.js">
<link rel="modulepreload" href="/docs/transformers.js/pr_1113/en/_app/immutable/chunks/scheduler.0219f8bd.js">
<link rel="modulepreload" href="/docs/transformers.js/pr_1113/en/_app/immutable/chunks/singletons.c59c6d8d.js">
<link rel="modulepreload" href="/docs/transformers.js/pr_1113/en/_app/immutable/chunks/paths.8e090985.js">
<link rel="modulepreload" href="/docs/transformers.js/pr_1113/en/_app/immutable/entry/app.0003020d.js">
<link rel="modulepreload" href="/docs/transformers.js/pr_1113/en/_app/immutable/chunks/index.f61edf3b.js">
<link rel="modulepreload" href="/docs/transformers.js/pr_1113/en/_app/immutable/nodes/0.25c65ab2.js">
<link rel="modulepreload" href="/docs/transformers.js/pr_1113/en/_app/immutable/nodes/2.ca0a80ee.js">
<link rel="modulepreload" href="/docs/transformers.js/pr_1113/en/_app/immutable/chunks/CodeBlock.38e566ae.js">
<link rel="modulepreload" href="/docs/transformers.js/pr_1113/en/_app/immutable/chunks/EditOnGithub.48fa589f.js"><!-- HEAD_svelte-u9bgzb_START --><meta name="hf:doc:metadata" content="{&quot;title&quot;:&quot;backends/onnx&quot;,&quot;local&quot;:&quot;backendsonnx&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;backends/onnx.deviceToExecutionProviders([device]) ⇒ <code> Array. < ONNXExecutionProviders > </code>&quot;,&quot;local&quot;:&quot;backendsonnxdevicetoexecutionprovidersdevice--code-array--onnxexecutionproviders--code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;backends/onnx.createInferenceSession(buffer, session_options, session_config) ⇒ <code> * </code>&quot;,&quot;local&quot;:&quot;backendsonnxcreateinferencesessionbuffer-sessionoptions-sessionconfig--code--code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;backends/onnx.isONNXTensor(x) ⇒ <code> boolean </code>&quot;,&quot;local&quot;:&quot;backendsonnxisonnxtensorx--code-boolean-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;backends/onnx.isONNXProxy() ⇒ <code> boolean </code>&quot;,&quot;local&quot;:&quot;backendsonnxisonnxproxy--code-boolean-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;backends/onnx~defaultDevices : <code> Array. < ONNXExecutionProviders > </code>&quot;,&quot;local&quot;:&quot;backendsonnxdefaultdevices--code-array--onnxexecutionproviders--code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;backends/onnx~wasmInitPromise : <code> Promise < any > </code> | <code> null </code>&quot;,&quot;local&quot;:&quot;backendsonnxwasminitpromise--code-promise--any--code--code-null-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;backends/onnx~DEVICE_TO_EXECUTION_PROVIDER_MAPPING : <code> * </code>&quot;,&quot;local&quot;:&quot;backendsonnxdevicetoexecutionprovidermapping--code--code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;backends/onnx~supportedDevices : <code> * </code>&quot;,&quot;local&quot;:&quot;backendsonnxsupporteddevices--code--code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;backends/onnx~ONNX_ENV : <code> * </code>&quot;,&quot;local&quot;:&quot;backendsonnxonnxenv--code--code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;backends/onnx~ONNXExecutionProviders : <code> * </code>&quot;,&quot;local&quot;:&quot;backendsonnxonnxexecutionproviders--code--code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2}],&quot;depth&quot;:1}"><!-- HEAD_svelte-u9bgzb_END --> <p></p> <a id="module_backends/onnx" class="group"></a> <h1 class="relative group"><a id="backendsonnx" 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" href="#backendsonnx"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>backends/onnx</span></h1> <p data-svelte-h="svelte-1nskovu">Handler file for choosing the correct version of ONNX Runtime, based on the environment.
Ideally, we could import the <code>onnxruntime-web</code> and <code>onnxruntime-node</code> packages only when needed,
but dynamic imports don’t 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:</p> <ul data-svelte-h="svelte-1nim9s8"><li>When running in node, we use <code>onnxruntime-node</code>.</li> <li>When running in the browser, we use <code>onnxruntime-web</code> (<code>onnxruntime-node</code> is not bundled).</li></ul> <p data-svelte-h="svelte-m4kxqp">This module is not directly exported, but can be accessed through the environment variables:</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">import</span> { env } <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;@huggingface/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>);<!-- HTML_TAG_END --></pre></div> <ul data-svelte-h="svelte-17ej4zc"><li><a href="#module_backends/onnx">backends/onnx</a><ul><li><em>static</em><ul><li><a href="#module_backends/onnx.deviceToExecutionProviders"><code>.deviceToExecutionProviders([device])</code></a><code>Array.&lt;ONNXExecutionProviders&gt;</code></li> <li><a href="#module_backends/onnx.createInferenceSession"><code>.createInferenceSession(buffer, session_options, session_config)</code></a><code>*</code></li> <li><a href="#module_backends/onnx.isONNXTensor"><code>.isONNXTensor(x)</code></a><code>boolean</code></li> <li><a href="#module_backends/onnx.isONNXProxy"><code>.isONNXProxy()</code></a><code>boolean</code></li></ul></li> <li><em>inner</em><ul><li><a href="#module_backends/onnx..defaultDevices"><code>~defaultDevices</code></a> : <code>Array.&lt;ONNXExecutionProviders&gt;</code></li> <li><a href="#module_backends/onnx..wasmInitPromise"><code>~wasmInitPromise</code></a> : <code>Promise&lt;any&gt;</code> | <code>null</code></li> <li><a href="#module_backends/onnx..DEVICE_TO_EXECUTION_PROVIDER_MAPPING"><code>~DEVICE_TO_EXECUTION_PROVIDER_MAPPING</code></a> : <code>*</code></li> <li><a href="#module_backends/onnx..supportedDevices"><code>~supportedDevices</code></a> : <code>*</code></li> <li><a href="#module_backends/onnx..ONNX_ENV"><code>~ONNX_ENV</code></a> : <code>*</code></li> <li><a href="#module_backends/onnx..ONNXExecutionProviders"><code>~ONNXExecutionProviders</code></a> : <code>*</code></li></ul></li></ul></li></ul> <hr> <a id="module_backends/onnx.deviceToExecutionProviders" class="group"></a> <h2 class="relative group"><a id="backendsonnxdevicetoexecutionprovidersdevice--code-array--onnxexecutionproviders--code" 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" href="#backendsonnxdevicetoexecutionprovidersdevice--code-array--onnxexecutionproviders--code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>backends/onnx.deviceToExecutionProviders([device]) ⇒ &lt;code> Array. &lt; ONNXExecutionProviders > &lt;/code></span></h2> <p data-svelte-h="svelte-g2kkoo">Map a device to the execution providers to use for the given device.</p> <p data-svelte-h="svelte-1ns1klp"><strong>Kind</strong>: static method of <a href="#module_backends/onnx"><code>backends/onnx</code></a><br> <strong>Returns</strong>: <code>Array.&lt;ONNXExecutionProviders&gt;</code> - The execution providers to use for the given device.</p> <table data-svelte-h="svelte-15mkoxu"><thead><tr><th>Param</th><th>Type</th><th>Default</th><th>Description</th></tr></thead> <tbody><tr><td>[device]</td><td><code>*</code></td><td><code></code></td><td><p>(Optional) The device to run the inference on.</p></td></tr></tbody></table> <hr> <a id="module_backends/onnx.createInferenceSession" class="group"></a> <h2 class="relative group"><a id="backendsonnxcreateinferencesessionbuffer-sessionoptions-sessionconfig--code--code" 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" href="#backendsonnxcreateinferencesessionbuffer-sessionoptions-sessionconfig--code--code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>backends/onnx.createInferenceSession(buffer, session_options, session_config) ⇒ &lt;code> * &lt;/code></span></h2> <p data-svelte-h="svelte-19a590t">Create an ONNX inference session.</p> <p data-svelte-h="svelte-17jc8ku"><strong>Kind</strong>: static method of <a href="#module_backends/onnx"><code>backends/onnx</code></a><br> <strong>Returns</strong>: <code>*</code> - The ONNX inference session.</p> <table data-svelte-h="svelte-1oy7vvm"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>buffer</td><td><code>Uint8Array</code></td><td><p>The ONNX model buffer.</p></td> </tr><tr><td>session_options</td><td><code>*</code></td><td><p>ONNX inference session options.</p></td> </tr><tr><td>session_config</td><td><code>Object</code></td><td><p>ONNX inference session configuration.</p></td></tr></tbody></table> <hr> <a id="module_backends/onnx.isONNXTensor" class="group"></a> <h2 class="relative group"><a id="backendsonnxisonnxtensorx--code-boolean-code" 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" href="#backendsonnxisonnxtensorx--code-boolean-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>backends/onnx.isONNXTensor(x) ⇒ &lt;code> boolean &lt;/code></span></h2> <p data-svelte-h="svelte-11755yo">Check if an object is an ONNX tensor.</p> <p data-svelte-h="svelte-1vudgod"><strong>Kind</strong>: static method of <a href="#module_backends/onnx"><code>backends/onnx</code></a><br> <strong>Returns</strong>: <code>boolean</code> - Whether the object is an ONNX tensor.</p> <table data-svelte-h="svelte-o3zzgy"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>x</td><td><code>any</code></td><td><p>The object to check</p></td></tr></tbody></table> <hr> <a id="module_backends/onnx.isONNXProxy" class="group"></a> <h2 class="relative group"><a id="backendsonnxisonnxproxy--code-boolean-code" 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" href="#backendsonnxisonnxproxy--code-boolean-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>backends/onnx.isONNXProxy() ⇒ &lt;code> boolean &lt;/code></span></h2> <p data-svelte-h="svelte-bsb3mu">Check if ONNX’s WASM backend is being proxied.</p> <p data-svelte-h="svelte-ha6bkx"><strong>Kind</strong>: static method of <a href="#module_backends/onnx"><code>backends/onnx</code></a><br> <strong>Returns</strong>: <code>boolean</code> - Whether ONNX’s WASM backend is being proxied.</p> <hr> <a id="module_backends/onnx..defaultDevices" class="group"></a> <h2 class="relative group"><a id="backendsonnxdefaultdevices--code-array--onnxexecutionproviders--code" 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" href="#backendsonnxdefaultdevices--code-array--onnxexecutionproviders--code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>backends/onnx~defaultDevices : &lt;code> Array. &lt; ONNXExecutionProviders > &lt;/code></span></h2> <p data-svelte-h="svelte-jxwmib"><strong>Kind</strong>: inner property of <a href="#module_backends/onnx"><code>backends/onnx</code></a></p> <hr> <a id="module_backends/onnx..wasmInitPromise" class="group"></a> <h2 class="relative group"><a id="backendsonnxwasminitpromise--code-promise--any--code--code-null-code" 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" href="#backendsonnxwasminitpromise--code-promise--any--code--code-null-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>backends/onnx~wasmInitPromise : &lt;code> Promise &lt; any > &lt;/code> | &lt;code> null &lt;/code></span></h2> <p data-svelte-h="svelte-mqeide">To prevent multiple calls to <code>initWasm()</code>, we store the first call in a Promise
that is resolved when the first InferenceSession is created. Subsequent calls
will wait for this Promise to resolve before creating their own InferenceSession.</p> <p data-svelte-h="svelte-jxwmib"><strong>Kind</strong>: inner property of <a href="#module_backends/onnx"><code>backends/onnx</code></a></p> <hr> <a id="module_backends/onnx..DEVICE_TO_EXECUTION_PROVIDER_MAPPING" class="group"></a> <h2 class="relative group"><a id="backendsonnxdevicetoexecutionprovidermapping--code--code" 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" href="#backendsonnxdevicetoexecutionprovidermapping--code--code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>backends/onnx~DEVICE_TO_EXECUTION_PROVIDER_MAPPING : &lt;code> * &lt;/code></span></h2> <p data-svelte-h="svelte-1djwi16"><strong>Kind</strong>: inner constant of <a href="#module_backends/onnx"><code>backends/onnx</code></a></p> <hr> <a id="module_backends/onnx..supportedDevices" class="group"></a> <h2 class="relative group"><a id="backendsonnxsupporteddevices--code--code" 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" href="#backendsonnxsupporteddevices--code--code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>backends/onnx~supportedDevices : &lt;code> * &lt;/code></span></h2> <p data-svelte-h="svelte-193vtbe">The list of supported devices, sorted by priority/performance.</p> <p data-svelte-h="svelte-1djwi16"><strong>Kind</strong>: inner constant of <a href="#module_backends/onnx"><code>backends/onnx</code></a></p> <hr> <a id="module_backends/onnx..ONNX_ENV" class="group"></a> <h2 class="relative group"><a id="backendsonnxonnxenv--code--code" 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" href="#backendsonnxonnxenv--code--code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>backends/onnx~ONNX_ENV : &lt;code> * &lt;/code></span></h2> <p data-svelte-h="svelte-1djwi16"><strong>Kind</strong>: inner constant of <a href="#module_backends/onnx"><code>backends/onnx</code></a></p> <hr> <a id="module_backends/onnx..ONNXExecutionProviders" class="group"></a> <h2 class="relative group"><a id="backendsonnxonnxexecutionproviders--code--code" 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" href="#backendsonnxonnxexecutionproviders--code--code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>backends/onnx~ONNXExecutionProviders : &lt;code> * &lt;/code></span></h2> <p data-svelte-h="svelte-488xn5"><strong>Kind</strong>: inner typedef of <a href="#module_backends/onnx"><code>backends/onnx</code></a></p> <hr> <a class="!text-gray-400 !no-underline text-sm flex items-center not-prose mt-4" href="https://github.com/huggingface/transformers.js/blob/main/docs/source/api/backends/onnx.md" target="_blank"><span data-svelte-h="svelte-1kd6by1">&lt;</span> <span data-svelte-h="svelte-x0xyl0">&gt;</span> <span data-svelte-h="svelte-1dajgef"><span class="underline ml-1.5">Update</span> on GitHub</span></a> <p></p>
<script>
{
__sveltekit_kuyevp = {
assets: "/docs/transformers.js/pr_1113/en",
base: "/docs/transformers.js/pr_1113/en",
env: {}
};
const element = document.currentScript.parentElement;
const data = [null,null];
Promise.all([
import("/docs/transformers.js/pr_1113/en/_app/immutable/entry/start.88a6e140.js"),
import("/docs/transformers.js/pr_1113/en/_app/immutable/entry/app.0003020d.js")
]).then(([kit, app]) => {
kit.start(app, element, {
node_ids: [0, 2],
data,
form: null,
error: null
});
});
}
</script>

Xet Storage Details

Size:
28.6 kB
·
Xet hash:
971654d6f41291560e3b4d3604b3e419d2a372964442588a61fb38e160a21295

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.