Buckets:

download
raw
2.11 kB
import"../chunks/DsnmJJEf.js";import{i as f,h,C as d,H as g,a as u,E as x,s as b}from"../chunks/DdZvggmf.js";import{p as w,o as _,s as e,f as v,a as n,b as y,c,n as F}from"../chunks/BbekZcyp.js";const k='{"title":"xFormers","local":"xformers","sections":[],"depth":1}';var P=c('<meta name="hf:doc:metadata"/>'),z=c('<p></p> <!> <!> <p>我们推荐在推理和训练过程中使用<a href="https://github.com/facebookresearch/xformers" rel="nofollow">xFormers</a>。在我们的测试中,其对注意力模块的优化能同时提升运行速度并降低内存消耗。</p> <p>通过<code>pip</code>安装xFormers:</p> <!> <blockquote class="tip"><p>xFormers的<code>pip</code>安装包需要最新版本的PyTorch。如需使用旧版PyTorch,建议<a href="https://github.com/facebookresearch/xformers#installing-xformers" rel="nofollow">从源码安装xFormers</a>。</p></blockquote> <p>安装完成后,您可调用<code>enable_xformers_memory_efficient_attention()</code>来实现更快的推理速度和更低的内存占用,具体用法参见<a href="memory#memory-efficient-attention">此章节</a>。</p> <blockquote class="warning"><p>根据<a href="https://github.com/huggingface/diffusers/issues/2234#issuecomment-1416931212" rel="nofollow">此问题</a>反馈,xFormers <code>v0.0.16</code>版本在某些GPU上无法用于训练(微调或DreamBooth)。如遇此问题,请按照该issue评论区指引安装开发版本。</p></blockquote> <!> <p></p>',1);function G(m,l){w(l,!1),_(()=>{new URLSearchParams(window.location.search).get("fw")}),f();var o=z();h("gjw17f",s=>{var i=P();b(i,"content",k),n(s,i)});var a=e(v(o),2);d(a,{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"});var r=e(a,2);g(r,{title:"xFormers",local:"xformers",headingTag:"h1"});var t=e(r,6);u(t,{code:"cGlwJTIwaW5zdGFsbCUyMHhmb3JtZXJz",highlighted:"pip install xformers",lang:"bash",wrap:!1});var p=e(t,8);x(p,{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/zh/optimization/xformers.md"}),F(2),n(m,o),y()}export{G as component};

Xet Storage Details

Size:
2.11 kB
·
Xet hash:
7ae422ff81261524f6171dd74e0f769b48176a5b8a333deb4a7b3c37da6e08b4

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.