Buckets:

HuggingFaceDocBuilder's picture
download
raw
47 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]) ⇒ Array&quot;,&quot;local&quot;:&quot;backendsonnxdevicetoexecutionprovidersdevice--array&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;backends/onnx.createInferenceSession(buffer_or_path, session_options, session_config) ⇒ Promise. < (InferenceSession|{config: Object}) >&quot;,&quot;local&quot;:&quot;backendsonnxcreateinferencesessionbufferorpath-sessionoptions-sessionconfig--promise--inferencesessionconfig-object-&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;backends/onnx.runInferenceSession(session, ortFeed) ⇒ Promise. < Record. < string, Tensor > >&quot;,&quot;local&quot;:&quot;backendsonnxruninferencesessionsession-ortfeed--promise--record--string-tensor--&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;backends/onnx.isONNXTensor(x) ⇒ boolean&quot;,&quot;local&quot;:&quot;backendsonnxisonnxtensorx--boolean&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;backends/onnx.isONNXProxy() ⇒ boolean&quot;,&quot;local&quot;:&quot;backendsonnxisonnxproxy--boolean&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;backends/onnx~defaultDevices : Array&quot;,&quot;local&quot;:&quot;backendsonnxdefaultdevices--array&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;backends/onnx~webInitChain : Promise. < any >&quot;,&quot;local&quot;:&quot;backendsonnxwebinitchain--promise--any-&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;backends/onnx~wasmLoadPromise : Promise. < void > | null&quot;,&quot;local&quot;:&quot;backendsonnxwasmloadpromise--promise--void---null&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;backends/onnx~webInferenceChain : Promise. < any >&quot;,&quot;local&quot;:&quot;backendsonnxwebinferencechain--promise--any-&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;backends/onnx~DEVICE_TO_EXECUTION_PROVIDER_MAPPING : Record. < DeviceType, ONNXExecutionProviders >&quot;,&quot;local&quot;:&quot;backendsonnxdevicetoexecutionprovidermapping--record--devicetype-onnxexecutionproviders-&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;backends/onnx~ONNX_LOG_LEVEL_NAMES : Record. < (0|1|2|3|4), ( ’ verbose ’ | ’ info ’ | ’ warning ’ | ’ error ’ | ’ fatal ’ ) >&quot;,&quot;local&quot;:&quot;backendsonnxonnxloglevelnames--record--01234---verbose----info----warning----error----fatal---&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;backends/onnx~supportedDevices : Array&quot;,&quot;local&quot;:&quot;backendsonnxsupporteddevices--array&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;backends/onnx~ONNX_ENV : Env&quot;,&quot;local&quot;:&quot;backendsonnxonnxenv--env&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;backends/onnx~getOnnxLogSeverityLevel(logLevel) ⇒ number&quot;,&quot;local&quot;:&quot;backendsonnxgetonnxlogseveritylevelloglevel--number&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;backends/onnx~ensureWasmLoaded() ⇒ Promise. < void >&quot;,&quot;local&quot;:&quot;backendsonnxensurewasmloaded--promise--void-&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;backends/onnx~setLogLevel(logLevel)&quot;,&quot;local&quot;:&quot;backendsonnxsetloglevelloglevel&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;backends/onnx~ONNXExecutionProviders : InferenceSession.ExecutionProviderConfig&quot;,&quot;local&quot;:&quot;backendsonnxonnxexecutionproviders--inferencesessionexecutionproviderconfig&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2}],&quot;depth&quot;:1}">
<link href="/docs/transformers.js/pr_1649/en/_app/immutable/assets/0.e3b0c442.css" rel="modulepreload">
<link rel="modulepreload" href="/docs/transformers.js/pr_1649/en/_app/immutable/entry/start.5f753a22.js">
<link rel="modulepreload" href="/docs/transformers.js/pr_1649/en/_app/immutable/chunks/scheduler.6efaaf90.js">
<link rel="modulepreload" href="/docs/transformers.js/pr_1649/en/_app/immutable/chunks/singletons.c0807d75.js">
<link rel="modulepreload" href="/docs/transformers.js/pr_1649/en/_app/immutable/chunks/paths.c5938264.js">
<link rel="modulepreload" href="/docs/transformers.js/pr_1649/en/_app/immutable/entry/app.db3dfcb7.js">
<link rel="modulepreload" href="/docs/transformers.js/pr_1649/en/_app/immutable/chunks/preload-helper.1d8e1e5d.js">
<link rel="modulepreload" href="/docs/transformers.js/pr_1649/en/_app/immutable/chunks/index.eb3e1f0f.js">
<link rel="modulepreload" href="/docs/transformers.js/pr_1649/en/_app/immutable/nodes/0.1b727385.js">
<link rel="modulepreload" href="/docs/transformers.js/pr_1649/en/_app/immutable/chunks/each.e59479a4.js">
<link rel="modulepreload" href="/docs/transformers.js/pr_1649/en/_app/immutable/nodes/2.ee5457c3.js">
<link rel="modulepreload" href="/docs/transformers.js/pr_1649/en/_app/immutable/chunks/MermaidChart.svelte_svelte_type_style_lang.16f13047.js">
<link rel="modulepreload" href="/docs/transformers.js/pr_1649/en/_app/immutable/chunks/CodeBlock.72c8dd07.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]) ⇒ Array&quot;,&quot;local&quot;:&quot;backendsonnxdevicetoexecutionprovidersdevice--array&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;backends/onnx.createInferenceSession(buffer_or_path, session_options, session_config) ⇒ Promise. < (InferenceSession|{config: Object}) >&quot;,&quot;local&quot;:&quot;backendsonnxcreateinferencesessionbufferorpath-sessionoptions-sessionconfig--promise--inferencesessionconfig-object-&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;backends/onnx.runInferenceSession(session, ortFeed) ⇒ Promise. < Record. < string, Tensor > >&quot;,&quot;local&quot;:&quot;backendsonnxruninferencesessionsession-ortfeed--promise--record--string-tensor--&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;backends/onnx.isONNXTensor(x) ⇒ boolean&quot;,&quot;local&quot;:&quot;backendsonnxisonnxtensorx--boolean&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;backends/onnx.isONNXProxy() ⇒ boolean&quot;,&quot;local&quot;:&quot;backendsonnxisonnxproxy--boolean&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;backends/onnx~defaultDevices : Array&quot;,&quot;local&quot;:&quot;backendsonnxdefaultdevices--array&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;backends/onnx~webInitChain : Promise. < any >&quot;,&quot;local&quot;:&quot;backendsonnxwebinitchain--promise--any-&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;backends/onnx~wasmLoadPromise : Promise. < void > | null&quot;,&quot;local&quot;:&quot;backendsonnxwasmloadpromise--promise--void---null&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;backends/onnx~webInferenceChain : Promise. < any >&quot;,&quot;local&quot;:&quot;backendsonnxwebinferencechain--promise--any-&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;backends/onnx~DEVICE_TO_EXECUTION_PROVIDER_MAPPING : Record. < DeviceType, ONNXExecutionProviders >&quot;,&quot;local&quot;:&quot;backendsonnxdevicetoexecutionprovidermapping--record--devicetype-onnxexecutionproviders-&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;backends/onnx~ONNX_LOG_LEVEL_NAMES : Record. < (0|1|2|3|4), ( ’ verbose ’ | ’ info ’ | ’ warning ’ | ’ error ’ | ’ fatal ’ ) >&quot;,&quot;local&quot;:&quot;backendsonnxonnxloglevelnames--record--01234---verbose----info----warning----error----fatal---&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;backends/onnx~supportedDevices : Array&quot;,&quot;local&quot;:&quot;backendsonnxsupporteddevices--array&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;backends/onnx~ONNX_ENV : Env&quot;,&quot;local&quot;:&quot;backendsonnxonnxenv--env&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;backends/onnx~getOnnxLogSeverityLevel(logLevel) ⇒ number&quot;,&quot;local&quot;:&quot;backendsonnxgetonnxlogseveritylevelloglevel--number&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;backends/onnx~ensureWasmLoaded() ⇒ Promise. < void >&quot;,&quot;local&quot;:&quot;backendsonnxensurewasmloaded--promise--void-&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;backends/onnx~setLogLevel(logLevel)&quot;,&quot;local&quot;:&quot;backendsonnxsetloglevelloglevel&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;backends/onnx~ONNXExecutionProviders : InferenceSession.ExecutionProviderConfig&quot;,&quot;local&quot;:&quot;backendsonnxonnxexecutionproviders--inferencesessionexecutionproviderconfig&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> <div class="items-center shrink-0 min-w-[100px] max-sm:min-w-[50px] justify-end ml-auto flex" style="float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"><div class="inline-flex rounded-md max-sm:rounded-sm"><button class="inline-flex items-center gap-1 h-7 max-sm:h-7 px-2 max-sm:px-1.5 text-sm font-medium text-gray-800 border border-r-0 rounded-l-md max-sm:rounded-l-sm border-gray-200 bg-white hover:shadow-inner dark:border-gray-850 dark:bg-gray-950 dark:text-gray-200 dark:hover:bg-gray-800" aria-live="polite"><span class="inline-flex items-center justify-center rounded-md p-0.5 max-sm:p-0 hover:text-gray-800 dark:hover:text-gray-200"><svg class="sm:size-3.5 size-3" 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></span> <span>Copy page</span></button> <button class="inline-flex items-center justify-center w-6 max-sm:w-5 h-7 max-sm:h-7 disabled:pointer-events-none text-sm text-gray-500 hover:text-gray-700 dark:hover:text-white rounded-r-md max-sm:rounded-r-sm border border-l transition border-gray-200 bg-white hover:shadow-inner dark:border-gray-850 dark:bg-gray-950 dark:text-gray-200 dark:hover:bg-gray-800" aria-haspopup="menu" aria-expanded="false" aria-label="Open copy menu"><svg class="transition-transform text-gray-400 overflow-visible sm:size-3.5 size-3 rotate-0" width="1em" height="1em" viewBox="0 0 12 7" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 1L6 6L11 1" stroke="currentColor"></path></svg></button></div> </div> <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-15zzcfh"><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</code></li> <li><a href="#module_backends/onnx.createInferenceSession"><code>.createInferenceSession(buffer_or_path, session_options, session_config)</code></a><code>Promise.&lt;(InferenceSession|{config: Object})&gt;</code></li> <li><a href="#module_backends/onnx.runInferenceSession"><code>.runInferenceSession(session, ortFeed)</code></a><code>Promise.&lt;Record.&lt;string, Tensor&gt;&gt;</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</code></li> <li><a href="#module_backends/onnx..webInitChain"><code>~webInitChain</code></a> : <code>Promise.&lt;any&gt;</code></li> <li><a href="#module_backends/onnx..wasmLoadPromise"><code>~wasmLoadPromise</code></a> : <code>Promise.&lt;void&gt;</code> | <code>null</code></li> <li><a href="#module_backends/onnx..webInferenceChain"><code>~webInferenceChain</code></a> : <code>Promise.&lt;any&gt;</code></li> <li><a href="#module_backends/onnx..DEVICE_TO_EXECUTION_PROVIDER_MAPPING"><code>~DEVICE_TO_EXECUTION_PROVIDER_MAPPING</code></a> : <code>Record.&lt;DeviceType, ONNXExecutionProviders&gt;</code></li> <li><a href="#module_backends/onnx..ONNX_LOG_LEVEL_NAMES"><code>~ONNX_LOG_LEVEL_NAMES</code></a> : <code>Record.&lt;(0|1|2|3|4), (’verbose’|’info’|’warning’|’error’|’fatal’)&gt;</code></li> <li><a href="#module_backends/onnx..supportedDevices"><code>~supportedDevices</code></a> : <code>Array</code></li> <li><a href="#module_backends/onnx..ONNX_ENV"><code>~ONNX_ENV</code></a> : <code>Env</code></li> <li><a href="#module_backends/onnx..getOnnxLogSeverityLevel"><code>~getOnnxLogSeverityLevel(logLevel)</code></a><code>number</code></li> <li><a href="#module_backends/onnx..ensureWasmLoaded"><code>~ensureWasmLoaded()</code></a><code>Promise.&lt;void&gt;</code></li> <li><a href="#module_backends/onnx..setLogLevel"><code>~setLogLevel(logLevel)</code></a></li> <li><a href="#module_backends/onnx..ONNXExecutionProviders"><code>~ONNXExecutionProviders</code></a> : <code>InferenceSession.ExecutionProviderConfig</code></li></ul></li></ul></li></ul> <hr> <a id="module_backends/onnx.deviceToExecutionProviders" class="group"></a> <h2 class="relative group"><a id="backendsonnxdevicetoexecutionprovidersdevice--array" 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--array"><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]) ⇒ Array</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-1x2sb20"><strong>Kind</strong>: static method of <a href="#module_backends/onnx"><code>backends/onnx</code></a><br> <strong>Returns</strong>: <code>Array</code> - The execution providers to use for the given device.</p> <table data-svelte-h="svelte-1yje546"><thead><tr><th>Param</th><th>Type</th><th>Default</th><th>Description</th></tr></thead> <tbody><tr><td>[device]</td><td><code><a href="#DeviceType">DeviceType</a></code> | <code>&quot;auto&quot;</code> | <code>null</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="backendsonnxcreateinferencesessionbufferorpath-sessionoptions-sessionconfig--promise--inferencesessionconfig-object-" 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="#backendsonnxcreateinferencesessionbufferorpath-sessionoptions-sessionconfig--promise--inferencesessionconfig-object-"><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_or_path, session_options, session_config) ⇒ Promise. &lt; (InferenceSession|{config: Object}) ></span></h2> <p data-svelte-h="svelte-19a590t">Create an ONNX inference session.</p> <p data-svelte-h="svelte-1nen099"><strong>Kind</strong>: static method of <a href="#module_backends/onnx"><code>backends/onnx</code></a><br> <strong>Returns</strong>: <code>Promise.&lt;(InferenceSession|{config: Object})&gt;</code> - The ONNX inference session.</p> <table data-svelte-h="svelte-16yc5b9"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>buffer_or_path</td><td><code>Uint8Array</code> | <code>string</code></td><td><p>The ONNX model buffer or path.</p></td> </tr><tr><td>session_options</td><td><code>InferenceSession.SessionOptions</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.runInferenceSession" class="group"></a> <h2 class="relative group"><a id="backendsonnxruninferencesessionsession-ortfeed--promise--record--string-tensor--" 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="#backendsonnxruninferencesessionsession-ortfeed--promise--record--string-tensor--"><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.runInferenceSession(session, ortFeed) ⇒ Promise. &lt; Record. &lt; string, Tensor > ></span></h2> <p data-svelte-h="svelte-tune43">Run an inference session.</p> <p data-svelte-h="svelte-1kk2xy9"><strong>Kind</strong>: static method of <a href="#module_backends/onnx"><code>backends/onnx</code></a><br> <strong>Returns</strong>: <code>Promise.&lt;Record.&lt;string, Tensor&gt;&gt;</code> - The output tensors.</p> <table data-svelte-h="svelte-7py481"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>session</td><td><code>InferenceSession</code></td><td><p>The ONNX inference session.</p></td> </tr><tr><td>ortFeed</td><td><code>Record.&lt;string, Tensor&gt;</code></td><td><p>The input tensors.</p></td></tr></tbody></table> <hr> <a id="module_backends/onnx.isONNXTensor" class="group"></a> <h2 class="relative group"><a id="backendsonnxisonnxtensorx--boolean" 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--boolean"><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) ⇒ boolean</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--boolean" 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--boolean"><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() ⇒ boolean</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--array" 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--array"><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 : Array</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..webInitChain" class="group"></a> <h2 class="relative group"><a id="backendsonnxwebinitchain--promise--any-" 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="#backendsonnxwebinitchain--promise--any-"><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~webInitChain : Promise. &lt; any ></span></h2> <p data-svelte-h="svelte-8qm3h2">Currently, Transformers.js doesn’t support simultaneous loading of sessions in WASM/WebGPU.
For this reason, we need to chain the loading calls.</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..wasmLoadPromise" class="group"></a> <h2 class="relative group"><a id="backendsonnxwasmloadpromise--promise--void---null" 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="#backendsonnxwasmloadpromise--promise--void---null"><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~wasmLoadPromise : Promise. &lt; void > | null</span></h2> <p data-svelte-h="svelte-17ki467">Promise that resolves when WASM binary has been loaded (if caching is enabled).
This ensures we only attempt to load the WASM binary once.</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..webInferenceChain" class="group"></a> <h2 class="relative group"><a id="backendsonnxwebinferencechain--promise--any-" 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="#backendsonnxwebinferencechain--promise--any-"><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~webInferenceChain : Promise. &lt; any ></span></h2> <p data-svelte-h="svelte-ngpre2">Currently, Transformers.js doesn’t support simultaneous execution of sessions in WASM/WebGPU.
For this reason, we need to chain the inference calls (otherwise we get “Error: Session already started”).</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--record--devicetype-onnxexecutionproviders-" 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--record--devicetype-onnxexecutionproviders-"><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 : Record. &lt; DeviceType, ONNXExecutionProviders ></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..ONNX_LOG_LEVEL_NAMES" class="group"></a> <h2 class="relative group"><a id="backendsonnxonnxloglevelnames--record--01234---verbose----info----warning----error----fatal---" 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="#backendsonnxonnxloglevelnames--record--01234---verbose----info----warning----error----fatal---"><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_LOG_LEVEL_NAMES : Record. &lt; (0|1|2|3|4), ( ’ verbose ’ | ’ info ’ | ’ warning ’ | ’ error ’ | ’ fatal ’ ) ></span></h2> <p data-svelte-h="svelte-pp6g4g">Maps ONNX Runtime numeric severity levels to string log levels.</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..supportedDevices" class="group"></a> <h2 class="relative group"><a id="backendsonnxsupporteddevices--array" 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--array"><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 : Array</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--env" 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--env"><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 : Env</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..getOnnxLogSeverityLevel" class="group"></a> <h2 class="relative group"><a id="backendsonnxgetonnxlogseveritylevelloglevel--number" 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="#backendsonnxgetonnxlogseveritylevelloglevel--number"><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~getOnnxLogSeverityLevel(logLevel) ⇒ number</span></h2> <p data-svelte-h="svelte-1nxo9rp">Converts any LogLevel value to ONNX Runtime’s numeric severity level (0-4).
This handles both standard LogLevel values (10, 20, 30, 40, 50) and custom intermediate values.</p> <p data-svelte-h="svelte-1ezixza"><strong>Kind</strong>: inner method of <a href="#module_backends/onnx"><code>backends/onnx</code></a><br> <strong>Returns</strong>: <code>number</code> - ONNX Runtime severity level (0-4)</p> <table data-svelte-h="svelte-1v4wimk"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>logLevel</td><td><code>number</code></td><td><p>The LogLevel value to convert</p></td></tr></tbody></table> <hr> <a id="module_backends/onnx..ensureWasmLoaded" class="group"></a> <h2 class="relative group"><a id="backendsonnxensurewasmloaded--promise--void-" 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="#backendsonnxensurewasmloaded--promise--void-"><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~ensureWasmLoaded() ⇒ Promise. &lt; void ></span></h2> <p data-svelte-h="svelte-1jbmajo">Ensures the WASM binary is loaded and cached before creating an inference session.
Only runs once, even if called multiple times.</p> <p data-svelte-h="svelte-1aa16df"><strong>Kind</strong>: inner method of <a href="#module_backends/onnx"><code>backends/onnx</code></a></p> <hr> <a id="module_backends/onnx..setLogLevel" class="group"></a> <h2 class="relative group"><a id="backendsonnxsetloglevelloglevel" 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="#backendsonnxsetloglevelloglevel"><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~setLogLevel(logLevel)</span></h2> <p data-svelte-h="svelte-1867xpz">A function to map Transformers.js log levels to ONNX Runtime log severity
levels, and set the log level environment variable in ONNX Runtime.</p> <p data-svelte-h="svelte-1aa16df"><strong>Kind</strong>: inner method of <a href="#module_backends/onnx"><code>backends/onnx</code></a></p> <table data-svelte-h="svelte-1rny4tc"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>logLevel</td><td><code>number</code></td><td><p>The log level to set.</p></td></tr></tbody></table> <hr> <a id="module_backends/onnx..ONNXExecutionProviders" class="group"></a> <h2 class="relative group"><a id="backendsonnxonnxexecutionproviders--inferencesessionexecutionproviderconfig" 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--inferencesessionexecutionproviderconfig"><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 : InferenceSession.ExecutionProviderConfig</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/packages/transformers/docs/source/api/backends/onnx.md" target="_blank"><svg class="mr-1" 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="M31,16l-7,7l-1.41-1.41L28.17,16l-5.58-5.59L24,9l7,7z"></path><path d="M1,16l7-7l1.41,1.41L3.83,16l5.58,5.59L8,23l-7-7z"></path><path d="M12.419,25.484L17.639,6.552l1.932,0.518L14.351,26.002z"></path></svg> <span data-svelte-h="svelte-zjs2n5"><span class="underline">Update</span> on GitHub</span></a> <p></p>
<script>
{
__sveltekit_rvrl7f = {
assets: "/docs/transformers.js/pr_1649/en",
base: "/docs/transformers.js/pr_1649/en",
env: {}
};
const element = document.currentScript.parentElement;
const data = [null,null];
Promise.all([
import("/docs/transformers.js/pr_1649/en/_app/immutable/entry/start.5f753a22.js"),
import("/docs/transformers.js/pr_1649/en/_app/immutable/entry/app.db3dfcb7.js")
]).then(([kit, app]) => {
kit.start(app, element, {
node_ids: [0, 2],
data,
form: null,
error: null
});
});
}
</script>

Xet Storage Details

Size:
47 kB
·
Xet hash:
ceaf7be465d029205f99228c424a730142a57138624178070b9628ddb483cd51

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