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