import{S as cs,i as us,s as hs,e as n,k as d,w as u,t as s,M as gs,c as a,d as i,m,a as o,x as h,h as r,b as p,G as t,g as f,y as g,L as _s,q as _,o as b,B as w,v as bs}from"../../../chunks/vendor-hf-doc-builder.js";import{D as I}from"../../../chunks/Docstring-hf-doc-builder.js";import{C as Fe}from"../../../chunks/CodeBlock-hf-doc-builder.js";import{I as N}from"../../../chunks/IconCopyLink-hf-doc-builder.js";function ws(Oa){let E,St,j,R,at,de,Hi,ot,qi,Ct,F,Oi,me,Ki,en,Qt,S,tn,fe,nn,an,Yt,Se,st,on,zt,T,sn,ce,rn,ln,ue,pn,dn,Lt,C,mn,he,fn,cn,At,G,Q,rt,ge,un,lt,hn,Ht,Ce,gn,qt,$,Y,pt,_e,_n,dt,bn,Ot,z,wn,Qe,vn,yn,Kt,be,ei,Ye,Un,ti,L,xn,ze,Mn,Tn,ii,we,ni,A,Zn,Le,Jn,In,ai,Ae,En,oi,ve,si,W,H,mt,ye,jn,ft,Gn,ri,He,$n,li,Ue,pi,y,Wn,ct,Pn,Xn,ut,Dn,kn,ht,Vn,Bn,gt,Nn,Rn,qe,Fn,Sn,di,P,q,_t,xe,Cn,bt,Qn,mi,Oe,Yn,fi,Me,ci,U,zn,wt,Ln,An,vt,Hn,qn,yt,On,Kn,Ke,ea,ta,ui,X,O,Ut,Te,ia,xt,na,hi,et,aa,gi,Ze,_i,D,K,Mt,Je,oa,Tt,sa,bi,tt,ra,wi,Ie,vi,k,ee,Zt,Ee,la,Jt,pa,yi,c,je,da,It,ma,fa,Ge,ca,it,ua,ha,ga,te,$e,_a,Et,ba,wa,ie,We,va,x,ya,jt,Ua,xa,Gt,Ma,Ta,$t,Za,Ja,Wt,Ia,Ea,ja,ne,Pe,Ga,Pt,$a,Wa,ae,Xe,Pa,Xt,Xa,Da,oe,De,ka,Dt,Va,Ba,se,ke,Na,kt,Ra,Fa,re,Ve,Sa,Vt,Ca,Qa,le,Be,Ya,Bt,za,Ui,V,pe,Nt,Ne,La,Rt,Aa,xi,B,Re,Ha,Ft,qa,Mi;return de=new N({}),ge=new N({}),_e=new N({}),be=new Fe({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)`}}),we=new Fe({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>)`}}),ve=new Fe({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>]`}}),ye=new N({}),Ue=new Fe({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>)`}}),xe=new N({}),Me=new Fe({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)`}}),Te=new N({}),Ze=new Fe({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 N({}),Ie=new Fe({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)`}}),Ee=new N({}),je=new I({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.20.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 <a href="https://huggingface.co/docs/transformers/v4.31.0/en/model_doc/clip#transformers.CLIPVisionModel" rel="nofollow">CLIPVisionModel</a> 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;
<a href="https://huggingface.co/docs/transformers/v4.31.0/en/model_doc/clip#transformers.CLIPImageProcessor" rel="nofollow">CLIPImageProcessor</a> 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 <a href="https://huggingface.co/docs/transformers/v4.31.0/en/model_doc/clip#transformers.CLIPTokenizer" rel="nofollow">CLIPTokenizer</a> 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 <a href="https://huggingface.co/docs/transformers/v4.31.0/en/model_doc/gpt2#transformers.GPT2Tokenizer" rel="nofollow">GPT2Tokenizer</a> 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.20.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.20.0/en/api/schedulers/multistep_dpm_solver#diffusers.DPMSolverMultistepScheduler">DPMSolverMultistepScheduler</a> scheduler.`,name:"scheduler"}],source:"https://github.com/huggingface/diffusers/blob/v0.20.0/src/diffusers/pipelines/unidiffuser/pipeline_unidiffuser.py#L82"}}),$e=new I({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.20.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.20.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.20.0/src/diffusers/pipelines/unidiffuser/pipeline_unidiffuser.py#L1028",returnDescription:`
<p>If <code>return_dict</code> is <code>True</code>, <a
  href="/docs/diffusers/v0.20.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.20.0/en/api/pipelines/unidiffuser#diffusers.ImageTextPipelineOutput"
>ImageTextPipelineOutput</a> or <code>tuple</code></p>
`}}),We=new I({props:{name:"enable_model_cpu_offload",anchor:"diffusers.UniDiffuserPipeline.enable_model_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/v0.20.0/src/diffusers/pipelines/unidiffuser/pipeline_unidiffuser.py#L167"}}),Pe=new I({props:{name:"reset_mode",anchor:"diffusers.UniDiffuserPipeline.reset_mode",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.20.0/src/diffusers/pipelines/unidiffuser/pipeline_unidiffuser.py#L292"}}),Xe=new I({props:{name:"set_image_mode",anchor:"diffusers.UniDiffuserPipeline.set_image_mode",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.20.0/src/diffusers/pipelines/unidiffuser/pipeline_unidiffuser.py#L276"}}),De=new I({props:{name:"set_image_to_text_mode",anchor:"diffusers.UniDiffuserPipeline.set_image_to_text_mode",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.20.0/src/diffusers/pipelines/unidiffuser/pipeline_unidiffuser.py#L284"}}),ke=new I({props:{name:"set_joint_mode",anchor:"diffusers.UniDiffuserPipeline.set_joint_mode",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.20.0/src/diffusers/pipelines/unidiffuser/pipeline_unidiffuser.py#L288"}}),Ve=new I({props:{name:"set_text_mode",anchor:"diffusers.UniDiffuserPipeline.set_text_mode",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.20.0/src/diffusers/pipelines/unidiffuser/pipeline_unidiffuser.py#L272"}}),Be=new I({props:{name:"set_text_to_image_mode",anchor:"diffusers.UniDiffuserPipeline.set_text_to_image_mode",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.20.0/src/diffusers/pipelines/unidiffuser/pipeline_unidiffuser.py#L280"}}),Ne=new N({}),Re=new I({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.20.0/src/diffusers/pipelines/unidiffuser/pipeline_unidiffuser.py#L65"}}),{c(){E=n("meta"),St=d(),j=n("h1"),R=n("a"),at=n("span"),u(de.$$.fragment),Hi=d(),ot=n("span"),qi=s("UniDiffuser"),Ct=d(),F=n("p"),Oi=s("The UniDiffuser model was proposed in "),me=n("a"),Ki=s("One Transformer Fits All Distributions in Multi-Modal Diffusion at Scale"),en=s(" by Fan Bao, Shen Nie, Kaiwen Xue, Chongxuan Li, Shi Pu, Yaole Wang, Gang Yue, Yue Cao, Hang Su, Jun Zhu."),Qt=d(),S=n("p"),tn=s("The abstract from the "),fe=n("a"),nn=s("paper"),an=s(" is:"),Yt=d(),Se=n("p"),st=n("em"),on=s("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)."),zt=d(),T=n("p"),sn=s("You can find the original codebase at "),ce=n("a"),rn=s("thu-ml/unidiffuser"),ln=s(" and additional checkpoints at "),ue=n("a"),pn=s("thu-ml"),dn=s("."),Lt=d(),C=n("p"),mn=s("This pipeline was contributed by "),he=n("a"),fn=s("dg845"),cn=s(". \u2764\uFE0F"),At=d(),G=n("h2"),Q=n("a"),rt=n("span"),u(ge.$$.fragment),un=d(),lt=n("span"),hn=s("Usage Examples"),Ht=d(),Ce=n("p"),gn=s("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:"),qt=d(),$=n("h3"),Y=n("a"),pt=n("span"),u(_e.$$.fragment),_n=d(),dt=n("span"),bn=s("Unconditional Image and Text Generation"),Ot=d(),z=n("p"),wn=s("Unconditional generation (where we start from only latents sampled from a standard Gaussian prior) from a "),Qe=n("a"),vn=s("UniDiffuserPipeline"),yn=s(" will produce a (image, text) pair:"),Kt=d(),u(be.$$.fragment),ei=d(),Ye=n("p"),Un=s("This is also called \u201Cjoint\u201D generation in the UniDiffusers paper, since we are sampling from the joint image-text distribution."),ti=d(),L=n("p"),xn=s(`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 `),ze=n("a"),Mn=s("UniDiffuserPipeline.set_joint_mode()"),Tn=s(":"),ii=d(),u(we.$$.fragment),ni=d(),A=n("p"),Zn=s(`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 `),Le=n("a"),Jn=s("UniDiffuserPipeline.reset_mode()"),In=s(", after which the pipeline will once again infer the mode."),ai=d(),Ae=n("p"),En=s("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):"),oi=d(),u(ve.$$.fragment),si=d(),W=n("h3"),H=n("a"),mt=n("span"),u(ye.$$.fragment),jn=d(),ft=n("span"),Gn=s("Text-to-Image Generation"),ri=d(),He=n("p"),$n=s(`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):`),li=d(),u(Ue.$$.fragment),pi=d(),y=n("p"),Wn=s("The "),ct=n("code"),Pn=s("text2img"),Xn=s(" mode requires that either an input "),ut=n("code"),Dn=s("prompt"),kn=s(" or "),ht=n("code"),Vn=s("prompt_embeds"),Bn=s(" be supplied. You can set the "),gt=n("code"),Nn=s("text2img"),Rn=s(" mode manually with "),qe=n("a"),Fn=s("UniDiffuserPipeline.set_text_to_image_mode()"),Sn=s("."),di=d(),P=n("h3"),q=n("a"),_t=n("span"),u(xe.$$.fragment),Cn=d(),bt=n("span"),Qn=s("Image-to-Text Generation"),mi=d(),Oe=n("p"),Yn=s("Similarly, UniDiffuser can also produce text samples given an image (image-to-text or image-conditioned text generation):"),fi=d(),u(Me.$$.fragment),ci=d(),U=n("p"),zn=s("The "),wt=n("code"),Ln=s("img2text"),An=s(" mode requires that an input "),vt=n("code"),Hn=s("image"),qn=s(" be supplied. You can set the "),yt=n("code"),On=s("img2text"),Kn=s(" mode manually with "),Ke=n("a"),ea=s("UniDiffuserPipeline.set_image_to_text_mode()"),ta=s("."),ui=d(),X=n("h3"),O=n("a"),Ut=n("span"),u(Te.$$.fragment),ia=d(),xt=n("span"),na=s("Image Variation"),hi=d(),et=n("p"),aa=s(`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:`),gi=d(),u(Ze.$$.fragment),_i=d(),D=n("h3"),K=n("a"),Mt=n("span"),u(Je.$$.fragment),oa=d(),Tt=n("span"),sa=s("Text Variation"),bi=d(),tt=n("p"),ra=s("Similarly, text variation can be performed on an input prompt with a text-to-image generation followed by a image-to-text generation:"),wi=d(),u(Ie.$$.fragment),vi=d(),k=n("h2"),ee=n("a"),Zt=n("span"),u(Ee.$$.fragment),la=d(),Jt=n("span"),pa=s("UniDiffuserPipeline"),yi=d(),c=n("div"),u(je.$$.fragment),da=d(),It=n("p"),ma=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.`),fa=d(),Ge=n("p"),ca=s("This model inherits from "),it=n("a"),ua=s("DiffusionPipeline"),ha=s(`. Check the superclass documentation for the generic methods
implemented for all pipelines (downloading, saving, running on a particular device, etc.).`),ga=d(),te=n("div"),u($e.$$.fragment),_a=d(),Et=n("p"),ba=s("The call function to the pipeline for generation."),wa=d(),ie=n("div"),u(We.$$.fragment),va=d(),x=n("p"),ya=s(`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),jt=n("code"),Ua=s("enable_sequential_cpu_offload"),xa=s(", this method moves one whole model at a time to the GPU when its "),Gt=n("code"),Ma=s("forward"),Ta=s(`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),$t=n("code"),Za=s("enable_sequential_cpu_offload"),Ja=s(", but performance is much better due to the iterative execution of the "),Wt=n("code"),Ia=s("unet"),Ea=s("."),ja=d(),ne=n("div"),u(Pe.$$.fragment),Ga=d(),Pt=n("p"),$a=s("Removes a manually set mode; after calling this, the pipeline will infer the mode from inputs."),Wa=d(),ae=n("div"),u(Xe.$$.fragment),Pa=d(),Xt=n("p"),Xa=s("Manually set the generation mode to unconditional (\u201Cmarginal\u201D) image generation."),Da=d(),oe=n("div"),u(De.$$.fragment),ka=d(),Dt=n("p"),Va=s("Manually set the generation mode to image-conditioned text generation."),Ba=d(),se=n("div"),u(ke.$$.fragment),Na=d(),kt=n("p"),Ra=s("Manually set the generation mode to unconditional joint image-text generation."),Fa=d(),re=n("div"),u(Ve.$$.fragment),Sa=d(),Vt=n("p"),Ca=s("Manually set the generation mode to unconditional (\u201Cmarginal\u201D) text generation."),Qa=d(),le=n("div"),u(Be.$$.fragment),Ya=d(),Bt=n("p"),za=s("Manually set the generation mode to text-conditioned image generation."),Ui=d(),V=n("h2"),pe=n("a"),Nt=n("span"),u(Ne.$$.fragment),La=d(),Rt=n("span"),Aa=s("ImageTextPipelineOutput"),xi=d(),B=n("div"),u(Re.$$.fragment),Ha=d(),Ft=n("p"),qa=s("Output class for joint image-text pipelines."),this.h()},l(e){const l=gs('[data-svelte="svelte-1phssyn"]',document.head);E=a(l,"META",{name:!0,content:!0}),l.forEach(i),St=m(e),j=a(e,"H1",{class:!0});var Ti=o(j);R=a(Ti,"A",{id:!0,class:!0,href:!0});var Ka=o(R);at=a(Ka,"SPAN",{});var eo=o(at);h(de.$$.fragment,eo),eo.forEach(i),Ka.forEach(i),Hi=m(Ti),ot=a(Ti,"SPAN",{});var to=o(ot);qi=r(to,"UniDiffuser"),to.forEach(i),Ti.forEach(i),Ct=m(e),F=a(e,"P",{});var Zi=o(F);Oi=r(Zi,"The UniDiffuser model was proposed in "),me=a(Zi,"A",{href:!0,rel:!0});var io=o(me);Ki=r(io,"One Transformer Fits All Distributions in Multi-Modal Diffusion at Scale"),io.forEach(i),en=r(Zi," by Fan Bao, Shen Nie, Kaiwen Xue, Chongxuan Li, Shi Pu, Yaole Wang, Gang Yue, Yue Cao, Hang Su, Jun Zhu."),Zi.forEach(i),Qt=m(e),S=a(e,"P",{});var Ji=o(S);tn=r(Ji,"The abstract from the "),fe=a(Ji,"A",{href:!0,rel:!0});var no=o(fe);nn=r(no,"paper"),no.forEach(i),an=r(Ji," is:"),Ji.forEach(i),Yt=m(e),Se=a(e,"P",{});var ao=o(Se);st=a(ao,"EM",{});var oo=o(st);on=r(oo,"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)."),oo.forEach(i),ao.forEach(i),zt=m(e),T=a(e,"P",{});var nt=o(T);sn=r(nt,"You can find the original codebase at "),ce=a(nt,"A",{href:!0,rel:!0});var so=o(ce);rn=r(so,"thu-ml/unidiffuser"),so.forEach(i),ln=r(nt," and additional checkpoints at "),ue=a(nt,"A",{href:!0,rel:!0});var ro=o(ue);pn=r(ro,"thu-ml"),ro.forEach(i),dn=r(nt,"."),nt.forEach(i),Lt=m(e),C=a(e,"P",{});var Ii=o(C);mn=r(Ii,"This pipeline was contributed by "),he=a(Ii,"A",{href:!0,rel:!0});var lo=o(he);fn=r(lo,"dg845"),lo.forEach(i),cn=r(Ii,". \u2764\uFE0F"),Ii.forEach(i),At=m(e),G=a(e,"H2",{class:!0});var Ei=o(G);Q=a(Ei,"A",{id:!0,class:!0,href:!0});var po=o(Q);rt=a(po,"SPAN",{});var mo=o(rt);h(ge.$$.fragment,mo),mo.forEach(i),po.forEach(i),un=m(Ei),lt=a(Ei,"SPAN",{});var fo=o(lt);hn=r(fo,"Usage Examples"),fo.forEach(i),Ei.forEach(i),Ht=m(e),Ce=a(e,"P",{});var co=o(Ce);gn=r(co,"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:"),co.forEach(i),qt=m(e),$=a(e,"H3",{class:!0});var ji=o($);Y=a(ji,"A",{id:!0,class:!0,href:!0});var uo=o(Y);pt=a(uo,"SPAN",{});var ho=o(pt);h(_e.$$.fragment,ho),ho.forEach(i),uo.forEach(i),_n=m(ji),dt=a(ji,"SPAN",{});var go=o(dt);bn=r(go,"Unconditional Image and Text Generation"),go.forEach(i),ji.forEach(i),Ot=m(e),z=a(e,"P",{});var Gi=o(z);wn=r(Gi,"Unconditional generation (where we start from only latents sampled from a standard Gaussian prior) from a "),Qe=a(Gi,"A",{href:!0});var _o=o(Qe);vn=r(_o,"UniDiffuserPipeline"),_o.forEach(i),yn=r(Gi," will produce a (image, text) pair:"),Gi.forEach(i),Kt=m(e),h(be.$$.fragment,e),ei=m(e),Ye=a(e,"P",{});var bo=o(Ye);Un=r(bo,"This is also called \u201Cjoint\u201D generation in the UniDiffusers paper, since we are sampling from the joint image-text distribution."),bo.forEach(i),ti=m(e),L=a(e,"P",{});var $i=o(L);xn=r($i,`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 `),ze=a($i,"A",{href:!0});var wo=o(ze);Mn=r(wo,"UniDiffuserPipeline.set_joint_mode()"),wo.forEach(i),Tn=r($i,":"),$i.forEach(i),ii=m(e),h(we.$$.fragment,e),ni=m(e),A=a(e,"P",{});var Wi=o(A);Zn=r(Wi,`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 `),Le=a(Wi,"A",{href:!0});var vo=o(Le);Jn=r(vo,"UniDiffuserPipeline.reset_mode()"),vo.forEach(i),In=r(Wi,", after which the pipeline will once again infer the mode."),Wi.forEach(i),ai=m(e),Ae=a(e,"P",{});var yo=o(Ae);En=r(yo,"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):"),yo.forEach(i),oi=m(e),h(ve.$$.fragment,e),si=m(e),W=a(e,"H3",{class:!0});var Pi=o(W);H=a(Pi,"A",{id:!0,class:!0,href:!0});var Uo=o(H);mt=a(Uo,"SPAN",{});var xo=o(mt);h(ye.$$.fragment,xo),xo.forEach(i),Uo.forEach(i),jn=m(Pi),ft=a(Pi,"SPAN",{});var Mo=o(ft);Gn=r(Mo,"Text-to-Image Generation"),Mo.forEach(i),Pi.forEach(i),ri=m(e),He=a(e,"P",{});var To=o(He);$n=r(To,`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):`),To.forEach(i),li=m(e),h(Ue.$$.fragment,e),pi=m(e),y=a(e,"P",{});var M=o(y);Wn=r(M,"The "),ct=a(M,"CODE",{});var Zo=o(ct);Pn=r(Zo,"text2img"),Zo.forEach(i),Xn=r(M," mode requires that either an input "),ut=a(M,"CODE",{});var Jo=o(ut);Dn=r(Jo,"prompt"),Jo.forEach(i),kn=r(M," or "),ht=a(M,"CODE",{});var Io=o(ht);Vn=r(Io,"prompt_embeds"),Io.forEach(i),Bn=r(M," be supplied. You can set the "),gt=a(M,"CODE",{});var Eo=o(gt);Nn=r(Eo,"text2img"),Eo.forEach(i),Rn=r(M," mode manually with "),qe=a(M,"A",{href:!0});var jo=o(qe);Fn=r(jo,"UniDiffuserPipeline.set_text_to_image_mode()"),jo.forEach(i),Sn=r(M,"."),M.forEach(i),di=m(e),P=a(e,"H3",{class:!0});var Xi=o(P);q=a(Xi,"A",{id:!0,class:!0,href:!0});var Go=o(q);_t=a(Go,"SPAN",{});var $o=o(_t);h(xe.$$.fragment,$o),$o.forEach(i),Go.forEach(i),Cn=m(Xi),bt=a(Xi,"SPAN",{});var Wo=o(bt);Qn=r(Wo,"Image-to-Text Generation"),Wo.forEach(i),Xi.forEach(i),mi=m(e),Oe=a(e,"P",{});var Po=o(Oe);Yn=r(Po,"Similarly, UniDiffuser can also produce text samples given an image (image-to-text or image-conditioned text generation):"),Po.forEach(i),fi=m(e),h(Me.$$.fragment,e),ci=m(e),U=a(e,"P",{});var Z=o(U);zn=r(Z,"The "),wt=a(Z,"CODE",{});var Xo=o(wt);Ln=r(Xo,"img2text"),Xo.forEach(i),An=r(Z," mode requires that an input "),vt=a(Z,"CODE",{});var Do=o(vt);Hn=r(Do,"image"),Do.forEach(i),qn=r(Z," be supplied. You can set the "),yt=a(Z,"CODE",{});var ko=o(yt);On=r(ko,"img2text"),ko.forEach(i),Kn=r(Z," mode manually with "),Ke=a(Z,"A",{href:!0});var Vo=o(Ke);ea=r(Vo,"UniDiffuserPipeline.set_image_to_text_mode()"),Vo.forEach(i),ta=r(Z,"."),Z.forEach(i),ui=m(e),X=a(e,"H3",{class:!0});var Di=o(X);O=a(Di,"A",{id:!0,class:!0,href:!0});var Bo=o(O);Ut=a(Bo,"SPAN",{});var No=o(Ut);h(Te.$$.fragment,No),No.forEach(i),Bo.forEach(i),ia=m(Di),xt=a(Di,"SPAN",{});var Ro=o(xt);na=r(Ro,"Image Variation"),Ro.forEach(i),Di.forEach(i),hi=m(e),et=a(e,"P",{});var Fo=o(et);aa=r(Fo,`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:`),Fo.forEach(i),gi=m(e),h(Ze.$$.fragment,e),_i=m(e),D=a(e,"H3",{class:!0});var ki=o(D);K=a(ki,"A",{id:!0,class:!0,href:!0});var So=o(K);Mt=a(So,"SPAN",{});var Co=o(Mt);h(Je.$$.fragment,Co),Co.forEach(i),So.forEach(i),oa=m(ki),Tt=a(ki,"SPAN",{});var Qo=o(Tt);sa=r(Qo,"Text Variation"),Qo.forEach(i),ki.forEach(i),bi=m(e),tt=a(e,"P",{});var Yo=o(tt);ra=r(Yo,"Similarly, text variation can be performed on an input prompt with a text-to-image generation followed by a image-to-text generation:"),Yo.forEach(i),wi=m(e),h(Ie.$$.fragment,e),vi=m(e),k=a(e,"H2",{class:!0});var Vi=o(k);ee=a(Vi,"A",{id:!0,class:!0,href:!0});var zo=o(ee);Zt=a(zo,"SPAN",{});var Lo=o(Zt);h(Ee.$$.fragment,Lo),Lo.forEach(i),zo.forEach(i),la=m(Vi),Jt=a(Vi,"SPAN",{});var Ao=o(Jt);pa=r(Ao,"UniDiffuserPipeline"),Ao.forEach(i),Vi.forEach(i),yi=m(e),c=a(e,"DIV",{class:!0});var v=o(c);h(je.$$.fragment,v),da=m(v),It=a(v,"P",{});var Ho=o(It);ma=r(Ho,`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.`),Ho.forEach(i),fa=m(v),Ge=a(v,"P",{});var Bi=o(Ge);ca=r(Bi,"This model inherits from "),it=a(Bi,"A",{href:!0});var qo=o(it);ua=r(qo,"DiffusionPipeline"),qo.forEach(i),ha=r(Bi,`. Check the superclass documentation for the generic methods
implemented for all pipelines (downloading, saving, running on a particular device, etc.).`),Bi.forEach(i),ga=m(v),te=a(v,"DIV",{class:!0});var Ni=o(te);h($e.$$.fragment,Ni),_a=m(Ni),Et=a(Ni,"P",{});var Oo=o(Et);ba=r(Oo,"The call function to the pipeline for generation."),Oo.forEach(i),Ni.forEach(i),wa=m(v),ie=a(v,"DIV",{class:!0});var Ri=o(ie);h(We.$$.fragment,Ri),va=m(Ri),x=a(Ri,"P",{});var J=o(x);ya=r(J,`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),jt=a(J,"CODE",{});var Ko=o(jt);Ua=r(Ko,"enable_sequential_cpu_offload"),Ko.forEach(i),xa=r(J,", this method moves one whole model at a time to the GPU when its "),Gt=a(J,"CODE",{});var es=o(Gt);Ma=r(es,"forward"),es.forEach(i),Ta=r(J,`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),$t=a(J,"CODE",{});var ts=o($t);Za=r(ts,"enable_sequential_cpu_offload"),ts.forEach(i),Ja=r(J,", but performance is much better due to the iterative execution of the "),Wt=a(J,"CODE",{});var is=o(Wt);Ia=r(is,"unet"),is.forEach(i),Ea=r(J,"."),J.forEach(i),Ri.forEach(i),ja=m(v),ne=a(v,"DIV",{class:!0});var Fi=o(ne);h(Pe.$$.fragment,Fi),Ga=m(Fi),Pt=a(Fi,"P",{});var ns=o(Pt);$a=r(ns,"Removes a manually set mode; after calling this, the pipeline will infer the mode from inputs."),ns.forEach(i),Fi.forEach(i),Wa=m(v),ae=a(v,"DIV",{class:!0});var Si=o(ae);h(Xe.$$.fragment,Si),Pa=m(Si),Xt=a(Si,"P",{});var as=o(Xt);Xa=r(as,"Manually set the generation mode to unconditional (\u201Cmarginal\u201D) image generation."),as.forEach(i),Si.forEach(i),Da=m(v),oe=a(v,"DIV",{class:!0});var Ci=o(oe);h(De.$$.fragment,Ci),ka=m(Ci),Dt=a(Ci,"P",{});var os=o(Dt);Va=r(os,"Manually set the generation mode to image-conditioned text generation."),os.forEach(i),Ci.forEach(i),Ba=m(v),se=a(v,"DIV",{class:!0});var Qi=o(se);h(ke.$$.fragment,Qi),Na=m(Qi),kt=a(Qi,"P",{});var ss=o(kt);Ra=r(ss,"Manually set the generation mode to unconditional joint image-text generation."),ss.forEach(i),Qi.forEach(i),Fa=m(v),re=a(v,"DIV",{class:!0});var Yi=o(re);h(Ve.$$.fragment,Yi),Sa=m(Yi),Vt=a(Yi,"P",{});var rs=o(Vt);Ca=r(rs,"Manually set the generation mode to unconditional (\u201Cmarginal\u201D) text generation."),rs.forEach(i),Yi.forEach(i),Qa=m(v),le=a(v,"DIV",{class:!0});var zi=o(le);h(Be.$$.fragment,zi),Ya=m(zi),Bt=a(zi,"P",{});var ls=o(Bt);za=r(ls,"Manually set the generation mode to text-conditioned image generation."),ls.forEach(i),zi.forEach(i),v.forEach(i),Ui=m(e),V=a(e,"H2",{class:!0});var Li=o(V);pe=a(Li,"A",{id:!0,class:!0,href:!0});var ps=o(pe);Nt=a(ps,"SPAN",{});var ds=o(Nt);h(Ne.$$.fragment,ds),ds.forEach(i),ps.forEach(i),La=m(Li),Rt=a(Li,"SPAN",{});var ms=o(Rt);Aa=r(ms,"ImageTextPipelineOutput"),ms.forEach(i),Li.forEach(i),xi=m(e),B=a(e,"DIV",{class:!0});var Ai=o(B);h(Re.$$.fragment,Ai),Ha=m(Ai),Ft=a(Ai,"P",{});var fs=o(Ft);qa=r(fs,"Output class for joint image-text pipelines."),fs.forEach(i),Ai.forEach(i),this.h()},h(){p(E,"name","hf:doc:metadata"),p(E,"content",JSON.stringify(vs)),p(R,"id","unidiffuser"),p(R,"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"),p(R,"href","#unidiffuser"),p(j,"class","relative group"),p(me,"href","https://huggingface.co/papers/2303.06555"),p(me,"rel","nofollow"),p(fe,"href","https://arxiv.org/abs/2303.06555"),p(fe,"rel","nofollow"),p(ce,"href","https://github.com/thu-ml/unidiffuser"),p(ce,"rel","nofollow"),p(ue,"href","https://huggingface.co/thu-ml"),p(ue,"rel","nofollow"),p(he,"href","https://github.com/dg845"),p(he,"rel","nofollow"),p(Q,"id","usage-examples"),p(Q,"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"),p(Q,"href","#usage-examples"),p(G,"class","relative group"),p(Y,"id","unconditional-image-and-text-generation"),p(Y,"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"),p(Y,"href","#unconditional-image-and-text-generation"),p($,"class","relative group"),p(Qe,"href","/docs/diffusers/v0.20.0/en/api/pipelines/unidiffuser#diffusers.UniDiffuserPipeline"),p(ze,"href","/docs/diffusers/v0.20.0/en/api/pipelines/unidiffuser#diffusers.UniDiffuserPipeline.set_joint_mode"),p(Le,"href","/docs/diffusers/v0.20.0/en/api/pipelines/unidiffuser#diffusers.UniDiffuserPipeline.reset_mode"),p(H,"id","texttoimage-generation"),p(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"),p(H,"href","#texttoimage-generation"),p(W,"class","relative group"),p(qe,"href","/docs/diffusers/v0.20.0/en/api/pipelines/unidiffuser#diffusers.UniDiffuserPipeline.set_text_to_image_mode"),p(q,"id","imagetotext-generation"),p(q,"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"),p(q,"href","#imagetotext-generation"),p(P,"class","relative group"),p(Ke,"href","/docs/diffusers/v0.20.0/en/api/pipelines/unidiffuser#diffusers.UniDiffuserPipeline.set_image_to_text_mode"),p(O,"id","image-variation"),p(O,"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"),p(O,"href","#image-variation"),p(X,"class","relative group"),p(K,"id","text-variation"),p(K,"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"),p(K,"href","#text-variation"),p(D,"class","relative group"),p(ee,"id","diffusers.UniDiffuserPipeline"),p(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"),p(ee,"href","#diffusers.UniDiffuserPipeline"),p(k,"class","relative group"),p(it,"href","/docs/diffusers/v0.20.0/en/api/pipelines/overview#diffusers.DiffusionPipeline"),p(te,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(ie,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(ne,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(ae,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(oe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(se,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(re,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(le,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(c,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(pe,"id","diffusers.ImageTextPipelineOutput"),p(pe,"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"),p(pe,"href","#diffusers.ImageTextPipelineOutput"),p(V,"class","relative group"),p(B,"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,l){t(document.head,E),f(e,St,l),f(e,j,l),t(j,R),t(R,at),g(de,at,null),t(j,Hi),t(j,ot),t(ot,qi),f(e,Ct,l),f(e,F,l),t(F,Oi),t(F,me),t(me,Ki),t(F,en),f(e,Qt,l),f(e,S,l),t(S,tn),t(S,fe),t(fe,nn),t(S,an),f(e,Yt,l),f(e,Se,l),t(Se,st),t(st,on),f(e,zt,l),f(e,T,l),t(T,sn),t(T,ce),t(ce,rn),t(T,ln),t(T,ue),t(ue,pn),t(T,dn),f(e,Lt,l),f(e,C,l),t(C,mn),t(C,he),t(he,fn),t(C,cn),f(e,At,l),f(e,G,l),t(G,Q),t(Q,rt),g(ge,rt,null),t(G,un),t(G,lt),t(lt,hn),f(e,Ht,l),f(e,Ce,l),t(Ce,gn),f(e,qt,l),f(e,$,l),t($,Y),t(Y,pt),g(_e,pt,null),t($,_n),t($,dt),t(dt,bn),f(e,Ot,l),f(e,z,l),t(z,wn),t(z,Qe),t(Qe,vn),t(z,yn),f(e,Kt,l),g(be,e,l),f(e,ei,l),f(e,Ye,l),t(Ye,Un),f(e,ti,l),f(e,L,l),t(L,xn),t(L,ze),t(ze,Mn),t(L,Tn),f(e,ii,l),g(we,e,l),f(e,ni,l),f(e,A,l),t(A,Zn),t(A,Le),t(Le,Jn),t(A,In),f(e,ai,l),f(e,Ae,l),t(Ae,En),f(e,oi,l),g(ve,e,l),f(e,si,l),f(e,W,l),t(W,H),t(H,mt),g(ye,mt,null),t(W,jn),t(W,ft),t(ft,Gn),f(e,ri,l),f(e,He,l),t(He,$n),f(e,li,l),g(Ue,e,l),f(e,pi,l),f(e,y,l),t(y,Wn),t(y,ct),t(ct,Pn),t(y,Xn),t(y,ut),t(ut,Dn),t(y,kn),t(y,ht),t(ht,Vn),t(y,Bn),t(y,gt),t(gt,Nn),t(y,Rn),t(y,qe),t(qe,Fn),t(y,Sn),f(e,di,l),f(e,P,l),t(P,q),t(q,_t),g(xe,_t,null),t(P,Cn),t(P,bt),t(bt,Qn),f(e,mi,l),f(e,Oe,l),t(Oe,Yn),f(e,fi,l),g(Me,e,l),f(e,ci,l),f(e,U,l),t(U,zn),t(U,wt),t(wt,Ln),t(U,An),t(U,vt),t(vt,Hn),t(U,qn),t(U,yt),t(yt,On),t(U,Kn),t(U,Ke),t(Ke,ea),t(U,ta),f(e,ui,l),f(e,X,l),t(X,O),t(O,Ut),g(Te,Ut,null),t(X,ia),t(X,xt),t(xt,na),f(e,hi,l),f(e,et,l),t(et,aa),f(e,gi,l),g(Ze,e,l),f(e,_i,l),f(e,D,l),t(D,K),t(K,Mt),g(Je,Mt,null),t(D,oa),t(D,Tt),t(Tt,sa),f(e,bi,l),f(e,tt,l),t(tt,ra),f(e,wi,l),g(Ie,e,l),f(e,vi,l),f(e,k,l),t(k,ee),t(ee,Zt),g(Ee,Zt,null),t(k,la),t(k,Jt),t(Jt,pa),f(e,yi,l),f(e,c,l),g(je,c,null),t(c,da),t(c,It),t(It,ma),t(c,fa),t(c,Ge),t(Ge,ca),t(Ge,it),t(it,ua),t(Ge,ha),t(c,ga),t(c,te),g($e,te,null),t(te,_a),t(te,Et),t(Et,ba),t(c,wa),t(c,ie),g(We,ie,null),t(ie,va),t(ie,x),t(x,ya),t(x,jt),t(jt,Ua),t(x,xa),t(x,Gt),t(Gt,Ma),t(x,Ta),t(x,$t),t($t,Za),t(x,Ja),t(x,Wt),t(Wt,Ia),t(x,Ea),t(c,ja),t(c,ne),g(Pe,ne,null),t(ne,Ga),t(ne,Pt),t(Pt,$a),t(c,Wa),t(c,ae),g(Xe,ae,null),t(ae,Pa),t(ae,Xt),t(Xt,Xa),t(c,Da),t(c,oe),g(De,oe,null),t(oe,ka),t(oe,Dt),t(Dt,Va),t(c,Ba),t(c,se),g(ke,se,null),t(se,Na),t(se,kt),t(kt,Ra),t(c,Fa),t(c,re),g(Ve,re,null),t(re,Sa),t(re,Vt),t(Vt,Ca),t(c,Qa),t(c,le),g(Be,le,null),t(le,Ya),t(le,Bt),t(Bt,za),f(e,Ui,l),f(e,V,l),t(V,pe),t(pe,Nt),g(Ne,Nt,null),t(V,La),t(V,Rt),t(Rt,Aa),f(e,xi,l),f(e,B,l),g(Re,B,null),t(B,Ha),t(B,Ft),t(Ft,qa),Mi=!0},p:_s,i(e){Mi||(_(de.$$.fragment,e),_(ge.$$.fragment,e),_(_e.$$.fragment,e),_(be.$$.fragment,e),_(we.$$.fragment,e),_(ve.$$.fragment,e),_(ye.$$.fragment,e),_(Ue.$$.fragment,e),_(xe.$$.fragment,e),_(Me.$$.fragment,e),_(Te.$$.fragment,e),_(Ze.$$.fragment,e),_(Je.$$.fragment,e),_(Ie.$$.fragment,e),_(Ee.$$.fragment,e),_(je.$$.fragment,e),_($e.$$.fragment,e),_(We.$$.fragment,e),_(Pe.$$.fragment,e),_(Xe.$$.fragment,e),_(De.$$.fragment,e),_(ke.$$.fragment,e),_(Ve.$$.fragment,e),_(Be.$$.fragment,e),_(Ne.$$.fragment,e),_(Re.$$.fragment,e),Mi=!0)},o(e){b(de.$$.fragment,e),b(ge.$$.fragment,e),b(_e.$$.fragment,e),b(be.$$.fragment,e),b(we.$$.fragment,e),b(ve.$$.fragment,e),b(ye.$$.fragment,e),b(Ue.$$.fragment,e),b(xe.$$.fragment,e),b(Me.$$.fragment,e),b(Te.$$.fragment,e),b(Ze.$$.fragment,e),b(Je.$$.fragment,e),b(Ie.$$.fragment,e),b(Ee.$$.fragment,e),b(je.$$.fragment,e),b($e.$$.fragment,e),b(We.$$.fragment,e),b(Pe.$$.fragment,e),b(Xe.$$.fragment,e),b(De.$$.fragment,e),b(ke.$$.fragment,e),b(Ve.$$.fragment,e),b(Be.$$.fragment,e),b(Ne.$$.fragment,e),b(Re.$$.fragment,e),Mi=!1},d(e){i(E),e&&i(St),e&&i(j),w(de),e&&i(Ct),e&&i(F),e&&i(Qt),e&&i(S),e&&i(Yt),e&&i(Se),e&&i(zt),e&&i(T),e&&i(Lt),e&&i(C),e&&i(At),e&&i(G),w(ge),e&&i(Ht),e&&i(Ce),e&&i(qt),e&&i($),w(_e),e&&i(Ot),e&&i(z),e&&i(Kt),w(be,e),e&&i(ei),e&&i(Ye),e&&i(ti),e&&i(L),e&&i(ii),w(we,e),e&&i(ni),e&&i(A),e&&i(ai),e&&i(Ae),e&&i(oi),w(ve,e),e&&i(si),e&&i(W),w(ye),e&&i(ri),e&&i(He),e&&i(li),w(Ue,e),e&&i(pi),e&&i(y),e&&i(di),e&&i(P),w(xe),e&&i(mi),e&&i(Oe),e&&i(fi),w(Me,e),e&&i(ci),e&&i(U),e&&i(ui),e&&i(X),w(Te),e&&i(hi),e&&i(et),e&&i(gi),w(Ze,e),e&&i(_i),e&&i(D),w(Je),e&&i(bi),e&&i(tt),e&&i(wi),w(Ie,e),e&&i(vi),e&&i(k),w(Ee),e&&i(yi),e&&i(c),w(je),w($e),w(We),w(Pe),w(Xe),w(De),w(ke),w(Ve),w(Be),e&&i(Ui),e&&i(V),w(Ne),e&&i(xi),e&&i(B),w(Re)}}}const vs={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 ys(Oa){return bs(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Zs extends cs{constructor(E){super();us(this,E,ys,ws,hs,{})}}export{Zs as default,vs as metadata};
