Buckets:
| import{S as xi,i as Ti,s as Mi,e as a,k as f,w,t as s,M as Pi,c as r,d as o,m,a as l,x as $,h as i,b as _,G as e,g as D,y as x,q as T,o as M,B as P,v as Di,L as Ho}from"../../chunks/vendor-hf-doc-builder.js";import{T as qo}from"../../chunks/Tip-hf-doc-builder.js";import{D as k}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Oo}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as $i}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Lo}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function ji(U){let d,b,c,p,g,n,u,Z,E,j,G;return{c(){d=a("p"),b=s("You shouldn\u2019t use the "),c=a("a"),p=s("DiffusionPipeline"),g=s(` class for training or finetuning a diffusion model. Individual | |
| components (for example, `),n=a("a"),u=s("UNet2DModel"),Z=s(" and "),E=a("a"),j=s("UNet2DConditionModel"),G=s(") of diffusion pipelines are usually trained individually, so we suggest directly working with them instead."),this.h()},l(W){d=r(W,"P",{});var I=l(d);b=i(I,"You shouldn\u2019t use the "),c=r(I,"A",{href:!0});var Oe=l(c);p=i(Oe,"DiffusionPipeline"),Oe.forEach(o),g=i(I,` class for training or finetuning a diffusion model. Individual | |
| components (for example, `),n=r(I,"A",{href:!0});var Qe=l(n);u=i(Qe,"UNet2DModel"),Qe.forEach(o),Z=i(I," and "),E=r(I,"A",{href:!0});var Y=l(E);j=i(Y,"UNet2DConditionModel"),Y.forEach(o),G=i(I,") of diffusion pipelines are usually trained individually, so we suggest directly working with them instead."),I.forEach(o),this.h()},h(){_(c,"href","/docs/diffusers/main/en/api/pipelines/overview#diffusers.DiffusionPipeline"),_(n,"href","/docs/diffusers/main/en/api/models/unet2d#diffusers.UNet2DModel"),_(E,"href","/docs/diffusers/main/en/api/models/unet2d-cond#diffusers.UNet2DConditionModel")},m(W,I){D(W,d,I),e(d,b),e(d,c),e(c,p),e(d,g),e(d,n),e(n,u),e(d,Z),e(d,E),e(E,j),e(d,G)},d(W){W&&o(d)}}}function Ui(U){let d,b,c,p,g;return p=new Oo({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMCglMEElMjAlMjAlMjAlMjBTdGFibGVEaWZmdXNpb25QaXBlbGluZSUyQyUwQSUyMCUyMCUyMCUyMFN0YWJsZURpZmZ1c2lvbkltZzJJbWdQaXBlbGluZSUyQyUwQSUyMCUyMCUyMCUyMFN0YWJsZURpZmZ1c2lvbklucGFpbnRQaXBlbGluZSUyQyUwQSklMEElMEF0ZXh0MmltZyUyMCUzRCUyMFN0YWJsZURpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJydW53YXltbCUyRnN0YWJsZS1kaWZmdXNpb24tdjEtNSUyMiklMEFpbWcyaW1nJTIwJTNEJTIwU3RhYmxlRGlmZnVzaW9uSW1nMkltZ1BpcGVsaW5lKCoqdGV4dDJpbWcuY29tcG9uZW50cyklMEFpbnBhaW50JTIwJTNEJTIwU3RhYmxlRGlmZnVzaW9uSW5wYWludFBpcGVsaW5lKCoqdGV4dDJpbWcuY29tcG9uZW50cyk=",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> ( | |
| <span class="hljs-meta">... </span> StableDiffusionPipeline, | |
| <span class="hljs-meta">... </span> StableDiffusionImg2ImgPipeline, | |
| <span class="hljs-meta">... </span> StableDiffusionInpaintPipeline, | |
| <span class="hljs-meta">... </span>) | |
| <span class="hljs-meta">>>> </span>text2img = StableDiffusionPipeline.from_pretrained(<span class="hljs-string">"runwayml/stable-diffusion-v1-5"</span>) | |
| <span class="hljs-meta">>>> </span>img2img = StableDiffusionImg2ImgPipeline(**text2img.components) | |
| <span class="hljs-meta">>>> </span>inpaint = StableDiffusionInpaintPipeline(**text2img.components)`}}),{c(){d=a("p"),b=s("Examples:"),c=f(),w(p.$$.fragment)},l(n){d=r(n,"P",{});var u=l(d);b=i(u,"Examples:"),u.forEach(o),c=m(n),$(p.$$.fragment,n)},m(n,u){D(n,d,u),e(d,b),D(n,c,u),x(p,n,u),g=!0},p:Ho,i(n){g||(T(p.$$.fragment,n),g=!0)},o(n){M(p.$$.fragment,n),g=!1},d(n){n&&o(d),n&&o(c),P(p,n)}}}function Ei(U){let d,b,c,p,g,n,u,Z;return{c(){d=a("p"),b=s("To use private or "),c=a("a"),p=s("gated models"),g=s(`, log-in with | |
| `),n=a("code"),u=s("huggingface-cli login"),Z=s("."),this.h()},l(E){d=r(E,"P",{});var j=l(d);b=i(j,"To use private or "),c=r(j,"A",{href:!0,rel:!0});var G=l(c);p=i(G,"gated models"),G.forEach(o),g=i(j,`, log-in with | |
| `),n=r(j,"CODE",{});var W=l(n);u=i(W,"huggingface-cli login"),W.forEach(o),Z=i(j,"."),j.forEach(o),this.h()},h(){_(c,"href","https://huggingface.co/docs/hub/models-gated#gated-models"),_(c,"rel","nofollow")},m(E,j){D(E,d,j),e(d,b),e(d,c),e(c,p),e(d,g),e(d,n),e(n,u),e(d,Z)},d(E){E&&o(d)}}}function Zi(U){let d,b,c,p,g;return{c(){d=a("p"),b=s("\u26A0\uFE0F Don\u2019t enable attention slicing if you\u2019re already using "),c=a("code"),p=s("scaled_dot_product_attention"),g=s(` (SDPA) from PyTorch | |
| 2.0 or xFormers. These attention computations are already very memory efficient so you won\u2019t need to enable | |
| this function. If you enable attention slicing with SDPA or xFormers, it can lead to serious slow downs!`)},l(n){d=r(n,"P",{});var u=l(d);b=i(u,"\u26A0\uFE0F Don\u2019t enable attention slicing if you\u2019re already using "),c=r(u,"CODE",{});var Z=l(c);p=i(Z,"scaled_dot_product_attention"),Z.forEach(o),g=i(u,` (SDPA) from PyTorch | |
| 2.0 or xFormers. These attention computations are already very memory efficient so you won\u2019t need to enable | |
| this function. If you enable attention slicing with SDPA or xFormers, it can lead to serious slow downs!`),u.forEach(o)},m(n,u){D(n,d,u),e(d,b),e(d,c),e(c,p),e(d,g)},d(n){n&&o(d)}}}function Gi(U){let d,b,c,p,g;return p=new Oo({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwU3RhYmxlRGlmZnVzaW9uUGlwZWxpbmUlMEElMEFwaXBlJTIwJTNEJTIwU3RhYmxlRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMnJ1bndheW1sJTJGc3RhYmxlLWRpZmZ1c2lvbi12MS01JTIyJTJDJTBBJTIwJTIwJTIwJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTBBJTIwJTIwJTIwJTIwdXNlX3NhZmV0ZW5zb3JzJTNEVHJ1ZSUyQyUwQSklMEElMEFwcm9tcHQlMjAlM0QlMjAlMjJhJTIwcGhvdG8lMjBvZiUyMGFuJTIwYXN0cm9uYXV0JTIwcmlkaW5nJTIwYSUyMGhvcnNlJTIwb24lMjBtYXJzJTIyJTBBcGlwZS5lbmFibGVfYXR0ZW50aW9uX3NsaWNpbmcoKSUwQWltYWdlJTIwJTNEJTIwcGlwZShwcm9tcHQpLmltYWdlcyU1QjAlNUQ=",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionPipeline | |
| <span class="hljs-meta">>>> </span>pipe = StableDiffusionPipeline.from_pretrained( | |
| <span class="hljs-meta">... </span> <span class="hljs-string">"runwayml/stable-diffusion-v1-5"</span>, | |
| <span class="hljs-meta">... </span> torch_dtype=torch.float16, | |
| <span class="hljs-meta">... </span> use_safetensors=<span class="hljs-literal">True</span>, | |
| <span class="hljs-meta">... </span>) | |
| <span class="hljs-meta">>>> </span>prompt = <span class="hljs-string">"a photo of an astronaut riding a horse on mars"</span> | |
| <span class="hljs-meta">>>> </span>pipe.enable_attention_slicing() | |
| <span class="hljs-meta">>>> </span>image = pipe(prompt).images[<span class="hljs-number">0</span>]`}}),{c(){d=a("p"),b=s("Examples:"),c=f(),w(p.$$.fragment)},l(n){d=r(n,"P",{});var u=l(d);b=i(u,"Examples:"),u.forEach(o),c=m(n),$(p.$$.fragment,n)},m(n,u){D(n,d,u),e(d,b),D(n,c,u),x(p,n,u),g=!0},p:Ho,i(n){g||(T(p.$$.fragment,n),g=!0)},o(n){M(p.$$.fragment,n),g=!1},d(n){n&&o(d),n&&o(c),P(p,n)}}}function Ii(U){let d,b;return{c(){d=a("p"),b=s(`\u26A0\uFE0F When memory efficient attention and sliced attention are both enabled, memory efficient attention takes | |
| precedent.`)},l(c){d=r(c,"P",{});var p=l(d);b=i(p,`\u26A0\uFE0F When memory efficient attention and sliced attention are both enabled, memory efficient attention takes | |
| precedent.`),p.forEach(o)},m(c,p){D(c,d,p),e(d,b)},d(c){c&&o(d)}}}function Ji(U){let d,b,c,p,g;return p=new Oo({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwRGlmZnVzaW9uUGlwZWxpbmUlMEFmcm9tJTIweGZvcm1lcnMub3BzJTIwaW1wb3J0JTIwTWVtb3J5RWZmaWNpZW50QXR0ZW50aW9uRmxhc2hBdHRlbnRpb25PcCUwQSUwQXBpcGUlMjAlM0QlMjBEaWZmdXNpb25QaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTIyc3RhYmlsaXR5YWklMkZzdGFibGUtZGlmZnVzaW9uLTItMSUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiklMEFwaXBlJTIwJTNEJTIwcGlwZS50byglMjJjdWRhJTIyKSUwQXBpcGUuZW5hYmxlX3hmb3JtZXJzX21lbW9yeV9lZmZpY2llbnRfYXR0ZW50aW9uKGF0dGVudGlvbl9vcCUzRE1lbW9yeUVmZmljaWVudEF0dGVudGlvbkZsYXNoQXR0ZW50aW9uT3ApJTBBJTIzJTIwV29ya2Fyb3VuZCUyMGZvciUyMG5vdCUyMGFjY2VwdGluZyUyMGF0dGVudGlvbiUyMHNoYXBlJTIwdXNpbmclMjBWQUUlMjBmb3IlMjBGbGFzaCUyMEF0dGVudGlvbiUwQXBpcGUudmFlLmVuYWJsZV94Zm9ybWVyc19tZW1vcnlfZWZmaWNpZW50X2F0dGVudGlvbihhdHRlbnRpb25fb3AlM0ROb25lKQ==",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> xformers.ops <span class="hljs-keyword">import</span> MemoryEfficientAttentionFlashAttentionOp | |
| <span class="hljs-meta">>>> </span>pipe = DiffusionPipeline.from_pretrained(<span class="hljs-string">"stabilityai/stable-diffusion-2-1"</span>, torch_dtype=torch.float16) | |
| <span class="hljs-meta">>>> </span>pipe = pipe.to(<span class="hljs-string">"cuda"</span>) | |
| <span class="hljs-meta">>>> </span>pipe.enable_xformers_memory_efficient_attention(attention_op=MemoryEfficientAttentionFlashAttentionOp) | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Workaround for not accepting attention shape using VAE for Flash Attention</span> | |
| <span class="hljs-meta">>>> </span>pipe.vae.enable_xformers_memory_efficient_attention(attention_op=<span class="hljs-literal">None</span>)`}}),{c(){d=a("p"),b=s("Examples:"),c=f(),w(p.$$.fragment)},l(n){d=r(n,"P",{});var u=l(d);b=i(u,"Examples:"),u.forEach(o),c=m(n),$(p.$$.fragment,n)},m(n,u){D(n,d,u),e(d,b),D(n,c,u),x(p,n,u),g=!0},p:Ho,i(n){g||(T(p.$$.fragment,n),g=!0)},o(n){M(p.$$.fragment,n),g=!1},d(n){n&&o(d),n&&o(c),P(p,n)}}}function ki(U){let d,b,c,p,g;return p=new Oo({props:{code:"U29tZSUyMHdlaWdodHMlMjBvZiUyMFVOZXQyRENvbmRpdGlvbk1vZGVsJTIwd2VyZSUyMG5vdCUyMGluaXRpYWxpemVkJTIwZnJvbSUyMHRoZSUyMG1vZGVsJTIwY2hlY2twb2ludCUyMGF0JTIwcnVud2F5bWwlMkZzdGFibGUtZGlmZnVzaW9uLXYxLTUlMjBhbmQlMjBhcmUlMjBuZXdseSUyMGluaXRpYWxpemVkJTIwYmVjYXVzZSUyMHRoZSUyMHNoYXBlcyUyMGRpZCUyMG5vdCUyMG1hdGNoJTNBJTBBLSUyMGNvbnZfaW4ud2VpZ2h0JTNBJTIwZm91bmQlMjBzaGFwZSUyMHRvcmNoLlNpemUoJTVCMzIwJTJDJTIwNCUyQyUyMDMlMkMlMjAzJTVEKSUyMGluJTIwdGhlJTIwY2hlY2twb2ludCUyMGFuZCUyMHRvcmNoLlNpemUoJTVCMzIwJTJDJTIwOSUyQyUyMDMlMkMlMjAzJTVEKSUyMGluJTIwdGhlJTIwbW9kZWwlMjBpbnN0YW50aWF0ZWQlMEFZb3UlMjBzaG91bGQlMjBwcm9iYWJseSUyMFRSQUlOJTIwdGhpcyUyMG1vZGVsJTIwb24lMjBhJTIwZG93bi1zdHJlYW0lMjB0YXNrJTIwdG8lMjBiZSUyMGFibGUlMjB0byUyMHVzZSUyMGl0JTIwZm9yJTIwcHJlZGljdGlvbnMlMjBhbmQlMjBpbmZlcmVuY2Uu",highlighted:`<span class="hljs-comment">Some</span> <span class="hljs-comment">weights</span> <span class="hljs-comment">of</span> <span class="hljs-comment">UNet2DConditionModel were not initialized from the model checkpoint at</span> <span class="hljs-comment">runwayml/stable</span><span class="hljs-literal">-</span><span class="hljs-comment">diffusion</span><span class="hljs-literal">-</span><span class="hljs-comment">v1</span><span class="hljs-literal">-</span><span class="hljs-comment">5 and are newly initialized because the shapes did</span> <span class="hljs-comment">not</span> <span class="hljs-comment">match:</span> | |
| <span class="hljs-literal">-</span> <span class="hljs-comment">conv_in</span><span class="hljs-string">.</span><span class="hljs-comment">weight:</span> <span class="hljs-comment">found</span> <span class="hljs-comment">shape</span> <span class="hljs-comment">torch</span><span class="hljs-string">.</span><span class="hljs-comment">Size(</span><span class="hljs-title">[</span><span class="hljs-comment">320</span><span class="hljs-string">,</span> <span class="hljs-comment">4</span><span class="hljs-string">,</span> <span class="hljs-comment">3</span><span class="hljs-string">,</span> <span class="hljs-comment">3</span><span class="hljs-title">]</span><span class="hljs-comment">) in the checkpoint and</span> <span class="hljs-comment">torch</span><span class="hljs-string">.</span><span class="hljs-comment">Size(</span><span class="hljs-title">[</span><span class="hljs-comment">320</span><span class="hljs-string">,</span> <span class="hljs-comment">9</span><span class="hljs-string">,</span> <span class="hljs-comment">3</span><span class="hljs-string">,</span> <span class="hljs-comment">3</span><span class="hljs-title">]</span><span class="hljs-comment">) in the model instantiated</span> | |
| <span class="hljs-comment">You</span> <span class="hljs-comment">should</span> <span class="hljs-comment">probably</span> <span class="hljs-comment">TRAIN this model on a down-stream task to be able to use it for predictions and inference</span><span class="hljs-string">.</span>`}}),{c(){d=a("p"),b=s("If you get the error message below, you need to finetune the weights for your downstream task:"),c=f(),w(p.$$.fragment)},l(n){d=r(n,"P",{});var u=l(d);b=i(u,"If you get the error message below, you need to finetune the weights for your downstream task:"),u.forEach(o),c=m(n),$(p.$$.fragment,n)},m(n,u){D(n,d,u),e(d,b),D(n,c,u),x(p,n,u),g=!0},p:Ho,i(n){g||(T(p.$$.fragment,n),g=!0)},o(n){M(p.$$.fragment,n),g=!1},d(n){n&&o(d),n&&o(c),P(p,n)}}}function Wi(U){let d,b,c,p,g,n,u,Z;return{c(){d=a("p"),b=s("To use private or "),c=a("a"),p=s("gated"),g=s(` models, log-in with | |
| `),n=a("code"),u=s("huggingface-cli login"),Z=s("."),this.h()},l(E){d=r(E,"P",{});var j=l(d);b=i(j,"To use private or "),c=r(j,"A",{href:!0,rel:!0});var G=l(c);p=i(G,"gated"),G.forEach(o),g=i(j,` models, log-in with | |
| `),n=r(j,"CODE",{});var W=l(n);u=i(W,"huggingface-cli login"),W.forEach(o),Z=i(j,"."),j.forEach(o),this.h()},h(){_(c,"href","https://huggingface.co/docs/hub/models-gated#gated-models"),_(c,"rel","nofollow")},m(E,j){D(E,d,j),e(d,b),e(d,c),e(c,p),e(d,g),e(d,n),e(n,u),e(d,Z)},d(E){E&&o(d)}}}function Ni(U){let d,b,c,p,g;return p=new Oo({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBJTBBJTIzJTIwRG93bmxvYWQlMjBwaXBlbGluZSUyMGZyb20lMjBodWdnaW5nZmFjZS5jbyUyMGFuZCUyMGNhY2hlLiUwQXBpcGVsaW5lJTIwJTNEJTIwRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUyMkNvbXBWaXMlMkZsZG0tdGV4dDJpbS1sYXJnZS0yNTYlMjIpJTBBJTBBJTIzJTIwRG93bmxvYWQlMjBwaXBlbGluZSUyMHRoYXQlMjByZXF1aXJlcyUyMGFuJTIwYXV0aG9yaXphdGlvbiUyMHRva2VuJTBBJTIzJTIwRm9yJTIwbW9yZSUyMGluZm9ybWF0aW9uJTIwb24lMjBhY2Nlc3MlMjB0b2tlbnMlMkMlMjBwbGVhc2UlMjByZWZlciUyMHRvJTIwdGhpcyUyMHNlY3Rpb24lMEElMjMlMjBvZiUyMHRoZSUyMGRvY3VtZW50YXRpb24lNUQoaHR0cHMlM0ElMkYlMkZodWdnaW5nZmFjZS5jbyUyRmRvY3MlMkZodWIlMkZzZWN1cml0eS10b2tlbnMpJTBBcGlwZWxpbmUlMjAlM0QlMjBEaWZmdXNpb25QaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTIycnVud2F5bWwlMkZzdGFibGUtZGlmZnVzaW9uLXYxLTUlMjIpJTBBJTBBJTIzJTIwVXNlJTIwYSUyMGRpZmZlcmVudCUyMHNjaGVkdWxlciUwQWZyb20lMjBkaWZmdXNlcnMlMjBpbXBvcnQlMjBMTVNEaXNjcmV0ZVNjaGVkdWxlciUwQSUwQXNjaGVkdWxlciUyMCUzRCUyMExNU0Rpc2NyZXRlU2NoZWR1bGVyLmZyb21fY29uZmlnKHBpcGVsaW5lLnNjaGVkdWxlci5jb25maWcpJTBBcGlwZWxpbmUuc2NoZWR1bGVyJTIwJTNEJTIwc2NoZWR1bGVy",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Download pipeline from huggingface.co and cache.</span> | |
| <span class="hljs-meta">>>> </span>pipeline = DiffusionPipeline.from_pretrained(<span class="hljs-string">"CompVis/ldm-text2im-large-256"</span>) | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Download pipeline that requires an authorization token</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># For more information on access tokens, please refer to this section</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># of the documentation](https://huggingface.co/docs/hub/security-tokens)</span> | |
| <span class="hljs-meta">>>> </span>pipeline = DiffusionPipeline.from_pretrained(<span class="hljs-string">"runwayml/stable-diffusion-v1-5"</span>) | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Use a different scheduler</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> LMSDiscreteScheduler | |
| <span class="hljs-meta">>>> </span>scheduler = LMSDiscreteScheduler.from_config(pipeline.scheduler.config) | |
| <span class="hljs-meta">>>> </span>pipeline.scheduler = scheduler`}}),{c(){d=a("p"),b=s("Examples:"),c=f(),w(p.$$.fragment)},l(n){d=r(n,"P",{});var u=l(d);b=i(u,"Examples:"),u.forEach(o),c=m(n),$(p.$$.fragment,n)},m(n,u){D(n,d,u),e(d,b),D(n,c,u),x(p,n,u),g=!0},p:Ho,i(n){g||(T(p.$$.fragment,n),g=!0)},o(n){M(p.$$.fragment,n),g=!1},d(n){n&&o(d),n&&o(c),P(p,n)}}}function Ci(U){let d,b,c,p,g,n,u,Z,E,j,G,W,I,Oe,Qe,Y,xt,Tt,Qo,O,Ko,V,Mt,Ke,Pt,Dt,eo,jt,Ut,lo,Et,Zt,et,Q,Gt,oo,It,Jt,ot,L,K,co,$e,kt,po,Wt,tt,h,xe,Nt,fo,Ct,Vt,to,no,Bt,Ft,St,Te,mo,Rt,Xt,uo,At,Yt,ho,zt,qt,Me,ee,go,Lt,Ht,_o,Ot,Qt,Kt,oe,bo,en,on,yo,tn,nn,sn,te,Pe,an,vo,rn,ln,so,De,dn,io,je,cn,B,Ue,pn,Ee,fn,wo,mn,un,hn,Ze,gn,$o,_n,bn,yn,ne,vn,se,Ge,wn,Ie,$n,xo,xn,Tn,Mn,ie,Je,Pn,ke,Dn,We,jn,Un,En,z,Ne,Zn,To,Gn,In,ae,Jn,F,Ce,kn,Mo,Wn,Nn,re,Cn,le,Vn,de,Ve,Bn,C,Fn,Po,Sn,Rn,Do,Xn,An,jo,Yn,zn,Uo,qn,Ln,Hn,ce,Be,On,N,Qn,Eo,Kn,es,Zo,os,ts,Go,ns,ss,Io,is,as,Jo,rs,ls,ds,S,Fe,cs,Se,ps,Re,fs,ms,us,pe,hs,fe,gs,J,Xe,_s,ko,bs,ys,Ae,vs,Wo,ws,$s,xs,me,Ts,ue,Ms,he,Ps,ge,Ye,Ds,No,js,Us,_e,ze,Es,Co,Zs,Gs,be,qe,Is,Le,Js,ao,ks,Ws,nt;return n=new $i({}),O=new qo({props:{$$slots:{default:[ji]},$$scope:{ctx:U}}}),$e=new $i({}),xe=new k({props:{name:"class diffusers.DiffusionPipeline",anchor:"diffusers.DiffusionPipeline",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/pipeline_utils.py#L478"}}),Pe=new k({props:{name:"__call__",anchor:"diffusers.DiffusionPipeline.__call__",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}]}}),De=new k({props:{name:"device",anchor:"diffusers.DiffusionPipeline.device",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/pipeline_utils.py#L748",returnDescription:` | |
| <p>The torch device on which the pipeline is located.</p> | |
| `,returnType:` | |
| <p><code>torch.device</code></p> | |
| `}}),je=new k({props:{name:"to",anchor:"diffusers.DiffusionPipeline.to",parameters:[{name:"torch_device",val:": typing.Union[str, torch.device, NoneType] = None"},{name:"torch_dtype",val:": typing.Optional[torch.dtype] = None"},{name:"silence_dtype_warnings",val:": bool = False"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/pipeline_utils.py#L673"}}),Ue=new k({props:{name:"components",anchor:"diffusers.DiffusionPipeline.components",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/pipeline_utils.py#L1657"}}),ne=new Lo({props:{anchor:"diffusers.DiffusionPipeline.components.example",$$slots:{default:[Ui]},$$scope:{ctx:U}}}),Ge=new k({props:{name:"disable_attention_slicing",anchor:"diffusers.DiffusionPipeline.disable_attention_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/pipeline_utils.py#L1819"}}),Je=new k({props:{name:"disable_xformers_memory_efficient_attention",anchor:"diffusers.DiffusionPipeline.disable_xformers_memory_efficient_attention",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/pipeline_utils.py#L1753"}}),Ne=new k({props:{name:"download",anchor:"diffusers.DiffusionPipeline.download",parameters:[{name:"pretrained_model_name",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"diffusers.DiffusionPipeline.download.pretrained_model_name",description:`<strong>pretrained_model_name</strong> (<code>str</code> or <code>os.PathLike</code>, <em>optional</em>) — | |
| A string, the <em>repository id</em> (for example <code>CompVis/ldm-text2im-large-256</code>) of a pretrained pipeline | |
| hosted on the Hub.`,name:"pretrained_model_name"},{anchor:"diffusers.DiffusionPipeline.download.custom_pipeline",description:`<strong>custom_pipeline</strong> (<code>str</code>, <em>optional</em>) — | |
| Can be either:</p> | |
| <ul> | |
| <li> | |
| <p>A string, the <em>repository id</em> (for example <code>CompVis/ldm-text2im-large-256</code>) of a pretrained | |
| pipeline hosted on the Hub. The repository must contain a file called <code>pipeline.py</code> that defines | |
| the custom pipeline.</p> | |
| </li> | |
| <li> | |
| <p>A string, the <em>file name</em> of a community pipeline hosted on GitHub under | |
| <a href="https://github.com/huggingface/diffusers/tree/main/examples/community" rel="nofollow">Community</a>. Valid file | |
| names must match the file name and not the pipeline script (<code>clip_guided_stable_diffusion</code> | |
| instead of <code>clip_guided_stable_diffusion.py</code>). Community pipelines are always loaded from the | |
| current <code>main</code> branch of GitHub.</p> | |
| </li> | |
| <li> | |
| <p>A path to a <em>directory</em> (<code>./my_pipeline_directory/</code>) containing a custom pipeline. The directory | |
| must contain a file called <code>pipeline.py</code> that defines the custom pipeline.</p> | |
| </li> | |
| </ul> | |
| <div class="course-tip course-tip-orange bg-gradient-to-br dark:bg-gradient-to-r before:border-orange-500 dark:before:border-orange-800 from-orange-50 dark:from-gray-900 to-white dark:to-gray-950 border border-orange-50 text-orange-700 dark:text-gray-400"> | |
| <p>🧪 This is an experimental feature and may change in the future.</p> | |
| </div> | |
| <p>For more information on how to load and create custom pipelines, take a look at <a href="https://huggingface.co/docs/diffusers/main/en/using-diffusers/contribute_pipeline" rel="nofollow">How to contribute a | |
| community pipeline</a>.`,name:"custom_pipeline"},{anchor:"diffusers.DiffusionPipeline.download.force_download",description:`<strong>force_download</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) — | |
| Whether or not to force the (re-)download of the model weights and configuration files, overriding the | |
| cached versions if they exist.`,name:"force_download"},{anchor:"diffusers.DiffusionPipeline.download.resume_download",description:`<strong>resume_download</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) — | |
| Whether or not to resume downloading the model weights and configuration files. If set to <code>False</code>, any | |
| incompletely downloaded files are deleted.`,name:"resume_download"},{anchor:"diffusers.DiffusionPipeline.download.proxies",description:`<strong>proxies</strong> (<code>Dict[str, str]</code>, <em>optional</em>) — | |
| A dictionary of proxy servers to use by protocol or endpoint, for example, <code>{'http': 'foo.bar:3128', 'http://hostname': 'foo.bar:4012'}</code>. The proxies are used on each request.`,name:"proxies"},{anchor:"diffusers.DiffusionPipeline.download.output_loading_info(bool,",description:`<strong>output_loading_info(<code>bool</code>,</strong> <em>optional</em>, defaults to <code>False</code>) — | |
| Whether or not to also return a dictionary containing missing keys, unexpected keys and error messages.`,name:"output_loading_info(bool,"},{anchor:"diffusers.DiffusionPipeline.download.local_files_only",description:`<strong>local_files_only</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) — | |
| Whether to only load local model weights and configuration files or not. If set to <code>True</code>, the model | |
| won’t be downloaded from the Hub.`,name:"local_files_only"},{anchor:"diffusers.DiffusionPipeline.download.use_auth_token",description:`<strong>use_auth_token</strong> (<code>str</code> or <em>bool</em>, <em>optional</em>) — | |
| The token to use as HTTP bearer authorization for remote files. If <code>True</code>, the token generated from | |
| <code>diffusers-cli login</code> (stored in <code>~/.huggingface</code>) is used.`,name:"use_auth_token"},{anchor:"diffusers.DiffusionPipeline.download.revision",description:`<strong>revision</strong> (<code>str</code>, <em>optional</em>, defaults to <code>"main"</code>) — | |
| The specific model version to use. It can be a branch name, a tag name, a commit id, or any identifier | |
| allowed by Git.`,name:"revision"},{anchor:"diffusers.DiffusionPipeline.download.custom_revision",description:`<strong>custom_revision</strong> (<code>str</code>, <em>optional</em>, defaults to <code>"main"</code>) — | |
| The specific model version to use. It can be a branch name, a tag name, or a commit id similar to | |
| <code>revision</code> when loading a custom pipeline from the Hub. It can be a 🤗 Diffusers version when loading a | |
| custom pipeline from GitHub, otherwise it defaults to <code>"main"</code> when loading from the Hub.`,name:"custom_revision"},{anchor:"diffusers.DiffusionPipeline.download.mirror",description:`<strong>mirror</strong> (<code>str</code>, <em>optional</em>) — | |
| Mirror source to resolve accessibility issues if you’re downloading a model in China. We do not | |
| guarantee the timeliness or safety of the source, and you should refer to the mirror site for more | |
| information.`,name:"mirror"},{anchor:"diffusers.DiffusionPipeline.download.variant",description:`<strong>variant</strong> (<code>str</code>, <em>optional</em>) — | |
| Load weights from a specified variant filename such as <code>"fp16"</code> or <code>"ema"</code>. This is ignored when | |
| loading <code>from_flax</code>.`,name:"variant"},{anchor:"diffusers.DiffusionPipeline.download.use_safetensors",description:`<strong>use_safetensors</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>None</code>) — | |
| If set to <code>None</code>, the safetensors weights are downloaded if they’re available <strong>and</strong> if the | |
| safetensors library is installed. If set to <code>True</code>, the model is forcibly loaded from safetensors | |
| weights. If set to <code>False</code>, safetensors weights are not loaded.`,name:"use_safetensors"},{anchor:"diffusers.DiffusionPipeline.download.use_onnx",description:`<strong>use_onnx</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) — | |
| If set to <code>True</code>, ONNX weights will always be downloaded if present. If set to <code>False</code>, ONNX weights | |
| will never be downloaded. By default <code>use_onnx</code> defaults to the <code>_is_onnx</code> class attribute which is | |
| <code>False</code> for non-ONNX pipelines and <code>True</code> for ONNX pipelines. ONNX weights include both files ending | |
| with <code>.onnx</code> and <code>.pb</code>.`,name:"use_onnx"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/pipeline_utils.py#L1325",returnDescription:` | |
| <p>A path to the downloaded pipeline.</p> | |
| `,returnType:` | |
| <p><code>os.PathLike</code></p> | |
| `}}),ae=new qo({props:{$$slots:{default:[Ei]},$$scope:{ctx:U}}}),Ce=new k({props:{name:"enable_attention_slicing",anchor:"diffusers.DiffusionPipeline.enable_attention_slicing",parameters:[{name:"slice_size",val:": typing.Union[str, int, NoneType] = 'auto'"}],parametersDescription:[{anchor:"diffusers.DiffusionPipeline.enable_attention_slicing.slice_size",description:`<strong>slice_size</strong> (<code>str</code> or <code>int</code>, <em>optional</em>, defaults to <code>"auto"</code>) — | |
| When <code>"auto"</code>, halves the input to the attention heads, so attention will be computed in two steps. If | |
| <code>"max"</code>, maximum amount of memory will be saved by running only one slice at a time. If a number is | |
| provided, uses as many slices as <code>attention_head_dim // slice_size</code>. In this case, <code>attention_head_dim</code> | |
| must be a multiple of <code>slice_size</code>.`,name:"slice_size"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/pipeline_utils.py#L1779"}}),re=new qo({props:{warning:!0,$$slots:{default:[Zi]},$$scope:{ctx:U}}}),le=new Lo({props:{anchor:"diffusers.DiffusionPipeline.enable_attention_slicing.example",$$slots:{default:[Gi]},$$scope:{ctx:U}}}),Ve=new k({props:{name:"enable_model_cpu_offload",anchor:"diffusers.DiffusionPipeline.enable_model_cpu_offload",parameters:[{name:"gpu_id",val:": int = 0"},{name:"device",val:": typing.Union[torch.device, str] = 'cuda'"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/pipeline_utils.py#L1225"}}),Be=new k({props:{name:"enable_sequential_cpu_offload",anchor:"diffusers.DiffusionPipeline.enable_sequential_cpu_offload",parameters:[{name:"gpu_id",val:": int = 0"},{name:"device",val:": typing.Union[torch.device, str] = 'cuda'"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/pipeline_utils.py#L1291"}}),Fe=new k({props:{name:"enable_xformers_memory_efficient_attention",anchor:"diffusers.DiffusionPipeline.enable_xformers_memory_efficient_attention",parameters:[{name:"attention_op",val:": typing.Optional[typing.Callable] = None"}],parametersDescription:[{anchor:"diffusers.DiffusionPipeline.enable_xformers_memory_efficient_attention.attention_op",description:`<strong>attention_op</strong> (<code>Callable</code>, <em>optional</em>) — | |
| Override the default <code>None</code> operator for use as <code>op</code> argument to the | |
| <a href="https://facebookresearch.github.io/xformers/components/ops.html#xformers.ops.memory_efficient_attention" rel="nofollow"><code>memory_efficient_attention()</code></a> | |
| function of xFormers.`,name:"attention_op"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/pipeline_utils.py#L1718"}}),pe=new qo({props:{warning:!0,$$slots:{default:[Ii]},$$scope:{ctx:U}}}),fe=new Lo({props:{anchor:"diffusers.DiffusionPipeline.enable_xformers_memory_efficient_attention.example",$$slots:{default:[Ji]},$$scope:{ctx:U}}}),Xe=new k({props:{name:"from_pretrained",anchor:"diffusers.DiffusionPipeline.from_pretrained",parameters:[{name:"pretrained_model_name_or_path",val:": typing.Union[str, os.PathLike, NoneType]"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"diffusers.DiffusionPipeline.from_pretrained.pretrained_model_name_or_path",description:`<strong>pretrained_model_name_or_path</strong> (<code>str</code> or <code>os.PathLike</code>, <em>optional</em>) — | |
| Can be either:</p> | |
| <ul> | |
| <li>A string, the <em>repo id</em> (for example <code>CompVis/ldm-text2im-large-256</code>) of a pretrained pipeline | |
| hosted on the Hub.</li> | |
| <li>A path to a <em>directory</em> (for example <code>./my_pipeline_directory/</code>) containing pipeline weights | |
| saved using | |
| <a href="/docs/diffusers/main/en/api/pipelines/overview#diffusers.DiffusionPipeline.save_pretrained">save_pretrained()</a>.</li> | |
| </ul>`,name:"pretrained_model_name_or_path"},{anchor:"diffusers.DiffusionPipeline.from_pretrained.torch_dtype",description:`<strong>torch_dtype</strong> (<code>str</code> or <code>torch.dtype</code>, <em>optional</em>) — | |
| Override the default <code>torch.dtype</code> and load the model with another dtype. If “auto” is passed, the | |
| dtype is automatically derived from the model’s weights.`,name:"torch_dtype"},{anchor:"diffusers.DiffusionPipeline.from_pretrained.custom_pipeline",description:`<strong>custom_pipeline</strong> (<code>str</code>, <em>optional</em>) —</p> | |
| <div class="course-tip course-tip-orange bg-gradient-to-br dark:bg-gradient-to-r before:border-orange-500 dark:before:border-orange-800 from-orange-50 dark:from-gray-900 to-white dark:to-gray-950 border border-orange-50 text-orange-700 dark:text-gray-400"> | |
| <p>🧪 This is an experimental feature and may change in the future.</p> | |
| </div> | |
| <p>Can be either:</p> | |
| <ul> | |
| <li>A string, the <em>repo id</em> (for example <code>hf-internal-testing/diffusers-dummy-pipeline</code>) of a custom | |
| pipeline hosted on the Hub. The repository must contain a file called pipeline.py that defines | |
| the custom pipeline.</li> | |
| <li>A string, the <em>file name</em> of a community pipeline hosted on GitHub under | |
| <a href="https://github.com/huggingface/diffusers/tree/main/examples/community" rel="nofollow">Community</a>. Valid file | |
| names must match the file name and not the pipeline script (<code>clip_guided_stable_diffusion</code> | |
| instead of <code>clip_guided_stable_diffusion.py</code>). Community pipelines are always loaded from the | |
| current main branch of GitHub.</li> | |
| <li>A path to a directory (<code>./my_pipeline_directory/</code>) containing a custom pipeline. The directory | |
| must contain a file called <code>pipeline.py</code> that defines the custom pipeline.</li> | |
| </ul> | |
| <p>For more information on how to load and create custom pipelines, please have a look at <a href="https://huggingface.co/docs/diffusers/using-diffusers/custom_pipeline_overview" rel="nofollow">Loading and | |
| Adding Custom | |
| Pipelines</a>`,name:"custom_pipeline"},{anchor:"diffusers.DiffusionPipeline.from_pretrained.force_download",description:`<strong>force_download</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) — | |
| Whether or not to force the (re-)download of the model weights and configuration files, overriding the | |
| cached versions if they exist.`,name:"force_download"},{anchor:"diffusers.DiffusionPipeline.from_pretrained.cache_dir",description:`<strong>cache_dir</strong> (<code>Union[str, os.PathLike]</code>, <em>optional</em>) — | |
| Path to a directory where a downloaded pretrained model configuration is cached if the standard cache | |
| is not used.`,name:"cache_dir"},{anchor:"diffusers.DiffusionPipeline.from_pretrained.resume_download",description:`<strong>resume_download</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) — | |
| Whether or not to resume downloading the model weights and configuration files. If set to <code>False</code>, any | |
| incompletely downloaded files are deleted.`,name:"resume_download"},{anchor:"diffusers.DiffusionPipeline.from_pretrained.proxies",description:`<strong>proxies</strong> (<code>Dict[str, str]</code>, <em>optional</em>) — | |
| A dictionary of proxy servers to use by protocol or endpoint, for example, <code>{'http': 'foo.bar:3128', 'http://hostname': 'foo.bar:4012'}</code>. The proxies are used on each request.`,name:"proxies"},{anchor:"diffusers.DiffusionPipeline.from_pretrained.output_loading_info(bool,",description:`<strong>output_loading_info(<code>bool</code>,</strong> <em>optional</em>, defaults to <code>False</code>) — | |
| Whether or not to also return a dictionary containing missing keys, unexpected keys and error messages.`,name:"output_loading_info(bool,"},{anchor:"diffusers.DiffusionPipeline.from_pretrained.local_files_only",description:`<strong>local_files_only</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) — | |
| Whether to only load local model weights and configuration files or not. If set to <code>True</code>, the model | |
| won’t be downloaded from the Hub.`,name:"local_files_only"},{anchor:"diffusers.DiffusionPipeline.from_pretrained.use_auth_token",description:`<strong>use_auth_token</strong> (<code>str</code> or <em>bool</em>, <em>optional</em>) — | |
| The token to use as HTTP bearer authorization for remote files. If <code>True</code>, the token generated from | |
| <code>diffusers-cli login</code> (stored in <code>~/.huggingface</code>) is used.`,name:"use_auth_token"},{anchor:"diffusers.DiffusionPipeline.from_pretrained.revision",description:`<strong>revision</strong> (<code>str</code>, <em>optional</em>, defaults to <code>"main"</code>) — | |
| The specific model version to use. It can be a branch name, a tag name, a commit id, or any identifier | |
| allowed by Git.`,name:"revision"},{anchor:"diffusers.DiffusionPipeline.from_pretrained.custom_revision",description:`<strong>custom_revision</strong> (<code>str</code>, <em>optional</em>, defaults to <code>"main"</code>) — | |
| The specific model version to use. It can be a branch name, a tag name, or a commit id similar to | |
| <code>revision</code> when loading a custom pipeline from the Hub. It can be a 🤗 Diffusers version when loading a | |
| custom pipeline from GitHub, otherwise it defaults to <code>"main"</code> when loading from the Hub.`,name:"custom_revision"},{anchor:"diffusers.DiffusionPipeline.from_pretrained.mirror",description:`<strong>mirror</strong> (<code>str</code>, <em>optional</em>) — | |
| Mirror source to resolve accessibility issues if you’re downloading a model in China. We do not | |
| guarantee the timeliness or safety of the source, and you should refer to the mirror site for more | |
| information.`,name:"mirror"},{anchor:"diffusers.DiffusionPipeline.from_pretrained.device_map",description:`<strong>device_map</strong> (<code>str</code> or <code>Dict[str, Union[int, str, torch.device]]</code>, <em>optional</em>) — | |
| A map that specifies where each submodule should go. It doesn’t need to be defined for each | |
| parameter/buffer name; once a given module name is inside, every submodule of it will be sent to the | |
| same device.</p> | |
| <p>Set <code>device_map="auto"</code> to have 🤗 Accelerate automatically compute the most optimized <code>device_map</code>. For | |
| more information about each option see <a href="https://hf.co/docs/accelerate/main/en/usage_guides/big_modeling#designing-a-device-map" rel="nofollow">designing a device | |
| map</a>.`,name:"device_map"},{anchor:"diffusers.DiffusionPipeline.from_pretrained.max_memory",description:`<strong>max_memory</strong> (<code>Dict</code>, <em>optional</em>) — | |
| A dictionary device identifier for the maximum memory. Will default to the maximum memory available for | |
| each GPU and the available CPU RAM if unset.`,name:"max_memory"},{anchor:"diffusers.DiffusionPipeline.from_pretrained.offload_folder",description:`<strong>offload_folder</strong> (<code>str</code> or <code>os.PathLike</code>, <em>optional</em>) — | |
| The path to offload weights if device_map contains the value <code>"disk"</code>.`,name:"offload_folder"},{anchor:"diffusers.DiffusionPipeline.from_pretrained.offload_state_dict",description:`<strong>offload_state_dict</strong> (<code>bool</code>, <em>optional</em>) — | |
| If <code>True</code>, temporarily offloads the CPU state dict to the hard drive to avoid running out of CPU RAM if | |
| the weight of the CPU state dict + the biggest shard of the checkpoint does not fit. Defaults to <code>True</code> | |
| when there is some disk offload.`,name:"offload_state_dict"},{anchor:"diffusers.DiffusionPipeline.from_pretrained.low_cpu_mem_usage",description:`<strong>low_cpu_mem_usage</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code> if torch version >= 1.9.0 else <code>False</code>) — | |
| Speed up model loading only loading the pretrained weights and not initializing the weights. This also | |
| tries to not use more than 1x model size in CPU memory (including peak memory) while loading the model. | |
| Only supported for PyTorch >= 1.9.0. If you are using an older version of PyTorch, setting this | |
| argument to <code>True</code> will raise an error.`,name:"low_cpu_mem_usage"},{anchor:"diffusers.DiffusionPipeline.from_pretrained.use_safetensors",description:`<strong>use_safetensors</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>None</code>) — | |
| If set to <code>None</code>, the safetensors weights are downloaded if they’re available <strong>and</strong> if the | |
| safetensors library is installed. If set to <code>True</code>, the model is forcibly loaded from safetensors | |
| weights. If set to <code>False</code>, safetensors weights are not loaded.`,name:"use_safetensors"},{anchor:"diffusers.DiffusionPipeline.from_pretrained.use_onnx",description:`<strong>use_onnx</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>None</code>) — | |
| If set to <code>True</code>, ONNX weights will always be downloaded if present. If set to <code>False</code>, ONNX weights | |
| will never be downloaded. By default <code>use_onnx</code> defaults to the <code>_is_onnx</code> class attribute which is | |
| <code>False</code> for non-ONNX pipelines and <code>True</code> for ONNX pipelines. ONNX weights include both files ending | |
| with <code>.onnx</code> and <code>.pb</code>.`,name:"use_onnx"},{anchor:"diffusers.DiffusionPipeline.from_pretrained.kwargs",description:`<strong>kwargs</strong> (remaining dictionary of keyword arguments, <em>optional</em>) — | |
| Can be used to overwrite load and saveable variables (the pipeline components of the specific pipeline | |
| class). The overwritten components are passed directly to the pipelines <code>__init__</code> method. See example | |
| below for more information.`,name:"kwargs"},{anchor:"diffusers.DiffusionPipeline.from_pretrained.variant",description:`<strong>variant</strong> (<code>str</code>, <em>optional</em>) — | |
| Load weights from a specified variant filename such as <code>"fp16"</code> or <code>"ema"</code>. This is ignored when | |
| loading <code>from_flax</code>.`,name:"variant"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/pipeline_utils.py#L763"}}),me=new Lo({props:{anchor:"diffusers.DiffusionPipeline.from_pretrained.example",$$slots:{default:[ki]},$$scope:{ctx:U}}}),ue=new qo({props:{$$slots:{default:[Wi]},$$scope:{ctx:U}}}),he=new Lo({props:{anchor:"diffusers.DiffusionPipeline.from_pretrained.example-2",$$slots:{default:[Ni]},$$scope:{ctx:U}}}),Ye=new k({props:{name:"maybe_free_model_hooks",anchor:"diffusers.DiffusionPipeline.maybe_free_model_hooks",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/pipeline_utils.py#L1275"}}),ze=new k({props:{name:"numpy_to_pil",anchor:"diffusers.DiffusionPipeline.numpy_to_pil",parameters:[{name:"images",val:""}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/pipeline_utils.py#L1693"}}),qe=new k({props:{name:"save_pretrained",anchor:"diffusers.DiffusionPipeline.save_pretrained",parameters:[{name:"save_directory",val:": typing.Union[str, os.PathLike]"},{name:"safe_serialization",val:": bool = True"},{name:"variant",val:": typing.Optional[str] = None"},{name:"push_to_hub",val:": bool = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"diffusers.DiffusionPipeline.save_pretrained.save_directory",description:`<strong>save_directory</strong> (<code>str</code> or <code>os.PathLike</code>) — | |
| Directory to save a pipeline to. Will be created if it doesn’t exist.`,name:"save_directory"},{anchor:"diffusers.DiffusionPipeline.save_pretrained.safe_serialization",description:`<strong>safe_serialization</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether to save the model using <code>safetensors</code> or the traditional PyTorch way with <code>pickle</code>.`,name:"safe_serialization"},{anchor:"diffusers.DiffusionPipeline.save_pretrained.variant",description:`<strong>variant</strong> (<code>str</code>, <em>optional</em>) — | |
| If specified, weights are saved in the format <code>pytorch_model.<variant>.bin</code>.`,name:"variant"},{anchor:"diffusers.DiffusionPipeline.save_pretrained.push_to_hub",description:`<strong>push_to_hub</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) — | |
| Whether or not to push your model to the Hugging Face model hub after saving it. You can specify the | |
| repository you want to push to with <code>repo_id</code> (will default to the name of <code>save_directory</code> in your | |
| namespace).`,name:"push_to_hub"},{anchor:"diffusers.DiffusionPipeline.save_pretrained.kwargs",description:`<strong>kwargs</strong> (<code>Dict[str, Any]</code>, <em>optional</em>) — | |
| Additional keyword arguments passed along to the <a href="/docs/diffusers/main/en/api/pipelines/overview#diffusers.utils.PushToHubMixin.push_to_hub">push_to_hub()</a> method.`,name:"kwargs"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/pipeline_utils.py#L560"}}),{c(){d=a("meta"),b=f(),c=a("h1"),p=a("a"),g=a("span"),w(n.$$.fragment),u=f(),Z=a("span"),E=s("Pipelines"),j=f(),G=a("p"),W=s("The "),I=a("a"),Oe=s("DiffusionPipeline"),Qe=s(" is the quickest way to load any pretrained diffusion pipeline from the "),Y=a("a"),xt=s("Hub"),Tt=s(" for inference."),Qo=f(),w(O.$$.fragment),Ko=f(),V=a("p"),Mt=s("The pipeline type (for example "),Ke=a("a"),Pt=s("StableDiffusionPipeline"),Dt=s(") of any diffusion pipeline loaded with "),eo=a("a"),jt=s("from_pretrained()"),Ut=s(` is automatically | |
| detected and pipeline components are loaded and passed to the `),lo=a("code"),Et=s("__init__"),Zt=s(" function of the pipeline."),et=f(),Q=a("p"),Gt=s("Any pipeline object can be saved locally with "),oo=a("a"),It=s("save_pretrained()"),Jt=s("."),ot=f(),L=a("h2"),K=a("a"),co=a("span"),w($e.$$.fragment),kt=f(),po=a("span"),Wt=s("DiffusionPipeline"),tt=f(),h=a("div"),w(xe.$$.fragment),Nt=f(),fo=a("p"),Ct=s("Base class for all pipelines."),Vt=f(),to=a("p"),no=a("a"),Bt=s("DiffusionPipeline"),Ft=s(` stores all components (models, schedulers, and processors) for diffusion pipelines and | |
| provides methods for loading, downloading and saving models. It also includes methods to:`),St=f(),Te=a("ul"),mo=a("li"),Rt=s("move all PyTorch modules to the device of your choice"),Xt=f(),uo=a("li"),At=s("enable/disable the progress bar for the denoising iteration"),Yt=f(),ho=a("p"),zt=s("Class attributes:"),qt=f(),Me=a("ul"),ee=a("li"),go=a("strong"),Lt=s("config_name"),Ht=s(" ("),_o=a("code"),Ot=s("str"),Qt=s(`) \u2014 The configuration filename that stores the class and module names of all the | |
| diffusion pipeline\u2019s components.`),Kt=f(),oe=a("li"),bo=a("strong"),en=s("_optional_components"),on=s(" ("),yo=a("code"),tn=s("List[str]"),nn=s(`) \u2014 List of all optional components that don\u2019t have to be passed to the | |
| pipeline to function (should be overridden by subclasses).`),sn=f(),te=a("div"),w(Pe.$$.fragment),an=f(),vo=a("p"),rn=s("Call self as a function."),ln=f(),so=a("div"),w(De.$$.fragment),dn=f(),io=a("div"),w(je.$$.fragment),cn=f(),B=a("div"),w(Ue.$$.fragment),pn=f(),Ee=a("p"),fn=s("The "),wo=a("code"),mn=s("self.components"),un=s(` property can be useful to run different pipelines with the same weights and | |
| configurations without reallocating additional memory.`),hn=f(),Ze=a("p"),gn=s("Returns ("),$o=a("code"),_n=s("dict"),bn=s(`): | |
| A dictionary containing all the modules needed to initialize the pipeline.`),yn=f(),w(ne.$$.fragment),vn=f(),se=a("div"),w(Ge.$$.fragment),wn=f(),Ie=a("p"),$n=s("Disable sliced attention computation. If "),xo=a("code"),xn=s("enable_attention_slicing"),Tn=s(` was previously called, attention is | |
| computed in one step.`),Mn=f(),ie=a("div"),w(Je.$$.fragment),Pn=f(),ke=a("p"),Dn=s("Disable memory efficient attention from "),We=a("a"),jn=s("xFormers"),Un=s("."),En=f(),z=a("div"),w(Ne.$$.fragment),Zn=f(),To=a("p"),Gn=s("Download and cache a PyTorch diffusion pipeline from pretrained pipeline weights."),In=f(),w(ae.$$.fragment),Jn=f(),F=a("div"),w(Ce.$$.fragment),kn=f(),Mo=a("p"),Wn=s(`Enable sliced attention computation. When this option is enabled, the attention module splits the input tensor | |
| in slices to compute attention in several steps. For more than one attention head, the computation is performed | |
| sequentially over each head. This is useful to save some memory in exchange for a small speed decrease.`),Nn=f(),w(re.$$.fragment),Cn=f(),w(le.$$.fragment),Vn=f(),de=a("div"),w(Ve.$$.fragment),Bn=f(),C=a("p"),Fn=s(`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared | |
| to `),Po=a("code"),Sn=s("enable_sequential_cpu_offload"),Rn=s(", this method moves one whole model at a time to the GPU when its "),Do=a("code"),Xn=s("forward"),An=s(` | |
| method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with | |
| `),jo=a("code"),Yn=s("enable_sequential_cpu_offload"),zn=s(", but performance is much better due to the iterative execution of the "),Uo=a("code"),qn=s("unet"),Ln=s("."),Hn=f(),ce=a("div"),w(Be.$$.fragment),On=f(),N=a("p"),Qn=s(`Offloads all models to CPU using \u{1F917} Accelerate, significantly reducing memory usage. When called, the state | |
| dicts of all `),Eo=a("code"),Kn=s("torch.nn.Module"),es=s(" components (except those in "),Zo=a("code"),os=s("self._exclude_from_cpu_offload"),ts=s(`) are saved to CPU | |
| and then moved to `),Go=a("code"),ns=s("torch.device('meta')"),ss=s(" and loaded to GPU only when their specific submodule has its "),Io=a("code"),is=s("forward"),as=s(` | |
| method called. Offloading happens on a submodule basis. Memory savings are higher than with | |
| `),Jo=a("code"),rs=s("enable_model_cpu_offload"),ls=s(", but performance is lower."),ds=f(),S=a("div"),w(Fe.$$.fragment),cs=f(),Se=a("p"),ps=s("Enable memory efficient attention from "),Re=a("a"),fs=s("xFormers"),ms=s(`. When this | |
| option is enabled, you should observe lower GPU memory usage and a potential speed up during inference. Speed | |
| up during training is not guaranteed.`),us=f(),w(pe.$$.fragment),hs=f(),w(fe.$$.fragment),gs=f(),J=a("div"),w(Xe.$$.fragment),_s=f(),ko=a("p"),bs=s("Instantiate a PyTorch diffusion pipeline from pretrained pipeline weights."),ys=f(),Ae=a("p"),vs=s("The pipeline is set in evaluation mode ("),Wo=a("code"),ws=s("model.eval()"),$s=s(") by default."),xs=f(),w(me.$$.fragment),Ts=f(),w(ue.$$.fragment),Ms=f(),w(he.$$.fragment),Ps=f(),ge=a("div"),w(Ye.$$.fragment),Ds=f(),No=a("p"),js=s("TODO: Better doc string"),Us=f(),_e=a("div"),w(ze.$$.fragment),Es=f(),Co=a("p"),Zs=s("Convert a NumPy image or a batch of images to a PIL image."),Gs=f(),be=a("div"),w(qe.$$.fragment),Is=f(),Le=a("p"),Js=s(`Save all saveable variables of the pipeline to a directory. A pipeline variable can be saved and loaded if its | |
| class implements both a save and loading method. The pipeline is easily reloaded using the | |
| `),ao=a("a"),ks=s("from_pretrained()"),Ws=s(" class method."),this.h()},l(t){const v=Pi('[data-svelte="svelte-1phssyn"]',document.head);d=r(v,"META",{name:!0,content:!0}),v.forEach(o),b=m(t),c=r(t,"H1",{class:!0});var He=l(c);p=r(He,"A",{id:!0,class:!0,href:!0});var Vo=l(p);g=r(Vo,"SPAN",{});var Bo=l(g);$(n.$$.fragment,Bo),Bo.forEach(o),Vo.forEach(o),u=m(He),Z=r(He,"SPAN",{});var Fo=l(Z);E=i(Fo,"Pipelines"),Fo.forEach(o),He.forEach(o),j=m(t),G=r(t,"P",{});var H=l(G);W=i(H,"The "),I=r(H,"A",{href:!0});var So=l(I);Oe=i(So,"DiffusionPipeline"),So.forEach(o),Qe=i(H," is the quickest way to load any pretrained diffusion pipeline from the "),Y=r(H,"A",{href:!0,rel:!0});var Ro=l(Y);xt=i(Ro,"Hub"),Ro.forEach(o),Tt=i(H," for inference."),H.forEach(o),Qo=m(t),$(O.$$.fragment,t),Ko=m(t),V=r(t,"P",{});var A=l(V);Mt=i(A,"The pipeline type (for example "),Ke=r(A,"A",{href:!0});var Xo=l(Ke);Pt=i(Xo,"StableDiffusionPipeline"),Xo.forEach(o),Dt=i(A,") of any diffusion pipeline loaded with "),eo=r(A,"A",{href:!0});var Ao=l(eo);jt=i(Ao,"from_pretrained()"),Ao.forEach(o),Ut=i(A,` is automatically | |
| detected and pipeline components are loaded and passed to the `),lo=r(A,"CODE",{});var Cs=l(lo);Et=i(Cs,"__init__"),Cs.forEach(o),Zt=i(A," function of the pipeline."),A.forEach(o),et=m(t),Q=r(t,"P",{});var st=l(Q);Gt=i(st,"Any pipeline object can be saved locally with "),oo=r(st,"A",{href:!0});var Vs=l(oo);It=i(Vs,"save_pretrained()"),Vs.forEach(o),Jt=i(st,"."),st.forEach(o),ot=m(t),L=r(t,"H2",{class:!0});var it=l(L);K=r(it,"A",{id:!0,class:!0,href:!0});var Bs=l(K);co=r(Bs,"SPAN",{});var Fs=l(co);$($e.$$.fragment,Fs),Fs.forEach(o),Bs.forEach(o),kt=m(it),po=r(it,"SPAN",{});var Ss=l(po);Wt=i(Ss,"DiffusionPipeline"),Ss.forEach(o),it.forEach(o),tt=m(t),h=r(t,"DIV",{class:!0});var y=l(h);$(xe.$$.fragment,y),Nt=m(y),fo=r(y,"P",{});var Rs=l(fo);Ct=i(Rs,"Base class for all pipelines."),Rs.forEach(o),Vt=m(y),to=r(y,"P",{});var Ns=l(to);no=r(Ns,"A",{href:!0});var Xs=l(no);Bt=i(Xs,"DiffusionPipeline"),Xs.forEach(o),Ft=i(Ns,` stores all components (models, schedulers, and processors) for diffusion pipelines and | |
| provides methods for loading, downloading and saving models. It also includes methods to:`),Ns.forEach(o),St=m(y),Te=r(y,"UL",{});var at=l(Te);mo=r(at,"LI",{});var As=l(mo);Rt=i(As,"move all PyTorch modules to the device of your choice"),As.forEach(o),Xt=m(at),uo=r(at,"LI",{});var Ys=l(uo);At=i(Ys,"enable/disable the progress bar for the denoising iteration"),Ys.forEach(o),at.forEach(o),Yt=m(y),ho=r(y,"P",{});var zs=l(ho);zt=i(zs,"Class attributes:"),zs.forEach(o),qt=m(y),Me=r(y,"UL",{});var rt=l(Me);ee=r(rt,"LI",{});var Yo=l(ee);go=r(Yo,"STRONG",{});var qs=l(go);Lt=i(qs,"config_name"),qs.forEach(o),Ht=i(Yo," ("),_o=r(Yo,"CODE",{});var Ls=l(_o);Ot=i(Ls,"str"),Ls.forEach(o),Qt=i(Yo,`) \u2014 The configuration filename that stores the class and module names of all the | |
| diffusion pipeline\u2019s components.`),Yo.forEach(o),Kt=m(rt),oe=r(rt,"LI",{});var zo=l(oe);bo=r(zo,"STRONG",{});var Hs=l(bo);en=i(Hs,"_optional_components"),Hs.forEach(o),on=i(zo," ("),yo=r(zo,"CODE",{});var Os=l(yo);tn=i(Os,"List[str]"),Os.forEach(o),nn=i(zo,`) \u2014 List of all optional components that don\u2019t have to be passed to the | |
| pipeline to function (should be overridden by subclasses).`),zo.forEach(o),rt.forEach(o),sn=m(y),te=r(y,"DIV",{class:!0});var lt=l(te);$(Pe.$$.fragment,lt),an=m(lt),vo=r(lt,"P",{});var Qs=l(vo);rn=i(Qs,"Call self as a function."),Qs.forEach(o),lt.forEach(o),ln=m(y),so=r(y,"DIV",{class:!0});var Ks=l(so);$(De.$$.fragment,Ks),Ks.forEach(o),dn=m(y),io=r(y,"DIV",{class:!0});var ei=l(io);$(je.$$.fragment,ei),ei.forEach(o),cn=m(y),B=r(y,"DIV",{class:!0});var ye=l(B);$(Ue.$$.fragment,ye),pn=m(ye),Ee=r(ye,"P",{});var dt=l(Ee);fn=i(dt,"The "),wo=r(dt,"CODE",{});var oi=l(wo);mn=i(oi,"self.components"),oi.forEach(o),un=i(dt,` property can be useful to run different pipelines with the same weights and | |
| configurations without reallocating additional memory.`),dt.forEach(o),hn=m(ye),Ze=r(ye,"P",{});var ct=l(Ze);gn=i(ct,"Returns ("),$o=r(ct,"CODE",{});var ti=l($o);_n=i(ti,"dict"),ti.forEach(o),bn=i(ct,`): | |
| A dictionary containing all the modules needed to initialize the pipeline.`),ct.forEach(o),yn=m(ye),$(ne.$$.fragment,ye),ye.forEach(o),vn=m(y),se=r(y,"DIV",{class:!0});var pt=l(se);$(Ge.$$.fragment,pt),wn=m(pt),Ie=r(pt,"P",{});var ft=l(Ie);$n=i(ft,"Disable sliced attention computation. If "),xo=r(ft,"CODE",{});var ni=l(xo);xn=i(ni,"enable_attention_slicing"),ni.forEach(o),Tn=i(ft,` was previously called, attention is | |
| computed in one step.`),ft.forEach(o),pt.forEach(o),Mn=m(y),ie=r(y,"DIV",{class:!0});var mt=l(ie);$(Je.$$.fragment,mt),Pn=m(mt),ke=r(mt,"P",{});var ut=l(ke);Dn=i(ut,"Disable memory efficient attention from "),We=r(ut,"A",{href:!0,rel:!0});var si=l(We);jn=i(si,"xFormers"),si.forEach(o),Un=i(ut,"."),ut.forEach(o),mt.forEach(o),En=m(y),z=r(y,"DIV",{class:!0});var ro=l(z);$(Ne.$$.fragment,ro),Zn=m(ro),To=r(ro,"P",{});var ii=l(To);Gn=i(ii,"Download and cache a PyTorch diffusion pipeline from pretrained pipeline weights."),ii.forEach(o),In=m(ro),$(ae.$$.fragment,ro),ro.forEach(o),Jn=m(y),F=r(y,"DIV",{class:!0});var ve=l(F);$(Ce.$$.fragment,ve),kn=m(ve),Mo=r(ve,"P",{});var ai=l(Mo);Wn=i(ai,`Enable sliced attention computation. When this option is enabled, the attention module splits the input tensor | |
| in slices to compute attention in several steps. For more than one attention head, the computation is performed | |
| sequentially over each head. This is useful to save some memory in exchange for a small speed decrease.`),ai.forEach(o),Nn=m(ve),$(re.$$.fragment,ve),Cn=m(ve),$(le.$$.fragment,ve),ve.forEach(o),Vn=m(y),de=r(y,"DIV",{class:!0});var ht=l(de);$(Ve.$$.fragment,ht),Bn=m(ht),C=r(ht,"P",{});var q=l(C);Fn=i(q,`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared | |
| to `),Po=r(q,"CODE",{});var ri=l(Po);Sn=i(ri,"enable_sequential_cpu_offload"),ri.forEach(o),Rn=i(q,", this method moves one whole model at a time to the GPU when its "),Do=r(q,"CODE",{});var li=l(Do);Xn=i(li,"forward"),li.forEach(o),An=i(q,` | |
| method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with | |
| `),jo=r(q,"CODE",{});var di=l(jo);Yn=i(di,"enable_sequential_cpu_offload"),di.forEach(o),zn=i(q,", but performance is much better due to the iterative execution of the "),Uo=r(q,"CODE",{});var ci=l(Uo);qn=i(ci,"unet"),ci.forEach(o),Ln=i(q,"."),q.forEach(o),ht.forEach(o),Hn=m(y),ce=r(y,"DIV",{class:!0});var gt=l(ce);$(Be.$$.fragment,gt),On=m(gt),N=r(gt,"P",{});var R=l(N);Qn=i(R,`Offloads all models to CPU using \u{1F917} Accelerate, significantly reducing memory usage. When called, the state | |
| dicts of all `),Eo=r(R,"CODE",{});var pi=l(Eo);Kn=i(pi,"torch.nn.Module"),pi.forEach(o),es=i(R," components (except those in "),Zo=r(R,"CODE",{});var fi=l(Zo);os=i(fi,"self._exclude_from_cpu_offload"),fi.forEach(o),ts=i(R,`) are saved to CPU | |
| and then moved to `),Go=r(R,"CODE",{});var mi=l(Go);ns=i(mi,"torch.device('meta')"),mi.forEach(o),ss=i(R," and loaded to GPU only when their specific submodule has its "),Io=r(R,"CODE",{});var ui=l(Io);is=i(ui,"forward"),ui.forEach(o),as=i(R,` | |
| method called. Offloading happens on a submodule basis. Memory savings are higher than with | |
| `),Jo=r(R,"CODE",{});var hi=l(Jo);rs=i(hi,"enable_model_cpu_offload"),hi.forEach(o),ls=i(R,", but performance is lower."),R.forEach(o),gt.forEach(o),ds=m(y),S=r(y,"DIV",{class:!0});var we=l(S);$(Fe.$$.fragment,we),cs=m(we),Se=r(we,"P",{});var _t=l(Se);ps=i(_t,"Enable memory efficient attention from "),Re=r(_t,"A",{href:!0,rel:!0});var gi=l(Re);fs=i(gi,"xFormers"),gi.forEach(o),ms=i(_t,`. When this | |
| option is enabled, you should observe lower GPU memory usage and a potential speed up during inference. Speed | |
| up during training is not guaranteed.`),_t.forEach(o),us=m(we),$(pe.$$.fragment,we),hs=m(we),$(fe.$$.fragment,we),we.forEach(o),gs=m(y),J=r(y,"DIV",{class:!0});var X=l(J);$(Xe.$$.fragment,X),_s=m(X),ko=r(X,"P",{});var _i=l(ko);bs=i(_i,"Instantiate a PyTorch diffusion pipeline from pretrained pipeline weights."),_i.forEach(o),ys=m(X),Ae=r(X,"P",{});var bt=l(Ae);vs=i(bt,"The pipeline is set in evaluation mode ("),Wo=r(bt,"CODE",{});var bi=l(Wo);ws=i(bi,"model.eval()"),bi.forEach(o),$s=i(bt,") by default."),bt.forEach(o),xs=m(X),$(me.$$.fragment,X),Ts=m(X),$(ue.$$.fragment,X),Ms=m(X),$(he.$$.fragment,X),X.forEach(o),Ps=m(y),ge=r(y,"DIV",{class:!0});var yt=l(ge);$(Ye.$$.fragment,yt),Ds=m(yt),No=r(yt,"P",{});var yi=l(No);js=i(yi,"TODO: Better doc string"),yi.forEach(o),yt.forEach(o),Us=m(y),_e=r(y,"DIV",{class:!0});var vt=l(_e);$(ze.$$.fragment,vt),Es=m(vt),Co=r(vt,"P",{});var vi=l(Co);Zs=i(vi,"Convert a NumPy image or a batch of images to a PIL image."),vi.forEach(o),vt.forEach(o),Gs=m(y),be=r(y,"DIV",{class:!0});var wt=l(be);$(qe.$$.fragment,wt),Is=m(wt),Le=r(wt,"P",{});var $t=l(Le);Js=i($t,`Save all saveable variables of the pipeline to a directory. A pipeline variable can be saved and loaded if its | |
| class implements both a save and loading method. The pipeline is easily reloaded using the | |
| `),ao=r($t,"A",{href:!0});var wi=l(ao);ks=i(wi,"from_pretrained()"),wi.forEach(o),Ws=i($t," class method."),$t.forEach(o),wt.forEach(o),y.forEach(o),this.h()},h(){_(d,"name","hf:doc:metadata"),_(d,"content",JSON.stringify(Vi)),_(p,"id","pipelines"),_(p,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),_(p,"href","#pipelines"),_(c,"class","relative group"),_(I,"href","/docs/diffusers/main/en/api/pipelines/overview#diffusers.DiffusionPipeline"),_(Y,"href","https://huggingface.co/models?library=diffusers"),_(Y,"rel","nofollow"),_(Ke,"href","/docs/diffusers/main/en/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline"),_(eo,"href","/docs/diffusers/main/en/api/pipelines/overview#diffusers.DiffusionPipeline.from_pretrained"),_(oo,"href","/docs/diffusers/main/en/api/pipelines/overview#diffusers.DiffusionPipeline.save_pretrained"),_(K,"id","diffusers.DiffusionPipeline"),_(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"),_(K,"href","#diffusers.DiffusionPipeline"),_(L,"class","relative group"),_(no,"href","/docs/diffusers/main/en/api/pipelines/overview#diffusers.DiffusionPipeline"),_(te,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),_(so,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),_(io,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),_(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),_(se,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),_(We,"href","https://facebookresearch.github.io/xformers/"),_(We,"rel","nofollow"),_(ie,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),_(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),_(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),_(de,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),_(ce,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),_(Re,"href","https://facebookresearch.github.io/xformers/"),_(Re,"rel","nofollow"),_(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),_(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),_(ge,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),_(_e,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),_(ao,"href","/docs/diffusers/main/en/api/pipelines/overview#diffusers.DiffusionPipeline.from_pretrained"),_(be,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),_(h,"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,v){e(document.head,d),D(t,b,v),D(t,c,v),e(c,p),e(p,g),x(n,g,null),e(c,u),e(c,Z),e(Z,E),D(t,j,v),D(t,G,v),e(G,W),e(G,I),e(I,Oe),e(G,Qe),e(G,Y),e(Y,xt),e(G,Tt),D(t,Qo,v),x(O,t,v),D(t,Ko,v),D(t,V,v),e(V,Mt),e(V,Ke),e(Ke,Pt),e(V,Dt),e(V,eo),e(eo,jt),e(V,Ut),e(V,lo),e(lo,Et),e(V,Zt),D(t,et,v),D(t,Q,v),e(Q,Gt),e(Q,oo),e(oo,It),e(Q,Jt),D(t,ot,v),D(t,L,v),e(L,K),e(K,co),x($e,co,null),e(L,kt),e(L,po),e(po,Wt),D(t,tt,v),D(t,h,v),x(xe,h,null),e(h,Nt),e(h,fo),e(fo,Ct),e(h,Vt),e(h,to),e(to,no),e(no,Bt),e(to,Ft),e(h,St),e(h,Te),e(Te,mo),e(mo,Rt),e(Te,Xt),e(Te,uo),e(uo,At),e(h,Yt),e(h,ho),e(ho,zt),e(h,qt),e(h,Me),e(Me,ee),e(ee,go),e(go,Lt),e(ee,Ht),e(ee,_o),e(_o,Ot),e(ee,Qt),e(Me,Kt),e(Me,oe),e(oe,bo),e(bo,en),e(oe,on),e(oe,yo),e(yo,tn),e(oe,nn),e(h,sn),e(h,te),x(Pe,te,null),e(te,an),e(te,vo),e(vo,rn),e(h,ln),e(h,so),x(De,so,null),e(h,dn),e(h,io),x(je,io,null),e(h,cn),e(h,B),x(Ue,B,null),e(B,pn),e(B,Ee),e(Ee,fn),e(Ee,wo),e(wo,mn),e(Ee,un),e(B,hn),e(B,Ze),e(Ze,gn),e(Ze,$o),e($o,_n),e(Ze,bn),e(B,yn),x(ne,B,null),e(h,vn),e(h,se),x(Ge,se,null),e(se,wn),e(se,Ie),e(Ie,$n),e(Ie,xo),e(xo,xn),e(Ie,Tn),e(h,Mn),e(h,ie),x(Je,ie,null),e(ie,Pn),e(ie,ke),e(ke,Dn),e(ke,We),e(We,jn),e(ke,Un),e(h,En),e(h,z),x(Ne,z,null),e(z,Zn),e(z,To),e(To,Gn),e(z,In),x(ae,z,null),e(h,Jn),e(h,F),x(Ce,F,null),e(F,kn),e(F,Mo),e(Mo,Wn),e(F,Nn),x(re,F,null),e(F,Cn),x(le,F,null),e(h,Vn),e(h,de),x(Ve,de,null),e(de,Bn),e(de,C),e(C,Fn),e(C,Po),e(Po,Sn),e(C,Rn),e(C,Do),e(Do,Xn),e(C,An),e(C,jo),e(jo,Yn),e(C,zn),e(C,Uo),e(Uo,qn),e(C,Ln),e(h,Hn),e(h,ce),x(Be,ce,null),e(ce,On),e(ce,N),e(N,Qn),e(N,Eo),e(Eo,Kn),e(N,es),e(N,Zo),e(Zo,os),e(N,ts),e(N,Go),e(Go,ns),e(N,ss),e(N,Io),e(Io,is),e(N,as),e(N,Jo),e(Jo,rs),e(N,ls),e(h,ds),e(h,S),x(Fe,S,null),e(S,cs),e(S,Se),e(Se,ps),e(Se,Re),e(Re,fs),e(Se,ms),e(S,us),x(pe,S,null),e(S,hs),x(fe,S,null),e(h,gs),e(h,J),x(Xe,J,null),e(J,_s),e(J,ko),e(ko,bs),e(J,ys),e(J,Ae),e(Ae,vs),e(Ae,Wo),e(Wo,ws),e(Ae,$s),e(J,xs),x(me,J,null),e(J,Ts),x(ue,J,null),e(J,Ms),x(he,J,null),e(h,Ps),e(h,ge),x(Ye,ge,null),e(ge,Ds),e(ge,No),e(No,js),e(h,Us),e(h,_e),x(ze,_e,null),e(_e,Es),e(_e,Co),e(Co,Zs),e(h,Gs),e(h,be),x(qe,be,null),e(be,Is),e(be,Le),e(Le,Js),e(Le,ao),e(ao,ks),e(Le,Ws),nt=!0},p(t,[v]){const He={};v&2&&(He.$$scope={dirty:v,ctx:t}),O.$set(He);const Vo={};v&2&&(Vo.$$scope={dirty:v,ctx:t}),ne.$set(Vo);const Bo={};v&2&&(Bo.$$scope={dirty:v,ctx:t}),ae.$set(Bo);const Fo={};v&2&&(Fo.$$scope={dirty:v,ctx:t}),re.$set(Fo);const H={};v&2&&(H.$$scope={dirty:v,ctx:t}),le.$set(H);const So={};v&2&&(So.$$scope={dirty:v,ctx:t}),pe.$set(So);const Ro={};v&2&&(Ro.$$scope={dirty:v,ctx:t}),fe.$set(Ro);const A={};v&2&&(A.$$scope={dirty:v,ctx:t}),me.$set(A);const Xo={};v&2&&(Xo.$$scope={dirty:v,ctx:t}),ue.$set(Xo);const Ao={};v&2&&(Ao.$$scope={dirty:v,ctx:t}),he.$set(Ao)},i(t){nt||(T(n.$$.fragment,t),T(O.$$.fragment,t),T($e.$$.fragment,t),T(xe.$$.fragment,t),T(Pe.$$.fragment,t),T(De.$$.fragment,t),T(je.$$.fragment,t),T(Ue.$$.fragment,t),T(ne.$$.fragment,t),T(Ge.$$.fragment,t),T(Je.$$.fragment,t),T(Ne.$$.fragment,t),T(ae.$$.fragment,t),T(Ce.$$.fragment,t),T(re.$$.fragment,t),T(le.$$.fragment,t),T(Ve.$$.fragment,t),T(Be.$$.fragment,t),T(Fe.$$.fragment,t),T(pe.$$.fragment,t),T(fe.$$.fragment,t),T(Xe.$$.fragment,t),T(me.$$.fragment,t),T(ue.$$.fragment,t),T(he.$$.fragment,t),T(Ye.$$.fragment,t),T(ze.$$.fragment,t),T(qe.$$.fragment,t),nt=!0)},o(t){M(n.$$.fragment,t),M(O.$$.fragment,t),M($e.$$.fragment,t),M(xe.$$.fragment,t),M(Pe.$$.fragment,t),M(De.$$.fragment,t),M(je.$$.fragment,t),M(Ue.$$.fragment,t),M(ne.$$.fragment,t),M(Ge.$$.fragment,t),M(Je.$$.fragment,t),M(Ne.$$.fragment,t),M(ae.$$.fragment,t),M(Ce.$$.fragment,t),M(re.$$.fragment,t),M(le.$$.fragment,t),M(Ve.$$.fragment,t),M(Be.$$.fragment,t),M(Fe.$$.fragment,t),M(pe.$$.fragment,t),M(fe.$$.fragment,t),M(Xe.$$.fragment,t),M(me.$$.fragment,t),M(ue.$$.fragment,t),M(he.$$.fragment,t),M(Ye.$$.fragment,t),M(ze.$$.fragment,t),M(qe.$$.fragment,t),nt=!1},d(t){o(d),t&&o(b),t&&o(c),P(n),t&&o(j),t&&o(G),t&&o(Qo),P(O,t),t&&o(Ko),t&&o(V),t&&o(et),t&&o(Q),t&&o(ot),t&&o(L),P($e),t&&o(tt),t&&o(h),P(xe),P(Pe),P(De),P(je),P(Ue),P(ne),P(Ge),P(Je),P(Ne),P(ae),P(Ce),P(re),P(le),P(Ve),P(Be),P(Fe),P(pe),P(fe),P(Xe),P(me),P(ue),P(he),P(Ye),P(ze),P(qe)}}}const Vi={local:"pipelines",sections:[{local:"diffusers.DiffusionPipeline",title:"DiffusionPipeline"}],title:"Pipelines"};function Bi(U){return Di(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class zi extends xi{constructor(d){super();Ti(this,d,Bi,Ci,Mi,{})}}export{zi as default,Vi as metadata}; | |
Xet Storage Details
- Size:
- 67 kB
- Xet hash:
- 6988600ea07f8e21f7747b64793e65199d92f8718b3dcd4d799a571fda51bad9
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.