Buckets:

download
raw
7.48 kB
import{s as le,a as se,n as re,o as me}from"../chunks/scheduler.53228c21.js";import{S as pe,i as fe,e as s,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.cac5d66a.js";import{C as ce}from"../chunks/CopyLLMTxtMenu.0ef49226.js";import{C as K}from"../chunks/CodeBlock.606cbaf4.js";import{D as de}from"../chunks/DocNotebookDropdown.c9ebcd31.js";import{H as he,E as be}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.48d5cb47.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/pr_13921/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_13921/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,y,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,_,B,w,ae="Try out the Space below to generate an image of a butterfly!",I,l,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`,lang:"py",wrap:!1}}),$=new K({props:{code:"aW1hZ2Uuc2F2ZSglMjJnZW5lcmF0ZWRfaW1hZ2UucG5nJTIyKQ==",highlighted:'image.save(<span class="hljs-string">&quot;generated_image.png&quot;</span>)',lang:"py",wrap:!1}}),_=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`,lang:"py",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=s("meta"),j=a(),W=s("p"),V=a(),k(f.$$.fragment),E=a(),k(u.$$.fragment),q=a(),k(g.$$.fragment),F=a(),c=s("p"),c.textContent=X,G=a(),d=s("p"),d.innerHTML=ee,J=a(),k(h.$$.fragment),H=a(),p=s("blockquote"),p.innerHTML=te,R=a(),b=s("p"),b.innerHTML=ne,D=a(),k($.$$.fragment),S=a(),y=s("p"),y.innerHTML=ie,z=a(),k(_.$$.fragment),B=a(),w=s("p"),w.textContent=ae,I=a(),l=s("iframe"),Q=a(),k(v.$$.fragment),Y=a(),L=s("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-16omk8v"&&(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),y=r(e,"P",{"data-svelte-h":!0}),P(y)!=="svelte-vy6m6f"&&(y.innerHTML=ie),z=o(e),M(_.$$.fragment,e),B=o(e),w=r(e,"P",{"data-svelte-h":!0}),P(w)!=="svelte-se673n"&&(w.textContent=ae),I=o(e),l=r(e,"IFRAME",{src:!0,frameborder:!0,width:!0,height:!0}),O(l).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",ye),T(p,"class","tip"),se(l.src,oe="https://stevhliu-unconditional-image-generation.hf.space")||T(l,"src",oe),T(l,"frameborder","0"),T(l,"width","850"),T(l,"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,y,t),i(e,z,t),x(_,e,t),i(e,B,t),i(e,w,t),i(e,I,t),i(e,l,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(_.$$.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(_.$$.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(y),n(z),n(B),n(w),n(I),n(l),n(Q),n(Y),n(L)),n(m),U(f,e),U(u,e),U(g,e),U(h,e),U($,e),U(_,e),U(v,e)}}}const ye='{"title":"Unconditional image generation","local":"unconditional-image-generation","sections":[],"depth":1}';function _e(N){return me(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ze extends pe{constructor(m){super(),fe(this,m,_e,$e,le,{})}}export{Ze as component};

Xet Storage Details

Size:
7.48 kB
·
Xet hash:
6859a2fef3141d345444fa9784a2311f9f13bcbbe5a2ca60d49b2bd600b71e2d

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.