import{s as le,n as ie,o as ae}from"../chunks/scheduler.9991993c.js";import{S as se,i as ne,g as n,s as a,r as j,A as me,h as m,f as l,c as s,j as ee,u as x,x as h,k as te,y as oe,a as i,v as B,d as Z,t as $,w as v}from"../chunks/index.7fc9a5e7.js";import{C as z}from"../chunks/CodeBlock.e11cba92.js";import{H as pe}from"../chunks/Heading.e3de321f.js";function Me(Y){let o,L,y,_,p,I,M,N='<a href="https://www.tensorflow.org/lite/guide" rel="nofollow">TensorFlow Lite</a> 是一个轻量级框架，用于资源受限的设备上，如手机、嵌入式系统和物联网（IoT）设备，部署机器学习模型。TFLite 旨在在计算能力、内存和功耗有限的设备上优化和高效运行模型。模型以一种特殊的高效可移植格式表示，其文件扩展名为 <code>.tflite</code>。',V,f,E='🤗 Optimum 通过 <code>exporters.tflite</code> 模块提供将 🤗 Transformers 模型导出至 TFLite 格式的功能。请参考 <a href="https://huggingface.co/docs/optimum/exporters/tflite/overview" rel="nofollow">🤗 Optimum 文档</a> 以获取支持的模型架构列表。',g,T,P="要将模型导出为 TFLite 格式，请安装所需的依赖项：",H,c,C,d,D='请参阅 <a href="https://huggingface.co/docs/optimum/main/en/exporters/tflite/usage_guides/export_a_model" rel="nofollow">🤗 Optimum 文档</a> 以查看所有可用参数，或者在命令行中查看帮助：',F,r,S,u,q="运行以下命令，以从 🤗 Hub 导出模型的检查点（checkpoint），以 <code>bert-base-uncased</code> 为例：",R,w,X,U,O="你应该能在日志中看到导出进度以及生成的 <code>model.tflite</code> 文件的保存位置，如下所示：",Q,b,W,J,K="上面的示例说明了从 🤗 Hub 导出检查点的过程。导出本地模型时，首先需要确保将模型的权重和分词器文件保存在同一目录（<code>local_path</code>）中。在使用 CLI（命令行）时，将 <code>local_path</code> 传递给 <code>model</code> 参数，而不是 🤗 Hub 上的检查点名称。",A,G,k;return p=new pe({props:{title:"导出为 TFLite",local:"导出为-tflite",headingTag:"h1"}}),c=new z({props:{code:"cGlwJTIwaW5zdGFsbCUyMG9wdGltdW0lNUJleHBvcnRlcnMtdGYlNUQ=",highlighted:"pip install optimum[exporters-tf]",wrap:!1}}),r=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}}),w=new z({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 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(){o=n("meta"),L=a(),y=n("p"),_=a(),j(p.$$.fragment),I=a(),M=n("p"),M.innerHTML=N,V=a(),f=n("p"),f.innerHTML=E,g=a(),T=n("p"),T.textContent=P,H=a(),j(c.$$.fragment),C=a(),d=n("p"),d.innerHTML=D,F=a(),j(r.$$.fragment),S=a(),u=n("p"),u.innerHTML=q,R=a(),j(w.$$.fragment),X=a(),U=n("p"),U.innerHTML=O,Q=a(),j(b.$$.fragment),W=a(),J=n("p"),J.innerHTML=K,A=a(),G=n("p"),this.h()},l(e){const t=me("svelte-u9bgzb",document.head);o=m(t,"META",{name:!0,content:!0}),t.forEach(l),L=s(e),y=m(e,"P",{}),ee(y).forEach(l),_=s(e),x(p.$$.fragment,e),I=s(e),M=m(e,"P",{"data-svelte-h":!0}),h(M)!=="svelte-mb0mc7"&&(M.innerHTML=N),V=s(e),f=m(e,"P",{"data-svelte-h":!0}),h(f)!=="svelte-1o6xu7v"&&(f.innerHTML=E),g=s(e),T=m(e,"P",{"data-svelte-h":!0}),h(T)!=="svelte-1o0dvm5"&&(T.textContent=P),H=s(e),x(c.$$.fragment,e),C=s(e),d=m(e,"P",{"data-svelte-h":!0}),h(d)!=="svelte-afi3po"&&(d.innerHTML=D),F=s(e),x(r.$$.fragment,e),S=s(e),u=m(e,"P",{"data-svelte-h":!0}),h(u)!=="svelte-3rwhfl"&&(u.innerHTML=q),R=s(e),x(w.$$.fragment,e),X=s(e),U=m(e,"P",{"data-svelte-h":!0}),h(U)!=="svelte-1db6oyf"&&(U.innerHTML=O),Q=s(e),x(b.$$.fragment,e),W=s(e),J=m(e,"P",{"data-svelte-h":!0}),h(J)!=="svelte-cqegdm"&&(J.innerHTML=K),A=s(e),G=m(e,"P",{}),ee(G).forEach(l),this.h()},h(){te(o,"name","hf:doc:metadata"),te(o,"content",fe)},m(e,t){oe(document.head,o),i(e,L,t),i(e,y,t),i(e,_,t),B(p,e,t),i(e,I,t),i(e,M,t),i(e,V,t),i(e,f,t),i(e,g,t),i(e,T,t),i(e,H,t),B(c,e,t),i(e,C,t),i(e,d,t),i(e,F,t),B(r,e,t),i(e,S,t),i(e,u,t),i(e,R,t),B(w,e,t),i(e,X,t),i(e,U,t),i(e,Q,t),B(b,e,t),i(e,W,t),i(e,J,t),i(e,A,t),i(e,G,t),k=!0},p:ie,i(e){k||(Z(p.$$.fragment,e),Z(c.$$.fragment,e),Z(r.$$.fragment,e),Z(w.$$.fragment,e),Z(b.$$.fragment,e),k=!0)},o(e){$(p.$$.fragment,e),$(c.$$.fragment,e),$(r.$$.fragment,e),$(w.$$.fragment,e),$(b.$$.fragment,e),k=!1},d(e){e&&(l(L),l(y),l(_),l(I),l(M),l(V),l(f),l(g),l(T),l(H),l(C),l(d),l(F),l(S),l(u),l(R),l(X),l(U),l(Q),l(W),l(J),l(A),l(G)),l(o),v(p,e),v(c,e),v(r,e),v(w,e),v(b,e)}}}const fe='{"title":"导出为 TFLite","local":"导出为-tflite","sections":[],"depth":1}';function Te(Y){return ae(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class we extends se{constructor(o){super(),ne(this,o,Te,Me,le,{})}}export{we as component};
