import{s as se,a as le,n as re,o as me}from"../chunks/scheduler.53228c21.js";import{S as pe,i as fe,e as l,s as i,c as k,h as ue,a as r,d as n,b as o,f as N,g as M,j as P,k as T,l as ge,m as a,n as Z,t as x,o as C,p as U}from"../chunks/index.100fac89.js";import{C as ce}from"../chunks/CopyLLMTxtMenu.4f0519ef.js";import{C as O}from"../chunks/CodeBlock.d30a6509.js";import{D as de}from"../chunks/DocNotebookDropdown.1a28089c.js";import{H as he,E as be}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.62dbb7c4.js";function $e(K){let m,j,W,V,f,E,u,q,g,F,c,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,d,ee='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,h,H,p,te='<p>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.</p>',R,b,ne='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:',D,$,z,_,ae="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.",B,w,I,y,ie="Try out the Space below to generate an image of a butterfly!",S,s,oe,Q,v,Y,L,A;return f=new ce({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),u=new he({props:{title:"Unconditional image generation",local:"unconditional-image-generation",headingTag:"h1"}}),g=new de({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"}]}}),h=new O({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}}),$=new O({props:{code:"aW1hZ2Uuc2F2ZSglMjJnZW5lcmF0ZWRfaW1hZ2UucG5nJTIyKQ==",highlighted:'image.save(<span class="hljs-string">&quot;generated_image.png&quot;</span>)',wrap:!1}}),w=new O({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}}),v=new be({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/using-diffusers/unconditional_image_generation.md"}}),{c(){m=l("meta"),j=i(),W=l("p"),V=i(),k(f.$$.fragment),E=i(),k(u.$$.fragment),q=i(),k(g.$$.fragment),F=i(),c=l("p"),c.textContent=X,G=i(),d=l("p"),d.innerHTML=ee,J=i(),k(h.$$.fragment),H=i(),p=l("blockquote"),p.innerHTML=te,R=i(),b=l("p"),b.innerHTML=ne,D=i(),k($.$$.fragment),z=i(),_=l("p"),_.innerHTML=ae,B=i(),k(w.$$.fragment),I=i(),y=l("p"),y.textContent=ie,S=i(),s=l("iframe"),Q=i(),k(v.$$.fragment),Y=i(),L=l("p"),this.h()},l(e){const t=ue("svelte-u9bgzb",document.head);m=r(t,"META",{name:!0,content:!0}),t.forEach(n),j=o(e),W=r(e,"P",{}),N(W).forEach(n),V=o(e),M(f.$$.fragment,e),E=o(e),M(u.$$.fragment,e),q=o(e),M(g.$$.fragment,e),F=o(e),c=r(e,"P",{"data-svelte-h":!0}),P(c)!=="svelte-tcg2lt"&&(c.textContent=X),G=o(e),d=r(e,"P",{"data-svelte-h":!0}),P(d)!=="svelte-1sbgfgr"&&(d.innerHTML=ee),J=o(e),M(h.$$.fragment,e),H=o(e),p=r(e,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),P(p)!=="svelte-xwf4nr"&&(p.innerHTML=te),R=o(e),b=r(e,"P",{"data-svelte-h":!0}),P(b)!=="svelte-1ut9jwr"&&(b.innerHTML=ne),D=o(e),M($.$$.fragment,e),z=o(e),_=r(e,"P",{"data-svelte-h":!0}),P(_)!=="svelte-vy6m6f"&&(_.innerHTML=ae),B=o(e),M(w.$$.fragment,e),I=o(e),y=r(e,"P",{"data-svelte-h":!0}),P(y)!=="svelte-se673n"&&(y.textContent=ie),S=o(e),s=r(e,"IFRAME",{src:!0,frameborder:!0,width:!0,height:!0}),N(s).forEach(n),Q=o(e),M(v.$$.fragment,e),Y=o(e),L=r(e,"P",{}),N(L).forEach(n),this.h()},h(){T(m,"name","hf:doc:metadata"),T(m,"content",_e),T(p,"class","tip"),le(s.src,oe="https://stevhliu-unconditional-image-generation.hf.space")||T(s,"src",oe),T(s,"frameborder","0"),T(s,"width","850"),T(s,"height","500")},m(e,t){ge(document.head,m),a(e,j,t),a(e,W,t),a(e,V,t),Z(f,e,t),a(e,E,t),Z(u,e,t),a(e,q,t),Z(g,e,t),a(e,F,t),a(e,c,t),a(e,G,t),a(e,d,t),a(e,J,t),Z(h,e,t),a(e,H,t),a(e,p,t),a(e,R,t),a(e,b,t),a(e,D,t),Z($,e,t),a(e,z,t),a(e,_,t),a(e,B,t),Z(w,e,t),a(e,I,t),a(e,y,t),a(e,S,t),a(e,s,t),a(e,Q,t),Z(v,e,t),a(e,Y,t),a(e,L,t),A=!0},p:re,i(e){A||(x(f.$$.fragment,e),x(u.$$.fragment,e),x(g.$$.fragment,e),x(h.$$.fragment,e),x($.$$.fragment,e),x(w.$$.fragment,e),x(v.$$.fragment,e),A=!0)},o(e){C(f.$$.fragment,e),C(u.$$.fragment,e),C(g.$$.fragment,e),C(h.$$.fragment,e),C($.$$.fragment,e),C(w.$$.fragment,e),C(v.$$.fragment,e),A=!1},d(e){e&&(n(j),n(W),n(V),n(E),n(q),n(F),n(c),n(G),n(d),n(J),n(H),n(p),n(R),n(b),n(D),n(z),n(_),n(B),n(I),n(y),n(S),n(s),n(Q),n(Y),n(L)),n(m),U(f,e),U(u,e),U(g,e),U(h,e),U($,e),U(w,e),U(v,e)}}}const _e='{"title":"Unconditional image generation","local":"unconditional-image-generation","sections":[],"depth":1}';function we(K){return me(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class xe extends pe{constructor(m){super(),fe(this,m,we,$e,se,{})}}export{xe as component};
