import{s as W,n as Y,o as K}from"../chunks/scheduler.8c3d61f6.js";import{S as X,i as Z,g,s as o,r as y,A as ee,h as w,f as a,c as i,j as Q,u as _,x as B,k as V,y as te,a as n,v as b,d as T,t as v,w as P}from"../chunks/index.da70eac4.js";import{C as ae}from"../chunks/CodeBlock.00a903b3.js";import{H as F,E as ne}from"../chunks/EditOnGithub.1e64e623.js";function oe(I){let r,M,x,k,s,z,l,J='<a href="https://github.com/pytorch/ao" rel="nofollow">TorchAO</a> is an architecture optimization library for PyTorch, it provides high performance dtypes, optimization techniques and kernels for inference and training, featuring composability with native PyTorch features like <code>torch.compile</code>, FSDP etc.. Some benchmark numbers can be found <a href="https://github.com/pytorch/ao/tree/main/torchao/quantization#benchmarks" rel="nofollow">here</a>.',A,f,R="Before you begin, make sure you have Pytorch version 2.5, or above, and TorchAO installed:",L,m,H,c,U,p,D='Now you can quantize a model by passing a <a href="/docs/diffusers/pr_10009/en/api/quantization#diffusers.TorchAoConfig">TorchAoConfig</a> to <a href="/docs/diffusers/pr_10009/en/api/models/overview#diffusers.ModelMixin.from_pretrained">from_pretrained()</a>. This works for any model in any modality, as long as it supports loading with <a href="https://hf.co/docs/accelerate/index" rel="nofollow">Accelerate</a> and contains <code>torch.nn.Linear</code> layers.',q,u,E,h,j,d,N='<li><a href="">TorchAO Quantization API</a></li> <li><a href="https://github.com/sayakpaul/diffusers-torchao" rel="nofollow">Diffusers-TorchAO examples</a></li>',G,$,O,C,S;return s=new F({props:{title:"torchao",local:"torchao",headingTag:"h1"}}),m=new ae({props:{code:"cGlwJTIwaW5zdGFsbCUyMC1VJTIwdG9yY2glMjB0b3JjaGFv",highlighted:"pip install -U torch torchao",wrap:!1}}),c=new F({props:{title:"Usage",local:"usage",headingTag:"h2"}}),u=new F({props:{title:"Usage",local:"usage",headingTag:"h2"}}),h=new F({props:{title:"Resources",local:"resources",headingTag:"h2"}}),$=new ne({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/quantization/torchao.md"}}),{c(){r=g("meta"),M=o(),x=g("p"),k=o(),y(s.$$.fragment),z=o(),l=g("p"),l.innerHTML=J,A=o(),f=g("p"),f.textContent=R,L=o(),y(m.$$.fragment),H=o(),y(c.$$.fragment),U=o(),p=g("p"),p.innerHTML=D,q=o(),y(u.$$.fragment),E=o(),y(h.$$.fragment),j=o(),d=g("ul"),d.innerHTML=N,G=o(),y($.$$.fragment),O=o(),C=g("p"),this.h()},l(e){const t=ee("svelte-u9bgzb",document.head);r=w(t,"META",{name:!0,content:!0}),t.forEach(a),M=i(e),x=w(e,"P",{}),Q(x).forEach(a),k=i(e),_(s.$$.fragment,e),z=i(e),l=w(e,"P",{"data-svelte-h":!0}),B(l)!=="svelte-1w5ww4g"&&(l.innerHTML=J),A=i(e),f=w(e,"P",{"data-svelte-h":!0}),B(f)!=="svelte-17cdtvy"&&(f.textContent=R),L=i(e),_(m.$$.fragment,e),H=i(e),_(c.$$.fragment,e),U=i(e),p=w(e,"P",{"data-svelte-h":!0}),B(p)!=="svelte-121j6kj"&&(p.innerHTML=D),q=i(e),_(u.$$.fragment,e),E=i(e),_(h.$$.fragment,e),j=i(e),d=w(e,"UL",{"data-svelte-h":!0}),B(d)!=="svelte-nzgza5"&&(d.innerHTML=N),G=i(e),_($.$$.fragment,e),O=i(e),C=w(e,"P",{}),Q(C).forEach(a),this.h()},h(){V(r,"name","hf:doc:metadata"),V(r,"content",ie)},m(e,t){te(document.head,r),n(e,M,t),n(e,x,t),n(e,k,t),b(s,e,t),n(e,z,t),n(e,l,t),n(e,A,t),n(e,f,t),n(e,L,t),b(m,e,t),n(e,H,t),b(c,e,t),n(e,U,t),n(e,p,t),n(e,q,t),b(u,e,t),n(e,E,t),b(h,e,t),n(e,j,t),n(e,d,t),n(e,G,t),b($,e,t),n(e,O,t),n(e,C,t),S=!0},p:Y,i(e){S||(T(s.$$.fragment,e),T(m.$$.fragment,e),T(c.$$.fragment,e),T(u.$$.fragment,e),T(h.$$.fragment,e),T($.$$.fragment,e),S=!0)},o(e){v(s.$$.fragment,e),v(m.$$.fragment,e),v(c.$$.fragment,e),v(u.$$.fragment,e),v(h.$$.fragment,e),v($.$$.fragment,e),S=!1},d(e){e&&(a(M),a(x),a(k),a(z),a(l),a(A),a(f),a(L),a(H),a(U),a(p),a(q),a(E),a(j),a(d),a(G),a(O),a(C)),a(r),P(s,e),P(m,e),P(c,e),P(u,e),P(h,e),P($,e)}}}const ie='{"title":"torchao","local":"torchao","sections":[{"title":"Usage","local":"usage","sections":[],"depth":2},{"title":"Usage","local":"usage","sections":[],"depth":2},{"title":"Resources","local":"resources","sections":[],"depth":2}],"depth":1}';function re(I){return K(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ce extends X{constructor(r){super(),Z(this,r,re,oe,W,{})}}export{ce as component};
