Buckets:

hf-doc-build/doc / diffusers /v0.18.2 /en /_app /pages /api /pipelines /versatile_diffusion.mdx-hf-doc-builder.js
rtrm's picture
download
raw
112 kB
import{S as Fo,i as Xo,s as Ro,e as n,k as c,w as b,t as r,M as qo,c as s,d as a,m as p,a as i,x as y,h as l,b as d,G as e,g as m,y as w,q as M,o as D,B as T,v as Lo,L as Ut}from"../../../chunks/vendor-hf-doc-builder.js";import{D as J}from"../../../chunks/Docstring-hf-doc-builder.js";import{C as at}from"../../../chunks/CodeBlock-hf-doc-builder.js";import{I as ye}from"../../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Zt}from"../../../chunks/ExampleCodeBlock-hf-doc-builder.js";function zo(k){let g,V,_,u,v;return u=new at({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFZlcnNhdGlsZURpZmZ1c2lvblBpcGVsaW5lJTBBaW1wb3J0JTIwdG9yY2glMEFpbXBvcnQlMjByZXF1ZXN0cyUwQWZyb20lMjBpbyUyMGltcG9ydCUyMEJ5dGVzSU8lMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEElMEElMjMlMjBsZXQncyUyMGRvd25sb2FkJTIwYW4lMjBpbml0aWFsJTIwaW1hZ2UlMEF1cmwlMjAlM0QlMjAlMjJodHRwcyUzQSUyRiUyRmh1Z2dpbmdmYWNlLmNvJTJGZGF0YXNldHMlMkZkaWZmdXNlcnMlMkZpbWFnZXMlMkZyZXNvbHZlJTJGbWFpbiUyRmJlbnouanBnJTIyJTBBJTBBcmVzcG9uc2UlMjAlM0QlMjByZXF1ZXN0cy5nZXQodXJsKSUwQWltYWdlJTIwJTNEJTIwSW1hZ2Uub3BlbihCeXRlc0lPKHJlc3BvbnNlLmNvbnRlbnQpKS5jb252ZXJ0KCUyMlJHQiUyMiklMEF0ZXh0JTIwJTNEJTIwJTIyYSUyMHJlZCUyMGNhciUyMGluJTIwdGhlJTIwc3VuJTIyJTBBJTBBcGlwZSUyMCUzRCUyMFZlcnNhdGlsZURpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJzaGktbGFicyUyRnZlcnNhdGlsZS1kaWZmdXNpb24lMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMEEpJTBBcGlwZSUyMCUzRCUyMHBpcGUudG8oJTIyY3VkYSUyMiklMEElMEFnZW5lcmF0b3IlMjAlM0QlMjB0b3JjaC5HZW5lcmF0b3IoZGV2aWNlJTNEJTIyY3VkYSUyMikubWFudWFsX3NlZWQoMCklMEF0ZXh0X3RvX2ltYWdlX3N0cmVuZ3RoJTIwJTNEJTIwMC43NSUwQSUwQWltYWdlJTIwJTNEJTIwcGlwZS5kdWFsX2d1aWRlZCglMEElMjAlMjAlMjAlMjBwcm9tcHQlM0R0ZXh0JTJDJTIwaW1hZ2UlM0RpbWFnZSUyQyUyMHRleHRfdG9faW1hZ2Vfc3RyZW5ndGglM0R0ZXh0X3RvX2ltYWdlX3N0cmVuZ3RoJTJDJTIwZ2VuZXJhdG9yJTNEZ2VuZXJhdG9yJTBBKS5pbWFnZXMlNUIwJTVEJTBBaW1hZ2Uuc2F2ZSglMjIuJTJGY2FyX3ZhcmlhdGlvbi5wbmclMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> VersatileDiffusionPipeline
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> io <span class="hljs-keyword">import</span> BytesIO
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># let&#x27;s download an initial image</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;https://huggingface.co/datasets/diffusers/images/resolve/main/benz.jpg&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>response = requests.get(url)
<span class="hljs-meta">&gt;&gt;&gt; </span>image = Image.<span class="hljs-built_in">open</span>(BytesIO(response.content)).convert(<span class="hljs-string">&quot;RGB&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>text = <span class="hljs-string">&quot;a red car in the sun&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = VersatileDiffusionPipeline.from_pretrained(
<span class="hljs-meta">... </span> <span class="hljs-string">&quot;shi-labs/versatile-diffusion&quot;</span>, torch_dtype=torch.float16
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>generator = torch.Generator(device=<span class="hljs-string">&quot;cuda&quot;</span>).manual_seed(<span class="hljs-number">0</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>text_to_image_strength = <span class="hljs-number">0.75</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = pipe.dual_guided(
<span class="hljs-meta">... </span> prompt=text, image=image, text_to_image_strength=text_to_image_strength, generator=generator
<span class="hljs-meta">... </span>).images[<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>image.save(<span class="hljs-string">&quot;./car_variation.png&quot;</span>)`}}),{c(){g=n("p"),V=r("Examples:"),_=c(),b(u.$$.fragment)},l(o){g=s(o,"P",{});var h=i(g);V=l(h,"Examples:"),h.forEach(a),_=p(o),y(u.$$.fragment,o)},m(o,h){m(o,g,h),e(g,V),m(o,_,h),w(u,o,h),v=!0},p:Ut,i(o){v||(M(u.$$.fragment,o),v=!0)},o(o){D(u.$$.fragment,o),v=!1},d(o){o&&a(g),o&&a(_),T(u,o)}}}function Qo(k){let g,V,_,u,v;return u=new at({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFZlcnNhdGlsZURpZmZ1c2lvblBpcGVsaW5lJTBBaW1wb3J0JTIwdG9yY2glMEFpbXBvcnQlMjByZXF1ZXN0cyUwQWZyb20lMjBpbyUyMGltcG9ydCUyMEJ5dGVzSU8lMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEElMEElMjMlMjBsZXQncyUyMGRvd25sb2FkJTIwYW4lMjBpbml0aWFsJTIwaW1hZ2UlMEF1cmwlMjAlM0QlMjAlMjJodHRwcyUzQSUyRiUyRmh1Z2dpbmdmYWNlLmNvJTJGZGF0YXNldHMlMkZkaWZmdXNlcnMlMkZpbWFnZXMlMkZyZXNvbHZlJTJGbWFpbiUyRmJlbnouanBnJTIyJTBBJTBBcmVzcG9uc2UlMjAlM0QlMjByZXF1ZXN0cy5nZXQodXJsKSUwQWltYWdlJTIwJTNEJTIwSW1hZ2Uub3BlbihCeXRlc0lPKHJlc3BvbnNlLmNvbnRlbnQpKS5jb252ZXJ0KCUyMlJHQiUyMiklMEElMEFwaXBlJTIwJTNEJTIwVmVyc2F0aWxlRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMnNoaS1sYWJzJTJGdmVyc2F0aWxlLWRpZmZ1c2lvbiUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUwQSklMEFwaXBlJTIwJTNEJTIwcGlwZS50byglMjJjdWRhJTIyKSUwQSUwQWdlbmVyYXRvciUyMCUzRCUyMHRvcmNoLkdlbmVyYXRvcihkZXZpY2UlM0QlMjJjdWRhJTIyKS5tYW51YWxfc2VlZCgwKSUwQWltYWdlJTIwJTNEJTIwcGlwZS5pbWFnZV92YXJpYXRpb24oaW1hZ2UlMkMlMjBnZW5lcmF0b3IlM0RnZW5lcmF0b3IpLmltYWdlcyU1QjAlNUQlMEFpbWFnZS5zYXZlKCUyMi4lMkZjYXJfdmFyaWF0aW9uLnBuZyUyMik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> VersatileDiffusionPipeline
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> io <span class="hljs-keyword">import</span> BytesIO
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># let&#x27;s download an initial image</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;https://huggingface.co/datasets/diffusers/images/resolve/main/benz.jpg&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>response = requests.get(url)
<span class="hljs-meta">&gt;&gt;&gt; </span>image = Image.<span class="hljs-built_in">open</span>(BytesIO(response.content)).convert(<span class="hljs-string">&quot;RGB&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = VersatileDiffusionPipeline.from_pretrained(
<span class="hljs-meta">... </span> <span class="hljs-string">&quot;shi-labs/versatile-diffusion&quot;</span>, torch_dtype=torch.float16
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>generator = torch.Generator(device=<span class="hljs-string">&quot;cuda&quot;</span>).manual_seed(<span class="hljs-number">0</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>image = pipe.image_variation(image, generator=generator).images[<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>image.save(<span class="hljs-string">&quot;./car_variation.png&quot;</span>)`}}),{c(){g=n("p"),V=r("Examples:"),_=c(),b(u.$$.fragment)},l(o){g=s(o,"P",{});var h=i(g);V=l(h,"Examples:"),h.forEach(a),_=p(o),y(u.$$.fragment,o)},m(o,h){m(o,g,h),e(g,V),m(o,_,h),w(u,o,h),v=!0},p:Ut,i(o){v||(M(u.$$.fragment,o),v=!0)},o(o){D(u.$$.fragment,o),v=!1},d(o){o&&a(g),o&&a(_),T(u,o)}}}function Ao(k){let g,V,_,u,v;return u=new at({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFZlcnNhdGlsZURpZmZ1c2lvblBpcGVsaW5lJTBBaW1wb3J0JTIwdG9yY2glMEElMEFwaXBlJTIwJTNEJTIwVmVyc2F0aWxlRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMnNoaS1sYWJzJTJGdmVyc2F0aWxlLWRpZmZ1c2lvbiUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUwQSklMEFwaXBlJTIwJTNEJTIwcGlwZS50byglMjJjdWRhJTIyKSUwQSUwQWdlbmVyYXRvciUyMCUzRCUyMHRvcmNoLkdlbmVyYXRvcihkZXZpY2UlM0QlMjJjdWRhJTIyKS5tYW51YWxfc2VlZCgwKSUwQWltYWdlJTIwJTNEJTIwcGlwZS50ZXh0X3RvX2ltYWdlKCUyMmFuJTIwYXN0cm9uYXV0JTIwcmlkaW5nJTIwb24lMjBhJTIwaG9yc2UlMjBvbiUyMG1hcnMlMjIlMkMlMjBnZW5lcmF0b3IlM0RnZW5lcmF0b3IpLmltYWdlcyU1QjAlNUQlMEFpbWFnZS5zYXZlKCUyMi4lMkZhc3Ryb25hdXQucG5nJTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> VersatileDiffusionPipeline
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = VersatileDiffusionPipeline.from_pretrained(
<span class="hljs-meta">... </span> <span class="hljs-string">&quot;shi-labs/versatile-diffusion&quot;</span>, torch_dtype=torch.float16
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>generator = torch.Generator(device=<span class="hljs-string">&quot;cuda&quot;</span>).manual_seed(<span class="hljs-number">0</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>image = pipe.text_to_image(<span class="hljs-string">&quot;an astronaut riding on a horse on mars&quot;</span>, generator=generator).images[<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>image.save(<span class="hljs-string">&quot;./astronaut.png&quot;</span>)`}}),{c(){g=n("p"),V=r("Examples:"),_=c(),b(u.$$.fragment)},l(o){g=s(o,"P",{});var h=i(g);V=l(h,"Examples:"),h.forEach(a),_=p(o),y(u.$$.fragment,o)},m(o,h){m(o,g,h),e(g,V),m(o,_,h),w(u,o,h),v=!0},p:Ut,i(o){v||(M(u.$$.fragment,o),v=!0)},o(o){D(u.$$.fragment,o),v=!1},d(o){o&&a(g),o&&a(_),T(u,o)}}}function Yo(k){let g,V,_,u,v;return u=new at({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFZlcnNhdGlsZURpZmZ1c2lvblRleHRUb0ltYWdlUGlwZWxpbmUlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXBpcGUlMjAlM0QlMjBWZXJzYXRpbGVEaWZmdXNpb25UZXh0VG9JbWFnZVBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJzaGktbGFicyUyRnZlcnNhdGlsZS1kaWZmdXNpb24lMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMEEpJTBBcGlwZS5yZW1vdmVfdW51c2VkX3dlaWdodHMoKSUwQXBpcGUlMjAlM0QlMjBwaXBlLnRvKCUyMmN1ZGElMjIpJTBBJTBBZ2VuZXJhdG9yJTIwJTNEJTIwdG9yY2guR2VuZXJhdG9yKGRldmljZSUzRCUyMmN1ZGElMjIpLm1hbnVhbF9zZWVkKDApJTBBaW1hZ2UlMjAlM0QlMjBwaXBlKCUyMmFuJTIwYXN0cm9uYXV0JTIwcmlkaW5nJTIwb24lMjBhJTIwaG9yc2UlMjBvbiUyMG1hcnMlMjIlMkMlMjBnZW5lcmF0b3IlM0RnZW5lcmF0b3IpLmltYWdlcyU1QjAlNUQlMEFpbWFnZS5zYXZlKCUyMi4lMkZhc3Ryb25hdXQucG5nJTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> VersatileDiffusionTextToImagePipeline
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = VersatileDiffusionTextToImagePipeline.from_pretrained(
<span class="hljs-meta">... </span> <span class="hljs-string">&quot;shi-labs/versatile-diffusion&quot;</span>, torch_dtype=torch.float16
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe.remove_unused_weights()
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>generator = torch.Generator(device=<span class="hljs-string">&quot;cuda&quot;</span>).manual_seed(<span class="hljs-number">0</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>image = pipe(<span class="hljs-string">&quot;an astronaut riding on a horse on mars&quot;</span>, generator=generator).images[<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>image.save(<span class="hljs-string">&quot;./astronaut.png&quot;</span>)`}}),{c(){g=n("p"),V=r("Examples:"),_=c(),b(u.$$.fragment)},l(o){g=s(o,"P",{});var h=i(g);V=l(h,"Examples:"),h.forEach(a),_=p(o),y(u.$$.fragment,o)},m(o,h){m(o,g,h),e(g,V),m(o,_,h),w(u,o,h),v=!0},p:Ut,i(o){v||(M(u.$$.fragment,o),v=!0)},o(o){D(u.$$.fragment,o),v=!1},d(o){o&&a(g),o&&a(_),T(u,o)}}}function Oo(k){let g,V,_,u,v;return u=new at({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFZlcnNhdGlsZURpZmZ1c2lvbkltYWdlVmFyaWF0aW9uUGlwZWxpbmUlMEFpbXBvcnQlMjB0b3JjaCUwQWltcG9ydCUyMHJlcXVlc3RzJTBBZnJvbSUyMGlvJTIwaW1wb3J0JTIwQnl0ZXNJTyUwQWZyb20lMjBQSUwlMjBpbXBvcnQlMjBJbWFnZSUwQSUwQSUyMyUyMGxldCdzJTIwZG93bmxvYWQlMjBhbiUyMGluaXRpYWwlMjBpbWFnZSUwQXVybCUyMCUzRCUyMCUyMmh0dHBzJTNBJTJGJTJGaHVnZ2luZ2ZhY2UuY28lMkZkYXRhc2V0cyUyRmRpZmZ1c2VycyUyRmltYWdlcyUyRnJlc29sdmUlMkZtYWluJTJGYmVuei5qcGclMjIlMEElMEFyZXNwb25zZSUyMCUzRCUyMHJlcXVlc3RzLmdldCh1cmwpJTBBaW1hZ2UlMjAlM0QlMjBJbWFnZS5vcGVuKEJ5dGVzSU8ocmVzcG9uc2UuY29udGVudCkpLmNvbnZlcnQoJTIyUkdCJTIyKSUwQSUwQXBpcGUlMjAlM0QlMjBWZXJzYXRpbGVEaWZmdXNpb25JbWFnZVZhcmlhdGlvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJzaGktbGFicyUyRnZlcnNhdGlsZS1kaWZmdXNpb24lMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMEEpJTBBcGlwZSUyMCUzRCUyMHBpcGUudG8oJTIyY3VkYSUyMiklMEElMEFnZW5lcmF0b3IlMjAlM0QlMjB0b3JjaC5HZW5lcmF0b3IoZGV2aWNlJTNEJTIyY3VkYSUyMikubWFudWFsX3NlZWQoMCklMEFpbWFnZSUyMCUzRCUyMHBpcGUoaW1hZ2UlMkMlMjBnZW5lcmF0b3IlM0RnZW5lcmF0b3IpLmltYWdlcyU1QjAlNUQlMEFpbWFnZS5zYXZlKCUyMi4lMkZjYXJfdmFyaWF0aW9uLnBuZyUyMik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> VersatileDiffusionImageVariationPipeline
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> io <span class="hljs-keyword">import</span> BytesIO
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># let&#x27;s download an initial image</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;https://huggingface.co/datasets/diffusers/images/resolve/main/benz.jpg&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>response = requests.get(url)
<span class="hljs-meta">&gt;&gt;&gt; </span>image = Image.<span class="hljs-built_in">open</span>(BytesIO(response.content)).convert(<span class="hljs-string">&quot;RGB&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = VersatileDiffusionImageVariationPipeline.from_pretrained(
<span class="hljs-meta">... </span> <span class="hljs-string">&quot;shi-labs/versatile-diffusion&quot;</span>, torch_dtype=torch.float16
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>generator = torch.Generator(device=<span class="hljs-string">&quot;cuda&quot;</span>).manual_seed(<span class="hljs-number">0</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>image = pipe(image, generator=generator).images[<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>image.save(<span class="hljs-string">&quot;./car_variation.png&quot;</span>)`}}),{c(){g=n("p"),V=r("Examples:"),_=c(),b(u.$$.fragment)},l(o){g=s(o,"P",{});var h=i(g);V=l(h,"Examples:"),h.forEach(a),_=p(o),y(u.$$.fragment,o)},m(o,h){m(o,g,h),e(g,V),m(o,_,h),w(u,o,h),v=!0},p:Ut,i(o){v||(M(u.$$.fragment,o),v=!0)},o(o){D(u.$$.fragment,o),v=!1},d(o){o&&a(g),o&&a(_),T(u,o)}}}function Ho(k){let g,V,_,u,v;return u=new at({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFZlcnNhdGlsZURpZmZ1c2lvbkR1YWxHdWlkZWRQaXBlbGluZSUwQWltcG9ydCUyMHRvcmNoJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwaW8lMjBpbXBvcnQlMjBCeXRlc0lPJTBBZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBJTBBJTIzJTIwbGV0J3MlMjBkb3dubG9hZCUyMGFuJTIwaW5pdGlhbCUyMGltYWdlJTBBdXJsJTIwJTNEJTIwJTIyaHR0cHMlM0ElMkYlMkZodWdnaW5nZmFjZS5jbyUyRmRhdGFzZXRzJTJGZGlmZnVzZXJzJTJGaW1hZ2VzJTJGcmVzb2x2ZSUyRm1haW4lMkZiZW56LmpwZyUyMiUwQSUwQXJlc3BvbnNlJTIwJTNEJTIwcmVxdWVzdHMuZ2V0KHVybCklMEFpbWFnZSUyMCUzRCUyMEltYWdlLm9wZW4oQnl0ZXNJTyhyZXNwb25zZS5jb250ZW50KSkuY29udmVydCglMjJSR0IlMjIpJTBBdGV4dCUyMCUzRCUyMCUyMmElMjByZWQlMjBjYXIlMjBpbiUyMHRoZSUyMHN1biUyMiUwQSUwQXBpcGUlMjAlM0QlMjBWZXJzYXRpbGVEaWZmdXNpb25EdWFsR3VpZGVkUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMnNoaS1sYWJzJTJGdmVyc2F0aWxlLWRpZmZ1c2lvbiUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUwQSklMEFwaXBlLnJlbW92ZV91bnVzZWRfd2VpZ2h0cygpJTBBcGlwZSUyMCUzRCUyMHBpcGUudG8oJTIyY3VkYSUyMiklMEElMEFnZW5lcmF0b3IlMjAlM0QlMjB0b3JjaC5HZW5lcmF0b3IoZGV2aWNlJTNEJTIyY3VkYSUyMikubWFudWFsX3NlZWQoMCklMEF0ZXh0X3RvX2ltYWdlX3N0cmVuZ3RoJTIwJTNEJTIwMC43NSUwQSUwQWltYWdlJTIwJTNEJTIwcGlwZSglMEElMjAlMjAlMjAlMjBwcm9tcHQlM0R0ZXh0JTJDJTIwaW1hZ2UlM0RpbWFnZSUyQyUyMHRleHRfdG9faW1hZ2Vfc3RyZW5ndGglM0R0ZXh0X3RvX2ltYWdlX3N0cmVuZ3RoJTJDJTIwZ2VuZXJhdG9yJTNEZ2VuZXJhdG9yJTBBKS5pbWFnZXMlNUIwJTVEJTBBaW1hZ2Uuc2F2ZSglMjIuJTJGY2FyX3ZhcmlhdGlvbi5wbmclMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> VersatileDiffusionDualGuidedPipeline
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> io <span class="hljs-keyword">import</span> BytesIO
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># let&#x27;s download an initial image</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;https://huggingface.co/datasets/diffusers/images/resolve/main/benz.jpg&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>response = requests.get(url)
<span class="hljs-meta">&gt;&gt;&gt; </span>image = Image.<span class="hljs-built_in">open</span>(BytesIO(response.content)).convert(<span class="hljs-string">&quot;RGB&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>text = <span class="hljs-string">&quot;a red car in the sun&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = VersatileDiffusionDualGuidedPipeline.from_pretrained(
<span class="hljs-meta">... </span> <span class="hljs-string">&quot;shi-labs/versatile-diffusion&quot;</span>, torch_dtype=torch.float16
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe.remove_unused_weights()
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>generator = torch.Generator(device=<span class="hljs-string">&quot;cuda&quot;</span>).manual_seed(<span class="hljs-number">0</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>text_to_image_strength = <span class="hljs-number">0.75</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = pipe(
<span class="hljs-meta">... </span> prompt=text, image=image, text_to_image_strength=text_to_image_strength, generator=generator
<span class="hljs-meta">... </span>).images[<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>image.save(<span class="hljs-string">&quot;./car_variation.png&quot;</span>)`}}),{c(){g=n("p"),V=r("Examples:"),_=c(),b(u.$$.fragment)},l(o){g=s(o,"P",{});var h=i(g);V=l(h,"Examples:"),h.forEach(a),_=p(o),y(u.$$.fragment,o)},m(o,h){m(o,g,h),e(g,V),m(o,_,h),w(u,o,h),v=!0},p:Ut,i(o){v||(M(u.$$.fragment,o),v=!0)},o(o){D(u.$$.fragment,o),v=!1},d(o){o&&a(g),o&&a(_),T(u,o)}}}function Ko(k){let g,V,_,u,v,o,h,$t,fn,ba,O,un,we,mn,gn,ya,nt,hn,wa,st,Jt,_n,Ma,X,H,Gt,Me,vn,Et,bn,Da,it,De,yn,ot,wn,Mn,Ta,R,K,St,Te,Dn,Wt,Tn,Va,j,Vn,rt,xn,In,lt,Pn,kn,dt,jn,Zn,ct,Un,xa,pt,Nt,$n,Ia,ft,Jn,Pa,E,Ve,Ct,Gn,En,ee,Sn,Bt,Wn,Nn,Cn,xe,Ft,Bn,Fn,te,Xn,Xt,Rn,qn,Ln,Ie,Rt,zn,Qn,ae,An,qt,Yn,On,ka,q,ne,Lt,Pe,Hn,zt,Kn,ja,x,es,ut,ts,as,Qt,ns,ss,mt,is,os,gt,rs,ls,ht,ds,cs,_t,ps,fs,vt,us,ms,At,gs,hs,Yt,_s,vs,bt,bs,ys,Za,ke,Ua,L,se,Ot,je,ws,Ht,Ms,$a,P,Ze,Ds,Kt,Ts,Vs,Ue,xs,yt,Is,Ps,ks,S,$e,js,ea,Zs,Us,ie,$s,W,Je,Js,ta,Gs,Es,oe,Ss,N,Ge,Ws,aa,Ns,Cs,re,Ja,z,le,na,Ee,Bs,sa,Fs,Ga,Z,Se,Xs,We,Rs,wt,qs,Ls,zs,C,Ne,Qs,ia,As,Ys,de,Os,ce,Ce,Hs,Be,Ks,oa,ei,ti,Ea,Q,pe,ra,Fe,ai,la,ni,Sa,U,Xe,si,Re,ii,Mt,oi,ri,li,B,qe,di,da,ci,pi,fe,fi,ue,Le,ui,ze,mi,ca,gi,hi,Wa,A,me,pa,Qe,_i,fa,vi,Na,$,Ae,bi,Ye,yi,Dt,wi,Mi,Di,F,Oe,Ti,ua,Vi,xi,ge,Ii,he,He,Pi,Ke,ki,ma,ji,Zi,Ca;return o=new ye({}),Me=new ye({}),Te=new ye({}),Pe=new ye({}),ke=new at({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFZlcnNhdGlsZURpZmZ1c2lvblBpcGVsaW5lJTJDJTIwRXVsZXJEaXNjcmV0ZVNjaGVkdWxlciUwQSUwQXBpcGVsaW5lJTIwJTNEJTIwVmVyc2F0aWxlRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUyMnNoaS1sYWJzJTJGdmVyc2F0aWxlLWRpZmZ1c2lvbiUyMiklMEFwaXBlbGluZS5zY2hlZHVsZXIlMjAlM0QlMjBFdWxlckRpc2NyZXRlU2NoZWR1bGVyLmZyb21fY29uZmlnKHBpcGVsaW5lLnNjaGVkdWxlci5jb25maWcpJTBBJTBBJTIzJTIwb3IlMEFldWxlcl9zY2hlZHVsZXIlMjAlM0QlMjBFdWxlckRpc2NyZXRlU2NoZWR1bGVyLmZyb21fcHJldHJhaW5lZCglMjJzaGktbGFicyUyRnZlcnNhdGlsZS1kaWZmdXNpb24lMjIlMkMlMjBzdWJmb2xkZXIlM0QlMjJzY2hlZHVsZXIlMjIpJTBBcGlwZWxpbmUlMjAlM0QlMjBWZXJzYXRpbGVEaWZmdXNpb25QaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTIyc2hpLWxhYnMlMkZ2ZXJzYXRpbGUtZGlmZnVzaW9uJTIyJTJDJTIwc2NoZWR1bGVyJTNEZXVsZXJfc2NoZWR1bGVyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> VersatileDiffusionPipeline, EulerDiscreteScheduler
<span class="hljs-meta">&gt;&gt;&gt; </span>pipeline = VersatileDiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;shi-labs/versatile-diffusion&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipeline.scheduler = EulerDiscreteScheduler.from_config(pipeline.scheduler.config)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># or</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>euler_scheduler = EulerDiscreteScheduler.from_pretrained(<span class="hljs-string">&quot;shi-labs/versatile-diffusion&quot;</span>, subfolder=<span class="hljs-string">&quot;scheduler&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipeline = VersatileDiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;shi-labs/versatile-diffusion&quot;</span>, scheduler=euler_scheduler)`}}),je=new ye({}),Ze=new J({props:{name:"class diffusers.VersatileDiffusionPipeline",anchor:"diffusers.VersatileDiffusionPipeline",parameters:[{name:"tokenizer",val:": CLIPTokenizer"},{name:"image_feature_extractor",val:": CLIPImageProcessor"},{name:"text_encoder",val:": CLIPTextModel"},{name:"image_encoder",val:": CLIPVisionModel"},{name:"image_unet",val:": UNet2DConditionModel"},{name:"text_unet",val:": UNet2DConditionModel"},{name:"vae",val:": AutoencoderKL"},{name:"scheduler",val:": KarrasDiffusionSchedulers"}],parametersDescription:[{anchor:"diffusers.VersatileDiffusionPipeline.vae",description:`<strong>vae</strong> (<a href="/docs/diffusers/v0.18.2/en/api/models/autoencoderkl#diffusers.AutoencoderKL">AutoencoderKL</a>) &#x2014;
Variational Auto-Encoder (VAE) Model to encode and decode images to and from latent representations.`,name:"vae"},{anchor:"diffusers.VersatileDiffusionPipeline.text_encoder",description:`<strong>text_encoder</strong> (<code>CLIPTextModel</code>) &#x2014;
Frozen text-encoder. Stable Diffusion uses the text portion of
<a href="https://huggingface.co/docs/transformers/model_doc/clip#transformers.CLIPTextModel" rel="nofollow">CLIP</a>, specifically
the <a href="https://huggingface.co/openai/clip-vit-large-patch14" rel="nofollow">clip-vit-large-patch14</a> variant.`,name:"text_encoder"},{anchor:"diffusers.VersatileDiffusionPipeline.tokenizer",description:`<strong>tokenizer</strong> (<code>CLIPTokenizer</code>) &#x2014;
Tokenizer of class
<a href="https://huggingface.co/docs/transformers/v4.21.0/en/model_doc/clip#transformers.CLIPTokenizer" rel="nofollow">CLIPTokenizer</a>.`,name:"tokenizer"},{anchor:"diffusers.VersatileDiffusionPipeline.unet",description:'<strong>unet</strong> (<a href="/docs/diffusers/v0.18.2/en/api/models/unet2d-cond#diffusers.UNet2DConditionModel">UNet2DConditionModel</a>) &#x2014; Conditional U-Net architecture to denoise the encoded image latents.',name:"unet"},{anchor:"diffusers.VersatileDiffusionPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/v0.18.2/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 latents. Can be one of
<a href="/docs/diffusers/v0.18.2/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>, <a href="/docs/diffusers/v0.18.2/en/api/schedulers/lms_discrete#diffusers.LMSDiscreteScheduler">LMSDiscreteScheduler</a>, or <a href="/docs/diffusers/v0.18.2/en/api/schedulers/pndm#diffusers.PNDMScheduler">PNDMScheduler</a>.`,name:"scheduler"},{anchor:"diffusers.VersatileDiffusionPipeline.safety_checker",description:`<strong>safety_checker</strong> (<code>StableDiffusionMegaSafetyChecker</code>) &#x2014;
Classification module that estimates whether generated images could be considered offensive or harmful.
Please, refer to the <a href="https://huggingface.co/runwayml/stable-diffusion-v1-5" rel="nofollow">model card</a> for details.`,name:"safety_checker"},{anchor:"diffusers.VersatileDiffusionPipeline.feature_extractor",description:`<strong>feature_extractor</strong> (<code>CLIPImageProcessor</code>) &#x2014;
Model that extracts features from generated images to be used as inputs for the <code>safety_checker</code>.`,name:"feature_extractor"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.2/src/diffusers/pipelines/versatile_diffusion/pipeline_versatile_diffusion.py#L20"}}),$e=new J({props:{name:"dual_guided",anchor:"diffusers.VersatileDiffusionPipeline.dual_guided",parameters:[{name:"prompt",val:": typing.Union[PIL.Image.Image, typing.List[PIL.Image.Image]]"},{name:"image",val:": typing.Union[str, typing.List[str]]"},{name:"text_to_image_strength",val:": float = 0.5"},{name:"height",val:": typing.Optional[int] = None"},{name:"width",val:": typing.Optional[int] = None"},{name:"num_inference_steps",val:": int = 50"},{name:"guidance_scale",val:": float = 7.5"},{name:"num_images_per_prompt",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:"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.VersatileDiffusionPipeline.dual_guided.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>) &#x2014;
The prompt or prompts to guide the image generation.`,name:"prompt"},{anchor:"diffusers.VersatileDiffusionPipeline.dual_guided.height",description:`<strong>height</strong> (<code>int</code>, <em>optional</em>, defaults to self.image_unet.config.sample_size * self.vae_scale_factor) &#x2014;
The height in pixels of the generated image.`,name:"height"},{anchor:"diffusers.VersatileDiffusionPipeline.dual_guided.width",description:`<strong>width</strong> (<code>int</code>, <em>optional</em>, defaults to self.image_unet.config.sample_size * self.vae_scale_factor) &#x2014;
The width in pixels of the generated image.`,name:"width"},{anchor:"diffusers.VersatileDiffusionPipeline.dual_guided.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.VersatileDiffusionPipeline.dual_guided.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 7.5) &#x2014;
Guidance scale as defined in <a href="https://arxiv.org/abs/2207.12598" rel="nofollow">Classifier-Free Diffusion Guidance</a>.
<code>guidance_scale</code> is defined as <code>w</code> of equation 2. of <a href="https://arxiv.org/pdf/2205.11487.pdf" rel="nofollow">Imagen
Paper</a>. Guidance scale is enabled by setting <code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to the text <code>prompt</code>,
usually at the expense of lower image quality.`,name:"guidance_scale"},{anchor:"diffusers.VersatileDiffusionPipeline.dual_guided.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts not to guide the image generation. Ignored when not using guidance (i.e., ignored
if <code>guidance_scale</code> is less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.VersatileDiffusionPipeline.dual_guided.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.`,name:"num_images_per_prompt"},{anchor:"diffusers.VersatileDiffusionPipeline.dual_guided.eta",description:`<strong>eta</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
Corresponds to parameter eta (&#x3B7;) in the DDIM paper: <a href="https://arxiv.org/abs/2010.02502" rel="nofollow">https://arxiv.org/abs/2010.02502</a>. Only applies to
<a href="/docs/diffusers/v0.18.2/en/api/schedulers/ddim#diffusers.DDIMScheduler">schedulers.DDIMScheduler</a>, will be ignored for others.`,name:"eta"},{anchor:"diffusers.VersatileDiffusionPipeline.dual_guided.generator",description:`<strong>generator</strong> (<code>torch.Generator</code>, <em>optional</em>) &#x2014;
One or a list of <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow">torch generator(s)</a>
to make generation deterministic.`,name:"generator"},{anchor:"diffusers.VersatileDiffusionPipeline.dual_guided.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 image
generation. Can be used to tweak the same generation with different prompts. If not provided, a latents
tensor will ge generated by sampling using the supplied random <code>generator</code>.`,name:"latents"},{anchor:"diffusers.VersatileDiffusionPipeline.dual_guided.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 generate image. Choose between
<a href="https://pillow.readthedocs.io/en/stable/" rel="nofollow">PIL</a>: <code>PIL.Image.Image</code> or <code>np.array</code>.`,name:"output_type"},{anchor:"diffusers.VersatileDiffusionPipeline.dual_guided.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.18.2/en/api/pipelines/stable_diffusion/overview#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput">StableDiffusionPipelineOutput</a> instead of a
plain tuple.`,name:"return_dict"},{anchor:"diffusers.VersatileDiffusionPipeline.dual_guided.callback",description:`<strong>callback</strong> (<code>Callable</code>, <em>optional</em>) &#x2014;
A function that will be called every <code>callback_steps</code> steps during inference. The function will be
called with the following arguments: <code>callback(step: int, timestep: int, latents: torch.FloatTensor)</code>.`,name:"callback"},{anchor:"diffusers.VersatileDiffusionPipeline.dual_guided.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 will be called. If not specified, the callback will be
called at every step.`,name:"callback_steps"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.2/src/diffusers/pipelines/versatile_diffusion/pipeline_versatile_diffusion.py#L310",returnDescription:`
<p><code>~pipelines.stable_diffusion.ImagePipelineOutput</code> if <code>return_dict</code> is True, otherwise a \`tuple. When
returning a tuple, the first element is a list with the generated images.</p>
`,returnType:`
<p><code>~pipelines.stable_diffusion.ImagePipelineOutput</code> or <code>tuple</code></p>
`}}),ie=new Zt({props:{anchor:"diffusers.VersatileDiffusionPipeline.dual_guided.example",$$slots:{default:[zo]},$$scope:{ctx:k}}}),Je=new J({props:{name:"image_variation",anchor:"diffusers.VersatileDiffusionPipeline.image_variation",parameters:[{name:"image",val:": typing.Union[torch.FloatTensor, PIL.Image.Image]"},{name:"height",val:": typing.Optional[int] = None"},{name:"width",val:": typing.Optional[int] = None"},{name:"num_inference_steps",val:": int = 50"},{name:"guidance_scale",val:": float = 7.5"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"num_images_per_prompt",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:"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.VersatileDiffusionPipeline.image_variation.image",description:`<strong>image</strong> (<code>PIL.Image.Image</code>, <code>List[PIL.Image.Image]</code> or <code>torch.Tensor</code>) &#x2014;
The image prompt or prompts to guide the image generation.`,name:"image"},{anchor:"diffusers.VersatileDiffusionPipeline.image_variation.height",description:`<strong>height</strong> (<code>int</code>, <em>optional</em>, defaults to self.image_unet.config.sample_size * self.vae_scale_factor) &#x2014;
The height in pixels of the generated image.`,name:"height"},{anchor:"diffusers.VersatileDiffusionPipeline.image_variation.width",description:`<strong>width</strong> (<code>int</code>, <em>optional</em>, defaults to self.image_unet.config.sample_size * self.vae_scale_factor) &#x2014;
The width in pixels of the generated image.`,name:"width"},{anchor:"diffusers.VersatileDiffusionPipeline.image_variation.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.VersatileDiffusionPipeline.image_variation.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 7.5) &#x2014;
Guidance scale as defined in <a href="https://arxiv.org/abs/2207.12598" rel="nofollow">Classifier-Free Diffusion Guidance</a>.
<code>guidance_scale</code> is defined as <code>w</code> of equation 2. of <a href="https://arxiv.org/pdf/2205.11487.pdf" rel="nofollow">Imagen
Paper</a>. Guidance scale is enabled by setting <code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to the text <code>prompt</code>,
usually at the expense of lower image quality.`,name:"guidance_scale"},{anchor:"diffusers.VersatileDiffusionPipeline.image_variation.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts not to guide the image generation. Ignored when not using guidance (i.e., ignored
if <code>guidance_scale</code> is less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.VersatileDiffusionPipeline.image_variation.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.`,name:"num_images_per_prompt"},{anchor:"diffusers.VersatileDiffusionPipeline.image_variation.eta",description:`<strong>eta</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
Corresponds to parameter eta (&#x3B7;) in the DDIM paper: <a href="https://arxiv.org/abs/2010.02502" rel="nofollow">https://arxiv.org/abs/2010.02502</a>. Only applies to
<a href="/docs/diffusers/v0.18.2/en/api/schedulers/ddim#diffusers.DDIMScheduler">schedulers.DDIMScheduler</a>, will be ignored for others.`,name:"eta"},{anchor:"diffusers.VersatileDiffusionPipeline.image_variation.generator",description:`<strong>generator</strong> (<code>torch.Generator</code>, <em>optional</em>) &#x2014;
One or a list of <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow">torch generator(s)</a>
to make generation deterministic.`,name:"generator"},{anchor:"diffusers.VersatileDiffusionPipeline.image_variation.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 image
generation. Can be used to tweak the same generation with different prompts. If not provided, a latents
tensor will ge generated by sampling using the supplied random <code>generator</code>.`,name:"latents"},{anchor:"diffusers.VersatileDiffusionPipeline.image_variation.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 generate image. Choose between
<a href="https://pillow.readthedocs.io/en/stable/" rel="nofollow">PIL</a>: <code>PIL.Image.Image</code> or <code>np.array</code>.`,name:"output_type"},{anchor:"diffusers.VersatileDiffusionPipeline.image_variation.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.18.2/en/api/pipelines/stable_diffusion/overview#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput">StableDiffusionPipelineOutput</a> instead of a
plain tuple.`,name:"return_dict"},{anchor:"diffusers.VersatileDiffusionPipeline.image_variation.callback",description:`<strong>callback</strong> (<code>Callable</code>, <em>optional</em>) &#x2014;
A function that will be called every <code>callback_steps</code> steps during inference. The function will be
called with the following arguments: <code>callback(step: int, timestep: int, latents: torch.FloatTensor)</code>.`,name:"callback"},{anchor:"diffusers.VersatileDiffusionPipeline.image_variation.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 will be called. If not specified, the callback will be
called at every step.`,name:"callback_steps"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.2/src/diffusers/pipelines/versatile_diffusion/pipeline_versatile_diffusion.py#L82",returnDescription:`
<p><a
href="/docs/diffusers/v0.18.2/en/api/pipelines/stable_diffusion/overview#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput"
>StableDiffusionPipelineOutput</a> if <code>return_dict</code> is True, otherwise a <code>tuple. When returning a tuple, the first element is a list with the generated images, and the second element is a list of </code>bool<code>s denoting whether the corresponding generated image likely represents "not-safe-for-work" (nsfw) content, according to the </code>safety_checker\`.</p>
`,returnType:`
<p><a
href="/docs/diffusers/v0.18.2/en/api/pipelines/stable_diffusion/overview#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput"
>StableDiffusionPipelineOutput</a> or <code>tuple</code></p>
`}}),oe=new Zt({props:{anchor:"diffusers.VersatileDiffusionPipeline.image_variation.example",$$slots:{default:[Qo]},$$scope:{ctx:k}}}),Ge=new J({props:{name:"text_to_image",anchor:"diffusers.VersatileDiffusionPipeline.text_to_image",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str]]"},{name:"height",val:": typing.Optional[int] = None"},{name:"width",val:": typing.Optional[int] = None"},{name:"num_inference_steps",val:": int = 50"},{name:"guidance_scale",val:": float = 7.5"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"num_images_per_prompt",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:"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.VersatileDiffusionPipeline.text_to_image.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>) &#x2014;
The prompt or prompts to guide the image generation.`,name:"prompt"},{anchor:"diffusers.VersatileDiffusionPipeline.text_to_image.height",description:`<strong>height</strong> (<code>int</code>, <em>optional</em>, defaults to self.image_unet.config.sample_size * self.vae_scale_factor) &#x2014;
The height in pixels of the generated image.`,name:"height"},{anchor:"diffusers.VersatileDiffusionPipeline.text_to_image.width",description:`<strong>width</strong> (<code>int</code>, <em>optional</em>, defaults to self.image_unet.config.sample_size * self.vae_scale_factor) &#x2014;
The width in pixels of the generated image.`,name:"width"},{anchor:"diffusers.VersatileDiffusionPipeline.text_to_image.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.VersatileDiffusionPipeline.text_to_image.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 7.5) &#x2014;
Guidance scale as defined in <a href="https://arxiv.org/abs/2207.12598" rel="nofollow">Classifier-Free Diffusion Guidance</a>.
<code>guidance_scale</code> is defined as <code>w</code> of equation 2. of <a href="https://arxiv.org/pdf/2205.11487.pdf" rel="nofollow">Imagen
Paper</a>. Guidance scale is enabled by setting <code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to the text <code>prompt</code>,
usually at the expense of lower image quality.`,name:"guidance_scale"},{anchor:"diffusers.VersatileDiffusionPipeline.text_to_image.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts not to guide the image generation. Ignored when not using guidance (i.e., ignored
if <code>guidance_scale</code> is less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.VersatileDiffusionPipeline.text_to_image.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.`,name:"num_images_per_prompt"},{anchor:"diffusers.VersatileDiffusionPipeline.text_to_image.eta",description:`<strong>eta</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
Corresponds to parameter eta (&#x3B7;) in the DDIM paper: <a href="https://arxiv.org/abs/2010.02502" rel="nofollow">https://arxiv.org/abs/2010.02502</a>. Only applies to
<a href="/docs/diffusers/v0.18.2/en/api/schedulers/ddim#diffusers.DDIMScheduler">schedulers.DDIMScheduler</a>, will be ignored for others.`,name:"eta"},{anchor:"diffusers.VersatileDiffusionPipeline.text_to_image.generator",description:`<strong>generator</strong> (<code>torch.Generator</code>, <em>optional</em>) &#x2014;
One or a list of <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow">torch generator(s)</a>
to make generation deterministic.`,name:"generator"},{anchor:"diffusers.VersatileDiffusionPipeline.text_to_image.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 image
generation. Can be used to tweak the same generation with different prompts. If not provided, a latents
tensor will ge generated by sampling using the supplied random <code>generator</code>.`,name:"latents"},{anchor:"diffusers.VersatileDiffusionPipeline.text_to_image.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 generate image. Choose between
<a href="https://pillow.readthedocs.io/en/stable/" rel="nofollow">PIL</a>: <code>PIL.Image.Image</code> or <code>np.array</code>.`,name:"output_type"},{anchor:"diffusers.VersatileDiffusionPipeline.text_to_image.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.18.2/en/api/pipelines/stable_diffusion/overview#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput">StableDiffusionPipelineOutput</a> instead of a
plain tuple.`,name:"return_dict"},{anchor:"diffusers.VersatileDiffusionPipeline.text_to_image.callback",description:`<strong>callback</strong> (<code>Callable</code>, <em>optional</em>) &#x2014;
A function that will be called every <code>callback_steps</code> steps during inference. The function will be
called with the following arguments: <code>callback(step: int, timestep: int, latents: torch.FloatTensor)</code>.`,name:"callback"},{anchor:"diffusers.VersatileDiffusionPipeline.text_to_image.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 will be called. If not specified, the callback will be
called at every step.`,name:"callback_steps"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.2/src/diffusers/pipelines/versatile_diffusion/pipeline_versatile_diffusion.py#L198",returnDescription:`
<p><a
href="/docs/diffusers/v0.18.2/en/api/pipelines/stable_diffusion/overview#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput"
>StableDiffusionPipelineOutput</a> if <code>return_dict</code> is True, otherwise a <code>tuple. When returning a tuple, the first element is a list with the generated images, and the second element is a list of </code>bool<code>s denoting whether the corresponding generated image likely represents "not-safe-for-work" (nsfw) content, according to the </code>safety_checker\`.</p>
`,returnType:`
<p><a
href="/docs/diffusers/v0.18.2/en/api/pipelines/stable_diffusion/overview#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput"
>StableDiffusionPipelineOutput</a> or <code>tuple</code></p>
`}}),re=new Zt({props:{anchor:"diffusers.VersatileDiffusionPipeline.text_to_image.example",$$slots:{default:[Ao]},$$scope:{ctx:k}}}),Ee=new ye({}),Se=new J({props:{name:"class diffusers.VersatileDiffusionTextToImagePipeline",anchor:"diffusers.VersatileDiffusionTextToImagePipeline",parameters:[{name:"tokenizer",val:": CLIPTokenizer"},{name:"text_encoder",val:": CLIPTextModelWithProjection"},{name:"image_unet",val:": UNet2DConditionModel"},{name:"text_unet",val:": UNetFlatConditionModel"},{name:"vae",val:": AutoencoderKL"},{name:"scheduler",val:": KarrasDiffusionSchedulers"}],parametersDescription:[{anchor:"diffusers.VersatileDiffusionTextToImagePipeline.vqvae",description:`<strong>vqvae</strong> (<a href="/docs/diffusers/v0.18.2/en/api/models/vq#diffusers.VQModel">VQModel</a>) &#x2014;
Vector-quantized (VQ) Model to encode and decode images to and from latent representations.`,name:"vqvae"},{anchor:"diffusers.VersatileDiffusionTextToImagePipeline.bert",description:`<strong>bert</strong> (<code>LDMBertModel</code>) &#x2014;
Text-encoder model based on <a href="https://huggingface.co/docs/transformers/model_doc/bert" rel="nofollow">BERT</a> architecture.`,name:"bert"},{anchor:"diffusers.VersatileDiffusionTextToImagePipeline.tokenizer",description:`<strong>tokenizer</strong> (<code>transformers.BertTokenizer</code>) &#x2014;
Tokenizer of class
<a href="https://huggingface.co/docs/transformers/model_doc/bert#transformers.BertTokenizer" rel="nofollow">BertTokenizer</a>.`,name:"tokenizer"},{anchor:"diffusers.VersatileDiffusionTextToImagePipeline.unet",description:'<strong>unet</strong> (<a href="/docs/diffusers/v0.18.2/en/api/models/unet2d-cond#diffusers.UNet2DConditionModel">UNet2DConditionModel</a>) &#x2014; Conditional U-Net architecture to denoise the encoded image latents.',name:"unet"},{anchor:"diffusers.VersatileDiffusionTextToImagePipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/v0.18.2/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 latents. Can be one of
<a href="/docs/diffusers/v0.18.2/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>, <a href="/docs/diffusers/v0.18.2/en/api/schedulers/lms_discrete#diffusers.LMSDiscreteScheduler">LMSDiscreteScheduler</a>, or <a href="/docs/diffusers/v0.18.2/en/api/schedulers/pndm#diffusers.PNDMScheduler">PNDMScheduler</a>.`,name:"scheduler"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.2/src/diffusers/pipelines/versatile_diffusion/pipeline_versatile_diffusion_text_to_image.py#L34"}}),Ne=new J({props:{name:"__call__",anchor:"diffusers.VersatileDiffusionTextToImagePipeline.__call__",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str]]"},{name:"height",val:": typing.Optional[int] = None"},{name:"width",val:": typing.Optional[int] = None"},{name:"num_inference_steps",val:": int = 50"},{name:"guidance_scale",val:": float = 7.5"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"num_images_per_prompt",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:"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"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"diffusers.VersatileDiffusionTextToImagePipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>) &#x2014;
The prompt or prompts to guide the image generation.`,name:"prompt"},{anchor:"diffusers.VersatileDiffusionTextToImagePipeline.__call__.height",description:`<strong>height</strong> (<code>int</code>, <em>optional</em>, defaults to self.image_unet.config.sample_size * self.vae_scale_factor) &#x2014;
The height in pixels of the generated image.`,name:"height"},{anchor:"diffusers.VersatileDiffusionTextToImagePipeline.__call__.width",description:`<strong>width</strong> (<code>int</code>, <em>optional</em>, defaults to self.image_unet.config.sample_size * self.vae_scale_factor) &#x2014;
The width in pixels of the generated image.`,name:"width"},{anchor:"diffusers.VersatileDiffusionTextToImagePipeline.__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.VersatileDiffusionTextToImagePipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 7.5) &#x2014;
Guidance scale as defined in <a href="https://arxiv.org/abs/2207.12598" rel="nofollow">Classifier-Free Diffusion Guidance</a>.
<code>guidance_scale</code> is defined as <code>w</code> of equation 2. of <a href="https://arxiv.org/pdf/2205.11487.pdf" rel="nofollow">Imagen
Paper</a>. Guidance scale is enabled by setting <code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to the text <code>prompt</code>,
usually at the expense of lower image quality.`,name:"guidance_scale"},{anchor:"diffusers.VersatileDiffusionTextToImagePipeline.__call__.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts not to guide the image generation. Ignored when not using guidance (i.e., ignored
if <code>guidance_scale</code> is less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.VersatileDiffusionTextToImagePipeline.__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.`,name:"num_images_per_prompt"},{anchor:"diffusers.VersatileDiffusionTextToImagePipeline.__call__.eta",description:`<strong>eta</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
Corresponds to parameter eta (&#x3B7;) in the DDIM paper: <a href="https://arxiv.org/abs/2010.02502" rel="nofollow">https://arxiv.org/abs/2010.02502</a>. Only applies to
<a href="/docs/diffusers/v0.18.2/en/api/schedulers/ddim#diffusers.DDIMScheduler">schedulers.DDIMScheduler</a>, will be ignored for others.`,name:"eta"},{anchor:"diffusers.VersatileDiffusionTextToImagePipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code>, <em>optional</em>) &#x2014;
One or a list of <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow">torch generator(s)</a>
to make generation deterministic.`,name:"generator"},{anchor:"diffusers.VersatileDiffusionTextToImagePipeline.__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 image
generation. Can be used to tweak the same generation with different prompts. If not provided, a latents
tensor will ge generated by sampling using the supplied random <code>generator</code>.`,name:"latents"},{anchor:"diffusers.VersatileDiffusionTextToImagePipeline.__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 generate image. Choose between
<a href="https://pillow.readthedocs.io/en/stable/" rel="nofollow">PIL</a>: <code>PIL.Image.Image</code> or <code>np.array</code>.`,name:"output_type"},{anchor:"diffusers.VersatileDiffusionTextToImagePipeline.__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.18.2/en/api/pipelines/stable_diffusion/overview#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput">StableDiffusionPipelineOutput</a> instead of a
plain tuple.`,name:"return_dict"},{anchor:"diffusers.VersatileDiffusionTextToImagePipeline.__call__.callback",description:`<strong>callback</strong> (<code>Callable</code>, <em>optional</em>) &#x2014;
A function that will be called every <code>callback_steps</code> steps during inference. The function will be
called with the following arguments: <code>callback(step: int, timestep: int, latents: torch.FloatTensor)</code>.`,name:"callback"},{anchor:"diffusers.VersatileDiffusionTextToImagePipeline.__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 will be called. If not specified, the callback will be
called at every step.`,name:"callback_steps"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.2/src/diffusers/pipelines/versatile_diffusion/pipeline_versatile_diffusion_text_to_image.py#L348",returnDescription:`
<p><a
href="/docs/diffusers/v0.18.2/en/api/pipelines/stable_diffusion/overview#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput"
>StableDiffusionPipelineOutput</a> if <code>return_dict</code> is True, otherwise a <code>tuple. When returning a tuple, the first element is a list with the generated images, and the second element is a list of </code>bool<code>s denoting whether the corresponding generated image likely represents "not-safe-for-work" (nsfw) content, according to the </code>safety_checker\`.</p>
`,returnType:`
<p><a
href="/docs/diffusers/v0.18.2/en/api/pipelines/stable_diffusion/overview#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput"
>StableDiffusionPipelineOutput</a> or <code>tuple</code></p>
`}}),de=new Zt({props:{anchor:"diffusers.VersatileDiffusionTextToImagePipeline.__call__.example",$$slots:{default:[Yo]},$$scope:{ctx:k}}}),Ce=new J({props:{name:"enable_sequential_cpu_offload",anchor:"diffusers.VersatileDiffusionTextToImagePipeline.enable_sequential_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.2/src/diffusers/pipelines/versatile_diffusion/pipeline_versatile_diffusion_text_to_image.py#L102"}}),Fe=new ye({}),Xe=new J({props:{name:"class diffusers.VersatileDiffusionImageVariationPipeline",anchor:"diffusers.VersatileDiffusionImageVariationPipeline",parameters:[{name:"image_feature_extractor",val:": CLIPImageProcessor"},{name:"image_encoder",val:": CLIPVisionModelWithProjection"},{name:"image_unet",val:": UNet2DConditionModel"},{name:"vae",val:": AutoencoderKL"},{name:"scheduler",val:": KarrasDiffusionSchedulers"}],parametersDescription:[{anchor:"diffusers.VersatileDiffusionImageVariationPipeline.vqvae",description:`<strong>vqvae</strong> (<a href="/docs/diffusers/v0.18.2/en/api/models/vq#diffusers.VQModel">VQModel</a>) &#x2014;
Vector-quantized (VQ) Model to encode and decode images to and from latent representations.`,name:"vqvae"},{anchor:"diffusers.VersatileDiffusionImageVariationPipeline.bert",description:`<strong>bert</strong> (<code>LDMBertModel</code>) &#x2014;
Text-encoder model based on <a href="https://huggingface.co/docs/transformers/model_doc/bert" rel="nofollow">BERT</a> architecture.`,name:"bert"},{anchor:"diffusers.VersatileDiffusionImageVariationPipeline.tokenizer",description:`<strong>tokenizer</strong> (<code>transformers.BertTokenizer</code>) &#x2014;
Tokenizer of class
<a href="https://huggingface.co/docs/transformers/model_doc/bert#transformers.BertTokenizer" rel="nofollow">BertTokenizer</a>.`,name:"tokenizer"},{anchor:"diffusers.VersatileDiffusionImageVariationPipeline.unet",description:'<strong>unet</strong> (<a href="/docs/diffusers/v0.18.2/en/api/models/unet2d-cond#diffusers.UNet2DConditionModel">UNet2DConditionModel</a>) &#x2014; Conditional U-Net architecture to denoise the encoded image latents.',name:"unet"},{anchor:"diffusers.VersatileDiffusionImageVariationPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/v0.18.2/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 latents. Can be one of
<a href="/docs/diffusers/v0.18.2/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>, <a href="/docs/diffusers/v0.18.2/en/api/schedulers/lms_discrete#diffusers.LMSDiscreteScheduler">LMSDiscreteScheduler</a>, or <a href="/docs/diffusers/v0.18.2/en/api/schedulers/pndm#diffusers.PNDMScheduler">PNDMScheduler</a>.`,name:"scheduler"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.2/src/diffusers/pipelines/versatile_diffusion/pipeline_versatile_diffusion_image_variation.py#L35"}}),qe=new J({props:{name:"__call__",anchor:"diffusers.VersatileDiffusionImageVariationPipeline.__call__",parameters:[{name:"image",val:": typing.Union[PIL.Image.Image, typing.List[PIL.Image.Image], torch.Tensor]"},{name:"height",val:": typing.Optional[int] = None"},{name:"width",val:": typing.Optional[int] = None"},{name:"num_inference_steps",val:": int = 50"},{name:"guidance_scale",val:": float = 7.5"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"num_images_per_prompt",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:"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"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"diffusers.VersatileDiffusionImageVariationPipeline.__call__.image",description:`<strong>image</strong> (<code>PIL.Image.Image</code>, <code>List[PIL.Image.Image]</code> or <code>torch.Tensor</code>) &#x2014;
The image prompt or prompts to guide the image generation.`,name:"image"},{anchor:"diffusers.VersatileDiffusionImageVariationPipeline.__call__.height",description:`<strong>height</strong> (<code>int</code>, <em>optional</em>, defaults to self.image_unet.config.sample_size * self.vae_scale_factor) &#x2014;
The height in pixels of the generated image.`,name:"height"},{anchor:"diffusers.VersatileDiffusionImageVariationPipeline.__call__.width",description:`<strong>width</strong> (<code>int</code>, <em>optional</em>, defaults to self.image_unet.config.sample_size * self.vae_scale_factor) &#x2014;
The width in pixels of the generated image.`,name:"width"},{anchor:"diffusers.VersatileDiffusionImageVariationPipeline.__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.VersatileDiffusionImageVariationPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 7.5) &#x2014;
Guidance scale as defined in <a href="https://arxiv.org/abs/2207.12598" rel="nofollow">Classifier-Free Diffusion Guidance</a>.
<code>guidance_scale</code> is defined as <code>w</code> of equation 2. of <a href="https://arxiv.org/pdf/2205.11487.pdf" rel="nofollow">Imagen
Paper</a>. Guidance scale is enabled by setting <code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to the text <code>prompt</code>,
usually at the expense of lower image quality.`,name:"guidance_scale"},{anchor:"diffusers.VersatileDiffusionImageVariationPipeline.__call__.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts not to guide the image generation. Ignored when not using guidance (i.e., ignored
if <code>guidance_scale</code> is less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.VersatileDiffusionImageVariationPipeline.__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.`,name:"num_images_per_prompt"},{anchor:"diffusers.VersatileDiffusionImageVariationPipeline.__call__.eta",description:`<strong>eta</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
Corresponds to parameter eta (&#x3B7;) in the DDIM paper: <a href="https://arxiv.org/abs/2010.02502" rel="nofollow">https://arxiv.org/abs/2010.02502</a>. Only applies to
<a href="/docs/diffusers/v0.18.2/en/api/schedulers/ddim#diffusers.DDIMScheduler">schedulers.DDIMScheduler</a>, will be ignored for others.`,name:"eta"},{anchor:"diffusers.VersatileDiffusionImageVariationPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code>, <em>optional</em>) &#x2014;
One or a list of <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow">torch generator(s)</a>
to make generation deterministic.`,name:"generator"},{anchor:"diffusers.VersatileDiffusionImageVariationPipeline.__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 image
generation. Can be used to tweak the same generation with different prompts. If not provided, a latents
tensor will ge generated by sampling using the supplied random <code>generator</code>.`,name:"latents"},{anchor:"diffusers.VersatileDiffusionImageVariationPipeline.__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 generate image. Choose between
<a href="https://pillow.readthedocs.io/en/stable/" rel="nofollow">PIL</a>: <code>PIL.Image.Image</code> or <code>np.array</code>.`,name:"output_type"},{anchor:"diffusers.VersatileDiffusionImageVariationPipeline.__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.18.2/en/api/pipelines/stable_diffusion/overview#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput">StableDiffusionPipelineOutput</a> instead of a
plain tuple.`,name:"return_dict"},{anchor:"diffusers.VersatileDiffusionImageVariationPipeline.__call__.callback",description:`<strong>callback</strong> (<code>Callable</code>, <em>optional</em>) &#x2014;
A function that will be called every <code>callback_steps</code> steps during inference. The function will be
called with the following arguments: <code>callback(step: int, timestep: int, latents: torch.FloatTensor)</code>.`,name:"callback"},{anchor:"diffusers.VersatileDiffusionImageVariationPipeline.__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 will be called. If not specified, the callback will be
called at every step.`,name:"callback_steps"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.2/src/diffusers/pipelines/versatile_diffusion/pipeline_versatile_diffusion_image_variation.py#L266",returnDescription:`
<p><a
href="/docs/diffusers/v0.18.2/en/api/pipelines/stable_diffusion/overview#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput"
>StableDiffusionPipelineOutput</a> if <code>return_dict</code> is True, otherwise a <code>tuple. When returning a tuple, the first element is a list with the generated images, and the second element is a list of </code>bool<code>s denoting whether the corresponding generated image likely represents "not-safe-for-work" (nsfw) content, according to the </code>safety_checker\`.</p>
`,returnType:`
<p><a
href="/docs/diffusers/v0.18.2/en/api/pipelines/stable_diffusion/overview#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput"
>StableDiffusionPipelineOutput</a> or <code>tuple</code></p>
`}}),fe=new Zt({props:{anchor:"diffusers.VersatileDiffusionImageVariationPipeline.__call__.example",$$slots:{default:[Oo]},$$scope:{ctx:k}}}),Le=new J({props:{name:"enable_sequential_cpu_offload",anchor:"diffusers.VersatileDiffusionImageVariationPipeline.enable_sequential_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.2/src/diffusers/pipelines/versatile_diffusion/pipeline_versatile_diffusion_image_variation.py#L78"}}),Qe=new ye({}),Ae=new J({props:{name:"class diffusers.VersatileDiffusionDualGuidedPipeline",anchor:"diffusers.VersatileDiffusionDualGuidedPipeline",parameters:[{name:"tokenizer",val:": CLIPTokenizer"},{name:"image_feature_extractor",val:": CLIPImageProcessor"},{name:"text_encoder",val:": CLIPTextModelWithProjection"},{name:"image_encoder",val:": CLIPVisionModelWithProjection"},{name:"image_unet",val:": UNet2DConditionModel"},{name:"text_unet",val:": UNetFlatConditionModel"},{name:"vae",val:": AutoencoderKL"},{name:"scheduler",val:": KarrasDiffusionSchedulers"}],parametersDescription:[{anchor:"diffusers.VersatileDiffusionDualGuidedPipeline.vqvae",description:`<strong>vqvae</strong> (<a href="/docs/diffusers/v0.18.2/en/api/models/vq#diffusers.VQModel">VQModel</a>) &#x2014;
Vector-quantized (VQ) Model to encode and decode images to and from latent representations.`,name:"vqvae"},{anchor:"diffusers.VersatileDiffusionDualGuidedPipeline.bert",description:`<strong>bert</strong> (<code>LDMBertModel</code>) &#x2014;
Text-encoder model based on <a href="https://huggingface.co/docs/transformers/model_doc/bert" rel="nofollow">BERT</a> architecture.`,name:"bert"},{anchor:"diffusers.VersatileDiffusionDualGuidedPipeline.tokenizer",description:`<strong>tokenizer</strong> (<code>transformers.BertTokenizer</code>) &#x2014;
Tokenizer of class
<a href="https://huggingface.co/docs/transformers/model_doc/bert#transformers.BertTokenizer" rel="nofollow">BertTokenizer</a>.`,name:"tokenizer"},{anchor:"diffusers.VersatileDiffusionDualGuidedPipeline.unet",description:'<strong>unet</strong> (<a href="/docs/diffusers/v0.18.2/en/api/models/unet2d-cond#diffusers.UNet2DConditionModel">UNet2DConditionModel</a>) &#x2014; Conditional U-Net architecture to denoise the encoded image latents.',name:"unet"},{anchor:"diffusers.VersatileDiffusionDualGuidedPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/v0.18.2/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 latents. Can be one of
<a href="/docs/diffusers/v0.18.2/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>, <a href="/docs/diffusers/v0.18.2/en/api/schedulers/lms_discrete#diffusers.LMSDiscreteScheduler">LMSDiscreteScheduler</a>, or <a href="/docs/diffusers/v0.18.2/en/api/schedulers/pndm#diffusers.PNDMScheduler">PNDMScheduler</a>.`,name:"scheduler"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.2/src/diffusers/pipelines/versatile_diffusion/pipeline_versatile_diffusion_dual_guided.py#L41"}}),Oe=new J({props:{name:"__call__",anchor:"diffusers.VersatileDiffusionDualGuidedPipeline.__call__",parameters:[{name:"prompt",val:": typing.Union[PIL.Image.Image, typing.List[PIL.Image.Image]]"},{name:"image",val:": typing.Union[str, typing.List[str]]"},{name:"text_to_image_strength",val:": float = 0.5"},{name:"height",val:": typing.Optional[int] = None"},{name:"width",val:": typing.Optional[int] = None"},{name:"num_inference_steps",val:": int = 50"},{name:"guidance_scale",val:": float = 7.5"},{name:"num_images_per_prompt",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:"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"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"diffusers.VersatileDiffusionDualGuidedPipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>) &#x2014;
The prompt or prompts to guide the image generation.`,name:"prompt"},{anchor:"diffusers.VersatileDiffusionDualGuidedPipeline.__call__.height",description:`<strong>height</strong> (<code>int</code>, <em>optional</em>, defaults to self.image_unet.config.sample_size * self.vae_scale_factor) &#x2014;
The height in pixels of the generated image.`,name:"height"},{anchor:"diffusers.VersatileDiffusionDualGuidedPipeline.__call__.width",description:`<strong>width</strong> (<code>int</code>, <em>optional</em>, defaults to self.image_unet.config.sample_size * self.vae_scale_factor) &#x2014;
The width in pixels of the generated image.`,name:"width"},{anchor:"diffusers.VersatileDiffusionDualGuidedPipeline.__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.VersatileDiffusionDualGuidedPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 7.5) &#x2014;
Guidance scale as defined in <a href="https://arxiv.org/abs/2207.12598" rel="nofollow">Classifier-Free Diffusion Guidance</a>.
<code>guidance_scale</code> is defined as <code>w</code> of equation 2. of <a href="https://arxiv.org/pdf/2205.11487.pdf" rel="nofollow">Imagen
Paper</a>. Guidance scale is enabled by setting <code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to the text <code>prompt</code>,
usually at the expense of lower image quality.`,name:"guidance_scale"},{anchor:"diffusers.VersatileDiffusionDualGuidedPipeline.__call__.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts not to guide the image generation. Ignored when not using guidance (i.e., ignored
if <code>guidance_scale</code> is less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.VersatileDiffusionDualGuidedPipeline.__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.`,name:"num_images_per_prompt"},{anchor:"diffusers.VersatileDiffusionDualGuidedPipeline.__call__.eta",description:`<strong>eta</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
Corresponds to parameter eta (&#x3B7;) in the DDIM paper: <a href="https://arxiv.org/abs/2010.02502" rel="nofollow">https://arxiv.org/abs/2010.02502</a>. Only applies to
<a href="/docs/diffusers/v0.18.2/en/api/schedulers/ddim#diffusers.DDIMScheduler">schedulers.DDIMScheduler</a>, will be ignored for others.`,name:"eta"},{anchor:"diffusers.VersatileDiffusionDualGuidedPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code>, <em>optional</em>) &#x2014;
One or a list of <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow">torch generator(s)</a>
to make generation deterministic.`,name:"generator"},{anchor:"diffusers.VersatileDiffusionDualGuidedPipeline.__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 image
generation. Can be used to tweak the same generation with different prompts. If not provided, a latents
tensor will ge generated by sampling using the supplied random <code>generator</code>.`,name:"latents"},{anchor:"diffusers.VersatileDiffusionDualGuidedPipeline.__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 generate image. Choose between
<a href="https://pillow.readthedocs.io/en/stable/" rel="nofollow">PIL</a>: <code>PIL.Image.Image</code> or <code>np.array</code>.`,name:"output_type"},{anchor:"diffusers.VersatileDiffusionDualGuidedPipeline.__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.18.2/en/api/pipelines/stable_diffusion/overview#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput">StableDiffusionPipelineOutput</a> instead of a
plain tuple.`,name:"return_dict"},{anchor:"diffusers.VersatileDiffusionDualGuidedPipeline.__call__.callback",description:`<strong>callback</strong> (<code>Callable</code>, <em>optional</em>) &#x2014;
A function that will be called every <code>callback_steps</code> steps during inference. The function will be
called with the following arguments: <code>callback(step: int, timestep: int, latents: torch.FloatTensor)</code>.`,name:"callback"},{anchor:"diffusers.VersatileDiffusionDualGuidedPipeline.__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 will be called. If not specified, the callback will be
called at every step.`,name:"callback_steps"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.2/src/diffusers/pipelines/versatile_diffusion/pipeline_versatile_diffusion_dual_guided.py#L413",returnDescription:`
<p><code>~pipelines.stable_diffusion.ImagePipelineOutput</code> if <code>return_dict</code> is True, otherwise a \`tuple. When
returning a tuple, the first element is a list with the generated images.</p>
`,returnType:`
<p><code>~pipelines.stable_diffusion.ImagePipelineOutput</code> or <code>tuple</code></p>
`}}),ge=new Zt({props:{anchor:"diffusers.VersatileDiffusionDualGuidedPipeline.__call__.example",$$slots:{default:[Ho]},$$scope:{ctx:k}}}),He=new J({props:{name:"enable_sequential_cpu_offload",anchor:"diffusers.VersatileDiffusionDualGuidedPipeline.enable_sequential_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.2/src/diffusers/pipelines/versatile_diffusion/pipeline_versatile_diffusion_dual_guided.py#L151"}}),{c(){g=n("meta"),V=c(),_=n("h1"),u=n("a"),v=n("span"),b(o.$$.fragment),h=c(),$t=n("span"),fn=r("VersatileDiffusion"),ba=c(),O=n("p"),un=r("VersatileDiffusion was proposed in "),we=n("a"),mn=r("Versatile Diffusion: Text, Images and Variations All in One Diffusion Model"),gn=r(" by Xingqian Xu, Zhangyang Wang, Eric Zhang, Kai Wang, Humphrey Shi ."),ya=c(),nt=n("p"),hn=r("The abstract of the paper is the following:"),wa=c(),st=n("p"),Jt=n("em"),_n=r("The recent advances in diffusion models have set an impressive milestone in many generation tasks. Trending works such as DALL-E2, Imagen, and Stable Diffusion have attracted great interest in academia and industry. Despite the rapid landscape changes, recent new approaches focus on extensions and performance rather than capacity, thus requiring separate models for separate tasks. In this work, we expand the existing single-flow diffusion pipeline into a multi-flow network, dubbed Versatile Diffusion (VD), that handles text-to-image, image-to-text, image-variation, and text-variation in one unified model. Moreover, we generalize VD to a unified multi-flow multimodal diffusion framework with grouped layers, swappable streams, and other propositions that can process modalities beyond images and text. Through our experiments, we demonstrate that VD and its underlying framework have the following merits: a) VD handles all subtasks with competitive quality; b) VD initiates novel extensions and applications such as disentanglement of style and semantic, image-text dual-guided generation, etc.; c) Through these experiments and applications, VD provides more semantic insights of the generated outputs."),Ma=c(),X=n("h2"),H=n("a"),Gt=n("span"),b(Me.$$.fragment),vn=c(),Et=n("span"),bn=r("Tips"),Da=c(),it=n("ul"),De=n("li"),yn=r("VersatileDiffusion is conceptually very similar as "),ot=n("a"),wn=r("Stable Diffusion"),Mn=r(", but instead of providing just a image data stream conditioned on text, VersatileDiffusion provides both a image and text data stream and can be conditioned on both text and image."),Ta=c(),R=n("h3"),K=n("a"),St=n("span"),b(Te.$$.fragment),Dn=c(),Wt=n("span"),Tn=r("*Run VersatileDiffusion*"),Va=c(),j=n("p"),Vn=r("You can both load the memory intensive \u201Call-in-one\u201D "),rt=n("a"),xn=r("VersatileDiffusionPipeline"),In=r(` that can run all tasks
with the same class as shown in `),lt=n("a"),Pn=r("VersatileDiffusionPipeline.text_to_image()"),kn=r(", "),dt=n("a"),jn=r("VersatileDiffusionPipeline.image_variation()"),Zn=r(", and "),ct=n("a"),Un=r("VersatileDiffusionPipeline.dual_guided()"),xa=c(),pt=n("p"),Nt=n("strong"),$n=r("or"),Ia=c(),ft=n("p"),Jn=r("You can run the individual pipelines which are much more memory efficient:"),Pa=c(),E=n("ul"),Ve=n("li"),Ct=n("em"),Gn=r("Text-to-Image"),En=r(": "),ee=n("a"),Sn=r("VersatileDiffusionTextToImagePipeline."),Bt=n("strong"),Wn=r("call"),Nn=r("()"),Cn=c(),xe=n("li"),Ft=n("em"),Bn=r("Image Variation"),Fn=r(": "),te=n("a"),Xn=r("VersatileDiffusionImageVariationPipeline."),Xt=n("strong"),Rn=r("call"),qn=r("()"),Ln=c(),Ie=n("li"),Rt=n("em"),zn=r("Dual Text and Image Guided Generation"),Qn=r(": "),ae=n("a"),An=r("VersatileDiffusionDualGuidedPipeline."),qt=n("strong"),Yn=r("call"),On=r("()"),ka=c(),q=n("h3"),ne=n("a"),Lt=n("span"),b(Pe.$$.fragment),Hn=c(),zt=n("span"),Kn=r("*How to load and use different schedulers.*"),ja=c(),x=n("p"),es=r("The versatile diffusion pipelines uses "),ut=n("a"),ts=r("DDIMScheduler"),as=r(" scheduler by default. But "),Qt=n("code"),ns=r("diffusers"),ss=r(" provides many other schedulers that can be used with the alt diffusion pipeline such as "),mt=n("a"),is=r("PNDMScheduler"),os=r(", "),gt=n("a"),rs=r("LMSDiscreteScheduler"),ls=r(", "),ht=n("a"),ds=r("EulerDiscreteScheduler"),cs=r(", "),_t=n("a"),ps=r("EulerAncestralDiscreteScheduler"),fs=r(` etc.
To use a different scheduler, you can either change it via the `),vt=n("a"),us=r("ConfigMixin.from_config()"),ms=r(" method or pass the "),At=n("code"),gs=r("scheduler"),hs=r(" argument to the "),Yt=n("code"),_s=r("from_pretrained"),vs=r(" method of the pipeline. For example, to use the "),bt=n("a"),bs=r("EulerDiscreteScheduler"),ys=r(", you can do the following:"),Za=c(),b(ke.$$.fragment),Ua=c(),L=n("h2"),se=n("a"),Ot=n("span"),b(je.$$.fragment),ws=c(),Ht=n("span"),Ms=r("VersatileDiffusionPipeline"),$a=c(),P=n("div"),b(Ze.$$.fragment),Ds=c(),Kt=n("p"),Ts=r("Pipeline for text-to-image generation using Stable Diffusion."),Vs=c(),Ue=n("p"),xs=r("This model inherits from "),yt=n("a"),Is=r("DiffusionPipeline"),Ps=r(`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),ks=c(),S=n("div"),b($e.$$.fragment),js=c(),ea=n("p"),Zs=r("Function invoked when calling the pipeline for generation."),Us=c(),b(ie.$$.fragment),$s=c(),W=n("div"),b(Je.$$.fragment),Js=c(),ta=n("p"),Gs=r("Function invoked when calling the pipeline for generation."),Es=c(),b(oe.$$.fragment),Ss=c(),N=n("div"),b(Ge.$$.fragment),Ws=c(),aa=n("p"),Ns=r("Function invoked when calling the pipeline for generation."),Cs=c(),b(re.$$.fragment),Ja=c(),z=n("h2"),le=n("a"),na=n("span"),b(Ee.$$.fragment),Bs=c(),sa=n("span"),Fs=r("VersatileDiffusionTextToImagePipeline"),Ga=c(),Z=n("div"),b(Se.$$.fragment),Xs=c(),We=n("p"),Rs=r("This model inherits from "),wt=n("a"),qs=r("DiffusionPipeline"),Ls=r(`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),zs=c(),C=n("div"),b(Ne.$$.fragment),Qs=c(),ia=n("p"),As=r("Function invoked when calling the pipeline for generation."),Ys=c(),b(de.$$.fragment),Os=c(),ce=n("div"),b(Ce.$$.fragment),Hs=c(),Be=n("p"),Ks=r(`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, unet,
text_encoder, vae and safety checker have their state dicts saved to CPU and then are moved to a
`),oa=n("code"),ei=r("torch.device('meta') and loaded to GPU only when their specific submodule has its "),ti=r("forward` method called."),Ea=c(),Q=n("h2"),pe=n("a"),ra=n("span"),b(Fe.$$.fragment),ai=c(),la=n("span"),ni=r("VersatileDiffusionImageVariationPipeline"),Sa=c(),U=n("div"),b(Xe.$$.fragment),si=c(),Re=n("p"),ii=r("This model inherits from "),Mt=n("a"),oi=r("DiffusionPipeline"),ri=r(`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),li=c(),B=n("div"),b(qe.$$.fragment),di=c(),da=n("p"),ci=r("Function invoked when calling the pipeline for generation."),pi=c(),b(fe.$$.fragment),fi=c(),ue=n("div"),b(Le.$$.fragment),ui=c(),ze=n("p"),mi=r(`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, unet,
text_encoder, vae and safety checker have their state dicts saved to CPU and then are moved to a
`),ca=n("code"),gi=r("torch.device('meta') and loaded to GPU only when their specific submodule has its "),hi=r("forward` method called."),Wa=c(),A=n("h2"),me=n("a"),pa=n("span"),b(Qe.$$.fragment),_i=c(),fa=n("span"),vi=r("VersatileDiffusionDualGuidedPipeline"),Na=c(),$=n("div"),b(Ae.$$.fragment),bi=c(),Ye=n("p"),yi=r("This model inherits from "),Dt=n("a"),wi=r("DiffusionPipeline"),Mi=r(`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),Di=c(),F=n("div"),b(Oe.$$.fragment),Ti=c(),ua=n("p"),Vi=r("Function invoked when calling the pipeline for generation."),xi=c(),b(ge.$$.fragment),Ii=c(),he=n("div"),b(He.$$.fragment),Pi=c(),Ke=n("p"),ki=r(`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, unet,
text_encoder, vae and safety checker have their state dicts saved to CPU and then are moved to a
`),ma=n("code"),ji=r("torch.device('meta') and loaded to GPU only when their specific submodule has its "),Zi=r("forward` method called."),this.h()},l(t){const f=qo('[data-svelte="svelte-1phssyn"]',document.head);g=s(f,"META",{name:!0,content:!0}),f.forEach(a),V=p(t),_=s(t,"H1",{class:!0});var et=i(_);u=s(et,"A",{id:!0,class:!0,href:!0});var ga=i(u);v=s(ga,"SPAN",{});var ha=i(v);y(o.$$.fragment,ha),ha.forEach(a),ga.forEach(a),h=p(et),$t=s(et,"SPAN",{});var _a=i($t);fn=l(_a,"VersatileDiffusion"),_a.forEach(a),et.forEach(a),ba=p(t),O=s(t,"P",{});var tt=i(O);un=l(tt,"VersatileDiffusion was proposed in "),we=s(tt,"A",{href:!0,rel:!0});var va=i(we);mn=l(va,"Versatile Diffusion: Text, Images and Variations All in One Diffusion Model"),va.forEach(a),gn=l(tt," by Xingqian Xu, Zhangyang Wang, Eric Zhang, Kai Wang, Humphrey Shi ."),tt.forEach(a),ya=p(t),nt=s(t,"P",{});var Ui=i(nt);hn=l(Ui,"The abstract of the paper is the following:"),Ui.forEach(a),wa=p(t),st=s(t,"P",{});var $i=i(st);Jt=s($i,"EM",{});var Ji=i(Jt);_n=l(Ji,"The recent advances in diffusion models have set an impressive milestone in many generation tasks. Trending works such as DALL-E2, Imagen, and Stable Diffusion have attracted great interest in academia and industry. Despite the rapid landscape changes, recent new approaches focus on extensions and performance rather than capacity, thus requiring separate models for separate tasks. In this work, we expand the existing single-flow diffusion pipeline into a multi-flow network, dubbed Versatile Diffusion (VD), that handles text-to-image, image-to-text, image-variation, and text-variation in one unified model. Moreover, we generalize VD to a unified multi-flow multimodal diffusion framework with grouped layers, swappable streams, and other propositions that can process modalities beyond images and text. Through our experiments, we demonstrate that VD and its underlying framework have the following merits: a) VD handles all subtasks with competitive quality; b) VD initiates novel extensions and applications such as disentanglement of style and semantic, image-text dual-guided generation, etc.; c) Through these experiments and applications, VD provides more semantic insights of the generated outputs."),Ji.forEach(a),$i.forEach(a),Ma=p(t),X=s(t,"H2",{class:!0});var Ba=i(X);H=s(Ba,"A",{id:!0,class:!0,href:!0});var Gi=i(H);Gt=s(Gi,"SPAN",{});var Ei=i(Gt);y(Me.$$.fragment,Ei),Ei.forEach(a),Gi.forEach(a),vn=p(Ba),Et=s(Ba,"SPAN",{});var Si=i(Et);bn=l(Si,"Tips"),Si.forEach(a),Ba.forEach(a),Da=p(t),it=s(t,"UL",{});var Wi=i(it);De=s(Wi,"LI",{});var Fa=i(De);yn=l(Fa,"VersatileDiffusion is conceptually very similar as "),ot=s(Fa,"A",{href:!0});var Ni=i(ot);wn=l(Ni,"Stable Diffusion"),Ni.forEach(a),Mn=l(Fa,", but instead of providing just a image data stream conditioned on text, VersatileDiffusion provides both a image and text data stream and can be conditioned on both text and image."),Fa.forEach(a),Wi.forEach(a),Ta=p(t),R=s(t,"H3",{class:!0});var Xa=i(R);K=s(Xa,"A",{id:!0,class:!0,href:!0});var Ci=i(K);St=s(Ci,"SPAN",{});var Bi=i(St);y(Te.$$.fragment,Bi),Bi.forEach(a),Ci.forEach(a),Dn=p(Xa),Wt=s(Xa,"SPAN",{});var Fi=i(Wt);Tn=l(Fi,"*Run VersatileDiffusion*"),Fi.forEach(a),Xa.forEach(a),Va=p(t),j=s(t,"P",{});var Y=i(j);Vn=l(Y,"You can both load the memory intensive \u201Call-in-one\u201D "),rt=s(Y,"A",{href:!0});var Xi=i(rt);xn=l(Xi,"VersatileDiffusionPipeline"),Xi.forEach(a),In=l(Y,` that can run all tasks
with the same class as shown in `),lt=s(Y,"A",{href:!0});var Ri=i(lt);Pn=l(Ri,"VersatileDiffusionPipeline.text_to_image()"),Ri.forEach(a),kn=l(Y,", "),dt=s(Y,"A",{href:!0});var qi=i(dt);jn=l(qi,"VersatileDiffusionPipeline.image_variation()"),qi.forEach(a),Zn=l(Y,", and "),ct=s(Y,"A",{href:!0});var Li=i(ct);Un=l(Li,"VersatileDiffusionPipeline.dual_guided()"),Li.forEach(a),Y.forEach(a),xa=p(t),pt=s(t,"P",{});var zi=i(pt);Nt=s(zi,"STRONG",{});var Qi=i(Nt);$n=l(Qi,"or"),Qi.forEach(a),zi.forEach(a),Ia=p(t),ft=s(t,"P",{});var Ai=i(ft);Jn=l(Ai,"You can run the individual pipelines which are much more memory efficient:"),Ai.forEach(a),Pa=p(t),E=s(t,"UL",{});var Tt=i(E);Ve=s(Tt,"LI",{});var Ra=i(Ve);Ct=s(Ra,"EM",{});var Yi=i(Ct);Gn=l(Yi,"Text-to-Image"),Yi.forEach(a),En=l(Ra,": "),ee=s(Ra,"A",{href:!0});var qa=i(ee);Sn=l(qa,"VersatileDiffusionTextToImagePipeline."),Bt=s(qa,"STRONG",{});var Oi=i(Bt);Wn=l(Oi,"call"),Oi.forEach(a),Nn=l(qa,"()"),qa.forEach(a),Ra.forEach(a),Cn=p(Tt),xe=s(Tt,"LI",{});var La=i(xe);Ft=s(La,"EM",{});var Hi=i(Ft);Bn=l(Hi,"Image Variation"),Hi.forEach(a),Fn=l(La,": "),te=s(La,"A",{href:!0});var za=i(te);Xn=l(za,"VersatileDiffusionImageVariationPipeline."),Xt=s(za,"STRONG",{});var Ki=i(Xt);Rn=l(Ki,"call"),Ki.forEach(a),qn=l(za,"()"),za.forEach(a),La.forEach(a),Ln=p(Tt),Ie=s(Tt,"LI",{});var Qa=i(Ie);Rt=s(Qa,"EM",{});var eo=i(Rt);zn=l(eo,"Dual Text and Image Guided Generation"),eo.forEach(a),Qn=l(Qa,": "),ae=s(Qa,"A",{href:!0});var Aa=i(ae);An=l(Aa,"VersatileDiffusionDualGuidedPipeline."),qt=s(Aa,"STRONG",{});var to=i(qt);Yn=l(to,"call"),to.forEach(a),On=l(Aa,"()"),Aa.forEach(a),Qa.forEach(a),Tt.forEach(a),ka=p(t),q=s(t,"H3",{class:!0});var Ya=i(q);ne=s(Ya,"A",{id:!0,class:!0,href:!0});var ao=i(ne);Lt=s(ao,"SPAN",{});var no=i(Lt);y(Pe.$$.fragment,no),no.forEach(a),ao.forEach(a),Hn=p(Ya),zt=s(Ya,"SPAN",{});var so=i(zt);Kn=l(so,"*How to load and use different schedulers.*"),so.forEach(a),Ya.forEach(a),ja=p(t),x=s(t,"P",{});var I=i(x);es=l(I,"The versatile diffusion pipelines uses "),ut=s(I,"A",{href:!0});var io=i(ut);ts=l(io,"DDIMScheduler"),io.forEach(a),as=l(I," scheduler by default. But "),Qt=s(I,"CODE",{});var oo=i(Qt);ns=l(oo,"diffusers"),oo.forEach(a),ss=l(I," provides many other schedulers that can be used with the alt diffusion pipeline such as "),mt=s(I,"A",{href:!0});var ro=i(mt);is=l(ro,"PNDMScheduler"),ro.forEach(a),os=l(I,", "),gt=s(I,"A",{href:!0});var lo=i(gt);rs=l(lo,"LMSDiscreteScheduler"),lo.forEach(a),ls=l(I,", "),ht=s(I,"A",{href:!0});var co=i(ht);ds=l(co,"EulerDiscreteScheduler"),co.forEach(a),cs=l(I,", "),_t=s(I,"A",{href:!0});var po=i(_t);ps=l(po,"EulerAncestralDiscreteScheduler"),po.forEach(a),fs=l(I,` etc.
To use a different scheduler, you can either change it via the `),vt=s(I,"A",{href:!0});var fo=i(vt);us=l(fo,"ConfigMixin.from_config()"),fo.forEach(a),ms=l(I," method or pass the "),At=s(I,"CODE",{});var uo=i(At);gs=l(uo,"scheduler"),uo.forEach(a),hs=l(I," argument to the "),Yt=s(I,"CODE",{});var mo=i(Yt);_s=l(mo,"from_pretrained"),mo.forEach(a),vs=l(I," method of the pipeline. For example, to use the "),bt=s(I,"A",{href:!0});var go=i(bt);bs=l(go,"EulerDiscreteScheduler"),go.forEach(a),ys=l(I,", you can do the following:"),I.forEach(a),Za=p(t),y(ke.$$.fragment,t),Ua=p(t),L=s(t,"H2",{class:!0});var Oa=i(L);se=s(Oa,"A",{id:!0,class:!0,href:!0});var ho=i(se);Ot=s(ho,"SPAN",{});var _o=i(Ot);y(je.$$.fragment,_o),_o.forEach(a),ho.forEach(a),ws=p(Oa),Ht=s(Oa,"SPAN",{});var vo=i(Ht);Ms=l(vo,"VersatileDiffusionPipeline"),vo.forEach(a),Oa.forEach(a),$a=p(t),P=s(t,"DIV",{class:!0});var G=i(P);y(Ze.$$.fragment,G),Ds=p(G),Kt=s(G,"P",{});var bo=i(Kt);Ts=l(bo,"Pipeline for text-to-image generation using Stable Diffusion."),bo.forEach(a),Vs=p(G),Ue=s(G,"P",{});var Ha=i(Ue);xs=l(Ha,"This model inherits from "),yt=s(Ha,"A",{href:!0});var yo=i(yt);Is=l(yo,"DiffusionPipeline"),yo.forEach(a),Ps=l(Ha,`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),Ha.forEach(a),ks=p(G),S=s(G,"DIV",{class:!0});var Vt=i(S);y($e.$$.fragment,Vt),js=p(Vt),ea=s(Vt,"P",{});var wo=i(ea);Zs=l(wo,"Function invoked when calling the pipeline for generation."),wo.forEach(a),Us=p(Vt),y(ie.$$.fragment,Vt),Vt.forEach(a),$s=p(G),W=s(G,"DIV",{class:!0});var xt=i(W);y(Je.$$.fragment,xt),Js=p(xt),ta=s(xt,"P",{});var Mo=i(ta);Gs=l(Mo,"Function invoked when calling the pipeline for generation."),Mo.forEach(a),Es=p(xt),y(oe.$$.fragment,xt),xt.forEach(a),Ss=p(G),N=s(G,"DIV",{class:!0});var It=i(N);y(Ge.$$.fragment,It),Ws=p(It),aa=s(It,"P",{});var Do=i(aa);Ns=l(Do,"Function invoked when calling the pipeline for generation."),Do.forEach(a),Cs=p(It),y(re.$$.fragment,It),It.forEach(a),G.forEach(a),Ja=p(t),z=s(t,"H2",{class:!0});var Ka=i(z);le=s(Ka,"A",{id:!0,class:!0,href:!0});var To=i(le);na=s(To,"SPAN",{});var Vo=i(na);y(Ee.$$.fragment,Vo),Vo.forEach(a),To.forEach(a),Bs=p(Ka),sa=s(Ka,"SPAN",{});var xo=i(sa);Fs=l(xo,"VersatileDiffusionTextToImagePipeline"),xo.forEach(a),Ka.forEach(a),Ga=p(t),Z=s(t,"DIV",{class:!0});var _e=i(Z);y(Se.$$.fragment,_e),Xs=p(_e),We=s(_e,"P",{});var en=i(We);Rs=l(en,"This model inherits from "),wt=s(en,"A",{href:!0});var Io=i(wt);qs=l(Io,"DiffusionPipeline"),Io.forEach(a),Ls=l(en,`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),en.forEach(a),zs=p(_e),C=s(_e,"DIV",{class:!0});var Pt=i(C);y(Ne.$$.fragment,Pt),Qs=p(Pt),ia=s(Pt,"P",{});var Po=i(ia);As=l(Po,"Function invoked when calling the pipeline for generation."),Po.forEach(a),Ys=p(Pt),y(de.$$.fragment,Pt),Pt.forEach(a),Os=p(_e),ce=s(_e,"DIV",{class:!0});var tn=i(ce);y(Ce.$$.fragment,tn),Hs=p(tn),Be=s(tn,"P",{});var an=i(Be);Ks=l(an,`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, unet,
text_encoder, vae and safety checker have their state dicts saved to CPU and then are moved to a
`),oa=s(an,"CODE",{});var ko=i(oa);ei=l(ko,"torch.device('meta') and loaded to GPU only when their specific submodule has its "),ko.forEach(a),ti=l(an,"forward` method called."),an.forEach(a),tn.forEach(a),_e.forEach(a),Ea=p(t),Q=s(t,"H2",{class:!0});var nn=i(Q);pe=s(nn,"A",{id:!0,class:!0,href:!0});var jo=i(pe);ra=s(jo,"SPAN",{});var Zo=i(ra);y(Fe.$$.fragment,Zo),Zo.forEach(a),jo.forEach(a),ai=p(nn),la=s(nn,"SPAN",{});var Uo=i(la);ni=l(Uo,"VersatileDiffusionImageVariationPipeline"),Uo.forEach(a),nn.forEach(a),Sa=p(t),U=s(t,"DIV",{class:!0});var ve=i(U);y(Xe.$$.fragment,ve),si=p(ve),Re=s(ve,"P",{});var sn=i(Re);ii=l(sn,"This model inherits from "),Mt=s(sn,"A",{href:!0});var $o=i(Mt);oi=l($o,"DiffusionPipeline"),$o.forEach(a),ri=l(sn,`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),sn.forEach(a),li=p(ve),B=s(ve,"DIV",{class:!0});var kt=i(B);y(qe.$$.fragment,kt),di=p(kt),da=s(kt,"P",{});var Jo=i(da);ci=l(Jo,"Function invoked when calling the pipeline for generation."),Jo.forEach(a),pi=p(kt),y(fe.$$.fragment,kt),kt.forEach(a),fi=p(ve),ue=s(ve,"DIV",{class:!0});var on=i(ue);y(Le.$$.fragment,on),ui=p(on),ze=s(on,"P",{});var rn=i(ze);mi=l(rn,`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, unet,
text_encoder, vae and safety checker have their state dicts saved to CPU and then are moved to a
`),ca=s(rn,"CODE",{});var Go=i(ca);gi=l(Go,"torch.device('meta') and loaded to GPU only when their specific submodule has its "),Go.forEach(a),hi=l(rn,"forward` method called."),rn.forEach(a),on.forEach(a),ve.forEach(a),Wa=p(t),A=s(t,"H2",{class:!0});var ln=i(A);me=s(ln,"A",{id:!0,class:!0,href:!0});var Eo=i(me);pa=s(Eo,"SPAN",{});var So=i(pa);y(Qe.$$.fragment,So),So.forEach(a),Eo.forEach(a),_i=p(ln),fa=s(ln,"SPAN",{});var Wo=i(fa);vi=l(Wo,"VersatileDiffusionDualGuidedPipeline"),Wo.forEach(a),ln.forEach(a),Na=p(t),$=s(t,"DIV",{class:!0});var be=i($);y(Ae.$$.fragment,be),bi=p(be),Ye=s(be,"P",{});var dn=i(Ye);yi=l(dn,"This model inherits from "),Dt=s(dn,"A",{href:!0});var No=i(Dt);wi=l(No,"DiffusionPipeline"),No.forEach(a),Mi=l(dn,`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),dn.forEach(a),Di=p(be),F=s(be,"DIV",{class:!0});var jt=i(F);y(Oe.$$.fragment,jt),Ti=p(jt),ua=s(jt,"P",{});var Co=i(ua);Vi=l(Co,"Function invoked when calling the pipeline for generation."),Co.forEach(a),xi=p(jt),y(ge.$$.fragment,jt),jt.forEach(a),Ii=p(be),he=s(be,"DIV",{class:!0});var cn=i(he);y(He.$$.fragment,cn),Pi=p(cn),Ke=s(cn,"P",{});var pn=i(Ke);ki=l(pn,`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, unet,
text_encoder, vae and safety checker have their state dicts saved to CPU and then are moved to a
`),ma=s(pn,"CODE",{});var Bo=i(ma);ji=l(Bo,"torch.device('meta') and loaded to GPU only when their specific submodule has its "),Bo.forEach(a),Zi=l(pn,"forward` method called."),pn.forEach(a),cn.forEach(a),be.forEach(a),this.h()},h(){d(g,"name","hf:doc:metadata"),d(g,"content",JSON.stringify(er)),d(u,"id","versatilediffusion"),d(u,"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(u,"href","#versatilediffusion"),d(_,"class","relative group"),d(we,"href","https://arxiv.org/abs/2211.08332"),d(we,"rel","nofollow"),d(H,"id","tips"),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","#tips"),d(X,"class","relative group"),d(ot,"href","./stable_diffusion/overview"),d(K,"id","run-versatilediffusion"),d(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"),d(K,"href","#run-versatilediffusion"),d(R,"class","relative group"),d(rt,"href","/docs/diffusers/v0.18.2/en/api/pipelines/versatile_diffusion#diffusers.VersatileDiffusionPipeline"),d(lt,"href","/docs/diffusers/v0.18.2/en/api/pipelines/versatile_diffusion#diffusers.VersatileDiffusionPipeline.text_to_image"),d(dt,"href","/docs/diffusers/v0.18.2/en/api/pipelines/versatile_diffusion#diffusers.VersatileDiffusionPipeline.image_variation"),d(ct,"href","/docs/diffusers/v0.18.2/en/api/pipelines/versatile_diffusion#diffusers.VersatileDiffusionPipeline.dual_guided"),d(ee,"href","/docs/diffusers/v0.18.2/en/api/pipelines/versatile_diffusion#diffusers.VersatileDiffusionTextToImagePipeline.__call__"),d(te,"href","/docs/diffusers/v0.18.2/en/api/pipelines/versatile_diffusion#diffusers.VersatileDiffusionImageVariationPipeline.__call__"),d(ae,"href","/docs/diffusers/v0.18.2/en/api/pipelines/versatile_diffusion#diffusers.VersatileDiffusionDualGuidedPipeline.__call__"),d(ne,"id","how-to-load-and-use-different-schedulers"),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","#how-to-load-and-use-different-schedulers"),d(q,"class","relative group"),d(ut,"href","/docs/diffusers/v0.18.2/en/api/schedulers/ddim#diffusers.DDIMScheduler"),d(mt,"href","/docs/diffusers/v0.18.2/en/api/schedulers/pndm#diffusers.PNDMScheduler"),d(gt,"href","/docs/diffusers/v0.18.2/en/api/schedulers/lms_discrete#diffusers.LMSDiscreteScheduler"),d(ht,"href","/docs/diffusers/v0.18.2/en/api/schedulers/euler#diffusers.EulerDiscreteScheduler"),d(_t,"href","/docs/diffusers/v0.18.2/en/api/schedulers/euler_ancestral#diffusers.EulerAncestralDiscreteScheduler"),d(vt,"href","/docs/diffusers/v0.18.2/en/api/configuration#diffusers.ConfigMixin.from_config"),d(bt,"href","/docs/diffusers/v0.18.2/en/api/schedulers/euler#diffusers.EulerDiscreteScheduler"),d(se,"id","diffusers.VersatileDiffusionPipeline"),d(se,"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(se,"href","#diffusers.VersatileDiffusionPipeline"),d(L,"class","relative group"),d(yt,"href","/docs/diffusers/v0.18.2/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),d(S,"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(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(P,"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,"id","diffusers.VersatileDiffusionTextToImagePipeline"),d(le,"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(le,"href","#diffusers.VersatileDiffusionTextToImagePipeline"),d(z,"class","relative group"),d(wt,"href","/docs/diffusers/v0.18.2/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),d(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(ce,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Z,"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,"id","diffusers.VersatileDiffusionImageVariationPipeline"),d(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"),d(pe,"href","#diffusers.VersatileDiffusionImageVariationPipeline"),d(Q,"class","relative group"),d(Mt,"href","/docs/diffusers/v0.18.2/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),d(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(ue,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(U,"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,"id","diffusers.VersatileDiffusionDualGuidedPipeline"),d(me,"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(me,"href","#diffusers.VersatileDiffusionDualGuidedPipeline"),d(A,"class","relative group"),d(Dt,"href","/docs/diffusers/v0.18.2/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),d(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(he,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(t,f){e(document.head,g),m(t,V,f),m(t,_,f),e(_,u),e(u,v),w(o,v,null),e(_,h),e(_,$t),e($t,fn),m(t,ba,f),m(t,O,f),e(O,un),e(O,we),e(we,mn),e(O,gn),m(t,ya,f),m(t,nt,f),e(nt,hn),m(t,wa,f),m(t,st,f),e(st,Jt),e(Jt,_n),m(t,Ma,f),m(t,X,f),e(X,H),e(H,Gt),w(Me,Gt,null),e(X,vn),e(X,Et),e(Et,bn),m(t,Da,f),m(t,it,f),e(it,De),e(De,yn),e(De,ot),e(ot,wn),e(De,Mn),m(t,Ta,f),m(t,R,f),e(R,K),e(K,St),w(Te,St,null),e(R,Dn),e(R,Wt),e(Wt,Tn),m(t,Va,f),m(t,j,f),e(j,Vn),e(j,rt),e(rt,xn),e(j,In),e(j,lt),e(lt,Pn),e(j,kn),e(j,dt),e(dt,jn),e(j,Zn),e(j,ct),e(ct,Un),m(t,xa,f),m(t,pt,f),e(pt,Nt),e(Nt,$n),m(t,Ia,f),m(t,ft,f),e(ft,Jn),m(t,Pa,f),m(t,E,f),e(E,Ve),e(Ve,Ct),e(Ct,Gn),e(Ve,En),e(Ve,ee),e(ee,Sn),e(ee,Bt),e(Bt,Wn),e(ee,Nn),e(E,Cn),e(E,xe),e(xe,Ft),e(Ft,Bn),e(xe,Fn),e(xe,te),e(te,Xn),e(te,Xt),e(Xt,Rn),e(te,qn),e(E,Ln),e(E,Ie),e(Ie,Rt),e(Rt,zn),e(Ie,Qn),e(Ie,ae),e(ae,An),e(ae,qt),e(qt,Yn),e(ae,On),m(t,ka,f),m(t,q,f),e(q,ne),e(ne,Lt),w(Pe,Lt,null),e(q,Hn),e(q,zt),e(zt,Kn),m(t,ja,f),m(t,x,f),e(x,es),e(x,ut),e(ut,ts),e(x,as),e(x,Qt),e(Qt,ns),e(x,ss),e(x,mt),e(mt,is),e(x,os),e(x,gt),e(gt,rs),e(x,ls),e(x,ht),e(ht,ds),e(x,cs),e(x,_t),e(_t,ps),e(x,fs),e(x,vt),e(vt,us),e(x,ms),e(x,At),e(At,gs),e(x,hs),e(x,Yt),e(Yt,_s),e(x,vs),e(x,bt),e(bt,bs),e(x,ys),m(t,Za,f),w(ke,t,f),m(t,Ua,f),m(t,L,f),e(L,se),e(se,Ot),w(je,Ot,null),e(L,ws),e(L,Ht),e(Ht,Ms),m(t,$a,f),m(t,P,f),w(Ze,P,null),e(P,Ds),e(P,Kt),e(Kt,Ts),e(P,Vs),e(P,Ue),e(Ue,xs),e(Ue,yt),e(yt,Is),e(Ue,Ps),e(P,ks),e(P,S),w($e,S,null),e(S,js),e(S,ea),e(ea,Zs),e(S,Us),w(ie,S,null),e(P,$s),e(P,W),w(Je,W,null),e(W,Js),e(W,ta),e(ta,Gs),e(W,Es),w(oe,W,null),e(P,Ss),e(P,N),w(Ge,N,null),e(N,Ws),e(N,aa),e(aa,Ns),e(N,Cs),w(re,N,null),m(t,Ja,f),m(t,z,f),e(z,le),e(le,na),w(Ee,na,null),e(z,Bs),e(z,sa),e(sa,Fs),m(t,Ga,f),m(t,Z,f),w(Se,Z,null),e(Z,Xs),e(Z,We),e(We,Rs),e(We,wt),e(wt,qs),e(We,Ls),e(Z,zs),e(Z,C),w(Ne,C,null),e(C,Qs),e(C,ia),e(ia,As),e(C,Ys),w(de,C,null),e(Z,Os),e(Z,ce),w(Ce,ce,null),e(ce,Hs),e(ce,Be),e(Be,Ks),e(Be,oa),e(oa,ei),e(Be,ti),m(t,Ea,f),m(t,Q,f),e(Q,pe),e(pe,ra),w(Fe,ra,null),e(Q,ai),e(Q,la),e(la,ni),m(t,Sa,f),m(t,U,f),w(Xe,U,null),e(U,si),e(U,Re),e(Re,ii),e(Re,Mt),e(Mt,oi),e(Re,ri),e(U,li),e(U,B),w(qe,B,null),e(B,di),e(B,da),e(da,ci),e(B,pi),w(fe,B,null),e(U,fi),e(U,ue),w(Le,ue,null),e(ue,ui),e(ue,ze),e(ze,mi),e(ze,ca),e(ca,gi),e(ze,hi),m(t,Wa,f),m(t,A,f),e(A,me),e(me,pa),w(Qe,pa,null),e(A,_i),e(A,fa),e(fa,vi),m(t,Na,f),m(t,$,f),w(Ae,$,null),e($,bi),e($,Ye),e(Ye,yi),e(Ye,Dt),e(Dt,wi),e(Ye,Mi),e($,Di),e($,F),w(Oe,F,null),e(F,Ti),e(F,ua),e(ua,Vi),e(F,xi),w(ge,F,null),e($,Ii),e($,he),w(He,he,null),e(he,Pi),e(he,Ke),e(Ke,ki),e(Ke,ma),e(ma,ji),e(Ke,Zi),Ca=!0},p(t,[f]){const et={};f&2&&(et.$$scope={dirty:f,ctx:t}),ie.$set(et);const ga={};f&2&&(ga.$$scope={dirty:f,ctx:t}),oe.$set(ga);const ha={};f&2&&(ha.$$scope={dirty:f,ctx:t}),re.$set(ha);const _a={};f&2&&(_a.$$scope={dirty:f,ctx:t}),de.$set(_a);const tt={};f&2&&(tt.$$scope={dirty:f,ctx:t}),fe.$set(tt);const va={};f&2&&(va.$$scope={dirty:f,ctx:t}),ge.$set(va)},i(t){Ca||(M(o.$$.fragment,t),M(Me.$$.fragment,t),M(Te.$$.fragment,t),M(Pe.$$.fragment,t),M(ke.$$.fragment,t),M(je.$$.fragment,t),M(Ze.$$.fragment,t),M($e.$$.fragment,t),M(ie.$$.fragment,t),M(Je.$$.fragment,t),M(oe.$$.fragment,t),M(Ge.$$.fragment,t),M(re.$$.fragment,t),M(Ee.$$.fragment,t),M(Se.$$.fragment,t),M(Ne.$$.fragment,t),M(de.$$.fragment,t),M(Ce.$$.fragment,t),M(Fe.$$.fragment,t),M(Xe.$$.fragment,t),M(qe.$$.fragment,t),M(fe.$$.fragment,t),M(Le.$$.fragment,t),M(Qe.$$.fragment,t),M(Ae.$$.fragment,t),M(Oe.$$.fragment,t),M(ge.$$.fragment,t),M(He.$$.fragment,t),Ca=!0)},o(t){D(o.$$.fragment,t),D(Me.$$.fragment,t),D(Te.$$.fragment,t),D(Pe.$$.fragment,t),D(ke.$$.fragment,t),D(je.$$.fragment,t),D(Ze.$$.fragment,t),D($e.$$.fragment,t),D(ie.$$.fragment,t),D(Je.$$.fragment,t),D(oe.$$.fragment,t),D(Ge.$$.fragment,t),D(re.$$.fragment,t),D(Ee.$$.fragment,t),D(Se.$$.fragment,t),D(Ne.$$.fragment,t),D(de.$$.fragment,t),D(Ce.$$.fragment,t),D(Fe.$$.fragment,t),D(Xe.$$.fragment,t),D(qe.$$.fragment,t),D(fe.$$.fragment,t),D(Le.$$.fragment,t),D(Qe.$$.fragment,t),D(Ae.$$.fragment,t),D(Oe.$$.fragment,t),D(ge.$$.fragment,t),D(He.$$.fragment,t),Ca=!1},d(t){a(g),t&&a(V),t&&a(_),T(o),t&&a(ba),t&&a(O),t&&a(ya),t&&a(nt),t&&a(wa),t&&a(st),t&&a(Ma),t&&a(X),T(Me),t&&a(Da),t&&a(it),t&&a(Ta),t&&a(R),T(Te),t&&a(Va),t&&a(j),t&&a(xa),t&&a(pt),t&&a(Ia),t&&a(ft),t&&a(Pa),t&&a(E),t&&a(ka),t&&a(q),T(Pe),t&&a(ja),t&&a(x),t&&a(Za),T(ke,t),t&&a(Ua),t&&a(L),T(je),t&&a($a),t&&a(P),T(Ze),T($e),T(ie),T(Je),T(oe),T(Ge),T(re),t&&a(Ja),t&&a(z),T(Ee),t&&a(Ga),t&&a(Z),T(Se),T(Ne),T(de),T(Ce),t&&a(Ea),t&&a(Q),T(Fe),t&&a(Sa),t&&a(U),T(Xe),T(qe),T(fe),T(Le),t&&a(Wa),t&&a(A),T(Qe),t&&a(Na),t&&a($),T(Ae),T(Oe),T(ge),T(He)}}}const er={local:"versatilediffusion",sections:[{local:"tips",sections:[{local:"run-versatilediffusion",title:"*Run VersatileDiffusion*"},{local:"how-to-load-and-use-different-schedulers",title:"*How to load and use different schedulers.*"}],title:"Tips"},{local:"diffusers.VersatileDiffusionPipeline",title:"VersatileDiffusionPipeline"},{local:"diffusers.VersatileDiffusionTextToImagePipeline",title:"VersatileDiffusionTextToImagePipeline"},{local:"diffusers.VersatileDiffusionImageVariationPipeline",title:"VersatileDiffusionImageVariationPipeline"},{local:"diffusers.VersatileDiffusionDualGuidedPipeline",title:"VersatileDiffusionDualGuidedPipeline"}],title:"VersatileDiffusion"};function tr(k){return Lo(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class rr extends Fo{constructor(g){super();Xo(this,g,tr,Ko,Ro,{})}}export{rr as default,er as metadata};

Xet Storage Details

Size:
112 kB
·
Xet hash:
dbf0bb46eaed40b372d2109acaa233e6d22d91c3514958c0bbd6e791e396766e

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