import{s as D,n as R,o as X}from"../chunks/scheduler.53228c21.js";import{S as Z,i as N,e as l,s,c as E,h as V,a as f,d as n,b as r,f as W,g as q,j as g,k as I,l as Y,m as o,n as O,t as U,o as B,p as G}from"../chunks/index.100fac89.js";import{C as ee}from"../chunks/CopyLLMTxtMenu.4f0519ef.js";import{C as te}from"../chunks/CodeBlock.d30a6509.js";import{H as ne,E as oe}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.62dbb7c4.js";function se(S){let i,v,b,T,p,w,c,y,u,A='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.',L,h,J="Install xFormers from <code>pip</code>:",M,d,C,a,j='<p>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>.</p>',H,$,K='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>.',k,m,Q='<p>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.</p>',P,x,F,_,z;return p=new ee({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),c=new ne({props:{title:"xFormers",local:"xformers",headingTag:"h1"}}),d=new te({props:{code:"cGlwJTIwaW5zdGFsbCUyMHhmb3JtZXJz",highlighted:"pip install xformers",wrap:!1}}),x=new oe({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/optimization/xformers.md"}}),{c(){i=l("meta"),v=s(),b=l("p"),T=s(),E(p.$$.fragment),w=s(),E(c.$$.fragment),y=s(),u=l("p"),u.innerHTML=A,L=s(),h=l("p"),h.innerHTML=J,M=s(),E(d.$$.fragment),C=s(),a=l("blockquote"),a.innerHTML=j,H=s(),$=l("p"),$.innerHTML=K,k=s(),m=l("blockquote"),m.innerHTML=Q,P=s(),E(x.$$.fragment),F=s(),_=l("p"),this.h()},l(e){const t=V("svelte-u9bgzb",document.head);i=f(t,"META",{name:!0,content:!0}),t.forEach(n),v=r(e),b=f(e,"P",{}),W(b).forEach(n),T=r(e),q(p.$$.fragment,e),w=r(e),q(c.$$.fragment,e),y=r(e),u=f(e,"P",{"data-svelte-h":!0}),g(u)!=="svelte-oz1ps0"&&(u.innerHTML=A),L=r(e),h=f(e,"P",{"data-svelte-h":!0}),g(h)!=="svelte-18m1qmn"&&(h.innerHTML=J),M=r(e),q(d.$$.fragment,e),C=r(e),a=f(e,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),g(a)!=="svelte-ar9tmo"&&(a.innerHTML=j),H=r(e),$=f(e,"P",{"data-svelte-h":!0}),g($)!=="svelte-1p2fcxh"&&($.innerHTML=K),k=r(e),m=f(e,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),g(m)!=="svelte-z7jtek"&&(m.innerHTML=Q),P=r(e),q(x.$$.fragment,e),F=r(e),_=f(e,"P",{}),W(_).forEach(n),this.h()},h(){I(i,"name","hf:doc:metadata"),I(i,"content",re),I(a,"class","tip"),I(m,"class","warning")},m(e,t){Y(document.head,i),o(e,v,t),o(e,b,t),o(e,T,t),O(p,e,t),o(e,w,t),O(c,e,t),o(e,y,t),o(e,u,t),o(e,L,t),o(e,h,t),o(e,M,t),O(d,e,t),o(e,C,t),o(e,a,t),o(e,H,t),o(e,$,t),o(e,k,t),o(e,m,t),o(e,P,t),O(x,e,t),o(e,F,t),o(e,_,t),z=!0},p:R,i(e){z||(U(p.$$.fragment,e),U(c.$$.fragment,e),U(d.$$.fragment,e),U(x.$$.fragment,e),z=!0)},o(e){B(p.$$.fragment,e),B(c.$$.fragment,e),B(d.$$.fragment,e),B(x.$$.fragment,e),z=!1},d(e){e&&(n(v),n(b),n(T),n(w),n(y),n(u),n(L),n(h),n(M),n(C),n(a),n(H),n($),n(k),n(m),n(P),n(F),n(_)),n(i),G(p,e),G(c,e),G(d,e),G(x,e)}}}const re='{"title":"xFormers","local":"xformers","sections":[],"depth":1}';function ie(S){return X(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ce extends Z{constructor(i){super(),N(this,i,ie,se,D,{})}}export{ce as component};
