import{s as q,n as A,o as z}from"../chunks/scheduler.5c93273d.js";import{S as Y,i as W,g as h,s as i,r as R,A as D,h as d,f as l,c as s,j as C,u as I,x as y,k as P,y as F,a,v as J,d as v,t as E,w as H}from"../chunks/index.e43dd92b.js";import{C as S}from"../chunks/CodeBlock.6896320e.js";import{H as X,E as V}from"../chunks/getInferenceSnippets.7a494bf3.js";function N(O){let n,g,T,M,r,U,p,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> 概述。',G,u,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,m,B="在您的管道上调用 <code>.to(&quot;hpu&quot;)</code> 以将其移动到 HPU 设备，如下所示为 Flux 示例：",_,c,Q,o,L='<p>对于 Gaudi 优化的扩散管道实现，我们推荐使用 <a href="https://huggingface.co/docs/optimum/main/en/habana/index" rel="nofollow">Optimum for Intel Gaudi</a>。</p>',$,f,j,b,k;return r=new X({props:{title:"Intel Gaudi",local:"intel-gaudi",headingTag:"h1"}}),c=new S({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}}),f=new V({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/zh/optimization/habana.md"}}),{c(){n=h("meta"),g=i(),T=h("p"),M=i(),R(r.$$.fragment),U=i(),p=h("p"),p.innerHTML=Z,G=i(),u=h("p"),u.innerHTML=x,w=i(),m=h("p"),m.innerHTML=B,_=i(),R(c.$$.fragment),Q=i(),o=h("blockquote"),o.innerHTML=L,$=i(),R(f.$$.fragment),j=i(),b=h("p"),this.h()},l(t){const e=D("svelte-u9bgzb",document.head);n=d(e,"META",{name:!0,content:!0}),e.forEach(l),g=s(t),T=d(t,"P",{}),C(T).forEach(l),M=s(t),I(r.$$.fragment,t),U=s(t),p=d(t,"P",{"data-svelte-h":!0}),y(p)!=="svelte-mh5zja"&&(p.innerHTML=Z),G=s(t),u=d(t,"P",{"data-svelte-h":!0}),y(u)!=="svelte-7cd3xk"&&(u.innerHTML=x),w=s(t),m=d(t,"P",{"data-svelte-h":!0}),y(m)!=="svelte-1vh47tk"&&(m.innerHTML=B),_=s(t),I(c.$$.fragment,t),Q=s(t),o=d(t,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),y(o)!=="svelte-c1zwav"&&(o.innerHTML=L),$=s(t),I(f.$$.fragment,t),j=s(t),b=d(t,"P",{}),C(b).forEach(l),this.h()},h(){P(n,"name","hf:doc:metadata"),P(n,"content",K),P(o,"class","tip")},m(t,e){F(document.head,n),a(t,g,e),a(t,T,e),a(t,M,e),J(r,t,e),a(t,U,e),a(t,p,e),a(t,G,e),a(t,u,e),a(t,w,e),a(t,m,e),a(t,_,e),J(c,t,e),a(t,Q,e),a(t,o,e),a(t,$,e),J(f,t,e),a(t,j,e),a(t,b,e),k=!0},p:A,i(t){k||(v(r.$$.fragment,t),v(c.$$.fragment,t),v(f.$$.fragment,t),k=!0)},o(t){E(r.$$.fragment,t),E(c.$$.fragment,t),E(f.$$.fragment,t),k=!1},d(t){t&&(l(g),l(T),l(M),l(U),l(p),l(G),l(u),l(w),l(m),l(_),l(Q),l(o),l($),l(j),l(b)),l(n),H(r,t),H(c,t),H(f,t)}}}const K='{"title":"Intel Gaudi","local":"intel-gaudi","sections":[],"depth":1}';function tt(O){return z(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class it extends Y{constructor(n){super(),W(this,n,tt,N,q,{})}}export{it as component};
