import{s as me,n as re,o as de}from"../chunks/scheduler.6e0d5ff7.js";import{S as ce,i as he,g as s,s as i,r as _,E as Me,h as u,f as a,c as n,j as oe,u as C,x as p,k as pe,y as be,a as l,v as $,d as H,t as Z,w as I}from"../chunks/index.d7c1b260.js";import{C as fe}from"../chunks/CodeBlock.09a08494.js";import{H as A}from"../chunks/Heading.30a009b0.js";function ye(K){let o,S,j,v,f,B,m,O='🤗 Diffusers는 🤗 <a href="https://huggingface.co/docs/optimum/habana/usage_guides/stable_diffusion" rel="nofollow">Optimum Habana</a>를 통해서 Habana Gaudi와 호환됩니다.',x,r,Q,d,ee='<li>Optimum Habana 1.4 또는 이후, <a href="https://huggingface.co/docs/optimum/habana/installation" rel="nofollow">여기</a>에 설치하는 방법이 있습니다.</li> <li>SynapseAI 1.8.</li>',k,c,E,h,te="Gaudi에서 Stable Diffusion 1 및 2로 이미지를 생성하려면 두 인스턴스를 인스턴스화해야 합니다:",V,M,ae='<li><a href="https://huggingface.co/docs/optimum/habana/package_reference/stable_diffusion_pipeline" rel="nofollow"><code>GaudiStableDiffusionPipeline</code></a>이 포함된 파이프라인. 이 파이프라인은 <em>텍스트-이미지 생성</em>을 지원합니다.</li> <li><a href="https://huggingface.co/docs/optimum/habana/package_reference/stable_diffusion_pipeline#optimum.habana.diffusers.GaudiDDIMScheduler" rel="nofollow"><code>GaudiDDIMScheduler</code></a>이 포함된 스케줄러. 이 스케줄러는 Habana Gaudi에 최적화되어 있습니다.</li>',N,b,le=`파이프라인을 초기화할 때, HPU에 배포하기 위해 <code>use_habana=True</code>를 지정해야 합니다.
또한 가능한 가장 빠른 생성을 위해 <code>use_hpu_graphs=True</code>로 <strong>HPU 그래프</strong>를 활성화해야 합니다.
마지막으로, <a href="https://huggingface.co/Habana" rel="nofollow">Hugging Face Hub</a>에서 다운로드할 수 있는 <a href="https://huggingface.co/docs/optimum/habana/package_reference/gaudi_config" rel="nofollow">Gaudi configuration</a>을 지정해야 합니다.`,R,y,D,g,ie="파이프라인을 호출하여 하나 이상의 프롬프트에서 배치별로 이미지를 생성할 수 있습니다.",L,U,F,T,ne='더 많은 정보를 얻기 위해, Optimum Habana의 <a href="https://huggingface.co/docs/optimum/habana/usage_guides/stable_diffusion" rel="nofollow">문서</a>와 공식 Github 저장소에 제공된 <a href="https://github.com/huggingface/optimum-habana/tree/main/examples/stable-diffusion" rel="nofollow">예시</a>를 확인하세요.',X,w,q,J,se='다음은 <a href="https://huggingface.co/Habana/stable-diffusion" rel="nofollow">Habana/stable-diffusion</a> Gaudi 구성(혼합 정밀도 bf16/fp32)을 사용하는 Habana first-generation Gaudi 및 Gaudi2의 지연 시간입니다:',Y,G,ue='<thead><tr><th></th> <th align="center">Latency (배치 크기 = 1)</th> <th align="center">Throughput (배치 크기 = 8)</th></tr></thead> <tbody><tr><td>first-generation Gaudi</td> <td align="center">4.29s</td> <td align="center">0.283 images/s</td></tr> <tr><td>Gaudi2</td> <td align="center">1.54s</td> <td align="center">0.904 images/s</td></tr></tbody>',P,W,z;return f=new A({props:{title:"Habana Gaudi에서 Stable Diffusion을 사용하는 방법",local:"habana-gaudi에서-stable-diffusion을-사용하는-방법",headingTag:"h1"}}),r=new A({props:{title:"요구 사항",local:"요구-사항",headingTag:"h2"}}),c=new A({props:{title:"추론 파이프라인",local:"추론-파이프라인",headingTag:"h2"}}),y=new fe({props:{code:"ZnJvbSUyMG9wdGltdW0uaGFiYW5hJTIwaW1wb3J0JTIwR2F1ZGlDb25maWclMEFmcm9tJTIwb3B0aW11bS5oYWJhbmEuZGlmZnVzZXJzJTIwaW1wb3J0JTIwR2F1ZGlERElNU2NoZWR1bGVyJTJDJTIwR2F1ZGlTdGFibGVEaWZmdXNpb25QaXBlbGluZSUwQSUwQW1vZGVsX25hbWUlMjAlM0QlMjAlMjJzdGFiaWxpdHlhaSUyRnN0YWJsZS1kaWZmdXNpb24tMi1iYXNlJTIyJTBBc2NoZWR1bGVyJTIwJTNEJTIwR2F1ZGlERElNU2NoZWR1bGVyLmZyb21fcHJldHJhaW5lZChtb2RlbF9uYW1lJTJDJTIwc3ViZm9sZGVyJTNEJTIyc2NoZWR1bGVyJTIyKSUwQXBpcGVsaW5lJTIwJTNEJTIwR2F1ZGlTdGFibGVEaWZmdXNpb25QaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwbW9kZWxfbmFtZSUyQyUwQSUyMCUyMCUyMCUyMHNjaGVkdWxlciUzRHNjaGVkdWxlciUyQyUwQSUyMCUyMCUyMCUyMHVzZV9oYWJhbmElM0RUcnVlJTJDJTBBJTIwJTIwJTIwJTIwdXNlX2hwdV9ncmFwaHMlM0RUcnVlJTJDJTBBJTIwJTIwJTIwJTIwZ2F1ZGlfY29uZmlnJTNEJTIySGFiYW5hJTJGc3RhYmxlLWRpZmZ1c2lvbiUyMiUyQyUwQSk=",highlighted:`<span class="hljs-keyword">from</span> optimum.habana <span class="hljs-keyword">import</span> GaudiConfig
<span class="hljs-keyword">from</span> optimum.habana.diffusers <span class="hljs-keyword">import</span> GaudiDDIMScheduler, GaudiStableDiffusionPipeline

model_name = <span class="hljs-string">&quot;stabilityai/stable-diffusion-2-base&quot;</span>
scheduler = GaudiDDIMScheduler.from_pretrained(model_name, subfolder=<span class="hljs-string">&quot;scheduler&quot;</span>)
pipeline = GaudiStableDiffusionPipeline.from_pretrained(
    model_name,
    scheduler=scheduler,
    use_habana=<span class="hljs-literal">True</span>,
    use_hpu_graphs=<span class="hljs-literal">True</span>,
    gaudi_config=<span class="hljs-string">&quot;Habana/stable-diffusion&quot;</span>,
)`,wrap:!1}}),U=new fe({props:{code:"b3V0cHV0cyUyMCUzRCUyMHBpcGVsaW5lKCUwQSUyMCUyMCUyMCUyMHByb21wdCUzRCU1QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMkhpZ2glMjBxdWFsaXR5JTIwcGhvdG8lMjBvZiUyMGFuJTIwYXN0cm9uYXV0JTIwcmlkaW5nJTIwYSUyMGhvcnNlJTIwaW4lMjBzcGFjZSUyMiUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMkZhY2UlMjBvZiUyMGElMjB5ZWxsb3clMjBjYXQlMkMlMjBoaWdoJTIwcmVzb2x1dGlvbiUyQyUyMHNpdHRpbmclMjBvbiUyMGElMjBwYXJrJTIwYmVuY2glMjIlMkMlMEElMjAlMjAlMjAlMjAlNUQlMkMlMEElMjAlMjAlMjAlMjBudW1faW1hZ2VzX3Blcl9wcm9tcHQlM0QxMCUyQyUwQSUyMCUyMCUyMCUyMGJhdGNoX3NpemUlM0Q0JTJDJTBBKQ==",highlighted:`outputs = pipeline(
    prompt=[
        <span class="hljs-string">&quot;High quality photo of an astronaut riding a horse in space&quot;</span>,
        <span class="hljs-string">&quot;Face of a yellow cat, high resolution, sitting on a park bench&quot;</span>,
    ],
    num_images_per_prompt=<span class="hljs-number">10</span>,
    batch_size=<span class="hljs-number">4</span>,
)`,wrap:!1}}),w=new A({props:{title:"벤치마크",local:"벤치마크",headingTag:"h2"}}),{c(){o=s("meta"),S=i(),j=s("p"),v=i(),_(f.$$.fragment),B=i(),m=s("p"),m.innerHTML=O,x=i(),_(r.$$.fragment),Q=i(),d=s("ul"),d.innerHTML=ee,k=i(),_(c.$$.fragment),E=i(),h=s("p"),h.textContent=te,V=i(),M=s("ul"),M.innerHTML=ae,N=i(),b=s("p"),b.innerHTML=le,R=i(),_(y.$$.fragment),D=i(),g=s("p"),g.textContent=ie,L=i(),_(U.$$.fragment),F=i(),T=s("p"),T.innerHTML=ne,X=i(),_(w.$$.fragment),q=i(),J=s("p"),J.innerHTML=se,Y=i(),G=s("table"),G.innerHTML=ue,P=i(),W=s("p"),this.h()},l(e){const t=Me("svelte-u9bgzb",document.head);o=u(t,"META",{name:!0,content:!0}),t.forEach(a),S=n(e),j=u(e,"P",{}),oe(j).forEach(a),v=n(e),C(f.$$.fragment,e),B=n(e),m=u(e,"P",{"data-svelte-h":!0}),p(m)!=="svelte-1qm46eq"&&(m.innerHTML=O),x=n(e),C(r.$$.fragment,e),Q=n(e),d=u(e,"UL",{"data-svelte-h":!0}),p(d)!=="svelte-1plptsp"&&(d.innerHTML=ee),k=n(e),C(c.$$.fragment,e),E=n(e),h=u(e,"P",{"data-svelte-h":!0}),p(h)!=="svelte-brqa4p"&&(h.textContent=te),V=n(e),M=u(e,"UL",{"data-svelte-h":!0}),p(M)!=="svelte-mqq187"&&(M.innerHTML=ae),N=n(e),b=u(e,"P",{"data-svelte-h":!0}),p(b)!=="svelte-18upou6"&&(b.innerHTML=le),R=n(e),C(y.$$.fragment,e),D=n(e),g=u(e,"P",{"data-svelte-h":!0}),p(g)!=="svelte-17u0cke"&&(g.textContent=ie),L=n(e),C(U.$$.fragment,e),F=n(e),T=u(e,"P",{"data-svelte-h":!0}),p(T)!=="svelte-16e6qx2"&&(T.innerHTML=ne),X=n(e),C(w.$$.fragment,e),q=n(e),J=u(e,"P",{"data-svelte-h":!0}),p(J)!=="svelte-1rc3yyr"&&(J.innerHTML=se),Y=n(e),G=u(e,"TABLE",{"data-svelte-h":!0}),p(G)!=="svelte-hkcvmz"&&(G.innerHTML=ue),P=n(e),W=u(e,"P",{}),oe(W).forEach(a),this.h()},h(){pe(o,"name","hf:doc:metadata"),pe(o,"content",ge)},m(e,t){be(document.head,o),l(e,S,t),l(e,j,t),l(e,v,t),$(f,e,t),l(e,B,t),l(e,m,t),l(e,x,t),$(r,e,t),l(e,Q,t),l(e,d,t),l(e,k,t),$(c,e,t),l(e,E,t),l(e,h,t),l(e,V,t),l(e,M,t),l(e,N,t),l(e,b,t),l(e,R,t),$(y,e,t),l(e,D,t),l(e,g,t),l(e,L,t),$(U,e,t),l(e,F,t),l(e,T,t),l(e,X,t),$(w,e,t),l(e,q,t),l(e,J,t),l(e,Y,t),l(e,G,t),l(e,P,t),l(e,W,t),z=!0},p:re,i(e){z||(H(f.$$.fragment,e),H(r.$$.fragment,e),H(c.$$.fragment,e),H(y.$$.fragment,e),H(U.$$.fragment,e),H(w.$$.fragment,e),z=!0)},o(e){Z(f.$$.fragment,e),Z(r.$$.fragment,e),Z(c.$$.fragment,e),Z(y.$$.fragment,e),Z(U.$$.fragment,e),Z(w.$$.fragment,e),z=!1},d(e){e&&(a(S),a(j),a(v),a(B),a(m),a(x),a(Q),a(d),a(k),a(E),a(h),a(V),a(M),a(N),a(b),a(R),a(D),a(g),a(L),a(F),a(T),a(X),a(q),a(J),a(Y),a(G),a(P),a(W)),a(o),I(f,e),I(r,e),I(c,e),I(y,e),I(U,e),I(w,e)}}}const ge='{"title":"Habana Gaudi에서 Stable Diffusion을 사용하는 방법","local":"habana-gaudi에서-stable-diffusion을-사용하는-방법","sections":[{"title":"요구 사항","local":"요구-사항","sections":[],"depth":2},{"title":"추론 파이프라인","local":"추론-파이프라인","sections":[],"depth":2},{"title":"벤치마크","local":"벤치마크","sections":[],"depth":2}],"depth":1}';function Ue(K){return de(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class _e extends ce{constructor(o){super(),he(this,o,Ue,ye,me,{})}}export{_e as component};
