import{s as dt,j as ht,o as $t,n as _t}from"../chunks/scheduler.6e0d5ff7.js";import{S as wt,i as Tt,g as s,s as i,r as M,E as vt,h as p,f as n,c as o,j as it,u as F,x as m,k as G,y as Jt,a as l,v as Z,d as I,t as N,w as U}from"../chunks/index.d7c1b260.js";import{T as xt}from"../chunks/Tip.c000e27b.js";import{C as lt}from"../chunks/CodeBlock.09a08494.js";import{D as yt}from"../chunks/DocNotebookDropdown.b1b23d60.js";import{H as Ct}from"../chunks/Heading.30a009b0.js";function kt(q){let a,g="💡 나만의 unconditional 이미지 생성 모델을 학습시키고 싶으신가요? 학습 가이드를 살펴보고 나만의 이미지를 생성하는 방법을 알아보세요.";return{c(){a=s("p"),a.textContent=g},l(f){a=p(f,"P",{"data-svelte-h":!0}),m(a)!=="svelte-1rcr7p4"&&(a.textContent=g)},m(f,j){l(f,a,j)},p:_t,d(f){f&&n(a)}}}function Pt(q){let a,g,f,j,c,E,b,L,d,ot="Unconditional 이미지 생성은 비교적 간단한 작업입니다. 모델이 텍스트나 이미지와 같은 추가 조건 없이 이미 학습된 학습 데이터와 유사한 이미지만 생성합니다.",D,h,at="[‘DiffusionPipeline’]은 추론을 위해 미리 학습된 diffusion 시스템을 사용하는 가장 쉬운 방법입니다.",H,$,st='먼저 [‘DiffusionPipeline’]의 인스턴스를 생성하고 다운로드할 파이프라인의 <a href="https://huggingface.co/models?library=diffusers&amp;sort=downloads" rel="nofollow">체크포인트</a>를 지정합니다. 허브의 🧨 diffusion 체크포인트 중 하나를 사용할 수 있습니다(사용할 체크포인트는 나비 이미지를 생성합니다).',V,u,B,_,pt='이 가이드에서는 unconditional 이미지 생성에 [‘DiffusionPipeline’]과 <a href="https://arxiv.org/abs/2006.11239" rel="nofollow">DDPM</a>을 사용합니다:',R,w,S,T,ft="[diffusion 파이프라인]은 모든 모델링, 토큰화, 스케줄링 구성 요소를 다운로드하고 캐시합니다. 이 모델은 약 14억 개의 파라미터로 구성되어 있기 때문에 GPU에서 실행할 것을 강력히 권장합니다. PyTorch에서와 마찬가지로 제너레이터 객체를 GPU로 옮길 수 있습니다:",z,v,K,J,rt="이제 제너레이터를 사용하여 이미지를 생성할 수 있습니다:",A,x,X,y,mt='출력은 기본적으로 <a href="https://pillow.readthedocs.io/en/stable/reference/Image.html?highlight=image#the-image-class" rel="nofollow">PIL.Image</a> 객체로 감싸집니다.',Q,C,ut="다음을 호출하여 이미지를 저장할 수 있습니다:",O,k,Y,P,gt="아래 스페이스(데모 링크)를 이용해 보고, 추론 단계의 매개변수를 자유롭게 조절하여 이미지 품질에 어떤 영향을 미치는지 확인해 보세요!",tt,r,ct,et,W,nt;return c=new Ct({props:{title:"Unconditional 이미지 생성",local:"unconditional-이미지-생성",headingTag:"h1"}}),b=new yt({props:{classNames:"absolute z-10 right-0 top-0",options:[{label:"Mixed",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers_doc/ko/unconditional_image_generation.ipynb"},{label:"PyTorch",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers_doc/ko/pytorch/unconditional_image_generation.ipynb"},{label:"TensorFlow",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers_doc/ko/tensorflow/unconditional_image_generation.ipynb"},{label:"Mixed",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/diffusers_doc/ko/unconditional_image_generation.ipynb"},{label:"PyTorch",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/diffusers_doc/ko/pytorch/unconditional_image_generation.ipynb"},{label:"TensorFlow",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/diffusers_doc/ko/tensorflow/unconditional_image_generation.ipynb"}]}}),u=new xt({props:{$$slots:{default:[kt]},$$scope:{ctx:q}}}),w=new lt({props:{code:"JTIwJTNFJTNFJTNFJTIwZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBJTBBJTIwJTNFJTNFJTNFJTIwZ2VuZXJhdG9yJTIwJTNEJTIwRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUyMmFudG9uLWwlMkZkZHBtLWJ1dHRlcmZsaWVzLTEyOCUyMik=",highlighted:` &gt;&gt;&gt; <span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline

 &gt;&gt;&gt; generator = DiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;anton-l/ddpm-butterflies-128&quot;</span>)`,wrap:!1}}),v=new lt({props:{code:"JTIwJTNFJTNFJTNFJTIwZ2VuZXJhdG9yLnRvKCUyMmN1ZGElMjIp",highlighted:' &gt;&gt;&gt; generator.to(<span class="hljs-string">&quot;cuda&quot;</span>)',wrap:!1}}),x=new lt({props:{code:"JTIwJTNFJTNFJTNFJTIwaW1hZ2UlMjAlM0QlMjBnZW5lcmF0b3IoKS5pbWFnZXMlNUIwJTVE",highlighted:' &gt;&gt;&gt; image = generator().images[<span class="hljs-number">0</span>]',wrap:!1}}),k=new lt({props:{code:"JTIwJTNFJTNFJTNFJTIwaW1hZ2Uuc2F2ZSglMjJnZW5lcmF0ZWRfaW1hZ2UucG5nJTIyKQ==",highlighted:' &gt;&gt;&gt; image.save(<span class="hljs-string">&quot;generated_image.png&quot;</span>)',wrap:!1}}),{c(){a=s("meta"),g=i(),f=s("p"),j=i(),M(c.$$.fragment),E=i(),M(b.$$.fragment),L=i(),d=s("p"),d.textContent=ot,D=i(),h=s("p"),h.textContent=at,H=i(),$=s("p"),$.innerHTML=st,V=i(),M(u.$$.fragment),B=i(),_=s("p"),_.innerHTML=pt,R=i(),M(w.$$.fragment),S=i(),T=s("p"),T.textContent=ft,z=i(),M(v.$$.fragment),K=i(),J=s("p"),J.textContent=rt,A=i(),M(x.$$.fragment),X=i(),y=s("p"),y.innerHTML=mt,Q=i(),C=s("p"),C.textContent=ut,O=i(),M(k.$$.fragment),Y=i(),P=s("p"),P.textContent=gt,tt=i(),r=s("iframe"),et=i(),W=s("p"),this.h()},l(t){const e=vt("svelte-u9bgzb",document.head);a=p(e,"META",{name:!0,content:!0}),e.forEach(n),g=o(t),f=p(t,"P",{}),it(f).forEach(n),j=o(t),F(c.$$.fragment,t),E=o(t),F(b.$$.fragment,t),L=o(t),d=p(t,"P",{"data-svelte-h":!0}),m(d)!=="svelte-tfszx0"&&(d.textContent=ot),D=o(t),h=p(t,"P",{"data-svelte-h":!0}),m(h)!=="svelte-10qi7c6"&&(h.textContent=at),H=o(t),$=p(t,"P",{"data-svelte-h":!0}),m($)!=="svelte-gbmace"&&($.innerHTML=st),V=o(t),F(u.$$.fragment,t),B=o(t),_=p(t,"P",{"data-svelte-h":!0}),m(_)!=="svelte-1h0b378"&&(_.innerHTML=pt),R=o(t),F(w.$$.fragment,t),S=o(t),T=p(t,"P",{"data-svelte-h":!0}),m(T)!=="svelte-19iqs64"&&(T.textContent=ft),z=o(t),F(v.$$.fragment,t),K=o(t),J=p(t,"P",{"data-svelte-h":!0}),m(J)!=="svelte-1v4twko"&&(J.textContent=rt),A=o(t),F(x.$$.fragment,t),X=o(t),y=p(t,"P",{"data-svelte-h":!0}),m(y)!=="svelte-q9tjpq"&&(y.innerHTML=mt),Q=o(t),C=p(t,"P",{"data-svelte-h":!0}),m(C)!=="svelte-t33pj2"&&(C.textContent=ut),O=o(t),F(k.$$.fragment,t),Y=o(t),P=p(t,"P",{"data-svelte-h":!0}),m(P)!=="svelte-ymgaag"&&(P.textContent=gt),tt=o(t),r=p(t,"IFRAME",{src:!0,frameborder:!0,width:!0,height:!0}),it(r).forEach(n),et=o(t),W=p(t,"P",{}),it(W).forEach(n),this.h()},h(){G(a,"name","hf:doc:metadata"),G(a,"content",Mt),ht(r.src,ct="https://stevhliu-ddpm-butterflies-128.hf.space")||G(r,"src",ct),G(r,"frameborder","0"),G(r,"width","850"),G(r,"height","500")},m(t,e){Jt(document.head,a),l(t,g,e),l(t,f,e),l(t,j,e),Z(c,t,e),l(t,E,e),Z(b,t,e),l(t,L,e),l(t,d,e),l(t,D,e),l(t,h,e),l(t,H,e),l(t,$,e),l(t,V,e),Z(u,t,e),l(t,B,e),l(t,_,e),l(t,R,e),Z(w,t,e),l(t,S,e),l(t,T,e),l(t,z,e),Z(v,t,e),l(t,K,e),l(t,J,e),l(t,A,e),Z(x,t,e),l(t,X,e),l(t,y,e),l(t,Q,e),l(t,C,e),l(t,O,e),Z(k,t,e),l(t,Y,e),l(t,P,e),l(t,tt,e),l(t,r,e),l(t,et,e),l(t,W,e),nt=!0},p(t,[e]){const bt={};e&2&&(bt.$$scope={dirty:e,ctx:t}),u.$set(bt)},i(t){nt||(I(c.$$.fragment,t),I(b.$$.fragment,t),I(u.$$.fragment,t),I(w.$$.fragment,t),I(v.$$.fragment,t),I(x.$$.fragment,t),I(k.$$.fragment,t),nt=!0)},o(t){N(c.$$.fragment,t),N(b.$$.fragment,t),N(u.$$.fragment,t),N(w.$$.fragment,t),N(v.$$.fragment,t),N(x.$$.fragment,t),N(k.$$.fragment,t),nt=!1},d(t){t&&(n(g),n(f),n(j),n(E),n(L),n(d),n(D),n(h),n(H),n($),n(V),n(B),n(_),n(R),n(S),n(T),n(z),n(K),n(J),n(A),n(X),n(y),n(Q),n(C),n(O),n(Y),n(P),n(tt),n(r),n(et),n(W)),n(a),U(c,t),U(b,t),U(u,t),U(w,t),U(v,t),U(x,t),U(k,t)}}}const Mt='{"title":"Unconditional 이미지 생성","local":"unconditional-이미지-생성","sections":[],"depth":1}';function Ft(q){return $t(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Wt extends wt{constructor(a){super(),Tt(this,a,Ft,Pt,dt,{})}}export{Wt as component};
