import{s as R,o as X,n as W}from"../chunks/scheduler.182ea377.js";import{S as Z,i as K,g as c,s as i,r as F,A as N,h as u,f as o,c as m,j,u as k,x as v,k as B,y as O,a as r,v as z,d as I,t as A,w as E}from"../chunks/index.1ea56653.js";import{H as Q,g as V}from"../chunks/Heading.71ac6e9f.js";import{T as D}from"../chunks/Tip.67abc998.js";import{C as Y}from"../chunks/CodeBlock.82c2494b.js";function ee(x){let n,a='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=a},l(s){n=u(s,"P",{"data-svelte-h":!0}),v(n)!=="svelte-1br1kjr"&&(n.innerHTML=a)},m(s,f){r(s,n,f)},p:W,d(s){s&&o(n)}}}function te(x){let n,a='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=a},l(s){n=u(s,"P",{"data-svelte-h":!0}),v(n)!=="svelte-b92wts"&&(n.innerHTML=a)},m(s,f){r(s,n,f)},p:W,d(s){s&&o(n)}}}function ne(x){let n,a,s,f,$,b,h,G='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.',T,d,q="Install xFormers from <code>pip</code>:",P,_,H,l,M,g,J='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>.',y,p,L,w,C;return $=new Q({props:{title:"xFormers",local:"xformers",headingTag:"h1"}}),_=new Y({props:{code:"cGlwJTIwaW5zdGFsbCUyMHhmb3JtZXJz",highlighted:"pip install xformers",wrap:!1}}),l=new D({props:{$$slots:{default:[ee]},$$scope:{ctx:x}}}),p=new D({props:{warning:!0,$$slots:{default:[te]},$$scope:{ctx:x}}}),{c(){n=c("meta"),a=i(),s=c("p"),f=i(),F($.$$.fragment),b=i(),h=c("p"),h.innerHTML=G,T=i(),d=c("p"),d.innerHTML=q,P=i(),F(_.$$.fragment),H=i(),F(l.$$.fragment),M=i(),g=c("p"),g.innerHTML=J,y=i(),F(p.$$.fragment),L=i(),w=c("p"),this.h()},l(e){const t=N("svelte-u9bgzb",document.head);n=u(t,"META",{name:!0,content:!0}),t.forEach(o),a=m(e),s=u(e,"P",{}),j(s).forEach(o),f=m(e),k($.$$.fragment,e),b=m(e),h=u(e,"P",{"data-svelte-h":!0}),v(h)!=="svelte-oz1ps0"&&(h.innerHTML=G),T=m(e),d=u(e,"P",{"data-svelte-h":!0}),v(d)!=="svelte-18m1qmn"&&(d.innerHTML=q),P=m(e),k(_.$$.fragment,e),H=m(e),k(l.$$.fragment,e),M=m(e),g=u(e,"P",{"data-svelte-h":!0}),v(g)!=="svelte-1p2fcxh"&&(g.innerHTML=J),y=m(e),k(p.$$.fragment,e),L=m(e),w=u(e,"P",{}),j(w).forEach(o),this.h()},h(){B(n,"name","hf:doc:metadata"),B(n,"content",oe)},m(e,t){O(document.head,n),r(e,a,t),r(e,s,t),r(e,f,t),z($,e,t),r(e,b,t),r(e,h,t),r(e,T,t),r(e,d,t),r(e,P,t),z(_,e,t),r(e,H,t),z(l,e,t),r(e,M,t),r(e,g,t),r(e,y,t),z(p,e,t),r(e,L,t),r(e,w,t),C=!0},p(e,[t]){const S={};t&2&&(S.$$scope={dirty:t,ctx:e}),l.$set(S);const U={};t&2&&(U.$$scope={dirty:t,ctx:e}),p.$set(U)},i(e){C||(I($.$$.fragment,e),I(_.$$.fragment,e),I(l.$$.fragment,e),I(p.$$.fragment,e),C=!0)},o(e){A($.$$.fragment,e),A(_.$$.fragment,e),A(l.$$.fragment,e),A(p.$$.fragment,e),C=!1},d(e){e&&(o(a),o(s),o(f),o(b),o(h),o(T),o(d),o(P),o(H),o(M),o(g),o(y),o(L),o(w)),o(n),E($,e),E(_,e),E(l,e),E(p,e)}}}const oe='{"title":"xFormers","local":"xformers","sections":[],"depth":1}';function se(x){return X(()=>{new URLSearchParams(window.location.search).get("fw"),window.hfDocGoto=V}),[]}class le extends Z{constructor(n){super(),K(this,n,se,ne,R,{})}}export{le as component};
