import{s as he,n as Me,o as be}from"../chunks/scheduler.23542ac5.js";import{S as ye,i as ge,e as s,s as i,c as f,h as Ue,a as u,d as a,b as n,f as re,g as m,j as o,k as de,l as Te,m as l,n as r,t as d,o as c,p as h}from"../chunks/index.9b1f405b.js";import{C as we,H as te,E as Je}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.ccdc6aab.js";import{C as ce}from"../chunks/CodeBlock.cef191d3.js";function $e(ae){let p,x,S,B,M,Q,b,k,y,le='🤗 Diffusers는 🤗 <a href="https://huggingface.co/docs/optimum/habana/usage_guides/stable_diffusion" rel="nofollow">Optimum Habana</a>를 통해서 Habana Gaudi와 호환됩니다.',E,g,V,U,ie='<li>Optimum Habana 1.4 또는 이후, <a href="https://huggingface.co/docs/optimum/habana/installation" rel="nofollow">여기</a>에 설치하는 방법이 있습니다.</li> <li>SynapseAI 1.8.</li>',N,T,R,w,ne="Gaudi에서 Stable Diffusion 1 및 2로 이미지를 생성하려면 두 인스턴스를 인스턴스화해야 합니다:",L,J,se='<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>',D,$,ue=`파이프라인을 초기화할 때, 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>을 지정해야 합니다.`,F,G,X,C,pe="파이프라인을 호출하여 하나 이상의 프롬프트에서 배치별로 이미지를 생성할 수 있습니다.",Y,_,q,H,oe='더 많은 정보를 얻기 위해, 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>를 확인하세요.',P,I,z,Z,fe='다음은 <a href="https://huggingface.co/Habana/stable-diffusion" rel="nofollow">Habana/stable-diffusion</a> Gaudi 구성(혼합 정밀도 bf16/fp32)을 사용하는 Habana first-generation Gaudi 및 Gaudi2의 지연 시간입니다:',A,j,me='<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>',O,W,K,v,ee;return M=new we({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),b=new te({props:{title:"Intel Gaudi에서 Stable Diffusion을 사용하는 방법",local:"intel-gaudi에서-stable-diffusion을-사용하는-방법",headingTag:"h1"}}),g=new te({props:{title:"요구 사항",local:"요구-사항",headingTag:"h2"}}),T=new te({props:{title:"추론 파이프라인",local:"추론-파이프라인",headingTag:"h2"}}),G=new ce({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}}),_=new ce({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}}),I=new te({props:{title:"벤치마크",local:"벤치마크",headingTag:"h2"}}),W=new Je({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/ko/optimization/habana.md"}}),{c(){p=s("meta"),x=i(),S=s("p"),B=i(),f(M.$$.fragment),Q=i(),f(b.$$.fragment),k=i(),y=s("p"),y.innerHTML=le,E=i(),f(g.$$.fragment),V=i(),U=s("ul"),U.innerHTML=ie,N=i(),f(T.$$.fragment),R=i(),w=s("p"),w.textContent=ne,L=i(),J=s("ul"),J.innerHTML=se,D=i(),$=s("p"),$.innerHTML=ue,F=i(),f(G.$$.fragment),X=i(),C=s("p"),C.textContent=pe,Y=i(),f(_.$$.fragment),q=i(),H=s("p"),H.innerHTML=oe,P=i(),f(I.$$.fragment),z=i(),Z=s("p"),Z.innerHTML=fe,A=i(),j=s("table"),j.innerHTML=me,O=i(),f(W.$$.fragment),K=i(),v=s("p"),this.h()},l(e){const t=Ue("svelte-u9bgzb",document.head);p=u(t,"META",{name:!0,content:!0}),t.forEach(a),x=n(e),S=u(e,"P",{}),re(S).forEach(a),B=n(e),m(M.$$.fragment,e),Q=n(e),m(b.$$.fragment,e),k=n(e),y=u(e,"P",{"data-svelte-h":!0}),o(y)!=="svelte-1qm46eq"&&(y.innerHTML=le),E=n(e),m(g.$$.fragment,e),V=n(e),U=u(e,"UL",{"data-svelte-h":!0}),o(U)!=="svelte-1plptsp"&&(U.innerHTML=ie),N=n(e),m(T.$$.fragment,e),R=n(e),w=u(e,"P",{"data-svelte-h":!0}),o(w)!=="svelte-brqa4p"&&(w.textContent=ne),L=n(e),J=u(e,"UL",{"data-svelte-h":!0}),o(J)!=="svelte-mqq187"&&(J.innerHTML=se),D=n(e),$=u(e,"P",{"data-svelte-h":!0}),o($)!=="svelte-18upou6"&&($.innerHTML=ue),F=n(e),m(G.$$.fragment,e),X=n(e),C=u(e,"P",{"data-svelte-h":!0}),o(C)!=="svelte-17u0cke"&&(C.textContent=pe),Y=n(e),m(_.$$.fragment,e),q=n(e),H=u(e,"P",{"data-svelte-h":!0}),o(H)!=="svelte-1o7u9ba"&&(H.innerHTML=oe),P=n(e),m(I.$$.fragment,e),z=n(e),Z=u(e,"P",{"data-svelte-h":!0}),o(Z)!=="svelte-1rc3yyr"&&(Z.innerHTML=fe),A=n(e),j=u(e,"TABLE",{"data-svelte-h":!0}),o(j)!=="svelte-hkcvmz"&&(j.innerHTML=me),O=n(e),m(W.$$.fragment,e),K=n(e),v=u(e,"P",{}),re(v).forEach(a),this.h()},h(){de(p,"name","hf:doc:metadata"),de(p,"content",Ge)},m(e,t){Te(document.head,p),l(e,x,t),l(e,S,t),l(e,B,t),r(M,e,t),l(e,Q,t),r(b,e,t),l(e,k,t),l(e,y,t),l(e,E,t),r(g,e,t),l(e,V,t),l(e,U,t),l(e,N,t),r(T,e,t),l(e,R,t),l(e,w,t),l(e,L,t),l(e,J,t),l(e,D,t),l(e,$,t),l(e,F,t),r(G,e,t),l(e,X,t),l(e,C,t),l(e,Y,t),r(_,e,t),l(e,q,t),l(e,H,t),l(e,P,t),r(I,e,t),l(e,z,t),l(e,Z,t),l(e,A,t),l(e,j,t),l(e,O,t),r(W,e,t),l(e,K,t),l(e,v,t),ee=!0},p:Me,i(e){ee||(d(M.$$.fragment,e),d(b.$$.fragment,e),d(g.$$.fragment,e),d(T.$$.fragment,e),d(G.$$.fragment,e),d(_.$$.fragment,e),d(I.$$.fragment,e),d(W.$$.fragment,e),ee=!0)},o(e){c(M.$$.fragment,e),c(b.$$.fragment,e),c(g.$$.fragment,e),c(T.$$.fragment,e),c(G.$$.fragment,e),c(_.$$.fragment,e),c(I.$$.fragment,e),c(W.$$.fragment,e),ee=!1},d(e){e&&(a(x),a(S),a(B),a(Q),a(k),a(y),a(E),a(V),a(U),a(N),a(R),a(w),a(L),a(J),a(D),a($),a(F),a(X),a(C),a(Y),a(q),a(H),a(P),a(z),a(Z),a(A),a(j),a(O),a(K),a(v)),a(p),h(M,e),h(b,e),h(g,e),h(T,e),h(G,e),h(_,e),h(I,e),h(W,e)}}}const Ge='{"title":"Intel Gaudi에서 Stable Diffusion을 사용하는 방법","local":"intel-gaudi에서-stable-diffusion을-사용하는-방법","sections":[{"title":"요구 사항","local":"요구-사항","sections":[],"depth":2},{"title":"추론 파이프라인","local":"추론-파이프라인","sections":[],"depth":2},{"title":"벤치마크","local":"벤치마크","sections":[],"depth":2}],"depth":1}';function Ce(ae){return be(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class je extends ye{constructor(p){super(),ge(this,p,Ce,$e,he,{})}}export{je as component};
