import{s as O,o as B,n as G}from"../chunks/scheduler.8c3d61f6.js";import{S as J,i as K,g as $,s as m,r as v,A as N,h as d,f as a,c as p,j as S,u as q,x as L,k as U,y as V,a as i,v as y,d as x,t as T,w as C}from"../chunks/index.da70eac4.js";import{T as W}from"../chunks/Tip.1d9b8c37.js";import{H as j,E as X}from"../chunks/EditOnGithub.1e64e623.js";function Y(b){let n,u='Interested in adding a new quantization method to Transformers? Refer to the <a href="https://huggingface.co/docs/transformers/main/en/quantization/contribute" rel="nofollow">Contribute new quantization method guide</a> to learn more about adding a new quantization method.';return{c(){n=$("p"),n.innerHTML=u},l(o){n=d(o,"P",{"data-svelte-h":!0}),L(n)!=="svelte-iot2ot"&&(n.innerHTML=u)},m(o,s){i(o,n,s)},p:G,d(o){o&&a(n)}}}function Z(b){let n,u="If you are new to the quantization field, we recommend you to check out these beginner-friendly courses about quantization in collaboration with DeepLearning.AI:",o,s,f='<li><a href="https://www.deeplearning.ai/short-courses/quantization-fundamentals-with-hugging-face/" rel="nofollow">Quantization Fundamentals with Hugging Face</a></li> <li><a href="https://www.deeplearning.ai/short-courses/quantization-in-depth/" rel="nofollow">Quantization in Depth</a></li>';return{c(){n=$("p"),n.textContent=u,o=m(),s=$("ul"),s.innerHTML=f},l(r){n=d(r,"P",{"data-svelte-h":!0}),L(n)!=="svelte-lvs4zq"&&(n.textContent=u),o=p(r),s=d(r,"UL",{"data-svelte-h":!0}),L(s)!=="svelte-tsydsg"&&(s.innerHTML=f)},m(r,l){i(r,n,l),i(r,o,l),i(r,s,l)},p:G,d(r){r&&(a(n),a(o),a(s))}}}function tt(b){let n,u,o,s,f,r,l,D="Quantization techniques focus on representing data with less information while also trying to not lose too much accuracy. This often means converting a data type to represent the same information with fewer bits. For example, if your model weights are stored as 32-bit floating points and they’re quantized to 16-bit floating points, this halves the model size which makes it easier to store and reduces memory-usage. Lower precision can also speedup inference because it takes less time to perform calculations with fewer bits.",P,h,H,c,M,w,k,g,F='Diffusers supports <a href="https://huggingface.co/docs/bitsandbytes/main/en/index" rel="nofollow">bitsandbytes</a> and <a href="https://github.com/pytorch/ao" rel="nofollow">torchao</a>. Refer to this <a href="https://huggingface.co/docs/transformers/main/en/quantization/overview#when-to-use-what" rel="nofollow">table</a> to help you determine which quantization backend to use.',E,_,Q,z,A;return f=new j({props:{title:"Quantization",local:"quantization",headingTag:"h1"}}),h=new W({props:{$$slots:{default:[Y]},$$scope:{ctx:b}}}),c=new W({props:{$$slots:{default:[Z]},$$scope:{ctx:b}}}),w=new j({props:{title:"When to use what?",local:"when-to-use-what",headingTag:"h2"}}),_=new X({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/quantization/overview.md"}}),{c(){n=$("meta"),u=m(),o=$("p"),s=m(),v(f.$$.fragment),r=m(),l=$("p"),l.textContent=D,P=m(),v(h.$$.fragment),H=m(),v(c.$$.fragment),M=m(),v(w.$$.fragment),k=m(),g=$("p"),g.innerHTML=F,E=m(),v(_.$$.fragment),Q=m(),z=$("p"),this.h()},l(t){const e=N("svelte-u9bgzb",document.head);n=d(e,"META",{name:!0,content:!0}),e.forEach(a),u=p(t),o=d(t,"P",{}),S(o).forEach(a),s=p(t),q(f.$$.fragment,t),r=p(t),l=d(t,"P",{"data-svelte-h":!0}),L(l)!=="svelte-1euzkei"&&(l.textContent=D),P=p(t),q(h.$$.fragment,t),H=p(t),q(c.$$.fragment,t),M=p(t),q(w.$$.fragment,t),k=p(t),g=d(t,"P",{"data-svelte-h":!0}),L(g)!=="svelte-11wqo6d"&&(g.innerHTML=F),E=p(t),q(_.$$.fragment,t),Q=p(t),z=d(t,"P",{}),S(z).forEach(a),this.h()},h(){U(n,"name","hf:doc:metadata"),U(n,"content",et)},m(t,e){V(document.head,n),i(t,u,e),i(t,o,e),i(t,s,e),y(f,t,e),i(t,r,e),i(t,l,e),i(t,P,e),y(h,t,e),i(t,H,e),y(c,t,e),i(t,M,e),y(w,t,e),i(t,k,e),i(t,g,e),i(t,E,e),y(_,t,e),i(t,Q,e),i(t,z,e),A=!0},p(t,[e]){const I={};e&2&&(I.$$scope={dirty:e,ctx:t}),h.$set(I);const R={};e&2&&(R.$$scope={dirty:e,ctx:t}),c.$set(R)},i(t){A||(x(f.$$.fragment,t),x(h.$$.fragment,t),x(c.$$.fragment,t),x(w.$$.fragment,t),x(_.$$.fragment,t),A=!0)},o(t){T(f.$$.fragment,t),T(h.$$.fragment,t),T(c.$$.fragment,t),T(w.$$.fragment,t),T(_.$$.fragment,t),A=!1},d(t){t&&(a(u),a(o),a(s),a(r),a(l),a(P),a(H),a(M),a(k),a(g),a(E),a(Q),a(z)),a(n),C(f,t),C(h,t),C(c,t),C(w,t),C(_,t)}}}const et='{"title":"Quantization","local":"quantization","sections":[{"title":"When to use what?","local":"when-to-use-what","sections":[],"depth":2}],"depth":1}';function nt(b){return B(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class rt extends J{constructor(n){super(),K(this,n,nt,tt,O,{})}}export{rt as component};
