import{s as ie,f as oe,o as se,n as le}from"../chunks/scheduler.8c3d61f6.js";import{S as re,i as me,g as m,s as o,r as M,A as fe,h as f,f as n,c as s,j as A,u as T,x as j,k as W,y as pe,a,v as Z,d as U,t as C,w as P}from"../chunks/index.da70eac4.js";import{T as ue}from"../chunks/Tip.1d9b8c37.js";import{C as N}from"../chunks/CodeBlock.a9c4becf.js";import{D as ge}from"../chunks/DocNotebookDropdown.48852948.js";import{H as ce,E as de}from"../chunks/index.ef90fe87.js";function he(E){let i,u='Want to generate images of something else? Take a look at the training <a href="../training/unconditional_training">guide</a> to learn how to train a model to generate your own images.';return{c(){i=m("p"),i.innerHTML=u},l(l){i=f(l,"P",{"data-svelte-h":!0}),j(i)!=="svelte-16mkqem"&&(i.innerHTML=u)},m(l,x){a(l,i,x)},p:le,d(l){l&&n(i)}}}function be(E){let i,u,l,x,g,L,c,F,d,X="Unconditional image generation generates images that look like a random sample from the training data the model was trained on because the denoising process is not guided by any additional context like text or image.",G,h,K='To get started, use the <a href="/docs/diffusers/main/en/api/pipelines/overview#diffusers.DiffusionPipeline">DiffusionPipeline</a> to load the <a href="https://huggingface.co/anton-l/ddpm-butterflies-128" rel="nofollow">anton-l/ddpm-butterflies-128</a> checkpoint to generate images of butterflies. The <a href="/docs/diffusers/main/en/api/pipelines/overview#diffusers.DiffusionPipeline">DiffusionPipeline</a> downloads and caches all the model components required to generate an image.',J,b,q,p,H,$,O='The output image is a <a href="https://pillow.readthedocs.io/en/stable/reference/Image.html?highlight=image#the-image-class" rel="nofollow"><code>PIL.Image</code></a> object that can be saved:',R,_,D,w,ee="You can also try experimenting with the <code>num_inference_steps</code> parameter, which controls the number of denoising steps. More denoising steps typically produce higher quality images, but it’ll take longer to generate. Feel free to play around with this parameter to see how it affects the image quality.",I,y,z,v,te="Try out the Space below to generate an image of a butterfly!",B,r,ne,S,k,Q,V,Y;return g=new ce({props:{title:"Unconditional image generation",local:"unconditional-image-generation",headingTag:"h1"}}),c=new ge({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/en/unconditional_image_generation.ipynb"},{label:"PyTorch",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers_doc/en/pytorch/unconditional_image_generation.ipynb"},{label:"TensorFlow",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers_doc/en/tensorflow/unconditional_image_generation.ipynb"},{label:"Mixed",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/diffusers_doc/en/unconditional_image_generation.ipynb"},{label:"PyTorch",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/diffusers_doc/en/pytorch/unconditional_image_generation.ipynb"},{label:"TensorFlow",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/diffusers_doc/en/tensorflow/unconditional_image_generation.ipynb"}]}}),b=new N({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBJTBBZ2VuZXJhdG9yJTIwJTNEJTIwRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUyMmFudG9uLWwlMkZkZHBtLWJ1dHRlcmZsaWVzLTEyOCUyMikudG8oJTIyY3VkYSUyMiklMEFpbWFnZSUyMCUzRCUyMGdlbmVyYXRvcigpLmltYWdlcyU1QjAlNUQlMEFpbWFnZQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline

generator = DiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;anton-l/ddpm-butterflies-128&quot;</span>).to(<span class="hljs-string">&quot;cuda&quot;</span>)
image = generator().images[<span class="hljs-number">0</span>]
image`,wrap:!1}}),p=new ue({props:{$$slots:{default:[he]},$$scope:{ctx:E}}}),_=new N({props:{code:"aW1hZ2Uuc2F2ZSglMjJnZW5lcmF0ZWRfaW1hZ2UucG5nJTIyKQ==",highlighted:'image.save(<span class="hljs-string">&quot;generated_image.png&quot;</span>)',wrap:!1}}),y=new N({props:{code:"aW1hZ2UlMjAlM0QlMjBnZW5lcmF0b3IobnVtX2luZmVyZW5jZV9zdGVwcyUzRDEwMCkuaW1hZ2VzJTVCMCU1RCUwQWltYWdl",highlighted:`image = generator(num_inference_steps=<span class="hljs-number">100</span>).images[<span class="hljs-number">0</span>]
image`,wrap:!1}}),k=new de({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/using-diffusers/unconditional_image_generation.md"}}),{c(){i=m("meta"),u=o(),l=m("p"),x=o(),M(g.$$.fragment),L=o(),M(c.$$.fragment),F=o(),d=m("p"),d.textContent=X,G=o(),h=m("p"),h.innerHTML=K,J=o(),M(b.$$.fragment),q=o(),M(p.$$.fragment),H=o(),$=m("p"),$.innerHTML=O,R=o(),M(_.$$.fragment),D=o(),w=m("p"),w.innerHTML=ee,I=o(),M(y.$$.fragment),z=o(),v=m("p"),v.textContent=te,B=o(),r=m("iframe"),S=o(),M(k.$$.fragment),Q=o(),V=m("p"),this.h()},l(e){const t=fe("svelte-u9bgzb",document.head);i=f(t,"META",{name:!0,content:!0}),t.forEach(n),u=s(e),l=f(e,"P",{}),A(l).forEach(n),x=s(e),T(g.$$.fragment,e),L=s(e),T(c.$$.fragment,e),F=s(e),d=f(e,"P",{"data-svelte-h":!0}),j(d)!=="svelte-tcg2lt"&&(d.textContent=X),G=s(e),h=f(e,"P",{"data-svelte-h":!0}),j(h)!=="svelte-1sbgfgr"&&(h.innerHTML=K),J=s(e),T(b.$$.fragment,e),q=s(e),T(p.$$.fragment,e),H=s(e),$=f(e,"P",{"data-svelte-h":!0}),j($)!=="svelte-1ut9jwr"&&($.innerHTML=O),R=s(e),T(_.$$.fragment,e),D=s(e),w=f(e,"P",{"data-svelte-h":!0}),j(w)!=="svelte-vy6m6f"&&(w.innerHTML=ee),I=s(e),T(y.$$.fragment,e),z=s(e),v=f(e,"P",{"data-svelte-h":!0}),j(v)!=="svelte-se673n"&&(v.textContent=te),B=s(e),r=f(e,"IFRAME",{src:!0,frameborder:!0,width:!0,height:!0}),A(r).forEach(n),S=s(e),T(k.$$.fragment,e),Q=s(e),V=f(e,"P",{}),A(V).forEach(n),this.h()},h(){W(i,"name","hf:doc:metadata"),W(i,"content",$e),oe(r.src,ne="https://stevhliu-unconditional-image-generation.hf.space")||W(r,"src",ne),W(r,"frameborder","0"),W(r,"width","850"),W(r,"height","500")},m(e,t){pe(document.head,i),a(e,u,t),a(e,l,t),a(e,x,t),Z(g,e,t),a(e,L,t),Z(c,e,t),a(e,F,t),a(e,d,t),a(e,G,t),a(e,h,t),a(e,J,t),Z(b,e,t),a(e,q,t),Z(p,e,t),a(e,H,t),a(e,$,t),a(e,R,t),Z(_,e,t),a(e,D,t),a(e,w,t),a(e,I,t),Z(y,e,t),a(e,z,t),a(e,v,t),a(e,B,t),a(e,r,t),a(e,S,t),Z(k,e,t),a(e,Q,t),a(e,V,t),Y=!0},p(e,[t]){const ae={};t&2&&(ae.$$scope={dirty:t,ctx:e}),p.$set(ae)},i(e){Y||(U(g.$$.fragment,e),U(c.$$.fragment,e),U(b.$$.fragment,e),U(p.$$.fragment,e),U(_.$$.fragment,e),U(y.$$.fragment,e),U(k.$$.fragment,e),Y=!0)},o(e){C(g.$$.fragment,e),C(c.$$.fragment,e),C(b.$$.fragment,e),C(p.$$.fragment,e),C(_.$$.fragment,e),C(y.$$.fragment,e),C(k.$$.fragment,e),Y=!1},d(e){e&&(n(u),n(l),n(x),n(L),n(F),n(d),n(G),n(h),n(J),n(q),n(H),n($),n(R),n(D),n(w),n(I),n(z),n(v),n(B),n(r),n(S),n(Q),n(V)),n(i),P(g,e),P(c,e),P(b,e),P(p,e),P(_,e),P(y,e),P(k,e)}}}const $e='{"title":"Unconditional image generation","local":"unconditional-image-generation","sections":[],"depth":1}';function _e(E){return se(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ze extends re{constructor(i){super(),me(this,i,_e,be,ie,{})}}export{Ze as component};
