Buckets:
| import{S as Ur,i as Tr,s as Jr,e as s,k as f,w as y,t as r,a1 as jr,M as kr,c as n,d as o,m as h,a as i,x as _,h as l,a2 as Zr,b,G as e,g as U,y as v,q as w,o as x,B as $,v as Gr,L as oe}from"../../../chunks/vendor-hf-doc-builder.js";import{T as $r}from"../../../chunks/Tip-hf-doc-builder.js";import{D as E}from"../../../chunks/Docstring-hf-doc-builder.js";import{C as ae}from"../../../chunks/CodeBlock-hf-doc-builder.js";import{I as Qo}from"../../../chunks/IconCopyLink-hf-doc-builder.js";import{E as te}from"../../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Er(J){let d,g;return{c(){d=s("p"),g=r(`\u26A0\uFE0F When memory efficient attention and sliced attention are both enabled, memory efficient attention takes | |
| precedent.`)},l(p){d=n(p,"P",{});var c=i(d);g=l(c,`\u26A0\uFE0F When memory efficient attention and sliced attention are both enabled, memory efficient attention takes | |
| precedent.`),c.forEach(o)},m(p,c){U(p,d,c),e(d,g)},d(p){p&&o(d)}}}function Fr(J){let d,g,p,c,u;return c=new ae({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwVU5ldDJEQ29uZGl0aW9uTW9kZWwlMEFmcm9tJTIweGZvcm1lcnMub3BzJTIwaW1wb3J0JTIwTWVtb3J5RWZmaWNpZW50QXR0ZW50aW9uRmxhc2hBdHRlbnRpb25PcCUwQSUwQW1vZGVsJTIwJTNEJTIwVU5ldDJEQ29uZGl0aW9uTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMnN0YWJpbGl0eWFpJTJGc3RhYmxlLWRpZmZ1c2lvbi0yLTElMjIlMkMlMjBzdWJmb2xkZXIlM0QlMjJ1bmV0JTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTBBKSUwQW1vZGVsJTIwJTNEJTIwbW9kZWwudG8oJTIyY3VkYSUyMiklMEFtb2RlbC5lbmFibGVfeGZvcm1lcnNfbWVtb3J5X2VmZmljaWVudF9hdHRlbnRpb24oYXR0ZW50aW9uX29wJTNETWVtb3J5RWZmaWNpZW50QXR0ZW50aW9uRmxhc2hBdHRlbnRpb25PcCk=",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> UNet2DConditionModel | |
| <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>model = UNet2DConditionModel.from_pretrained( | |
| <span class="hljs-meta">... </span> <span class="hljs-string">"stabilityai/stable-diffusion-2-1"</span>, subfolder=<span class="hljs-string">"unet"</span>, torch_dtype=torch.float16 | |
| <span class="hljs-meta">... </span>) | |
| <span class="hljs-meta">>>> </span>model = model.to(<span class="hljs-string">"cuda"</span>) | |
| <span class="hljs-meta">>>> </span>model.enable_xformers_memory_efficient_attention(attention_op=MemoryEfficientAttentionFlashAttentionOp)`}}),{c(){d=s("p"),g=r("Examples:"),p=f(),y(c.$$.fragment)},l(t){d=n(t,"P",{});var m=i(d);g=l(m,"Examples:"),m.forEach(o),p=h(t),_(c.$$.fragment,t)},m(t,m){U(t,d,m),e(d,g),U(t,p,m),v(c,t,m),u=!0},p:oe,i(t){u||(w(c.$$.fragment,t),u=!0)},o(t){x(c.$$.fragment,t),u=!1},d(t){t&&o(d),t&&o(p),$(c,t)}}}function Ir(J){let d,g,p,c,u,t,m,se,Y,fe,V;return{c(){d=s("p"),g=r("To use private or "),p=s("a"),c=r("gated models"),u=r(`, log-in with | |
| `),t=s("code"),m=r("huggingface-cli login"),se=r(`. You can also activate the special | |
| `),Y=s("a"),fe=r("\u201Coffline-mode\u201D"),V=r(` to use this method in a | |
| firewalled environment.`),this.h()},l(ne){d=n(ne,"P",{});var F=i(d);g=l(F,"To use private or "),p=n(F,"A",{href:!0,rel:!0});var jo=i(p);c=l(jo,"gated models"),jo.forEach(o),u=l(F,`, log-in with | |
| `),t=n(F,"CODE",{});var Ce=i(t);m=l(Ce,"huggingface-cli login"),Ce.forEach(o),se=l(F,`. You can also activate the special | |
| `),Y=n(F,"A",{href:!0,rel:!0});var Ve=i(Y);fe=l(Ve,"\u201Coffline-mode\u201D"),Ve.forEach(o),V=l(F,` to use this method in a | |
| firewalled environment.`),F.forEach(o),this.h()},h(){b(p,"href","https://huggingface.co/docs/hub/models-gated#gated-models"),b(p,"rel","nofollow"),b(Y,"href","https://huggingface.co/diffusers/installation.html#offline-mode"),b(Y,"rel","nofollow")},m(ne,F){U(ne,d,F),e(d,g),e(d,p),e(p,c),e(d,u),e(d,t),e(t,m),e(d,se),e(d,Y),e(Y,fe),e(d,V)},d(ne){ne&&o(d)}}}function Wr(J){let d,g,p,c,u;return c=new ae({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFVOZXQyRENvbmRpdGlvbk1vZGVsJTBBJTBBdW5ldCUyMCUzRCUyMFVOZXQyRENvbmRpdGlvbk1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJydW53YXltbCUyRnN0YWJsZS1kaWZmdXNpb24tdjEtNSUyMiUyQyUyMHN1YmZvbGRlciUzRCUyMnVuZXQlMjIp",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> UNet2DConditionModel | |
| unet = UNet2DConditionModel.from_pretrained(<span class="hljs-string">"runwayml/stable-diffusion-v1-5"</span>, subfolder=<span class="hljs-string">"unet"</span>)`}}),{c(){d=s("p"),g=r("Example:"),p=f(),y(c.$$.fragment)},l(t){d=n(t,"P",{});var m=i(d);g=l(m,"Example:"),m.forEach(o),p=h(t),_(c.$$.fragment,t)},m(t,m){U(t,d,m),e(d,g),U(t,p,m),v(c,t,m),u=!0},p:oe,i(t){u||(w(c.$$.fragment,t),u=!0)},o(t){x(c.$$.fragment,t),u=!1},d(t){t&&o(d),t&&o(p),$(c,t)}}}function Br(J){let d,g,p,c,u;return c=new ae({props:{code:"U29tZSUyMHdlaWdodHMlMjBvZiUyMFVOZXQyRENvbmRpdGlvbk1vZGVsJTIwd2VyZSUyMG5vdCUyMGluaXRpYWxpemVkJTIwZnJvbSUyMHRoZSUyMG1vZGVsJTIwY2hlY2twb2ludCUyMGF0JTIwcnVud2F5bWwlMkZzdGFibGUtZGlmZnVzaW9uLXYxLTUlMjBhbmQlMjBhcmUlMjBuZXdseSUyMGluaXRpYWxpemVkJTIwYmVjYXVzZSUyMHRoZSUyMHNoYXBlcyUyMGRpZCUyMG5vdCUyMG1hdGNoJTNBJTBBLSUyMGNvbnZfaW4ud2VpZ2h0JTNBJTIwZm91bmQlMjBzaGFwZSUyMHRvcmNoLlNpemUoJTVCMzIwJTJDJTIwNCUyQyUyMDMlMkMlMjAzJTVEKSUyMGluJTIwdGhlJTIwY2hlY2twb2ludCUyMGFuZCUyMHRvcmNoLlNpemUoJTVCMzIwJTJDJTIwOSUyQyUyMDMlMkMlMjAzJTVEKSUyMGluJTIwdGhlJTIwbW9kZWwlMjBpbnN0YW50aWF0ZWQlMEFZb3UlMjBzaG91bGQlMjBwcm9iYWJseSUyMFRSQUlOJTIwdGhpcyUyMG1vZGVsJTIwb24lMjBhJTIwZG93bi1zdHJlYW0lMjB0YXNrJTIwdG8lMjBiZSUyMGFibGUlMjB0byUyMHVzZSUyMGl0JTIwZm9yJTIwcHJlZGljdGlvbnMlMjBhbmQlMjBpbmZlcmVuY2Uu",highlighted:`Some weights of UNet2DConditionModel were not initialized from the model checkpoint at runwayml/stable-diffusion-v1-5 and are newly initialized because the shapes did not match: | |
| - conv_in.weight: found shape torch.Size([320, 4, 3, 3]) <span class="hljs-keyword">in</span> the checkpoint and torch.Size([320, 9, 3, 3]) <span class="hljs-keyword">in</span> the model instantiated | |
| You should probably TRAIN this model on a down-stream task to be able to use it <span class="hljs-keyword">for</span> predictions and inference.`}}),{c(){d=s("p"),g=r("If you get the error message below, you need to finetune the weights for your downstream task:"),p=f(),y(c.$$.fragment)},l(t){d=n(t,"P",{});var m=i(d);g=l(m,"If you get the error message below, you need to finetune the weights for your downstream task:"),m.forEach(o),p=h(t),_(c.$$.fragment,t)},m(t,m){U(t,d,m),e(d,g),U(t,p,m),v(c,t,m),u=!0},p:oe,i(t){u||(w(c.$$.fragment,t),u=!0)},o(t){x(c.$$.fragment,t),u=!1},d(t){t&&o(d),t&&o(p),$(c,t)}}}function Cr(J){let d,g,p,c,u;return c=new ae({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFVOZXQyRENvbmRpdGlvbk1vZGVsJTBBJTBBbW9kZWxfaWQlMjAlM0QlMjAlMjJydW53YXltbCUyRnN0YWJsZS1kaWZmdXNpb24tdjEtNSUyMiUwQXVuZXQlMjAlM0QlMjBVTmV0MkRDb25kaXRpb25Nb2RlbC5mcm9tX3ByZXRyYWluZWQobW9kZWxfaWQlMkMlMjBzdWJmb2xkZXIlM0QlMjJ1bmV0JTIyKSUwQXVuZXQubnVtX3BhcmFtZXRlcnMob25seV90cmFpbmFibGUlM0RUcnVlKSUwQTg1OTUyMDk2NA==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> UNet2DConditionModel | |
| model_id = <span class="hljs-string">"runwayml/stable-diffusion-v1-5"</span> | |
| unet = UNet2DConditionModel.from_pretrained(model_id, subfolder=<span class="hljs-string">"unet"</span>) | |
| unet.num_parameters(only_trainable=<span class="hljs-literal">True</span>) | |
| <span class="hljs-number">859520964</span>`}}),{c(){d=s("p"),g=r("Example:"),p=f(),y(c.$$.fragment)},l(t){d=n(t,"P",{});var m=i(d);g=l(m,"Example:"),m.forEach(o),p=h(t),_(c.$$.fragment,t)},m(t,m){U(t,d,m),e(d,g),U(t,p,m),v(c,t,m),u=!0},p:oe,i(t){u||(w(c.$$.fragment,t),u=!0)},o(t){x(c.$$.fragment,t),u=!1},d(t){t&&o(d),t&&o(p),$(c,t)}}}function Vr(J){let d,g,p,c,u;return c=new ae({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEZsYXhVTmV0MkRDb25kaXRpb25Nb2RlbCUwQSUwQSUyMyUyMERvd25sb2FkJTIwbW9kZWwlMjBhbmQlMjBjb25maWd1cmF0aW9uJTIwZnJvbSUyMGh1Z2dpbmdmYWNlLmNvJTIwYW5kJTIwY2FjaGUuJTBBbW9kZWwlMkMlMjBwYXJhbXMlMjAlM0QlMjBGbGF4VU5ldDJEQ29uZGl0aW9uTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMnJ1bndheW1sJTJGc3RhYmxlLWRpZmZ1c2lvbi12MS01JTIyKSUwQSUyMyUyME1vZGVsJTIwd2FzJTIwc2F2ZWQlMjB1c2luZyUyMCpzYXZlX3ByZXRyYWluZWQoJy4lMkZ0ZXN0JTJGc2F2ZWRfbW9kZWwlMkYnKSolMjAoZm9yJTIwZXhhbXBsZSUyMHB1cnBvc2VzJTJDJTIwbm90JTIwcnVubmFibGUpLiUwQW1vZGVsJTJDJTIwcGFyYW1zJTIwJTNEJTIwRmxheFVOZXQyRENvbmRpdGlvbk1vZGVsLmZyb21fcHJldHJhaW5lZCglMjIuJTJGdGVzdCUyRnNhdmVkX21vZGVsJTJGJTIyKQ==",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> FlaxUNet2DConditionModel | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Download model and configuration from huggingface.co and cache.</span> | |
| <span class="hljs-meta">>>> </span>model, params = FlaxUNet2DConditionModel.from_pretrained(<span class="hljs-string">"runwayml/stable-diffusion-v1-5"</span>) | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Model was saved using *save_pretrained('./test/saved_model/')* (for example purposes, not runnable).</span> | |
| <span class="hljs-meta">>>> </span>model, params = FlaxUNet2DConditionModel.from_pretrained(<span class="hljs-string">"./test/saved_model/"</span>)`}}),{c(){d=s("p"),g=r("Examples:"),p=f(),y(c.$$.fragment)},l(t){d=n(t,"P",{});var m=i(d);g=l(m,"Examples:"),m.forEach(o),p=h(t),_(c.$$.fragment,t)},m(t,m){U(t,d,m),e(d,g),U(t,p,m),v(c,t,m),u=!0},p:oe,i(t){u||(w(c.$$.fragment,t),u=!0)},o(t){x(c.$$.fragment,t),u=!1},d(t){t&&o(d),t&&o(p),$(c,t)}}}function Rr(J){let d,g,p,c,u;return c=new ae({props:{code:"U29tZSUyMHdlaWdodHMlMjBvZiUyMFVOZXQyRENvbmRpdGlvbk1vZGVsJTIwd2VyZSUyMG5vdCUyMGluaXRpYWxpemVkJTIwZnJvbSUyMHRoZSUyMG1vZGVsJTIwY2hlY2twb2ludCUyMGF0JTIwcnVud2F5bWwlMkZzdGFibGUtZGlmZnVzaW9uLXYxLTUlMjBhbmQlMjBhcmUlMjBuZXdseSUyMGluaXRpYWxpemVkJTIwYmVjYXVzZSUyMHRoZSUyMHNoYXBlcyUyMGRpZCUyMG5vdCUyMG1hdGNoJTNBJTBBLSUyMGNvbnZfaW4ud2VpZ2h0JTNBJTIwZm91bmQlMjBzaGFwZSUyMHRvcmNoLlNpemUoJTVCMzIwJTJDJTIwNCUyQyUyMDMlMkMlMjAzJTVEKSUyMGluJTIwdGhlJTIwY2hlY2twb2ludCUyMGFuZCUyMHRvcmNoLlNpemUoJTVCMzIwJTJDJTIwOSUyQyUyMDMlMkMlMjAzJTVEKSUyMGluJTIwdGhlJTIwbW9kZWwlMjBpbnN0YW50aWF0ZWQlMEFZb3UlMjBzaG91bGQlMjBwcm9iYWJseSUyMFRSQUlOJTIwdGhpcyUyMG1vZGVsJTIwb24lMjBhJTIwZG93bi1zdHJlYW0lMjB0YXNrJTIwdG8lMjBiZSUyMGFibGUlMjB0byUyMHVzZSUyMGl0JTIwZm9yJTIwcHJlZGljdGlvbnMlMjBhbmQlMjBpbmZlcmVuY2Uu",highlighted:`Some weights of UNet2DConditionModel were not initialized from the model checkpoint at runwayml/stable-diffusion-v1-5 and are newly initialized because the shapes did not match: | |
| - conv_in.weight: found shape torch.Size([320, 4, 3, 3]) <span class="hljs-keyword">in</span> the checkpoint and torch.Size([320, 9, 3, 3]) <span class="hljs-keyword">in</span> the model instantiated | |
| You should probably TRAIN this model on a down-stream task to be able to use it <span class="hljs-keyword">for</span> predictions and inference.`}}),{c(){d=s("p"),g=r("If you get the error message below, you need to finetune the weights for your downstream task:"),p=f(),y(c.$$.fragment)},l(t){d=n(t,"P",{});var m=i(d);g=l(m,"If you get the error message below, you need to finetune the weights for your downstream task:"),m.forEach(o),p=h(t),_(c.$$.fragment,t)},m(t,m){U(t,d,m),e(d,g),U(t,p,m),v(c,t,m),u=!0},p:oe,i(t){u||(w(c.$$.fragment,t),u=!0)},o(t){x(c.$$.fragment,t),u=!1},d(t){t&&o(d),t&&o(p),$(c,t)}}}function Nr(J){let d,g,p,c,u;return c=new ae({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEZsYXhVTmV0MkRDb25kaXRpb25Nb2RlbCUwQSUwQSUyMyUyMGxvYWQlMjBtb2RlbCUwQW1vZGVsJTJDJTIwcGFyYW1zJTIwJTNEJTIwRmxheFVOZXQyRENvbmRpdGlvbk1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJydW53YXltbCUyRnN0YWJsZS1kaWZmdXNpb24tdjEtNSUyMiklMEElMjMlMjBCeSUyMGRlZmF1bHQlMkMlMjB0aGUlMjBtb2RlbCUyMHBhcmFtZXRlcnMlMjB3aWxsJTIwYmUlMjBpbiUyMGZwMzIlMjBwcmVjaXNpb24lMkMlMjB0byUyMGNhc3QlMjB0aGVzZSUyMHRvJTIwYmZsb2F0MTYlMjBwcmVjaXNpb24lMEFwYXJhbXMlMjAlM0QlMjBtb2RlbC50b19iZjE2KHBhcmFtcyklMEElMjMlMjBJZiUyMHlvdSUyMGRvbid0JTIwd2FudCUyMHRvJTIwY2FzdCUyMGNlcnRhaW4lMjBwYXJhbWV0ZXJzJTIwKGZvciUyMGV4YW1wbGUlMjBsYXllciUyMG5vcm0lMjBiaWFzJTIwYW5kJTIwc2NhbGUpJTBBJTIzJTIwdGhlbiUyMHBhc3MlMjB0aGUlMjBtYXNrJTIwYXMlMjBmb2xsb3dzJTBBZnJvbSUyMGZsYXglMjBpbXBvcnQlMjB0cmF2ZXJzZV91dGlsJTBBJTBBbW9kZWwlMkMlMjBwYXJhbXMlMjAlM0QlMjBGbGF4VU5ldDJEQ29uZGl0aW9uTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMnJ1bndheW1sJTJGc3RhYmxlLWRpZmZ1c2lvbi12MS01JTIyKSUwQWZsYXRfcGFyYW1zJTIwJTNEJTIwdHJhdmVyc2VfdXRpbC5mbGF0dGVuX2RpY3QocGFyYW1zKSUwQW1hc2slMjAlM0QlMjAlN0IlMEElMjAlMjAlMjAlMjBwYXRoJTNBJTIwKHBhdGglNUItMiU1RCUyMCElM0QlMjAoJTIyTGF5ZXJOb3JtJTIyJTJDJTIwJTIyYmlhcyUyMiklMjBhbmQlMjBwYXRoJTVCLTIlM0ElNUQlMjAhJTNEJTIwKCUyMkxheWVyTm9ybSUyMiUyQyUyMCUyMnNjYWxlJTIyKSklMEElMjAlMjAlMjAlMjBmb3IlMjBwYXRoJTIwaW4lMjBmbGF0X3BhcmFtcyUwQSU3RCUwQW1hc2slMjAlM0QlMjB0cmF2ZXJzZV91dGlsLnVuZmxhdHRlbl9kaWN0KG1hc2spJTBBcGFyYW1zJTIwJTNEJTIwbW9kZWwudG9fYmYxNihwYXJhbXMlMkMlMjBtYXNrKQ==",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> FlaxUNet2DConditionModel | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># load model</span> | |
| <span class="hljs-meta">>>> </span>model, params = FlaxUNet2DConditionModel.from_pretrained(<span class="hljs-string">"runwayml/stable-diffusion-v1-5"</span>) | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># By default, the model parameters will be in fp32 precision, to cast these to bfloat16 precision</span> | |
| <span class="hljs-meta">>>> </span>params = model.to_bf16(params) | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># If you don't want to cast certain parameters (for example layer norm bias and scale)</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># then pass the mask as follows</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> flax <span class="hljs-keyword">import</span> traverse_util | |
| <span class="hljs-meta">>>> </span>model, params = FlaxUNet2DConditionModel.from_pretrained(<span class="hljs-string">"runwayml/stable-diffusion-v1-5"</span>) | |
| <span class="hljs-meta">>>> </span>flat_params = traverse_util.flatten_dict(params) | |
| <span class="hljs-meta">>>> </span>mask = { | |
| <span class="hljs-meta">... </span> path: (path[-<span class="hljs-number">2</span>] != (<span class="hljs-string">"LayerNorm"</span>, <span class="hljs-string">"bias"</span>) <span class="hljs-keyword">and</span> path[-<span class="hljs-number">2</span>:] != (<span class="hljs-string">"LayerNorm"</span>, <span class="hljs-string">"scale"</span>)) | |
| <span class="hljs-meta">... </span> <span class="hljs-keyword">for</span> path <span class="hljs-keyword">in</span> flat_params | |
| <span class="hljs-meta">... </span>} | |
| <span class="hljs-meta">>>> </span>mask = traverse_util.unflatten_dict(mask) | |
| <span class="hljs-meta">>>> </span>params = model.to_bf16(params, mask)`}}),{c(){d=s("p"),g=r("Examples:"),p=f(),y(c.$$.fragment)},l(t){d=n(t,"P",{});var m=i(d);g=l(m,"Examples:"),m.forEach(o),p=h(t),_(c.$$.fragment,t)},m(t,m){U(t,d,m),e(d,g),U(t,p,m),v(c,t,m),u=!0},p:oe,i(t){u||(w(c.$$.fragment,t),u=!0)},o(t){x(c.$$.fragment,t),u=!1},d(t){t&&o(d),t&&o(p),$(c,t)}}}function Xr(J){let d,g,p,c,u;return c=new ae({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEZsYXhVTmV0MkRDb25kaXRpb25Nb2RlbCUwQSUwQSUyMyUyMGxvYWQlMjBtb2RlbCUwQW1vZGVsJTJDJTIwcGFyYW1zJTIwJTNEJTIwRmxheFVOZXQyRENvbmRpdGlvbk1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJydW53YXltbCUyRnN0YWJsZS1kaWZmdXNpb24tdjEtNSUyMiklMEElMjMlMjBCeSUyMGRlZmF1bHQlMkMlMjB0aGUlMjBtb2RlbCUyMHBhcmFtcyUyMHdpbGwlMjBiZSUyMGluJTIwZnAzMiUyQyUyMHRvJTIwY2FzdCUyMHRoZXNlJTIwdG8lMjBmbG9hdDE2JTBBcGFyYW1zJTIwJTNEJTIwbW9kZWwudG9fZnAxNihwYXJhbXMpJTBBJTIzJTIwSWYlMjB5b3UlMjB3YW50JTIwZG9uJ3QlMjB3YW50JTIwdG8lMjBjYXN0JTIwY2VydGFpbiUyMHBhcmFtZXRlcnMlMjAoZm9yJTIwZXhhbXBsZSUyMGxheWVyJTIwbm9ybSUyMGJpYXMlMjBhbmQlMjBzY2FsZSklMEElMjMlMjB0aGVuJTIwcGFzcyUyMHRoZSUyMG1hc2slMjBhcyUyMGZvbGxvd3MlMEFmcm9tJTIwZmxheCUyMGltcG9ydCUyMHRyYXZlcnNlX3V0aWwlMEElMEFtb2RlbCUyQyUyMHBhcmFtcyUyMCUzRCUyMEZsYXhVTmV0MkRDb25kaXRpb25Nb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIycnVud2F5bWwlMkZzdGFibGUtZGlmZnVzaW9uLXYxLTUlMjIpJTBBZmxhdF9wYXJhbXMlMjAlM0QlMjB0cmF2ZXJzZV91dGlsLmZsYXR0ZW5fZGljdChwYXJhbXMpJTBBbWFzayUyMCUzRCUyMCU3QiUwQSUyMCUyMCUyMCUyMHBhdGglM0ElMjAocGF0aCU1Qi0yJTVEJTIwISUzRCUyMCglMjJMYXllck5vcm0lMjIlMkMlMjAlMjJiaWFzJTIyKSUyMGFuZCUyMHBhdGglNUItMiUzQSU1RCUyMCElM0QlMjAoJTIyTGF5ZXJOb3JtJTIyJTJDJTIwJTIyc2NhbGUlMjIpKSUwQSUyMCUyMCUyMCUyMGZvciUyMHBhdGglMjBpbiUyMGZsYXRfcGFyYW1zJTBBJTdEJTBBbWFzayUyMCUzRCUyMHRyYXZlcnNlX3V0aWwudW5mbGF0dGVuX2RpY3QobWFzayklMEFwYXJhbXMlMjAlM0QlMjBtb2RlbC50b19mcDE2KHBhcmFtcyUyQyUyMG1hc2sp",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> FlaxUNet2DConditionModel | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># load model</span> | |
| <span class="hljs-meta">>>> </span>model, params = FlaxUNet2DConditionModel.from_pretrained(<span class="hljs-string">"runwayml/stable-diffusion-v1-5"</span>) | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># By default, the model params will be in fp32, to cast these to float16</span> | |
| <span class="hljs-meta">>>> </span>params = model.to_fp16(params) | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># If you want don't want to cast certain parameters (for example layer norm bias and scale)</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># then pass the mask as follows</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> flax <span class="hljs-keyword">import</span> traverse_util | |
| <span class="hljs-meta">>>> </span>model, params = FlaxUNet2DConditionModel.from_pretrained(<span class="hljs-string">"runwayml/stable-diffusion-v1-5"</span>) | |
| <span class="hljs-meta">>>> </span>flat_params = traverse_util.flatten_dict(params) | |
| <span class="hljs-meta">>>> </span>mask = { | |
| <span class="hljs-meta">... </span> path: (path[-<span class="hljs-number">2</span>] != (<span class="hljs-string">"LayerNorm"</span>, <span class="hljs-string">"bias"</span>) <span class="hljs-keyword">and</span> path[-<span class="hljs-number">2</span>:] != (<span class="hljs-string">"LayerNorm"</span>, <span class="hljs-string">"scale"</span>)) | |
| <span class="hljs-meta">... </span> <span class="hljs-keyword">for</span> path <span class="hljs-keyword">in</span> flat_params | |
| <span class="hljs-meta">... </span>} | |
| <span class="hljs-meta">>>> </span>mask = traverse_util.unflatten_dict(mask) | |
| <span class="hljs-meta">>>> </span>params = model.to_fp16(params, mask)`}}),{c(){d=s("p"),g=r("Examples:"),p=f(),y(c.$$.fragment)},l(t){d=n(t,"P",{});var m=i(d);g=l(m,"Examples:"),m.forEach(o),p=h(t),_(c.$$.fragment,t)},m(t,m){U(t,d,m),e(d,g),U(t,p,m),v(c,t,m),u=!0},p:oe,i(t){u||(w(c.$$.fragment,t),u=!0)},o(t){x(c.$$.fragment,t),u=!1},d(t){t&&o(d),t&&o(p),$(c,t)}}}function Dr(J){let d,g,p,c,u;return c=new ae({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEZsYXhVTmV0MkRDb25kaXRpb25Nb2RlbCUwQSUwQSUyMyUyMERvd25sb2FkJTIwbW9kZWwlMjBhbmQlMjBjb25maWd1cmF0aW9uJTIwZnJvbSUyMGh1Z2dpbmdmYWNlLmNvJTBBbW9kZWwlMkMlMjBwYXJhbXMlMjAlM0QlMjBGbGF4VU5ldDJEQ29uZGl0aW9uTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMnJ1bndheW1sJTJGc3RhYmxlLWRpZmZ1c2lvbi12MS01JTIyKSUwQSUyMyUyMEJ5JTIwZGVmYXVsdCUyQyUyMHRoZSUyMG1vZGVsJTIwcGFyYW1zJTIwd2lsbCUyMGJlJTIwaW4lMjBmcDMyJTJDJTIwdG8lMjBpbGx1c3RyYXRlJTIwdGhlJTIwdXNlJTIwb2YlMjB0aGlzJTIwbWV0aG9kJTJDJTBBJTIzJTIwd2UnbGwlMjBmaXJzdCUyMGNhc3QlMjB0byUyMGZwMTYlMjBhbmQlMjBiYWNrJTIwdG8lMjBmcDMyJTBBcGFyYW1zJTIwJTNEJTIwbW9kZWwudG9fZjE2KHBhcmFtcyklMEElMjMlMjBub3clMjBjYXN0JTIwYmFjayUyMHRvJTIwZnAzMiUwQXBhcmFtcyUyMCUzRCUyMG1vZGVsLnRvX2ZwMzIocGFyYW1zKQ==",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> FlaxUNet2DConditionModel | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Download model and configuration from huggingface.co</span> | |
| <span class="hljs-meta">>>> </span>model, params = FlaxUNet2DConditionModel.from_pretrained(<span class="hljs-string">"runwayml/stable-diffusion-v1-5"</span>) | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># By default, the model params will be in fp32, to illustrate the use of this method,</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># we'll first cast to fp16 and back to fp32</span> | |
| <span class="hljs-meta">>>> </span>params = model.to_f16(params) | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># now cast back to fp32</span> | |
| <span class="hljs-meta">>>> </span>params = model.to_fp32(params)`}}),{c(){d=s("p"),g=r("Examples:"),p=f(),y(c.$$.fragment)},l(t){d=n(t,"P",{});var m=i(d);g=l(m,"Examples:"),m.forEach(o),p=h(t),_(c.$$.fragment,t)},m(t,m){U(t,d,m),e(d,g),U(t,p,m),v(c,t,m),u=!0},p:oe,i(t){u||(w(c.$$.fragment,t),u=!0)},o(t){x(c.$$.fragment,t),u=!1},d(t){t&&o(d),t&&o(p),$(c,t)}}}function Yr(J){let d,g,p,c,u;return c=new ae({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFVOZXQyRENvbmRpdGlvbk1vZGVsJTBBJTBBdW5ldCUyMCUzRCUyMFVOZXQyRENvbmRpdGlvbk1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJzdGFiaWxpdHlhaSUyRnN0YWJsZS1kaWZmdXNpb24tMiUyMiUyQyUyMHN1YmZvbGRlciUzRCUyMnVuZXQlMjIpJTBBJTBBJTIzJTIwUHVzaCUyMHRoZSUyMCU2MHVuZXQlNjAlMjB0byUyMHlvdXIlMjBuYW1lc3BhY2UlMjB3aXRoJTIwdGhlJTIwbmFtZSUyMCUyMm15LWZpbmV0dW5lZC11bmV0JTIyLiUwQXVuZXQucHVzaF90b19odWIoJTIybXktZmluZXR1bmVkLXVuZXQlMjIpJTBBJTBBJTIzJTIwUHVzaCUyMHRoZSUyMCU2MHVuZXQlNjAlMjB0byUyMGFuJTIwb3JnYW5pemF0aW9uJTIwd2l0aCUyMHRoZSUyMG5hbWUlMjAlMjJteS1maW5ldHVuZWQtdW5ldCUyMi4lMEF1bmV0LnB1c2hfdG9faHViKCUyMnlvdXItb3JnJTJGbXktZmluZXR1bmVkLXVuZXQlMjIp",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> UNet2DConditionModel | |
| unet = UNet2DConditionModel.from_pretrained(<span class="hljs-string">"stabilityai/stable-diffusion-2"</span>, subfolder=<span class="hljs-string">"unet"</span>) | |
| <span class="hljs-comment"># Push the \`unet\` to your namespace with the name "my-finetuned-unet".</span> | |
| unet.push_to_hub(<span class="hljs-string">"my-finetuned-unet"</span>) | |
| <span class="hljs-comment"># Push the \`unet\` to an organization with the name "my-finetuned-unet".</span> | |
| unet.push_to_hub(<span class="hljs-string">"your-org/my-finetuned-unet"</span>)`}}),{c(){d=s("p"),g=r("Examples:"),p=f(),y(c.$$.fragment)},l(t){d=n(t,"P",{});var m=i(d);g=l(m,"Examples:"),m.forEach(o),p=h(t),_(c.$$.fragment,t)},m(t,m){U(t,d,m),e(d,g),U(t,p,m),v(c,t,m),u=!0},p:oe,i(t){u||(w(c.$$.fragment,t),u=!0)},o(t){x(c.$$.fragment,t),u=!1},d(t){t&&o(d),t&&o(p),$(c,t)}}}function zr(J){let d,g,p,c,u,t,m,se,Y,fe,V,ne,F,jo='<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>p</mi><mi>\u03B8</mi></msub><mo stretchy="false">(</mo><msub><mi>x</mi><mrow><mi>t</mi><mo>\u2212</mo><mn>1</mn></mrow></msub><mi mathvariant="normal">\u2223</mi><msub><mi>x</mi><mi>t</mi></msub><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">p_{\\theta}(x_{t-1}|x_{t})</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord"><span class="mord mathnormal">p</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3361em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathnormal mtight" style="margin-right:0.02778em;">\u03B8</span></span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mopen">(</span><span class="mord"><span class="mord mathnormal">x</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3011em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathnormal mtight">t</span><span class="mbin mtight">\u2212</span><span class="mord mtight">1</span></span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.2083em;"><span></span></span></span></span></span></span><span class="mord">\u2223</span><span class="mord"><span class="mord mathnormal">x</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.2806em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathnormal mtight">t</span></span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mclose">)</span></span></span></span>',Ce,Ve,S,Po,gt,Ao,qo,Re,Et,Lo,Oo,ko,re,he,Ft,Ne,Ko,It,ea,Zo,T,Xe,ta,Wt,oa,aa,bt,Mt,sa,na,ra,Bt,H,Ct,la,ia,Vt,da,ca,yt,ma,pa,fa,ue,De,ha,le,ua,Rt,ga,ba,Nt,Ma,ya,_a,ge,Ye,va,ze,wa,Se,xa,$a,Ua,be,He,Ta,ie,Ja,Xt,ja,ka,Dt,Za,Ga,Ea,I,Qe,Fa,Pe,Ia,Ae,Wa,Ba,Ca,Yt,Va,Ra,Me,Na,ye,Xa,G,qe,Da,zt,Ya,za,de,Sa,St,Ha,Qa,Ht,Pa,Aa,qa,_e,La,ve,Oa,we,Ka,Q,Le,es,Qt,ts,os,xe,as,$e,Oe,ss,Ke,ns,_t,rs,ls,Go,ce,Ue,Pt,et,is,At,ds,Eo,j,tt,cs,qt,ms,ps,vt,wt,fs,hs,us,Lt,P,Ot,gs,bs,Kt,Ms,ys,xt,_s,vs,ws,R,ot,xs,eo,$s,Us,Te,Ts,Je,Js,je,at,js,st,ks,$t,Zs,Gs,Es,N,nt,Fs,W,Is,to,Ws,Bs,oo,Cs,Vs,ao,Rs,Ns,so,Xs,Ds,Ys,no,zs,Ss,ke,Hs,X,rt,Qs,B,Ps,ro,As,qs,lo,Ls,Os,io,Ks,en,co,tn,on,an,mo,sn,nn,Ze,rn,A,lt,ln,C,dn,po,cn,mn,fo,pn,fn,ho,hn,un,uo,gn,bn,Mn,Ge,Fo,me,Ee,go,it,yn,bo,_n,Io,z,dt,vn,Mo,wn,xn,q,ct,$n,yo,Un,Tn,Fe,Wo;return t=new Qo({}),Ne=new Qo({}),Xe=new E({props:{name:"class diffusers.ModelMixin",anchor:"diffusers.ModelMixin",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/modeling_utils.py#L177"}}),De=new E({props:{name:"disable_gradient_checkpointing",anchor:"diffusers.ModelMixin.disable_gradient_checkpointing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/modeling_utils.py#L228"}}),Ye=new E({props:{name:"disable_xformers_memory_efficient_attention",anchor:"diffusers.ModelMixin.disable_xformers_memory_efficient_attention",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/modeling_utils.py#L289"}}),He=new E({props:{name:"enable_gradient_checkpointing",anchor:"diffusers.ModelMixin.enable_gradient_checkpointing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/modeling_utils.py#L219"}}),Qe=new E({props:{name:"enable_xformers_memory_efficient_attention",anchor:"diffusers.ModelMixin.enable_xformers_memory_efficient_attention",parameters:[{name:"attention_op",val:": typing.Optional[typing.Callable] = None"}],parametersDescription:[{anchor:"diffusers.ModelMixin.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/models/modeling_utils.py#L253"}}),Me=new $r({props:{warning:!0,$$slots:{default:[Er]},$$scope:{ctx:J}}}),ye=new te({props:{anchor:"diffusers.ModelMixin.enable_xformers_memory_efficient_attention.example",$$slots:{default:[Fr]},$$scope:{ctx:J}}}),qe=new E({props:{name:"from_pretrained",anchor:"diffusers.ModelMixin.from_pretrained",parameters:[{name:"pretrained_model_name_or_path",val:": typing.Union[str, os.PathLike, NoneType]"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"diffusers.ModelMixin.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>model id</em> (for example <code>google/ddpm-celebahq-256</code>) of a pretrained model hosted on | |
| the Hub.</li> | |
| <li>A path to a <em>directory</em> (for example <code>./my_model_directory</code>) containing the model weights saved | |
| with <a href="/docs/diffusers/main/en/api/models/overview#diffusers.ModelMixin.save_pretrained">save_pretrained()</a>.</li> | |
| </ul>`,name:"pretrained_model_name_or_path"},{anchor:"diffusers.ModelMixin.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.ModelMixin.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 <code>"auto"</code> is passed, the | |
| dtype is automatically derived from the model’s weights.`,name:"torch_dtype"},{anchor:"diffusers.ModelMixin.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.ModelMixin.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.ModelMixin.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.ModelMixin.from_pretrained.output_loading_info",description:`<strong>output_loading_info</strong> (<code>bool</code>, <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"},{anchor:"diffusers.ModelMixin.from_pretrained.local_files_only(bool,",description:`<strong>local_files_only(<code>bool</code>,</strong> <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(bool,"},{anchor:"diffusers.ModelMixin.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.ModelMixin.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.ModelMixin.from_pretrained.from_flax",description:`<strong>from_flax</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) — | |
| Load the model weights from a Flax checkpoint save file.`,name:"from_flax"},{anchor:"diffusers.ModelMixin.from_pretrained.subfolder",description:`<strong>subfolder</strong> (<code>str</code>, <em>optional</em>, defaults to <code>""</code>) — | |
| The subfolder location of a model file within a larger model repository on the Hub or locally.`,name:"subfolder"},{anchor:"diffusers.ModelMixin.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.ModelMixin.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.ModelMixin.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.ModelMixin.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 <code>device_map</code> contains the value <code>"disk"</code>.`,name:"offload_folder"},{anchor:"diffusers.ModelMixin.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.ModelMixin.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.ModelMixin.from_pretrained.variant",description:`<strong>variant</strong> (<code>str</code>, <em>optional</em>) — | |
| Load weights from a specified <code>variant</code> filename such as <code>"fp16"</code> or <code>"ema"</code>. This is ignored when | |
| loading <code>from_flax</code>.`,name:"variant"},{anchor:"diffusers.ModelMixin.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 <code>safetensors</code> weights are downloaded if they’re available <strong>and</strong> if the | |
| <code>safetensors</code> library is installed. If set to <code>True</code>, the model is forcibly loaded from <code>safetensors</code> | |
| weights. If set to <code>False</code>, <code>safetensors</code> weights are not loaded.`,name:"use_safetensors"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/modeling_utils.py#L378"}}),_e=new $r({props:{$$slots:{default:[Ir]},$$scope:{ctx:J}}}),ve=new te({props:{anchor:"diffusers.ModelMixin.from_pretrained.example",$$slots:{default:[Wr]},$$scope:{ctx:J}}}),we=new te({props:{anchor:"diffusers.ModelMixin.from_pretrained.example-2",$$slots:{default:[Br]},$$scope:{ctx:J}}}),Le=new E({props:{name:"num_parameters",anchor:"diffusers.ModelMixin.num_parameters",parameters:[{name:"only_trainable",val:": bool = False"},{name:"exclude_embeddings",val:": bool = False"}],parametersDescription:[{anchor:"diffusers.ModelMixin.num_parameters.only_trainable",description:`<strong>only_trainable</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) — | |
| Whether or not to return only the number of trainable parameters.`,name:"only_trainable"},{anchor:"diffusers.ModelMixin.num_parameters.exclude_embeddings",description:`<strong>exclude_embeddings</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) — | |
| Whether or not to return only the number of non-embedding parameters.`,name:"exclude_embeddings"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/modeling_utils.py#L877",returnDescription:` | |
| <p>The number of parameters.</p> | |
| `,returnType:` | |
| <p><code>int</code></p> | |
| `}}),xe=new te({props:{anchor:"diffusers.ModelMixin.num_parameters.example",$$slots:{default:[Cr]},$$scope:{ctx:J}}}),Oe=new E({props:{name:"save_pretrained",anchor:"diffusers.ModelMixin.save_pretrained",parameters:[{name:"save_directory",val:": typing.Union[str, os.PathLike]"},{name:"is_main_process",val:": bool = True"},{name:"save_function",val:": typing.Callable = None"},{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.ModelMixin.save_pretrained.save_directory",description:`<strong>save_directory</strong> (<code>str</code> or <code>os.PathLike</code>) — | |
| Directory to save a model and its configuration file to. Will be created if it doesn’t exist.`,name:"save_directory"},{anchor:"diffusers.ModelMixin.save_pretrained.is_main_process",description:`<strong>is_main_process</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether the process calling this is the main process or not. Useful during distributed training and you | |
| need to call this function on all processes. In this case, set <code>is_main_process=True</code> only on the main | |
| process to avoid race conditions.`,name:"is_main_process"},{anchor:"diffusers.ModelMixin.save_pretrained.save_function",description:`<strong>save_function</strong> (<code>Callable</code>) — | |
| The function to use to save the state dictionary. Useful during distributed training when you need to | |
| replace <code>torch.save</code> with another method. Can be configured with the environment variable | |
| <code>DIFFUSERS_SAVE_MODE</code>.`,name:"save_function"},{anchor:"diffusers.ModelMixin.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.ModelMixin.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.ModelMixin.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 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.ModelMixin.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/models/modeling_utils.py#L295"}}),et=new Qo({}),tt=new E({props:{name:"class diffusers.FlaxModelMixin",anchor:"diffusers.FlaxModelMixin",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/modeling_flax_utils.py#L46"}}),ot=new E({props:{name:"from_pretrained",anchor:"diffusers.FlaxModelMixin.from_pretrained",parameters:[{name:"pretrained_model_name_or_path",val:": typing.Union[str, os.PathLike]"},{name:"dtype",val:": dtype = <class 'jax.numpy.float32'>"},{name:"*model_args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"diffusers.FlaxModelMixin.from_pretrained.pretrained_model_name_or_path",description:`<strong>pretrained_model_name_or_path</strong> (<code>str</code> or <code>os.PathLike</code>) — | |
| Can be either:</p> | |
| <ul> | |
| <li>A string, the <em>model id</em> (for example <code>runwayml/stable-diffusion-v1-5</code>) of a pretrained model | |
| hosted on the Hub.</li> | |
| <li>A path to a <em>directory</em> (for example <code>./my_model_directory</code>) containing the model weights saved | |
| using <a href="/docs/diffusers/main/en/api/models/overview#diffusers.FlaxModelMixin.save_pretrained">save_pretrained()</a>.</li> | |
| </ul>`,name:"pretrained_model_name_or_path"},{anchor:"diffusers.FlaxModelMixin.from_pretrained.dtype",description:`<strong>dtype</strong> (<code>jax.numpy.dtype</code>, <em>optional</em>, defaults to <code>jax.numpy.float32</code>) — | |
| The data type of the computation. Can be one of <code>jax.numpy.float32</code>, <code>jax.numpy.float16</code> (on GPUs) and | |
| <code>jax.numpy.bfloat16</code> (on TPUs).</p> | |
| <p>This can be used to enable mixed-precision training or half-precision inference on GPUs or TPUs. If | |
| specified, all the computation will be performed with the given <code>dtype</code>.</p> | |
| <div class="course-tip bg-gradient-to-br dark:bg-gradient-to-r before:border-green-500 dark:before:border-green-800 from-green-50 dark:from-gray-900 to-white dark:to-gray-950 border border-green-50 text-green-700 dark:text-gray-400"> | |
| <p>This only specifies the dtype of the <em>computation</em> and does not influence the dtype of model | |
| parameters.</p> | |
| <p>If you wish to change the dtype of the model parameters, see <a href="/docs/diffusers/main/en/api/models/overview#diffusers.FlaxModelMixin.to_fp16">to_fp16()</a> and | |
| <a href="/docs/diffusers/main/en/api/models/overview#diffusers.FlaxModelMixin.to_bf16">to_bf16()</a>.</p> | |
| </div>`,name:"dtype"},{anchor:"diffusers.FlaxModelMixin.from_pretrained.model_args",description:`<strong>model_args</strong> (sequence of positional arguments, <em>optional</em>) — | |
| All remaining positional arguments are passed to the underlying model’s <code>__init__</code> method.`,name:"model_args"},{anchor:"diffusers.FlaxModelMixin.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.FlaxModelMixin.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.FlaxModelMixin.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.FlaxModelMixin.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.FlaxModelMixin.from_pretrained.local_files_only(bool,",description:`<strong>local_files_only(<code>bool</code>,</strong> <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(bool,"},{anchor:"diffusers.FlaxModelMixin.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.FlaxModelMixin.from_pretrained.from_pt",description:`<strong>from_pt</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) — | |
| Load the model weights from a PyTorch checkpoint save file.`,name:"from_pt"},{anchor:"diffusers.FlaxModelMixin.from_pretrained.kwargs",description:`<strong>kwargs</strong> (remaining dictionary of keyword arguments, <em>optional</em>) — | |
| Can be used to update the configuration object (after it is loaded) and initiate the model (for | |
| example, <code>output_attentions=True</code>). Behaves differently depending on whether a <code>config</code> is provided or | |
| automatically loaded:</p> | |
| <ul> | |
| <li>If a configuration is provided with <code>config</code>, <code>kwargs</code> are directly passed to the underlying | |
| model’s <code>__init__</code> method (we assume all relevant updates to the configuration have already been | |
| done).</li> | |
| <li>If a configuration is not provided, <code>kwargs</code> are first passed to the configuration class | |
| initialization function <a href="/docs/diffusers/main/en/api/configuration#diffusers.ConfigMixin.from_config">from_config()</a>. Each key of the <code>kwargs</code> that corresponds | |
| to a configuration attribute is used to override said attribute with the supplied <code>kwargs</code> value. | |
| Remaining keys that do not correspond to any configuration attribute are passed to the underlying | |
| model’s <code>__init__</code> function.</li> | |
| </ul>`,name:"kwargs"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/modeling_flax_utils.py#L198"}}),Te=new te({props:{anchor:"diffusers.FlaxModelMixin.from_pretrained.example",$$slots:{default:[Vr]},$$scope:{ctx:J}}}),Je=new te({props:{anchor:"diffusers.FlaxModelMixin.from_pretrained.example-2",$$slots:{default:[Rr]},$$scope:{ctx:J}}}),at=new E({props:{name:"save_pretrained",anchor:"diffusers.FlaxModelMixin.save_pretrained",parameters:[{name:"save_directory",val:": typing.Union[str, os.PathLike]"},{name:"params",val:": typing.Union[typing.Dict, flax.core.frozen_dict.FrozenDict]"},{name:"is_main_process",val:": bool = True"},{name:"push_to_hub",val:": bool = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"diffusers.FlaxModelMixin.save_pretrained.save_directory",description:`<strong>save_directory</strong> (<code>str</code> or <code>os.PathLike</code>) — | |
| Directory to save a model and its configuration file to. Will be created if it doesn’t exist.`,name:"save_directory"},{anchor:"diffusers.FlaxModelMixin.save_pretrained.params",description:`<strong>params</strong> (<code>Union[Dict, FrozenDict]</code>) — | |
| A <code>PyTree</code> of model parameters.`,name:"params"},{anchor:"diffusers.FlaxModelMixin.save_pretrained.is_main_process",description:`<strong>is_main_process</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether the process calling this is the main process or not. Useful during distributed training and you | |
| need to call this function on all processes. In this case, set <code>is_main_process=True</code> only on the main | |
| process to avoid race conditions.`,name:"is_main_process"},{anchor:"diffusers.FlaxModelMixin.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.FlaxModelMixin.save_pretrained.kwargs",description:`<strong>kwargs</strong> (<code>Dict[str, Any]</code>, <em>optional</em>) — | |
| Additional key word 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/models/modeling_flax_utils.py#L496"}}),nt=new E({props:{name:"to_bf16",anchor:"diffusers.FlaxModelMixin.to_bf16",parameters:[{name:"params",val:": typing.Union[typing.Dict, flax.core.frozen_dict.FrozenDict]"},{name:"mask",val:": typing.Any = None"}],parametersDescription:[{anchor:"diffusers.FlaxModelMixin.to_bf16.params",description:`<strong>params</strong> (<code>Union[Dict, FrozenDict]</code>) — | |
| A <code>PyTree</code> of model parameters.`,name:"params"},{anchor:"diffusers.FlaxModelMixin.to_bf16.mask",description:`<strong>mask</strong> (<code>Union[Dict, FrozenDict]</code>) — | |
| A <code>PyTree</code> with same structure as the <code>params</code> tree. The leaves should be booleans. It should be <code>True</code> | |
| for params you want to cast, and <code>False</code> for those you want to skip.`,name:"mask"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/modeling_flax_utils.py#L90"}}),ke=new te({props:{anchor:"diffusers.FlaxModelMixin.to_bf16.example",$$slots:{default:[Nr]},$$scope:{ctx:J}}}),rt=new E({props:{name:"to_fp16",anchor:"diffusers.FlaxModelMixin.to_fp16",parameters:[{name:"params",val:": typing.Union[typing.Dict, flax.core.frozen_dict.FrozenDict]"},{name:"mask",val:": typing.Any = None"}],parametersDescription:[{anchor:"diffusers.FlaxModelMixin.to_fp16.params",description:`<strong>params</strong> (<code>Union[Dict, FrozenDict]</code>) — | |
| A <code>PyTree</code> of model parameters.`,name:"params"},{anchor:"diffusers.FlaxModelMixin.to_fp16.mask",description:`<strong>mask</strong> (<code>Union[Dict, FrozenDict]</code>) — | |
| A <code>PyTree</code> with same structure as the <code>params</code> tree. The leaves should be booleans. It should be <code>True</code> | |
| for params you want to cast, and <code>False</code> for those you want to skip.`,name:"mask"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/modeling_flax_utils.py#L156"}}),Ze=new te({props:{anchor:"diffusers.FlaxModelMixin.to_fp16.example",$$slots:{default:[Xr]},$$scope:{ctx:J}}}),lt=new E({props:{name:"to_fp32",anchor:"diffusers.FlaxModelMixin.to_fp32",parameters:[{name:"params",val:": typing.Union[typing.Dict, flax.core.frozen_dict.FrozenDict]"},{name:"mask",val:": typing.Any = None"}],parametersDescription:[{anchor:"diffusers.FlaxModelMixin.to_fp32.params",description:`<strong>params</strong> (<code>Union[Dict, FrozenDict]</code>) — | |
| A <code>PyTree</code> of model parameters.`,name:"params"},{anchor:"diffusers.FlaxModelMixin.to_fp32.mask",description:`<strong>mask</strong> (<code>Union[Dict, FrozenDict]</code>) — | |
| A <code>PyTree</code> with same structure as the <code>params</code> tree. The leaves should be booleans. It should be <code>True</code> | |
| for params you want to cast, and <code>False</code> for those you want to skip.`,name:"mask"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/modeling_flax_utils.py#L129"}}),Ge=new te({props:{anchor:"diffusers.FlaxModelMixin.to_fp32.example",$$slots:{default:[Dr]},$$scope:{ctx:J}}}),it=new Qo({}),dt=new E({props:{name:"class diffusers.utils.PushToHubMixin",anchor:"diffusers.utils.PushToHubMixin",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/utils/hub_utils.py#L373"}}),ct=new E({props:{name:"push_to_hub",anchor:"diffusers.utils.PushToHubMixin.push_to_hub",parameters:[{name:"repo_id",val:": str"},{name:"commit_message",val:": typing.Optional[str] = None"},{name:"private",val:": typing.Optional[bool] = None"},{name:"token",val:": typing.Optional[str] = None"},{name:"create_pr",val:": bool = False"},{name:"safe_serialization",val:": bool = True"},{name:"variant",val:": typing.Optional[str] = None"}],parametersDescription:[{anchor:"diffusers.utils.PushToHubMixin.push_to_hub.repo_id",description:`<strong>repo_id</strong> (<code>str</code>) — | |
| The name of the repository you want to push your model, scheduler, or pipeline files to. It should | |
| contain your organization name when pushing to an organization. <code>repo_id</code> can also be a path to a local | |
| directory.`,name:"repo_id"},{anchor:"diffusers.utils.PushToHubMixin.push_to_hub.commit_message",description:`<strong>commit_message</strong> (<code>str</code>, <em>optional</em>) — | |
| Message to commit while pushing. Default to <code>"Upload {object}"</code>.`,name:"commit_message"},{anchor:"diffusers.utils.PushToHubMixin.push_to_hub.private",description:`<strong>private</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not the repository created should be private.`,name:"private"},{anchor:"diffusers.utils.PushToHubMixin.push_to_hub.token",description:`<strong>token</strong> (<code>str</code>, <em>optional</em>) — | |
| The token to use as HTTP bearer authorization for remote files. The token generated when running | |
| <code>huggingface-cli login</code> (stored in <code>~/.huggingface</code>).`,name:"token"},{anchor:"diffusers.utils.PushToHubMixin.push_to_hub.create_pr",description:`<strong>create_pr</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) — | |
| Whether or not to create a PR with the uploaded files or directly commit.`,name:"create_pr"},{anchor:"diffusers.utils.PushToHubMixin.push_to_hub.safe_serialization",description:`<strong>safe_serialization</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether or not to convert the model weights to the <code>safetensors</code> format.`,name:"safe_serialization"},{anchor:"diffusers.utils.PushToHubMixin.push_to_hub.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"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/utils/hub_utils.py#L402"}}),Fe=new te({props:{anchor:"diffusers.utils.PushToHubMixin.push_to_hub.example",$$slots:{default:[Yr]},$$scope:{ctx:J}}}),{c(){d=s("meta"),g=f(),p=s("h1"),c=s("a"),u=s("span"),y(t.$$.fragment),m=f(),se=s("span"),Y=r("Models"),fe=f(),V=s("p"),ne=r("\u{1F917} Diffusers provides pretrained models for popular algorithms and modules to create custom diffusion systems. The primary function of models is to denoise an input sample as modeled by the distribution "),F=new jr,Ce=r("."),Ve=f(),S=s("p"),Po=r("All models are built from the base "),gt=s("a"),Ao=r("ModelMixin"),qo=r(" class which is a "),Re=s("a"),Et=s("code"),Lo=r("torch.nn.module"),Oo=r(" providing basic functionality for saving and loading models, locally and from the Hugging Face Hub."),ko=f(),re=s("h2"),he=s("a"),Ft=s("span"),y(Ne.$$.fragment),Ko=f(),It=s("span"),ea=r("ModelMixin"),Zo=f(),T=s("div"),y(Xe.$$.fragment),ta=f(),Wt=s("p"),oa=r("Base class for all models."),aa=f(),bt=s("p"),Mt=s("a"),sa=r("ModelMixin"),na=r(` takes care of storing the model configuration and provides methods for loading, downloading and | |
| saving models.`),ra=f(),Bt=s("ul"),H=s("li"),Ct=s("strong"),la=r("config_name"),ia=r(" ("),Vt=s("code"),da=r("str"),ca=r(") \u2014 Filename to save a model to when calling "),yt=s("a"),ma=r("save_pretrained()"),pa=r("."),fa=f(),ue=s("div"),y(De.$$.fragment),ha=f(),le=s("p"),ua=r("Deactivates gradient checkpointing for the current model (may be referred to as "),Rt=s("em"),ga=r("activation checkpointing"),ba=r(` or | |
| `),Nt=s("em"),Ma=r("checkpoint activations"),ya=r(" in other frameworks)."),_a=f(),ge=s("div"),y(Ye.$$.fragment),va=f(),ze=s("p"),wa=r("Disable memory efficient attention from "),Se=s("a"),xa=r("xFormers"),$a=r("."),Ua=f(),be=s("div"),y(He.$$.fragment),Ta=f(),ie=s("p"),Ja=r("Activates gradient checkpointing for the current model (may be referred to as "),Xt=s("em"),ja=r("activation checkpointing"),ka=r(` or | |
| `),Dt=s("em"),Za=r("checkpoint activations"),Ga=r(" in other frameworks)."),Ea=f(),I=s("div"),y(Qe.$$.fragment),Fa=f(),Pe=s("p"),Ia=r("Enable memory efficient attention from "),Ae=s("a"),Wa=r("xFormers"),Ba=r("."),Ca=f(),Yt=s("p"),Va=r(`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.`),Ra=f(),y(Me.$$.fragment),Na=f(),y(ye.$$.fragment),Xa=f(),G=s("div"),y(qe.$$.fragment),Da=f(),zt=s("p"),Ya=r("Instantiate a pretrained PyTorch model from a pretrained model configuration."),za=f(),de=s("p"),Sa=r("The model is set in evaluation mode - "),St=s("code"),Ha=r("model.eval()"),Qa=r(` - by default, and dropout modules are deactivated. To | |
| train the model, set it back in training mode with `),Ht=s("code"),Pa=r("model.train()"),Aa=r("."),qa=f(),y(_e.$$.fragment),La=f(),y(ve.$$.fragment),Oa=f(),y(we.$$.fragment),Ka=f(),Q=s("div"),y(Le.$$.fragment),es=f(),Qt=s("p"),ts=r("Get number of (trainable or non-embedding) parameters in the module."),os=f(),y(xe.$$.fragment),as=f(),$e=s("div"),y(Oe.$$.fragment),ss=f(),Ke=s("p"),ns=r(`Save a model and its configuration file to a directory so that it can be reloaded using the | |
| `),_t=s("a"),rs=r("from_pretrained()"),ls=r(" class method."),Go=f(),ce=s("h2"),Ue=s("a"),Pt=s("span"),y(et.$$.fragment),is=f(),At=s("span"),ds=r("FlaxModelMixin"),Eo=f(),j=s("div"),y(tt.$$.fragment),cs=f(),qt=s("p"),ms=r("Base class for all Flax models."),ps=f(),vt=s("p"),wt=s("a"),fs=r("FlaxModelMixin"),hs=r(` takes care of storing the model configuration and provides methods for loading, downloading and | |
| saving models.`),us=f(),Lt=s("ul"),P=s("li"),Ot=s("strong"),gs=r("config_name"),bs=r(" ("),Kt=s("code"),Ms=r("str"),ys=r(") \u2014 Filename to save a model to when calling "),xt=s("a"),_s=r("save_pretrained()"),vs=r("."),ws=f(),R=s("div"),y(ot.$$.fragment),xs=f(),eo=s("p"),$s=r("Instantiate a pretrained Flax model from a pretrained model configuration."),Us=f(),y(Te.$$.fragment),Ts=f(),y(Je.$$.fragment),Js=f(),je=s("div"),y(at.$$.fragment),js=f(),st=s("p"),ks=r(`Save a model and its configuration file to a directory so that it can be reloaded using the | |
| `),$t=s("a"),Zs=r("from_pretrained()"),Gs=r(" class method."),Es=f(),N=s("div"),y(nt.$$.fragment),Fs=f(),W=s("p"),Is=r("Cast the floating-point "),to=s("code"),Ws=r("params"),Bs=r(" to "),oo=s("code"),Cs=r("jax.numpy.bfloat16"),Vs=r(". This returns a new "),ao=s("code"),Rs=r("params"),Ns=r(` tree and does not cast | |
| the `),so=s("code"),Xs=r("params"),Ds=r(" in place."),Ys=f(),no=s("p"),zs=r(`This method can be used on a TPU to explicitly convert the model parameters to bfloat16 precision to do full | |
| half-precision training or to save weights in bfloat16 for inference in order to save memory and improve speed.`),Ss=f(),y(ke.$$.fragment),Hs=f(),X=s("div"),y(rt.$$.fragment),Qs=f(),B=s("p"),Ps=r("Cast the floating-point "),ro=s("code"),As=r("params"),qs=r(" to "),lo=s("code"),Ls=r("jax.numpy.float16"),Os=r(". This returns a new "),io=s("code"),Ks=r("params"),en=r(` tree and does not cast the | |
| `),co=s("code"),tn=r("params"),on=r(" in place."),an=f(),mo=s("p"),sn=r(`This method can be used on a GPU to explicitly convert the model parameters to float16 precision to do full | |
| half-precision training or to save weights in float16 for inference in order to save memory and improve speed.`),nn=f(),y(Ze.$$.fragment),rn=f(),A=s("div"),y(lt.$$.fragment),ln=f(),C=s("p"),dn=r("Cast the floating-point "),po=s("code"),cn=r("params"),mn=r(" to "),fo=s("code"),pn=r("jax.numpy.float32"),fn=r(`. This method can be used to explicitly convert the | |
| model parameters to fp32 precision. This returns a new `),ho=s("code"),hn=r("params"),un=r(" tree and does not cast the "),uo=s("code"),gn=r("params"),bn=r(" in place."),Mn=f(),y(Ge.$$.fragment),Fo=f(),me=s("h2"),Ee=s("a"),go=s("span"),y(it.$$.fragment),yn=f(),bo=s("span"),_n=r("PushToHubMixin"),Io=f(),z=s("div"),y(dt.$$.fragment),vn=f(),Mo=s("p"),wn=r("A Mixin to push a model, scheduler, or pipeline to the Hugging Face Hub."),xn=f(),q=s("div"),y(ct.$$.fragment),$n=f(),yo=s("p"),Un=r("Upload model, scheduler, or pipeline files to the \u{1F917} Hugging Face Hub."),Tn=f(),y(Fe.$$.fragment),this.h()},l(a){const M=kr('[data-svelte="svelte-1phssyn"]',document.head);d=n(M,"META",{name:!0,content:!0}),M.forEach(o),g=h(a),p=n(a,"H1",{class:!0});var mt=i(p);c=n(mt,"A",{id:!0,class:!0,href:!0});var _o=i(c);u=n(_o,"SPAN",{});var vo=i(u);_(t.$$.fragment,vo),vo.forEach(o),_o.forEach(o),m=h(mt),se=n(mt,"SPAN",{});var wo=i(se);Y=l(wo,"Models"),wo.forEach(o),mt.forEach(o),fe=h(a),V=n(a,"P",{});var pt=i(V);ne=l(pt,"\u{1F917} Diffusers provides pretrained models for popular algorithms and modules to create custom diffusion systems. The primary function of models is to denoise an input sample as modeled by the distribution "),F=Zr(pt),Ce=l(pt,"."),pt.forEach(o),Ve=h(a),S=n(a,"P",{});var pe=i(S);Po=l(pe,"All models are built from the base "),gt=n(pe,"A",{href:!0});var xo=i(gt);Ao=l(xo,"ModelMixin"),xo.forEach(o),qo=l(pe," class which is a "),Re=n(pe,"A",{href:!0,rel:!0});var $o=i(Re);Et=n($o,"CODE",{});var Uo=i(Et);Lo=l(Uo,"torch.nn.module"),Uo.forEach(o),$o.forEach(o),Oo=l(pe," providing basic functionality for saving and loading models, locally and from the Hugging Face Hub."),pe.forEach(o),ko=h(a),re=n(a,"H2",{class:!0});var ft=i(re);he=n(ft,"A",{id:!0,class:!0,href:!0});var To=i(he);Ft=n(To,"SPAN",{});var Jo=i(Ft);_(Ne.$$.fragment,Jo),Jo.forEach(o),To.forEach(o),Ko=h(ft),It=n(ft,"SPAN",{});var kn=i(It);ea=l(kn,"ModelMixin"),kn.forEach(o),ft.forEach(o),Zo=h(a),T=n(a,"DIV",{class:!0});var k=i(T);_(Xe.$$.fragment,k),ta=h(k),Wt=n(k,"P",{});var Zn=i(Wt);oa=l(Zn,"Base class for all models."),Zn.forEach(o),aa=h(k),bt=n(k,"P",{});var Jn=i(bt);Mt=n(Jn,"A",{href:!0});var Gn=i(Mt);sa=l(Gn,"ModelMixin"),Gn.forEach(o),na=l(Jn,` takes care of storing the model configuration and provides methods for loading, downloading and | |
| saving models.`),Jn.forEach(o),ra=h(k),Bt=n(k,"UL",{});var En=i(Bt);H=n(En,"LI",{});var ht=i(H);Ct=n(ht,"STRONG",{});var Fn=i(Ct);la=l(Fn,"config_name"),Fn.forEach(o),ia=l(ht," ("),Vt=n(ht,"CODE",{});var In=i(Vt);da=l(In,"str"),In.forEach(o),ca=l(ht,") \u2014 Filename to save a model to when calling "),yt=n(ht,"A",{href:!0});var Wn=i(yt);ma=l(Wn,"save_pretrained()"),Wn.forEach(o),pa=l(ht,"."),ht.forEach(o),En.forEach(o),fa=h(k),ue=n(k,"DIV",{class:!0});var Bo=i(ue);_(De.$$.fragment,Bo),ha=h(Bo),le=n(Bo,"P",{});var Ut=i(le);ua=l(Ut,"Deactivates gradient checkpointing for the current model (may be referred to as "),Rt=n(Ut,"EM",{});var Bn=i(Rt);ga=l(Bn,"activation checkpointing"),Bn.forEach(o),ba=l(Ut,` or | |
| `),Nt=n(Ut,"EM",{});var Cn=i(Nt);Ma=l(Cn,"checkpoint activations"),Cn.forEach(o),ya=l(Ut," in other frameworks)."),Ut.forEach(o),Bo.forEach(o),_a=h(k),ge=n(k,"DIV",{class:!0});var Co=i(ge);_(Ye.$$.fragment,Co),va=h(Co),ze=n(Co,"P",{});var Vo=i(ze);wa=l(Vo,"Disable memory efficient attention from "),Se=n(Vo,"A",{href:!0,rel:!0});var Vn=i(Se);xa=l(Vn,"xFormers"),Vn.forEach(o),$a=l(Vo,"."),Vo.forEach(o),Co.forEach(o),Ua=h(k),be=n(k,"DIV",{class:!0});var Ro=i(be);_(He.$$.fragment,Ro),Ta=h(Ro),ie=n(Ro,"P",{});var Tt=i(ie);Ja=l(Tt,"Activates gradient checkpointing for the current model (may be referred to as "),Xt=n(Tt,"EM",{});var Rn=i(Xt);ja=l(Rn,"activation checkpointing"),Rn.forEach(o),ka=l(Tt,` or | |
| `),Dt=n(Tt,"EM",{});var Nn=i(Dt);Za=l(Nn,"checkpoint activations"),Nn.forEach(o),Ga=l(Tt," in other frameworks)."),Tt.forEach(o),Ro.forEach(o),Ea=h(k),I=n(k,"DIV",{class:!0});var L=i(I);_(Qe.$$.fragment,L),Fa=h(L),Pe=n(L,"P",{});var No=i(Pe);Ia=l(No,"Enable memory efficient attention from "),Ae=n(No,"A",{href:!0,rel:!0});var Xn=i(Ae);Wa=l(Xn,"xFormers"),Xn.forEach(o),Ba=l(No,"."),No.forEach(o),Ca=h(L),Yt=n(L,"P",{});var Dn=i(Yt);Va=l(Dn,`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.`),Dn.forEach(o),Ra=h(L),_(Me.$$.fragment,L),Na=h(L),_(ye.$$.fragment,L),L.forEach(o),Xa=h(k),G=n(k,"DIV",{class:!0});var D=i(G);_(qe.$$.fragment,D),Da=h(D),zt=n(D,"P",{});var Yn=i(zt);Ya=l(Yn,"Instantiate a pretrained PyTorch model from a pretrained model configuration."),Yn.forEach(o),za=h(D),de=n(D,"P",{});var Jt=i(de);Sa=l(Jt,"The model is set in evaluation mode - "),St=n(Jt,"CODE",{});var zn=i(St);Ha=l(zn,"model.eval()"),zn.forEach(o),Qa=l(Jt,` - by default, and dropout modules are deactivated. To | |
| train the model, set it back in training mode with `),Ht=n(Jt,"CODE",{});var Sn=i(Ht);Pa=l(Sn,"model.train()"),Sn.forEach(o),Aa=l(Jt,"."),Jt.forEach(o),qa=h(D),_(_e.$$.fragment,D),La=h(D),_(ve.$$.fragment,D),Oa=h(D),_(we.$$.fragment,D),D.forEach(o),Ka=h(k),Q=n(k,"DIV",{class:!0});var jt=i(Q);_(Le.$$.fragment,jt),es=h(jt),Qt=n(jt,"P",{});var Hn=i(Qt);ts=l(Hn,"Get number of (trainable or non-embedding) parameters in the module."),Hn.forEach(o),os=h(jt),_(xe.$$.fragment,jt),jt.forEach(o),as=h(k),$e=n(k,"DIV",{class:!0});var Xo=i($e);_(Oe.$$.fragment,Xo),ss=h(Xo),Ke=n(Xo,"P",{});var Do=i(Ke);ns=l(Do,`Save a model and its configuration file to a directory so that it can be reloaded using the | |
| `),_t=n(Do,"A",{href:!0});var Qn=i(_t);rs=l(Qn,"from_pretrained()"),Qn.forEach(o),ls=l(Do," class method."),Do.forEach(o),Xo.forEach(o),k.forEach(o),Go=h(a),ce=n(a,"H2",{class:!0});var Yo=i(ce);Ue=n(Yo,"A",{id:!0,class:!0,href:!0});var Pn=i(Ue);Pt=n(Pn,"SPAN",{});var An=i(Pt);_(et.$$.fragment,An),An.forEach(o),Pn.forEach(o),is=h(Yo),At=n(Yo,"SPAN",{});var qn=i(At);ds=l(qn,"FlaxModelMixin"),qn.forEach(o),Yo.forEach(o),Eo=h(a),j=n(a,"DIV",{class:!0});var Z=i(j);_(tt.$$.fragment,Z),cs=h(Z),qt=n(Z,"P",{});var Ln=i(qt);ms=l(Ln,"Base class for all Flax models."),Ln.forEach(o),ps=h(Z),vt=n(Z,"P",{});var jn=i(vt);wt=n(jn,"A",{href:!0});var On=i(wt);fs=l(On,"FlaxModelMixin"),On.forEach(o),hs=l(jn,` takes care of storing the model configuration and provides methods for loading, downloading and | |
| saving models.`),jn.forEach(o),us=h(Z),Lt=n(Z,"UL",{});var Kn=i(Lt);P=n(Kn,"LI",{});var ut=i(P);Ot=n(ut,"STRONG",{});var er=i(Ot);gs=l(er,"config_name"),er.forEach(o),bs=l(ut," ("),Kt=n(ut,"CODE",{});var tr=i(Kt);Ms=l(tr,"str"),tr.forEach(o),ys=l(ut,") \u2014 Filename to save a model to when calling "),xt=n(ut,"A",{href:!0});var or=i(xt);_s=l(or,"save_pretrained()"),or.forEach(o),vs=l(ut,"."),ut.forEach(o),Kn.forEach(o),ws=h(Z),R=n(Z,"DIV",{class:!0});var Ie=i(R);_(ot.$$.fragment,Ie),xs=h(Ie),eo=n(Ie,"P",{});var ar=i(eo);$s=l(ar,"Instantiate a pretrained Flax model from a pretrained model configuration."),ar.forEach(o),Us=h(Ie),_(Te.$$.fragment,Ie),Ts=h(Ie),_(Je.$$.fragment,Ie),Ie.forEach(o),Js=h(Z),je=n(Z,"DIV",{class:!0});var zo=i(je);_(at.$$.fragment,zo),js=h(zo),st=n(zo,"P",{});var So=i(st);ks=l(So,`Save a model and its configuration file to a directory so that it can be reloaded using the | |
| `),$t=n(So,"A",{href:!0});var sr=i($t);Zs=l(sr,"from_pretrained()"),sr.forEach(o),Gs=l(So," class method."),So.forEach(o),zo.forEach(o),Es=h(Z),N=n(Z,"DIV",{class:!0});var We=i(N);_(nt.$$.fragment,We),Fs=h(We),W=n(We,"P",{});var O=i(W);Is=l(O,"Cast the floating-point "),to=n(O,"CODE",{});var nr=i(to);Ws=l(nr,"params"),nr.forEach(o),Bs=l(O," to "),oo=n(O,"CODE",{});var rr=i(oo);Cs=l(rr,"jax.numpy.bfloat16"),rr.forEach(o),Vs=l(O,". This returns a new "),ao=n(O,"CODE",{});var lr=i(ao);Rs=l(lr,"params"),lr.forEach(o),Ns=l(O,` tree and does not cast | |
| the `),so=n(O,"CODE",{});var ir=i(so);Xs=l(ir,"params"),ir.forEach(o),Ds=l(O," in place."),O.forEach(o),Ys=h(We),no=n(We,"P",{});var dr=i(no);zs=l(dr,`This method can be used on a TPU to explicitly convert the model parameters to bfloat16 precision to do full | |
| half-precision training or to save weights in bfloat16 for inference in order to save memory and improve speed.`),dr.forEach(o),Ss=h(We),_(ke.$$.fragment,We),We.forEach(o),Hs=h(Z),X=n(Z,"DIV",{class:!0});var Be=i(X);_(rt.$$.fragment,Be),Qs=h(Be),B=n(Be,"P",{});var K=i(B);Ps=l(K,"Cast the floating-point "),ro=n(K,"CODE",{});var cr=i(ro);As=l(cr,"params"),cr.forEach(o),qs=l(K," to "),lo=n(K,"CODE",{});var mr=i(lo);Ls=l(mr,"jax.numpy.float16"),mr.forEach(o),Os=l(K,". This returns a new "),io=n(K,"CODE",{});var pr=i(io);Ks=l(pr,"params"),pr.forEach(o),en=l(K,` tree and does not cast the | |
| `),co=n(K,"CODE",{});var fr=i(co);tn=l(fr,"params"),fr.forEach(o),on=l(K," in place."),K.forEach(o),an=h(Be),mo=n(Be,"P",{});var hr=i(mo);sn=l(hr,`This method can be used on a GPU to explicitly convert the model parameters to float16 precision to do full | |
| half-precision training or to save weights in float16 for inference in order to save memory and improve speed.`),hr.forEach(o),nn=h(Be),_(Ze.$$.fragment,Be),Be.forEach(o),rn=h(Z),A=n(Z,"DIV",{class:!0});var kt=i(A);_(lt.$$.fragment,kt),ln=h(kt),C=n(kt,"P",{});var ee=i(C);dn=l(ee,"Cast the floating-point "),po=n(ee,"CODE",{});var ur=i(po);cn=l(ur,"params"),ur.forEach(o),mn=l(ee," to "),fo=n(ee,"CODE",{});var gr=i(fo);pn=l(gr,"jax.numpy.float32"),gr.forEach(o),fn=l(ee,`. This method can be used to explicitly convert the | |
| model parameters to fp32 precision. This returns a new `),ho=n(ee,"CODE",{});var br=i(ho);hn=l(br,"params"),br.forEach(o),un=l(ee," tree and does not cast the "),uo=n(ee,"CODE",{});var Mr=i(uo);gn=l(Mr,"params"),Mr.forEach(o),bn=l(ee," in place."),ee.forEach(o),Mn=h(kt),_(Ge.$$.fragment,kt),kt.forEach(o),Z.forEach(o),Fo=h(a),me=n(a,"H2",{class:!0});var Ho=i(me);Ee=n(Ho,"A",{id:!0,class:!0,href:!0});var yr=i(Ee);go=n(yr,"SPAN",{});var _r=i(go);_(it.$$.fragment,_r),_r.forEach(o),yr.forEach(o),yn=h(Ho),bo=n(Ho,"SPAN",{});var vr=i(bo);_n=l(vr,"PushToHubMixin"),vr.forEach(o),Ho.forEach(o),Io=h(a),z=n(a,"DIV",{class:!0});var Zt=i(z);_(dt.$$.fragment,Zt),vn=h(Zt),Mo=n(Zt,"P",{});var wr=i(Mo);wn=l(wr,"A Mixin to push a model, scheduler, or pipeline to the Hugging Face Hub."),wr.forEach(o),xn=h(Zt),q=n(Zt,"DIV",{class:!0});var Gt=i(q);_(ct.$$.fragment,Gt),$n=h(Gt),yo=n(Gt,"P",{});var xr=i(yo);Un=l(xr,"Upload model, scheduler, or pipeline files to the \u{1F917} Hugging Face Hub."),xr.forEach(o),Tn=h(Gt),_(Fe.$$.fragment,Gt),Gt.forEach(o),Zt.forEach(o),this.h()},h(){b(d,"name","hf:doc:metadata"),b(d,"content",JSON.stringify(Sr)),b(c,"id","models"),b(c,"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"),b(c,"href","#models"),b(p,"class","relative group"),F.a=Ce,b(gt,"href","/docs/diffusers/main/en/api/models/overview#diffusers.ModelMixin"),b(Re,"href","https://pytorch.org/docs/stable/generated/torch.nn.Module.html"),b(Re,"rel","nofollow"),b(he,"id","diffusers.ModelMixin"),b(he,"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"),b(he,"href","#diffusers.ModelMixin"),b(re,"class","relative group"),b(Mt,"href","/docs/diffusers/main/en/api/models/overview#diffusers.ModelMixin"),b(yt,"href","/docs/diffusers/main/en/api/models/overview#diffusers.ModelMixin.save_pretrained"),b(ue,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(Se,"href","https://facebookresearch.github.io/xformers/"),b(Se,"rel","nofollow"),b(ge,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(be,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(Ae,"href","https://facebookresearch.github.io/xformers/"),b(Ae,"rel","nofollow"),b(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(Q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(_t,"href","/docs/diffusers/main/en/api/models/overview#diffusers.ModelMixin.from_pretrained"),b($e,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(T,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(Ue,"id","diffusers.FlaxModelMixin"),b(Ue,"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"),b(Ue,"href","#diffusers.FlaxModelMixin"),b(ce,"class","relative group"),b(wt,"href","/docs/diffusers/main/en/api/models/overview#diffusers.FlaxModelMixin"),b(xt,"href","/docs/diffusers/main/en/api/models/overview#diffusers.FlaxModelMixin.save_pretrained"),b(R,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b($t,"href","/docs/diffusers/main/en/api/models/overview#diffusers.FlaxModelMixin.from_pretrained"),b(je,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(X,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(Ee,"id","diffusers.utils.PushToHubMixin"),b(Ee,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),b(Ee,"href","#diffusers.utils.PushToHubMixin"),b(me,"class","relative group"),b(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(a,M){e(document.head,d),U(a,g,M),U(a,p,M),e(p,c),e(c,u),v(t,u,null),e(p,m),e(p,se),e(se,Y),U(a,fe,M),U(a,V,M),e(V,ne),F.m(jo,V),e(V,Ce),U(a,Ve,M),U(a,S,M),e(S,Po),e(S,gt),e(gt,Ao),e(S,qo),e(S,Re),e(Re,Et),e(Et,Lo),e(S,Oo),U(a,ko,M),U(a,re,M),e(re,he),e(he,Ft),v(Ne,Ft,null),e(re,Ko),e(re,It),e(It,ea),U(a,Zo,M),U(a,T,M),v(Xe,T,null),e(T,ta),e(T,Wt),e(Wt,oa),e(T,aa),e(T,bt),e(bt,Mt),e(Mt,sa),e(bt,na),e(T,ra),e(T,Bt),e(Bt,H),e(H,Ct),e(Ct,la),e(H,ia),e(H,Vt),e(Vt,da),e(H,ca),e(H,yt),e(yt,ma),e(H,pa),e(T,fa),e(T,ue),v(De,ue,null),e(ue,ha),e(ue,le),e(le,ua),e(le,Rt),e(Rt,ga),e(le,ba),e(le,Nt),e(Nt,Ma),e(le,ya),e(T,_a),e(T,ge),v(Ye,ge,null),e(ge,va),e(ge,ze),e(ze,wa),e(ze,Se),e(Se,xa),e(ze,$a),e(T,Ua),e(T,be),v(He,be,null),e(be,Ta),e(be,ie),e(ie,Ja),e(ie,Xt),e(Xt,ja),e(ie,ka),e(ie,Dt),e(Dt,Za),e(ie,Ga),e(T,Ea),e(T,I),v(Qe,I,null),e(I,Fa),e(I,Pe),e(Pe,Ia),e(Pe,Ae),e(Ae,Wa),e(Pe,Ba),e(I,Ca),e(I,Yt),e(Yt,Va),e(I,Ra),v(Me,I,null),e(I,Na),v(ye,I,null),e(T,Xa),e(T,G),v(qe,G,null),e(G,Da),e(G,zt),e(zt,Ya),e(G,za),e(G,de),e(de,Sa),e(de,St),e(St,Ha),e(de,Qa),e(de,Ht),e(Ht,Pa),e(de,Aa),e(G,qa),v(_e,G,null),e(G,La),v(ve,G,null),e(G,Oa),v(we,G,null),e(T,Ka),e(T,Q),v(Le,Q,null),e(Q,es),e(Q,Qt),e(Qt,ts),e(Q,os),v(xe,Q,null),e(T,as),e(T,$e),v(Oe,$e,null),e($e,ss),e($e,Ke),e(Ke,ns),e(Ke,_t),e(_t,rs),e(Ke,ls),U(a,Go,M),U(a,ce,M),e(ce,Ue),e(Ue,Pt),v(et,Pt,null),e(ce,is),e(ce,At),e(At,ds),U(a,Eo,M),U(a,j,M),v(tt,j,null),e(j,cs),e(j,qt),e(qt,ms),e(j,ps),e(j,vt),e(vt,wt),e(wt,fs),e(vt,hs),e(j,us),e(j,Lt),e(Lt,P),e(P,Ot),e(Ot,gs),e(P,bs),e(P,Kt),e(Kt,Ms),e(P,ys),e(P,xt),e(xt,_s),e(P,vs),e(j,ws),e(j,R),v(ot,R,null),e(R,xs),e(R,eo),e(eo,$s),e(R,Us),v(Te,R,null),e(R,Ts),v(Je,R,null),e(j,Js),e(j,je),v(at,je,null),e(je,js),e(je,st),e(st,ks),e(st,$t),e($t,Zs),e(st,Gs),e(j,Es),e(j,N),v(nt,N,null),e(N,Fs),e(N,W),e(W,Is),e(W,to),e(to,Ws),e(W,Bs),e(W,oo),e(oo,Cs),e(W,Vs),e(W,ao),e(ao,Rs),e(W,Ns),e(W,so),e(so,Xs),e(W,Ds),e(N,Ys),e(N,no),e(no,zs),e(N,Ss),v(ke,N,null),e(j,Hs),e(j,X),v(rt,X,null),e(X,Qs),e(X,B),e(B,Ps),e(B,ro),e(ro,As),e(B,qs),e(B,lo),e(lo,Ls),e(B,Os),e(B,io),e(io,Ks),e(B,en),e(B,co),e(co,tn),e(B,on),e(X,an),e(X,mo),e(mo,sn),e(X,nn),v(Ze,X,null),e(j,rn),e(j,A),v(lt,A,null),e(A,ln),e(A,C),e(C,dn),e(C,po),e(po,cn),e(C,mn),e(C,fo),e(fo,pn),e(C,fn),e(C,ho),e(ho,hn),e(C,un),e(C,uo),e(uo,gn),e(C,bn),e(A,Mn),v(Ge,A,null),U(a,Fo,M),U(a,me,M),e(me,Ee),e(Ee,go),v(it,go,null),e(me,yn),e(me,bo),e(bo,_n),U(a,Io,M),U(a,z,M),v(dt,z,null),e(z,vn),e(z,Mo),e(Mo,wn),e(z,xn),e(z,q),v(ct,q,null),e(q,$n),e(q,yo),e(yo,Un),e(q,Tn),v(Fe,q,null),Wo=!0},p(a,[M]){const mt={};M&2&&(mt.$$scope={dirty:M,ctx:a}),Me.$set(mt);const _o={};M&2&&(_o.$$scope={dirty:M,ctx:a}),ye.$set(_o);const vo={};M&2&&(vo.$$scope={dirty:M,ctx:a}),_e.$set(vo);const wo={};M&2&&(wo.$$scope={dirty:M,ctx:a}),ve.$set(wo);const pt={};M&2&&(pt.$$scope={dirty:M,ctx:a}),we.$set(pt);const pe={};M&2&&(pe.$$scope={dirty:M,ctx:a}),xe.$set(pe);const xo={};M&2&&(xo.$$scope={dirty:M,ctx:a}),Te.$set(xo);const $o={};M&2&&($o.$$scope={dirty:M,ctx:a}),Je.$set($o);const Uo={};M&2&&(Uo.$$scope={dirty:M,ctx:a}),ke.$set(Uo);const ft={};M&2&&(ft.$$scope={dirty:M,ctx:a}),Ze.$set(ft);const To={};M&2&&(To.$$scope={dirty:M,ctx:a}),Ge.$set(To);const Jo={};M&2&&(Jo.$$scope={dirty:M,ctx:a}),Fe.$set(Jo)},i(a){Wo||(w(t.$$.fragment,a),w(Ne.$$.fragment,a),w(Xe.$$.fragment,a),w(De.$$.fragment,a),w(Ye.$$.fragment,a),w(He.$$.fragment,a),w(Qe.$$.fragment,a),w(Me.$$.fragment,a),w(ye.$$.fragment,a),w(qe.$$.fragment,a),w(_e.$$.fragment,a),w(ve.$$.fragment,a),w(we.$$.fragment,a),w(Le.$$.fragment,a),w(xe.$$.fragment,a),w(Oe.$$.fragment,a),w(et.$$.fragment,a),w(tt.$$.fragment,a),w(ot.$$.fragment,a),w(Te.$$.fragment,a),w(Je.$$.fragment,a),w(at.$$.fragment,a),w(nt.$$.fragment,a),w(ke.$$.fragment,a),w(rt.$$.fragment,a),w(Ze.$$.fragment,a),w(lt.$$.fragment,a),w(Ge.$$.fragment,a),w(it.$$.fragment,a),w(dt.$$.fragment,a),w(ct.$$.fragment,a),w(Fe.$$.fragment,a),Wo=!0)},o(a){x(t.$$.fragment,a),x(Ne.$$.fragment,a),x(Xe.$$.fragment,a),x(De.$$.fragment,a),x(Ye.$$.fragment,a),x(He.$$.fragment,a),x(Qe.$$.fragment,a),x(Me.$$.fragment,a),x(ye.$$.fragment,a),x(qe.$$.fragment,a),x(_e.$$.fragment,a),x(ve.$$.fragment,a),x(we.$$.fragment,a),x(Le.$$.fragment,a),x(xe.$$.fragment,a),x(Oe.$$.fragment,a),x(et.$$.fragment,a),x(tt.$$.fragment,a),x(ot.$$.fragment,a),x(Te.$$.fragment,a),x(Je.$$.fragment,a),x(at.$$.fragment,a),x(nt.$$.fragment,a),x(ke.$$.fragment,a),x(rt.$$.fragment,a),x(Ze.$$.fragment,a),x(lt.$$.fragment,a),x(Ge.$$.fragment,a),x(it.$$.fragment,a),x(dt.$$.fragment,a),x(ct.$$.fragment,a),x(Fe.$$.fragment,a),Wo=!1},d(a){o(d),a&&o(g),a&&o(p),$(t),a&&o(fe),a&&o(V),a&&o(Ve),a&&o(S),a&&o(ko),a&&o(re),$(Ne),a&&o(Zo),a&&o(T),$(Xe),$(De),$(Ye),$(He),$(Qe),$(Me),$(ye),$(qe),$(_e),$(ve),$(we),$(Le),$(xe),$(Oe),a&&o(Go),a&&o(ce),$(et),a&&o(Eo),a&&o(j),$(tt),$(ot),$(Te),$(Je),$(at),$(nt),$(ke),$(rt),$(Ze),$(lt),$(Ge),a&&o(Fo),a&&o(me),$(it),a&&o(Io),a&&o(z),$(dt),$(ct),$(Fe)}}}const Sr={local:"models",sections:[{local:"diffusers.ModelMixin",title:"ModelMixin"},{local:"diffusers.FlaxModelMixin",title:"FlaxModelMixin"},{local:"diffusers.utils.PushToHubMixin",title:"PushToHubMixin"}],title:"Models"};function Hr(J){return Gr(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Kr extends Ur{constructor(d){super();Tr(this,d,Hr,zr,Jr,{})}}export{Kr as default,Sr as metadata}; | |
Xet Storage Details
- Size:
- 81.6 kB
- Xet hash:
- a77d7fcc54752440c45729b463d599682ef89d751bbea0c9a497edfb24d3d8ae
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.