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 pe,h as p,f as n,c as s,j as A,u as T,x as j,k as W,y as fe,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.00a903b3.js";import{D as ge}from"../chunks/DocNotebookDropdown.02900f6b.js";import{H as ce,E as de}from"../chunks/EditOnGithub.1e64e623.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=p(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/pr_10047/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/pr_10047/en/api/pipelines/overview#diffusers.DiffusionPipeline">DiffusionPipeline</a> downloads and caches all the model components required to generate an image.',J,b,q,f,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}}),f=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(f.$$.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=pe("svelte-u9bgzb",document.head);i=p(t,"META",{name:!0,content:!0}),t.forEach(n),u=s(e),l=p(e,"P",{}),A(l).forEach(n),x=s(e),T(g.$$.fragment,e),L=s(e),T(c.$$.fragment,e),F=s(e),d=p(e,"P",{"data-svelte-h":!0}),j(d)!=="svelte-tcg2lt"&&(d.textContent=X),G=s(e),h=p(e,"P",{"data-svelte-h":!0}),j(h)!=="svelte-1fn944v"&&(h.innerHTML=K),J=s(e),T(b.$$.fragment,e),q=s(e),T(f.$$.fragment,e),H=s(e),$=p(e,"P",{"data-svelte-h":!0}),j($)!=="svelte-1ut9jwr"&&($.innerHTML=O),R=s(e),T(_.$$.fragment,e),D=s(e),w=p(e,"P",{"data-svelte-h":!0}),j(w)!=="svelte-vy6m6f"&&(w.innerHTML=ee),I=s(e),T(y.$$.fragment,e),z=s(e),v=p(e,"P",{"data-svelte-h":!0}),j(v)!=="svelte-se673n"&&(v.textContent=te),B=s(e),r=p(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=p(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){fe(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(f,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}),f.$set(ae)},i(e){Y||(U(g.$$.fragment,e),U(c.$$.fragment,e),U(b.$$.fragment,e),U(f.$$.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(f.$$.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(f,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};
