import{s as ne,z as ae,o as ie,n as oe}from"../chunks/scheduler.182ea377.js";import{S as se,i as le,g as m,s as o,r as M,A as re,h as p,f as n,c as s,j as Q,u as T,x as W,k as Z,y as me,a,v as U,d as C,t as P,w as x}from"../chunks/index.abf12888.js";import{T as pe}from"../chunks/Tip.230e2334.js";import{C as Y}from"../chunks/CodeBlock.57fe6e13.js";import{D as fe}from"../chunks/DocNotebookDropdown.d9060979.js";import{H as ue}from"../chunks/Heading.16916d63.js";function ge(V){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}),W(i)!=="svelte-16mkqem"&&(i.innerHTML=u)},m(l,k){a(l,i,k)},p:oe,d(l){l&&n(i)}}}function ce(V){let i,u,l,k,g,L,c,F,d,A="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.",J,h,N='To get started, use the <a href="/docs/diffusers/v0.24.0/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/v0.24.0/en/api/pipelines/overview#diffusers.DiffusionPipeline">DiffusionPipeline</a> downloads and caches all the model components required to generate an image.',q,b,E,f,G,$,X='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:',H,_,R,w,K="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.",D,y,z,v,O="Try out the Space below to generate an image of a butterfly!",I,r,ee,B,j,S;return g=new ue({props:{title:"Unconditional image generation",local:"unconditional-image-generation",headingTag:"h1"}}),c=new fe({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 Y({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 pe({props:{$$slots:{default:[ge]},$$scope:{ctx:V}}}),_=new Y({props:{code:"aW1hZ2Uuc2F2ZSglMjJnZW5lcmF0ZWRfaW1hZ2UucG5nJTIyKQ==",highlighted:'image.save(<span class="hljs-string">&quot;generated_image.png&quot;</span>)',wrap:!1}}),y=new Y({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}}),{c(){i=m("meta"),u=o(),l=m("p"),k=o(),M(g.$$.fragment),L=o(),M(c.$$.fragment),F=o(),d=m("p"),d.textContent=A,J=o(),h=m("p"),h.innerHTML=N,q=o(),M(b.$$.fragment),E=o(),M(f.$$.fragment),G=o(),$=m("p"),$.innerHTML=X,H=o(),M(_.$$.fragment),R=o(),w=m("p"),w.innerHTML=K,D=o(),M(y.$$.fragment),z=o(),v=m("p"),v.textContent=O,I=o(),r=m("iframe"),B=o(),j=m("p"),this.h()},l(e){const t=re("svelte-u9bgzb",document.head);i=p(t,"META",{name:!0,content:!0}),t.forEach(n),u=s(e),l=p(e,"P",{}),Q(l).forEach(n),k=s(e),T(g.$$.fragment,e),L=s(e),T(c.$$.fragment,e),F=s(e),d=p(e,"P",{"data-svelte-h":!0}),W(d)!=="svelte-tcg2lt"&&(d.textContent=A),J=s(e),h=p(e,"P",{"data-svelte-h":!0}),W(h)!=="svelte-spn91v"&&(h.innerHTML=N),q=s(e),T(b.$$.fragment,e),E=s(e),T(f.$$.fragment,e),G=s(e),$=p(e,"P",{"data-svelte-h":!0}),W($)!=="svelte-1ut9jwr"&&($.innerHTML=X),H=s(e),T(_.$$.fragment,e),R=s(e),w=p(e,"P",{"data-svelte-h":!0}),W(w)!=="svelte-vy6m6f"&&(w.innerHTML=K),D=s(e),T(y.$$.fragment,e),z=s(e),v=p(e,"P",{"data-svelte-h":!0}),W(v)!=="svelte-se673n"&&(v.textContent=O),I=s(e),r=p(e,"IFRAME",{src:!0,frameborder:!0,width:!0,height:!0}),Q(r).forEach(n),B=s(e),j=p(e,"P",{}),Q(j).forEach(n),this.h()},h(){Z(i,"name","hf:doc:metadata"),Z(i,"content",de),ae(r.src,ee="https://stevhliu-unconditional-image-generation.hf.space")||Z(r,"src",ee),Z(r,"frameborder","0"),Z(r,"width","850"),Z(r,"height","500")},m(e,t){me(document.head,i),a(e,u,t),a(e,l,t),a(e,k,t),U(g,e,t),a(e,L,t),U(c,e,t),a(e,F,t),a(e,d,t),a(e,J,t),a(e,h,t),a(e,q,t),U(b,e,t),a(e,E,t),U(f,e,t),a(e,G,t),a(e,$,t),a(e,H,t),U(_,e,t),a(e,R,t),a(e,w,t),a(e,D,t),U(y,e,t),a(e,z,t),a(e,v,t),a(e,I,t),a(e,r,t),a(e,B,t),a(e,j,t),S=!0},p(e,[t]){const te={};t&2&&(te.$$scope={dirty:t,ctx:e}),f.$set(te)},i(e){S||(C(g.$$.fragment,e),C(c.$$.fragment,e),C(b.$$.fragment,e),C(f.$$.fragment,e),C(_.$$.fragment,e),C(y.$$.fragment,e),S=!0)},o(e){P(g.$$.fragment,e),P(c.$$.fragment,e),P(b.$$.fragment,e),P(f.$$.fragment,e),P(_.$$.fragment,e),P(y.$$.fragment,e),S=!1},d(e){e&&(n(u),n(l),n(k),n(L),n(F),n(d),n(J),n(h),n(q),n(E),n(G),n($),n(H),n(R),n(w),n(D),n(z),n(v),n(I),n(r),n(B),n(j)),n(i),x(g,e),x(c,e),x(b,e),x(f,e),x(_,e),x(y,e)}}}const de='{"title":"Unconditional image generation","local":"unconditional-image-generation","sections":[],"depth":1}';function he(V){return ie(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ke extends se{constructor(i){super(),le(this,i,he,ce,ne,{})}}export{ke as component};
