import{s as ue,o as ce,n as Me}from"../chunks/scheduler.01eeda35.js";import{S as he,i as Te,g as r,s as a,r as h,A as we,h as m,f as l,c as o,j as fe,u as T,x as c,k as de,y as be,a as i,v as w,d as b,t as g,w as $}from"../chunks/index.6dd51b66.js";import{T as ge}from"../chunks/Tip.de9bae2b.js";import{C as H}from"../chunks/CodeBlock.19ec9b8c.js";import{H as $e,E as Ue}from"../chunks/index.58fe8f9d.js";function ye(R){let s,U='Refer to the <a href="https://huggingface.co/docs/optimum/main/en/exporters/tflite/usage_guides/export_a_model" rel="nofollow">Export a model to TFLite with optimum.exporters.tflite</a> guide for all available arguments or with the command below.',u,p,f;return p=new H({props:{code:"b3B0aW11bS1jbGklMjBleHBvcnQlMjB0ZmxpdGUlMjAtLWhlbHA=",highlighted:'optimum-cli <span class="hljs-built_in">export</span> tflite --<span class="hljs-built_in">help</span>',wrap:!1}}),{c(){s=r("p"),s.innerHTML=U,u=a(),h(p.$$.fragment)},l(n){s=m(n,"P",{"data-svelte-h":!0}),c(s)!=="svelte-fkoen8"&&(s.innerHTML=U),u=o(n),T(p.$$.fragment,n)},m(n,d){i(n,s,d),i(n,u,d),w(p,n,d),f=!0},p:Me,i(n){f||(b(p.$$.fragment,n),f=!0)},o(n){g(p.$$.fragment,n),f=!1},d(n){n&&(l(s),l(u)),$(p,n)}}}function Je(R){let s,U,u,p,f,n,d,te='<a href="https://ai.google.dev/edge/litert" rel="nofollow">LiteRT</a> (previously known as TensorFlow Lite) is a high-performance runtime designed for on-device machine learning.',F,y,le='The <a href="https://huggingface.co/docs/optimum/index" rel="nofollow">Optimum</a> library exports a model to LiteRT for <a href="(https://huggingface.co/docs/optimum/exporters/onnx/overview)">many architectures</a>.',W,J,ie="The benefits of exporting to LiteRT include the following.",S,x,ne="<li>Low-latency, privacy-focused, no internet connectivity required, and reduced model size and power consumption for on-device machine learning.</li> <li>Broad platform, model framework, and language support.</li> <li>Hardware acceleration for GPUs and Apple Silicon.</li>",X,G,ae="Export a Transformers model to LiteRT with the Optimum CLI.",Y,v,oe='Run the command below to install Optimum and the <a href="https://huggingface.co/docs/optimum/exporters/overview" rel="nofollow">exporters</a> module for LiteRT.',Q,j,A,M,z,Z,se="Set the <code>--model</code> argument to export a from the Hub.",N,L,E,B,re="You should see logs indicating the progress and showing where the resulting <code>model.tflite</code> is saved.",P,_,D,V,me='For local models, make sure the model weights and tokenizer files are saved in the same directory, for example <code>local_path</code>. Pass the directory to the <code>--model</code> argument and use <code>--task</code> to indicate the <a href="https://huggingface.co/docs/optimum/exporters/task_manager" rel="nofollow">task</a> a model can perform. If <code>--task</code> isn’t provided, the model architecture without a task-specific head is used.',q,C,O,I,K,k,ee;return f=new $e({props:{title:"LiteRT",local:"litert",headingTag:"h1"}}),j=new H({props:{code:"cGlwJTIwaW5zdGFsbCUyMG9wdGltdW0lNUJleHBvcnRlcnMtdGYlNUQ=",highlighted:"pip install optimum[exporters-tf]",wrap:!1}}),M=new ge({props:{warning:!1,$$slots:{default:[ye]},$$scope:{ctx:R}}}),L=new H({props:{code:"b3B0aW11bS1jbGklMjBleHBvcnQlMjB0ZmxpdGUlMjAtLW1vZGVsJTIwZ29vZ2xlLWJlcnQlMkZiZXJ0LWJhc2UtdW5jYXNlZCUyMC0tc2VxdWVuY2VfbGVuZ3RoJTIwMTI4JTIwYmVydF90ZmxpdGUlMkY=",highlighted:'optimum-cli <span class="hljs-built_in">export</span> tflite --model google-bert/bert-base-uncased --sequence_length 128 bert_tflite/',wrap:!1}}),_=new H({props:{code:"VmFsaWRhdGluZyUyMFRGTGl0ZSUyMG1vZGVsLi4uJTBBJTA5LSU1QiVFMiU5QyU5MyU1RCUyMFRGTGl0ZSUyMG1vZGVsJTIwb3V0cHV0JTIwbmFtZXMlMjBtYXRjaCUyMHJlZmVyZW5jZSUyMG1vZGVsJTIwKGxvZ2l0cyklMEElMDktJTIwVmFsaWRhdGluZyUyMFRGTGl0ZSUyME1vZGVsJTIwb3V0cHV0JTIwJTIybG9naXRzJTIyJTNBJTBBJTA5JTA5LSU1QiVFMiU5QyU5MyU1RCUyMCgxJTJDJTIwMTI4JTJDJTIwMzA1MjIpJTIwbWF0Y2hlcyUyMCgxJTJDJTIwMTI4JTJDJTIwMzA1MjIpJTBBJTA5JTA5LSU1QnglNUQlMjB2YWx1ZXMlMjBub3QlMjBjbG9zZSUyMGVub3VnaCUyQyUyMG1heCUyMGRpZmYlM0ElMjA1LjgxNzQxMzMzMDA3ODEyNWUtMDUlMjAoYXRvbCUzQSUyMDFlLTA1KSUwQVRoZSUyMFRlbnNvckZsb3clMjBMaXRlJTIwZXhwb3J0JTIwc3VjY2VlZGVkJTIwd2l0aCUyMHRoZSUyMHdhcm5pbmclM0ElMjBUaGUlMjBtYXhpbXVtJTIwYWJzb2x1dGUlMjBkaWZmZXJlbmNlJTIwYmV0d2VlbiUyMHRoZSUyMG91dHB1dCUyMG9mJTIwdGhlJTIwcmVmZXJlbmNlJTIwbW9kZWwlMjBhbmQlMjB0aGUlMjBURkxpdGUlMjBleHBvcnRlZCUyMG1vZGVsJTIwaXMlMjBub3QlMjB3aXRoaW4lMjB0aGUlMjBzZXQlMjB0b2xlcmFuY2UlMjAxZS0wNSUzQSUwQS0lMjBsb2dpdHMlM0ElMjBtYXglMjBkaWZmJTIwJTNEJTIwNS44MTc0MTMzMzAwNzgxMjVlLTA1LiUwQSUyMFRoZSUyMGV4cG9ydGVkJTIwbW9kZWwlMjB3YXMlMjBzYXZlZCUyMGF0JTNBJTIwYmVydF90ZmxpdGU=",highlighted:`Validating TFLite model...
	-[✓] TFLite model output names match reference model (logits)
	- Validating TFLite Model output <span class="hljs-string">&quot;logits&quot;</span>:
		-[✓] (1, 128, 30522) matches (1, 128, 30522)
		-[x] values not close enough, max diff: 5.817413330078125e-05 (atol: 1e-05)
The TensorFlow Lite <span class="hljs-built_in">export</span> succeeded with the warning: The maximum absolute difference between the output of the reference model and the TFLite exported model is not within the <span class="hljs-built_in">set</span> tolerance 1e-05:
- logits: max diff = 5.817413330078125e-05.
 The exported model was saved at: bert_tflite`,wrap:!1}}),C=new H({props:{code:"b3B0aW11bS1jbGklMjBleHBvcnQlMjB0ZmxpdGUlMjAtLW1vZGVsJTIwbG9jYWxfcGF0aCUyMC0tdGFzayUyMHF1ZXN0aW9uLWFuc3dlcmluZyUyMGdvb2dsZS1iZXJ0JTJGYmVydC1iYXNlLXVuY2FzZWQlMjAtLXNlcXVlbmNlX2xlbmd0aCUyMDEyOCUyMGJlcnRfdGZsaXRlJTJG",highlighted:'optimum-cli <span class="hljs-built_in">export</span> tflite --model local_path --task question-answering google-bert/bert-base-uncased --sequence_length 128 bert_tflite/',wrap:!1}}),I=new Ue({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/tflite.md"}}),{c(){s=r("meta"),U=a(),u=r("p"),p=a(),h(f.$$.fragment),n=a(),d=r("p"),d.innerHTML=te,F=a(),y=r("p"),y.innerHTML=le,W=a(),J=r("p"),J.textContent=ie,S=a(),x=r("ul"),x.innerHTML=ne,X=a(),G=r("p"),G.textContent=ae,Y=a(),v=r("p"),v.innerHTML=oe,Q=a(),h(j.$$.fragment),A=a(),h(M.$$.fragment),z=a(),Z=r("p"),Z.innerHTML=se,N=a(),h(L.$$.fragment),E=a(),B=r("p"),B.innerHTML=re,P=a(),h(_.$$.fragment),D=a(),V=r("p"),V.innerHTML=me,q=a(),h(C.$$.fragment),O=a(),h(I.$$.fragment),K=a(),k=r("p"),this.h()},l(e){const t=we("svelte-u9bgzb",document.head);s=m(t,"META",{name:!0,content:!0}),t.forEach(l),U=o(e),u=m(e,"P",{}),fe(u).forEach(l),p=o(e),T(f.$$.fragment,e),n=o(e),d=m(e,"P",{"data-svelte-h":!0}),c(d)!=="svelte-119vmcr"&&(d.innerHTML=te),F=o(e),y=m(e,"P",{"data-svelte-h":!0}),c(y)!=="svelte-1inyo6w"&&(y.innerHTML=le),W=o(e),J=m(e,"P",{"data-svelte-h":!0}),c(J)!=="svelte-17hh8gb"&&(J.textContent=ie),S=o(e),x=m(e,"UL",{"data-svelte-h":!0}),c(x)!=="svelte-vbljly"&&(x.innerHTML=ne),X=o(e),G=m(e,"P",{"data-svelte-h":!0}),c(G)!=="svelte-1s64gvt"&&(G.textContent=ae),Y=o(e),v=m(e,"P",{"data-svelte-h":!0}),c(v)!=="svelte-rj5saf"&&(v.innerHTML=oe),Q=o(e),T(j.$$.fragment,e),A=o(e),T(M.$$.fragment,e),z=o(e),Z=m(e,"P",{"data-svelte-h":!0}),c(Z)!=="svelte-15gv2f2"&&(Z.innerHTML=se),N=o(e),T(L.$$.fragment,e),E=o(e),B=m(e,"P",{"data-svelte-h":!0}),c(B)!=="svelte-7trkfk"&&(B.innerHTML=re),P=o(e),T(_.$$.fragment,e),D=o(e),V=m(e,"P",{"data-svelte-h":!0}),c(V)!=="svelte-611ab4"&&(V.innerHTML=me),q=o(e),T(C.$$.fragment,e),O=o(e),T(I.$$.fragment,e),K=o(e),k=m(e,"P",{}),fe(k).forEach(l),this.h()},h(){de(s,"name","hf:doc:metadata"),de(s,"content",xe)},m(e,t){be(document.head,s),i(e,U,t),i(e,u,t),i(e,p,t),w(f,e,t),i(e,n,t),i(e,d,t),i(e,F,t),i(e,y,t),i(e,W,t),i(e,J,t),i(e,S,t),i(e,x,t),i(e,X,t),i(e,G,t),i(e,Y,t),i(e,v,t),i(e,Q,t),w(j,e,t),i(e,A,t),w(M,e,t),i(e,z,t),i(e,Z,t),i(e,N,t),w(L,e,t),i(e,E,t),i(e,B,t),i(e,P,t),w(_,e,t),i(e,D,t),i(e,V,t),i(e,q,t),w(C,e,t),i(e,O,t),w(I,e,t),i(e,K,t),i(e,k,t),ee=!0},p(e,[t]){const pe={};t&2&&(pe.$$scope={dirty:t,ctx:e}),M.$set(pe)},i(e){ee||(b(f.$$.fragment,e),b(j.$$.fragment,e),b(M.$$.fragment,e),b(L.$$.fragment,e),b(_.$$.fragment,e),b(C.$$.fragment,e),b(I.$$.fragment,e),ee=!0)},o(e){g(f.$$.fragment,e),g(j.$$.fragment,e),g(M.$$.fragment,e),g(L.$$.fragment,e),g(_.$$.fragment,e),g(C.$$.fragment,e),g(I.$$.fragment,e),ee=!1},d(e){e&&(l(U),l(u),l(p),l(n),l(d),l(F),l(y),l(W),l(J),l(S),l(x),l(X),l(G),l(Y),l(v),l(Q),l(A),l(z),l(Z),l(N),l(E),l(B),l(P),l(D),l(V),l(q),l(O),l(K),l(k)),l(s),$(f,e),$(j,e),$(M,e),$(L,e),$(_,e),$(C,e),$(I,e)}}}const xe='{"title":"LiteRT","local":"litert","sections":[],"depth":1}';function Ge(R){return ce(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class _e extends he{constructor(s){super(),Te(this,s,Ge,Je,ue,{})}}export{_e as component};
