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 a,c as k,h as ue,a as r,d as n,b as o,f as O,g as M,j as P,k as T,l as ge,m as i,n as x,t as Z,o as C,p as U}from"../chunks/index.100fac89.js";import{C as ce}from"../chunks/CopyLLMTxtMenu.b0ff86f3.js";import{C as K}from"../chunks/CodeBlock.d30a6509.js";import{D as de}from"../chunks/DocNotebookDropdown.74a16910.js";import{H as he,E as be}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.136ef3fd.js";function $e(N){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,$,S,_,ie="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.",z,y,B,w,ae="Try out the Space below to generate an image of a butterfly!",I,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 de({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;",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"}]}}),g=new he({props:{title:"Unconditional image generation",local:"unconditional-image-generation",headingTag:"h1"}}),h=new K({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 K({props:{code:"aW1hZ2Uuc2F2ZSglMjJnZW5lcmF0ZWRfaW1hZ2UucG5nJTIyKQ==",highlighted:'image.save(<span class="hljs-string">&quot;generated_image.png&quot;</span>)',wrap:!1}}),y=new K({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=a(),W=l("p"),V=a(),k(f.$$.fragment),E=a(),k(u.$$.fragment),q=a(),k(g.$$.fragment),F=a(),c=l("p"),c.textContent=X,G=a(),d=l("p"),d.innerHTML=ee,J=a(),k(h.$$.fragment),H=a(),p=l("blockquote"),p.innerHTML=te,R=a(),b=l("p"),b.innerHTML=ne,D=a(),k($.$$.fragment),S=a(),_=l("p"),_.innerHTML=ie,z=a(),k(y.$$.fragment),B=a(),w=l("p"),w.textContent=ae,I=a(),s=l("iframe"),Q=a(),k(v.$$.fragment),Y=a(),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",{}),O(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),S=o(e),_=r(e,"P",{"data-svelte-h":!0}),P(_)!=="svelte-vy6m6f"&&(_.innerHTML=ie),z=o(e),M(y.$$.fragment,e),B=o(e),w=r(e,"P",{"data-svelte-h":!0}),P(w)!=="svelte-se673n"&&(w.textContent=ae),I=o(e),s=r(e,"IFRAME",{src:!0,frameborder:!0,width:!0,height:!0}),O(s).forEach(n),Q=o(e),M(v.$$.fragment,e),Y=o(e),L=r(e,"P",{}),O(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),i(e,j,t),i(e,W,t),i(e,V,t),x(f,e,t),i(e,E,t),x(u,e,t),i(e,q,t),x(g,e,t),i(e,F,t),i(e,c,t),i(e,G,t),i(e,d,t),i(e,J,t),x(h,e,t),i(e,H,t),i(e,p,t),i(e,R,t),i(e,b,t),i(e,D,t),x($,e,t),i(e,S,t),i(e,_,t),i(e,z,t),x(y,e,t),i(e,B,t),i(e,w,t),i(e,I,t),i(e,s,t),i(e,Q,t),x(v,e,t),i(e,Y,t),i(e,L,t),A=!0},p:re,i(e){A||(Z(f.$$.fragment,e),Z(u.$$.fragment,e),Z(g.$$.fragment,e),Z(h.$$.fragment,e),Z($.$$.fragment,e),Z(y.$$.fragment,e),Z(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(y.$$.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(S),n(_),n(z),n(B),n(w),n(I),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(y,e),U(v,e)}}}const _e='{"title":"Unconditional image generation","local":"unconditional-image-generation","sections":[],"depth":1}';function ye(N){return me(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ze extends pe{constructor(m){super(),fe(this,m,ye,$e,se,{})}}export{Ze as component};
