import{s as le,n as oe,o as ie}from"../chunks/scheduler.9bc65507.js";import{S as ne,i as se,g as s,s as i,r as y,A as ae,h as a,f as l,c as n,j as ee,u as j,x as J,k as te,y as me,a as o,v as G,d as Z,t as v,w as B}from"../chunks/index.707bf1b6.js";import{C as z}from"../chunks/CodeBlock.54a9f38d.js";import{H as re}from"../chunks/Heading.342b1fa6.js";function pe(X){let m,$,x,I,r,L,p,N=`<a href="https://www.tensorflow.org/lite/guide" rel="nofollow">TensorFlow Lite</a> is a lightweight framework for deploying machine learning models
on resource-constrained devices, such as mobile phones, embedded systems, and Internet of Things (IoT) devices.
TFLite is designed to optimize and run models efficiently on these devices with limited computational power, memory, and
power consumption.
A TensorFlow Lite model is represented in a special efficient portable format identified by the <code>.tflite</code> file extension.`,V,d,E=`🤗 Optimum offers functionality to export 🤗 Transformers models to TFLite through the <code>exporters.tflite</code> module.
For the list of supported model architectures, please refer to <a href="https://huggingface.co/docs/optimum/exporters/tflite/overview" rel="nofollow">🤗 Optimum documentation</a>.`,_,c,P="To export a model to TFLite, install the required dependencies:",F,f,H,M,D=`To check out all available arguments, refer to the <a href="https://huggingface.co/docs/optimum/main/en/exporters/tflite/usage_guides/export_a_model" rel="nofollow">🤗 Optimum docs</a>,
or view help in command line:`,k,u,C,h,q="To export a model’s checkpoint from the 🤗 Hub, for example, <code>google-bert/bert-base-uncased</code>, run the following command:",W,T,S,w,O="You should see the logs indicating progress and showing where the resulting <code>model.tflite</code> is saved, like this:",R,b,Q,U,K=`The example above illustrates exporting a checkpoint from 🤗 Hub. When exporting a local model, first make sure that you
saved both the model’s weights and tokenizer files in the same directory (<code>local_path</code>). When using CLI, pass the
<code>local_path</code> to the <code>model</code> argument instead of the checkpoint name on 🤗 Hub.`,A,g,Y;return r=new re({props:{title:"Export to TFLite",local:"export-to-tflite",headingTag:"h1"}}),f=new z({props:{code:"cGlwJTIwaW5zdGFsbCUyMG9wdGltdW0lNUJleHBvcnRlcnMtdGYlNUQ=",highlighted:"pip install optimum[exporters-tf]",wrap:!1}}),u=new z({props:{code:"b3B0aW11bS1jbGklMjBleHBvcnQlMjB0ZmxpdGUlMjAtLWhlbHA=",highlighted:'optimum-cli <span class="hljs-built_in">export</span> tflite --<span class="hljs-built_in">help</span>',wrap:!1}}),T=new z({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}}),b=new z({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(){m=s("meta"),$=i(),x=s("p"),I=i(),y(r.$$.fragment),L=i(),p=s("p"),p.innerHTML=N,V=i(),d=s("p"),d.innerHTML=E,_=i(),c=s("p"),c.textContent=P,F=i(),y(f.$$.fragment),H=i(),M=s("p"),M.innerHTML=D,k=i(),y(u.$$.fragment),C=i(),h=s("p"),h.innerHTML=q,W=i(),y(T.$$.fragment),S=i(),w=s("p"),w.innerHTML=O,R=i(),y(b.$$.fragment),Q=i(),U=s("p"),U.innerHTML=K,A=i(),g=s("p"),this.h()},l(e){const t=ae("svelte-u9bgzb",document.head);m=a(t,"META",{name:!0,content:!0}),t.forEach(l),$=n(e),x=a(e,"P",{}),ee(x).forEach(l),I=n(e),j(r.$$.fragment,e),L=n(e),p=a(e,"P",{"data-svelte-h":!0}),J(p)!=="svelte-1btfcc4"&&(p.innerHTML=N),V=n(e),d=a(e,"P",{"data-svelte-h":!0}),J(d)!=="svelte-m0va7t"&&(d.innerHTML=E),_=n(e),c=a(e,"P",{"data-svelte-h":!0}),J(c)!=="svelte-fibc5e"&&(c.textContent=P),F=n(e),j(f.$$.fragment,e),H=n(e),M=a(e,"P",{"data-svelte-h":!0}),J(M)!=="svelte-1ebb3ag"&&(M.innerHTML=D),k=n(e),j(u.$$.fragment,e),C=n(e),h=a(e,"P",{"data-svelte-h":!0}),J(h)!=="svelte-1qhuwrl"&&(h.innerHTML=q),W=n(e),j(T.$$.fragment,e),S=n(e),w=a(e,"P",{"data-svelte-h":!0}),J(w)!=="svelte-ptkmnx"&&(w.innerHTML=O),R=n(e),j(b.$$.fragment,e),Q=n(e),U=a(e,"P",{"data-svelte-h":!0}),J(U)!=="svelte-1a6s6im"&&(U.innerHTML=K),A=n(e),g=a(e,"P",{}),ee(g).forEach(l),this.h()},h(){te(m,"name","hf:doc:metadata"),te(m,"content",de)},m(e,t){me(document.head,m),o(e,$,t),o(e,x,t),o(e,I,t),G(r,e,t),o(e,L,t),o(e,p,t),o(e,V,t),o(e,d,t),o(e,_,t),o(e,c,t),o(e,F,t),G(f,e,t),o(e,H,t),o(e,M,t),o(e,k,t),G(u,e,t),o(e,C,t),o(e,h,t),o(e,W,t),G(T,e,t),o(e,S,t),o(e,w,t),o(e,R,t),G(b,e,t),o(e,Q,t),o(e,U,t),o(e,A,t),o(e,g,t),Y=!0},p:oe,i(e){Y||(Z(r.$$.fragment,e),Z(f.$$.fragment,e),Z(u.$$.fragment,e),Z(T.$$.fragment,e),Z(b.$$.fragment,e),Y=!0)},o(e){v(r.$$.fragment,e),v(f.$$.fragment,e),v(u.$$.fragment,e),v(T.$$.fragment,e),v(b.$$.fragment,e),Y=!1},d(e){e&&(l($),l(x),l(I),l(L),l(p),l(V),l(d),l(_),l(c),l(F),l(H),l(M),l(k),l(C),l(h),l(W),l(S),l(w),l(R),l(Q),l(U),l(A),l(g)),l(m),B(r,e),B(f,e),B(u,e),B(T,e),B(b,e)}}}const de='{"title":"Export to TFLite","local":"export-to-tflite","sections":[],"depth":1}';function ce(X){return ie(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Te extends ne{constructor(m){super(),se(this,m,ce,pe,le,{})}}export{Te as component};
