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