import{s as Y,n as z,o as A}from"../chunks/scheduler.5f3e6389.js";import{S as P,i as H,e as w,s as n,c as M,h as N,a as J,d as a,b as o,f as U,g as $,j as F,k as R,l as q,m as l,n as T,t as y,o as b,p as h}from"../chunks/index.373ab25c.js";import{C as O,H as Q}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.3893c80c.js";import{C as E}from"../chunks/CodeBlock.d3463551.js";function D(C){let s,_,x,B,m,Z,r,g,i,v,p,V="You can export your models to ONNX easily:",X,c,j,f,k,u,S="To load a model and run inference, you can just replace your <code>AutoModelForCausalLM</code> class with the corresponding <code>ORTModelForCausalLM</code> class. You can also load a PyTorch checkpoint and convert it to ONNX on-the-fly when loading your model.",G,d,L,W,I;return m=new O({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),r=new Q({props:{title:"Quickstart",local:"quickstart",headingTag:"h1"}}),i=new Q({props:{title:"Export",local:"export",headingTag:"h2"}}),c=new E({props:{code:"b3B0aW11bS1jbGklMjBleHBvcnQlMjBvbm54JTIwLS1tb2RlbCUyMG1ldGEtbGxhbWElMkZMbGFtYS0zLjItMUIlMjAtLW91dHB1dF9kaXIlMjBtZXRhX2xsYW1hM18yXzFiX29ubng=",highlighted:'optimum-cli <span class="hljs-built_in">export</span> onnx --model meta-llama/Llama-3.2-1B --output_dir meta_llama3_2_1b_onnx',wrap:!1}}),f=new Q({props:{title:"Inference",local:"inference",headingTag:"h2"}}),d=new E({props:{code:"LSUyMGZyb20lMjB0cmFuc2Zvcm1lcnMlMjBpbXBvcnQlMjBBdXRvTW9kZWxGb3JDYXVzYWxMTSUwQSUyQiUyMGZyb20lMjBvcHRpbXVtLm9ubnhydW50aW1lJTIwaW1wb3J0JTIwT1JUTW9kZWxGb3JDYXVzYWxMTSUwQSUyMCUyMGZyb20lMjB0cmFuc2Zvcm1lcnMlMjBpbXBvcnQlMjBBdXRvVG9rZW5pemVyJTBBJTBBJTIwJTIwbW9kZWxfaWQlMjAlM0QlMjAlMjJtZXRhLWxsYW1hJTJGTGxhbWEtMy4yLTFCJTIyJTBBJTIwJTIwdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQobW9kZWxfaWQpJTBBLSUyMG1vZGVsJTIwJTNEJTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKG1vZGVsX2lkKSUwQSUyQiUyMG1vZGVsJTIwJTNEJTIwT1JUTW9kZWxGb3JDYXVzYWxMTS5mcm9tX3ByZXRyYWluZWQobW9kZWxfaWQp",highlighted:`<span class="hljs-deletion">- from transformers import AutoModelForCausalLM</span>
<span class="hljs-addition">+ from optimum.onnxruntime import ORTModelForCausalLM</span>
  from transformers import AutoTokenizer

  model_id = &quot;meta-llama/Llama-3.2-1B&quot;
  tokenizer = AutoTokenizer.from_pretrained(model_id)
<span class="hljs-deletion">- model = AutoModelForCausalLM.from_pretrained(model_id)</span>
<span class="hljs-addition">+ model = ORTModelForCausalLM.from_pretrained(model_id)</span>`,wrap:!1}}),{c(){s=w("meta"),_=n(),x=w("p"),B=n(),M(m.$$.fragment),Z=n(),M(r.$$.fragment),g=n(),M(i.$$.fragment),v=n(),p=w("p"),p.textContent=V,X=n(),M(c.$$.fragment),j=n(),M(f.$$.fragment),k=n(),u=w("p"),u.innerHTML=S,G=n(),M(d.$$.fragment),L=n(),W=w("p"),this.h()},l(e){const t=N("svelte-u9bgzb",document.head);s=J(t,"META",{name:!0,content:!0}),t.forEach(a),_=o(e),x=J(e,"P",{}),U(x).forEach(a),B=o(e),$(m.$$.fragment,e),Z=o(e),$(r.$$.fragment,e),g=o(e),$(i.$$.fragment,e),v=o(e),p=J(e,"P",{"data-svelte-h":!0}),F(p)!=="svelte-1h55u71"&&(p.textContent=V),X=o(e),$(c.$$.fragment,e),j=o(e),$(f.$$.fragment,e),k=o(e),u=J(e,"P",{"data-svelte-h":!0}),F(u)!=="svelte-10o8ew2"&&(u.innerHTML=S),G=o(e),$(d.$$.fragment,e),L=o(e),W=J(e,"P",{}),U(W).forEach(a),this.h()},h(){R(s,"name","hf:doc:metadata"),R(s,"content",K)},m(e,t){q(document.head,s),l(e,_,t),l(e,x,t),l(e,B,t),T(m,e,t),l(e,Z,t),T(r,e,t),l(e,g,t),T(i,e,t),l(e,v,t),l(e,p,t),l(e,X,t),T(c,e,t),l(e,j,t),T(f,e,t),l(e,k,t),l(e,u,t),l(e,G,t),T(d,e,t),l(e,L,t),l(e,W,t),I=!0},p:z,i(e){I||(y(m.$$.fragment,e),y(r.$$.fragment,e),y(i.$$.fragment,e),y(c.$$.fragment,e),y(f.$$.fragment,e),y(d.$$.fragment,e),I=!0)},o(e){b(m.$$.fragment,e),b(r.$$.fragment,e),b(i.$$.fragment,e),b(c.$$.fragment,e),b(f.$$.fragment,e),b(d.$$.fragment,e),I=!1},d(e){e&&(a(_),a(x),a(B),a(Z),a(g),a(v),a(p),a(X),a(j),a(k),a(u),a(G),a(L),a(W)),a(s),h(m,e),h(r,e),h(i,e),h(c,e),h(f,e),h(d,e)}}}const K='{"title":"Quickstart","local":"quickstart","sections":[{"title":"Export","local":"export","sections":[],"depth":2},{"title":"Inference","local":"inference","sections":[],"depth":2}],"depth":1}';function ee(C){return A(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class oe extends P{constructor(s){super(),H(this,s,ee,D,Y,{})}}export{oe as component};
