import{S as Qs,i as Cs,s as Ys,e as n,k as m,w as c,t as r,M as zs,c as a,d as i,m as f,a as s,x as u,h as l,b as d,G as t,g as p,y as h,q as g,o as _,B as b,v as Ls}from"../../../chunks/vendor-hf-doc-builder.js";import{T as As}from"../../../chunks/Tip-hf-doc-builder.js";import{D as R}from"../../../chunks/Docstring-hf-doc-builder.js";import{C as Qe}from"../../../chunks/CodeBlock-hf-doc-builder.js";import{I as F}from"../../../chunks/IconCopyLink-hf-doc-builder.js";function Hs(Bt){let v,S,x,Z,$;return{c(){v=n("p"),S=r("There is currently an issue on PyTorch 1.X where the output images are all black or the pixel values become "),x=n("code"),Z=r("NaNs"),$=r(". This issue can be mitigated by switching to PyTorch 2.X.")},l(M){v=a(M,"P",{});var I=s(v);S=l(I,"There is currently an issue on PyTorch 1.X where the output images are all black or the pixel values become "),x=a(I,"CODE",{});var Q=s(x);Z=l(Q,"NaNs"),Q.forEach(i),$=l(I,". This issue can be mitigated by switching to PyTorch 2.X."),I.forEach(i)},m(M,I){p(M,v,I),t(v,S),t(v,x),t(x,Z),t(v,$)},d(M){M&&i(v)}}}function qs(Bt){let v,S,x,Z,$,M,I,Q,Ci,Nt,C,Yi,ce,zi,Li,Rt,Y,Ai,ue,Hi,qi,Ft,Ce,ot,Oi,St,j,Ki,he,en,tn,ge,nn,an,Qt,z,Ct,L,sn,_e,on,rn,Yt,G,A,rt,be,ln,lt,pn,zt,Ye,dn,Lt,W,H,pt,we,mn,dt,fn,At,q,cn,ze,un,hn,Ht,ye,qt,Le,gn,Ot,O,_n,Ae,bn,wn,Kt,ve,ei,K,yn,He,vn,Un,ti,qe,xn,ii,Ue,ni,X,ee,mt,xe,Tn,ft,Mn,ai,Oe,Zn,si,Te,oi,U,Jn,ct,In,jn,ut,En,$n,ht,Gn,Wn,gt,Xn,Pn,Ke,Dn,kn,ri,P,te,_t,Me,Vn,bt,Bn,li,et,Nn,pi,Ze,di,T,Rn,wt,Fn,Sn,yt,Qn,Cn,vt,Yn,zn,tt,Ln,An,mi,D,ie,Ut,Je,Hn,xt,qn,fi,it,On,ci,Ie,ui,k,ne,Tt,je,Kn,Mt,ea,hi,nt,ta,gi,Ee,_i,V,ae,Zt,$e,ia,Jt,na,bi,w,Ge,aa,It,sa,oa,We,ra,at,la,pa,da,se,Xe,ma,jt,fa,ca,oe,Pe,ua,Et,ha,ga,re,De,_a,$t,ba,wa,le,ke,ya,Gt,va,Ua,pe,Ve,xa,Wt,Ta,Ma,de,Be,Za,Xt,Ja,Ia,me,Ne,ja,Pt,Ea,wi,B,fe,Dt,Re,$a,kt,Ga,yi,N,Fe,Wa,Vt,Xa,vi;return M=new F({}),z=new As({props:{warning:!0,$$slots:{default:[Hs]},$$scope:{ctx:Bt}}}),be=new F({}),we=new F({}),ye=new Qe({props:{code:"aW1wb3J0JTIwdG9yY2glMEElMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwVW5pRGlmZnVzZXJQaXBlbGluZSUwQSUwQWRldmljZSUyMCUzRCUyMCUyMmN1ZGElMjIlMEFtb2RlbF9pZF9vcl9wYXRoJTIwJTNEJTIwJTIydGh1LW1sJTJGdW5pZGlmZnVzZXItdjElMjIlMEFwaXBlJTIwJTNEJTIwVW5pRGlmZnVzZXJQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQobW9kZWxfaWRfb3JfcGF0aCUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiklMEFwaXBlLnRvKGRldmljZSklMEElMEElMjMlMjBVbmNvbmRpdGlvbmFsJTIwaW1hZ2UlMjBhbmQlMjB0ZXh0JTIwZ2VuZXJhdGlvbi4lMjBUaGUlMjBnZW5lcmF0aW9uJTIwdGFzayUyMGlzJTIwYXV0b21hdGljYWxseSUyMGluZmVycmVkLiUwQXNhbXBsZSUyMCUzRCUyMHBpcGUobnVtX2luZmVyZW5jZV9zdGVwcyUzRDIwJTJDJTIwZ3VpZGFuY2Vfc2NhbGUlM0Q4LjApJTBBaW1hZ2UlMjAlM0QlMjBzYW1wbGUuaW1hZ2VzJTVCMCU1RCUwQXRleHQlMjAlM0QlMjBzYW1wbGUudGV4dCU1QjAlNUQlMEFpbWFnZS5zYXZlKCUyMnVuaWRpZmZ1c2VyX2pvaW50X3NhbXBsZV9pbWFnZS5wbmclMjIpJTBBcHJpbnQodGV4dCk=",highlighted:`<span class="hljs-keyword">import</span> torch

<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> UniDiffuserPipeline

device = <span class="hljs-string">&quot;cuda&quot;</span>
model_id_or_path = <span class="hljs-string">&quot;thu-ml/unidiffuser-v1&quot;</span>
pipe = UniDiffuserPipeline.from_pretrained(model_id_or_path, torch_dtype=torch.float16)
pipe.to(device)

<span class="hljs-comment"># Unconditional image and text generation. The generation task is automatically inferred.</span>
sample = pipe(num_inference_steps=<span class="hljs-number">20</span>, guidance_scale=<span class="hljs-number">8.0</span>)
image = sample.images[<span class="hljs-number">0</span>]
text = sample.text[<span class="hljs-number">0</span>]
image.save(<span class="hljs-string">&quot;unidiffuser_joint_sample_image.png&quot;</span>)
<span class="hljs-built_in">print</span>(text)`}}),ve=new Qe({props:{code:"JTIzJTIwRXF1aXZhbGVudCUyMHRvJTIwdGhlJTIwYWJvdmUuJTBBcGlwZS5zZXRfam9pbnRfbW9kZSgpJTBBc2FtcGxlJTIwJTNEJTIwcGlwZShudW1faW5mZXJlbmNlX3N0ZXBzJTNEMjAlMkMlMjBndWlkYW5jZV9zY2FsZSUzRDguMCk=",highlighted:`<span class="hljs-comment"># Equivalent to the above.</span>
pipe.set_joint_mode()
sample = pipe(num_inference_steps=<span class="hljs-number">20</span>, guidance_scale=<span class="hljs-number">8.0</span>)`}}),Ue=new Qe({props:{code:"JTIzJTIwVW5saWtlJTIwb3RoZXIlMjBnZW5lcmF0aW9uJTIwdGFza3MlMkMlMjBpbWFnZS1vbmx5JTIwYW5kJTIwdGV4dC1vbmx5JTIwZ2VuZXJhdGlvbiUyMGRvbid0JTIwdXNlJTIwY2xhc3NpZmllci1mcmVlJTIwZ3VpZGFuY2UlMEElMjMlMjBJbWFnZS1vbmx5JTIwZ2VuZXJhdGlvbiUwQXBpcGUuc2V0X2ltYWdlX21vZGUoKSUwQXNhbXBsZV9pbWFnZSUyMCUzRCUyMHBpcGUobnVtX2luZmVyZW5jZV9zdGVwcyUzRDIwKS5pbWFnZXMlNUIwJTVEJTBBJTIzJTIwVGV4dC1vbmx5JTIwZ2VuZXJhdGlvbiUwQXBpcGUuc2V0X3RleHRfbW9kZSgpJTBBc2FtcGxlX3RleHQlMjAlM0QlMjBwaXBlKG51bV9pbmZlcmVuY2Vfc3RlcHMlM0QyMCkudGV4dCU1QjAlNUQ=",highlighted:`<span class="hljs-comment"># Unlike other generation tasks, image-only and text-only generation don&#x27;t use classifier-free guidance</span>
<span class="hljs-comment"># Image-only generation</span>
pipe.set_image_mode()
sample_image = pipe(num_inference_steps=<span class="hljs-number">20</span>).images[<span class="hljs-number">0</span>]
<span class="hljs-comment"># Text-only generation</span>
pipe.set_text_mode()
sample_text = pipe(num_inference_steps=<span class="hljs-number">20</span>).text[<span class="hljs-number">0</span>]`}}),xe=new F({}),Te=new Qe({props:{code:"aW1wb3J0JTIwdG9yY2glMEElMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwVW5pRGlmZnVzZXJQaXBlbGluZSUwQSUwQWRldmljZSUyMCUzRCUyMCUyMmN1ZGElMjIlMEFtb2RlbF9pZF9vcl9wYXRoJTIwJTNEJTIwJTIydGh1LW1sJTJGdW5pZGlmZnVzZXItdjElMjIlMEFwaXBlJTIwJTNEJTIwVW5pRGlmZnVzZXJQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQobW9kZWxfaWRfb3JfcGF0aCUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiklMEFwaXBlLnRvKGRldmljZSklMEElMEElMjMlMjBUZXh0LXRvLWltYWdlJTIwZ2VuZXJhdGlvbiUwQXByb21wdCUyMCUzRCUyMCUyMmFuJTIwZWxlcGhhbnQlMjB1bmRlciUyMHRoZSUyMHNlYSUyMiUwQSUwQXNhbXBsZSUyMCUzRCUyMHBpcGUocHJvbXB0JTNEcHJvbXB0JTJDJTIwbnVtX2luZmVyZW5jZV9zdGVwcyUzRDIwJTJDJTIwZ3VpZGFuY2Vfc2NhbGUlM0Q4LjApJTBBdDJpX2ltYWdlJTIwJTNEJTIwc2FtcGxlLmltYWdlcyU1QjAlNUQlMEF0MmlfaW1hZ2Uuc2F2ZSglMjJ1bmlkaWZmdXNlcl90ZXh0MmltZ19zYW1wbGVfaW1hZ2UucG5nJTIyKQ==",highlighted:`<span class="hljs-keyword">import</span> torch

<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> UniDiffuserPipeline

device = <span class="hljs-string">&quot;cuda&quot;</span>
model_id_or_path = <span class="hljs-string">&quot;thu-ml/unidiffuser-v1&quot;</span>
pipe = UniDiffuserPipeline.from_pretrained(model_id_or_path, torch_dtype=torch.float16)
pipe.to(device)

<span class="hljs-comment"># Text-to-image generation</span>
prompt = <span class="hljs-string">&quot;an elephant under the sea&quot;</span>

sample = pipe(prompt=prompt, num_inference_steps=<span class="hljs-number">20</span>, guidance_scale=<span class="hljs-number">8.0</span>)
t2i_image = sample.images[<span class="hljs-number">0</span>]
t2i_image.save(<span class="hljs-string">&quot;unidiffuser_text2img_sample_image.png&quot;</span>)`}}),Me=new F({}),Ze=new Qe({props:{code:"aW1wb3J0JTIwdG9yY2glMEElMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwVW5pRGlmZnVzZXJQaXBlbGluZSUwQWZyb20lMjBkaWZmdXNlcnMudXRpbHMlMjBpbXBvcnQlMjBsb2FkX2ltYWdlJTBBJTBBZGV2aWNlJTIwJTNEJTIwJTIyY3VkYSUyMiUwQW1vZGVsX2lkX29yX3BhdGglMjAlM0QlMjAlMjJ0aHUtbWwlMkZ1bmlkaWZmdXNlci12MSUyMiUwQXBpcGUlMjAlM0QlMjBVbmlEaWZmdXNlclBpcGVsaW5lLmZyb21fcHJldHJhaW5lZChtb2RlbF9pZF9vcl9wYXRoJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2KSUwQXBpcGUudG8oZGV2aWNlKSUwQSUwQSUyMyUyMEltYWdlLXRvLXRleHQlMjBnZW5lcmF0aW9uJTBBaW1hZ2VfdXJsJTIwJTNEJTIwJTIyaHR0cHMlM0ElMkYlMkZodWdnaW5nZmFjZS5jbyUyRmRhdGFzZXRzJTJGaGYtaW50ZXJuYWwtdGVzdGluZyUyRmRpZmZ1c2Vycy1pbWFnZXMlMkZyZXNvbHZlJTJGbWFpbiUyRnVuaWRpZmZ1c2VyJTJGdW5pZGlmZnVzZXJfZXhhbXBsZV9pbWFnZS5qcGclMjIlMEFpbml0X2ltYWdlJTIwJTNEJTIwbG9hZF9pbWFnZShpbWFnZV91cmwpLnJlc2l6ZSgoNTEyJTJDJTIwNTEyKSklMEElMEFzYW1wbGUlMjAlM0QlMjBwaXBlKGltYWdlJTNEaW5pdF9pbWFnZSUyQyUyMG51bV9pbmZlcmVuY2Vfc3RlcHMlM0QyMCUyQyUyMGd1aWRhbmNlX3NjYWxlJTNEOC4wKSUwQWkydF90ZXh0JTIwJTNEJTIwc2FtcGxlLnRleHQlNUIwJTVEJTBBcHJpbnQoaTJ0X3RleHQp",highlighted:`<span class="hljs-keyword">import</span> torch

<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> UniDiffuserPipeline
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image

device = <span class="hljs-string">&quot;cuda&quot;</span>
model_id_or_path = <span class="hljs-string">&quot;thu-ml/unidiffuser-v1&quot;</span>
pipe = UniDiffuserPipeline.from_pretrained(model_id_or_path, torch_dtype=torch.float16)
pipe.to(device)

<span class="hljs-comment"># Image-to-text generation</span>
image_url = <span class="hljs-string">&quot;https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/unidiffuser/unidiffuser_example_image.jpg&quot;</span>
init_image = load_image(image_url).resize((<span class="hljs-number">512</span>, <span class="hljs-number">512</span>))

sample = pipe(image=init_image, num_inference_steps=<span class="hljs-number">20</span>, guidance_scale=<span class="hljs-number">8.0</span>)
i2t_text = sample.text[<span class="hljs-number">0</span>]
<span class="hljs-built_in">print</span>(i2t_text)`}}),Je=new F({}),Ie=new Qe({props:{code:"aW1wb3J0JTIwdG9yY2glMEElMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwVW5pRGlmZnVzZXJQaXBlbGluZSUwQWZyb20lMjBkaWZmdXNlcnMudXRpbHMlMjBpbXBvcnQlMjBsb2FkX2ltYWdlJTBBJTBBZGV2aWNlJTIwJTNEJTIwJTIyY3VkYSUyMiUwQW1vZGVsX2lkX29yX3BhdGglMjAlM0QlMjAlMjJ0aHUtbWwlMkZ1bmlkaWZmdXNlci12MSUyMiUwQXBpcGUlMjAlM0QlMjBVbmlEaWZmdXNlclBpcGVsaW5lLmZyb21fcHJldHJhaW5lZChtb2RlbF9pZF9vcl9wYXRoJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2KSUwQXBpcGUudG8oZGV2aWNlKSUwQSUwQSUyMyUyMEltYWdlJTIwdmFyaWF0aW9uJTIwY2FuJTIwYmUlMjBwZXJmb3JtZWQlMjB3aXRoJTIwYSUyMGltYWdlLXRvLXRleHQlMjBnZW5lcmF0aW9uJTIwZm9sbG93ZWQlMjBieSUyMGElMjB0ZXh0LXRvLWltYWdlJTIwZ2VuZXJhdGlvbiUzQSUwQSUyMyUyMDEuJTIwSW1hZ2UtdG8tdGV4dCUyMGdlbmVyYXRpb24lMEFpbWFnZV91cmwlMjAlM0QlMjAlMjJodHRwcyUzQSUyRiUyRmh1Z2dpbmdmYWNlLmNvJTJGZGF0YXNldHMlMkZoZi1pbnRlcm5hbC10ZXN0aW5nJTJGZGlmZnVzZXJzLWltYWdlcyUyRnJlc29sdmUlMkZtYWluJTJGdW5pZGlmZnVzZXIlMkZ1bmlkaWZmdXNlcl9leGFtcGxlX2ltYWdlLmpwZyUyMiUwQWluaXRfaW1hZ2UlMjAlM0QlMjBsb2FkX2ltYWdlKGltYWdlX3VybCkucmVzaXplKCg1MTIlMkMlMjA1MTIpKSUwQSUwQXNhbXBsZSUyMCUzRCUyMHBpcGUoaW1hZ2UlM0Rpbml0X2ltYWdlJTJDJTIwbnVtX2luZmVyZW5jZV9zdGVwcyUzRDIwJTJDJTIwZ3VpZGFuY2Vfc2NhbGUlM0Q4LjApJTBBaTJ0X3RleHQlMjAlM0QlMjBzYW1wbGUudGV4dCU1QjAlNUQlMEFwcmludChpMnRfdGV4dCklMEElMEElMjMlMjAyLiUyMFRleHQtdG8taW1hZ2UlMjBnZW5lcmF0aW9uJTBBc2FtcGxlJTIwJTNEJTIwcGlwZShwcm9tcHQlM0RpMnRfdGV4dCUyQyUyMG51bV9pbmZlcmVuY2Vfc3RlcHMlM0QyMCUyQyUyMGd1aWRhbmNlX3NjYWxlJTNEOC4wKSUwQWZpbmFsX2ltYWdlJTIwJTNEJTIwc2FtcGxlLmltYWdlcyU1QjAlNUQlMEFmaW5hbF9pbWFnZS5zYXZlKCUyMnVuaWRpZmZ1c2VyX2ltYWdlX3ZhcmlhdGlvbl9zYW1wbGUucG5nJTIyKQ==",highlighted:`<span class="hljs-keyword">import</span> torch

<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> UniDiffuserPipeline
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image

device = <span class="hljs-string">&quot;cuda&quot;</span>
model_id_or_path = <span class="hljs-string">&quot;thu-ml/unidiffuser-v1&quot;</span>
pipe = UniDiffuserPipeline.from_pretrained(model_id_or_path, torch_dtype=torch.float16)
pipe.to(device)

<span class="hljs-comment"># Image variation can be performed with a image-to-text generation followed by a text-to-image generation:</span>
<span class="hljs-comment"># 1. Image-to-text generation</span>
image_url = <span class="hljs-string">&quot;https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/unidiffuser/unidiffuser_example_image.jpg&quot;</span>
init_image = load_image(image_url).resize((<span class="hljs-number">512</span>, <span class="hljs-number">512</span>))

sample = pipe(image=init_image, num_inference_steps=<span class="hljs-number">20</span>, guidance_scale=<span class="hljs-number">8.0</span>)
i2t_text = sample.text[<span class="hljs-number">0</span>]
<span class="hljs-built_in">print</span>(i2t_text)

<span class="hljs-comment"># 2. Text-to-image generation</span>
sample = pipe(prompt=i2t_text, num_inference_steps=<span class="hljs-number">20</span>, guidance_scale=<span class="hljs-number">8.0</span>)
final_image = sample.images[<span class="hljs-number">0</span>]
final_image.save(<span class="hljs-string">&quot;unidiffuser_image_variation_sample.png&quot;</span>)`}}),je=new F({}),Ee=new Qe({props:{code:"aW1wb3J0JTIwdG9yY2glMEElMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwVW5pRGlmZnVzZXJQaXBlbGluZSUwQSUwQWRldmljZSUyMCUzRCUyMCUyMmN1ZGElMjIlMEFtb2RlbF9pZF9vcl9wYXRoJTIwJTNEJTIwJTIydGh1LW1sJTJGdW5pZGlmZnVzZXItdjElMjIlMEFwaXBlJTIwJTNEJTIwVW5pRGlmZnVzZXJQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQobW9kZWxfaWRfb3JfcGF0aCUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiklMEFwaXBlLnRvKGRldmljZSklMEElMEElMjMlMjBUZXh0JTIwdmFyaWF0aW9uJTIwY2FuJTIwYmUlMjBwZXJmb3JtZWQlMjB3aXRoJTIwYSUyMHRleHQtdG8taW1hZ2UlMjBnZW5lcmF0aW9uJTIwZm9sbG93ZWQlMjBieSUyMGElMjBpbWFnZS10by10ZXh0JTIwZ2VuZXJhdGlvbiUzQSUwQSUyMyUyMDEuJTIwVGV4dC10by1pbWFnZSUyMGdlbmVyYXRpb24lMEFwcm9tcHQlMjAlM0QlMjAlMjJhbiUyMGVsZXBoYW50JTIwdW5kZXIlMjB0aGUlMjBzZWElMjIlMEElMEFzYW1wbGUlMjAlM0QlMjBwaXBlKHByb21wdCUzRHByb21wdCUyQyUyMG51bV9pbmZlcmVuY2Vfc3RlcHMlM0QyMCUyQyUyMGd1aWRhbmNlX3NjYWxlJTNEOC4wKSUwQXQyaV9pbWFnZSUyMCUzRCUyMHNhbXBsZS5pbWFnZXMlNUIwJTVEJTBBdDJpX2ltYWdlLnNhdmUoJTIydW5pZGlmZnVzZXJfdGV4dDJpbWdfc2FtcGxlX2ltYWdlLnBuZyUyMiklMEElMEElMjMlMjAyLiUyMEltYWdlLXRvLXRleHQlMjBnZW5lcmF0aW9uJTBBc2FtcGxlJTIwJTNEJTIwcGlwZShpbWFnZSUzRHQyaV9pbWFnZSUyQyUyMG51bV9pbmZlcmVuY2Vfc3RlcHMlM0QyMCUyQyUyMGd1aWRhbmNlX3NjYWxlJTNEOC4wKSUwQWZpbmFsX3Byb21wdCUyMCUzRCUyMHNhbXBsZS50ZXh0JTVCMCU1RCUwQXByaW50KGZpbmFsX3Byb21wdCk=",highlighted:`<span class="hljs-keyword">import</span> torch

<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> UniDiffuserPipeline

device = <span class="hljs-string">&quot;cuda&quot;</span>
model_id_or_path = <span class="hljs-string">&quot;thu-ml/unidiffuser-v1&quot;</span>
pipe = UniDiffuserPipeline.from_pretrained(model_id_or_path, torch_dtype=torch.float16)
pipe.to(device)

<span class="hljs-comment"># Text variation can be performed with a text-to-image generation followed by a image-to-text generation:</span>
<span class="hljs-comment"># 1. Text-to-image generation</span>
prompt = <span class="hljs-string">&quot;an elephant under the sea&quot;</span>

sample = pipe(prompt=prompt, num_inference_steps=<span class="hljs-number">20</span>, guidance_scale=<span class="hljs-number">8.0</span>)
t2i_image = sample.images[<span class="hljs-number">0</span>]
t2i_image.save(<span class="hljs-string">&quot;unidiffuser_text2img_sample_image.png&quot;</span>)

<span class="hljs-comment"># 2. Image-to-text generation</span>
sample = pipe(image=t2i_image, num_inference_steps=<span class="hljs-number">20</span>, guidance_scale=<span class="hljs-number">8.0</span>)
final_prompt = sample.text[<span class="hljs-number">0</span>]
<span class="hljs-built_in">print</span>(final_prompt)`}}),$e=new F({}),Ge=new R({props:{name:"class diffusers.UniDiffuserPipeline",anchor:"diffusers.UniDiffuserPipeline",parameters:[{name:"vae",val:": AutoencoderKL"},{name:"text_encoder",val:": CLIPTextModel"},{name:"image_encoder",val:": CLIPVisionModelWithProjection"},{name:"image_processor",val:": CLIPImageProcessor"},{name:"clip_tokenizer",val:": CLIPTokenizer"},{name:"text_decoder",val:": UniDiffuserTextDecoder"},{name:"text_tokenizer",val:": GPT2Tokenizer"},{name:"unet",val:": UniDiffuserModel"},{name:"scheduler",val:": KarrasDiffusionSchedulers"}],parametersDescription:[{anchor:"diffusers.UniDiffuserPipeline.vae",description:`<strong>vae</strong> (<a href="/docs/diffusers/v0.21.0/en/api/models/autoencoderkl#diffusers.AutoencoderKL">AutoencoderKL</a>) &#x2014;
Variational Auto-Encoder (VAE) model to encode and decode images to and from latent representations. This
is part of the UniDiffuser image representation along with the CLIP vision encoding.`,name:"vae"},{anchor:"diffusers.UniDiffuserPipeline.text_encoder",description:`<strong>text_encoder</strong> (<code>CLIPTextModel</code>) &#x2014;
Frozen text-encoder (<a href="https://huggingface.co/openai/clip-vit-large-patch14" rel="nofollow">clip-vit-large-patch14</a>).`,name:"text_encoder"},{anchor:"diffusers.UniDiffuserPipeline.image_encoder",description:`<strong>image_encoder</strong> (<code>CLIPVisionModel</code>) &#x2014;
A <code>CLIPVisionModel</code> to encode images as part of its image representation along with the VAE
latent representation.`,name:"image_encoder"},{anchor:"diffusers.UniDiffuserPipeline.image_processor",description:`<strong>image_processor</strong> (<code>CLIPImageProcessor</code>) &#x2014;
<code>CLIPImageProcessor</code> to preprocess an image before CLIP encoding it with <code>image_encoder</code>.`,name:"image_processor"},{anchor:"diffusers.UniDiffuserPipeline.clip_tokenizer",description:`<strong>clip_tokenizer</strong> (<code>CLIPTokenizer</code>) &#x2014;
A <code>CLIPTokenizer</code> to tokenize the prompt before encoding it with <code>text_encoder</code>.`,name:"clip_tokenizer"},{anchor:"diffusers.UniDiffuserPipeline.text_decoder",description:`<strong>text_decoder</strong> (<code>UniDiffuserTextDecoder</code>) &#x2014;
Frozen text decoder. This is a GPT-style model which is used to generate text from the UniDiffuser
embedding.`,name:"text_decoder"},{anchor:"diffusers.UniDiffuserPipeline.text_tokenizer",description:`<strong>text_tokenizer</strong> (<code>GPT2Tokenizer</code>) &#x2014;
A <code>GPT2Tokenizer</code> to decode text for text generation; used along with the <code>text_decoder</code>.`,name:"text_tokenizer"},{anchor:"diffusers.UniDiffuserPipeline.unet",description:`<strong>unet</strong> (<code>UniDiffuserModel</code>) &#x2014;
A <a href="https://github.com/baofff/U-ViT" rel="nofollow">U-ViT</a> model with UNNet-style skip connections between transformer
layers to denoise the encoded image latents.`,name:"unet"},{anchor:"diffusers.UniDiffuserPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/v0.21.0/en/api/schedulers/overview#diffusers.SchedulerMixin">SchedulerMixin</a>) &#x2014;
A scheduler to be used in combination with <code>unet</code> to denoise the encoded image and/or text latents. The
original UniDiffuser paper uses the <a href="/docs/diffusers/v0.21.0/en/api/schedulers/multistep_dpm_solver#diffusers.DPMSolverMultistepScheduler">DPMSolverMultistepScheduler</a> scheduler.`,name:"scheduler"}],source:"https://github.com/huggingface/diffusers/blob/v0.21.0/src/diffusers/pipelines/unidiffuser/pipeline_unidiffuser.py#L72"}}),Xe=new R({props:{name:"__call__",anchor:"diffusers.UniDiffuserPipeline.__call__",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"image",val:": typing.Union[torch.FloatTensor, PIL.Image.Image, NoneType] = None"},{name:"height",val:": typing.Optional[int] = None"},{name:"width",val:": typing.Optional[int] = None"},{name:"data_type",val:": typing.Optional[int] = 1"},{name:"num_inference_steps",val:": int = 50"},{name:"guidance_scale",val:": float = 8.0"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"num_images_per_prompt",val:": typing.Optional[int] = 1"},{name:"num_prompts_per_image",val:": typing.Optional[int] = 1"},{name:"eta",val:": float = 0.0"},{name:"generator",val:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = None"},{name:"latents",val:": typing.Optional[torch.FloatTensor] = None"},{name:"prompt_latents",val:": typing.Optional[torch.FloatTensor] = None"},{name:"vae_latents",val:": typing.Optional[torch.FloatTensor] = None"},{name:"clip_latents",val:": typing.Optional[torch.FloatTensor] = None"},{name:"prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_type",val:": typing.Optional[str] = 'pil'"},{name:"return_dict",val:": bool = True"},{name:"callback",val:": typing.Union[typing.Callable[[int, int, torch.FloatTensor], NoneType], NoneType] = None"},{name:"callback_steps",val:": int = 1"}],parametersDescription:[{anchor:"diffusers.UniDiffuserPipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts to guide image generation. If not defined, you need to pass <code>prompt_embeds</code>.
Required for text-conditioned image generation (<code>text2img</code>) mode.`,name:"prompt"},{anchor:"diffusers.UniDiffuserPipeline.__call__.image",description:`<strong>image</strong> (<code>torch.FloatTensor</code> or <code>PIL.Image.Image</code>, <em>optional</em>) &#x2014;
<code>Image</code> or tensor representing an image batch. Required for image-conditioned text generation
(<code>img2text</code>) mode.`,name:"image"},{anchor:"diffusers.UniDiffuserPipeline.__call__.height",description:`<strong>height</strong> (<code>int</code>, <em>optional</em>, defaults to <code>self.unet.config.sample_size * self.vae_scale_factor</code>) &#x2014;
The height in pixels of the generated image.`,name:"height"},{anchor:"diffusers.UniDiffuserPipeline.__call__.width",description:`<strong>width</strong> (<code>int</code>, <em>optional</em>, defaults to <code>self.unet.config.sample_size * self.vae_scale_factor</code>) &#x2014;
The width in pixels of the generated image.`,name:"width"},{anchor:"diffusers.UniDiffuserPipeline.__call__.data_type",description:`<strong>data_type</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The data type (either 0 or 1). Only used if you are loading a checkpoint which supports a data type
embedding; this is added for compatibility with the
<a href="https://huggingface.co/thu-ml/unidiffuser-v1" rel="nofollow">UniDiffuser-v1</a> checkpoint.`,name:"data_type"},{anchor:"diffusers.UniDiffuserPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 50) &#x2014;
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
expense of slower inference.`,name:"num_inference_steps"},{anchor:"diffusers.UniDiffuserPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 8.0) &#x2014;
A higher guidance scale value encourages the model to generate images closely linked to the text
<code>prompt</code> at the expense of lower image quality. Guidance scale is enabled when <code>guidance_scale &gt; 1</code>.`,name:"guidance_scale"},{anchor:"diffusers.UniDiffuserPipeline.__call__.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts to guide what to not include in image generation. If not defined, you need to
pass <code>negative_prompt_embeds</code> instead. Ignored when not using guidance (<code>guidance_scale &lt; 1</code>). Used in
text-conditioned image generation (<code>text2img</code>) mode.`,name:"negative_prompt"},{anchor:"diffusers.UniDiffuserPipeline.__call__.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of images to generate per prompt. Used in <code>text2img</code> (text-conditioned image generation) and
<code>img</code> mode. If the mode is joint and both <code>num_images_per_prompt</code> and <code>num_prompts_per_image</code> are
supplied, <code>min(num_images_per_prompt, num_prompts_per_image)</code> samples are generated.`,name:"num_images_per_prompt"},{anchor:"diffusers.UniDiffuserPipeline.__call__.num_prompts_per_image",description:`<strong>num_prompts_per_image</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of prompts to generate per image. Used in <code>img2text</code> (image-conditioned text generation) and
<code>text</code> mode. If the mode is joint and both <code>num_images_per_prompt</code> and <code>num_prompts_per_image</code> are
supplied, <code>min(num_images_per_prompt, num_prompts_per_image)</code> samples are generated.`,name:"num_prompts_per_image"},{anchor:"diffusers.UniDiffuserPipeline.__call__.eta",description:`<strong>eta</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
Corresponds to parameter eta (&#x3B7;) from the <a href="https://arxiv.org/abs/2010.02502" rel="nofollow">DDIM</a> paper. Only applies
to the <a href="/docs/diffusers/v0.21.0/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>, and is ignored in other schedulers.`,name:"eta"},{anchor:"diffusers.UniDiffuserPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) &#x2014;
A <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow"><code>torch.Generator</code></a> to make
generation deterministic.`,name:"generator"},{anchor:"diffusers.UniDiffuserPipeline.__call__.latents",description:`<strong>latents</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated noisy latents sampled from a Gaussian distribution, to be used as inputs for joint
image-text generation. Can be used to tweak the same generation with different prompts. If not
provided, a latents tensor is generated by sampling using the supplied random <code>generator</code>. This assumes
a full set of VAE, CLIP, and text latents, if supplied, overrides the value of <code>prompt_latents</code>,
<code>vae_latents</code>, and <code>clip_latents</code>.`,name:"latents"},{anchor:"diffusers.UniDiffuserPipeline.__call__.prompt_latents",description:`<strong>prompt_latents</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated noisy latents sampled from a Gaussian distribution, to be used as inputs for text
generation. Can be used to tweak the same generation with different prompts. If not provided, a latents
tensor is generated by sampling using the supplied random <code>generator</code>.`,name:"prompt_latents"},{anchor:"diffusers.UniDiffuserPipeline.__call__.vae_latents",description:`<strong>vae_latents</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated noisy latents sampled from a Gaussian distribution, to be used as inputs for image
generation. Can be used to tweak the same generation with different prompts. If not provided, a latents
tensor is generated by sampling using the supplied random <code>generator</code>.`,name:"vae_latents"},{anchor:"diffusers.UniDiffuserPipeline.__call__.clip_latents",description:`<strong>clip_latents</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated noisy latents sampled from a Gaussian distribution, to be used as inputs for image
generation. Can be used to tweak the same generation with different prompts. If not provided, a latents
tensor is generated by sampling using the supplied random <code>generator</code>.`,name:"clip_latents"},{anchor:"diffusers.UniDiffuserPipeline.__call__.prompt_embeds",description:`<strong>prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated text embeddings. Can be used to easily tweak text inputs (prompt weighting). If not
provided, text embeddings are generated from the <code>prompt</code> input argument. Used in text-conditioned
image generation (<code>text2img</code>) mode.`,name:"prompt_embeds"},{anchor:"diffusers.UniDiffuserPipeline.__call__.negative_prompt_embeds",description:`<strong>negative_prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated negative text embeddings. Can be used to easily tweak text inputs (prompt weighting). If
not provided, <code>negative_prompt_embeds</code> are be generated from the <code>negative_prompt</code> input argument. Used
in text-conditioned image generation (<code>text2img</code>) mode.`,name:"negative_prompt_embeds"},{anchor:"diffusers.UniDiffuserPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;pil&quot;</code>) &#x2014;
The output format of the generated image. Choose between <code>PIL.Image</code> or <code>np.array</code>.`,name:"output_type"},{anchor:"diffusers.UniDiffuserPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <a href="/docs/diffusers/v0.21.0/en/api/pipelines/unidiffuser#diffusers.ImageTextPipelineOutput">ImageTextPipelineOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"diffusers.UniDiffuserPipeline.__call__.callback",description:`<strong>callback</strong> (<code>Callable</code>, <em>optional</em>) &#x2014;
A function that calls every <code>callback_steps</code> steps during inference. The function is called with the
following arguments: <code>callback(step: int, timestep: int, latents: torch.FloatTensor)</code>.`,name:"callback"},{anchor:"diffusers.UniDiffuserPipeline.__call__.callback_steps",description:`<strong>callback_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The frequency at which the <code>callback</code> function is called. If not specified, the callback is called at
every step.`,name:"callback_steps"}],source:"https://github.com/huggingface/diffusers/blob/v0.21.0/src/diffusers/pipelines/unidiffuser/pipeline_unidiffuser.py#L1029",returnDescription:`
<p>If <code>return_dict</code> is <code>True</code>, <a
  href="/docs/diffusers/v0.21.0/en/api/pipelines/unidiffuser#diffusers.ImageTextPipelineOutput"
>ImageTextPipelineOutput</a> is returned, otherwise a
<code>tuple</code> is returned where the first element is a list with the generated images and the second element
is a list of generated texts.</p>
`,returnType:`
<p><a
  href="/docs/diffusers/v0.21.0/en/api/pipelines/unidiffuser#diffusers.ImageTextPipelineOutput"
>ImageTextPipelineOutput</a> or <code>tuple</code></p>
`}}),Pe=new R({props:{name:"reset_mode",anchor:"diffusers.UniDiffuserPipeline.reset_mode",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.21.0/src/diffusers/pipelines/unidiffuser/pipeline_unidiffuser.py#L293"}}),De=new R({props:{name:"set_image_mode",anchor:"diffusers.UniDiffuserPipeline.set_image_mode",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.21.0/src/diffusers/pipelines/unidiffuser/pipeline_unidiffuser.py#L277"}}),ke=new R({props:{name:"set_image_to_text_mode",anchor:"diffusers.UniDiffuserPipeline.set_image_to_text_mode",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.21.0/src/diffusers/pipelines/unidiffuser/pipeline_unidiffuser.py#L285"}}),Ve=new R({props:{name:"set_joint_mode",anchor:"diffusers.UniDiffuserPipeline.set_joint_mode",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.21.0/src/diffusers/pipelines/unidiffuser/pipeline_unidiffuser.py#L289"}}),Be=new R({props:{name:"set_text_mode",anchor:"diffusers.UniDiffuserPipeline.set_text_mode",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.21.0/src/diffusers/pipelines/unidiffuser/pipeline_unidiffuser.py#L273"}}),Ne=new R({props:{name:"set_text_to_image_mode",anchor:"diffusers.UniDiffuserPipeline.set_text_to_image_mode",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.21.0/src/diffusers/pipelines/unidiffuser/pipeline_unidiffuser.py#L281"}}),Re=new F({}),Fe=new R({props:{name:"class diffusers.ImageTextPipelineOutput",anchor:"diffusers.ImageTextPipelineOutput",parameters:[{name:"images",val:": typing.Union[typing.List[PIL.Image.Image], numpy.ndarray, NoneType]"},{name:"text",val:": typing.Union[typing.List[str], typing.List[typing.List[str]], NoneType]"}],parametersDescription:[{anchor:"diffusers.ImageTextPipelineOutput.images",description:`<strong>images</strong> (<code>List[PIL.Image.Image]</code> or <code>np.ndarray</code>) &#x2014;
List of denoised PIL images of length <code>batch_size</code> or NumPy array of shape <code>(batch_size, height, width, num_channels)</code>.`,name:"images"},{anchor:"diffusers.ImageTextPipelineOutput.text",description:`<strong>text</strong> (<code>List[str]</code> or <code>List[List[str]]</code>) &#x2014;
List of generated text strings of length <code>batch_size</code> or a list of list of strings whose outer list has
length <code>batch_size</code>.`,name:"text"}],source:"https://github.com/huggingface/diffusers/blob/v0.21.0/src/diffusers/pipelines/unidiffuser/pipeline_unidiffuser.py#L55"}}),{c(){v=n("meta"),S=m(),x=n("h1"),Z=n("a"),$=n("span"),c(M.$$.fragment),I=m(),Q=n("span"),Ci=r("UniDiffuser"),Nt=m(),C=n("p"),Yi=r("The UniDiffuser model was proposed in "),ce=n("a"),zi=r("One Transformer Fits All Distributions in Multi-Modal Diffusion at Scale"),Li=r(" by Fan Bao, Shen Nie, Kaiwen Xue, Chongxuan Li, Shi Pu, Yaole Wang, Gang Yue, Yue Cao, Hang Su, Jun Zhu."),Rt=m(),Y=n("p"),Ai=r("The abstract from the "),ue=n("a"),Hi=r("paper"),qi=r(" is:"),Ft=m(),Ce=n("p"),ot=n("em"),Oi=r("This paper proposes a unified diffusion framework (dubbed UniDiffuser) to fit all distributions relevant to a set of multi-modal data in one model. Our key insight is \u2014 learning diffusion models for marginal, conditional, and joint distributions can be unified as predicting the noise in the perturbed data, where the perturbation levels (i.e. timesteps) can be different for different modalities. Inspired by the unified view, UniDiffuser learns all distributions simultaneously with a minimal modification to the original diffusion model \u2014 perturbs data in all modalities instead of a single modality, inputs individual timesteps in different modalities, and predicts the noise of all modalities instead of a single modality. UniDiffuser is parameterized by a transformer for diffusion models to handle input types of different modalities. Implemented on large-scale paired image-text data, UniDiffuser is able to perform image, text, text-to-image, image-to-text, and image-text pair generation by setting proper timesteps without additional overhead. In particular, UniDiffuser is able to produce perceptually realistic samples in all tasks and its quantitative results (e.g., the FID and CLIP score) are not only superior to existing general-purpose models but also comparable to the bespoken models (e.g., Stable Diffusion and DALL-E 2) in representative tasks (e.g., text-to-image generation)."),St=m(),j=n("p"),Ki=r("You can find the original codebase at "),he=n("a"),en=r("thu-ml/unidiffuser"),tn=r(" and additional checkpoints at "),ge=n("a"),nn=r("thu-ml"),an=r("."),Qt=m(),c(z.$$.fragment),Ct=m(),L=n("p"),sn=r("This pipeline was contributed by "),_e=n("a"),on=r("dg845"),rn=r(". \u2764\uFE0F"),Yt=m(),G=n("h2"),A=n("a"),rt=n("span"),c(be.$$.fragment),ln=m(),lt=n("span"),pn=r("Usage Examples"),zt=m(),Ye=n("p"),dn=r("Because the UniDiffuser model is trained to model the joint distribution of (image, text) pairs, it is capable of performing a diverse range of generation tasks:"),Lt=m(),W=n("h3"),H=n("a"),pt=n("span"),c(we.$$.fragment),mn=m(),dt=n("span"),fn=r("Unconditional Image and Text Generation"),At=m(),q=n("p"),cn=r("Unconditional generation (where we start from only latents sampled from a standard Gaussian prior) from a "),ze=n("a"),un=r("UniDiffuserPipeline"),hn=r(" will produce a (image, text) pair:"),Ht=m(),c(ye.$$.fragment),qt=m(),Le=n("p"),gn=r("This is also called \u201Cjoint\u201D generation in the UniDiffusers paper, since we are sampling from the joint image-text distribution."),Ot=m(),O=n("p"),_n=r(`Note that the generation task is inferred from the inputs used when calling the pipeline.
It is also possible to manually specify the unconditional generation task (\u201Cmode\u201D) manually with `),Ae=n("a"),bn=r("UniDiffuserPipeline.set_joint_mode()"),wn=r(":"),Kt=m(),c(ve.$$.fragment),ei=m(),K=n("p"),yn=r(`When the mode is set manually, subsequent calls to the pipeline will use the set mode without attempting the infer the mode.
You can reset the mode with `),He=n("a"),vn=r("UniDiffuserPipeline.reset_mode()"),Un=r(", after which the pipeline will once again infer the mode."),ti=m(),qe=n("p"),xn=r("You can also generate only an image or only text (which the UniDiffuser paper calls \u201Cmarginal\u201D generation since we sample from the marginal distribution of images and text, respectively):"),ii=m(),c(Ue.$$.fragment),ni=m(),X=n("h3"),ee=n("a"),mt=n("span"),c(xe.$$.fragment),Tn=m(),ft=n("span"),Mn=r("Text-to-Image Generation"),ai=m(),Oe=n("p"),Zn=r(`UniDiffuser is also capable of sampling from conditional distributions; that is, the distribution of images conditioned on a text prompt or the distribution of texts conditioned on an image.
Here is an example of sampling from the conditional image distribution (text-to-image generation or text-conditioned image generation):`),si=m(),c(Te.$$.fragment),oi=m(),U=n("p"),Jn=r("The "),ct=n("code"),In=r("text2img"),jn=r(" mode requires that either an input "),ut=n("code"),En=r("prompt"),$n=r(" or "),ht=n("code"),Gn=r("prompt_embeds"),Wn=r(" be supplied. You can set the "),gt=n("code"),Xn=r("text2img"),Pn=r(" mode manually with "),Ke=n("a"),Dn=r("UniDiffuserPipeline.set_text_to_image_mode()"),kn=r("."),ri=m(),P=n("h3"),te=n("a"),_t=n("span"),c(Me.$$.fragment),Vn=m(),bt=n("span"),Bn=r("Image-to-Text Generation"),li=m(),et=n("p"),Nn=r("Similarly, UniDiffuser can also produce text samples given an image (image-to-text or image-conditioned text generation):"),pi=m(),c(Ze.$$.fragment),di=m(),T=n("p"),Rn=r("The "),wt=n("code"),Fn=r("img2text"),Sn=r(" mode requires that an input "),yt=n("code"),Qn=r("image"),Cn=r(" be supplied. You can set the "),vt=n("code"),Yn=r("img2text"),zn=r(" mode manually with "),tt=n("a"),Ln=r("UniDiffuserPipeline.set_image_to_text_mode()"),An=r("."),mi=m(),D=n("h3"),ie=n("a"),Ut=n("span"),c(Je.$$.fragment),Hn=m(),xt=n("span"),qn=r("Image Variation"),fi=m(),it=n("p"),On=r(`The UniDiffuser authors suggest performing image variation through a \u201Cround-trip\u201D generation method, where given an input image, we first perform an image-to-text generation, and the perform a text-to-image generation on the outputs of the first generation.
This produces a new image which is semantically similar to the input image:`),ci=m(),c(Ie.$$.fragment),ui=m(),k=n("h3"),ne=n("a"),Tt=n("span"),c(je.$$.fragment),Kn=m(),Mt=n("span"),ea=r("Text Variation"),hi=m(),nt=n("p"),ta=r("Similarly, text variation can be performed on an input prompt with a text-to-image generation followed by a image-to-text generation:"),gi=m(),c(Ee.$$.fragment),_i=m(),V=n("h2"),ae=n("a"),Zt=n("span"),c($e.$$.fragment),ia=m(),Jt=n("span"),na=r("UniDiffuserPipeline"),bi=m(),w=n("div"),c(Ge.$$.fragment),aa=m(),It=n("p"),sa=r(`Pipeline for a bimodal image-text model which supports unconditional text and image generation, text-conditioned
image generation, image-conditioned text generation, and joint image-text generation.`),oa=m(),We=n("p"),ra=r("This model inherits from "),at=n("a"),la=r("DiffusionPipeline"),pa=r(`. Check the superclass documentation for the generic methods
implemented for all pipelines (downloading, saving, running on a particular device, etc.).`),da=m(),se=n("div"),c(Xe.$$.fragment),ma=m(),jt=n("p"),fa=r("The call function to the pipeline for generation."),ca=m(),oe=n("div"),c(Pe.$$.fragment),ua=m(),Et=n("p"),ha=r("Removes a manually set mode; after calling this, the pipeline will infer the mode from inputs."),ga=m(),re=n("div"),c(De.$$.fragment),_a=m(),$t=n("p"),ba=r("Manually set the generation mode to unconditional (\u201Cmarginal\u201D) image generation."),wa=m(),le=n("div"),c(ke.$$.fragment),ya=m(),Gt=n("p"),va=r("Manually set the generation mode to image-conditioned text generation."),Ua=m(),pe=n("div"),c(Ve.$$.fragment),xa=m(),Wt=n("p"),Ta=r("Manually set the generation mode to unconditional joint image-text generation."),Ma=m(),de=n("div"),c(Be.$$.fragment),Za=m(),Xt=n("p"),Ja=r("Manually set the generation mode to unconditional (\u201Cmarginal\u201D) text generation."),Ia=m(),me=n("div"),c(Ne.$$.fragment),ja=m(),Pt=n("p"),Ea=r("Manually set the generation mode to text-conditioned image generation."),wi=m(),B=n("h2"),fe=n("a"),Dt=n("span"),c(Re.$$.fragment),$a=m(),kt=n("span"),Ga=r("ImageTextPipelineOutput"),yi=m(),N=n("div"),c(Fe.$$.fragment),Wa=m(),Vt=n("p"),Xa=r("Output class for joint image-text pipelines."),this.h()},l(e){const o=zs('[data-svelte="svelte-1phssyn"]',document.head);v=a(o,"META",{name:!0,content:!0}),o.forEach(i),S=f(e),x=a(e,"H1",{class:!0});var Se=s(x);Z=a(Se,"A",{id:!0,class:!0,href:!0});var Pa=s(Z);$=a(Pa,"SPAN",{});var Da=s($);u(M.$$.fragment,Da),Da.forEach(i),Pa.forEach(i),I=f(Se),Q=a(Se,"SPAN",{});var ka=s(Q);Ci=l(ka,"UniDiffuser"),ka.forEach(i),Se.forEach(i),Nt=f(e),C=a(e,"P",{});var Ui=s(C);Yi=l(Ui,"The UniDiffuser model was proposed in "),ce=a(Ui,"A",{href:!0,rel:!0});var Va=s(ce);zi=l(Va,"One Transformer Fits All Distributions in Multi-Modal Diffusion at Scale"),Va.forEach(i),Li=l(Ui," by Fan Bao, Shen Nie, Kaiwen Xue, Chongxuan Li, Shi Pu, Yaole Wang, Gang Yue, Yue Cao, Hang Su, Jun Zhu."),Ui.forEach(i),Rt=f(e),Y=a(e,"P",{});var xi=s(Y);Ai=l(xi,"The abstract from the "),ue=a(xi,"A",{href:!0,rel:!0});var Ba=s(ue);Hi=l(Ba,"paper"),Ba.forEach(i),qi=l(xi," is:"),xi.forEach(i),Ft=f(e),Ce=a(e,"P",{});var Na=s(Ce);ot=a(Na,"EM",{});var Ra=s(ot);Oi=l(Ra,"This paper proposes a unified diffusion framework (dubbed UniDiffuser) to fit all distributions relevant to a set of multi-modal data in one model. Our key insight is \u2014 learning diffusion models for marginal, conditional, and joint distributions can be unified as predicting the noise in the perturbed data, where the perturbation levels (i.e. timesteps) can be different for different modalities. Inspired by the unified view, UniDiffuser learns all distributions simultaneously with a minimal modification to the original diffusion model \u2014 perturbs data in all modalities instead of a single modality, inputs individual timesteps in different modalities, and predicts the noise of all modalities instead of a single modality. UniDiffuser is parameterized by a transformer for diffusion models to handle input types of different modalities. Implemented on large-scale paired image-text data, UniDiffuser is able to perform image, text, text-to-image, image-to-text, and image-text pair generation by setting proper timesteps without additional overhead. In particular, UniDiffuser is able to produce perceptually realistic samples in all tasks and its quantitative results (e.g., the FID and CLIP score) are not only superior to existing general-purpose models but also comparable to the bespoken models (e.g., Stable Diffusion and DALL-E 2) in representative tasks (e.g., text-to-image generation)."),Ra.forEach(i),Na.forEach(i),St=f(e),j=a(e,"P",{});var st=s(j);Ki=l(st,"You can find the original codebase at "),he=a(st,"A",{href:!0,rel:!0});var Fa=s(he);en=l(Fa,"thu-ml/unidiffuser"),Fa.forEach(i),tn=l(st," and additional checkpoints at "),ge=a(st,"A",{href:!0,rel:!0});var Sa=s(ge);nn=l(Sa,"thu-ml"),Sa.forEach(i),an=l(st,"."),st.forEach(i),Qt=f(e),u(z.$$.fragment,e),Ct=f(e),L=a(e,"P",{});var Ti=s(L);sn=l(Ti,"This pipeline was contributed by "),_e=a(Ti,"A",{href:!0,rel:!0});var Qa=s(_e);on=l(Qa,"dg845"),Qa.forEach(i),rn=l(Ti,". \u2764\uFE0F"),Ti.forEach(i),Yt=f(e),G=a(e,"H2",{class:!0});var Mi=s(G);A=a(Mi,"A",{id:!0,class:!0,href:!0});var Ca=s(A);rt=a(Ca,"SPAN",{});var Ya=s(rt);u(be.$$.fragment,Ya),Ya.forEach(i),Ca.forEach(i),ln=f(Mi),lt=a(Mi,"SPAN",{});var za=s(lt);pn=l(za,"Usage Examples"),za.forEach(i),Mi.forEach(i),zt=f(e),Ye=a(e,"P",{});var La=s(Ye);dn=l(La,"Because the UniDiffuser model is trained to model the joint distribution of (image, text) pairs, it is capable of performing a diverse range of generation tasks:"),La.forEach(i),Lt=f(e),W=a(e,"H3",{class:!0});var Zi=s(W);H=a(Zi,"A",{id:!0,class:!0,href:!0});var Aa=s(H);pt=a(Aa,"SPAN",{});var Ha=s(pt);u(we.$$.fragment,Ha),Ha.forEach(i),Aa.forEach(i),mn=f(Zi),dt=a(Zi,"SPAN",{});var qa=s(dt);fn=l(qa,"Unconditional Image and Text Generation"),qa.forEach(i),Zi.forEach(i),At=f(e),q=a(e,"P",{});var Ji=s(q);cn=l(Ji,"Unconditional generation (where we start from only latents sampled from a standard Gaussian prior) from a "),ze=a(Ji,"A",{href:!0});var Oa=s(ze);un=l(Oa,"UniDiffuserPipeline"),Oa.forEach(i),hn=l(Ji," will produce a (image, text) pair:"),Ji.forEach(i),Ht=f(e),u(ye.$$.fragment,e),qt=f(e),Le=a(e,"P",{});var Ka=s(Le);gn=l(Ka,"This is also called \u201Cjoint\u201D generation in the UniDiffusers paper, since we are sampling from the joint image-text distribution."),Ka.forEach(i),Ot=f(e),O=a(e,"P",{});var Ii=s(O);_n=l(Ii,`Note that the generation task is inferred from the inputs used when calling the pipeline.
It is also possible to manually specify the unconditional generation task (\u201Cmode\u201D) manually with `),Ae=a(Ii,"A",{href:!0});var es=s(Ae);bn=l(es,"UniDiffuserPipeline.set_joint_mode()"),es.forEach(i),wn=l(Ii,":"),Ii.forEach(i),Kt=f(e),u(ve.$$.fragment,e),ei=f(e),K=a(e,"P",{});var ji=s(K);yn=l(ji,`When the mode is set manually, subsequent calls to the pipeline will use the set mode without attempting the infer the mode.
You can reset the mode with `),He=a(ji,"A",{href:!0});var ts=s(He);vn=l(ts,"UniDiffuserPipeline.reset_mode()"),ts.forEach(i),Un=l(ji,", after which the pipeline will once again infer the mode."),ji.forEach(i),ti=f(e),qe=a(e,"P",{});var is=s(qe);xn=l(is,"You can also generate only an image or only text (which the UniDiffuser paper calls \u201Cmarginal\u201D generation since we sample from the marginal distribution of images and text, respectively):"),is.forEach(i),ii=f(e),u(Ue.$$.fragment,e),ni=f(e),X=a(e,"H3",{class:!0});var Ei=s(X);ee=a(Ei,"A",{id:!0,class:!0,href:!0});var ns=s(ee);mt=a(ns,"SPAN",{});var as=s(mt);u(xe.$$.fragment,as),as.forEach(i),ns.forEach(i),Tn=f(Ei),ft=a(Ei,"SPAN",{});var ss=s(ft);Mn=l(ss,"Text-to-Image Generation"),ss.forEach(i),Ei.forEach(i),ai=f(e),Oe=a(e,"P",{});var os=s(Oe);Zn=l(os,`UniDiffuser is also capable of sampling from conditional distributions; that is, the distribution of images conditioned on a text prompt or the distribution of texts conditioned on an image.
Here is an example of sampling from the conditional image distribution (text-to-image generation or text-conditioned image generation):`),os.forEach(i),si=f(e),u(Te.$$.fragment,e),oi=f(e),U=a(e,"P",{});var J=s(U);Jn=l(J,"The "),ct=a(J,"CODE",{});var rs=s(ct);In=l(rs,"text2img"),rs.forEach(i),jn=l(J," mode requires that either an input "),ut=a(J,"CODE",{});var ls=s(ut);En=l(ls,"prompt"),ls.forEach(i),$n=l(J," or "),ht=a(J,"CODE",{});var ps=s(ht);Gn=l(ps,"prompt_embeds"),ps.forEach(i),Wn=l(J," be supplied. You can set the "),gt=a(J,"CODE",{});var ds=s(gt);Xn=l(ds,"text2img"),ds.forEach(i),Pn=l(J," mode manually with "),Ke=a(J,"A",{href:!0});var ms=s(Ke);Dn=l(ms,"UniDiffuserPipeline.set_text_to_image_mode()"),ms.forEach(i),kn=l(J,"."),J.forEach(i),ri=f(e),P=a(e,"H3",{class:!0});var $i=s(P);te=a($i,"A",{id:!0,class:!0,href:!0});var fs=s(te);_t=a(fs,"SPAN",{});var cs=s(_t);u(Me.$$.fragment,cs),cs.forEach(i),fs.forEach(i),Vn=f($i),bt=a($i,"SPAN",{});var us=s(bt);Bn=l(us,"Image-to-Text Generation"),us.forEach(i),$i.forEach(i),li=f(e),et=a(e,"P",{});var hs=s(et);Nn=l(hs,"Similarly, UniDiffuser can also produce text samples given an image (image-to-text or image-conditioned text generation):"),hs.forEach(i),pi=f(e),u(Ze.$$.fragment,e),di=f(e),T=a(e,"P",{});var E=s(T);Rn=l(E,"The "),wt=a(E,"CODE",{});var gs=s(wt);Fn=l(gs,"img2text"),gs.forEach(i),Sn=l(E," mode requires that an input "),yt=a(E,"CODE",{});var _s=s(yt);Qn=l(_s,"image"),_s.forEach(i),Cn=l(E," be supplied. You can set the "),vt=a(E,"CODE",{});var bs=s(vt);Yn=l(bs,"img2text"),bs.forEach(i),zn=l(E," mode manually with "),tt=a(E,"A",{href:!0});var ws=s(tt);Ln=l(ws,"UniDiffuserPipeline.set_image_to_text_mode()"),ws.forEach(i),An=l(E,"."),E.forEach(i),mi=f(e),D=a(e,"H3",{class:!0});var Gi=s(D);ie=a(Gi,"A",{id:!0,class:!0,href:!0});var ys=s(ie);Ut=a(ys,"SPAN",{});var vs=s(Ut);u(Je.$$.fragment,vs),vs.forEach(i),ys.forEach(i),Hn=f(Gi),xt=a(Gi,"SPAN",{});var Us=s(xt);qn=l(Us,"Image Variation"),Us.forEach(i),Gi.forEach(i),fi=f(e),it=a(e,"P",{});var xs=s(it);On=l(xs,`The UniDiffuser authors suggest performing image variation through a \u201Cround-trip\u201D generation method, where given an input image, we first perform an image-to-text generation, and the perform a text-to-image generation on the outputs of the first generation.
This produces a new image which is semantically similar to the input image:`),xs.forEach(i),ci=f(e),u(Ie.$$.fragment,e),ui=f(e),k=a(e,"H3",{class:!0});var Wi=s(k);ne=a(Wi,"A",{id:!0,class:!0,href:!0});var Ts=s(ne);Tt=a(Ts,"SPAN",{});var Ms=s(Tt);u(je.$$.fragment,Ms),Ms.forEach(i),Ts.forEach(i),Kn=f(Wi),Mt=a(Wi,"SPAN",{});var Zs=s(Mt);ea=l(Zs,"Text Variation"),Zs.forEach(i),Wi.forEach(i),hi=f(e),nt=a(e,"P",{});var Js=s(nt);ta=l(Js,"Similarly, text variation can be performed on an input prompt with a text-to-image generation followed by a image-to-text generation:"),Js.forEach(i),gi=f(e),u(Ee.$$.fragment,e),_i=f(e),V=a(e,"H2",{class:!0});var Xi=s(V);ae=a(Xi,"A",{id:!0,class:!0,href:!0});var Is=s(ae);Zt=a(Is,"SPAN",{});var js=s(Zt);u($e.$$.fragment,js),js.forEach(i),Is.forEach(i),ia=f(Xi),Jt=a(Xi,"SPAN",{});var Es=s(Jt);na=l(Es,"UniDiffuserPipeline"),Es.forEach(i),Xi.forEach(i),bi=f(e),w=a(e,"DIV",{class:!0});var y=s(w);u(Ge.$$.fragment,y),aa=f(y),It=a(y,"P",{});var $s=s(It);sa=l($s,`Pipeline for a bimodal image-text model which supports unconditional text and image generation, text-conditioned
image generation, image-conditioned text generation, and joint image-text generation.`),$s.forEach(i),oa=f(y),We=a(y,"P",{});var Pi=s(We);ra=l(Pi,"This model inherits from "),at=a(Pi,"A",{href:!0});var Gs=s(at);la=l(Gs,"DiffusionPipeline"),Gs.forEach(i),pa=l(Pi,`. Check the superclass documentation for the generic methods
implemented for all pipelines (downloading, saving, running on a particular device, etc.).`),Pi.forEach(i),da=f(y),se=a(y,"DIV",{class:!0});var Di=s(se);u(Xe.$$.fragment,Di),ma=f(Di),jt=a(Di,"P",{});var Ws=s(jt);fa=l(Ws,"The call function to the pipeline for generation."),Ws.forEach(i),Di.forEach(i),ca=f(y),oe=a(y,"DIV",{class:!0});var ki=s(oe);u(Pe.$$.fragment,ki),ua=f(ki),Et=a(ki,"P",{});var Xs=s(Et);ha=l(Xs,"Removes a manually set mode; after calling this, the pipeline will infer the mode from inputs."),Xs.forEach(i),ki.forEach(i),ga=f(y),re=a(y,"DIV",{class:!0});var Vi=s(re);u(De.$$.fragment,Vi),_a=f(Vi),$t=a(Vi,"P",{});var Ps=s($t);ba=l(Ps,"Manually set the generation mode to unconditional (\u201Cmarginal\u201D) image generation."),Ps.forEach(i),Vi.forEach(i),wa=f(y),le=a(y,"DIV",{class:!0});var Bi=s(le);u(ke.$$.fragment,Bi),ya=f(Bi),Gt=a(Bi,"P",{});var Ds=s(Gt);va=l(Ds,"Manually set the generation mode to image-conditioned text generation."),Ds.forEach(i),Bi.forEach(i),Ua=f(y),pe=a(y,"DIV",{class:!0});var Ni=s(pe);u(Ve.$$.fragment,Ni),xa=f(Ni),Wt=a(Ni,"P",{});var ks=s(Wt);Ta=l(ks,"Manually set the generation mode to unconditional joint image-text generation."),ks.forEach(i),Ni.forEach(i),Ma=f(y),de=a(y,"DIV",{class:!0});var Ri=s(de);u(Be.$$.fragment,Ri),Za=f(Ri),Xt=a(Ri,"P",{});var Vs=s(Xt);Ja=l(Vs,"Manually set the generation mode to unconditional (\u201Cmarginal\u201D) text generation."),Vs.forEach(i),Ri.forEach(i),Ia=f(y),me=a(y,"DIV",{class:!0});var Fi=s(me);u(Ne.$$.fragment,Fi),ja=f(Fi),Pt=a(Fi,"P",{});var Bs=s(Pt);Ea=l(Bs,"Manually set the generation mode to text-conditioned image generation."),Bs.forEach(i),Fi.forEach(i),y.forEach(i),wi=f(e),B=a(e,"H2",{class:!0});var Si=s(B);fe=a(Si,"A",{id:!0,class:!0,href:!0});var Ns=s(fe);Dt=a(Ns,"SPAN",{});var Rs=s(Dt);u(Re.$$.fragment,Rs),Rs.forEach(i),Ns.forEach(i),$a=f(Si),kt=a(Si,"SPAN",{});var Fs=s(kt);Ga=l(Fs,"ImageTextPipelineOutput"),Fs.forEach(i),Si.forEach(i),yi=f(e),N=a(e,"DIV",{class:!0});var Qi=s(N);u(Fe.$$.fragment,Qi),Wa=f(Qi),Vt=a(Qi,"P",{});var Ss=s(Vt);Xa=l(Ss,"Output class for joint image-text pipelines."),Ss.forEach(i),Qi.forEach(i),this.h()},h(){d(v,"name","hf:doc:metadata"),d(v,"content",JSON.stringify(Os)),d(Z,"id","unidiffuser"),d(Z,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(Z,"href","#unidiffuser"),d(x,"class","relative group"),d(ce,"href","https://huggingface.co/papers/2303.06555"),d(ce,"rel","nofollow"),d(ue,"href","https://arxiv.org/abs/2303.06555"),d(ue,"rel","nofollow"),d(he,"href","https://github.com/thu-ml/unidiffuser"),d(he,"rel","nofollow"),d(ge,"href","https://huggingface.co/thu-ml"),d(ge,"rel","nofollow"),d(_e,"href","https://github.com/dg845"),d(_e,"rel","nofollow"),d(A,"id","usage-examples"),d(A,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(A,"href","#usage-examples"),d(G,"class","relative group"),d(H,"id","unconditional-image-and-text-generation"),d(H,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(H,"href","#unconditional-image-and-text-generation"),d(W,"class","relative group"),d(ze,"href","/docs/diffusers/v0.21.0/en/api/pipelines/unidiffuser#diffusers.UniDiffuserPipeline"),d(Ae,"href","/docs/diffusers/v0.21.0/en/api/pipelines/unidiffuser#diffusers.UniDiffuserPipeline.set_joint_mode"),d(He,"href","/docs/diffusers/v0.21.0/en/api/pipelines/unidiffuser#diffusers.UniDiffuserPipeline.reset_mode"),d(ee,"id","texttoimage-generation"),d(ee,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(ee,"href","#texttoimage-generation"),d(X,"class","relative group"),d(Ke,"href","/docs/diffusers/v0.21.0/en/api/pipelines/unidiffuser#diffusers.UniDiffuserPipeline.set_text_to_image_mode"),d(te,"id","imagetotext-generation"),d(te,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(te,"href","#imagetotext-generation"),d(P,"class","relative group"),d(tt,"href","/docs/diffusers/v0.21.0/en/api/pipelines/unidiffuser#diffusers.UniDiffuserPipeline.set_image_to_text_mode"),d(ie,"id","image-variation"),d(ie,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(ie,"href","#image-variation"),d(D,"class","relative group"),d(ne,"id","text-variation"),d(ne,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(ne,"href","#text-variation"),d(k,"class","relative group"),d(ae,"id","diffusers.UniDiffuserPipeline"),d(ae,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(ae,"href","#diffusers.UniDiffuserPipeline"),d(V,"class","relative group"),d(at,"href","/docs/diffusers/v0.21.0/en/api/pipelines/overview#diffusers.DiffusionPipeline"),d(se,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(oe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(re,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(le,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(pe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(de,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(me,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(w,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(fe,"id","diffusers.ImageTextPipelineOutput"),d(fe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(fe,"href","#diffusers.ImageTextPipelineOutput"),d(B,"class","relative group"),d(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,o){t(document.head,v),p(e,S,o),p(e,x,o),t(x,Z),t(Z,$),h(M,$,null),t(x,I),t(x,Q),t(Q,Ci),p(e,Nt,o),p(e,C,o),t(C,Yi),t(C,ce),t(ce,zi),t(C,Li),p(e,Rt,o),p(e,Y,o),t(Y,Ai),t(Y,ue),t(ue,Hi),t(Y,qi),p(e,Ft,o),p(e,Ce,o),t(Ce,ot),t(ot,Oi),p(e,St,o),p(e,j,o),t(j,Ki),t(j,he),t(he,en),t(j,tn),t(j,ge),t(ge,nn),t(j,an),p(e,Qt,o),h(z,e,o),p(e,Ct,o),p(e,L,o),t(L,sn),t(L,_e),t(_e,on),t(L,rn),p(e,Yt,o),p(e,G,o),t(G,A),t(A,rt),h(be,rt,null),t(G,ln),t(G,lt),t(lt,pn),p(e,zt,o),p(e,Ye,o),t(Ye,dn),p(e,Lt,o),p(e,W,o),t(W,H),t(H,pt),h(we,pt,null),t(W,mn),t(W,dt),t(dt,fn),p(e,At,o),p(e,q,o),t(q,cn),t(q,ze),t(ze,un),t(q,hn),p(e,Ht,o),h(ye,e,o),p(e,qt,o),p(e,Le,o),t(Le,gn),p(e,Ot,o),p(e,O,o),t(O,_n),t(O,Ae),t(Ae,bn),t(O,wn),p(e,Kt,o),h(ve,e,o),p(e,ei,o),p(e,K,o),t(K,yn),t(K,He),t(He,vn),t(K,Un),p(e,ti,o),p(e,qe,o),t(qe,xn),p(e,ii,o),h(Ue,e,o),p(e,ni,o),p(e,X,o),t(X,ee),t(ee,mt),h(xe,mt,null),t(X,Tn),t(X,ft),t(ft,Mn),p(e,ai,o),p(e,Oe,o),t(Oe,Zn),p(e,si,o),h(Te,e,o),p(e,oi,o),p(e,U,o),t(U,Jn),t(U,ct),t(ct,In),t(U,jn),t(U,ut),t(ut,En),t(U,$n),t(U,ht),t(ht,Gn),t(U,Wn),t(U,gt),t(gt,Xn),t(U,Pn),t(U,Ke),t(Ke,Dn),t(U,kn),p(e,ri,o),p(e,P,o),t(P,te),t(te,_t),h(Me,_t,null),t(P,Vn),t(P,bt),t(bt,Bn),p(e,li,o),p(e,et,o),t(et,Nn),p(e,pi,o),h(Ze,e,o),p(e,di,o),p(e,T,o),t(T,Rn),t(T,wt),t(wt,Fn),t(T,Sn),t(T,yt),t(yt,Qn),t(T,Cn),t(T,vt),t(vt,Yn),t(T,zn),t(T,tt),t(tt,Ln),t(T,An),p(e,mi,o),p(e,D,o),t(D,ie),t(ie,Ut),h(Je,Ut,null),t(D,Hn),t(D,xt),t(xt,qn),p(e,fi,o),p(e,it,o),t(it,On),p(e,ci,o),h(Ie,e,o),p(e,ui,o),p(e,k,o),t(k,ne),t(ne,Tt),h(je,Tt,null),t(k,Kn),t(k,Mt),t(Mt,ea),p(e,hi,o),p(e,nt,o),t(nt,ta),p(e,gi,o),h(Ee,e,o),p(e,_i,o),p(e,V,o),t(V,ae),t(ae,Zt),h($e,Zt,null),t(V,ia),t(V,Jt),t(Jt,na),p(e,bi,o),p(e,w,o),h(Ge,w,null),t(w,aa),t(w,It),t(It,sa),t(w,oa),t(w,We),t(We,ra),t(We,at),t(at,la),t(We,pa),t(w,da),t(w,se),h(Xe,se,null),t(se,ma),t(se,jt),t(jt,fa),t(w,ca),t(w,oe),h(Pe,oe,null),t(oe,ua),t(oe,Et),t(Et,ha),t(w,ga),t(w,re),h(De,re,null),t(re,_a),t(re,$t),t($t,ba),t(w,wa),t(w,le),h(ke,le,null),t(le,ya),t(le,Gt),t(Gt,va),t(w,Ua),t(w,pe),h(Ve,pe,null),t(pe,xa),t(pe,Wt),t(Wt,Ta),t(w,Ma),t(w,de),h(Be,de,null),t(de,Za),t(de,Xt),t(Xt,Ja),t(w,Ia),t(w,me),h(Ne,me,null),t(me,ja),t(me,Pt),t(Pt,Ea),p(e,wi,o),p(e,B,o),t(B,fe),t(fe,Dt),h(Re,Dt,null),t(B,$a),t(B,kt),t(kt,Ga),p(e,yi,o),p(e,N,o),h(Fe,N,null),t(N,Wa),t(N,Vt),t(Vt,Xa),vi=!0},p(e,[o]){const Se={};o&2&&(Se.$$scope={dirty:o,ctx:e}),z.$set(Se)},i(e){vi||(g(M.$$.fragment,e),g(z.$$.fragment,e),g(be.$$.fragment,e),g(we.$$.fragment,e),g(ye.$$.fragment,e),g(ve.$$.fragment,e),g(Ue.$$.fragment,e),g(xe.$$.fragment,e),g(Te.$$.fragment,e),g(Me.$$.fragment,e),g(Ze.$$.fragment,e),g(Je.$$.fragment,e),g(Ie.$$.fragment,e),g(je.$$.fragment,e),g(Ee.$$.fragment,e),g($e.$$.fragment,e),g(Ge.$$.fragment,e),g(Xe.$$.fragment,e),g(Pe.$$.fragment,e),g(De.$$.fragment,e),g(ke.$$.fragment,e),g(Ve.$$.fragment,e),g(Be.$$.fragment,e),g(Ne.$$.fragment,e),g(Re.$$.fragment,e),g(Fe.$$.fragment,e),vi=!0)},o(e){_(M.$$.fragment,e),_(z.$$.fragment,e),_(be.$$.fragment,e),_(we.$$.fragment,e),_(ye.$$.fragment,e),_(ve.$$.fragment,e),_(Ue.$$.fragment,e),_(xe.$$.fragment,e),_(Te.$$.fragment,e),_(Me.$$.fragment,e),_(Ze.$$.fragment,e),_(Je.$$.fragment,e),_(Ie.$$.fragment,e),_(je.$$.fragment,e),_(Ee.$$.fragment,e),_($e.$$.fragment,e),_(Ge.$$.fragment,e),_(Xe.$$.fragment,e),_(Pe.$$.fragment,e),_(De.$$.fragment,e),_(ke.$$.fragment,e),_(Ve.$$.fragment,e),_(Be.$$.fragment,e),_(Ne.$$.fragment,e),_(Re.$$.fragment,e),_(Fe.$$.fragment,e),vi=!1},d(e){i(v),e&&i(S),e&&i(x),b(M),e&&i(Nt),e&&i(C),e&&i(Rt),e&&i(Y),e&&i(Ft),e&&i(Ce),e&&i(St),e&&i(j),e&&i(Qt),b(z,e),e&&i(Ct),e&&i(L),e&&i(Yt),e&&i(G),b(be),e&&i(zt),e&&i(Ye),e&&i(Lt),e&&i(W),b(we),e&&i(At),e&&i(q),e&&i(Ht),b(ye,e),e&&i(qt),e&&i(Le),e&&i(Ot),e&&i(O),e&&i(Kt),b(ve,e),e&&i(ei),e&&i(K),e&&i(ti),e&&i(qe),e&&i(ii),b(Ue,e),e&&i(ni),e&&i(X),b(xe),e&&i(ai),e&&i(Oe),e&&i(si),b(Te,e),e&&i(oi),e&&i(U),e&&i(ri),e&&i(P),b(Me),e&&i(li),e&&i(et),e&&i(pi),b(Ze,e),e&&i(di),e&&i(T),e&&i(mi),e&&i(D),b(Je),e&&i(fi),e&&i(it),e&&i(ci),b(Ie,e),e&&i(ui),e&&i(k),b(je),e&&i(hi),e&&i(nt),e&&i(gi),b(Ee,e),e&&i(_i),e&&i(V),b($e),e&&i(bi),e&&i(w),b(Ge),b(Xe),b(Pe),b(De),b(ke),b(Ve),b(Be),b(Ne),e&&i(wi),e&&i(B),b(Re),e&&i(yi),e&&i(N),b(Fe)}}}const Os={local:"unidiffuser",sections:[{local:"usage-examples",sections:[{local:"unconditional-image-and-text-generation",title:"Unconditional Image and Text Generation"},{local:"texttoimage-generation",title:"Text-to-Image Generation"},{local:"imagetotext-generation",title:"Image-to-Text Generation"},{local:"image-variation",title:"Image Variation"},{local:"text-variation",title:"Text Variation"}],title:"Usage Examples"},{local:"diffusers.UniDiffuserPipeline",title:"UniDiffuserPipeline"},{local:"diffusers.ImageTextPipelineOutput",title:"ImageTextPipelineOutput"}],title:"UniDiffuser"};function Ks(Bt){return Ls(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class so extends Qs{constructor(v){super();Cs(this,v,Ks,qs,Ys,{})}}export{so as default,Os as metadata};
