import{s as X,o as Z,n as R}from"../chunks/scheduler.8c3d61f6.js";import{S as K,i as N,g as c,s as a,r as w,A as Q,h as u,f as s,c as m,j as W,u as T,x as L,k as D,y as V,a as r,v as P,d as H,t as M,w as y}from"../chunks/index.da70eac4.js";import{T as O}from"../chunks/Tip.1d9b8c37.js";import{C as Y}from"../chunks/CodeBlock.00a903b3.js";import{H as ee,E as te}from"../chunks/EditOnGithub.1e64e623.js";function ne(b){let n,i='The xFormers <code>pip</code> package requires the latest version of PyTorch. If you need to use a previous version of PyTorch, then we recommend <a href="https://github.com/facebookresearch/xformers#installing-xformers" rel="nofollow">installing xFormers from the source</a>.';return{c(){n=c("p"),n.innerHTML=i},l(o){n=u(o,"P",{"data-svelte-h":!0}),L(n)!=="svelte-1br1kjr"&&(n.innerHTML=i)},m(o,f){r(o,n,f)},p:R,d(o){o&&s(n)}}}function se(b){let n,i='According to this <a href="https://github.com/huggingface/diffusers/issues/2234#issuecomment-1416931212" rel="nofollow">issue</a>, xFormers <code>v0.0.16</code> cannot be used for training (fine-tune or DreamBooth) in some GPUs. If you observe this problem, please install a development version as indicated in the issue comments.';return{c(){n=c("p"),n.innerHTML=i},l(o){n=u(o,"P",{"data-svelte-h":!0}),L(n)!=="svelte-b92wts"&&(n.innerHTML=i)},m(o,f){r(o,n,f)},p:R,d(o){o&&s(n)}}}function oe(b){let n,i,o,f,$,C,h,J='We recommend <a href="https://github.com/facebookresearch/xformers" rel="nofollow">xFormers</a> for both inference and training. In our tests, the optimizations performed in the attention blocks allow for both faster speed and reduced memory consumption.',F,d,S="Install xFormers from <code>pip</code>:",k,_,z,l,E,g,U='After xFormers is installed, you can use <code>enable_xformers_memory_efficient_attention()</code> for faster inference and reduced memory consumption as shown in this <a href="memory#memory-efficient-attention">section</a>.',I,p,A,x,G,v,q;return $=new ee({props:{title:"xFormers",local:"xformers",headingTag:"h1"}}),_=new Y({props:{code:"cGlwJTIwaW5zdGFsbCUyMHhmb3JtZXJz",highlighted:"pip install xformers",wrap:!1}}),l=new O({props:{$$slots:{default:[ne]},$$scope:{ctx:b}}}),p=new O({props:{warning:!0,$$slots:{default:[se]},$$scope:{ctx:b}}}),x=new te({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/optimization/xformers.md"}}),{c(){n=c("meta"),i=a(),o=c("p"),f=a(),w($.$$.fragment),C=a(),h=c("p"),h.innerHTML=J,F=a(),d=c("p"),d.innerHTML=S,k=a(),w(_.$$.fragment),z=a(),w(l.$$.fragment),E=a(),g=c("p"),g.innerHTML=U,I=a(),w(p.$$.fragment),A=a(),w(x.$$.fragment),G=a(),v=c("p"),this.h()},l(e){const t=Q("svelte-u9bgzb",document.head);n=u(t,"META",{name:!0,content:!0}),t.forEach(s),i=m(e),o=u(e,"P",{}),W(o).forEach(s),f=m(e),T($.$$.fragment,e),C=m(e),h=u(e,"P",{"data-svelte-h":!0}),L(h)!=="svelte-oz1ps0"&&(h.innerHTML=J),F=m(e),d=u(e,"P",{"data-svelte-h":!0}),L(d)!=="svelte-18m1qmn"&&(d.innerHTML=S),k=m(e),T(_.$$.fragment,e),z=m(e),T(l.$$.fragment,e),E=m(e),g=u(e,"P",{"data-svelte-h":!0}),L(g)!=="svelte-1p2fcxh"&&(g.innerHTML=U),I=m(e),T(p.$$.fragment,e),A=m(e),T(x.$$.fragment,e),G=m(e),v=u(e,"P",{}),W(v).forEach(s),this.h()},h(){D(n,"name","hf:doc:metadata"),D(n,"content",re)},m(e,t){V(document.head,n),r(e,i,t),r(e,o,t),r(e,f,t),P($,e,t),r(e,C,t),r(e,h,t),r(e,F,t),r(e,d,t),r(e,k,t),P(_,e,t),r(e,z,t),P(l,e,t),r(e,E,t),r(e,g,t),r(e,I,t),P(p,e,t),r(e,A,t),P(x,e,t),r(e,G,t),r(e,v,t),q=!0},p(e,[t]){const j={};t&2&&(j.$$scope={dirty:t,ctx:e}),l.$set(j);const B={};t&2&&(B.$$scope={dirty:t,ctx:e}),p.$set(B)},i(e){q||(H($.$$.fragment,e),H(_.$$.fragment,e),H(l.$$.fragment,e),H(p.$$.fragment,e),H(x.$$.fragment,e),q=!0)},o(e){M($.$$.fragment,e),M(_.$$.fragment,e),M(l.$$.fragment,e),M(p.$$.fragment,e),M(x.$$.fragment,e),q=!1},d(e){e&&(s(i),s(o),s(f),s(C),s(h),s(F),s(d),s(k),s(z),s(E),s(g),s(I),s(A),s(G),s(v)),s(n),y($,e),y(_,e),y(l,e),y(p,e),y(x,e)}}}const re='{"title":"xFormers","local":"xformers","sections":[],"depth":1}';function ie(b){return Z(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ce extends K{constructor(n){super(),N(this,n,ie,oe,X,{})}}export{ce as component};
