import{s as C,o as Y,n as q}from"../chunks/scheduler.5c93273d.js";import{S as z,i as W,g as T,s,r as k,A as D,h as g,f as l,c as o,j as L,u as y,x as E,k as A,y as F,a as n,v as I,d as J,t as v,w as H}from"../chunks/index.e43dd92b.js";import{T as S}from"../chunks/Tip.1cbfe904.js";import{C as X}from"../chunks/CodeBlock.6896320e.js";import{H as V,E as N}from"../chunks/getInferenceSnippets.d410b42d.js";function K(b){let a,p='对于 Gaudi 优化的扩散管道实现，我们推荐使用 <a href="https://huggingface.co/docs/optimum/main/en/habana/index" rel="nofollow">Optimum for Intel Gaudi</a>。';return{c(){a=T("p"),a.innerHTML=p},l(i){a=g(i,"P",{"data-svelte-h":!0}),E(a)!=="svelte-1o0va8c"&&(a.innerHTML=p)},m(i,$){n(i,a,$)},p:q,d(i){i&&l(a)}}}function tt(b){let a,p,i,$,u,G,m,Z='Intel Gaudi AI 加速器系列包括 <a href="https://habana.ai/products/gaudi/" rel="nofollow">Intel Gaudi 1</a>、<a href="https://habana.ai/products/gaudi2/" rel="nofollow">Intel Gaudi 2</a> 和 <a href="https://habana.ai/products/gaudi3/" rel="nofollow">Intel Gaudi 3</a>。每台服务器配备 8 个设备，称为 Habana 处理单元 (HPU)，在 Gaudi 3 上提供 128GB 内存，在 Gaudi 2 上提供 96GB 内存，在第一代 Gaudi 上提供 32GB 内存。有关底层硬件架构的更多详细信息，请查看 <a href="https://docs.habana.ai/en/latest/Gaudi_Overview/Gaudi_Architecture.html" rel="nofollow">Gaudi 架构</a> 概述。',U,f,x='Diffusers 管道可以利用 HPU 加速，即使管道尚未添加到 <a href="https://huggingface.co/docs/optimum/main/en/habana/index" rel="nofollow">Optimum for Intel Gaudi</a>，也可以通过 <a href="https://docs.habana.ai/en/latest/PyTorch/PyTorch_Model_Porting/GPU_Migration_Toolkit/GPU_Migration_Toolkit.html" rel="nofollow">GPU 迁移工具包</a> 实现。',w,c,O="在您的管道上调用 <code>.to(&quot;hpu&quot;)</code> 以将其移动到 HPU 设备，如下所示为 Flux 示例：",_,h,Q,r,j,d,P,M,R;return u=new V({props:{title:"Intel Gaudi",local:"intel-gaudi",headingTag:"h1"}}),h=new X({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwRGlmZnVzaW9uUGlwZWxpbmUlMEElMEFwaXBlbGluZSUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJibGFjay1mb3Jlc3QtbGFicyUyRkZMVVguMS1zY2huZWxsJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5iZmxvYXQxNiklMEFwaXBlbGluZS50byglMjJocHUlMjIpJTBBJTBBaW1hZ2UlMjAlM0QlMjBwaXBlbGluZSglMjIlRTQlQjglODAlRTUlQkMlQTAlRTYlOUQlQkUlRTklQkMlQTAlRTUlOUMlQTglRTYlQUYlOTUlRTUlOEElQTAlRTclQjQlQTIlRTklQTMlOEUlRTYlQTAlQkMlRTQlQjglQUQlRTclOUElODQlRTUlOUIlQkUlRTUlODMlOEYlMjIpLmltYWdlcyU1QjAlNUQ=",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline

pipeline = DiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;black-forest-labs/FLUX.1-schnell&quot;</span>, torch_dtype=torch.bfloat16)
pipeline.to(<span class="hljs-string">&quot;hpu&quot;</span>)

image = pipeline(<span class="hljs-string">&quot;一张松鼠在毕加索风格中的图像&quot;</span>).images[<span class="hljs-number">0</span>]`,wrap:!1}}),r=new S({props:{warning:!1,$$slots:{default:[K]},$$scope:{ctx:b}}}),d=new N({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/zh/optimization/habana.md"}}),{c(){a=T("meta"),p=s(),i=T("p"),$=s(),k(u.$$.fragment),G=s(),m=T("p"),m.innerHTML=Z,U=s(),f=T("p"),f.innerHTML=x,w=s(),c=T("p"),c.innerHTML=O,_=s(),k(h.$$.fragment),Q=s(),k(r.$$.fragment),j=s(),k(d.$$.fragment),P=s(),M=T("p"),this.h()},l(t){const e=D("svelte-u9bgzb",document.head);a=g(e,"META",{name:!0,content:!0}),e.forEach(l),p=o(t),i=g(t,"P",{}),L(i).forEach(l),$=o(t),y(u.$$.fragment,t),G=o(t),m=g(t,"P",{"data-svelte-h":!0}),E(m)!=="svelte-mh5zja"&&(m.innerHTML=Z),U=o(t),f=g(t,"P",{"data-svelte-h":!0}),E(f)!=="svelte-7cd3xk"&&(f.innerHTML=x),w=o(t),c=g(t,"P",{"data-svelte-h":!0}),E(c)!=="svelte-1vh47tk"&&(c.innerHTML=O),_=o(t),y(h.$$.fragment,t),Q=o(t),y(r.$$.fragment,t),j=o(t),y(d.$$.fragment,t),P=o(t),M=g(t,"P",{}),L(M).forEach(l),this.h()},h(){A(a,"name","hf:doc:metadata"),A(a,"content",et)},m(t,e){F(document.head,a),n(t,p,e),n(t,i,e),n(t,$,e),I(u,t,e),n(t,G,e),n(t,m,e),n(t,U,e),n(t,f,e),n(t,w,e),n(t,c,e),n(t,_,e),I(h,t,e),n(t,Q,e),I(r,t,e),n(t,j,e),I(d,t,e),n(t,P,e),n(t,M,e),R=!0},p(t,[e]){const B={};e&2&&(B.$$scope={dirty:e,ctx:t}),r.$set(B)},i(t){R||(J(u.$$.fragment,t),J(h.$$.fragment,t),J(r.$$.fragment,t),J(d.$$.fragment,t),R=!0)},o(t){v(u.$$.fragment,t),v(h.$$.fragment,t),v(r.$$.fragment,t),v(d.$$.fragment,t),R=!1},d(t){t&&(l(p),l(i),l($),l(G),l(m),l(U),l(f),l(w),l(c),l(_),l(Q),l(j),l(P),l(M)),l(a),H(u,t),H(h,t),H(r,t),H(d,t)}}}const et='{"title":"Intel Gaudi","local":"intel-gaudi","sections":[],"depth":1}';function lt(b){return Y(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class rt extends z{constructor(a){super(),W(this,a,lt,tt,C,{})}}export{rt as component};
