Buckets:
| <meta charset="utf-8" /><meta name="hf:doc:metadata" content="{"title":"utils/model_registry","local":"utilsmodelregistry","sections":[{"title":"Classes","local":"classes","sections":[{"title":"ModelRegistry","local":"modelregistry","sections":[{"title":"ModelRegistry.get_files(modelId, [options])","local":"modelregistrygetfilesmodelid-options","sections":[],"depth":4},{"title":"ModelRegistry.get_pipeline_files(task, modelId, [options])","local":"modelregistrygetpipelinefilestask-modelid-options","sections":[],"depth":4},{"title":"ModelRegistry.get_model_files(modelId, [options])","local":"modelregistrygetmodelfilesmodelid-options","sections":[],"depth":4},{"title":"ModelRegistry.get_tokenizer_files(modelId)","local":"modelregistrygettokenizerfilesmodelid","sections":[],"depth":4},{"title":"ModelRegistry.get_processor_files(modelId)","local":"modelregistrygetprocessorfilesmodelid","sections":[],"depth":4},{"title":"ModelRegistry.get_available_dtypes(modelId, [options])","local":"modelregistrygetavailabledtypesmodelid-options","sections":[],"depth":4},{"title":"ModelRegistry.is_cached(modelId, [options])","local":"modelregistryiscachedmodelid-options","sections":[],"depth":4},{"title":"ModelRegistry.is_cached_files(modelId, [options])","local":"modelregistryiscachedfilesmodelid-options","sections":[],"depth":4},{"title":"ModelRegistry.is_pipeline_cached(task, modelId, [options])","local":"modelregistryispipelinecachedtask-modelid-options","sections":[],"depth":4},{"title":"ModelRegistry.is_pipeline_cached_files(task, modelId, [options])","local":"modelregistryispipelinecachedfilestask-modelid-options","sections":[],"depth":4},{"title":"ModelRegistry.get_file_metadata(path_or_repo_id, filename, [options])","local":"modelregistrygetfilemetadatapathorrepoid-filename-options","sections":[],"depth":4},{"title":"ModelRegistry.clear_cache(modelId, [options])","local":"modelregistryclearcachemodelid-options","sections":[],"depth":4},{"title":"ModelRegistry.clear_pipeline_cache(task, modelId, [options])","local":"modelregistryclearpipelinecachetask-modelid-options","sections":[],"depth":4}],"depth":3}],"depth":2}],"depth":1}"> | |
| <link href="/docs/transformers.js/pr_1665/en/_app/immutable/assets/0.e3b0c442.css" rel="modulepreload"> | |
| <link rel="modulepreload" href="/docs/transformers.js/pr_1665/en/_app/immutable/entry/start.cb58eb6f.js"> | |
| <link rel="modulepreload" href="/docs/transformers.js/pr_1665/en/_app/immutable/chunks/scheduler.6efaaf90.js"> | |
| <link rel="modulepreload" href="/docs/transformers.js/pr_1665/en/_app/immutable/chunks/singletons.08239980.js"> | |
| <link rel="modulepreload" href="/docs/transformers.js/pr_1665/en/_app/immutable/chunks/paths.611c3944.js"> | |
| <link rel="modulepreload" href="/docs/transformers.js/pr_1665/en/_app/immutable/entry/app.9eafcf9d.js"> | |
| <link rel="modulepreload" href="/docs/transformers.js/pr_1665/en/_app/immutable/chunks/preload-helper.4b821645.js"> | |
| <link rel="modulepreload" href="/docs/transformers.js/pr_1665/en/_app/immutable/chunks/index.eb3e1f0f.js"> | |
| <link rel="modulepreload" href="/docs/transformers.js/pr_1665/en/_app/immutable/nodes/0.d361a553.js"> | |
| <link rel="modulepreload" href="/docs/transformers.js/pr_1665/en/_app/immutable/chunks/each.e59479a4.js"> | |
| <link rel="modulepreload" href="/docs/transformers.js/pr_1665/en/_app/immutable/nodes/21.915a07c5.js"> | |
| <link rel="modulepreload" href="/docs/transformers.js/pr_1665/en/_app/immutable/chunks/MermaidChart.svelte_svelte_type_style_lang.699f2734.js"> | |
| <link rel="modulepreload" href="/docs/transformers.js/pr_1665/en/_app/immutable/chunks/CodeBlock.b303f0b9.js"><!-- HEAD_svelte-u9bgzb_START --><meta name="hf:doc:metadata" content="{"title":"utils/model_registry","local":"utilsmodelregistry","sections":[{"title":"Classes","local":"classes","sections":[{"title":"ModelRegistry","local":"modelregistry","sections":[{"title":"ModelRegistry.get_files(modelId, [options])","local":"modelregistrygetfilesmodelid-options","sections":[],"depth":4},{"title":"ModelRegistry.get_pipeline_files(task, modelId, [options])","local":"modelregistrygetpipelinefilestask-modelid-options","sections":[],"depth":4},{"title":"ModelRegistry.get_model_files(modelId, [options])","local":"modelregistrygetmodelfilesmodelid-options","sections":[],"depth":4},{"title":"ModelRegistry.get_tokenizer_files(modelId)","local":"modelregistrygettokenizerfilesmodelid","sections":[],"depth":4},{"title":"ModelRegistry.get_processor_files(modelId)","local":"modelregistrygetprocessorfilesmodelid","sections":[],"depth":4},{"title":"ModelRegistry.get_available_dtypes(modelId, [options])","local":"modelregistrygetavailabledtypesmodelid-options","sections":[],"depth":4},{"title":"ModelRegistry.is_cached(modelId, [options])","local":"modelregistryiscachedmodelid-options","sections":[],"depth":4},{"title":"ModelRegistry.is_cached_files(modelId, [options])","local":"modelregistryiscachedfilesmodelid-options","sections":[],"depth":4},{"title":"ModelRegistry.is_pipeline_cached(task, modelId, [options])","local":"modelregistryispipelinecachedtask-modelid-options","sections":[],"depth":4},{"title":"ModelRegistry.is_pipeline_cached_files(task, modelId, [options])","local":"modelregistryispipelinecachedfilestask-modelid-options","sections":[],"depth":4},{"title":"ModelRegistry.get_file_metadata(path_or_repo_id, filename, [options])","local":"modelregistrygetfilemetadatapathorrepoid-filename-options","sections":[],"depth":4},{"title":"ModelRegistry.clear_cache(modelId, [options])","local":"modelregistryclearcachemodelid-options","sections":[],"depth":4},{"title":"ModelRegistry.clear_pipeline_cache(task, modelId, [options])","local":"modelregistryclearpipelinecachetask-modelid-options","sections":[],"depth":4}],"depth":3}],"depth":2}],"depth":1}"><!-- HEAD_svelte-u9bgzb_END --> <p></p> <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="utilsmodelregistry" 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="#utilsmodelregistry"><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>utils/model_registry</span></h1> <p data-svelte-h="svelte-1ysh8k8">Model registry for cache and file operations</p> <p data-svelte-h="svelte-ef8roz">Provides static methods for:</p> <ul data-svelte-h="svelte-17b0l0d"><li>Discovering which files a model needs</li> <li>Detecting available quantization levels (dtypes)</li> <li>Getting file metadata</li> <li>Checking cache status</li></ul> <p data-svelte-h="svelte-1hcetp5"><strong>Example:</strong> Get all files needed for a model</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="language-javascript "><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> files = <span class="hljs-keyword">await</span> <span class="hljs-title class_">ModelRegistry</span>.<span class="hljs-title function_">get_files</span>( | |
| <span class="hljs-string">"onnx-community/all-MiniLM-L6-v2-ONNX"</span>, | |
| { <span class="hljs-attr">dtype</span>: <span class="hljs-string">"fp16"</span> }, | |
| ); | |
| <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(files); <span class="hljs-comment">// [ 'config.json', 'onnx/model_fp16.onnx', 'onnx/model_fp16.onnx_data', 'tokenizer.json', 'tokenizer_config.json' ]</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-1t21awt"><strong>Example:</strong> Get all files needed for a specific pipeline task</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="language-javascript "><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> files = <span class="hljs-keyword">await</span> <span class="hljs-title class_">ModelRegistry</span>.<span class="hljs-title function_">get_pipeline_files</span>( | |
| <span class="hljs-string">"text-generation"</span>, | |
| <span class="hljs-string">"onnx-community/Qwen3-0.6B-ONNX"</span>, | |
| { <span class="hljs-attr">dtype</span>: <span class="hljs-string">"q4"</span> }, | |
| ); | |
| <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(files); <span class="hljs-comment">// [ 'config.json', 'onnx/model_q4.onnx', 'generation_config.json', 'tokenizer.json', 'tokenizer_config.json' ]</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-fgydvl"><strong>Example:</strong> Get specific component files</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="language-javascript "><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> modelFiles = <span class="hljs-keyword">await</span> <span class="hljs-title class_">ModelRegistry</span>.<span class="hljs-title function_">get_model_files</span>(<span class="hljs-string">"onnx-community/all-MiniLM-L6-v2-ONNX"</span>, { <span class="hljs-attr">dtype</span>: <span class="hljs-string">"q4"</span> }); | |
| <span class="hljs-keyword">const</span> tokenizerFiles = <span class="hljs-keyword">await</span> <span class="hljs-title class_">ModelRegistry</span>.<span class="hljs-title function_">get_tokenizer_files</span>(<span class="hljs-string">"onnx-community/all-MiniLM-L6-v2-ONNX"</span>); | |
| <span class="hljs-keyword">const</span> processorFiles = <span class="hljs-keyword">await</span> <span class="hljs-title class_">ModelRegistry</span>.<span class="hljs-title function_">get_processor_files</span>(<span class="hljs-string">"onnx-community/all-MiniLM-L6-v2-ONNX"</span>); | |
| <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(modelFiles); <span class="hljs-comment">// [ 'config.json', 'onnx/model_q4.onnx', 'onnx/model_q4.onnx_data' ]</span> | |
| <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(tokenizerFiles); <span class="hljs-comment">// [ 'tokenizer.json', 'tokenizer_config.json' ]</span> | |
| <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(processorFiles); <span class="hljs-comment">// [ ]</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-jce94a"><strong>Example:</strong> Detect available quantization levels for a model</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="language-javascript "><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> dtypes = <span class="hljs-keyword">await</span> <span class="hljs-title class_">ModelRegistry</span>.<span class="hljs-title function_">get_available_dtypes</span>(<span class="hljs-string">"onnx-community/all-MiniLM-L6-v2-ONNX"</span>); | |
| <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(dtypes); <span class="hljs-comment">// [ 'fp32', 'fp16', 'int8', 'uint8', 'q8', 'q4' ]</span> | |
| <span class="hljs-comment">// Use the result to pick the best available dtype</span> | |
| <span class="hljs-keyword">const</span> preferredDtype = dtypes.<span class="hljs-title function_">includes</span>(<span class="hljs-string">"q4"</span>) ? <span class="hljs-string">"q4"</span> : <span class="hljs-string">"fp32"</span>; | |
| <span class="hljs-keyword">const</span> files = <span class="hljs-keyword">await</span> <span class="hljs-title class_">ModelRegistry</span>.<span class="hljs-title function_">get_files</span>(<span class="hljs-string">"onnx-community/all-MiniLM-L6-v2-ONNX"</span>, { <span class="hljs-attr">dtype</span>: preferredDtype });<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-17bx9ku"><strong>Example:</strong> Check file metadata without downloading</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="language-javascript "><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> metadata = <span class="hljs-keyword">await</span> <span class="hljs-title class_">ModelRegistry</span>.<span class="hljs-title function_">get_file_metadata</span>( | |
| <span class="hljs-string">"onnx-community/Qwen3-0.6B-ONNX"</span>, | |
| <span class="hljs-string">"config.json"</span> | |
| ); | |
| <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(metadata); <span class="hljs-comment">// { exists: true, size: 912, contentType: 'application/json', fromCache: true }</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-2tnxgf"><strong>Example:</strong> Model cache management</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="language-javascript "><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> modelId = <span class="hljs-string">"onnx-community/Qwen3-0.6B-ONNX"</span>; | |
| <span class="hljs-keyword">const</span> options = { <span class="hljs-attr">dtype</span>: <span class="hljs-string">"q4"</span> }; | |
| <span class="hljs-comment">// Quickly check if the model is cached (probably false)</span> | |
| <span class="hljs-keyword">let</span> cached = <span class="hljs-keyword">await</span> <span class="hljs-title class_">ModelRegistry</span>.<span class="hljs-title function_">is_cached</span>(modelId, options); | |
| <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(cached); <span class="hljs-comment">// false</span> | |
| <span class="hljs-comment">// Get per-file cache detail</span> | |
| <span class="hljs-keyword">let</span> cacheStatus = <span class="hljs-keyword">await</span> <span class="hljs-title class_">ModelRegistry</span>.<span class="hljs-title function_">is_cached_files</span>(modelId, options); | |
| <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(cacheStatus); | |
| <span class="hljs-comment">// {</span> | |
| <span class="hljs-comment">// allCached: false,</span> | |
| <span class="hljs-comment">// files: [ { file: 'config.json', cached: true }, { file: 'onnx/model_q4.onnx', cached: false }, { file: 'generation_config.json', cached: false }, { file: 'tokenizer.json', cached: false }, { file: 'tokenizer_config.json', cached: false } ]</span> | |
| <span class="hljs-comment">// }</span> | |
| <span class="hljs-comment">// Download the model by instantiating a pipeline</span> | |
| <span class="hljs-keyword">const</span> generator = <span class="hljs-keyword">await</span> <span class="hljs-title function_">pipeline</span>(<span class="hljs-string">"text-generation"</span>, modelId, options); | |
| <span class="hljs-keyword">const</span> output = <span class="hljs-keyword">await</span> <span class="hljs-title function_">generator</span>( | |
| [{ <span class="hljs-attr">role</span>: <span class="hljs-string">"user"</span>, <span class="hljs-attr">content</span>: <span class="hljs-string">"What is the capital of France?"</span> }], | |
| { <span class="hljs-attr">max_new_tokens</span>: <span class="hljs-number">256</span>, <span class="hljs-attr">do_sample</span>: <span class="hljs-literal">false</span> }, | |
| ); | |
| <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(output[<span class="hljs-number">0</span>].<span class="hljs-property">generated_text</span>.<span class="hljs-title function_">at</span>(-<span class="hljs-number">1</span>).<span class="hljs-property">content</span>); <span class="hljs-comment">// <think>...</think>\n\nThe capital of France is **Paris**.</span> | |
| <span class="hljs-comment">// Check if the model is cached (should be true now)</span> | |
| cached = <span class="hljs-keyword">await</span> <span class="hljs-title class_">ModelRegistry</span>.<span class="hljs-title function_">is_cached</span>(modelId, options); | |
| <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(cached); <span class="hljs-comment">// true</span> | |
| <span class="hljs-comment">// Clear the cache</span> | |
| <span class="hljs-keyword">const</span> clearResult = <span class="hljs-keyword">await</span> <span class="hljs-title class_">ModelRegistry</span>.<span class="hljs-title function_">clear_cache</span>(modelId, options); | |
| <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(clearResult); | |
| <span class="hljs-comment">// {</span> | |
| <span class="hljs-comment">// filesDeleted: 5,</span> | |
| <span class="hljs-comment">// filesCached: 5,</span> | |
| <span class="hljs-comment">// files: [ { file: 'config.json', deleted: true, wasCached: true }, { file: 'onnx/model_q4.onnx', deleted: true, wasCached: true }, { file: 'generation_config.json', deleted: true, wasCached: true }, { file: 'tokenizer.json', deleted: true, wasCached: true }, { file: 'tokenizer_config.json', deleted: true, wasCached: true } ]</span> | |
| <span class="hljs-comment">// }</span> | |
| <span class="hljs-comment">// Check if the model is cached (should be false again)</span> | |
| cached = <span class="hljs-keyword">await</span> <span class="hljs-title class_">ModelRegistry</span>.<span class="hljs-title function_">is_cached</span>(modelId, options); | |
| <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(cached); <span class="hljs-comment">// false</span><!-- HTML_TAG_END --></pre></div> <h2 class="relative group"><a id="classes" 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="#classes"><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>Classes</span></h2> <a id="module_utils/model_registry.ModelRegistry"></a> <h3 class="relative group"><a id="modelregistry" 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="#modelregistry"><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>ModelRegistry</span></h3> <p data-svelte-h="svelte-1kd13al">Static class for cache and file management operations.</p> <a id="module_utils/model_registry.ModelRegistry.get_files"></a> <h4 class="relative group"><a id="modelregistrygetfilesmodelid-options" 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="#modelregistrygetfilesmodelid-options"><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>ModelRegistry.get_files(modelId, [options])</span></h4> <p data-svelte-h="svelte-lii7db">Get all files (model, tokenizer, processor) needed for a model.</p> <p data-svelte-h="svelte-11fqvcp"><strong>Parameters</strong></p> <ul data-svelte-h="svelte-8vj47h"><li><code>modelId</code> (<code>string</code>) — The model id (e.g., “onnx-community/bert-base-uncased-ONNX”)</li> <li><code>options</code> (<code>Object</code>) <em>optional</em> — Optional parameters | |
| <ul><li><code>config</code> (<a href="../configs#module_configs.PretrainedConfig"><code>PretrainedConfig</code></a>) <em>optional</em> — defaults to <code>null</code> — Pre-loaded config</li> <li><code>dtype</code> (<a href="../transformers#module_transformers.DataType"><code>DataType</code></a> | <code>Record</code><<code>string</code>, <a href="../transformers#module_transformers.DataType"><code>DataType</code></a>>) <em>optional</em> — defaults to <code>null</code> — Override dtype</li> <li><code>device</code> (<a href="../transformers#module_transformers.DeviceType"><code>DeviceType</code></a> | <code>Record</code><<code>string</code>, <a href="../transformers#module_transformers.DeviceType"><code>DeviceType</code></a>>) <em>optional</em> — defaults to <code>null</code> — Override device</li> <li><code>model_file_name</code> (<code>string</code>) <em>optional</em> — defaults to <code>null</code> — Override the model file name (excluding .onnx suffix)</li> <li><code>include_tokenizer</code> (<code>boolean</code>) <em>optional</em> — defaults to <code>true</code> — Whether to check for tokenizer files</li> <li><code>include_processor</code> (<code>boolean</code>) <em>optional</em> — defaults to <code>true</code> — Whether to check for processor files</li></ul></li></ul> <p data-svelte-h="svelte-1priee6"><strong>Returns:</strong> <code>Promise</code><<code>string[]</code>> — Array of file paths</p> <p data-svelte-h="svelte-9sr4u1"><strong>Example:</strong></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="language-javascript "><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> files = <span class="hljs-keyword">await</span> <span class="hljs-title class_">ModelRegistry</span>.<span class="hljs-title function_">get_files</span>(<span class="hljs-string">'onnx-community/gpt2-ONNX'</span>); | |
| <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(files); <span class="hljs-comment">// ['config.json', 'tokenizer.json', 'onnx/model_q4.onnx', ...]</span><!-- HTML_TAG_END --></pre></div> <a id="module_utils/model_registry.ModelRegistry.get_pipeline_files"></a> <h4 class="relative group"><a id="modelregistrygetpipelinefilestask-modelid-options" 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="#modelregistrygetpipelinefilestask-modelid-options"><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>ModelRegistry.get_pipeline_files(task, modelId, [options])</span></h4> <p data-svelte-h="svelte-5jfugd">Get all files needed for a specific pipeline task. | |
| Automatically determines which components are needed based on the task.</p> <p data-svelte-h="svelte-11fqvcp"><strong>Parameters</strong></p> <ul data-svelte-h="svelte-tnqij7"><li><code>task</code> (<code>string</code>) — The pipeline task (e.g., “text-generation”, “background-removal”)</li> <li><code>modelId</code> (<code>string</code>) — The model id (e.g., “onnx-community/bert-base-uncased-ONNX”)</li> <li><code>options</code> (<code>Object</code>) <em>optional</em> — Optional parameters | |
| <ul><li><code>config</code> (<a href="../configs#module_configs.PretrainedConfig"><code>PretrainedConfig</code></a>) <em>optional</em> — defaults to <code>null</code> — Pre-loaded config</li> <li><code>dtype</code> (<a href="../transformers#module_transformers.DataType"><code>DataType</code></a> | <code>Record</code><<code>string</code>, <a href="../transformers#module_transformers.DataType"><code>DataType</code></a>>) <em>optional</em> — defaults to <code>null</code> — Override dtype</li> <li><code>device</code> (<a href="../transformers#module_transformers.DeviceType"><code>DeviceType</code></a> | <code>Record</code><<code>string</code>, <a href="../transformers#module_transformers.DeviceType"><code>DeviceType</code></a>>) <em>optional</em> — defaults to <code>null</code> — Override device</li> <li><code>model_file_name</code> (<code>string</code>) <em>optional</em> — defaults to <code>null</code> — Override the model file name (excluding .onnx suffix)</li></ul></li></ul> <p data-svelte-h="svelte-1priee6"><strong>Returns:</strong> <code>Promise</code><<code>string[]</code>> — Array of file paths</p> <p data-svelte-h="svelte-9sr4u1"><strong>Example:</strong></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="language-javascript "><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> files = <span class="hljs-keyword">await</span> <span class="hljs-title class_">ModelRegistry</span>.<span class="hljs-title function_">get_pipeline_files</span>(<span class="hljs-string">'text-generation'</span>, <span class="hljs-string">'onnx-community/gpt2-ONNX'</span>); | |
| <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(files); <span class="hljs-comment">// ['config.json', 'tokenizer.json', 'onnx/model_q4.onnx', ...]</span><!-- HTML_TAG_END --></pre></div> <a id="module_utils/model_registry.ModelRegistry.get_model_files"></a> <h4 class="relative group"><a id="modelregistrygetmodelfilesmodelid-options" 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="#modelregistrygetmodelfilesmodelid-options"><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>ModelRegistry.get_model_files(modelId, [options])</span></h4> <p data-svelte-h="svelte-1hss116">Get model files needed for a specific model.</p> <p data-svelte-h="svelte-11fqvcp"><strong>Parameters</strong></p> <ul data-svelte-h="svelte-x5lqs6"><li><code>modelId</code> (<code>string</code>) — The model id</li> <li><code>options</code> (<code>Object</code>) <em>optional</em> — Optional parameters | |
| <ul><li><code>config</code> (<a href="../configs#module_configs.PretrainedConfig"><code>PretrainedConfig</code></a>) <em>optional</em> — defaults to <code>null</code> — Pre-loaded config</li> <li><code>dtype</code> (<a href="../transformers#module_transformers.DataType"><code>DataType</code></a> | <code>Record</code><<code>string</code>, <a href="../transformers#module_transformers.DataType"><code>DataType</code></a>>) <em>optional</em> — defaults to <code>null</code> — Override dtype</li> <li><code>device</code> (<a href="../transformers#module_transformers.DeviceType"><code>DeviceType</code></a> | <code>Record</code><<code>string</code>, <a href="../transformers#module_transformers.DeviceType"><code>DeviceType</code></a>>) <em>optional</em> — defaults to <code>null</code> — Override device</li> <li><code>model_file_name</code> (<code>string</code>) <em>optional</em> — defaults to <code>null</code> — Override the model file name (excluding .onnx suffix)</li></ul></li></ul> <p data-svelte-h="svelte-mulnx9"><strong>Returns:</strong> <code>Promise</code><<code>string[]</code>> — Array of model file paths</p> <p data-svelte-h="svelte-9sr4u1"><strong>Example:</strong></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="language-javascript "><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> files = <span class="hljs-keyword">await</span> <span class="hljs-title class_">ModelRegistry</span>.<span class="hljs-title function_">get_model_files</span>(<span class="hljs-string">'onnx-community/bert-base-uncased-ONNX'</span>); | |
| <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(files); <span class="hljs-comment">// ['config.json', 'onnx/model_q4.onnx', 'generation_config.json']</span><!-- HTML_TAG_END --></pre></div> <a id="module_utils/model_registry.ModelRegistry.get_tokenizer_files"></a> <h4 class="relative group"><a id="modelregistrygettokenizerfilesmodelid" 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="#modelregistrygettokenizerfilesmodelid"><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>ModelRegistry.get_tokenizer_files(modelId)</span></h4> <p data-svelte-h="svelte-19jkoey">Get tokenizer files needed for a specific model.</p> <p data-svelte-h="svelte-11fqvcp"><strong>Parameters</strong></p> <ul data-svelte-h="svelte-hpo67w"><li><code>modelId</code> (<code>string</code>) — The model id</li></ul> <p data-svelte-h="svelte-18sngmd"><strong>Returns:</strong> <code>Promise</code><<code>string[]</code>> — Array of tokenizer file paths</p> <p data-svelte-h="svelte-9sr4u1"><strong>Example:</strong></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="language-javascript "><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> files = <span class="hljs-keyword">await</span> <span class="hljs-title class_">ModelRegistry</span>.<span class="hljs-title function_">get_tokenizer_files</span>(<span class="hljs-string">'onnx-community/gpt2-ONNX'</span>); | |
| <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(files); <span class="hljs-comment">// ['tokenizer.json', 'tokenizer_config.json']</span><!-- HTML_TAG_END --></pre></div> <a id="module_utils/model_registry.ModelRegistry.get_processor_files"></a> <h4 class="relative group"><a id="modelregistrygetprocessorfilesmodelid" 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="#modelregistrygetprocessorfilesmodelid"><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>ModelRegistry.get_processor_files(modelId)</span></h4> <p data-svelte-h="svelte-nfbbaz">Get processor files needed for a specific model.</p> <p data-svelte-h="svelte-11fqvcp"><strong>Parameters</strong></p> <ul data-svelte-h="svelte-hpo67w"><li><code>modelId</code> (<code>string</code>) — The model id</li></ul> <p data-svelte-h="svelte-1rqy7cm"><strong>Returns:</strong> <code>Promise</code><<code>string[]</code>> — Array of processor file paths</p> <p data-svelte-h="svelte-9sr4u1"><strong>Example:</strong></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="language-javascript "><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> files = <span class="hljs-keyword">await</span> <span class="hljs-title class_">ModelRegistry</span>.<span class="hljs-title function_">get_processor_files</span>(<span class="hljs-string">'onnx-community/vit-base-patch16-224-ONNX'</span>); | |
| <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(files); <span class="hljs-comment">// ['preprocessor_config.json']</span><!-- HTML_TAG_END --></pre></div> <a id="module_utils/model_registry.ModelRegistry.get_available_dtypes"></a> <h4 class="relative group"><a id="modelregistrygetavailabledtypesmodelid-options" 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="#modelregistrygetavailabledtypesmodelid-options"><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>ModelRegistry.get_available_dtypes(modelId, [options])</span></h4> <p data-svelte-h="svelte-gkw8ba">Detects which quantization levels (dtypes) are available for a model | |
| by checking which ONNX files exist on the hub or locally.</p> <p data-svelte-h="svelte-j7xapm">A dtype is considered available if all required model session files | |
| exist for that dtype.</p> <p data-svelte-h="svelte-11fqvcp"><strong>Parameters</strong></p> <ul data-svelte-h="svelte-aj79rp"><li><code>modelId</code> (<code>string</code>) — The model id (e.g., “onnx-community/all-MiniLM-L6-v2-ONNX”)</li> <li><code>options</code> (<code>Object</code>) <em>optional</em> — Optional parameters | |
| <ul><li><code>config</code> (<a href="../configs#module_configs.PretrainedConfig"><code>PretrainedConfig</code></a>) <em>optional</em> — defaults to <code>null</code> — Pre-loaded config</li> <li><code>model_file_name</code> (<code>string</code>) <em>optional</em> — defaults to <code>null</code> — Override the model file name (excluding .onnx suffix)</li> <li><code>revision</code> (<code>string</code>) <em>optional</em> — defaults to <code>'main'</code> — Model revision</li> <li><code>cache_dir</code> (<code>string</code>) <em>optional</em> — defaults to <code>null</code> — Custom cache directory</li> <li><code>local_files_only</code> (<code>boolean</code>) <em>optional</em> — defaults to <code>false</code> — Only check local files</li></ul></li></ul> <p data-svelte-h="svelte-72mrwc"><strong>Returns:</strong> <code>Promise</code><<code>string[]</code>> — Array of available dtype strings (e.g., [‘fp32’, ‘fp16’, ‘q4’, ‘q8’])</p> <p data-svelte-h="svelte-9sr4u1"><strong>Example:</strong></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="language-javascript "><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> dtypes = <span class="hljs-keyword">await</span> <span class="hljs-title class_">ModelRegistry</span>.<span class="hljs-title function_">get_available_dtypes</span>(<span class="hljs-string">'onnx-community/all-MiniLM-L6-v2-ONNX'</span>); | |
| <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(dtypes); <span class="hljs-comment">// ['fp32', 'fp16', 'int8', 'uint8', 'q8', 'q4']</span><!-- HTML_TAG_END --></pre></div> <a id="module_utils/model_registry.ModelRegistry.is_cached"></a> <h4 class="relative group"><a id="modelregistryiscachedmodelid-options" 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="#modelregistryiscachedmodelid-options"><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>ModelRegistry.is_cached(modelId, [options])</span></h4> <p data-svelte-h="svelte-145ques">Quickly checks if a model is fully cached by verifying <code>config.json</code> is present, | |
| then confirming all required files are cached. | |
| Returns a plain boolean — use <code>is_cached_files</code> if you need per-file detail.</p> <p data-svelte-h="svelte-11fqvcp"><strong>Parameters</strong></p> <ul data-svelte-h="svelte-1u4yn1k"><li><code>modelId</code> (<code>string</code>) — The model id</li> <li><code>options</code> (<code>Object</code>) <em>optional</em> — Optional parameters | |
| <ul><li><code>cache_dir</code> (<code>string</code>) <em>optional</em> — Custom cache directory</li> <li><code>revision</code> (<code>string</code>) <em>optional</em> — Model revision (default: ‘main’)</li> <li><code>config</code> (<a href="../configs#module_configs.PretrainedConfig"><code>PretrainedConfig</code></a>) <em>optional</em> — Pre-loaded config</li> <li><code>dtype</code> (<a href="../transformers#module_transformers.DataType"><code>DataType</code></a> | <code>Record</code><<code>string</code>, <a href="../transformers#module_transformers.DataType"><code>DataType</code></a>>) <em>optional</em> — defaults to <code>null</code> — Override dtype</li> <li><code>device</code> (<a href="../transformers#module_transformers.DeviceType"><code>DeviceType</code></a> | <code>Record</code><<code>string</code>, <a href="../transformers#module_transformers.DeviceType"><code>DeviceType</code></a>>) <em>optional</em> — defaults to <code>null</code> — Override device</li></ul></li></ul> <p data-svelte-h="svelte-14o95q3"><strong>Returns:</strong> <code>Promise</code><<code>boolean</code>> — Whether all required files are cached</p> <p data-svelte-h="svelte-9sr4u1"><strong>Example:</strong></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="language-javascript "><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> cached = <span class="hljs-keyword">await</span> <span class="hljs-title class_">ModelRegistry</span>.<span class="hljs-title function_">is_cached</span>(<span class="hljs-string">'onnx-community/bert-base-uncased-ONNX'</span>); | |
| <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(cached); <span class="hljs-comment">// true or false</span><!-- HTML_TAG_END --></pre></div> <a id="module_utils/model_registry.ModelRegistry.is_cached_files"></a> <h4 class="relative group"><a id="modelregistryiscachedfilesmodelid-options" 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="#modelregistryiscachedfilesmodelid-options"><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>ModelRegistry.is_cached_files(modelId, [options])</span></h4> <p data-svelte-h="svelte-73r79c">Checks if all files for a given model are already cached, with per-file detail. | |
| Automatically determines which files are needed using get_files().</p> <p data-svelte-h="svelte-11fqvcp"><strong>Parameters</strong></p> <ul data-svelte-h="svelte-1u4yn1k"><li><code>modelId</code> (<code>string</code>) — The model id</li> <li><code>options</code> (<code>Object</code>) <em>optional</em> — Optional parameters | |
| <ul><li><code>cache_dir</code> (<code>string</code>) <em>optional</em> — Custom cache directory</li> <li><code>revision</code> (<code>string</code>) <em>optional</em> — Model revision (default: ‘main’)</li> <li><code>config</code> (<a href="../configs#module_configs.PretrainedConfig"><code>PretrainedConfig</code></a>) <em>optional</em> — Pre-loaded config</li> <li><code>dtype</code> (<a href="../transformers#module_transformers.DataType"><code>DataType</code></a> | <code>Record</code><<code>string</code>, <a href="../transformers#module_transformers.DataType"><code>DataType</code></a>>) <em>optional</em> — defaults to <code>null</code> — Override dtype</li> <li><code>device</code> (<a href="../transformers#module_transformers.DeviceType"><code>DeviceType</code></a> | <code>Record</code><<code>string</code>, <a href="../transformers#module_transformers.DeviceType"><code>DeviceType</code></a>>) <em>optional</em> — defaults to <code>null</code> — Override device</li></ul></li></ul> <p data-svelte-h="svelte-1tsy5cr"><strong>Returns:</strong> <code>Promise</code><<code>CacheCheckResult</code>> — Object with allCached boolean and files array with cache status</p> <p data-svelte-h="svelte-9sr4u1"><strong>Example:</strong></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="language-javascript "><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> status = <span class="hljs-keyword">await</span> <span class="hljs-title class_">ModelRegistry</span>.<span class="hljs-title function_">is_cached_files</span>(<span class="hljs-string">'onnx-community/bert-base-uncased-ONNX'</span>); | |
| <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(status.<span class="hljs-property">allCached</span>); <span class="hljs-comment">// true or false</span> | |
| <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(status.<span class="hljs-property">files</span>); <span class="hljs-comment">// [{ file: 'config.json', cached: true }, ...]</span><!-- HTML_TAG_END --></pre></div> <a id="module_utils/model_registry.ModelRegistry.is_pipeline_cached"></a> <h4 class="relative group"><a id="modelregistryispipelinecachedtask-modelid-options" 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="#modelregistryispipelinecachedtask-modelid-options"><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>ModelRegistry.is_pipeline_cached(task, modelId, [options])</span></h4> <p data-svelte-h="svelte-sv13fs">Quickly checks if all files for a specific pipeline task are cached by verifying | |
| <code>config.json</code> is present, then confirming all required files are cached. | |
| Returns a plain boolean — use <code>is_pipeline_cached_files</code> if you need per-file detail.</p> <p data-svelte-h="svelte-11fqvcp"><strong>Parameters</strong></p> <ul data-svelte-h="svelte-yq31w6"><li><code>task</code> (<code>string</code>) — The pipeline task (e.g., “text-generation”, “background-removal”)</li> <li><code>modelId</code> (<code>string</code>) — The model id</li> <li><code>options</code> (<code>Object</code>) <em>optional</em> — Optional parameters | |
| <ul><li><code>cache_dir</code> (<code>string</code>) <em>optional</em> — Custom cache directory</li> <li><code>revision</code> (<code>string</code>) <em>optional</em> — Model revision (default: ‘main’)</li> <li><code>config</code> (<a href="../configs#module_configs.PretrainedConfig"><code>PretrainedConfig</code></a>) <em>optional</em> — Pre-loaded config</li> <li><code>dtype</code> (<a href="../transformers#module_transformers.DataType"><code>DataType</code></a> | <code>Record</code><<code>string</code>, <a href="../transformers#module_transformers.DataType"><code>DataType</code></a>>) <em>optional</em> — defaults to <code>null</code> — Override dtype</li> <li><code>device</code> (<a href="../transformers#module_transformers.DeviceType"><code>DeviceType</code></a> | <code>Record</code><<code>string</code>, <a href="../transformers#module_transformers.DeviceType"><code>DeviceType</code></a>>) <em>optional</em> — defaults to <code>null</code> — Override device</li></ul></li></ul> <p data-svelte-h="svelte-14o95q3"><strong>Returns:</strong> <code>Promise</code><<code>boolean</code>> — Whether all required files are cached</p> <p data-svelte-h="svelte-9sr4u1"><strong>Example:</strong></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="language-javascript "><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> cached = <span class="hljs-keyword">await</span> <span class="hljs-title class_">ModelRegistry</span>.<span class="hljs-title function_">is_pipeline_cached</span>(<span class="hljs-string">'text-generation'</span>, <span class="hljs-string">'onnx-community/gpt2-ONNX'</span>); | |
| <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(cached); <span class="hljs-comment">// true or false</span><!-- HTML_TAG_END --></pre></div> <a id="module_utils/model_registry.ModelRegistry.is_pipeline_cached_files"></a> <h4 class="relative group"><a id="modelregistryispipelinecachedfilestask-modelid-options" 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="#modelregistryispipelinecachedfilestask-modelid-options"><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>ModelRegistry.is_pipeline_cached_files(task, modelId, [options])</span></h4> <p data-svelte-h="svelte-x8opf5">Checks if all files for a specific pipeline task are already cached, with per-file detail. | |
| Automatically determines which components are needed based on the task.</p> <p data-svelte-h="svelte-11fqvcp"><strong>Parameters</strong></p> <ul data-svelte-h="svelte-yq31w6"><li><code>task</code> (<code>string</code>) — The pipeline task (e.g., “text-generation”, “background-removal”)</li> <li><code>modelId</code> (<code>string</code>) — The model id</li> <li><code>options</code> (<code>Object</code>) <em>optional</em> — Optional parameters | |
| <ul><li><code>cache_dir</code> (<code>string</code>) <em>optional</em> — Custom cache directory</li> <li><code>revision</code> (<code>string</code>) <em>optional</em> — Model revision (default: ‘main’)</li> <li><code>config</code> (<a href="../configs#module_configs.PretrainedConfig"><code>PretrainedConfig</code></a>) <em>optional</em> — Pre-loaded config</li> <li><code>dtype</code> (<a href="../transformers#module_transformers.DataType"><code>DataType</code></a> | <code>Record</code><<code>string</code>, <a href="../transformers#module_transformers.DataType"><code>DataType</code></a>>) <em>optional</em> — defaults to <code>null</code> — Override dtype</li> <li><code>device</code> (<a href="../transformers#module_transformers.DeviceType"><code>DeviceType</code></a> | <code>Record</code><<code>string</code>, <a href="../transformers#module_transformers.DeviceType"><code>DeviceType</code></a>>) <em>optional</em> — defaults to <code>null</code> — Override device</li></ul></li></ul> <p data-svelte-h="svelte-1tsy5cr"><strong>Returns:</strong> <code>Promise</code><<code>CacheCheckResult</code>> — Object with allCached boolean and files array with cache status</p> <p data-svelte-h="svelte-9sr4u1"><strong>Example:</strong></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="language-javascript "><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> status = <span class="hljs-keyword">await</span> <span class="hljs-title class_">ModelRegistry</span>.<span class="hljs-title function_">is_pipeline_cached_files</span>(<span class="hljs-string">'text-generation'</span>, <span class="hljs-string">'onnx-community/gpt2-ONNX'</span>); | |
| <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(status.<span class="hljs-property">allCached</span>); <span class="hljs-comment">// true or false</span> | |
| <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(status.<span class="hljs-property">files</span>); <span class="hljs-comment">// [{ file: 'config.json', cached: true }, ...]</span><!-- HTML_TAG_END --></pre></div> <a id="module_utils/model_registry.ModelRegistry.get_file_metadata"></a> <h4 class="relative group"><a id="modelregistrygetfilemetadatapathorrepoid-filename-options" 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="#modelregistrygetfilemetadatapathorrepoid-filename-options"><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>ModelRegistry.get_file_metadata(path_or_repo_id, filename, [options])</span></h4> <p data-svelte-h="svelte-q41ox2">Get metadata for a specific file without downloading it.</p> <p data-svelte-h="svelte-11fqvcp"><strong>Parameters</strong></p> <ul data-svelte-h="svelte-1wse5sq"><li><code>path_or_repo_id</code> (<code>string</code>) — Model id or path</li> <li><code>filename</code> (<code>string</code>) — The file name</li> <li><code>options</code> (<a href="./hub#module_utils/hub.PretrainedOptions"><code>PretrainedOptions</code></a>) <em>optional</em> — Optional parameters</li></ul> <p data-svelte-h="svelte-lqodnn"><strong>Returns:</strong> <code>Promise</code><<code>object</code>> — File metadata</p> <p data-svelte-h="svelte-9sr4u1"><strong>Example:</strong></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="language-javascript "><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> metadata = <span class="hljs-keyword">await</span> <span class="hljs-title class_">ModelRegistry</span>.<span class="hljs-title function_">get_file_metadata</span>(<span class="hljs-string">'onnx-community/gpt2-ONNX'</span>, <span class="hljs-string">'config.json'</span>); | |
| <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(metadata.<span class="hljs-property">exists</span>, metadata.<span class="hljs-property">size</span>); <span class="hljs-comment">// true, 665</span><!-- HTML_TAG_END --></pre></div> <a id="module_utils/model_registry.ModelRegistry.clear_cache"></a> <h4 class="relative group"><a id="modelregistryclearcachemodelid-options" 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="#modelregistryclearcachemodelid-options"><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>ModelRegistry.clear_cache(modelId, [options])</span></h4> <p data-svelte-h="svelte-1m87x63">Clears all cached files for a given model. | |
| Automatically determines which files are needed and removes them from the cache.</p> <p data-svelte-h="svelte-11fqvcp"><strong>Parameters</strong></p> <ul data-svelte-h="svelte-15dx4bp"><li><code>modelId</code> (<code>string</code>) — The model id (e.g., “onnx-community/gpt2-ONNX”)</li> <li><code>options</code> (<code>Object</code>) <em>optional</em> — Optional parameters | |
| <ul><li><code>cache_dir</code> (<code>string</code>) <em>optional</em> — Custom cache directory</li> <li><code>revision</code> (<code>string</code>) <em>optional</em> — Model revision (default: ‘main’)</li> <li><code>config</code> (<a href="../configs#module_configs.PretrainedConfig"><code>PretrainedConfig</code></a>) <em>optional</em> — Pre-loaded config</li> <li><code>dtype</code> (<a href="../transformers#module_transformers.DataType"><code>DataType</code></a> | <code>Record</code><<code>string</code>, <a href="../transformers#module_transformers.DataType"><code>DataType</code></a>>) <em>optional</em> — Override dtype</li> <li><code>device</code> (<a href="../transformers#module_transformers.DeviceType"><code>DeviceType</code></a> | <code>Record</code><<code>string</code>, <a href="../transformers#module_transformers.DeviceType"><code>DeviceType</code></a>>) <em>optional</em> — Override device</li> <li><code>include_tokenizer</code> (<code>boolean</code>) <em>optional</em> — defaults to <code>true</code> — Whether to clear tokenizer files</li> <li><code>include_processor</code> (<code>boolean</code>) <em>optional</em> — defaults to <code>true</code> — Whether to clear processor files</li></ul></li></ul> <p data-svelte-h="svelte-wn8cjk"><strong>Returns:</strong> <code>Promise</code><<code>CacheClearResult</code>> — Object with deletion statistics and file status</p> <p data-svelte-h="svelte-9sr4u1"><strong>Example:</strong></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="language-javascript "><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> result = <span class="hljs-keyword">await</span> <span class="hljs-title class_">ModelRegistry</span>.<span class="hljs-title function_">clear_cache</span>(<span class="hljs-string">'onnx-community/bert-base-uncased-ONNX'</span>); | |
| <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">`Deleted <span class="hljs-subst">${result.filesDeleted}</span> of <span class="hljs-subst">${result.filesCached}</span> cached files`</span>);<!-- HTML_TAG_END --></pre></div> <a id="module_utils/model_registry.ModelRegistry.clear_pipeline_cache"></a> <h4 class="relative group"><a id="modelregistryclearpipelinecachetask-modelid-options" 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="#modelregistryclearpipelinecachetask-modelid-options"><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>ModelRegistry.clear_pipeline_cache(task, modelId, [options])</span></h4> <p data-svelte-h="svelte-8fr5k0">Clears all cached files for a specific pipeline task. | |
| Automatically determines which components are needed based on the task.</p> <p data-svelte-h="svelte-11fqvcp"><strong>Parameters</strong></p> <ul data-svelte-h="svelte-g32j0q"><li><code>task</code> (<code>string</code>) — The pipeline task (e.g., “text-generation”, “image-classification”)</li> <li><code>modelId</code> (<code>string</code>) — The model id (e.g., “onnx-community/gpt2-ONNX”)</li> <li><code>options</code> (<code>Object</code>) <em>optional</em> — Optional parameters | |
| <ul><li><code>cache_dir</code> (<code>string</code>) <em>optional</em> — Custom cache directory</li> <li><code>revision</code> (<code>string</code>) <em>optional</em> — Model revision (default: ‘main’)</li> <li><code>config</code> (<a href="../configs#module_configs.PretrainedConfig"><code>PretrainedConfig</code></a>) <em>optional</em> — Pre-loaded config</li> <li><code>dtype</code> (<a href="../transformers#module_transformers.DataType"><code>DataType</code></a> | <code>Record</code><<code>string</code>, <a href="../transformers#module_transformers.DataType"><code>DataType</code></a>>) <em>optional</em> — Override dtype</li> <li><code>device</code> (<a href="../transformers#module_transformers.DeviceType"><code>DeviceType</code></a> | <code>Record</code><<code>string</code>, <a href="../transformers#module_transformers.DeviceType"><code>DeviceType</code></a>>) <em>optional</em> — Override device</li></ul></li></ul> <p data-svelte-h="svelte-wn8cjk"><strong>Returns:</strong> <code>Promise</code><<code>CacheClearResult</code>> — Object with deletion statistics and file status</p> <p data-svelte-h="svelte-9sr4u1"><strong>Example:</strong></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="language-javascript "><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> result = <span class="hljs-keyword">await</span> <span class="hljs-title class_">ModelRegistry</span>.<span class="hljs-title function_">clear_pipeline_cache</span>(<span class="hljs-string">'text-generation'</span>, <span class="hljs-string">'onnx-community/gpt2-ONNX'</span>); | |
| <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">`Deleted <span class="hljs-subst">${result.filesDeleted}</span> of <span class="hljs-subst">${result.filesCached}</span> cached files`</span>);<!-- HTML_TAG_END --></pre></div> <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/utils/model_registry.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_1t06csc = { | |
| assets: "/docs/transformers.js/pr_1665/en", | |
| base: "/docs/transformers.js/pr_1665/en", | |
| env: {} | |
| }; | |
| const element = document.currentScript.parentElement; | |
| const data = [null,null]; | |
| Promise.all([ | |
| import("/docs/transformers.js/pr_1665/en/_app/immutable/entry/start.cb58eb6f.js"), | |
| import("/docs/transformers.js/pr_1665/en/_app/immutable/entry/app.9eafcf9d.js") | |
| ]).then(([kit, app]) => { | |
| kit.start(app, element, { | |
| node_ids: [0, 21], | |
| data, | |
| form: null, | |
| error: null | |
| }); | |
| }); | |
| } | |
| </script> | |
Xet Storage Details
- Size:
- 91.5 kB
- Xet hash:
- 7e934ed9d5a2afa9a950613fa7584216df52cc45bd00adf6f9c27b580f63238f
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.