import{s as le,n as ie,o as oe}from"../chunks/scheduler.9bc65507.js";import{S as ne,i as se,g as s,s as o,r as g,A as ae,h as a,f as l,c as n,j as ee,u as G,x as y,k as te,y as me,a as i,v as j,d as v,t as B,w as Z}from"../chunks/index.707bf1b6.js";import{C as Q}from"../chunks/CodeBlock.54a9f38d.js";import{H as re}from"../chunks/Heading.342b1fa6.js";function pe(Y){let m,$,J,L,r,_,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.`,I,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>.`,V,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:`,C,u,k,h,q="To export a model’s checkpoint from the 🤗 Hub, for example, <code>bert-base-uncased</code>, run the following command:",S,T,R,w,O="You should see the logs indicating progress and showing where the resulting <code>model.tflite</code> is saved, like this:",W,b,X,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.`,z,x,A;return r=new re({props:{title:"Export to TFLite",local:"export-to-tflite",headingTag:"h1"}}),f=new Q({props:{code:"cGlwJTIwaW5zdGFsbCUyMG9wdGltdW0lNUJleHBvcnRlcnMtdGYlNUQ=",highlighted:"pip install optimum[exporters-tf]",wrap:!1}}),u=new Q({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 Q({props:{code:"b3B0aW11bS1jbGklMjBleHBvcnQlMjB0ZmxpdGUlMjAtLW1vZGVsJTIwYmVydC1iYXNlLXVuY2FzZWQlMjAtLXNlcXVlbmNlX2xlbmd0aCUyMDEyOCUyMGJlcnRfdGZsaXRlJTJG",highlighted:'optimum-cli <span class="hljs-built_in">export</span> tflite --model bert-base-uncased --sequence_length 128 bert_tflite/',wrap:!1}}),b=new Q({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"),$=o(),J=s("p"),L=o(),g(r.$$.fragment),_=o(),p=s("p"),p.innerHTML=N,I=o(),d=s("p"),d.innerHTML=E,V=o(),c=s("p"),c.textContent=P,F=o(),g(f.$$.fragment),H=o(),M=s("p"),M.innerHTML=D,C=o(),g(u.$$.fragment),k=o(),h=s("p"),h.innerHTML=q,S=o(),g(T.$$.fragment),R=o(),w=s("p"),w.innerHTML=O,W=o(),g(b.$$.fragment),X=o(),U=s("p"),U.innerHTML=K,z=o(),x=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),J=a(e,"P",{}),ee(J).forEach(l),L=n(e),G(r.$$.fragment,e),_=n(e),p=a(e,"P",{"data-svelte-h":!0}),y(p)!=="svelte-1btfcc4"&&(p.innerHTML=N),I=n(e),d=a(e,"P",{"data-svelte-h":!0}),y(d)!=="svelte-m0va7t"&&(d.innerHTML=E),V=n(e),c=a(e,"P",{"data-svelte-h":!0}),y(c)!=="svelte-fibc5e"&&(c.textContent=P),F=n(e),G(f.$$.fragment,e),H=n(e),M=a(e,"P",{"data-svelte-h":!0}),y(M)!=="svelte-1ebb3ag"&&(M.innerHTML=D),C=n(e),G(u.$$.fragment,e),k=n(e),h=a(e,"P",{"data-svelte-h":!0}),y(h)!=="svelte-8zfn5r"&&(h.innerHTML=q),S=n(e),G(T.$$.fragment,e),R=n(e),w=a(e,"P",{"data-svelte-h":!0}),y(w)!=="svelte-ptkmnx"&&(w.innerHTML=O),W=n(e),G(b.$$.fragment,e),X=n(e),U=a(e,"P",{"data-svelte-h":!0}),y(U)!=="svelte-1a6s6im"&&(U.innerHTML=K),z=n(e),x=a(e,"P",{}),ee(x).forEach(l),this.h()},h(){te(m,"name","hf:doc:metadata"),te(m,"content",de)},m(e,t){me(document.head,m),i(e,$,t),i(e,J,t),i(e,L,t),j(r,e,t),i(e,_,t),i(e,p,t),i(e,I,t),i(e,d,t),i(e,V,t),i(e,c,t),i(e,F,t),j(f,e,t),i(e,H,t),i(e,M,t),i(e,C,t),j(u,e,t),i(e,k,t),i(e,h,t),i(e,S,t),j(T,e,t),i(e,R,t),i(e,w,t),i(e,W,t),j(b,e,t),i(e,X,t),i(e,U,t),i(e,z,t),i(e,x,t),A=!0},p:ie,i(e){A||(v(r.$$.fragment,e),v(f.$$.fragment,e),v(u.$$.fragment,e),v(T.$$.fragment,e),v(b.$$.fragment,e),A=!0)},o(e){B(r.$$.fragment,e),B(f.$$.fragment,e),B(u.$$.fragment,e),B(T.$$.fragment,e),B(b.$$.fragment,e),A=!1},d(e){e&&(l($),l(J),l(L),l(_),l(p),l(I),l(d),l(V),l(c),l(F),l(H),l(M),l(C),l(k),l(h),l(S),l(R),l(w),l(W),l(X),l(U),l(z),l(x)),l(m),Z(r,e),Z(f,e),Z(u,e),Z(T,e),Z(b,e)}}}const de='{"title":"Export to TFLite","local":"export-to-tflite","sections":[],"depth":1}';function ce(Y){return oe(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Te extends ne{constructor(m){super(),se(this,m,ce,pe,le,{})}}export{Te as component};
