import{S as wx,i as Mx,s as Tx,e as r,k as i,w as h,t as s,M as $x,c as a,d as t,m as d,a as n,x as p,h as l,b as m,G as e,g as w,y as f,q as u,o as g,B as _,v as xx,L as Xe}from"../../chunks/vendor-hf-doc-builder.js";import{T as Xh}from"../../chunks/Tip-hf-doc-builder.js";import{D as $}from"../../chunks/Docstring-hf-doc-builder.js";import{C as z}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as Re}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Ve}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function kx(F){let v,E,M,y,P;return y=new z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbCUwQSUwQW1vZGVsJTIwJTNEJTIwQXV0b01vZGVsLmZyb21fcHJldHJhaW5lZCglMjJiZXJ0LWJhc2UtY2FzZWQlMjIpJTBBJTBBJTIzJTIwUHVzaCUyMHRoZSUyMG1vZGVsJTIwdG8lMjB5b3VyJTIwbmFtZXNwYWNlJTIwd2l0aCUyMHRoZSUyMG5hbWUlMjAlMjJteS1maW5ldHVuZWQtYmVydCUyMi4lMEFtb2RlbC5wdXNoX3RvX2h1YiglMjJteS1maW5ldHVuZWQtYmVydCUyMiklMEElMEElMjMlMjBQdXNoJTIwdGhlJTIwbW9kZWwlMjB0byUyMGFuJTIwb3JnYW5pemF0aW9uJTIwd2l0aCUyMHRoZSUyMG5hbWUlMjAlMjJteS1maW5ldHVuZWQtYmVydCUyMi4lMEFtb2RlbC5wdXNoX3RvX2h1YiglMjJodWdnaW5nZmFjZSUyRm15LWZpbmV0dW5lZC1iZXJ0JTIyKQ==",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModel

model = AutoModel.from_pretrained(<span class="hljs-string">&quot;bert-base-cased&quot;</span>)

<span class="hljs-comment"># Push the model to your namespace with the name &quot;my-finetuned-bert&quot;.</span>
model.push_to_hub(<span class="hljs-string">&quot;my-finetuned-bert&quot;</span>)

<span class="hljs-comment"># Push the model to an organization with the name &quot;my-finetuned-bert&quot;.</span>
model.push_to_hub(<span class="hljs-string">&quot;huggingface/my-finetuned-bert&quot;</span>)`}}),{c(){v=r("p"),E=s("Examples:"),M=i(),h(y.$$.fragment)},l(c){v=a(c,"P",{});var T=n(v);E=l(T,"Examples:"),T.forEach(t),M=d(c),p(y.$$.fragment,c)},m(c,T){w(c,v,T),e(v,E),w(c,M,T),f(y,c,T),P=!0},p:Xe,i(c){P||(u(y.$$.fragment,c),P=!0)},o(c){g(y.$$.fragment,c),P=!1},d(c){c&&t(v),c&&t(M),_(y,c)}}}function Ex(F){let v,E,M,y,P;return{c(){v=r("p"),E=s("Activate the special "),M=r("a"),y=s("\u201Coffline-mode\u201D"),P=s(` to
use this method in a firewalled environment.`),this.h()},l(c){v=a(c,"P",{});var T=n(v);E=l(T,"Activate the special "),M=a(T,"A",{href:!0,rel:!0});var ct=n(M);y=l(ct,"\u201Coffline-mode\u201D"),ct.forEach(t),P=l(T,` to
use this method in a firewalled environment.`),T.forEach(t),this.h()},h(){m(M,"href","https://huggingface.co/transformers/installation.html#offline-mode"),m(M,"rel","nofollow")},m(c,T){w(c,v,T),e(v,E),e(v,M),e(M,y),e(v,P)},d(c){c&&t(v)}}}function Px(F){let v,E,M,y,P;return y=new z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEJlcnRDb25maWclMkMlMjBCZXJ0TW9kZWwlMEElMEElMjMlMjBEb3dubG9hZCUyMG1vZGVsJTIwYW5kJTIwY29uZmlndXJhdGlvbiUyMGZyb20lMjBodWdnaW5nZmFjZS5jbyUyMGFuZCUyMGNhY2hlLiUwQW1vZGVsJTIwJTNEJTIwQmVydE1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJiZXJ0LWJhc2UtdW5jYXNlZCUyMiklMEElMjMlMjBNb2RlbCUyMHdhcyUyMHNhdmVkJTIwdXNpbmclMjAqc2F2ZV9wcmV0cmFpbmVkKCcuJTJGdGVzdCUyRnNhdmVkX21vZGVsJTJGJykqJTIwKGZvciUyMGV4YW1wbGUlMjBwdXJwb3NlcyUyQyUyMG5vdCUyMHJ1bm5hYmxlKS4lMEFtb2RlbCUyMCUzRCUyMEJlcnRNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyLiUyRnRlc3QlMkZzYXZlZF9tb2RlbCUyRiUyMiklMEElMjMlMjBVcGRhdGUlMjBjb25maWd1cmF0aW9uJTIwZHVyaW5nJTIwbG9hZGluZy4lMEFtb2RlbCUyMCUzRCUyMEJlcnRNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyYmVydC1iYXNlLXVuY2FzZWQlMjIlMkMlMjBvdXRwdXRfYXR0ZW50aW9ucyUzRFRydWUpJTBBYXNzZXJ0JTIwbW9kZWwuY29uZmlnLm91dHB1dF9hdHRlbnRpb25zJTIwJTNEJTNEJTIwVHJ1ZSUwQSUyMyUyMExvYWRpbmclMjBmcm9tJTIwYSUyMFRGJTIwY2hlY2twb2ludCUyMGZpbGUlMjBpbnN0ZWFkJTIwb2YlMjBhJTIwUHlUb3JjaCUyMG1vZGVsJTIwKHNsb3dlciUyQyUyMGZvciUyMGV4YW1wbGUlMjBwdXJwb3NlcyUyQyUyMG5vdCUyMHJ1bm5hYmxlKS4lMEFjb25maWclMjAlM0QlMjBCZXJ0Q29uZmlnLmZyb21fanNvbl9maWxlKCUyMi4lMkZ0Zl9tb2RlbCUyRm15X3RmX21vZGVsX2NvbmZpZy5qc29uJTIyKSUwQW1vZGVsJTIwJTNEJTIwQmVydE1vZGVsLmZyb21fcHJldHJhaW5lZCglMjIuJTJGdGZfbW9kZWwlMkZteV90Zl9jaGVja3BvaW50LmNrcHQuaW5kZXglMjIlMkMlMjBmcm9tX3RmJTNEVHJ1ZSUyQyUyMGNvbmZpZyUzRGNvbmZpZyklMEElMjMlMjBMb2FkaW5nJTIwZnJvbSUyMGElMjBGbGF4JTIwY2hlY2twb2ludCUyMGZpbGUlMjBpbnN0ZWFkJTIwb2YlMjBhJTIwUHlUb3JjaCUyMG1vZGVsJTIwKHNsb3dlciklMEFtb2RlbCUyMCUzRCUyMEJlcnRNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyYmVydC1iYXNlLXVuY2FzZWQlMjIlMkMlMjBmcm9tX2ZsYXglM0RUcnVlKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> BertConfig, BertModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Download model and configuration from huggingface.co and cache.</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = BertModel.from_pretrained(<span class="hljs-string">&quot;bert-base-uncased&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Model was saved using *save_pretrained(&#x27;./test/saved_model/&#x27;)* (for example purposes, not runnable).</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = BertModel.from_pretrained(<span class="hljs-string">&quot;./test/saved_model/&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Update configuration during loading.</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = BertModel.from_pretrained(<span class="hljs-string">&quot;bert-base-uncased&quot;</span>, output_attentions=<span class="hljs-literal">True</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">assert</span> model.config.output_attentions == <span class="hljs-literal">True</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Loading from a TF checkpoint file instead of a PyTorch model (slower, for example purposes, not runnable).</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>config = BertConfig.from_json_file(<span class="hljs-string">&quot;./tf_model/my_tf_model_config.json&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = BertModel.from_pretrained(<span class="hljs-string">&quot;./tf_model/my_tf_checkpoint.ckpt.index&quot;</span>, from_tf=<span class="hljs-literal">True</span>, config=config)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Loading from a Flax checkpoint file instead of a PyTorch model (slower)</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = BertModel.from_pretrained(<span class="hljs-string">&quot;bert-base-uncased&quot;</span>, from_flax=<span class="hljs-literal">True</span>)`}}),{c(){v=r("p"),E=s("Examples:"),M=i(),h(y.$$.fragment)},l(c){v=a(c,"P",{});var T=n(v);E=l(T,"Examples:"),T.forEach(t),M=d(c),p(y.$$.fragment,c)},m(c,T){w(c,v,T),e(v,E),w(c,M,T),f(y,c,T),P=!0},p:Xe,i(c){P||(u(y.$$.fragment,c),P=!0)},o(c){g(y.$$.fragment,c),P=!1},d(c){c&&t(v),c&&t(M),_(y,c)}}}function jx(F){let v,E;return{c(){v=r("p"),E=s("This API is experimental and may have some slight breaking changes in the next releases.")},l(M){v=a(M,"P",{});var y=n(v);E=l(y,"This API is experimental and may have some slight breaking changes in the next releases."),y.forEach(t)},m(M,y){w(M,v,y),e(v,E)},d(M){M&&t(v)}}}function Ux(F){let v,E,M,y,P;return y=new z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGQXV0b01vZGVsJTBBJTBBbW9kZWwlMjAlM0QlMjBURkF1dG9Nb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyYmVydC1iYXNlLWNhc2VkJTIyKSUwQSUwQSUyMyUyMFB1c2glMjB0aGUlMjBtb2RlbCUyMHRvJTIweW91ciUyMG5hbWVzcGFjZSUyMHdpdGglMjB0aGUlMjBuYW1lJTIwJTIybXktZmluZXR1bmVkLWJlcnQlMjIuJTBBbW9kZWwucHVzaF90b19odWIoJTIybXktZmluZXR1bmVkLWJlcnQlMjIpJTBBJTBBJTIzJTIwUHVzaCUyMHRoZSUyMG1vZGVsJTIwdG8lMjBhbiUyMG9yZ2FuaXphdGlvbiUyMHdpdGglMjB0aGUlMjBuYW1lJTIwJTIybXktZmluZXR1bmVkLWJlcnQlMjIuJTBBbW9kZWwucHVzaF90b19odWIoJTIyaHVnZ2luZ2ZhY2UlMkZteS1maW5ldHVuZWQtYmVydCUyMik=",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFAutoModel

model = TFAutoModel.from_pretrained(<span class="hljs-string">&quot;bert-base-cased&quot;</span>)

<span class="hljs-comment"># Push the model to your namespace with the name &quot;my-finetuned-bert&quot;.</span>
model.push_to_hub(<span class="hljs-string">&quot;my-finetuned-bert&quot;</span>)

<span class="hljs-comment"># Push the model to an organization with the name &quot;my-finetuned-bert&quot;.</span>
model.push_to_hub(<span class="hljs-string">&quot;huggingface/my-finetuned-bert&quot;</span>)`}}),{c(){v=r("p"),E=s("Examples:"),M=i(),h(y.$$.fragment)},l(c){v=a(c,"P",{});var T=n(v);E=l(T,"Examples:"),T.forEach(t),M=d(c),p(y.$$.fragment,c)},m(c,T){w(c,v,T),e(v,E),w(c,M,T),f(y,c,T),P=!0},p:Xe,i(c){P||(u(y.$$.fragment,c),P=!0)},o(c){g(y.$$.fragment,c),P=!1},d(c){c&&t(v),c&&t(M),_(y,c)}}}function Jx(F){let v,E,M,y,P;return y=new z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEJlcnRDb25maWclMkMlMjBURkJlcnRNb2RlbCUwQSUwQSUyMyUyMERvd25sb2FkJTIwbW9kZWwlMjBhbmQlMjBjb25maWd1cmF0aW9uJTIwZnJvbSUyMGh1Z2dpbmdmYWNlLmNvJTIwYW5kJTIwY2FjaGUuJTBBbW9kZWwlMjAlM0QlMjBURkJlcnRNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyYmVydC1iYXNlLXVuY2FzZWQlMjIpJTBBJTIzJTIwTW9kZWwlMjB3YXMlMjBzYXZlZCUyMHVzaW5nJTIwKnNhdmVfcHJldHJhaW5lZCgnLiUyRnRlc3QlMkZzYXZlZF9tb2RlbCUyRicpKiUyMChmb3IlMjBleGFtcGxlJTIwcHVycG9zZXMlMkMlMjBub3QlMjBydW5uYWJsZSkuJTBBbW9kZWwlMjAlM0QlMjBURkJlcnRNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyLiUyRnRlc3QlMkZzYXZlZF9tb2RlbCUyRiUyMiklMEElMjMlMjBVcGRhdGUlMjBjb25maWd1cmF0aW9uJTIwZHVyaW5nJTIwbG9hZGluZy4lMEFtb2RlbCUyMCUzRCUyMFRGQmVydE1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJiZXJ0LWJhc2UtdW5jYXNlZCUyMiUyQyUyMG91dHB1dF9hdHRlbnRpb25zJTNEVHJ1ZSklMEFhc3NlcnQlMjBtb2RlbC5jb25maWcub3V0cHV0X2F0dGVudGlvbnMlMjAlM0QlM0QlMjBUcnVlJTBBJTIzJTIwTG9hZGluZyUyMGZyb20lMjBhJTIwUHl0b3JjaCUyMG1vZGVsJTIwZmlsZSUyMGluc3RlYWQlMjBvZiUyMGElMjBUZW5zb3JGbG93JTIwY2hlY2twb2ludCUyMChzbG93ZXIlMkMlMjBmb3IlMjBleGFtcGxlJTIwcHVycG9zZXMlMkMlMjBub3QlMjBydW5uYWJsZSkuJTBBY29uZmlnJTIwJTNEJTIwQmVydENvbmZpZy5mcm9tX2pzb25fZmlsZSglMjIuJTJGcHRfbW9kZWwlMkZteV9wdF9tb2RlbF9jb25maWcuanNvbiUyMiklMEFtb2RlbCUyMCUzRCUyMFRGQmVydE1vZGVsLmZyb21fcHJldHJhaW5lZCglMjIuJTJGcHRfbW9kZWwlMkZteV9weXRvcmNoX21vZGVsLmJpbiUyMiUyQyUyMGZyb21fcHQlM0RUcnVlJTJDJTIwY29uZmlnJTNEY29uZmlnKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> BertConfig, TFBertModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Download model and configuration from huggingface.co and cache.</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFBertModel.from_pretrained(<span class="hljs-string">&quot;bert-base-uncased&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Model was saved using *save_pretrained(&#x27;./test/saved_model/&#x27;)* (for example purposes, not runnable).</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFBertModel.from_pretrained(<span class="hljs-string">&quot;./test/saved_model/&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Update configuration during loading.</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFBertModel.from_pretrained(<span class="hljs-string">&quot;bert-base-uncased&quot;</span>, output_attentions=<span class="hljs-literal">True</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">assert</span> model.config.output_attentions == <span class="hljs-literal">True</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Loading from a Pytorch model file instead of a TensorFlow checkpoint (slower, for example purposes, not runnable).</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>config = BertConfig.from_json_file(<span class="hljs-string">&quot;./pt_model/my_pt_model_config.json&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFBertModel.from_pretrained(<span class="hljs-string">&quot;./pt_model/my_pytorch_model.bin&quot;</span>, from_pt=<span class="hljs-literal">True</span>, config=config)`}}),{c(){v=r("p"),E=s("Examples:"),M=i(),h(y.$$.fragment)},l(c){v=a(c,"P",{});var T=n(v);E=l(T,"Examples:"),T.forEach(t),M=d(c),p(y.$$.fragment,c)},m(c,T){w(c,v,T),e(v,E),w(c,M,T),f(y,c,T),P=!0},p:Xe,i(c){P||(u(y.$$.fragment,c),P=!0)},o(c){g(y.$$.fragment,c),P=!1},d(c){c&&t(v),c&&t(M),_(y,c)}}}function Fx(F){let v,E;return{c(){v=r("p"),E=s("This API is experimental and may have some slight breaking changes in the next releases.")},l(M){v=a(M,"P",{});var y=n(v);E=l(y,"This API is experimental and may have some slight breaking changes in the next releases."),y.forEach(t)},m(M,y){w(M,v,y),e(v,E)},d(M){M&&t(v)}}}function Ix(F){let v,E,M,y,P;return y=new z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEZsYXhBdXRvTW9kZWwlMEElMEFtb2RlbCUyMCUzRCUyMEZsYXhBdXRvTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMmJlcnQtYmFzZS1jYXNlZCUyMiklMEElMEElMjMlMjBQdXNoJTIwdGhlJTIwbW9kZWwlMjB0byUyMHlvdXIlMjBuYW1lc3BhY2UlMjB3aXRoJTIwdGhlJTIwbmFtZSUyMCUyMm15LWZpbmV0dW5lZC1iZXJ0JTIyLiUwQW1vZGVsLnB1c2hfdG9faHViKCUyMm15LWZpbmV0dW5lZC1iZXJ0JTIyKSUwQSUwQSUyMyUyMFB1c2glMjB0aGUlMjBtb2RlbCUyMHRvJTIwYW4lMjBvcmdhbml6YXRpb24lMjB3aXRoJTIwdGhlJTIwbmFtZSUyMCUyMm15LWZpbmV0dW5lZC1iZXJ0JTIyLiUwQW1vZGVsLnB1c2hfdG9faHViKCUyMmh1Z2dpbmdmYWNlJTJGbXktZmluZXR1bmVkLWJlcnQlMjIp",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> FlaxAutoModel

model = FlaxAutoModel.from_pretrained(<span class="hljs-string">&quot;bert-base-cased&quot;</span>)

<span class="hljs-comment"># Push the model to your namespace with the name &quot;my-finetuned-bert&quot;.</span>
model.push_to_hub(<span class="hljs-string">&quot;my-finetuned-bert&quot;</span>)

<span class="hljs-comment"># Push the model to an organization with the name &quot;my-finetuned-bert&quot;.</span>
model.push_to_hub(<span class="hljs-string">&quot;huggingface/my-finetuned-bert&quot;</span>)`}}),{c(){v=r("p"),E=s("Examples:"),M=i(),h(y.$$.fragment)},l(c){v=a(c,"P",{});var T=n(v);E=l(T,"Examples:"),T.forEach(t),M=d(c),p(y.$$.fragment,c)},m(c,T){w(c,v,T),e(v,E),w(c,M,T),f(y,c,T),P=!0},p:Xe,i(c){P||(u(y.$$.fragment,c),P=!0)},o(c){g(y.$$.fragment,c),P=!1},d(c){c&&t(v),c&&t(M),_(y,c)}}}function Zx(F){let v,E,M,y,P;return y=new z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEJlcnRDb25maWclMkMlMjBGbGF4QmVydE1vZGVsJTBBJTBBJTIzJTIwRG93bmxvYWQlMjBtb2RlbCUyMGFuZCUyMGNvbmZpZ3VyYXRpb24lMjBmcm9tJTIwaHVnZ2luZ2ZhY2UuY28lMjBhbmQlMjBjYWNoZS4lMEFtb2RlbCUyMCUzRCUyMEZsYXhCZXJ0TW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMmJlcnQtYmFzZS1jYXNlZCUyMiklMEElMjMlMjBNb2RlbCUyMHdhcyUyMHNhdmVkJTIwdXNpbmclMjAqc2F2ZV9wcmV0cmFpbmVkKCcuJTJGdGVzdCUyRnNhdmVkX21vZGVsJTJGJykqJTIwKGZvciUyMGV4YW1wbGUlMjBwdXJwb3NlcyUyQyUyMG5vdCUyMHJ1bm5hYmxlKS4lMEFtb2RlbCUyMCUzRCUyMEZsYXhCZXJ0TW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMi4lMkZ0ZXN0JTJGc2F2ZWRfbW9kZWwlMkYlMjIpJTBBJTIzJTIwTG9hZGluZyUyMGZyb20lMjBhJTIwUHlUb3JjaCUyMGNoZWNrcG9pbnQlMjBmaWxlJTIwaW5zdGVhZCUyMG9mJTIwYSUyMFB5VG9yY2glMjBtb2RlbCUyMChzbG93ZXIlMkMlMjBmb3IlMjBleGFtcGxlJTIwcHVycG9zZXMlMkMlMjBub3QlMjBydW5uYWJsZSkuJTBBY29uZmlnJTIwJTNEJTIwQmVydENvbmZpZy5mcm9tX2pzb25fZmlsZSglMjIuJTJGcHRfbW9kZWwlMkZjb25maWcuanNvbiUyMiklMEFtb2RlbCUyMCUzRCUyMEZsYXhCZXJ0TW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMi4lMkZwdF9tb2RlbCUyRnB5dG9yY2hfbW9kZWwuYmluJTIyJTJDJTIwZnJvbV9wdCUzRFRydWUlMkMlMjBjb25maWclM0Rjb25maWcp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> BertConfig, FlaxBertModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Download model and configuration from huggingface.co and cache.</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = FlaxBertModel.from_pretrained(<span class="hljs-string">&quot;bert-base-cased&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Model was saved using *save_pretrained(&#x27;./test/saved_model/&#x27;)* (for example purposes, not runnable).</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = FlaxBertModel.from_pretrained(<span class="hljs-string">&quot;./test/saved_model/&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Loading from a PyTorch checkpoint file instead of a PyTorch model (slower, for example purposes, not runnable).</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>config = BertConfig.from_json_file(<span class="hljs-string">&quot;./pt_model/config.json&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = FlaxBertModel.from_pretrained(<span class="hljs-string">&quot;./pt_model/pytorch_model.bin&quot;</span>, from_pt=<span class="hljs-literal">True</span>, config=config)`}}),{c(){v=r("p"),E=s("Examples:"),M=i(),h(y.$$.fragment)},l(c){v=a(c,"P",{});var T=n(v);E=l(T,"Examples:"),T.forEach(t),M=d(c),p(y.$$.fragment,c)},m(c,T){w(c,v,T),e(v,E),w(c,M,T),f(y,c,T),P=!0},p:Xe,i(c){P||(u(y.$$.fragment,c),P=!0)},o(c){g(y.$$.fragment,c),P=!1},d(c){c&&t(v),c&&t(M),_(y,c)}}}function Cx(F){let v,E;return{c(){v=r("p"),E=s("This API is experimental and may have some slight breaking changes in the next releases.")},l(M){v=a(M,"P",{});var y=n(v);E=l(y,"This API is experimental and may have some slight breaking changes in the next releases."),y.forEach(t)},m(M,y){w(M,v,y),e(v,E)},d(M){M&&t(v)}}}function Wx(F){let v,E,M,y,P;return y=new z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEZsYXhCZXJ0TW9kZWwlMEElMEElMjMlMjBsb2FkJTIwbW9kZWwlMEFtb2RlbCUyMCUzRCUyMEZsYXhCZXJ0TW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMmJlcnQtYmFzZS1jYXNlZCUyMiklMEElMjMlMjBCeSUyMGRlZmF1bHQlMkMlMjB0aGUlMjBtb2RlbCUyMHBhcmFtZXRlcnMlMjB3aWxsJTIwYmUlMjBpbiUyMGZwMzIlMjBwcmVjaXNpb24lMkMlMjB0byUyMGNhc3QlMjB0aGVzZSUyMHRvJTIwYmZsb2F0MTYlMjBwcmVjaXNpb24lMEFtb2RlbC5wYXJhbXMlMjAlM0QlMjBtb2RlbC50b19iZjE2KG1vZGVsLnBhcmFtcyklMEElMjMlMjBJZiUyMHlvdSUyMHdhbnQlMjBkb24ndCUyMHdhbnQlMjB0byUyMGNhc3QlMjBjZXJ0YWluJTIwcGFyYW1ldGVycyUyMChmb3IlMjBleGFtcGxlJTIwbGF5ZXIlMjBub3JtJTIwYmlhcyUyMGFuZCUyMHNjYWxlKSUwQSUyMyUyMHRoZW4lMjBwYXNzJTIwdGhlJTIwbWFzayUyMGFzJTIwZm9sbG93cyUwQWZyb20lMjBmbGF4JTIwaW1wb3J0JTIwdHJhdmVyc2VfdXRpbCUwQSUwQW1vZGVsJTIwJTNEJTIwRmxheEJlcnRNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyYmVydC1iYXNlLWNhc2VkJTIyKSUwQWZsYXRfcGFyYW1zJTIwJTNEJTIwdHJhdmVyc2VfdXRpbC5mbGF0dGVuX2RpY3QobW9kZWwucGFyYW1zKSUwQW1hc2slMjAlM0QlMjAlN0IlMEElMjAlMjAlMjAlMjBwYXRoJTNBJTIwKHBhdGglNUItMiU1RCUyMCElM0QlMjAoJTIyTGF5ZXJOb3JtJTIyJTJDJTIwJTIyYmlhcyUyMiklMjBhbmQlMjBwYXRoJTVCLTIlM0ElNUQlMjAhJTNEJTIwKCUyMkxheWVyTm9ybSUyMiUyQyUyMCUyMnNjYWxlJTIyKSklMEElMjAlMjAlMjAlMjBmb3IlMjBwYXRoJTIwaW4lMjBmbGF0X3BhcmFtcyUwQSU3RCUwQW1hc2slMjAlM0QlMjB0cmF2ZXJzZV91dGlsLnVuZmxhdHRlbl9kaWN0KG1hc2spJTBBbW9kZWwucGFyYW1zJTIwJTNEJTIwbW9kZWwudG9fYmYxNihtb2RlbC5wYXJhbXMlMkMlMjBtYXNrKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> FlaxBertModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># load model</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = FlaxBertModel.from_pretrained(<span class="hljs-string">&quot;bert-base-cased&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </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">&gt;&gt;&gt; </span>model.params = model.to_bf16(model.params)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># If you want don&#x27;t want to cast certain parameters (for example layer norm bias and scale)</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># then pass the mask as follows</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> flax <span class="hljs-keyword">import</span> traverse_util

<span class="hljs-meta">&gt;&gt;&gt; </span>model = FlaxBertModel.from_pretrained(<span class="hljs-string">&quot;bert-base-cased&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>flat_params = traverse_util.flatten_dict(model.params)
<span class="hljs-meta">&gt;&gt;&gt; </span>mask = {
<span class="hljs-meta">... </span>    path: (path[-<span class="hljs-number">2</span>] != (<span class="hljs-string">&quot;LayerNorm&quot;</span>, <span class="hljs-string">&quot;bias&quot;</span>) <span class="hljs-keyword">and</span> path[-<span class="hljs-number">2</span>:] != (<span class="hljs-string">&quot;LayerNorm&quot;</span>, <span class="hljs-string">&quot;scale&quot;</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">&gt;&gt;&gt; </span>mask = traverse_util.unflatten_dict(mask)
<span class="hljs-meta">&gt;&gt;&gt; </span>model.params = model.to_bf16(model.params, mask)`}}),{c(){v=r("p"),E=s("Examples:"),M=i(),h(y.$$.fragment)},l(c){v=a(c,"P",{});var T=n(v);E=l(T,"Examples:"),T.forEach(t),M=d(c),p(y.$$.fragment,c)},m(c,T){w(c,v,T),e(v,E),w(c,M,T),f(y,c,T),P=!0},p:Xe,i(c){P||(u(y.$$.fragment,c),P=!0)},o(c){g(y.$$.fragment,c),P=!1},d(c){c&&t(v),c&&t(M),_(y,c)}}}function Gx(F){let v,E,M,y,P;return y=new z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEZsYXhCZXJ0TW9kZWwlMEElMEElMjMlMjBsb2FkJTIwbW9kZWwlMEFtb2RlbCUyMCUzRCUyMEZsYXhCZXJ0TW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMmJlcnQtYmFzZS1jYXNlZCUyMiklMEElMjMlMjBCeSUyMGRlZmF1bHQlMkMlMjB0aGUlMjBtb2RlbCUyMHBhcmFtcyUyMHdpbGwlMjBiZSUyMGluJTIwZnAzMiUyQyUyMHRvJTIwY2FzdCUyMHRoZXNlJTIwdG8lMjBmbG9hdDE2JTBBbW9kZWwucGFyYW1zJTIwJTNEJTIwbW9kZWwudG9fZnAxNihtb2RlbC5wYXJhbXMpJTBBJTIzJTIwSWYlMjB5b3UlMjB3YW50JTIwZG9uJ3QlMjB3YW50JTIwdG8lMjBjYXN0JTIwY2VydGFpbiUyMHBhcmFtZXRlcnMlMjAoZm9yJTIwZXhhbXBsZSUyMGxheWVyJTIwbm9ybSUyMGJpYXMlMjBhbmQlMjBzY2FsZSklMEElMjMlMjB0aGVuJTIwcGFzcyUyMHRoZSUyMG1hc2slMjBhcyUyMGZvbGxvd3MlMEFmcm9tJTIwZmxheCUyMGltcG9ydCUyMHRyYXZlcnNlX3V0aWwlMEElMEFtb2RlbCUyMCUzRCUyMEZsYXhCZXJ0TW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMmJlcnQtYmFzZS1jYXNlZCUyMiklMEFmbGF0X3BhcmFtcyUyMCUzRCUyMHRyYXZlcnNlX3V0aWwuZmxhdHRlbl9kaWN0KG1vZGVsLnBhcmFtcyklMEFtYXNrJTIwJTNEJTIwJTdCJTBBJTIwJTIwJTIwJTIwcGF0aCUzQSUyMChwYXRoJTVCLTIlNUQlMjAhJTNEJTIwKCUyMkxheWVyTm9ybSUyMiUyQyUyMCUyMmJpYXMlMjIpJTIwYW5kJTIwcGF0aCU1Qi0yJTNBJTVEJTIwISUzRCUyMCglMjJMYXllck5vcm0lMjIlMkMlMjAlMjJzY2FsZSUyMikpJTBBJTIwJTIwJTIwJTIwZm9yJTIwcGF0aCUyMGluJTIwZmxhdF9wYXJhbXMlMEElN0QlMEFtYXNrJTIwJTNEJTIwdHJhdmVyc2VfdXRpbC51bmZsYXR0ZW5fZGljdChtYXNrKSUwQW1vZGVsLnBhcmFtcyUyMCUzRCUyMG1vZGVsLnRvX2ZwMTYobW9kZWwucGFyYW1zJTJDJTIwbWFzayk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> FlaxBertModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># load model</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = FlaxBertModel.from_pretrained(<span class="hljs-string">&quot;bert-base-cased&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># By default, the model params will be in fp32, to cast these to float16</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model.params = model.to_fp16(model.params)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># If you want don&#x27;t want to cast certain parameters (for example layer norm bias and scale)</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># then pass the mask as follows</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> flax <span class="hljs-keyword">import</span> traverse_util

<span class="hljs-meta">&gt;&gt;&gt; </span>model = FlaxBertModel.from_pretrained(<span class="hljs-string">&quot;bert-base-cased&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>flat_params = traverse_util.flatten_dict(model.params)
<span class="hljs-meta">&gt;&gt;&gt; </span>mask = {
<span class="hljs-meta">... </span>    path: (path[-<span class="hljs-number">2</span>] != (<span class="hljs-string">&quot;LayerNorm&quot;</span>, <span class="hljs-string">&quot;bias&quot;</span>) <span class="hljs-keyword">and</span> path[-<span class="hljs-number">2</span>:] != (<span class="hljs-string">&quot;LayerNorm&quot;</span>, <span class="hljs-string">&quot;scale&quot;</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">&gt;&gt;&gt; </span>mask = traverse_util.unflatten_dict(mask)
<span class="hljs-meta">&gt;&gt;&gt; </span>model.params = model.to_fp16(model.params, mask)`}}),{c(){v=r("p"),E=s("Examples:"),M=i(),h(y.$$.fragment)},l(c){v=a(c,"P",{});var T=n(v);E=l(T,"Examples:"),T.forEach(t),M=d(c),p(y.$$.fragment,c)},m(c,T){w(c,v,T),e(v,E),w(c,M,T),f(y,c,T),P=!0},p:Xe,i(c){P||(u(y.$$.fragment,c),P=!0)},o(c){g(y.$$.fragment,c),P=!1},d(c){c&&t(v),c&&t(M),_(y,c)}}}function zx(F){let v,E,M,y,P;return y=new z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEZsYXhCZXJ0TW9kZWwlMEElMEElMjMlMjBEb3dubG9hZCUyMG1vZGVsJTIwYW5kJTIwY29uZmlndXJhdGlvbiUyMGZyb20lMjBodWdnaW5nZmFjZS5jbyUwQW1vZGVsJTIwJTNEJTIwRmxheEJlcnRNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyYmVydC1iYXNlLWNhc2VkJTIyKSUwQSUyMyUyMEJ5JTIwZGVmYXVsdCUyQyUyMHRoZSUyMG1vZGVsJTIwcGFyYW1zJTIwd2lsbCUyMGJlJTIwaW4lMjBmcDMyJTJDJTIwdG8lMjBpbGx1c3RyYXRlJTIwdGhlJTIwdXNlJTIwb2YlMjB0aGlzJTIwbWV0aG9kJTJDJTBBJTIzJTIwd2UnbGwlMjBmaXJzdCUyMGNhc3QlMjB0byUyMGZwMTYlMjBhbmQlMjBiYWNrJTIwdG8lMjBmcDMyJTBBbW9kZWwucGFyYW1zJTIwJTNEJTIwbW9kZWwudG9fZjE2KG1vZGVsLnBhcmFtcyklMEElMjMlMjBub3clMjBjYXN0JTIwYmFjayUyMHRvJTIwZnAzMiUwQW1vZGVsLnBhcmFtcyUyMCUzRCUyMG1vZGVsLnRvX2ZwMzIobW9kZWwucGFyYW1zKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> FlaxBertModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Download model and configuration from huggingface.co</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = FlaxBertModel.from_pretrained(<span class="hljs-string">&quot;bert-base-cased&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </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">&gt;&gt;&gt; </span><span class="hljs-comment"># we&#x27;ll first cast to fp16 and back to fp32</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model.params = model.to_f16(model.params)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># now cast back to fp32</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model.params = model.to_fp32(model.params)`}}),{c(){v=r("p"),E=s("Examples:"),M=i(),h(y.$$.fragment)},l(c){v=a(c,"P",{});var T=n(v);E=l(T,"Examples:"),T.forEach(t),M=d(c),p(y.$$.fragment,c)},m(c,T){w(c,v,T),e(v,E),w(c,M,T),f(y,c,T),P=!0},p:Xe,i(c){P||(u(y.$$.fragment,c),P=!0)},o(c){g(y.$$.fragment,c),P=!1},d(c){c&&t(v),c&&t(M),_(y,c)}}}function Bx(F){let v,E,M,y,P;return y=new z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMCU3Qm9iamVjdF9jbGFzcyU3RCUwQSUwQSU3Qm9iamVjdCU3RCUyMCUzRCUyMCU3Qm9iamVjdF9jbGFzcyU3RC5mcm9tX3ByZXRyYWluZWQoJTIyYmVydC1iYXNlLWNhc2VkJTIyKSUwQSUwQSUyMyUyMFB1c2glMjB0aGUlMjAlN0JvYmplY3QlN0QlMjB0byUyMHlvdXIlMjBuYW1lc3BhY2UlMjB3aXRoJTIwdGhlJTIwbmFtZSUyMCUyMm15LWZpbmV0dW5lZC1iZXJ0JTIyLiUwQSU3Qm9iamVjdCU3RC5wdXNoX3RvX2h1YiglMjJteS1maW5ldHVuZWQtYmVydCUyMiklMEElMEElMjMlMjBQdXNoJTIwdGhlJTIwJTdCb2JqZWN0JTdEJTIwdG8lMjBhbiUyMG9yZ2FuaXphdGlvbiUyMHdpdGglMjB0aGUlMjBuYW1lJTIwJTIybXktZmluZXR1bmVkLWJlcnQlMjIuJTBBJTdCb2JqZWN0JTdELnB1c2hfdG9faHViKCUyMmh1Z2dpbmdmYWNlJTJGbXktZmluZXR1bmVkLWJlcnQlMjIp",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> {object_class}

{<span class="hljs-built_in">object</span>} = {object_class}.from_pretrained(<span class="hljs-string">&quot;bert-base-cased&quot;</span>)

<span class="hljs-comment"># Push the {object} to your namespace with the name &quot;my-finetuned-bert&quot;.</span>
{<span class="hljs-built_in">object</span>}.push_to_hub(<span class="hljs-string">&quot;my-finetuned-bert&quot;</span>)

<span class="hljs-comment"># Push the {object} to an organization with the name &quot;my-finetuned-bert&quot;.</span>
{<span class="hljs-built_in">object</span>}.push_to_hub(<span class="hljs-string">&quot;huggingface/my-finetuned-bert&quot;</span>)`}}),{c(){v=r("p"),E=s("Examples:"),M=i(),h(y.$$.fragment)},l(c){v=a(c,"P",{});var T=n(v);E=l(T,"Examples:"),T.forEach(t),M=d(c),p(y.$$.fragment,c)},m(c,T){w(c,v,T),e(v,E),w(c,M,T),f(y,c,T),P=!0},p:Xe,i(c){P||(u(y.$$.fragment,c),P=!0)},o(c){g(y.$$.fragment,c),P=!1},d(c){c&&t(v),c&&t(M),_(y,c)}}}function Dx(F){let v,E,M,y,P,c,T,ct,Nh,yc,Q,Yh,yn,Ah,qh,wn,Lh,Sh,Mn,Hh,Qh,wc,Ne,Tn,Oh,Kh,$n,ep,tp,Mc,mt,Us,op,rp,Js,ap,Tc,B,np,xn,sp,lp,Fs,ip,dp,kn,cp,mp,En,hp,pp,Pn,fp,up,$c,Ye,ht,Is,No,gp,Zs,_p,xc,j,Yo,bp,Cs,vp,yp,jn,Un,wp,Mp,Tp,Ao,Ws,$p,xp,Gs,kp,Ep,zs,Pp,jp,Y,Bs,me,Ds,Up,Jp,Jn,Fp,Ip,Fn,Zp,Cp,Wp,qo,he,Rs,Gp,zp,Vs,Bp,Dp,Xs,Rp,Vp,Xp,Ae,pt,Ns,Np,Yp,In,Ap,qp,Lp,ft,Ys,Sp,Hp,As,Qp,Op,Kp,ut,qs,ef,tf,Ls,of,rf,af,Ss,gt,Hs,nf,sf,Qs,lf,df,cf,Os,_t,Ks,mf,hf,el,pf,ff,uf,tl,D,ol,gf,_f,rl,bf,vf,al,yf,wf,nl,Mf,Tf,sl,$f,xf,kf,pe,Lo,Ef,So,Pf,ll,jf,Uf,Jf,bt,Ff,vt,Ho,If,Qo,Zf,il,Cf,Wf,Gf,yt,Oo,zf,Ko,Bf,dl,Df,Rf,Vf,wt,er,Xf,cl,Nf,Yf,I,tr,Af,ml,qf,Lf,qe,Sf,hl,Hf,Qf,pl,Of,Kf,eu,or,tu,fl,ou,ru,au,rr,nu,ul,su,lu,iu,Mt,du,Tt,cu,gl,Zn,_l,mu,hu,pu,bl,fu,uu,vl,gu,_u,A,yl,bu,vu,wl,yu,wu,Ml,Mu,Tu,Tl,$u,xu,$l,ku,Eu,xl,Pu,ju,$t,ar,Uu,kl,Ju,Fu,xt,nr,Iu,Cn,Zu,sr,Cu,Wu,kt,lr,Gu,El,zu,Bu,fe,ir,Du,Pl,Ru,Vu,jl,Xu,Nu,ue,dr,Yu,Ul,Au,qu,Jl,Lu,Su,Et,cr,Hu,Le,Qu,Fl,Ou,Ku,Il,eg,tg,og,Pt,mr,rg,Zl,ag,ng,jt,hr,sg,Cl,lg,ig,ge,pr,dg,Wl,cg,mg,Ut,hg,_e,fr,pg,ur,fg,Gl,ug,gg,_g,gr,bg,zl,vg,yg,wg,Jt,_r,Mg,br,Tg,Wn,$g,xg,kg,Ft,vr,Eg,yr,Pg,Gn,jg,Ug,Jg,It,wr,Fg,Bl,Ig,Zg,be,Mr,Cg,Dl,Wg,Gg,Tr,zg,Rl,Bg,Dg,Rg,ve,$r,Vg,Se,Xg,xr,Ng,Yg,kr,Ag,qg,Lg,He,Sg,Er,Hg,Qg,Pr,Og,Kg,e_,Zt,jr,t_,Vl,o_,kc,zn,Ec,Qe,Ct,Xl,Ur,r_,Nl,a_,Pc,ye,n_,Bn,s_,l_,Jr,i_,d_,jc,Wt,c_,Yl,m_,h_,Uc,Fr,Jc,Gt,p_,Al,f_,u_,Fc,O,g_,ql,__,b_,Ll,v_,y_,Sl,w_,M_,Ic,Ir,Zc,zt,T_,Hl,$_,x_,Cc,Zr,Wc,Cr,Gc,Dn,k_,zc,Wr,Bc,Bt,E_,Ql,P_,j_,Dc,Oe,Dt,Ol,Gr,U_,Kl,J_,Rc,K,F_,ei,I_,Z_,ti,C_,W_,oi,G_,z_,Vc,zr,Xc,we,B_,ri,D_,R_,ai,V_,X_,Nc,Br,Yc,Rt,N_,ni,Y_,A_,Ac,Dr,qc,Rn,q_,Lc,Ke,Vt,si,Rr,L_,li,S_,Sc,C,Vr,H_,Xr,Q_,ii,O_,K_,eb,Me,Nr,tb,di,ob,rb,et,ab,ci,nb,sb,mi,lb,ib,db,Xt,Yr,cb,hi,mb,hb,Nt,Ar,pb,tt,fb,pi,ub,gb,qr,_b,bb,vb,Yt,Lr,yb,fi,wb,Mb,At,Sr,Tb,ui,$b,xb,qt,Hr,kb,gi,Eb,Pb,Lt,Qr,jb,_i,Ub,Jb,St,Or,Fb,ot,Ib,bi,Zb,Cb,Vn,Wb,Gb,Hc,rt,Ht,vi,Kr,zb,yi,Bb,Qc,x,ea,Db,wi,Rb,Vb,Xn,Nn,Xb,Nb,Yb,ta,Mi,Ab,qb,Ti,Lb,Sb,$i,Hb,Qb,at,Te,xi,Ob,Kb,Yn,ev,tv,An,ov,rv,av,Qt,ki,nv,sv,Ei,lv,iv,dv,R,Pi,cv,mv,ji,hv,pv,Ui,fv,uv,Ji,gv,_v,Fi,bv,vv,yv,$e,oa,wv,ra,Mv,Ii,Tv,$v,xv,Ot,kv,Kt,aa,Ev,na,Pv,Zi,jv,Uv,Jv,eo,sa,Fv,Ci,Iv,Zv,to,la,Cv,ia,Wv,Wi,Gv,zv,Bv,oo,da,Dv,Gi,Rv,Vv,V,ca,Xv,zi,Nv,Yv,ma,Av,Bi,qv,Lv,Sv,ha,Hv,Di,Qv,Ov,Kv,ro,ey,ao,pa,ty,Ri,oy,ry,no,fa,ay,Vi,ny,sy,so,ua,ly,Xi,iy,dy,lo,ga,cy,Ni,my,hy,io,_a,py,Yi,fy,uy,co,ba,gy,Ai,_y,by,mo,va,vy,qi,yy,wy,ho,ya,My,Li,Ty,$y,po,wa,xy,q,ky,Ma,Ey,Py,Si,jy,Uy,Hi,Jy,Fy,Qi,Iy,Zy,Cy,fo,Ta,Wy,Oi,Gy,zy,xe,$a,By,Ki,Dy,Ry,uo,Vy,ke,xa,Xy,ka,Ny,ed,Yy,Ay,qy,Ea,Ly,td,Sy,Hy,Qy,go,Pa,Oy,ja,Ky,qn,e1,t1,o1,Ln,Ua,r1,_o,Ja,a1,od,n1,s1,bo,Fa,l1,rd,i1,d1,vo,Ia,c1,ad,m1,h1,yo,Za,p1,nd,f1,u1,wo,Ca,g1,Wa,_1,sd,b1,v1,y1,Mo,Ga,w1,za,M1,ld,T1,$1,Oc,nt,To,id,Ba,x1,dd,k1,Kc,re,Da,E1,Ra,P1,cd,j1,U1,J1,$o,Va,F1,md,I1,em,st,xo,hd,Xa,Z1,pd,C1,tm,J,Na,W1,fd,G1,z1,Sn,Hn,B1,D1,R1,ud,V1,X1,lt,Ee,gd,N1,Y1,Qn,A1,q1,On,L1,S1,H1,ko,_d,Q1,O1,bd,K1,ew,tw,X,vd,ow,rw,yd,aw,nw,wd,sw,lw,Md,iw,dw,Td,cw,mw,hw,Pe,Ya,pw,Aa,fw,$d,uw,gw,_w,Eo,bw,Po,qa,vw,ae,yw,xd,ww,Mw,kd,Tw,$w,Ed,xw,kw,Ew,N,La,Pw,Pd,jw,Uw,Sa,Jw,jd,Fw,Iw,Zw,Ha,Cw,Ud,Ww,Gw,zw,jo,Bw,je,Qa,Dw,Oa,Rw,Jd,Vw,Xw,Nw,Fd,Yw,Aw,Ue,Ka,qw,Id,Lw,Sw,Uo,Hw,Jo,en,Qw,tn,Ow,Zd,Kw,e2,t2,ee,on,o2,L,r2,Cd,a2,n2,Wd,s2,l2,Gd,i2,d2,zd,c2,m2,h2,Bd,p2,f2,Fo,u2,te,rn,g2,S,_2,Dd,b2,v2,Rd,y2,w2,Vd,M2,T2,Xd,$2,x2,k2,Nd,E2,P2,Io,j2,Je,an,U2,H,J2,Yd,F2,I2,Ad,Z2,C2,qd,W2,G2,Ld,z2,B2,D2,Zo,om,it,Co,Sd,nn,R2,Hd,V2,rm,ne,sn,X2,Qd,N2,Y2,Fe,ln,A2,dn,q2,Od,L2,S2,H2,Wo,am,dt,Go,Kd,cn,Q2,ec,O2,nm,se,mn,K2,hn,eM,pn,tc,tM,oM,rM,oc,aM,sm;return c=new Re({}),No=new Re({}),Yo=new $({props:{name:"class transformers.PreTrainedModel",anchor:"transformers.PreTrainedModel",parameters:[{name:"config",val:": PretrainedConfig"},{name:"*inputs",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_utils.py#L1024"}}),Lo=new $({props:{name:"push_to_hub",anchor:"transformers.PreTrainedModel.push_to_hub",parameters:[{name:"repo_id",val:": str"},{name:"use_temp_dir",val:": typing.Optional[bool] = None"},{name:"commit_message",val:": typing.Optional[str] = None"},{name:"private",val:": typing.Optional[bool] = None"},{name:"use_auth_token",val:": typing.Union[bool, str, NoneType] = None"},{name:"max_shard_size",val:": typing.Union[int, str, NoneType] = '10GB'"},{name:"create_pr",val:": bool = False"},{name:"safe_serialization",val:": bool = False"},{name:"**deprecated_kwargs",val:""}],parametersDescription:[{anchor:"transformers.PreTrainedModel.push_to_hub.repo_id",description:`<strong>repo_id</strong> (<code>str</code>) &#x2014;
The name of the repository you want to push your model to. It should contain your organization name
when pushing to a given organization.`,name:"repo_id"},{anchor:"transformers.PreTrainedModel.push_to_hub.use_temp_dir",description:`<strong>use_temp_dir</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to use a temporary directory to store the files saved before they are pushed to the Hub.
Will default to <code>True</code> if there is no directory named like <code>repo_id</code>, <code>False</code> otherwise.`,name:"use_temp_dir"},{anchor:"transformers.PreTrainedModel.push_to_hub.commit_message",description:`<strong>commit_message</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Message to commit while pushing. Will default to <code>&quot;Upload model&quot;</code>.`,name:"commit_message"},{anchor:"transformers.PreTrainedModel.push_to_hub.private",description:`<strong>private</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not the repository created should be private.`,name:"private"},{anchor:"transformers.PreTrainedModel.push_to_hub.use_auth_token",description:`<strong>use_auth_token</strong> (<code>bool</code> or <code>str</code>, <em>optional</em>) &#x2014;
The token to use as HTTP bearer authorization for remote files. If <code>True</code>, will use the token generated
when running <code>huggingface-cli login</code> (stored in <code>~/.huggingface</code>). Will default to <code>True</code> if <code>repo_url</code>
is not specified.`,name:"use_auth_token"},{anchor:"transformers.PreTrainedModel.push_to_hub.max_shard_size",description:`<strong>max_shard_size</strong> (<code>int</code> or <code>str</code>, <em>optional</em>, defaults to <code>&quot;10GB&quot;</code>) &#x2014;
Only applicable for models. The maximum size for a checkpoint before being sharded. Checkpoints shard
will then be each of size lower than this size. If expressed as a string, needs to be digits followed
by a unit (like <code>&quot;5MB&quot;</code>).`,name:"max_shard_size"},{anchor:"transformers.PreTrainedModel.push_to_hub.create_pr",description:`<strong>create_pr</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to create a PR with the uploaded files or directly commit.`,name:"create_pr"},{anchor:"transformers.PreTrainedModel.push_to_hub.safe_serialization",description:`<strong>safe_serialization</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to convert the model weights in safetensors format for safer serialization.`,name:"safe_serialization"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/utils/hub.py#L733"}}),bt=new Ve({props:{anchor:"transformers.PreTrainedModel.push_to_hub.example",$$slots:{default:[kx]},$$scope:{ctx:F}}}),Ho=new $({props:{name:"can_generate",anchor:"transformers.PreTrainedModel.can_generate",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_utils.py#L1184",returnDescription:`
<p>Whether this model can generate sequences with <code>.generate()</code>.</p>
`,returnType:`
<p><code>bool</code></p>
`}}),Oo=new $({props:{name:"disable_input_require_grads",anchor:"transformers.PreTrainedModel.disable_input_require_grads",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_utils.py#L1208"}}),er=new $({props:{name:"enable_input_require_grads",anchor:"transformers.PreTrainedModel.enable_input_require_grads",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_utils.py#L1197"}}),tr=new $({props:{name:"from_pretrained",anchor:"transformers.PreTrainedModel.from_pretrained",parameters:[{name:"pretrained_model_name_or_path",val:": typing.Union[str, os.PathLike, NoneType]"},{name:"*model_args",val:""},{name:"config",val:": typing.Union[transformers.configuration_utils.PretrainedConfig, str, os.PathLike, NoneType] = None"},{name:"cache_dir",val:": typing.Union[str, os.PathLike, NoneType] = None"},{name:"ignore_mismatched_sizes",val:": bool = False"},{name:"force_download",val:": bool = False"},{name:"local_files_only",val:": bool = False"},{name:"token",val:": typing.Union[bool, str, NoneType] = None"},{name:"revision",val:": str = 'main'"},{name:"use_safetensors",val:": bool = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.PreTrainedModel.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>) &#x2014;
Can be either:</p>
<ul>
<li>A string, the <em>model id</em> of a pretrained model hosted inside a model repo on huggingface.co.
Valid model ids can be located at the root-level, like <code>bert-base-uncased</code>, or namespaced under a
user or organization name, like <code>dbmdz/bert-base-german-cased</code>.</li>
<li>A path to a <em>directory</em> containing model weights saved using
<a href="/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel.save_pretrained">save_pretrained()</a>, e.g., <code>./my_model_directory/</code>.</li>
<li>A path or url to a <em>tensorflow index checkpoint file</em> (e.g, <code>./tf_model/model.ckpt.index</code>). In
this case, <code>from_tf</code> should be set to <code>True</code> and a configuration object should be provided as
<code>config</code> argument. This loading path is slower than converting the TensorFlow checkpoint in a
PyTorch model using the provided conversion scripts and loading the PyTorch model afterwards.</li>
<li>A path or url to a model folder containing a <em>flax checkpoint file</em> in <em>.msgpack</em> format (e.g,
<code>./flax_model/</code> containing <code>flax_model.msgpack</code>). In this case, <code>from_flax</code> should be set to
<code>True</code>.</li>
<li><code>None</code> if you are both providing the configuration and state dictionary (resp. with keyword
arguments <code>config</code> and <code>state_dict</code>).</li>
</ul>`,name:"pretrained_model_name_or_path"},{anchor:"transformers.PreTrainedModel.from_pretrained.model_args",description:`<strong>model_args</strong> (sequence of positional arguments, <em>optional</em>) &#x2014;
All remaining positional arguments will be passed to the underlying model&#x2019;s <code>__init__</code> method.`,name:"model_args"},{anchor:"transformers.PreTrainedModel.from_pretrained.config",description:`<strong>config</strong> (<code>Union[PretrainedConfig, str, os.PathLike]</code>, <em>optional</em>) &#x2014;
Can be either:</p>
<ul>
<li>an instance of a class derived from <a href="/docs/transformers/v4.31.0/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a>,</li>
<li>a string or path valid as input to <a href="/docs/transformers/v4.31.0/en/main_classes/configuration#transformers.PretrainedConfig.from_pretrained">from_pretrained()</a>.</li>
</ul>
<p>Configuration for the model to use instead of an automatically loaded configuration. Configuration can
be automatically loaded when:</p>
<ul>
<li>The model is a model provided by the library (loaded with the <em>model id</em> string of a pretrained
model).</li>
<li>The model was saved using <a href="/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel.save_pretrained">save_pretrained()</a> and is reloaded by supplying the
save directory.</li>
<li>The model is loaded by supplying a local directory as <code>pretrained_model_name_or_path</code> and a
configuration JSON file named <em>config.json</em> is found in the directory.</li>
</ul>`,name:"config"},{anchor:"transformers.PreTrainedModel.from_pretrained.state_dict",description:`<strong>state_dict</strong> (<code>Dict[str, torch.Tensor]</code>, <em>optional</em>) &#x2014;
A state dictionary to use instead of a state dictionary loaded from saved weights file.</p>
<p>This option can be used if you want to create a model from a pretrained configuration but load your own
weights. In this case though, you should check if using <a href="/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel.save_pretrained">save_pretrained()</a> and
<a href="/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> is not a simpler option.`,name:"state_dict"},{anchor:"transformers.PreTrainedModel.from_pretrained.cache_dir",description:`<strong>cache_dir</strong> (<code>Union[str, os.PathLike]</code>, <em>optional</em>) &#x2014;
Path to a directory in which a downloaded pretrained model configuration should be cached if the
standard cache should not be used.`,name:"cache_dir"},{anchor:"transformers.PreTrainedModel.from_pretrained.from_tf",description:`<strong>from_tf</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Load the model weights from a TensorFlow checkpoint save file (see docstring of
<code>pretrained_model_name_or_path</code> argument).`,name:"from_tf"},{anchor:"transformers.PreTrainedModel.from_pretrained.from_flax",description:`<strong>from_flax</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Load the model weights from a Flax checkpoint save file (see docstring of
<code>pretrained_model_name_or_path</code> argument).`,name:"from_flax"},{anchor:"transformers.PreTrainedModel.from_pretrained.ignore_mismatched_sizes",description:`<strong>ignore_mismatched_sizes</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to raise an error if some of the weights from the checkpoint do not have the same size
as the weights of the model (if for instance, you are instantiating a model with 10 labels from a
checkpoint with 3 labels).`,name:"ignore_mismatched_sizes"},{anchor:"transformers.PreTrainedModel.from_pretrained.force_download",description:`<strong>force_download</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
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:"transformers.PreTrainedModel.from_pretrained.resume_download",description:`<strong>resume_download</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to delete incompletely received files. Will attempt to resume the download if such a
file exists.`,name:"resume_download"},{anchor:"transformers.PreTrainedModel.from_pretrained.proxies",description:`<strong>proxies</strong> (<code>Dict[str, str]</code>, <em>optional</em>) &#x2014;
A dictionary of proxy servers to use by protocol or endpoint, e.g., <code>{&apos;http&apos;: &apos;foo.bar:3128&apos;, &apos;http://hostname&apos;: &apos;foo.bar:4012&apos;}</code>. The proxies are used on each request.`,name:"proxies"},{anchor:"transformers.PreTrainedModel.from_pretrained.output_loading_info(bool,",description:`<strong>output_loading_info(<code>bool</code>,</strong> <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether ot not to also return a dictionary containing missing keys, unexpected keys and error messages.`,name:"output_loading_info(bool,"},{anchor:"transformers.PreTrainedModel.from_pretrained.local_files_only(bool,",description:`<strong>local_files_only(<code>bool</code>,</strong> <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to only look at local files (i.e., do not try to download the model).`,name:"local_files_only(bool,"},{anchor:"transformers.PreTrainedModel.from_pretrained.token",description:`<strong>token</strong> (<code>str</code> or <code>bool</code>, <em>optional</em>) &#x2014;
The token to use as HTTP bearer authorization for remote files. If <code>True</code>, or not specified, will use
the token generated when running <code>huggingface-cli login</code> (stored in <code>~/.huggingface</code>).`,name:"token"},{anchor:"transformers.PreTrainedModel.from_pretrained.revision",description:`<strong>revision</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;main&quot;</code>) &#x2014;
The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a
git-based system for storing models and other artifacts on huggingface.co, so <code>revision</code> can be any
identifier allowed by git.</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>To test a pull request you made on the Hub, you can pass \`revision=&#x201C;refs/pr/<pr_number>&#x201C;.</pr_number></p>

					</div>`,name:"revision"},{anchor:"transformers.PreTrainedModel.from_pretrained.mirror",description:`<strong>mirror</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Mirror source to accelerate downloads in China. If you are from China and have an accessibility
problem, you can set this option to resolve it. Note that we do not guarantee the timeliness or safety.
Please refer to the mirror site for more information.`,name:"mirror"},{anchor:"transformers.PreTrainedModel.from_pretrained._fast_init(bool,",description:`<strong>_fast_init(<code>bool</code>,</strong> <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to disable fast initialization.</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>One should only disable <em>_fast_init</em> to ensure backwards compatibility with <code>transformers.__version__ &lt; 4.6.0</code> for seeded model initialization. This argument will be removed at the next major version. See
<a href="https://github.com/huggingface/transformers/pull/11471" rel="nofollow">pull request 11471</a> for more information.</p>

					</div>`,name:"_fast_init(bool,"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_utils.py#L1922",parameterGroups:[{title:"Parameters for big model inference",parametersDescription:[{anchor:"transformers.PreTrainedModel.from_pretrained.low_cpu_mem_usage(bool,",description:`<strong>low_cpu_mem_usage(<code>bool</code>,</strong> <em>optional</em>) &#x2014;
Tries to not use more than 1x model size in CPU memory (including peak memory) while loading the model.
This is an experimental feature and a subject to change at any moment.`,name:"low_cpu_mem_usage(bool,"},{anchor:"transformers.PreTrainedModel.from_pretrained.torch_dtype",description:`<strong>torch_dtype</strong> (<code>str</code> or <code>torch.dtype</code>, <em>optional</em>) &#x2014;
Override the default <code>torch.dtype</code> and load the model under a specific <code>dtype</code>. The different options
are:</p>
<ol>
<li>
<p><code>torch.float16</code> or <code>torch.bfloat16</code> or <code>torch.float</code>: load in a specified
<code>dtype</code>, ignoring the model&#x2019;s <code>config.torch_dtype</code> if one exists. If not specified</p>
<ul>
<li>the model will get loaded in <code>torch.float</code> (fp32).</li>
</ul>
</li>
<li>
<p><code>&quot;auto&quot;</code> - A <code>torch_dtype</code> entry in the <code>config.json</code> file of the model will be
attempted to be used. If this entry isn&#x2019;t found then next check the <code>dtype</code> of the first weight in
the checkpoint that&#x2019;s of a floating point type and use that as <code>dtype</code>. This will load the model
using the <code>dtype</code> it was saved in at the end of the training. It can&#x2019;t be used as an indicator of how
the model was trained. Since it could be trained in one of half precision dtypes, but saved in fp32.</p>
</li>
</ol>
<tip>
<p>For some models the <code>dtype</code> they were trained in is unknown - you may try to check the model&#x2019;s paper or
reach out to the authors and ask them to add this information to the model&#x2019;s card and to insert the
<code>torch_dtype</code> entry in <code>config.json</code> on the hub.</p>
</tip>`,name:"torch_dtype"},{anchor:"transformers.PreTrainedModel.from_pretrained.device_map",description:`<strong>device_map</strong> (<code>str</code> or <code>Dict[str, Union[int, str, torch.device]]</code> or <code>int</code> or <code>torch.device</code>, <em>optional</em>) &#x2014;
A map that specifies where each submodule should go. It doesn&#x2019;t need to be refined to each
parameter/buffer name, once a given module name is inside, every submodule of it will be sent to the
same device. If we only pass the device (<em>e.g.</em>, <code>&quot;cpu&quot;</code>, <code>&quot;cuda:1&quot;</code>, <code>&quot;mps&quot;</code>, or a GPU ordinal rank
like <code>1</code>) on which the model will be allocated, the device map will map the entire model to this
device. Passing <code>device_map = 0</code> means put the whole model on GPU 0.</p>
<p>To have Accelerate compute the most optimized <code>device_map</code> automatically, set <code>device_map=&quot;auto&quot;</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:"transformers.PreTrainedModel.from_pretrained.max_memory",description:`<strong>max_memory</strong> (<code>Dict</code>, <em>optional</em>) &#x2014;
A dictionary device identifier to maximum memory. Will default to the maximum memory available for each
GPU and the available CPU RAM if unset.`,name:"max_memory"},{anchor:"transformers.PreTrainedModel.from_pretrained.offload_folder",description:`<strong>offload_folder</strong> (<code>str</code> or <code>os.PathLike</code>, <em>optional</em>) &#x2014;
If the <code>device_map</code> contains any value <code>&quot;disk&quot;</code>, the folder where we will offload weights.`,name:"offload_folder"},{anchor:"transformers.PreTrainedModel.from_pretrained.offload_state_dict",description:`<strong>offload_state_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If <code>True</code>, will temporarily offload the CPU state dict to the hard drive to avoid getting 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:"transformers.PreTrainedModel.from_pretrained.load_in_8bit",description:`<strong>load_in_8bit</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
If <code>True</code>, will convert the loaded model into mixed-8bit quantized model. To use this feature please
install <code>bitsandbytes</code> compiled with your CUDA version by running <code>pip install -i https://test.pypi.org/simple/ bitsandbytes-cudaXXX</code> where XXX is your CUDA version (e.g. 11.6 = 116).
Make also sure that you have enough GPU RAM to store half of the model size since the 8bit modules are
not compiled and adapted for CPUs.`,name:"load_in_8bit"},{anchor:"transformers.PreTrainedModel.from_pretrained.quantization_config",description:`<strong>quantization_config</strong> (<code>Dict</code>, <em>optional</em>) &#x2014;
A dictionary of configuration parameters for the <code>bitsandbytes</code> library and loading the model using
advanced features such as offloading in fp32 on CPU or on disk.`,name:"quantization_config"},{anchor:"transformers.PreTrainedModel.from_pretrained.subfolder",description:`<strong>subfolder</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&quot;</code>) &#x2014;
In case the relevant files are located inside a subfolder of the model repo on huggingface.co, you can
specify the folder name here.`,name:"subfolder"},{anchor:"transformers.PreTrainedModel.from_pretrained.variant",description:`<strong>variant</strong> (<code>str</code>, <em>optional</em>) &#x2014;
If specified load weights from <code>variant</code> filename, <em>e.g.</em> pytorch_model.<variant>.bin. <code>variant</code> is
ignored when using <code>from_tf</code> or <code>from_flax</code>.</variant>`,name:"variant"},{anchor:"transformers.PreTrainedModel.from_pretrained.use_safetensors",description:`<strong>use_safetensors</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
Whether or not to use <code>safetensors</code> checkpoints. Defaults to <code>None</code>. If not specified and <code>safetensors</code>
is not installed, it will be set to <code>False</code>.`,name:"use_safetensors"},{anchor:"transformers.PreTrainedModel.from_pretrained.kwargs",description:`<strong>kwargs</strong> (remaining dictionary of keyword arguments, <em>optional</em>) &#x2014;
Can be used to update the configuration object (after it being loaded) and initiate the model (e.g.,
<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> will be directly passed to the
underlying model&#x2019;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> will be first passed to the configuration class
initialization function (<a href="/docs/transformers/v4.31.0/en/main_classes/configuration#transformers.PretrainedConfig.from_pretrained">from_pretrained()</a>). Each key of <code>kwargs</code> that
corresponds to a configuration attribute will be used to override said attribute with the
supplied <code>kwargs</code> value. Remaining keys that do not correspond to any configuration attribute
will be passed to the underlying model&#x2019;s <code>__init__</code> function.</li>
</ul>`,name:"kwargs"}]}]}}),Mt=new Xh({props:{$$slots:{default:[Ex]},$$scope:{ctx:F}}}),Tt=new Ve({props:{anchor:"transformers.PreTrainedModel.from_pretrained.example",$$slots:{default:[Px]},$$scope:{ctx:F}}}),ar=new $({props:{name:"get_input_embeddings",anchor:"transformers.PreTrainedModel.get_input_embeddings",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_utils.py#L1214",returnDescription:`
<p>A torch module mapping vocabulary to hidden states.</p>
`,returnType:`
<p><code>nn.Module</code></p>
`}}),nr=new $({props:{name:"get_memory_footprint",anchor:"transformers.PreTrainedModel.get_memory_footprint",parameters:[{name:"return_buffers",val:" = True"}],parametersDescription:[{anchor:"transformers.PreTrainedModel.get_memory_footprint.return_buffers",description:`<strong>return_buffers</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to return the size of the buffer tensors in the computation of the memory footprint. Buffers
are tensors that do not require gradients and not registered as parameters. E.g. mean and std in batch
norm layers. Please see: <a href="https://discuss.pytorch.org/t/what-pytorch-means-by-buffers/120266/2" rel="nofollow">https://discuss.pytorch.org/t/what-pytorch-means-by-buffers/120266/2</a>`,name:"return_buffers"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_utils.py#L1874"}}),lr=new $({props:{name:"get_output_embeddings",anchor:"transformers.PreTrainedModel.get_output_embeddings",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_utils.py#L1240",returnDescription:`
<p>A torch module mapping hidden states to vocabulary.</p>
`,returnType:`
<p><code>nn.Module</code></p>
`}}),ir=new $({props:{name:"gradient_checkpointing_disable",anchor:"transformers.PreTrainedModel.gradient_checkpointing_disable",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_utils.py#L1634"}}),dr=new $({props:{name:"gradient_checkpointing_enable",anchor:"transformers.PreTrainedModel.gradient_checkpointing_enable",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_utils.py#L1623"}}),cr=new $({props:{name:"init_weights",anchor:"transformers.PreTrainedModel.init_weights",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_utils.py#L1589"}}),mr=new $({props:{name:"post_init",anchor:"transformers.PreTrainedModel.post_init",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_utils.py#L1103"}}),hr=new $({props:{name:"prune_heads",anchor:"transformers.PreTrainedModel.prune_heads",parameters:[{name:"heads_to_prune",val:": typing.Dict[int, typing.List[int]]"}],parametersDescription:[{anchor:"transformers.PreTrainedModel.prune_heads.heads_to_prune",description:`<strong>heads_to_prune</strong> (<code>Dict[int, List[int]]</code>) &#x2014;
Dictionary with keys being selected layer indices (<code>int</code>) and associated values being the list of heads
to prune in said layer (list of <code>int</code>). For instance {1: [0, 2], 2: [2, 3]} will prune heads 0 and 2 on
layer 1 and heads 2 and 3 on layer 2.`,name:"heads_to_prune"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_utils.py#L1606"}}),pr=new $({props:{name:"register_for_auto_class",anchor:"transformers.PreTrainedModel.register_for_auto_class",parameters:[{name:"auto_class",val:" = 'AutoModel'"}],parametersDescription:[{anchor:"transformers.PreTrainedModel.register_for_auto_class.auto_class",description:`<strong>auto_class</strong> (<code>str</code> or <code>type</code>, <em>optional</em>, defaults to <code>&quot;AutoModel&quot;</code>) &#x2014;
The auto class to register this new model with.`,name:"auto_class"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_utils.py#L3406"}}),Ut=new Xh({props:{warning:!0,$$slots:{default:[jx]},$$scope:{ctx:F}}}),fr=new $({props:{name:"resize_token_embeddings",anchor:"transformers.PreTrainedModel.resize_token_embeddings",parameters:[{name:"new_num_tokens",val:": typing.Optional[int] = None"}],parametersDescription:[{anchor:"transformers.PreTrainedModel.resize_token_embeddings.new_num_tokens",description:`<strong>new_num_tokens</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The number of new tokens in the embedding matrix. Increasing the size will add newly initialized
vectors at the end. Reducing the size will remove vectors from the end. If not provided or <code>None</code>, just
returns a pointer to the input tokens <code>torch.nn.Embedding</code> module of the model without doing anything.`,name:"new_num_tokens"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_utils.py#L1380",returnDescription:`
<p>Pointer to the input tokens Embeddings Module of the model.</p>
`,returnType:`
<p><code>torch.nn.Embedding</code></p>
`}}),_r=new $({props:{name:"reverse_bettertransformer",anchor:"transformers.PreTrainedModel.reverse_bettertransformer",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_utils.py#L3460",returnDescription:`
<p>The model converted back to the original modeling.</p>
`,returnType:`
<p><a
  href="/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel"
>PreTrainedModel</a></p>
`}}),vr=new $({props:{name:"save_pretrained",anchor:"transformers.PreTrainedModel.save_pretrained",parameters:[{name:"save_directory",val:": typing.Union[str, os.PathLike]"},{name:"is_main_process",val:": bool = True"},{name:"state_dict",val:": typing.Optional[dict] = None"},{name:"save_function",val:": typing.Callable = <function save at 0x7f6d96c814c0>"},{name:"push_to_hub",val:": bool = False"},{name:"max_shard_size",val:": typing.Union[int, str] = '10GB'"},{name:"safe_serialization",val:": bool = False"},{name:"variant",val:": typing.Optional[str] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.PreTrainedModel.save_pretrained.save_directory",description:`<strong>save_directory</strong> (<code>str</code> or <code>os.PathLike</code>) &#x2014;
Directory to which to save. Will be created if it doesn&#x2019;t exist.`,name:"save_directory"},{anchor:"transformers.PreTrainedModel.save_pretrained.is_main_process",description:`<strong>is_main_process</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether the process calling this is the main process or not. Useful when in distributed training like
TPUs and 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:"transformers.PreTrainedModel.save_pretrained.state_dict",description:`<strong>state_dict</strong> (nested dictionary of <code>torch.Tensor</code>) &#x2014;
The state dictionary of the model to save. Will default to <code>self.state_dict()</code>, but can be used to only
save parts of the model or if special precautions need to be taken when recovering the state dictionary
of a model (like when using model parallelism).`,name:"state_dict"},{anchor:"transformers.PreTrainedModel.save_pretrained.save_function",description:`<strong>save_function</strong> (<code>Callable</code>) &#x2014;
The function to use to save the state dictionary. Useful on distributed training like TPUs when one
need to replace <code>torch.save</code> by another method.`,name:"save_function"},{anchor:"transformers.PreTrainedModel.save_pretrained.push_to_hub",description:`<strong>push_to_hub</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
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:"transformers.PreTrainedModel.save_pretrained.max_shard_size",description:`<strong>max_shard_size</strong> (<code>int</code> or <code>str</code>, <em>optional</em>, defaults to <code>&quot;10GB&quot;</code>) &#x2014;
The maximum size for a checkpoint before being sharded. Checkpoints shard will then be each of size
lower than this size. If expressed as a string, needs to be digits followed by a unit (like <code>&quot;5MB&quot;</code>).</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>If a single weight of the model is bigger than <code>max_shard_size</code>, it will be in its own checkpoint shard
which will be bigger than <code>max_shard_size</code>.</p>

					</div>`,name:"max_shard_size"},{anchor:"transformers.PreTrainedModel.save_pretrained.safe_serialization",description:`<strong>safe_serialization</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to save the model using <code>safetensors</code> or the traditional PyTorch way (that uses <code>pickle</code>).`,name:"safe_serialization"},{anchor:"transformers.PreTrainedModel.save_pretrained.variant",description:`<strong>variant</strong> (<code>str</code>, <em>optional</em>) &#x2014;
If specified, weights are saved in the format pytorch_model.<variant>.bin.</variant>`,name:"variant"},{anchor:"transformers.PreTrainedModel.save_pretrained.kwargs",description:`<strong>kwargs</strong> (<code>Dict[str, Any]</code>, <em>optional</em>) &#x2014;
Additional key word arguments passed along to the <a href="/docs/transformers/v4.31.0/en/internal/image_processing_utils#transformers.ImageProcessingMixin.push_to_hub">push_to_hub()</a> method.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_utils.py#L1654"}}),wr=new $({props:{name:"set_input_embeddings",anchor:"transformers.PreTrainedModel.set_input_embeddings",parameters:[{name:"value",val:": Module"}],parametersDescription:[{anchor:"transformers.PreTrainedModel.set_input_embeddings.value",description:"<strong>value</strong> (<code>nn.Module</code>) &#x2014; A module mapping vocabulary to hidden states.",name:"value"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_utils.py#L1227"}}),Mr=new $({props:{name:"tie_weights",anchor:"transformers.PreTrainedModel.tie_weights",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_utils.py#L1264"}}),$r=new $({props:{name:"to_bettertransformer",anchor:"transformers.PreTrainedModel.to_bettertransformer",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_utils.py#L3432",returnDescription:`
<p>The model converted to BetterTransformer.</p>
`,returnType:`
<p><a
  href="/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel"
>PreTrainedModel</a></p>
`}}),jr=new $({props:{name:"warn_if_padding_and_no_attention_mask",anchor:"transformers.PreTrainedModel.warn_if_padding_and_no_attention_mask",parameters:[{name:"input_ids",val:""},{name:"attention_mask",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_utils.py#L3482"}}),Ur=new Re({}),Fr=new z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvclNlcTJTZXFMTSUwQSUwQXQwcHAlMjAlM0QlMjBBdXRvTW9kZWxGb3JTZXEyU2VxTE0uZnJvbV9wcmV0cmFpbmVkKCUyMmJpZ3NjaWVuY2UlMkZUMHBwJTIyJTJDJTIwbG93X2NwdV9tZW1fdXNhZ2UlM0RUcnVlKQ==",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForSeq2SeqLM

t0pp = AutoModelForSeq2SeqLM.from_pretrained(<span class="hljs-string">&quot;bigscience/T0pp&quot;</span>, low_cpu_mem_usage=<span class="hljs-literal">True</span>)`}}),Ir=new z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvclNlcTJTZXFMTSUwQSUwQXQwcHAlMjAlM0QlMjBBdXRvTW9kZWxGb3JTZXEyU2VxTE0uZnJvbV9wcmV0cmFpbmVkKCUyMmJpZ3NjaWVuY2UlMkZUMHBwJTIyJTJDJTIwZGV2aWNlX21hcCUzRCUyMmF1dG8lMjIp",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForSeq2SeqLM

t0pp = AutoModelForSeq2SeqLM.from_pretrained(<span class="hljs-string">&quot;bigscience/T0pp&quot;</span>, device_map=<span class="hljs-string">&quot;auto&quot;</span>)`}}),Zr=new z({props:{code:"dDBwcC5oZl9kZXZpY2VfbWFw",highlighted:"t0pp.hf_device_map"}}),Cr=new z({props:{code:"JTdCJ3NoYXJlZCclM0ElMjAwJTJDJTBBJTIwJ2RlY29kZXIuZW1iZWRfdG9rZW5zJyUzQSUyMDAlMkMlMEElMjAnZW5jb2RlciclM0ElMjAwJTJDJTBBJTIwJ2RlY29kZXIuYmxvY2suMCclM0ElMjAwJTJDJTBBJTIwJ2RlY29kZXIuYmxvY2suMSclM0ElMjAxJTJDJTBBJTIwJ2RlY29kZXIuYmxvY2suMiclM0ElMjAxJTJDJTBBJTIwJ2RlY29kZXIuYmxvY2suMyclM0ElMjAxJTJDJTBBJTIwJ2RlY29kZXIuYmxvY2suNCclM0ElMjAxJTJDJTBBJTIwJ2RlY29kZXIuYmxvY2suNSclM0ElMjAxJTJDJTBBJTIwJ2RlY29kZXIuYmxvY2suNiclM0ElMjAxJTJDJTBBJTIwJ2RlY29kZXIuYmxvY2suNyclM0ElMjAxJTJDJTBBJTIwJ2RlY29kZXIuYmxvY2suOCclM0ElMjAxJTJDJTBBJTIwJ2RlY29kZXIuYmxvY2suOSclM0ElMjAxJTJDJTBBJTIwJ2RlY29kZXIuYmxvY2suMTAnJTNBJTIwMSUyQyUwQSUyMCdkZWNvZGVyLmJsb2NrLjExJyUzQSUyMDElMkMlMEElMjAnZGVjb2Rlci5ibG9jay4xMiclM0ElMjAxJTJDJTBBJTIwJ2RlY29kZXIuYmxvY2suMTMnJTNBJTIwMSUyQyUwQSUyMCdkZWNvZGVyLmJsb2NrLjE0JyUzQSUyMDElMkMlMEElMjAnZGVjb2Rlci5ibG9jay4xNSclM0ElMjAxJTJDJTBBJTIwJ2RlY29kZXIuYmxvY2suMTYnJTNBJTIwMSUyQyUwQSUyMCdkZWNvZGVyLmJsb2NrLjE3JyUzQSUyMDElMkMlMEElMjAnZGVjb2Rlci5ibG9jay4xOCclM0ElMjAxJTJDJTBBJTIwJ2RlY29kZXIuYmxvY2suMTknJTNBJTIwMSUyQyUwQSUyMCdkZWNvZGVyLmJsb2NrLjIwJyUzQSUyMDElMkMlMEElMjAnZGVjb2Rlci5ibG9jay4yMSclM0ElMjAxJTJDJTBBJTIwJ2RlY29kZXIuYmxvY2suMjInJTNBJTIwJ2NwdSclMkMlMEElMjAnZGVjb2Rlci5ibG9jay4yMyclM0ElMjAnY3B1JyUyQyUwQSUyMCdkZWNvZGVyLmZpbmFsX2xheWVyX25vcm0nJTNBJTIwJ2NwdSclMkMlMEElMjAnZGVjb2Rlci5kcm9wb3V0JyUzQSUyMCdjcHUnJTJDJTBBJTIwJ2xtX2hlYWQnJTNBJTIwJ2NwdSclN0Q=",highlighted:`{<span class="hljs-string">&#x27;shared&#x27;</span>: <span class="hljs-number">0</span>,
 <span class="hljs-string">&#x27;decoder.embed_tokens&#x27;</span>: <span class="hljs-number">0</span>,
 <span class="hljs-string">&#x27;encoder&#x27;</span>: <span class="hljs-number">0</span>,
 <span class="hljs-string">&#x27;decoder.block.0&#x27;</span>: <span class="hljs-number">0</span>,
 <span class="hljs-string">&#x27;decoder.block.1&#x27;</span>: <span class="hljs-number">1</span>,
 <span class="hljs-string">&#x27;decoder.block.2&#x27;</span>: <span class="hljs-number">1</span>,
 <span class="hljs-string">&#x27;decoder.block.3&#x27;</span>: <span class="hljs-number">1</span>,
 <span class="hljs-string">&#x27;decoder.block.4&#x27;</span>: <span class="hljs-number">1</span>,
 <span class="hljs-string">&#x27;decoder.block.5&#x27;</span>: <span class="hljs-number">1</span>,
 <span class="hljs-string">&#x27;decoder.block.6&#x27;</span>: <span class="hljs-number">1</span>,
 <span class="hljs-string">&#x27;decoder.block.7&#x27;</span>: <span class="hljs-number">1</span>,
 <span class="hljs-string">&#x27;decoder.block.8&#x27;</span>: <span class="hljs-number">1</span>,
 <span class="hljs-string">&#x27;decoder.block.9&#x27;</span>: <span class="hljs-number">1</span>,
 <span class="hljs-string">&#x27;decoder.block.10&#x27;</span>: <span class="hljs-number">1</span>,
 <span class="hljs-string">&#x27;decoder.block.11&#x27;</span>: <span class="hljs-number">1</span>,
 <span class="hljs-string">&#x27;decoder.block.12&#x27;</span>: <span class="hljs-number">1</span>,
 <span class="hljs-string">&#x27;decoder.block.13&#x27;</span>: <span class="hljs-number">1</span>,
 <span class="hljs-string">&#x27;decoder.block.14&#x27;</span>: <span class="hljs-number">1</span>,
 <span class="hljs-string">&#x27;decoder.block.15&#x27;</span>: <span class="hljs-number">1</span>,
 <span class="hljs-string">&#x27;decoder.block.16&#x27;</span>: <span class="hljs-number">1</span>,
 <span class="hljs-string">&#x27;decoder.block.17&#x27;</span>: <span class="hljs-number">1</span>,
 <span class="hljs-string">&#x27;decoder.block.18&#x27;</span>: <span class="hljs-number">1</span>,
 <span class="hljs-string">&#x27;decoder.block.19&#x27;</span>: <span class="hljs-number">1</span>,
 <span class="hljs-string">&#x27;decoder.block.20&#x27;</span>: <span class="hljs-number">1</span>,
 <span class="hljs-string">&#x27;decoder.block.21&#x27;</span>: <span class="hljs-number">1</span>,
 <span class="hljs-string">&#x27;decoder.block.22&#x27;</span>: <span class="hljs-string">&#x27;cpu&#x27;</span>,
 <span class="hljs-string">&#x27;decoder.block.23&#x27;</span>: <span class="hljs-string">&#x27;cpu&#x27;</span>,
 <span class="hljs-string">&#x27;decoder.final_layer_norm&#x27;</span>: <span class="hljs-string">&#x27;cpu&#x27;</span>,
 <span class="hljs-string">&#x27;decoder.dropout&#x27;</span>: <span class="hljs-string">&#x27;cpu&#x27;</span>,
 <span class="hljs-string">&#x27;lm_head&#x27;</span>: <span class="hljs-string">&#x27;cpu&#x27;</span>}`}}),Wr=new z({props:{code:"ZGV2aWNlX21hcCUyMCUzRCUyMCU3QiUyMnNoYXJlZCUyMiUzQSUyMDAlMkMlMjAlMjJlbmNvZGVyJTIyJTNBJTIwMCUyQyUyMCUyMmRlY29kZXIlMjIlM0ElMjAxJTJDJTIwJTIybG1faGVhZCUyMiUzQSUyMDElN0Q=",highlighted:'device_map = {<span class="hljs-string">&quot;shared&quot;</span>: <span class="hljs-number">0</span>, <span class="hljs-string">&quot;encoder&quot;</span>: <span class="hljs-number">0</span>, <span class="hljs-string">&quot;decoder&quot;</span>: <span class="hljs-number">1</span>, <span class="hljs-string">&quot;lm_head&quot;</span>: <span class="hljs-number">1</span>}'}}),Gr=new Re({}),zr=new z({props:{code:"bW9kZWwlMjAlM0QlMjBUNUZvckNvbmRpdGlvbmFsR2VuZXJhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIydDUlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYp",highlighted:'model = T5ForConditionalGeneration.from_pretrained(<span class="hljs-string">&quot;t5&quot;</span>, torch_dtype=torch.float16)'}}),Br=new z({props:{code:"bW9kZWwlMjAlM0QlMjBUNUZvckNvbmRpdGlvbmFsR2VuZXJhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIydDUlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRCUyMmF1dG8lMjIp",highlighted:'model = T5ForConditionalGeneration.from_pretrained(<span class="hljs-string">&quot;t5&quot;</span>, torch_dtype=<span class="hljs-string">&quot;auto&quot;</span>)'}}),Dr=new z({props:{code:"Y29uZmlnJTIwJTNEJTIwVDVDb25maWcuZnJvbV9wcmV0cmFpbmVkKCUyMnQ1JTIyKSUwQW1vZGVsJTIwJTNEJTIwQXV0b01vZGVsLmZyb21fY29uZmlnKGNvbmZpZyk=",highlighted:`config = T5Config.from_pretrained(<span class="hljs-string">&quot;t5&quot;</span>)
model = AutoModel.from_config(config)`}}),Rr=new Re({}),Vr=new $({props:{name:"class transformers.modeling_utils.ModuleUtilsMixin",anchor:"transformers.modeling_utils.ModuleUtilsMixin",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_utils.py#L741"}}),Nr=new $({props:{name:"add_memory_hooks",anchor:"transformers.modeling_utils.ModuleUtilsMixin.add_memory_hooks",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_utils.py#L772"}}),Yr=new $({props:{name:"estimate_tokens",anchor:"transformers.modeling_utils.ModuleUtilsMixin.estimate_tokens",parameters:[{name:"input_dict",val:": typing.Dict[str, typing.Union[torch.Tensor, typing.Any]]"}],parametersDescription:[{anchor:"transformers.modeling_utils.ModuleUtilsMixin.estimate_tokens.inputs",description:"<strong>inputs</strong> (<code>dict</code>) &#x2014; The model inputs.",name:"inputs"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_utils.py#L976",returnDescription:`
<p>The total number of tokens.</p>
`,returnType:`
<p><code>int</code></p>
`}}),Ar=new $({props:{name:"floating_point_ops",anchor:"transformers.modeling_utils.ModuleUtilsMixin.floating_point_ops",parameters:[{name:"input_dict",val:": typing.Dict[str, typing.Union[torch.Tensor, typing.Any]]"},{name:"exclude_embeddings",val:": bool = True"}],parametersDescription:[{anchor:"transformers.modeling_utils.ModuleUtilsMixin.floating_point_ops.batch_size",description:`<strong>batch_size</strong> (<code>int</code>) &#x2014;
The batch size for the forward pass.`,name:"batch_size"},{anchor:"transformers.modeling_utils.ModuleUtilsMixin.floating_point_ops.sequence_length",description:`<strong>sequence_length</strong> (<code>int</code>) &#x2014;
The number of tokens in each line of the batch.`,name:"sequence_length"},{anchor:"transformers.modeling_utils.ModuleUtilsMixin.floating_point_ops.exclude_embeddings",description:`<strong>exclude_embeddings</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to count embedding and softmax operations.`,name:"exclude_embeddings"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_utils.py#L997",returnDescription:`
<p>The number of floating-point operations.</p>
`,returnType:`
<p><code>int</code></p>
`}}),Lr=new $({props:{name:"get_extended_attention_mask",anchor:"transformers.modeling_utils.ModuleUtilsMixin.get_extended_attention_mask",parameters:[{name:"attention_mask",val:": Tensor"},{name:"input_shape",val:": typing.Tuple[int]"},{name:"device",val:": device = None"},{name:"dtype",val:": torch.float32 = None"}],parametersDescription:[{anchor:"transformers.modeling_utils.ModuleUtilsMixin.get_extended_attention_mask.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code>) &#x2014;
Mask with ones indicating tokens to attend to, zeros for tokens to ignore.`,name:"attention_mask"},{anchor:"transformers.modeling_utils.ModuleUtilsMixin.get_extended_attention_mask.input_shape",description:`<strong>input_shape</strong> (<code>Tuple[int]</code>) &#x2014;
The shape of the input to the model.`,name:"input_shape"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_utils.py#L860",returnDescription:`
<p><code>torch.Tensor</code> The extended attention mask, with a the same dtype as <code>attention_mask.dtype</code>.</p>
`}}),Sr=new $({props:{name:"get_head_mask",anchor:"transformers.modeling_utils.ModuleUtilsMixin.get_head_mask",parameters:[{name:"head_mask",val:": typing.Optional[torch.Tensor]"},{name:"num_hidden_layers",val:": int"},{name:"is_attention_chunked",val:": bool = False"}],parametersDescription:[{anchor:"transformers.modeling_utils.ModuleUtilsMixin.get_head_mask.head_mask",description:`<strong>head_mask</strong> (<code>torch.Tensor</code> with shape <code>[num_heads]</code> or <code>[num_hidden_layers x num_heads]</code>, <em>optional</em>) &#x2014;
The mask indicating if we should keep the heads or not (1.0 for keep, 0.0 for discard).`,name:"head_mask"},{anchor:"transformers.modeling_utils.ModuleUtilsMixin.get_head_mask.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>) &#x2014;
The number of hidden layers in the model.`,name:"num_hidden_layers"},{anchor:"transformers.modeling_utils.ModuleUtilsMixin.get_head_mask.is_attention_chunked",description:`<strong>is_attention_chunked</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not the attentions scores are computed by chunks or not.`,name:"is_attention_chunked"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_utils.py#L912",returnDescription:`
<p><code>torch.Tensor</code> with shape <code>[num_hidden_layers x batch x num_heads x seq_length x seq_length]</code> or list with
<code>[None]</code> for each layer.</p>
`}}),Hr=new $({props:{name:"invert_attention_mask",anchor:"transformers.modeling_utils.ModuleUtilsMixin.invert_attention_mask",parameters:[{name:"encoder_attention_mask",val:": Tensor"}],parametersDescription:[{anchor:"transformers.modeling_utils.ModuleUtilsMixin.invert_attention_mask.encoder_attention_mask",description:"<strong>encoder_attention_mask</strong> (<code>torch.Tensor</code>) &#x2014; An attention mask.",name:"encoder_attention_mask"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_utils.py#L808",returnDescription:`
<p>The inverted attention mask.</p>
`,returnType:`
<p><code>torch.Tensor</code></p>
`}}),Qr=new $({props:{name:"num_parameters",anchor:"transformers.modeling_utils.ModuleUtilsMixin.num_parameters",parameters:[{name:"only_trainable",val:": bool = False"},{name:"exclude_embeddings",val:": bool = False"}],parametersDescription:[{anchor:"transformers.modeling_utils.ModuleUtilsMixin.num_parameters.only_trainable",description:`<strong>only_trainable</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to return only the number of trainable parameters`,name:"only_trainable"},{anchor:"transformers.modeling_utils.ModuleUtilsMixin.num_parameters.exclude_embeddings",description:`<strong>exclude_embeddings</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to return only the number of non-embeddings parameters`,name:"exclude_embeddings"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_utils.py#L950",returnDescription:`
<p>The number of parameters.</p>
`,returnType:`
<p><code>int</code></p>
`}}),Or=new $({props:{name:"reset_memory_hooks_state",anchor:"transformers.modeling_utils.ModuleUtilsMixin.reset_memory_hooks_state",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_utils.py#L784"}}),Kr=new Re({}),ea=new $({props:{name:"class transformers.TFPreTrainedModel",anchor:"transformers.TFPreTrainedModel",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_tf_utils.py#L1057"}}),oa=new $({props:{name:"push_to_hub",anchor:"transformers.TFPreTrainedModel.push_to_hub",parameters:[{name:"repo_id",val:": str"},{name:"use_temp_dir",val:": Optional[bool] = None"},{name:"commit_message",val:": Optional[str] = None"},{name:"private",val:": Optional[bool] = None"},{name:"max_shard_size",val:": Optional[Union[int, str]] = '10GB'"},{name:"use_auth_token",val:": Optional[Union[bool, str]] = None"},{name:"create_pr",val:": bool = False"},{name:"**base_model_card_args",val:""}],parametersDescription:[{anchor:"transformers.TFPreTrainedModel.push_to_hub.repo_id",description:`<strong>repo_id</strong> (<code>str</code>) &#x2014;
The name of the repository you want to push your model to. It should contain your organization name
when pushing to a given organization.`,name:"repo_id"},{anchor:"transformers.TFPreTrainedModel.push_to_hub.use_temp_dir",description:`<strong>use_temp_dir</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to use a temporary directory to store the files saved before they are pushed to the Hub.
Will default to <code>True</code> if there is no directory named like <code>repo_id</code>, <code>False</code> otherwise.`,name:"use_temp_dir"},{anchor:"transformers.TFPreTrainedModel.push_to_hub.commit_message",description:`<strong>commit_message</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Message to commit while pushing. Will default to <code>&quot;Upload model&quot;</code>.`,name:"commit_message"},{anchor:"transformers.TFPreTrainedModel.push_to_hub.private",description:`<strong>private</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not the repository created should be private.`,name:"private"},{anchor:"transformers.TFPreTrainedModel.push_to_hub.use_auth_token",description:`<strong>use_auth_token</strong> (<code>bool</code> or <code>str</code>, <em>optional</em>) &#x2014;
The token to use as HTTP bearer authorization for remote files. If <code>True</code>, will use the token generated
when running <code>huggingface-cli login</code> (stored in <code>~/.huggingface</code>). Will default to <code>True</code> if <code>repo_url</code>
is not specified.`,name:"use_auth_token"},{anchor:"transformers.TFPreTrainedModel.push_to_hub.max_shard_size",description:`<strong>max_shard_size</strong> (<code>int</code> or <code>str</code>, <em>optional</em>, defaults to <code>&quot;10GB&quot;</code>) &#x2014;
Only applicable for models. The maximum size for a checkpoint before being sharded. Checkpoints shard
will then be each of size lower than this size. If expressed as a string, needs to be digits followed
by a unit (like <code>&quot;5MB&quot;</code>).`,name:"max_shard_size"},{anchor:"transformers.TFPreTrainedModel.push_to_hub.create_pr",description:`<strong>create_pr</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to create a PR with the uploaded files or directly commit.`,name:"create_pr"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_tf_utils.py#L3032"}}),Ot=new Ve({props:{anchor:"transformers.TFPreTrainedModel.push_to_hub.example",$$slots:{default:[Ux]},$$scope:{ctx:F}}}),aa=new $({props:{name:"can_generate",anchor:"transformers.TFPreTrainedModel.can_generate",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_tf_utils.py#L1302",returnDescription:`
<p>Whether this model can generate sequences with <code>.generate()</code>.</p>
`,returnType:`
<p><code>bool</code></p>
`}}),sa=new $({props:{name:"compile",anchor:"transformers.TFPreTrainedModel.compile",parameters:[{name:"optimizer",val:" = 'rmsprop'"},{name:"loss",val:" = 'auto_with_warning'"},{name:"metrics",val:" = None"},{name:"loss_weights",val:" = None"},{name:"weighted_metrics",val:" = None"},{name:"run_eagerly",val:" = None"},{name:"steps_per_execution",val:" = None"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_tf_utils.py#L1501"}}),la=new $({props:{name:"create_model_card",anchor:"transformers.TFPreTrainedModel.create_model_card",parameters:[{name:"output_dir",val:""},{name:"model_name",val:": str"},{name:"language",val:": Optional[str] = None"},{name:"license",val:": Optional[str] = None"},{name:"tags",val:": Optional[str] = None"},{name:"finetuned_from",val:": Optional[str] = None"},{name:"tasks",val:": Optional[str] = None"},{name:"dataset_tags",val:": Optional[Union[str, List[str]]] = None"},{name:"dataset",val:": Optional[Union[str, List[str]]] = None"},{name:"dataset_args",val:": Optional[Union[str, List[str]]] = None"}],parametersDescription:[{anchor:"transformers.TFPreTrainedModel.create_model_card.output_dir",description:`<strong>output_dir</strong> (<code>str</code> or <code>os.PathLike</code>) &#x2014;
The folder in which to create the model card.`,name:"output_dir"},{anchor:"transformers.TFPreTrainedModel.create_model_card.model_name",description:`<strong>model_name</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The name of the model.`,name:"model_name"},{anchor:"transformers.TFPreTrainedModel.create_model_card.language",description:`<strong>language</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The language of the model (if applicable)`,name:"language"},{anchor:"transformers.TFPreTrainedModel.create_model_card.license",description:`<strong>license</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The license of the model. Will default to the license of the pretrained model used, if the original
model given to the <code>Trainer</code> comes from a repo on the Hub.`,name:"license"},{anchor:"transformers.TFPreTrainedModel.create_model_card.tags",description:`<strong>tags</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
Some tags to be included in the metadata of the model card.`,name:"tags"},{anchor:"transformers.TFPreTrainedModel.create_model_card.finetuned_from",description:`<strong>finetuned_from</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The name of the model used to fine-tune this one (if applicable). Will default to the name of the repo
of the original model given to the <code>Trainer</code> (if it comes from the Hub).`,name:"finetuned_from"},{anchor:"transformers.TFPreTrainedModel.create_model_card.tasks",description:`<strong>tasks</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
One or several task identifiers, to be included in the metadata of the model card.`,name:"tasks"},{anchor:"transformers.TFPreTrainedModel.create_model_card.dataset_tags",description:`<strong>dataset_tags</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
One or several dataset tags, to be included in the metadata of the model card.`,name:"dataset_tags"},{anchor:"transformers.TFPreTrainedModel.create_model_card.dataset",description:`<strong>dataset</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
One or several dataset identifiers, to be included in the metadata of the model card.`,name:"dataset"},{anchor:"transformers.TFPreTrainedModel.create_model_card.dataset_args",description:`<strong>dataset_args</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
One or several dataset arguments, to be included in the metadata of the model card.`,name:"dataset_args"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_tf_utils.py#L1796"}}),da=new $({props:{name:"eager_serving",anchor:"transformers.TFPreTrainedModel.eager_serving",parameters:[{name:"inputs",val:""}],parametersDescription:[{anchor:"transformers.TFPreTrainedModel.eager_serving.inputs",description:`<strong>inputs</strong> (<code>Dict[str, tf.Tensor]</code>) &#x2014;
The input of the saved model as a dictionary of tensors.`,name:"inputs"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_tf_utils.py#L1214"}}),ca=new $({props:{name:"from_pretrained",anchor:"transformers.TFPreTrainedModel.from_pretrained",parameters:[{name:"pretrained_model_name_or_path",val:": Optional[Union[str, os.PathLike]]"},{name:"*model_args",val:""},{name:"config",val:": Optional[Union[PretrainedConfig, str, os.PathLike]] = None"},{name:"cache_dir",val:": Optional[Union[str, os.PathLike]] = None"},{name:"ignore_mismatched_sizes",val:": bool = False"},{name:"force_download",val:": bool = False"},{name:"local_files_only",val:": bool = False"},{name:"token",val:": Optional[Union[str, bool]] = None"},{name:"revision",val:": str = 'main'"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFPreTrainedModel.from_pretrained.pretrained_model_name_or_path",description:`<strong>pretrained_model_name_or_path</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Can be either:</p>
<ul>
<li>A string, the <em>model id</em> of a pretrained model hosted inside a model repo on huggingface.co.
Valid model ids can be located at the root-level, like <code>bert-base-uncased</code>, or namespaced under a
user or organization name, like <code>dbmdz/bert-base-german-cased</code>.</li>
<li>A path to a <em>directory</em> containing model weights saved using
<a href="/docs/transformers/v4.31.0/en/main_classes/model#transformers.TFPreTrainedModel.save_pretrained">save_pretrained()</a>, e.g., <code>./my_model_directory/</code>.</li>
<li>A path or url to a <em>PyTorch state_dict save file</em> (e.g, <code>./pt_model/pytorch_model.bin</code>). In this
case, <code>from_pt</code> should be set to <code>True</code> and a configuration object should be provided as <code>config</code>
argument. This loading path is slower than converting the PyTorch model in a TensorFlow model
using the provided conversion scripts and loading the TensorFlow model afterwards.</li>
<li><code>None</code> if you are both providing the configuration and state dictionary (resp. with keyword
arguments <code>config</code> and <code>state_dict</code>).</li>
</ul>`,name:"pretrained_model_name_or_path"},{anchor:"transformers.TFPreTrainedModel.from_pretrained.model_args",description:`<strong>model_args</strong> (sequence of positional arguments, <em>optional</em>) &#x2014;
All remaining positional arguments will be passed to the underlying model&#x2019;s <code>__init__</code> method.`,name:"model_args"},{anchor:"transformers.TFPreTrainedModel.from_pretrained.config",description:`<strong>config</strong> (<code>Union[PretrainedConfig, str]</code>, <em>optional</em>) &#x2014;
Can be either:</p>
<ul>
<li>an instance of a class derived from <a href="/docs/transformers/v4.31.0/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a>,</li>
<li>a string valid as input to <a href="/docs/transformers/v4.31.0/en/main_classes/configuration#transformers.PretrainedConfig.from_pretrained">from_pretrained()</a>.</li>
</ul>
<p>Configuration for the model to use instead of an automatically loaded configuration. Configuration can
be automatically loaded when:</p>
<ul>
<li>The model is a model provided by the library (loaded with the <em>model id</em> string of a pretrained
model).</li>
<li>The model was saved using <a href="/docs/transformers/v4.31.0/en/main_classes/model#transformers.TFPreTrainedModel.save_pretrained">save_pretrained()</a> and is reloaded by supplying the
save directory.</li>
<li>The model is loaded by supplying a local directory as <code>pretrained_model_name_or_path</code> and a
configuration JSON file named <em>config.json</em> is found in the directory.</li>
</ul>`,name:"config"},{anchor:"transformers.TFPreTrainedModel.from_pretrained.from_pt",description:`<strong>from_pt</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Load the model weights from a PyTorch state_dict save file (see docstring of
<code>pretrained_model_name_or_path</code> argument).`,name:"from_pt"},{anchor:"transformers.TFPreTrainedModel.from_pretrained.ignore_mismatched_sizes",description:`<strong>ignore_mismatched_sizes</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to raise an error if some of the weights from the checkpoint do not have the same size
as the weights of the model (if for instance, you are instantiating a model with 10 labels from a
checkpoint with 3 labels).`,name:"ignore_mismatched_sizes"},{anchor:"transformers.TFPreTrainedModel.from_pretrained.cache_dir",description:`<strong>cache_dir</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Path to a directory in which a downloaded pretrained model configuration should be cached if the
standard cache should not be used.`,name:"cache_dir"},{anchor:"transformers.TFPreTrainedModel.from_pretrained.force_download",description:`<strong>force_download</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
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:"transformers.TFPreTrainedModel.from_pretrained.resume_download",description:`<strong>resume_download</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to delete incompletely received files. Will attempt to resume the download if such a
file exists.
proxies &#x2014;
(<code>Dict[str, str], </code>optional<code>): A dictionary of proxy servers to use by protocol or endpoint, e.g., </code>{&#x2018;http&#x2019;: &#x2018;foo.bar:3128&#x2019;, &#x2018;http://hostname&#x2019;: &#x2018;foo.bar:4012&#x2019;}<code>. The proxies are used on each request. output_loading_info(</code>bool<code>, *optional*, defaults to </code>False\`): Whether ot not to also return a
dictionary containing missing keys, unexpected keys and error messages.`,name:"resume_download"},{anchor:"transformers.TFPreTrainedModel.from_pretrained.local_files_only(bool,",description:`<strong>local_files_only(<code>bool</code>,</strong> <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to only look at local files (e.g., not try doanloading the model).`,name:"local_files_only(bool,"},{anchor:"transformers.TFPreTrainedModel.from_pretrained.token",description:`<strong>token</strong> (<code>str</code> or <code>bool</code>, <em>optional</em>) &#x2014;
The token to use as HTTP bearer authorization for remote files. If <code>True</code>, or not specified, will use
the token generated when running <code>huggingface-cli login</code> (stored in <code>~/.huggingface</code>).`,name:"token"},{anchor:"transformers.TFPreTrainedModel.from_pretrained.revision",description:`<strong>revision</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;main&quot;</code>) &#x2014;
The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a
git-based system for storing models and other artifacts on huggingface.co, so <code>revision</code> can be any
identifier allowed by git.`,name:"revision"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_tf_utils.py#L2484"}}),ro=new Ve({props:{anchor:"transformers.TFPreTrainedModel.from_pretrained.example",$$slots:{default:[Jx]},$$scope:{ctx:F}}}),pa=new $({props:{name:"get_bias",anchor:"transformers.TFPreTrainedModel.get_bias",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_tf_utils.py#L1936",returnDescription:`
<p>The weights representing the bias, None if not an LM model.</p>
`,returnType:`
<p><code>tf.Variable</code></p>
`}}),fa=new $({props:{name:"get_head_mask",anchor:"transformers.TFPreTrainedModel.get_head_mask",parameters:[{name:"head_mask",val:": tf.Tensor | None"},{name:"num_hidden_layers",val:": int"}],parametersDescription:[{anchor:"transformers.TFPreTrainedModel.get_head_mask.head_mask",description:`<strong>head_mask</strong> (<code>tf.Tensor</code> with shape <code>[num_heads]</code> or <code>[num_hidden_layers x num_heads]</code>, <em>optional</em>) &#x2014;
The mask indicating if we should keep the heads or not (1.0 for keep, 0.0 for discard).`,name:"head_mask"},{anchor:"transformers.TFPreTrainedModel.get_head_mask.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>) &#x2014;
The number of hidden layers in the model.`,name:"num_hidden_layers"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_tf_utils.py#L1169",returnDescription:`
<p><code>tf.Tensor</code> with shape <code>[num_hidden_layers x batch x num_heads x seq_length x seq_length]</code> or list with
<code>[None]</code> for each layer.</p>
`}}),ua=new $({props:{name:"get_input_embeddings",anchor:"transformers.TFPreTrainedModel.get_input_embeddings",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_tf_utils.py#L1315",returnDescription:`
<p>The embeddings layer mapping vocabulary to hidden states.</p>
`,returnType:`
<p><code>tf.Variable</code></p>
`}}),ga=new $({props:{name:"get_lm_head",anchor:"transformers.TFPreTrainedModel.get_lm_head",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_tf_utils.py#L1969",returnDescription:`
<p>The LM head layer if the model has one, None if not.</p>
`,returnType:`
<p><code>tf.keras.layers.Layer</code></p>
`}}),_a=new $({props:{name:"get_output_embeddings",anchor:"transformers.TFPreTrainedModel.get_output_embeddings",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_tf_utils.py#L1876",returnDescription:`
<p>The new weights mapping vocabulary to hidden states.</p>
`,returnType:`
<p><code>tf.Variable</code></p>
`}}),ba=new $({props:{name:"get_output_layer_with_bias",anchor:"transformers.TFPreTrainedModel.get_output_layer_with_bias",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_tf_utils.py#L1913",returnDescription:`
<p>The layer that handles the bias, None if not an LM model.</p>
`,returnType:`
<p><code>tf.keras.layers.Layer</code></p>
`}}),va=new $({props:{name:"get_prefix_bias_name",anchor:"transformers.TFPreTrainedModel.get_prefix_bias_name",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_tf_utils.py#L1926",returnDescription:`
<p>The _prefix name of the bias.</p>
`,returnType:`
<p><code>str</code></p>
`}}),ya=new $({props:{name:"load_repo_checkpoint",anchor:"transformers.TFPreTrainedModel.load_repo_checkpoint",parameters:[{name:"repo_path_or_name",val:""}],parametersDescription:[{anchor:"transformers.TFPreTrainedModel.load_repo_checkpoint.repo_path_or_name",description:`<strong>repo_path_or_name</strong> (<code>str</code>) &#x2014;
Can either be a repository name for your {object} in the Hub or a path to a local folder (in which case
the repository will have the name of that local folder).`,name:"repo_path_or_name"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_tf_utils.py#L1342",returnDescription:`
<p>A dictionary of extra metadata from the checkpoint, most commonly an \u201Cepoch\u201D count.</p>
`,returnType:`
<p><code>dict</code></p>
`}}),wa=new $({props:{name:"prepare_tf_dataset",anchor:"transformers.TFPreTrainedModel.prepare_tf_dataset",parameters:[{name:"dataset",val:": 'datasets.Dataset'"},{name:"batch_size",val:": int = 8"},{name:"shuffle",val:": bool = True"},{name:"tokenizer",val:": Optional['PreTrainedTokenizerBase'] = None"},{name:"collate_fn",val:": Optional[Callable] = None"},{name:"collate_fn_args",val:": Optional[Dict[str, Any]] = None"},{name:"drop_remainder",val:": Optional[bool] = None"},{name:"prefetch",val:": bool = True"}],parametersDescription:[{anchor:"transformers.TFPreTrainedModel.prepare_tf_dataset.dataset",description:`<strong>dataset</strong> (<code>Any</code>) &#x2014;
A [~<code>datasets.Dataset</code>] to be wrapped as a <code>tf.data.Dataset</code>.`,name:"dataset"},{anchor:"transformers.TFPreTrainedModel.prepare_tf_dataset.batch_size",description:`<strong>batch_size</strong> (<code>int</code>, defaults to 8) &#x2014;
The size of batches to return.`,name:"batch_size"},{anchor:"transformers.TFPreTrainedModel.prepare_tf_dataset.shuffle",description:`<strong>shuffle</strong> (<code>bool</code>, defaults to <code>True</code>) &#x2014;
Whether to return samples from the dataset in random order. Usually <code>True</code> for training datasets and
<code>False</code> for validation/test datasets.`,name:"shuffle"},{anchor:"transformers.TFPreTrainedModel.prepare_tf_dataset.tokenizer",description:`<strong>tokenizer</strong> (<a href="/docs/transformers/v4.31.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase">PreTrainedTokenizerBase</a>, <em>optional</em>) &#x2014;
A <code>PreTrainedTokenizer</code> that will be used to pad samples to create batches. Has no effect if a specific
<code>collate_fn</code> is passed instead.`,name:"tokenizer"},{anchor:"transformers.TFPreTrainedModel.prepare_tf_dataset.collate_fn",description:`<strong>collate_fn</strong> (<code>Callable</code>, <em>optional</em>) &#x2014;
A function that collates samples from the dataset into a single batch. Defaults to
<code>DefaultDataCollator</code> if no <code>tokenizer</code> is supplied or <code>DataCollatorWithPadding</code> if a <code>tokenizer</code> is
passed.`,name:"collate_fn"},{anchor:"transformers.TFPreTrainedModel.prepare_tf_dataset.collate_fn_args",description:`<strong>collate_fn_args</strong> (<code>Dict[str, Any]</code>, <em>optional</em>) &#x2014;
A dict of arguments to pass to the <code>collate_fn</code> alongside the list of samples.`,name:"collate_fn_args"},{anchor:"transformers.TFPreTrainedModel.prepare_tf_dataset.drop_remainder",description:`<strong>drop_remainder</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to drop the final batch, if the batch_size does not evenly divide the dataset length. Defaults
to the same setting as <code>shuffle</code>.`,name:"drop_remainder"},{anchor:"transformers.TFPreTrainedModel.prepare_tf_dataset.prefetch",description:`<strong>prefetch</strong> (<code>bool</code>, defaults to <code>True</code>) &#x2014;
Whether to add prefetching to the end of the <code>tf.data</code> pipeline. This is almost always beneficial for
performance, but can be disabled in edge cases.`,name:"prefetch"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_tf_utils.py#L1396",returnDescription:`
<p>A <code>tf.data.Dataset</code> which is ready to pass to the Keras API.</p>
`,returnType:`
<p><code>Dataset</code></p>
`}}),Ta=new $({props:{name:"prune_heads",anchor:"transformers.TFPreTrainedModel.prune_heads",parameters:[{name:"heads_to_prune",val:""}],parametersDescription:[{anchor:"transformers.TFPreTrainedModel.prune_heads.heads_to_prune",description:`<strong>heads_to_prune</strong> (<code>Dict[int, List[int]]</code>) &#x2014;
Dictionary with keys being selected layer indices (<code>int</code>) and associated values being the list of heads
to prune in said layer (list of <code>int</code>). For instance {1: [0, 2], 2: [2, 3]} will prune heads 0 and 2 on
layer 1 and heads 2 and 3 on layer 2.`,name:"heads_to_prune"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_tf_utils.py#L2316"}}),$a=new $({props:{name:"register_for_auto_class",anchor:"transformers.TFPreTrainedModel.register_for_auto_class",parameters:[{name:"auto_class",val:" = 'TFAutoModel'"}],parametersDescription:[{anchor:"transformers.TFPreTrainedModel.register_for_auto_class.auto_class",description:`<strong>auto_class</strong> (<code>str</code> or <code>type</code>, <em>optional</em>, defaults to <code>&quot;TFAutoModel&quot;</code>) &#x2014;
The auto class to register this new model with.`,name:"auto_class"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_tf_utils.py#L3128"}}),uo=new Xh({props:{warning:!0,$$slots:{default:[Fx]},$$scope:{ctx:F}}}),xa=new $({props:{name:"resize_token_embeddings",anchor:"transformers.TFPreTrainedModel.resize_token_embeddings",parameters:[{name:"new_num_tokens",val:": Optional[int] = None"}],parametersDescription:[{anchor:"transformers.TFPreTrainedModel.resize_token_embeddings.new_num_tokens",description:`<strong>new_num_tokens</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The number of new tokens in the embedding matrix. Increasing the size will add newly initialized
vectors at the end. Reducing the size will remove vectors from the end. If not provided or <code>None</code>, just
returns a pointer to the input tokens without doing anything.`,name:"new_num_tokens"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_tf_utils.py#L1978",returnDescription:`
<p>Pointer to the input tokens of the model.</p>
`,returnType:`
<p><code>tf.Variable</code> or <code>tf.keras.layers.Embedding</code></p>
`}}),Pa=new $({props:{name:"save_pretrained",anchor:"transformers.TFPreTrainedModel.save_pretrained",parameters:[{name:"save_directory",val:""},{name:"saved_model",val:" = False"},{name:"version",val:" = 1"},{name:"push_to_hub",val:" = False"},{name:"signatures",val:" = None"},{name:"max_shard_size",val:": Union[int, str] = '10GB'"},{name:"create_pr",val:": bool = False"},{name:"safe_serialization",val:": bool = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFPreTrainedModel.save_pretrained.save_directory",description:`<strong>save_directory</strong> (<code>str</code>) &#x2014;
Directory to which to save. Will be created if it doesn&#x2019;t exist.`,name:"save_directory"},{anchor:"transformers.TFPreTrainedModel.save_pretrained.saved_model",description:`<strong>saved_model</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
If the model has to be saved in saved model format as well or not.`,name:"saved_model"},{anchor:"transformers.TFPreTrainedModel.save_pretrained.version",description:`<strong>version</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The version of the saved model. A saved model needs to be versioned in order to be properly loaded by
TensorFlow Serving as detailed in the official documentation
<a href="https://www.tensorflow.org/tfx/serving/serving_basic" rel="nofollow">https://www.tensorflow.org/tfx/serving/serving_basic</a>`,name:"version"},{anchor:"transformers.TFPreTrainedModel.save_pretrained.push_to_hub",description:`<strong>push_to_hub</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
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:"transformers.TFPreTrainedModel.save_pretrained.signatures",description:`<strong>signatures</strong> (<code>dict</code> or <code>tf.function</code>, <em>optional</em>) &#x2014;
Model&#x2019;s signature used for serving. This will be passed to the <code>signatures</code> argument of model.save().`,name:"signatures"},{anchor:"transformers.TFPreTrainedModel.save_pretrained.max_shard_size",description:`<strong>max_shard_size</strong> (<code>int</code> or <code>str</code>, <em>optional</em>, defaults to <code>&quot;10GB&quot;</code>) &#x2014;
The maximum size for a checkpoint before being sharded. Checkpoints shard will then be each of size
lower than this size. If expressed as a string, needs to be digits followed by a unit (like <code>&quot;5MB&quot;</code>).</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>If a single weight of the model is bigger than <code>max_shard_size</code>, it will be in its own checkpoint shard
which will be bigger than <code>max_shard_size</code>.</p>

					</div>`,name:"max_shard_size"},{anchor:"transformers.TFPreTrainedModel.save_pretrained.create_pr",description:`<strong>create_pr</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to create a PR with the uploaded files or directly commit.`,name:"create_pr"},{anchor:"transformers.TFPreTrainedModel.save_pretrained.safe_serialization",description:`<strong>safe_serialization</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to save the model using <code>safetensors</code> or the traditional PyTorch way (that uses <code>pickle</code>).`,name:"safe_serialization"},{anchor:"transformers.TFPreTrainedModel.save_pretrained.kwargs",description:`<strong>kwargs</strong> (<code>Dict[str, Any]</code>, <em>optional</em>) &#x2014;
Additional key word arguments passed along to the <a href="/docs/transformers/v4.31.0/en/internal/image_processing_utils#transformers.ImageProcessingMixin.push_to_hub">push_to_hub()</a> method.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_tf_utils.py#L2328"}}),Ua=new $({props:{name:"serving",anchor:"transformers.TFPreTrainedModel.serving",parameters:[{name:"inputs",val:""}],parametersDescription:[{anchor:"transformers.TFPreTrainedModel.serving.Method",description:"<strong>Method</strong> used for serving the model. Does not have a specific signature, but will be specialized as concrete &#x2014;",name:"Method"},{anchor:"transformers.TFPreTrainedModel.serving.functions",description:`<strong>functions</strong> when saving with <code>save_pretrained</code>. &#x2014;
inputs (<code>Dict[str, tf.Tensor]</code>):
The input of the saved model as a dictionary of tensors.`,name:"functions"}]}}),Ja=new $({props:{name:"serving_output",anchor:"transformers.TFPreTrainedModel.serving_output",parameters:[{name:"output",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_tf_utils.py#L1278"}}),Fa=new $({props:{name:"set_bias",anchor:"transformers.TFPreTrainedModel.set_bias",parameters:[{name:"value",val:""}],parametersDescription:[{anchor:"transformers.TFPreTrainedModel.set_bias.value",description:`<strong>value</strong> (<code>Dict[tf.Variable]</code>) &#x2014;
All the new bias attached to an LM head.`,name:"value"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_tf_utils.py#L1953"}}),Ia=new $({props:{name:"set_input_embeddings",anchor:"transformers.TFPreTrainedModel.set_input_embeddings",parameters:[{name:"value",val:""}],parametersDescription:[{anchor:"transformers.TFPreTrainedModel.set_input_embeddings.value",description:`<strong>value</strong> (<code>tf.Variable</code>) &#x2014;
The new weights mapping hidden states to vocabulary.`,name:"value"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_tf_utils.py#L1856"}}),Za=new $({props:{name:"set_output_embeddings",anchor:"transformers.TFPreTrainedModel.set_output_embeddings",parameters:[{name:"value",val:""}],parametersDescription:[{anchor:"transformers.TFPreTrainedModel.set_output_embeddings.value",description:`<strong>value</strong> (<code>tf.Variable</code>) &#x2014;
The new weights mapping hidden states to vocabulary.`,name:"value"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_tf_utils.py#L1896"}}),Ca=new $({props:{name:"test_step",anchor:"transformers.TFPreTrainedModel.test_step",parameters:[{name:"data",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_tf_utils.py#L1692"}}),Ga=new $({props:{name:"train_step",anchor:"transformers.TFPreTrainedModel.train_step",parameters:[{name:"data",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_tf_utils.py#L1584"}}),Ba=new Re({}),Da=new $({props:{name:"class transformers.modeling_tf_utils.TFModelUtilsMixin",anchor:"transformers.modeling_tf_utils.TFModelUtilsMixin",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_tf_utils.py#L105"}}),Va=new $({props:{name:"num_parameters",anchor:"transformers.modeling_tf_utils.TFModelUtilsMixin.num_parameters",parameters:[{name:"only_trainable",val:": bool = False"}],parametersDescription:[{anchor:"transformers.modeling_tf_utils.TFModelUtilsMixin.num_parameters.only_trainable",description:`<strong>only_trainable</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to return only the number of trainable parameters`,name:"only_trainable"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_tf_utils.py#L110",returnDescription:`
<p>The number of parameters.</p>
`,returnType:`
<p><code>int</code></p>
`}}),Xa=new Re({}),Na=new $({props:{name:"class transformers.FlaxPreTrainedModel",anchor:"transformers.FlaxPreTrainedModel",parameters:[{name:"config",val:": PretrainedConfig"},{name:"module",val:": Module"},{name:"input_shape",val:": typing.Tuple = (1, 1)"},{name:"seed",val:": int = 0"},{name:"dtype",val:": dtype = <class 'jax.numpy.float32'>"},{name:"_do_init",val:": bool = True"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_flax_utils.py#L158"}}),Ya=new $({props:{name:"push_to_hub",anchor:"transformers.FlaxPreTrainedModel.push_to_hub",parameters:[{name:"repo_id",val:": str"},{name:"use_temp_dir",val:": typing.Optional[bool] = None"},{name:"commit_message",val:": typing.Optional[str] = None"},{name:"private",val:": typing.Optional[bool] = None"},{name:"use_auth_token",val:": typing.Union[bool, str, NoneType] = None"},{name:"max_shard_size",val:": typing.Union[int, str, NoneType] = '10GB'"},{name:"create_pr",val:": bool = False"},{name:"safe_serialization",val:": bool = False"},{name:"**deprecated_kwargs",val:""}],parametersDescription:[{anchor:"transformers.FlaxPreTrainedModel.push_to_hub.repo_id",description:`<strong>repo_id</strong> (<code>str</code>) &#x2014;
The name of the repository you want to push your model to. It should contain your organization name
when pushing to a given organization.`,name:"repo_id"},{anchor:"transformers.FlaxPreTrainedModel.push_to_hub.use_temp_dir",description:`<strong>use_temp_dir</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to use a temporary directory to store the files saved before they are pushed to the Hub.
Will default to <code>True</code> if there is no directory named like <code>repo_id</code>, <code>False</code> otherwise.`,name:"use_temp_dir"},{anchor:"transformers.FlaxPreTrainedModel.push_to_hub.commit_message",description:`<strong>commit_message</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Message to commit while pushing. Will default to <code>&quot;Upload model&quot;</code>.`,name:"commit_message"},{anchor:"transformers.FlaxPreTrainedModel.push_to_hub.private",description:`<strong>private</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not the repository created should be private.`,name:"private"},{anchor:"transformers.FlaxPreTrainedModel.push_to_hub.use_auth_token",description:`<strong>use_auth_token</strong> (<code>bool</code> or <code>str</code>, <em>optional</em>) &#x2014;
The token to use as HTTP bearer authorization for remote files. If <code>True</code>, will use the token generated
when running <code>huggingface-cli login</code> (stored in <code>~/.huggingface</code>). Will default to <code>True</code> if <code>repo_url</code>
is not specified.`,name:"use_auth_token"},{anchor:"transformers.FlaxPreTrainedModel.push_to_hub.max_shard_size",description:`<strong>max_shard_size</strong> (<code>int</code> or <code>str</code>, <em>optional</em>, defaults to <code>&quot;10GB&quot;</code>) &#x2014;
Only applicable for models. The maximum size for a checkpoint before being sharded. Checkpoints shard
will then be each of size lower than this size. If expressed as a string, needs to be digits followed
by a unit (like <code>&quot;5MB&quot;</code>).`,name:"max_shard_size"},{anchor:"transformers.FlaxPreTrainedModel.push_to_hub.create_pr",description:`<strong>create_pr</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to create a PR with the uploaded files or directly commit.`,name:"create_pr"},{anchor:"transformers.FlaxPreTrainedModel.push_to_hub.safe_serialization",description:`<strong>safe_serialization</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to convert the model weights in safetensors format for safer serialization.`,name:"safe_serialization"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/utils/hub.py#L733"}}),Eo=new Ve({props:{anchor:"transformers.FlaxPreTrainedModel.push_to_hub.example",$$slots:{default:[Ix]},$$scope:{ctx:F}}}),qa=new $({props:{name:"can_generate",anchor:"transformers.FlaxPreTrainedModel.can_generate",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_flax_utils.py#L472"}}),La=new $({props:{name:"from_pretrained",anchor:"transformers.FlaxPreTrainedModel.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:"config",val:": typing.Union[transformers.configuration_utils.PretrainedConfig, str, os.PathLike, NoneType] = None"},{name:"cache_dir",val:": typing.Union[str, os.PathLike, NoneType] = None"},{name:"ignore_mismatched_sizes",val:": bool = False"},{name:"force_download",val:": bool = False"},{name:"local_files_only",val:": bool = False"},{name:"token",val:": typing.Union[bool, str, NoneType] = None"},{name:"revision",val:": str = 'main'"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.FlaxPreTrainedModel.from_pretrained.pretrained_model_name_or_path",description:`<strong>pretrained_model_name_or_path</strong> (<code>str</code> or <code>os.PathLike</code>) &#x2014;
Can be either:</p>
<ul>
<li>A string, the <em>model id</em> of a pretrained model hosted inside a model repo on huggingface.co.
Valid model ids can be located at the root-level, like <code>bert-base-uncased</code>, or namespaced under a
user or organization name, like <code>dbmdz/bert-base-german-cased</code>.</li>
<li>A path to a <em>directory</em> containing model weights saved using
<a href="/docs/transformers/v4.31.0/en/main_classes/model#transformers.FlaxPreTrainedModel.save_pretrained">save_pretrained()</a>, e.g., <code>./my_model_directory/</code>.</li>
<li>A path or url to a <em>pt index checkpoint file</em> (e.g, <code>./tf_model/model.ckpt.index</code>). In this case,
<code>from_pt</code> should be set to <code>True</code>.</li>
</ul>`,name:"pretrained_model_name_or_path"},{anchor:"transformers.FlaxPreTrainedModel.from_pretrained.dtype",description:`<strong>dtype</strong> (<code>jax.numpy.dtype</code>, <em>optional</em>, defaults to <code>jax.numpy.float32</code>) &#x2014;
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>
<p><strong>Note that this only specifies the dtype of the computation and does not influence the dtype of model
parameters.</strong></p>
<p>If you wish to change the dtype of the model parameters, see <a href="/docs/transformers/v4.31.0/en/main_classes/model#transformers.FlaxPreTrainedModel.to_fp16">to_fp16()</a> and
<a href="/docs/transformers/v4.31.0/en/main_classes/model#transformers.FlaxPreTrainedModel.to_bf16">to_bf16()</a>.`,name:"dtype"},{anchor:"transformers.FlaxPreTrainedModel.from_pretrained.model_args",description:`<strong>model_args</strong> (sequence of positional arguments, <em>optional</em>) &#x2014;
All remaining positional arguments will be passed to the underlying model&#x2019;s <code>__init__</code> method.`,name:"model_args"},{anchor:"transformers.FlaxPreTrainedModel.from_pretrained.config",description:`<strong>config</strong> (<code>Union[PretrainedConfig, str, os.PathLike]</code>, <em>optional</em>) &#x2014;
Can be either:</p>
<ul>
<li>an instance of a class derived from <a href="/docs/transformers/v4.31.0/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a>,</li>
<li>a string or path valid as input to <a href="/docs/transformers/v4.31.0/en/main_classes/configuration#transformers.PretrainedConfig.from_pretrained">from_pretrained()</a>.</li>
</ul>
<p>Configuration for the model to use instead of an automatically loaded configuration. Configuration can
be automatically loaded when:</p>
<ul>
<li>The model is a model provided by the library (loaded with the <em>model id</em> string of a pretrained
model).</li>
<li>The model was saved using <a href="/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel.save_pretrained">save_pretrained()</a> and is reloaded by supplying the
save directory.</li>
<li>The model is loaded by supplying a local directory as <code>pretrained_model_name_or_path</code> and a
configuration JSON file named <em>config.json</em> is found in the directory.</li>
</ul>`,name:"config"},{anchor:"transformers.FlaxPreTrainedModel.from_pretrained.cache_dir",description:`<strong>cache_dir</strong> (<code>Union[str, os.PathLike]</code>, <em>optional</em>) &#x2014;
Path to a directory in which a downloaded pretrained model configuration should be cached if the
standard cache should not be used.`,name:"cache_dir"},{anchor:"transformers.FlaxPreTrainedModel.from_pretrained.from_pt",description:`<strong>from_pt</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Load the model weights from a PyTorch checkpoint save file (see docstring of
<code>pretrained_model_name_or_path</code> argument).`,name:"from_pt"},{anchor:"transformers.FlaxPreTrainedModel.from_pretrained.ignore_mismatched_sizes",description:`<strong>ignore_mismatched_sizes</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to raise an error if some of the weights from the checkpoint do not have the same size
as the weights of the model (if for instance, you are instantiating a model with 10 labels from a
checkpoint with 3 labels).`,name:"ignore_mismatched_sizes"},{anchor:"transformers.FlaxPreTrainedModel.from_pretrained.force_download",description:`<strong>force_download</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
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:"transformers.FlaxPreTrainedModel.from_pretrained.resume_download",description:`<strong>resume_download</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to delete incompletely received files. Will attempt to resume the download if such a
file exists.`,name:"resume_download"},{anchor:"transformers.FlaxPreTrainedModel.from_pretrained.proxies",description:`<strong>proxies</strong> (<code>Dict[str, str]</code>, <em>optional</em>) &#x2014;
A dictionary of proxy servers to use by protocol or endpoint, e.g., <code>{&apos;http&apos;: &apos;foo.bar:3128&apos;, &apos;http://hostname&apos;: &apos;foo.bar:4012&apos;}</code>. The proxies are used on each request.`,name:"proxies"},{anchor:"transformers.FlaxPreTrainedModel.from_pretrained.local_files_only(bool,",description:`<strong>local_files_only(<code>bool</code>,</strong> <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to only look at local files (i.e., do not try to download the model).`,name:"local_files_only(bool,"},{anchor:"transformers.FlaxPreTrainedModel.from_pretrained.token",description:`<strong>token</strong> (<code>str</code> or <code>bool</code>, <em>optional</em>) &#x2014;
The token to use as HTTP bearer authorization for remote files. If <code>True</code>, or not specified, will use
the token generated when running <code>huggingface-cli login</code> (stored in <code>~/.huggingface</code>).`,name:"token"},{anchor:"transformers.FlaxPreTrainedModel.from_pretrained.revision",description:`<strong>revision</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;main&quot;</code>) &#x2014;
The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a
git-based system for storing models and other artifacts on huggingface.co, so <code>revision</code> can be any
identifier allowed by git.`,name:"revision"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_flax_utils.py#L483"}}),jo=new Ve({props:{anchor:"transformers.FlaxPreTrainedModel.from_pretrained.example",$$slots:{default:[Zx]},$$scope:{ctx:F}}}),Qa=new $({props:{name:"load_flax_sharded_weights",anchor:"transformers.FlaxPreTrainedModel.load_flax_sharded_weights",parameters:[{name:"shard_files",val:""}],parametersDescription:[{anchor:"transformers.FlaxPreTrainedModel.load_flax_sharded_weights.shard_files",description:`<strong>shard_files</strong> (<code>List[str]</code> &#x2014;
The list of shard files to load.`,name:"shard_files"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_flax_utils.py#L425",returnDescription:`
<p>A nested dictionary of the model parameters, in the expected format for flax models : <code>&#123;'model': &#123;'params': &#123;'...'&#125;&#125;&#125;</code>.</p>
`,returnType:`
<p><code>Dict</code></p>
`}}),Ka=new $({props:{name:"register_for_auto_class",anchor:"transformers.FlaxPreTrainedModel.register_for_auto_class",parameters:[{name:"auto_class",val:" = 'FlaxAutoModel'"}],parametersDescription:[{anchor:"transformers.FlaxPreTrainedModel.register_for_auto_class.auto_class",description:`<strong>auto_class</strong> (<code>str</code> or <code>type</code>, <em>optional</em>, defaults to <code>&quot;FlaxAutoModel&quot;</code>) &#x2014;
The auto class to register this new model with.`,name:"auto_class"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_flax_utils.py#L1124"}}),Uo=new Xh({props:{warning:!0,$$slots:{default:[Cx]},$$scope:{ctx:F}}}),en=new $({props:{name:"save_pretrained",anchor:"transformers.FlaxPreTrainedModel.save_pretrained",parameters:[{name:"save_directory",val:": typing.Union[str, os.PathLike]"},{name:"params",val:" = None"},{name:"push_to_hub",val:" = False"},{name:"max_shard_size",val:" = '10GB'"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.FlaxPreTrainedModel.save_pretrained.save_directory",description:`<strong>save_directory</strong> (<code>str</code> or <code>os.PathLike</code>) &#x2014;
Directory to which to save. Will be created if it doesn&#x2019;t exist.`,name:"save_directory"},{anchor:"transformers.FlaxPreTrainedModel.save_pretrained.push_to_hub",description:`<strong>push_to_hub</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
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:"transformers.FlaxPreTrainedModel.save_pretrained.max_shard_size",description:`<strong>max_shard_size</strong> (<code>int</code> or <code>str</code>, <em>optional</em>, defaults to <code>&quot;10GB&quot;</code>) &#x2014;
The maximum size for a checkpoint before being sharded. Checkpoints shard will then be each of size
lower than this size. If expressed as a string, needs to be digits followed by a unit (like <code>&quot;5MB&quot;</code>).</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>If a single weight of the model is bigger than <code>max_shard_size</code>, it will be in its own checkpoint shard
which will be bigger than <code>max_shard_size</code>.</p>

					</div>`,name:"max_shard_size"},{anchor:"transformers.FlaxPreTrainedModel.save_pretrained.kwargs",description:`<strong>kwargs</strong> (<code>Dict[str, Any]</code>, <em>optional</em>) &#x2014;
Additional key word arguments passed along to the <a href="/docs/transformers/v4.31.0/en/internal/image_processing_utils#transformers.ImageProcessingMixin.push_to_hub">push_to_hub()</a> method.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_flax_utils.py#L1021"}}),on=new $({props:{name:"to_bf16",anchor:"transformers.FlaxPreTrainedModel.to_bf16",parameters:[{name:"params",val:": typing.Union[typing.Dict, flax.core.frozen_dict.FrozenDict]"},{name:"mask",val:": typing.Any = None"}],parametersDescription:[{anchor:"transformers.FlaxPreTrainedModel.to_bf16.params",description:`<strong>params</strong> (<code>Union[Dict, FrozenDict]</code>) &#x2014;
A <code>PyTree</code> of model parameters.`,name:"params"},{anchor:"transformers.FlaxPreTrainedModel.to_bf16.mask",description:`<strong>mask</strong> (<code>Union[Dict, FrozenDict]</code>) &#x2014;
A <code>PyTree</code> with same structure as the <code>params</code> tree. The leaves should be booleans, <code>True</code> for params
you want to cast, and should be <code>False</code> for those you want to skip.`,name:"mask"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_flax_utils.py#L320"}}),Fo=new Ve({props:{anchor:"transformers.FlaxPreTrainedModel.to_bf16.example",$$slots:{default:[Wx]},$$scope:{ctx:F}}}),rn=new $({props:{name:"to_fp16",anchor:"transformers.FlaxPreTrainedModel.to_fp16",parameters:[{name:"params",val:": typing.Union[typing.Dict, flax.core.frozen_dict.FrozenDict]"},{name:"mask",val:": typing.Any = None"}],parametersDescription:[{anchor:"transformers.FlaxPreTrainedModel.to_fp16.params",description:`<strong>params</strong> (<code>Union[Dict, FrozenDict]</code>) &#x2014;
A <code>PyTree</code> of model parameters.`,name:"params"},{anchor:"transformers.FlaxPreTrainedModel.to_fp16.mask",description:`<strong>mask</strong> (<code>Union[Dict, FrozenDict]</code>) &#x2014;
A <code>PyTree</code> with same structure as the <code>params</code> tree. The leaves should be booleans, <code>True</code> for params
you want to cast, and should be <code>False</code> for those you want to skip`,name:"mask"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_flax_utils.py#L386"}}),Io=new Ve({props:{anchor:"transformers.FlaxPreTrainedModel.to_fp16.example",$$slots:{default:[Gx]},$$scope:{ctx:F}}}),an=new $({props:{name:"to_fp32",anchor:"transformers.FlaxPreTrainedModel.to_fp32",parameters:[{name:"params",val:": typing.Union[typing.Dict, flax.core.frozen_dict.FrozenDict]"},{name:"mask",val:": typing.Any = None"}],parametersDescription:[{anchor:"transformers.FlaxPreTrainedModel.to_fp32.params",description:`<strong>params</strong> (<code>Union[Dict, FrozenDict]</code>) &#x2014;
A <code>PyTree</code> of model parameters.`,name:"params"},{anchor:"transformers.FlaxPreTrainedModel.to_fp32.mask",description:`<strong>mask</strong> (<code>Union[Dict, FrozenDict]</code>) &#x2014;
A <code>PyTree</code> with same structure as the <code>params</code> tree. The leaves should be booleans, <code>True</code> for params
you want to cast, and should be <code>False</code> for those you want to skip`,name:"mask"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_flax_utils.py#L359"}}),Zo=new Ve({props:{anchor:"transformers.FlaxPreTrainedModel.to_fp32.example",$$slots:{default:[zx]},$$scope:{ctx:F}}}),nn=new Re({}),sn=new $({props:{name:"class transformers.utils.PushToHubMixin",anchor:"transformers.utils.PushToHubMixin",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/utils/hub.py#L628"}}),ln=new $({props:{name:"push_to_hub",anchor:"transformers.utils.PushToHubMixin.push_to_hub",parameters:[{name:"repo_id",val:": str"},{name:"use_temp_dir",val:": typing.Optional[bool] = None"},{name:"commit_message",val:": typing.Optional[str] = None"},{name:"private",val:": typing.Optional[bool] = None"},{name:"use_auth_token",val:": typing.Union[bool, str, NoneType] = None"},{name:"max_shard_size",val:": typing.Union[int, str, NoneType] = '10GB'"},{name:"create_pr",val:": bool = False"},{name:"safe_serialization",val:": bool = False"},{name:"**deprecated_kwargs",val:""}],parametersDescription:[{anchor:"transformers.utils.PushToHubMixin.push_to_hub.repo_id",description:`<strong>repo_id</strong> (<code>str</code>) &#x2014;
The name of the repository you want to push your {object} to. It should contain your organization name
when pushing to a given organization.`,name:"repo_id"},{anchor:"transformers.utils.PushToHubMixin.push_to_hub.use_temp_dir",description:`<strong>use_temp_dir</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to use a temporary directory to store the files saved before they are pushed to the Hub.
Will default to <code>True</code> if there is no directory named like <code>repo_id</code>, <code>False</code> otherwise.`,name:"use_temp_dir"},{anchor:"transformers.utils.PushToHubMixin.push_to_hub.commit_message",description:`<strong>commit_message</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Message to commit while pushing. Will default to <code>&quot;Upload {object}&quot;</code>.`,name:"commit_message"},{anchor:"transformers.utils.PushToHubMixin.push_to_hub.private",description:`<strong>private</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not the repository created should be private.`,name:"private"},{anchor:"transformers.utils.PushToHubMixin.push_to_hub.use_auth_token",description:`<strong>use_auth_token</strong> (<code>bool</code> or <code>str</code>, <em>optional</em>) &#x2014;
The token to use as HTTP bearer authorization for remote files. If <code>True</code>, will use the token generated
when running <code>huggingface-cli login</code> (stored in <code>~/.huggingface</code>). Will default to <code>True</code> if <code>repo_url</code>
is not specified.`,name:"use_auth_token"},{anchor:"transformers.utils.PushToHubMixin.push_to_hub.max_shard_size",description:`<strong>max_shard_size</strong> (<code>int</code> or <code>str</code>, <em>optional</em>, defaults to <code>&quot;10GB&quot;</code>) &#x2014;
Only applicable for models. The maximum size for a checkpoint before being sharded. Checkpoints shard
will then be each of size lower than this size. If expressed as a string, needs to be digits followed
by a unit (like <code>&quot;5MB&quot;</code>).`,name:"max_shard_size"},{anchor:"transformers.utils.PushToHubMixin.push_to_hub.create_pr",description:`<strong>create_pr</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to create a PR with the uploaded files or directly commit.`,name:"create_pr"},{anchor:"transformers.utils.PushToHubMixin.push_to_hub.safe_serialization",description:`<strong>safe_serialization</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to convert the model weights in safetensors format for safer serialization.`,name:"safe_serialization"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/utils/hub.py#L733"}}),Wo=new Ve({props:{anchor:"transformers.utils.PushToHubMixin.push_to_hub.example",$$slots:{default:[Bx]},$$scope:{ctx:F}}}),cn=new Re({}),mn=new $({props:{name:"transformers.modeling_utils.load_sharded_checkpoint",anchor:"transformers.modeling_utils.load_sharded_checkpoint",parameters:[{name:"model",val:""},{name:"folder",val:""},{name:"strict",val:" = True"},{name:"prefer_safe",val:" = True"}],parametersDescription:[{anchor:"transformers.modeling_utils.load_sharded_checkpoint.model",description:"<strong>model</strong> (<code>torch.nn.Module</code>) &#x2014; The model in which to load the checkpoint.",name:"model"},{anchor:"transformers.modeling_utils.load_sharded_checkpoint.folder",description:"<strong>folder</strong> (<code>str</code> or <code>os.PathLike</code>) &#x2014; A path to a folder containing the sharded checkpoint.",name:"folder"},{anchor:"transformers.modeling_utils.load_sharded_checkpoint.strict",description:"<strong>strict</strong> (<code>bool</code>, *optional<code>, defaults to </code>True`) &#x2014;\nWhether to strictly enforce that the keys in the model state dict match the keys in the sharded checkpoint.",name:"strict"},{anchor:"transformers.modeling_utils.load_sharded_checkpoint.prefer_safe",description:`<strong>prefer_safe</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
If both safetensors and PyTorch save files are present in checkpoint and <code>prefer_safe</code> is True, the
safetensors files will be loaded. Otherwise, PyTorch files are always loaded when possible.`,name:"prefer_safe"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_utils.py#L357",returnDescription:`
<p>A named tuple with <code>missing_keys</code> and <code>unexpected_keys</code> fields</p>
<ul>
<li><code>missing_keys</code> is a list of str containing the missing keys</li>
<li><code>unexpected_keys</code> is a list of str containing the unexpected keys</li>
</ul>
`,returnType:`
<p><code>NamedTuple</code></p>
`}}),{c(){v=r("meta"),E=i(),M=r("h1"),y=r("a"),P=r("span"),h(c.$$.fragment),T=i(),ct=r("span"),Nh=s("Models"),yc=i(),Q=r("p"),Yh=s("The base classes "),yn=r("a"),Ah=s("PreTrainedModel"),qh=s(", "),wn=r("a"),Lh=s("TFPreTrainedModel"),Sh=s(`, and
`),Mn=r("a"),Hh=s("FlaxPreTrainedModel"),Qh=s(` implement the common methods for loading/saving a model either from a local
file or directory, or from a pretrained model configuration provided by the library (downloaded from HuggingFace\u2019s AWS
S3 repository).`),wc=i(),Ne=r("p"),Tn=r("a"),Oh=s("PreTrainedModel"),Kh=s(" and "),$n=r("a"),ep=s("TFPreTrainedModel"),tp=s(` also implement a few methods which
are common among all the models to:`),Mc=i(),mt=r("ul"),Us=r("li"),op=s("resize the input token embeddings when new tokens are added to the vocabulary"),rp=i(),Js=r("li"),ap=s("prune the attention heads of the model."),Tc=i(),B=r("p"),np=s("The other methods that are common to each model are defined in "),xn=r("a"),sp=s("ModuleUtilsMixin"),lp=s(`
(for the PyTorch models) and `),Fs=r("code"),ip=s("~modeling_tf_utils.TFModuleUtilsMixin"),dp=s(` (for the TensorFlow models) or
for text generation, `),kn=r("a"),cp=s("GenerationMixin"),mp=s(` (for the PyTorch models),
`),En=r("a"),hp=s("TFGenerationMixin"),pp=s(` (for the TensorFlow models) and
`),Pn=r("a"),fp=s("FlaxGenerationMixin"),up=s(" (for the Flax/JAX models)."),$c=i(),Ye=r("h2"),ht=r("a"),Is=r("span"),h(No.$$.fragment),gp=i(),Zs=r("span"),_p=s("PreTrainedModel"),xc=i(),j=r("div"),h(Yo.$$.fragment),bp=i(),Cs=r("p"),vp=s("Base class for all models."),yp=i(),jn=r("p"),Un=r("a"),wp=s("PreTrainedModel"),Mp=s(` takes care of storing the configuration of the models and handles methods for loading,
downloading and saving models as well as a few methods common to all models to:`),Tp=i(),Ao=r("ul"),Ws=r("li"),$p=s("resize the input embeddings,"),xp=i(),Gs=r("li"),kp=s("prune heads in the self-attention heads."),Ep=i(),zs=r("p"),Pp=s("Class attributes (overridden by derived classes):"),jp=i(),Y=r("ul"),Bs=r("li"),me=r("p"),Ds=r("strong"),Up=s("config_class"),Jp=s(" ("),Jn=r("a"),Fp=s("PretrainedConfig"),Ip=s(") \u2014 A subclass of "),Fn=r("a"),Zp=s("PretrainedConfig"),Cp=s(` to use as configuration class
for this model architecture.`),Wp=i(),qo=r("li"),he=r("p"),Rs=r("strong"),Gp=s("load_tf_weights"),zp=s(" ("),Vs=r("code"),Bp=s("Callable"),Dp=s(") \u2014 A python "),Xs=r("em"),Rp=s("method"),Vp=s(` for loading a TensorFlow checkpoint in a PyTorch model,
taking as arguments:`),Xp=i(),Ae=r("ul"),pt=r("li"),Ns=r("strong"),Np=s("model"),Yp=s(" ("),In=r("a"),Ap=s("PreTrainedModel"),qp=s(") \u2014 An instance of the model on which to load the TensorFlow checkpoint."),Lp=i(),ft=r("li"),Ys=r("strong"),Sp=s("config"),Hp=s(" ("),As=r("code"),Qp=s("PreTrainedConfig"),Op=s(") \u2014 An instance of the configuration associated to the model."),Kp=i(),ut=r("li"),qs=r("strong"),ef=s("path"),tf=s(" ("),Ls=r("code"),of=s("str"),rf=s(") \u2014 A path to the TensorFlow checkpoint."),af=i(),Ss=r("li"),gt=r("p"),Hs=r("strong"),nf=s("base_model_prefix"),sf=s(" ("),Qs=r("code"),lf=s("str"),df=s(`) \u2014 A string indicating the attribute associated to the base model in derived
classes of the same architecture adding modules on top of the base model.`),cf=i(),Os=r("li"),_t=r("p"),Ks=r("strong"),mf=s("is_parallelizable"),hf=s(" ("),el=r("code"),pf=s("bool"),ff=s(") \u2014 A flag indicating whether this model supports model parallelization."),uf=i(),tl=r("li"),D=r("p"),ol=r("strong"),gf=s("main_input_name"),_f=s(" ("),rl=r("code"),bf=s("str"),vf=s(") \u2014 The name of the principal input to the model (often "),al=r("code"),yf=s("input_ids"),wf=s(` for NLP
models, `),nl=r("code"),Mf=s("pixel_values"),Tf=s(" for vision models and "),sl=r("code"),$f=s("input_values"),xf=s(" for speech models)."),kf=i(),pe=r("div"),h(Lo.$$.fragment),Ef=i(),So=r("p"),Pf=s(`Upload the model file to the \u{1F917} Model Hub while synchronizing a local clone of the repo in
`),ll=r("code"),jf=s("repo_path_or_name"),Uf=s("."),Jf=i(),h(bt.$$.fragment),Ff=i(),vt=r("div"),h(Ho.$$.fragment),If=i(),Qo=r("p"),Zf=s("Returns whether this model can generate sequences with "),il=r("code"),Cf=s(".generate()"),Wf=s("."),Gf=i(),yt=r("div"),h(Oo.$$.fragment),zf=i(),Ko=r("p"),Bf=s("Removes the "),dl=r("code"),Df=s("_require_grads_hook"),Rf=s("."),Vf=i(),wt=r("div"),h(er.$$.fragment),Xf=i(),cl=r("p"),Nf=s(`Enables the gradients for the input embeddings. This is useful for fine-tuning adapter weights while keeping
the model weights fixed.`),Yf=i(),I=r("div"),h(tr.$$.fragment),Af=i(),ml=r("p"),qf=s("Instantiate a pretrained pytorch model from a pre-trained model configuration."),Lf=i(),qe=r("p"),Sf=s("The model is set in evaluation mode by default using "),hl=r("code"),Hf=s("model.eval()"),Qf=s(` (Dropout modules are deactivated). To train
the model, you should first set it back in training mode with `),pl=r("code"),Of=s("model.train()"),Kf=s("."),eu=i(),or=r("p"),tu=s("The warning "),fl=r("em"),ou=s("Weights from XXX not initialized from pretrained model"),ru=s(` means that the weights of XXX do not come
pretrained with the rest of the model. It is up to you to train those weights with a downstream fine-tuning
task.`),au=i(),rr=r("p"),nu=s("The warning "),ul=r("em"),su=s("Weights from XXX not used in YYY"),lu=s(` means that the layer XXX is not used by YYY, therefore those
weights are discarded.`),iu=i(),h(Mt.$$.fragment),du=i(),h(Tt.$$.fragment),cu=i(),gl=r("ul"),Zn=r("li"),_l=r("code"),mu=s("low_cpu_mem_usage"),hu=s(" algorithm:"),pu=i(),bl=r("p"),fu=s("This is an experimental function that loads the model using ~1x model size CPU memory"),uu=i(),vl=r("p"),gu=s("Here is how it works:"),_u=i(),A=r("ol"),yl=r("li"),bu=s("save which state_dict keys we have"),vu=i(),wl=r("li"),yu=s("drop state_dict before the model is created, since the latter takes 1x model size CPU memory"),wu=i(),Ml=r("li"),Mu=s(`after the model has been instantiated switch to the meta device all params/buffers that
are going to be replaced from the loaded state_dict`),Tu=i(),Tl=r("li"),$u=s("load state_dict 2nd time"),xu=i(),$l=r("li"),ku=s("replace the params/buffers from the state_dict"),Eu=i(),xl=r("p"),Pu=s("Currently, it can\u2019t handle deepspeed ZeRO stage 3 and ignores loading errors"),ju=i(),$t=r("div"),h(ar.$$.fragment),Uu=i(),kl=r("p"),Ju=s("Returns the model\u2019s input embeddings."),Fu=i(),xt=r("div"),h(nr.$$.fragment),Iu=i(),Cn=r("p"),Zu=s(`Get the memory footprint of a model. This will return the memory footprint of the current model in bytes.
Useful to benchmark the memory footprint of the current model and design some tests. Solution inspired from the
PyTorch discussions: `),sr=r("a"),Cu=s("https://discuss.pytorch.org/t/gpu-memory-that-model-uses/56822/2"),Wu=i(),kt=r("div"),h(lr.$$.fragment),Gu=i(),El=r("p"),zu=s("Returns the model\u2019s output embeddings."),Bu=i(),fe=r("div"),h(ir.$$.fragment),Du=i(),Pl=r("p"),Ru=s("Deactivates gradient checkpointing for the current model."),Vu=i(),jl=r("p"),Xu=s(`Note that in other frameworks this feature can be referred to as \u201Cactivation checkpointing\u201D or \u201Ccheckpoint
activations\u201D.`),Nu=i(),ue=r("div"),h(dr.$$.fragment),Yu=i(),Ul=r("p"),Au=s("Activates gradient checkpointing for the current model."),qu=i(),Jl=r("p"),Lu=s(`Note that in other frameworks this feature can be referred to as \u201Cactivation checkpointing\u201D or \u201Ccheckpoint
activations\u201D.`),Su=i(),Et=r("div"),h(cr.$$.fragment),Hu=i(),Le=r("p"),Qu=s("If needed prunes and maybe initializes weights. If using a custom "),Fl=r("code"),Ou=s("PreTrainedModel"),Ku=s(`, you need to implement any
initialization logic in `),Il=r("code"),eg=s("_init_weights"),tg=s("."),og=i(),Pt=r("div"),h(mr.$$.fragment),rg=i(),Zl=r("p"),ag=s(`A method executed at the end of each Transformer model initialization, to execute code that needs the model\u2019s
modules properly initialized (such as weight initialization).`),ng=i(),jt=r("div"),h(hr.$$.fragment),sg=i(),Cl=r("p"),lg=s("Prunes heads of the base model."),ig=i(),ge=r("div"),h(pr.$$.fragment),dg=i(),Wl=r("p"),cg=s(`Register this class with a given auto class. This should only be used for custom models as the ones in the
library are already mapped with an auto class.`),mg=i(),h(Ut.$$.fragment),hg=i(),_e=r("div"),h(fr.$$.fragment),pg=i(),ur=r("p"),fg=s("Resizes input token embeddings matrix of the model if "),Gl=r("code"),ug=s("new_num_tokens != config.vocab_size"),gg=s("."),_g=i(),gr=r("p"),bg=s("Takes care of tying weights embeddings afterwards if the model class has a "),zl=r("code"),vg=s("tie_weights()"),yg=s(" method."),wg=i(),Jt=r("div"),h(_r.$$.fragment),Mg=i(),br=r("p"),Tg=s("Reverts the transformation from "),Wn=r("a"),$g=s("to_bettertransformer()"),xg=s(` so that the original modeling is
used, for example in order to save the model.`),kg=i(),Ft=r("div"),h(vr.$$.fragment),Eg=i(),yr=r("p"),Pg=s(`Save a model and its configuration file to a directory, so that it can be re-loaded using the
`),Gn=r("a"),jg=s("from_pretrained()"),Ug=s(" class method."),Jg=i(),It=r("div"),h(wr.$$.fragment),Fg=i(),Bl=r("p"),Ig=s("Set model\u2019s input embeddings."),Zg=i(),be=r("div"),h(Mr.$$.fragment),Cg=i(),Dl=r("p"),Wg=s("Tie the weights between the input embeddings and the output embeddings."),Gg=i(),Tr=r("p"),zg=s("If the "),Rl=r("code"),Bg=s("torchscript"),Dg=s(` flag is set in the configuration, can\u2019t handle parameter sharing so we are cloning the
weights instead.`),Rg=i(),ve=r("div"),h($r.$$.fragment),Vg=i(),Se=r("p"),Xg=s("Converts the model to use "),xr=r("a"),Ng=s(`PyTorch\u2019s native attention
implementation`),Yg=s(`, integrated to
Transformers through `),kr=r("a"),Ag=s("Optimum library"),qg=s(`. Only a
subset of all Transformers models are supported.`),Lg=i(),He=r("p"),Sg=s("PyTorch\u2019s attention fastpath allows to speed up inference through kernel fusions and the use of "),Er=r("a"),Hg=s(`nested
tensors`),Qg=s(". Detailed benchmarks can be found in "),Pr=r("a"),Og=s(`this blog
post`),Kg=s("."),e_=i(),Zt=r("div"),h(jr.$$.fragment),t_=i(),Vl=r("p"),o_=s("Shows a one-time warning if the input_ids appear to contain padding and no attention mask was given."),kc=i(),zn=r("a"),Ec=i(),Qe=r("h3"),Ct=r("a"),Xl=r("span"),h(Ur.$$.fragment),r_=i(),Nl=r("span"),a_=s("Large model loading"),Pc=i(),ye=r("p"),n_=s("In Transformers 4.20.0, the "),Bn=r("a"),s_=s("from_pretrained()"),l_=s(" method has been reworked to accommodate large models using "),Jr=r("a"),i_=s("Accelerate"),d_=s(". This requires Accelerate >= 0.9.0 and PyTorch >= 1.9.0. Instead of creating the full model, then loading the pretrained weights inside it (which takes twice the size of the model in RAM, one for the randomly initialized model, one for the weights), there is an option to create the model as an empty shell, then only materialize its parameters when the pretrained weights are loaded."),jc=i(),Wt=r("p"),c_=s("This option can be activated with "),Yl=r("code"),m_=s("low_cpu_mem_usage=True"),h_=s(". The model is first created on the Meta device (with empty weights) and the state dict is then loaded inside it (shard by shard in the case of a sharded checkpoint). This way the maximum RAM used is the full size of the model only."),Uc=i(),h(Fr.$$.fragment),Jc=i(),Gt=r("p"),p_=s("Moreover, you can directly place the model on different devices if it doesn\u2019t fully fit in RAM (only works for inference for now). With "),Al=r("code"),f_=s('device_map="auto"'),u_=s(", Accelerate will determine where to put each layer to maximize the use of your fastest devices (GPUs) and offload the rest on the CPU, or even the hard drive if you don\u2019t have enough GPU RAM (or CPU RAM). Even if the model is split across several devices, it will run as you would normally expect."),Fc=i(),O=r("p"),g_=s("When passing a "),ql=r("code"),__=s("device_map"),b_=s(", "),Ll=r("code"),v_=s("low_cpu_mem_usage"),y_=s(" is automatically set to "),Sl=r("code"),w_=s("True"),M_=s(", so you don\u2019t need to specify it:"),Ic=i(),h(Ir.$$.fragment),Zc=i(),zt=r("p"),T_=s("You can inspect how the model was split across devices by looking at its "),Hl=r("code"),$_=s("hf_device_map"),x_=s(" attribute:"),Cc=i(),h(Zr.$$.fragment),Wc=i(),h(Cr.$$.fragment),Gc=i(),Dn=r("p"),k_=s("You can also write your own device map following the same format (a dictionary layer name to device). It should map all parameters of the model to a given device, but you don\u2019t have to detail where all the submodules of one layer go if that layer is entirely on the same device. For instance, the following device map would work properly for T0pp (as long as you have the GPU memory):"),zc=i(),h(Wr.$$.fragment),Bc=i(),Bt=r("p"),E_=s("Another way to minimize the memory impact of your model is to instantiate it at a lower precision dtype (like "),Ql=r("code"),P_=s("torch.float16"),j_=s(") or use direct quantization techniques as described below."),Dc=i(),Oe=r("h3"),Dt=r("a"),Ol=r("span"),h(Gr.$$.fragment),U_=i(),Kl=r("span"),J_=s("Model Instantiation dtype"),Rc=i(),K=r("p"),F_=s("Under Pytorch a model normally gets instantiated with "),ei=r("code"),I_=s("torch.float32"),Z_=s(` format. This can be an issue if one tries to
load a model whose weights are in fp16, since it\u2019d require twice as much memory. To overcome this limitation, you can
either explicitly pass the desired `),ti=r("code"),C_=s("dtype"),W_=s(" using "),oi=r("code"),G_=s("torch_dtype"),z_=s(" argument:"),Vc=i(),h(zr.$$.fragment),Xc=i(),we=r("p"),B_=s("or, if you want the model to always load in the most optimal memory pattern, you can use the special value "),ri=r("code"),D_=s('"auto"'),R_=s(`,
and then `),ai=r("code"),V_=s("dtype"),X_=s(" will be automatically derived from the model\u2019s weights:"),Nc=i(),h(Br.$$.fragment),Yc=i(),Rt=r("p"),N_=s("Models instantiated from scratch can also be told which "),ni=r("code"),Y_=s("dtype"),A_=s(" to use with:"),Ac=i(),h(Dr.$$.fragment),qc=i(),Rn=r("p"),q_=s("Due to Pytorch design, this functionality is only available for floating dtypes."),Lc=i(),Ke=r("h2"),Vt=r("a"),si=r("span"),h(Rr.$$.fragment),L_=i(),li=r("span"),S_=s("ModuleUtilsMixin"),Sc=i(),C=r("div"),h(Vr.$$.fragment),H_=i(),Xr=r("p"),Q_=s("A few utilities for "),ii=r("code"),O_=s("torch.nn.Modules"),K_=s(", to be used as a mixin."),eb=i(),Me=r("div"),h(Nr.$$.fragment),tb=i(),di=r("p"),ob=s("Add a memory hook before and after each sub-module forward pass to record increase in memory consumption."),rb=i(),et=r("p"),ab=s("Increase in memory consumption is stored in a "),ci=r("code"),nb=s("mem_rss_diff"),sb=s(` attribute for each module and can be reset to zero
with `),mi=r("code"),lb=s("model.reset_memory_hooks_state()"),ib=s("."),db=i(),Xt=r("div"),h(Yr.$$.fragment),cb=i(),hi=r("p"),mb=s("Helper function to estimate the total number of tokens from the model inputs."),hb=i(),Nt=r("div"),h(Ar.$$.fragment),pb=i(),tt=r("p"),fb=s(`Get number of (optionally, non-embeddings) floating-point operations for the forward and backward passes of a
batch with this transformer model. Default approximation neglects the quadratic dependency on the number of
tokens (valid if `),pi=r("code"),ub=s("12 * d_model << sequence_length"),gb=s(") as laid out in "),qr=r("a"),_b=s(`this
paper`),bb=s(` section 2.1. Should be overridden for transformers with parameter
re-use e.g. Albert or Universal Transformers, or if doing long-range modeling with very high sequence lengths.`),vb=i(),Yt=r("div"),h(Lr.$$.fragment),yb=i(),fi=r("p"),wb=s("Makes broadcastable attention and causal masks so that future and masked tokens are ignored."),Mb=i(),At=r("div"),h(Sr.$$.fragment),Tb=i(),ui=r("p"),$b=s("Prepare the head mask if needed."),xb=i(),qt=r("div"),h(Hr.$$.fragment),kb=i(),gi=r("p"),Eb=s("Invert an attention mask (e.g., switches 0. and 1.)."),Pb=i(),Lt=r("div"),h(Qr.$$.fragment),jb=i(),_i=r("p"),Ub=s("Get number of (optionally, trainable or non-embeddings) parameters in the module."),Jb=i(),St=r("div"),h(Or.$$.fragment),Fb=i(),ot=r("p"),Ib=s("Reset the "),bi=r("code"),Zb=s("mem_rss_diff"),Cb=s(" attribute of each module (see "),Vn=r("a"),Wb=s("add_memory_hooks()"),Gb=s(")."),Hc=i(),rt=r("h2"),Ht=r("a"),vi=r("span"),h(Kr.$$.fragment),zb=i(),yi=r("span"),Bb=s("TFPreTrainedModel"),Qc=i(),x=r("div"),h(ea.$$.fragment),Db=i(),wi=r("p"),Rb=s("Base class for all TF models."),Vb=i(),Xn=r("p"),Nn=r("a"),Xb=s("TFPreTrainedModel"),Nb=s(` takes care of storing the configuration of the models and handles methods for loading,
downloading and saving models as well as a few methods common to all models to:`),Yb=i(),ta=r("ul"),Mi=r("li"),Ab=s("resize the input embeddings,"),qb=i(),Ti=r("li"),Lb=s("prune heads in the self-attention heads."),Sb=i(),$i=r("p"),Hb=s("Class attributes (overridden by derived classes):"),Qb=i(),at=r("ul"),Te=r("li"),xi=r("strong"),Ob=s("config_class"),Kb=s(" ("),Yn=r("a"),ev=s("PretrainedConfig"),tv=s(") \u2014 A subclass of "),An=r("a"),ov=s("PretrainedConfig"),rv=s(` to use as configuration class
for this model architecture.`),av=i(),Qt=r("li"),ki=r("strong"),nv=s("base_model_prefix"),sv=s(" ("),Ei=r("code"),lv=s("str"),iv=s(`) \u2014 A string indicating the attribute associated to the base model in derived
classes of the same architecture adding modules on top of the base model.`),dv=i(),R=r("li"),Pi=r("strong"),cv=s("main_input_name"),mv=s(" ("),ji=r("code"),hv=s("str"),pv=s(") \u2014 The name of the principal input to the model (often "),Ui=r("code"),fv=s("input_ids"),uv=s(` for NLP
models, `),Ji=r("code"),gv=s("pixel_values"),_v=s(" for vision models and "),Fi=r("code"),bv=s("input_values"),vv=s(" for speech models)."),yv=i(),$e=r("div"),h(oa.$$.fragment),wv=i(),ra=r("p"),Mv=s("Upload the model files to the \u{1F917} Model Hub while synchronizing a local clone of the repo in "),Ii=r("code"),Tv=s("repo_path_or_name"),$v=s("."),xv=i(),h(Ot.$$.fragment),kv=i(),Kt=r("div"),h(aa.$$.fragment),Ev=i(),na=r("p"),Pv=s("Returns whether this model can generate sequences with "),Zi=r("code"),jv=s(".generate()"),Uv=s("."),Jv=i(),eo=r("div"),h(sa.$$.fragment),Fv=i(),Ci=r("p"),Iv=s(`This is a thin wrapper that sets the model\u2019s loss output head as the loss if the user does not specify a loss
function themselves.`),Zv=i(),to=r("div"),h(la.$$.fragment),Cv=i(),ia=r("p"),Wv=s("Creates a draft of a model card using the information available to the "),Wi=r("code"),Gv=s("Trainer"),zv=s("."),Bv=i(),oo=r("div"),h(da.$$.fragment),Dv=i(),Gi=r("p"),Rv=s("Method used for serving the model. This method is deprecated, and will be removed."),Vv=i(),V=r("div"),h(ca.$$.fragment),Xv=i(),zi=r("p"),Nv=s("Instantiate a pretrained TF 2.0 model from a pre-trained model configuration."),Yv=i(),ma=r("p"),Av=s("The warning "),Bi=r("em"),qv=s("Weights from XXX not initialized from pretrained model"),Lv=s(` means that the weights of XXX do not come
pretrained with the rest of the model. It is up to you to train those weights with a downstream fine-tuning
task.`),Sv=i(),ha=r("p"),Hv=s("The warning "),Di=r("em"),Qv=s("Weights from XXX not used in YYY"),Ov=s(` means that the layer XXX is not used by YYY, therefore those
weights are discarded.`),Kv=i(),h(ro.$$.fragment),ey=i(),ao=r("div"),h(pa.$$.fragment),ty=i(),Ri=r("p"),oy=s("Dict of bias attached to an LM head. The key represents the name of the bias attribute."),ry=i(),no=r("div"),h(fa.$$.fragment),ay=i(),Vi=r("p"),ny=s("Prepare the head mask if needed."),sy=i(),so=r("div"),h(ua.$$.fragment),ly=i(),Xi=r("p"),iy=s("Returns the model\u2019s input embeddings layer."),dy=i(),lo=r("div"),h(ga.$$.fragment),cy=i(),Ni=r("p"),my=s("The LM Head layer. This method must be overwritten by all the models that have a lm head."),hy=i(),io=r("div"),h(_a.$$.fragment),py=i(),Yi=r("p"),fy=s("Returns the model\u2019s output embeddings"),uy=i(),co=r("div"),h(ba.$$.fragment),gy=i(),Ai=r("p"),_y=s(`Get the layer that handles a bias attribute in case the model has an LM head with weights tied to the
embeddings`),by=i(),mo=r("div"),h(va.$$.fragment),vy=i(),qi=r("p"),yy=s("Get the concatenated _prefix name of the bias from the model name to the parent layer"),wy=i(),ho=r("div"),h(ya.$$.fragment),My=i(),Li=r("p"),Ty=s(`Loads a saved checkpoint (model weights and optimizer state) from a repo. Returns the current epoch count when
the checkpoint was made.`),$y=i(),po=r("div"),h(wa.$$.fragment),xy=i(),q=r("p"),ky=s("Wraps a HuggingFace "),Ma=r("a"),Ey=s("Dataset"),Py=s(" as a "),Si=r("code"),jy=s("tf.data.Dataset"),Uy=s(` with collation and batching. This method is
designed to create a \u201Cready-to-use\u201D dataset that can be passed directly to Keras methods like `),Hi=r("code"),Jy=s("fit()"),Fy=s(` without
further modification. The method will drop columns from the dataset if they don\u2019t match input names for the
model. If you want to specify the column names to return rather than using the names that match this model, we
recommend using `),Qi=r("code"),Iy=s("Dataset.to_tf_dataset()"),Zy=s(" instead."),Cy=i(),fo=r("div"),h(Ta.$$.fragment),Wy=i(),Oi=r("p"),Gy=s("Prunes heads of the base model."),zy=i(),xe=r("div"),h($a.$$.fragment),By=i(),Ki=r("p"),Dy=s(`Register this class with a given auto class. This should only be used for custom models as the ones in the
library are already mapped with an auto class.`),Ry=i(),h(uo.$$.fragment),Vy=i(),ke=r("div"),h(xa.$$.fragment),Xy=i(),ka=r("p"),Ny=s("Resizes input token embeddings matrix of the model if "),ed=r("code"),Yy=s("new_num_tokens != config.vocab_size"),Ay=s("."),qy=i(),Ea=r("p"),Ly=s("Takes care of tying weights embeddings afterwards if the model class has a "),td=r("code"),Sy=s("tie_weights()"),Hy=s(" method."),Qy=i(),go=r("div"),h(Pa.$$.fragment),Oy=i(),ja=r("p"),Ky=s(`Save a model and its configuration file to a directory, so that it can be re-loaded using the
`),qn=r("a"),e1=s("from_pretrained()"),t1=s(" class method."),o1=i(),Ln=r("div"),h(Ua.$$.fragment),r1=i(),_o=r("div"),h(Ja.$$.fragment),a1=i(),od=r("p"),n1=s("Prepare the output of the saved model. Can be overridden if specific serving modifications are required."),s1=i(),bo=r("div"),h(Fa.$$.fragment),l1=i(),rd=r("p"),i1=s("Set all the bias in the LM head."),d1=i(),vo=r("div"),h(Ia.$$.fragment),c1=i(),ad=r("p"),m1=s("Set model\u2019s input embeddings"),h1=i(),yo=r("div"),h(Za.$$.fragment),p1=i(),nd=r("p"),f1=s("Set model\u2019s output embeddings"),u1=i(),wo=r("div"),h(Ca.$$.fragment),g1=i(),Wa=r("p"),_1=s("A modification of Keras\u2019s default "),sd=r("code"),b1=s("train_step"),v1=s(` that correctly handles matching outputs to labels for our models
and supports directly training on the loss output head. In addition, it ensures input keys are copied to the
labels where appropriate. It will also copy label keys into the input dict when using the dummy loss, to ensure
that they are available to the model during the forward pass.`),y1=i(),Mo=r("div"),h(Ga.$$.fragment),w1=i(),za=r("p"),M1=s("A modification of Keras\u2019s default "),ld=r("code"),T1=s("train_step"),$1=s(` that correctly handles matching outputs to labels for our models
and supports directly training on the loss output head. In addition, it ensures input keys are copied to the
labels where appropriate. It will also copy label keys into the input dict when using the dummy loss, to ensure
that they are available to the model during the forward pass.`),Oc=i(),nt=r("h2"),To=r("a"),id=r("span"),h(Ba.$$.fragment),x1=i(),dd=r("span"),k1=s("TFModelUtilsMixin"),Kc=i(),re=r("div"),h(Da.$$.fragment),E1=i(),Ra=r("p"),P1=s("A few utilities for "),cd=r("code"),j1=s("tf.keras.Model"),U1=s(", to be used as a mixin."),J1=i(),$o=r("div"),h(Va.$$.fragment),F1=i(),md=r("p"),I1=s("Get the number of (optionally, trainable) parameters in the model."),em=i(),st=r("h2"),xo=r("a"),hd=r("span"),h(Xa.$$.fragment),Z1=i(),pd=r("span"),C1=s("FlaxPreTrainedModel"),tm=i(),J=r("div"),h(Na.$$.fragment),W1=i(),fd=r("p"),G1=s("Base class for all models."),z1=i(),Sn=r("p"),Hn=r("a"),B1=s("FlaxPreTrainedModel"),D1=s(` takes care of storing the configuration of the models and handles methods for loading,
downloading and saving models.`),R1=i(),ud=r("p"),V1=s("Class attributes (overridden by derived classes):"),X1=i(),lt=r("ul"),Ee=r("li"),gd=r("strong"),N1=s("config_class"),Y1=s(" ("),Qn=r("a"),A1=s("PretrainedConfig"),q1=s(") \u2014 A subclass of "),On=r("a"),L1=s("PretrainedConfig"),S1=s(` to use as configuration class
for this model architecture.`),H1=i(),ko=r("li"),_d=r("strong"),Q1=s("base_model_prefix"),O1=s(" ("),bd=r("code"),K1=s("str"),ew=s(`) \u2014 A string indicating the attribute associated to the base model in derived
classes of the same architecture adding modules on top of the base model.`),tw=i(),X=r("li"),vd=r("strong"),ow=s("main_input_name"),rw=s(" ("),yd=r("code"),aw=s("str"),nw=s(") \u2014 The name of the principal input to the model (often "),wd=r("code"),sw=s("input_ids"),lw=s(` for NLP
models, `),Md=r("code"),iw=s("pixel_values"),dw=s(" for vision models and "),Td=r("code"),cw=s("input_values"),mw=s(" for speech models)."),hw=i(),Pe=r("div"),h(Ya.$$.fragment),pw=i(),Aa=r("p"),fw=s(`Upload the model checkpoint to the \u{1F917} Model Hub while synchronizing a local clone of the repo in
`),$d=r("code"),uw=s("repo_path_or_name"),gw=s("."),_w=i(),h(Eo.$$.fragment),bw=i(),Po=r("div"),h(qa.$$.fragment),vw=i(),ae=r("p"),yw=s("Returns whether this model can generate sequences with "),xd=r("code"),ww=s(".generate()"),Mw=s(`. Returns:
`),kd=r("code"),Tw=s("bool"),$w=s(": Whether this model can generate sequences with "),Ed=r("code"),xw=s(".generate()"),kw=s("."),Ew=i(),N=r("div"),h(La.$$.fragment),Pw=i(),Pd=r("p"),jw=s("Instantiate a pretrained flax model from a pre-trained model configuration."),Uw=i(),Sa=r("p"),Jw=s("The warning "),jd=r("em"),Fw=s("Weights from XXX not initialized from pretrained model"),Iw=s(` means that the weights of XXX do not come
pretrained with the rest of the model. It is up to you to train those weights with a downstream fine-tuning
task.`),Zw=i(),Ha=r("p"),Cw=s("The warning "),Ud=r("em"),Ww=s("Weights from XXX not used in YYY"),Gw=s(` means that the layer XXX is not used by YYY, therefore those
weights are discarded.`),zw=i(),h(jo.$$.fragment),Bw=i(),je=r("div"),h(Qa.$$.fragment),Dw=i(),Oa=r("p"),Rw=s("This is the same as "),Jd=r("code"),Vw=s("flax.serialization.from_bytes"),Xw=s(`
(https:lax.readthedocs.io/en/latest/_modules/flax/serialization.html#from_bytes) but for a sharded checkpoint.`),Nw=i(),Fd=r("p"),Yw=s(`This load is performed efficiently: each checkpoint shard is loaded one by one in RAM and deleted after being
loaded in the model.`),Aw=i(),Ue=r("div"),h(Ka.$$.fragment),qw=i(),Id=r("p"),Lw=s(`Register this class with a given auto class. This should only be used for custom models as the ones in the
library are already mapped with an auto class.`),Sw=i(),h(Uo.$$.fragment),Hw=i(),Jo=r("div"),h(en.$$.fragment),Qw=i(),tn=r("p"),Ow=s(`Save a model and its configuration file to a directory, so that it can be re-loaded using the
`),Zd=r("code"),Kw=s("[from_pretrained()](/docs/transformers/v4.31.0/en/main_classes/model#transformers.FlaxPreTrainedModel.from_pretrained)"),e2=s(" class method"),t2=i(),ee=r("div"),h(on.$$.fragment),o2=i(),L=r("p"),r2=s("Cast the floating-point "),Cd=r("code"),a2=s("params"),n2=s(" to "),Wd=r("code"),s2=s("jax.numpy.bfloat16"),l2=s(". This returns a new "),Gd=r("code"),i2=s("params"),d2=s(` tree and does not cast
the `),zd=r("code"),c2=s("params"),m2=s(" in place."),h2=i(),Bd=r("p"),p2=s(`This method can be used on 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.`),f2=i(),h(Fo.$$.fragment),u2=i(),te=r("div"),h(rn.$$.fragment),g2=i(),S=r("p"),_2=s("Cast the floating-point "),Dd=r("code"),b2=s("parmas"),v2=s(" to "),Rd=r("code"),y2=s("jax.numpy.float16"),w2=s(". This returns a new "),Vd=r("code"),M2=s("params"),T2=s(` tree and does not cast the
`),Xd=r("code"),$2=s("params"),x2=s(" in place."),k2=i(),Nd=r("p"),E2=s(`This method can be used on 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.`),P2=i(),h(Io.$$.fragment),j2=i(),Je=r("div"),h(an.$$.fragment),U2=i(),H=r("p"),J2=s("Cast the floating-point "),Yd=r("code"),F2=s("parmas"),I2=s(" to "),Ad=r("code"),Z2=s("jax.numpy.float32"),C2=s(`. This method can be used to explicitly convert the
model parameters to fp32 precision. This returns a new `),qd=r("code"),W2=s("params"),G2=s(" tree and does not cast the "),Ld=r("code"),z2=s("params"),B2=s(" in place."),D2=i(),h(Zo.$$.fragment),om=i(),it=r("h2"),Co=r("a"),Sd=r("span"),h(nn.$$.fragment),R2=i(),Hd=r("span"),V2=s("Pushing to the Hub"),rm=i(),ne=r("div"),h(sn.$$.fragment),X2=i(),Qd=r("p"),N2=s("A Mixin containing the functionality to push a model or tokenizer to the hub."),Y2=i(),Fe=r("div"),h(ln.$$.fragment),A2=i(),dn=r("p"),q2=s(`Upload the {object_files} to the \u{1F917} Model Hub while synchronizing a local clone of the repo in
`),Od=r("code"),L2=s("repo_path_or_name"),S2=s("."),H2=i(),h(Wo.$$.fragment),am=i(),dt=r("h2"),Go=r("a"),Kd=r("span"),h(cn.$$.fragment),Q2=i(),ec=r("span"),O2=s("Sharded checkpoints"),nm=i(),se=r("div"),h(mn.$$.fragment),K2=i(),hn=r("p"),eM=s(`This is the same as
`),pn=r("a"),tc=r("code"),tM=s("torch.nn.Module.load_state_dict"),oM=s(`
but for a sharded checkpoint.`),rM=i(),oc=r("p"),aM=s(`This load is performed efficiently: each checkpoint shard is loaded one by one in RAM and deleted after being
loaded in the model.`),this.h()},l(o){const b=$x('[data-svelte="svelte-1phssyn"]',document.head);v=a(b,"META",{name:!0,content:!0}),b.forEach(t),E=d(o),M=a(o,"H1",{class:!0});var fn=n(M);y=a(fn,"A",{id:!0,class:!0,href:!0});var rc=n(y);P=a(rc,"SPAN",{});var ac=n(P);p(c.$$.fragment,ac),ac.forEach(t),rc.forEach(t),T=d(fn),ct=a(fn,"SPAN",{});var nc=n(ct);Nh=l(nc,"Models"),nc.forEach(t),fn.forEach(t),yc=d(o),Q=a(o,"P",{});var le=n(Q);Yh=l(le,"The base classes "),yn=a(le,"A",{href:!0});var sc=n(yn);Ah=l(sc,"PreTrainedModel"),sc.forEach(t),qh=l(le,", "),wn=a(le,"A",{href:!0});var lc=n(wn);Lh=l(lc,"TFPreTrainedModel"),lc.forEach(t),Sh=l(le,`, and
`),Mn=a(le,"A",{href:!0});var ic=n(Mn);Hh=l(ic,"FlaxPreTrainedModel"),ic.forEach(t),Qh=l(le,` implement the common methods for loading/saving a model either from a local
file or directory, or from a pretrained model configuration provided by the library (downloaded from HuggingFace\u2019s AWS
S3 repository).`),le.forEach(t),wc=d(o),Ne=a(o,"P",{});var zo=n(Ne);Tn=a(zo,"A",{href:!0});var dc=n(Tn);Oh=l(dc,"PreTrainedModel"),dc.forEach(t),Kh=l(zo," and "),$n=a(zo,"A",{href:!0});var cc=n($n);ep=l(cc,"TFPreTrainedModel"),cc.forEach(t),tp=l(zo,` also implement a few methods which
are common among all the models to:`),zo.forEach(t),Mc=d(o),mt=a(o,"UL",{});var un=n(mt);Us=a(un,"LI",{});var mc=n(Us);op=l(mc,"resize the input token embeddings when new tokens are added to the vocabulary"),mc.forEach(t),rp=d(un),Js=a(un,"LI",{});var hc=n(Js);ap=l(hc,"prune the attention heads of the model."),hc.forEach(t),un.forEach(t),Tc=d(o),B=a(o,"P",{});var oe=n(B);np=l(oe,"The other methods that are common to each model are defined in "),xn=a(oe,"A",{href:!0});var cM=n(xn);sp=l(cM,"ModuleUtilsMixin"),cM.forEach(t),lp=l(oe,`
(for the PyTorch models) and `),Fs=a(oe,"CODE",{});var mM=n(Fs);ip=l(mM,"~modeling_tf_utils.TFModuleUtilsMixin"),mM.forEach(t),dp=l(oe,` (for the TensorFlow models) or
for text generation, `),kn=a(oe,"A",{href:!0});var hM=n(kn);cp=l(hM,"GenerationMixin"),hM.forEach(t),mp=l(oe,` (for the PyTorch models),
`),En=a(oe,"A",{href:!0});var pM=n(En);hp=l(pM,"TFGenerationMixin"),pM.forEach(t),pp=l(oe,` (for the TensorFlow models) and
`),Pn=a(oe,"A",{href:!0});var fM=n(Pn);fp=l(fM,"FlaxGenerationMixin"),fM.forEach(t),up=l(oe," (for the Flax/JAX models)."),oe.forEach(t),$c=d(o),Ye=a(o,"H2",{class:!0});var lm=n(Ye);ht=a(lm,"A",{id:!0,class:!0,href:!0});var uM=n(ht);Is=a(uM,"SPAN",{});var gM=n(Is);p(No.$$.fragment,gM),gM.forEach(t),uM.forEach(t),gp=d(lm),Zs=a(lm,"SPAN",{});var _M=n(Zs);_p=l(_M,"PreTrainedModel"),_M.forEach(t),lm.forEach(t),xc=d(o),j=a(o,"DIV",{class:!0});var U=n(j);p(Yo.$$.fragment,U),bp=d(U),Cs=a(U,"P",{});var bM=n(Cs);vp=l(bM,"Base class for all models."),bM.forEach(t),yp=d(U),jn=a(U,"P",{});var nM=n(jn);Un=a(nM,"A",{href:!0});var vM=n(Un);wp=l(vM,"PreTrainedModel"),vM.forEach(t),Mp=l(nM,` takes care of storing the configuration of the models and handles methods for loading,
downloading and saving models as well as a few methods common to all models to:`),nM.forEach(t),Tp=d(U),Ao=a(U,"UL",{});var im=n(Ao);Ws=a(im,"LI",{});var yM=n(Ws);$p=l(yM,"resize the input embeddings,"),yM.forEach(t),xp=d(im),Gs=a(im,"LI",{});var wM=n(Gs);kp=l(wM,"prune heads in the self-attention heads."),wM.forEach(t),im.forEach(t),Ep=d(U),zs=a(U,"P",{});var MM=n(zs);Pp=l(MM,"Class attributes (overridden by derived classes):"),MM.forEach(t),jp=d(U),Y=a(U,"UL",{});var Ie=n(Y);Bs=a(Ie,"LI",{});var TM=n(Bs);me=a(TM,"P",{});var gn=n(me);Ds=a(gn,"STRONG",{});var $M=n(Ds);Up=l($M,"config_class"),$M.forEach(t),Jp=l(gn," ("),Jn=a(gn,"A",{href:!0});var xM=n(Jn);Fp=l(xM,"PretrainedConfig"),xM.forEach(t),Ip=l(gn,") \u2014 A subclass of "),Fn=a(gn,"A",{href:!0});var kM=n(Fn);Zp=l(kM,"PretrainedConfig"),kM.forEach(t),Cp=l(gn,` to use as configuration class
for this model architecture.`),gn.forEach(t),TM.forEach(t),Wp=d(Ie),qo=a(Ie,"LI",{});var dm=n(qo);he=a(dm,"P",{});var _n=n(he);Rs=a(_n,"STRONG",{});var EM=n(Rs);Gp=l(EM,"load_tf_weights"),EM.forEach(t),zp=l(_n," ("),Vs=a(_n,"CODE",{});var PM=n(Vs);Bp=l(PM,"Callable"),PM.forEach(t),Dp=l(_n,") \u2014 A python "),Xs=a(_n,"EM",{});var jM=n(Xs);Rp=l(jM,"method"),jM.forEach(t),Vp=l(_n,` for loading a TensorFlow checkpoint in a PyTorch model,
taking as arguments:`),_n.forEach(t),Xp=d(dm),Ae=a(dm,"UL",{});var Kn=n(Ae);pt=a(Kn,"LI",{});var pc=n(pt);Ns=a(pc,"STRONG",{});var UM=n(Ns);Np=l(UM,"model"),UM.forEach(t),Yp=l(pc," ("),In=a(pc,"A",{href:!0});var JM=n(In);Ap=l(JM,"PreTrainedModel"),JM.forEach(t),qp=l(pc,") \u2014 An instance of the model on which to load the TensorFlow checkpoint."),pc.forEach(t),Lp=d(Kn),ft=a(Kn,"LI",{});var fc=n(ft);Ys=a(fc,"STRONG",{});var FM=n(Ys);Sp=l(FM,"config"),FM.forEach(t),Hp=l(fc," ("),As=a(fc,"CODE",{});var IM=n(As);Qp=l(IM,"PreTrainedConfig"),IM.forEach(t),Op=l(fc,") \u2014 An instance of the configuration associated to the model."),fc.forEach(t),Kp=d(Kn),ut=a(Kn,"LI",{});var uc=n(ut);qs=a(uc,"STRONG",{});var ZM=n(qs);ef=l(ZM,"path"),ZM.forEach(t),tf=l(uc," ("),Ls=a(uc,"CODE",{});var CM=n(Ls);of=l(CM,"str"),CM.forEach(t),rf=l(uc,") \u2014 A path to the TensorFlow checkpoint."),uc.forEach(t),Kn.forEach(t),dm.forEach(t),af=d(Ie),Ss=a(Ie,"LI",{});var WM=n(Ss);gt=a(WM,"P",{});var gc=n(gt);Hs=a(gc,"STRONG",{});var GM=n(Hs);nf=l(GM,"base_model_prefix"),GM.forEach(t),sf=l(gc," ("),Qs=a(gc,"CODE",{});var zM=n(Qs);lf=l(zM,"str"),zM.forEach(t),df=l(gc,`) \u2014 A string indicating the attribute associated to the base model in derived
classes of the same architecture adding modules on top of the base model.`),gc.forEach(t),WM.forEach(t),cf=d(Ie),Os=a(Ie,"LI",{});var BM=n(Os);_t=a(BM,"P",{});var _c=n(_t);Ks=a(_c,"STRONG",{});var DM=n(Ks);mf=l(DM,"is_parallelizable"),DM.forEach(t),hf=l(_c," ("),el=a(_c,"CODE",{});var RM=n(el);pf=l(RM,"bool"),RM.forEach(t),ff=l(_c,") \u2014 A flag indicating whether this model supports model parallelization."),_c.forEach(t),BM.forEach(t),uf=d(Ie),tl=a(Ie,"LI",{});var VM=n(tl);D=a(VM,"P",{});var ie=n(D);ol=a(ie,"STRONG",{});var XM=n(ol);gf=l(XM,"main_input_name"),XM.forEach(t),_f=l(ie," ("),rl=a(ie,"CODE",{});var NM=n(rl);bf=l(NM,"str"),NM.forEach(t),vf=l(ie,") \u2014 The name of the principal input to the model (often "),al=a(ie,"CODE",{});var YM=n(al);yf=l(YM,"input_ids"),YM.forEach(t),wf=l(ie,` for NLP
models, `),nl=a(ie,"CODE",{});var AM=n(nl);Mf=l(AM,"pixel_values"),AM.forEach(t),Tf=l(ie," for vision models and "),sl=a(ie,"CODE",{});var qM=n(sl);$f=l(qM,"input_values"),qM.forEach(t),xf=l(ie," for speech models)."),ie.forEach(t),VM.forEach(t),Ie.forEach(t),kf=d(U),pe=a(U,"DIV",{class:!0});var es=n(pe);p(Lo.$$.fragment,es),Ef=d(es),So=a(es,"P",{});var cm=n(So);Pf=l(cm,`Upload the model file to the \u{1F917} Model Hub while synchronizing a local clone of the repo in
`),ll=a(cm,"CODE",{});var LM=n(ll);jf=l(LM,"repo_path_or_name"),LM.forEach(t),Uf=l(cm,"."),cm.forEach(t),Jf=d(es),p(bt.$$.fragment,es),es.forEach(t),Ff=d(U),vt=a(U,"DIV",{class:!0});var mm=n(vt);p(Ho.$$.fragment,mm),If=d(mm),Qo=a(mm,"P",{});var hm=n(Qo);Zf=l(hm,"Returns whether this model can generate sequences with "),il=a(hm,"CODE",{});var SM=n(il);Cf=l(SM,".generate()"),SM.forEach(t),Wf=l(hm,"."),hm.forEach(t),mm.forEach(t),Gf=d(U),yt=a(U,"DIV",{class:!0});var pm=n(yt);p(Oo.$$.fragment,pm),zf=d(pm),Ko=a(pm,"P",{});var fm=n(Ko);Bf=l(fm,"Removes the "),dl=a(fm,"CODE",{});var HM=n(dl);Df=l(HM,"_require_grads_hook"),HM.forEach(t),Rf=l(fm,"."),fm.forEach(t),pm.forEach(t),Vf=d(U),wt=a(U,"DIV",{class:!0});var um=n(wt);p(er.$$.fragment,um),Xf=d(um),cl=a(um,"P",{});var QM=n(cl);Nf=l(QM,`Enables the gradients for the input embeddings. This is useful for fine-tuning adapter weights while keeping
the model weights fixed.`),QM.forEach(t),um.forEach(t),Yf=d(U),I=a(U,"DIV",{class:!0});var W=n(I);p(tr.$$.fragment,W),Af=d(W),ml=a(W,"P",{});var OM=n(ml);qf=l(OM,"Instantiate a pretrained pytorch model from a pre-trained model configuration."),OM.forEach(t),Lf=d(W),qe=a(W,"P",{});var ts=n(qe);Sf=l(ts,"The model is set in evaluation mode by default using "),hl=a(ts,"CODE",{});var KM=n(hl);Hf=l(KM,"model.eval()"),KM.forEach(t),Qf=l(ts,` (Dropout modules are deactivated). To train
the model, you should first set it back in training mode with `),pl=a(ts,"CODE",{});var eT=n(pl);Of=l(eT,"model.train()"),eT.forEach(t),Kf=l(ts,"."),ts.forEach(t),eu=d(W),or=a(W,"P",{});var gm=n(or);tu=l(gm,"The warning "),fl=a(gm,"EM",{});var tT=n(fl);ou=l(tT,"Weights from XXX not initialized from pretrained model"),tT.forEach(t),ru=l(gm,` means that the weights of XXX do not come
pretrained with the rest of the model. It is up to you to train those weights with a downstream fine-tuning
task.`),gm.forEach(t),au=d(W),rr=a(W,"P",{});var _m=n(rr);nu=l(_m,"The warning "),ul=a(_m,"EM",{});var oT=n(ul);su=l(oT,"Weights from XXX not used in YYY"),oT.forEach(t),lu=l(_m,` means that the layer XXX is not used by YYY, therefore those
weights are discarded.`),_m.forEach(t),iu=d(W),p(Mt.$$.fragment,W),du=d(W),p(Tt.$$.fragment,W),cu=d(W),gl=a(W,"UL",{});var rT=n(gl);Zn=a(rT,"LI",{});var sM=n(Zn);_l=a(sM,"CODE",{});var aT=n(_l);mu=l(aT,"low_cpu_mem_usage"),aT.forEach(t),hu=l(sM," algorithm:"),sM.forEach(t),rT.forEach(t),pu=d(W),bl=a(W,"P",{});var nT=n(bl);fu=l(nT,"This is an experimental function that loads the model using ~1x model size CPU memory"),nT.forEach(t),uu=d(W),vl=a(W,"P",{});var sT=n(vl);gu=l(sT,"Here is how it works:"),sT.forEach(t),_u=d(W),A=a(W,"OL",{});var Ze=n(A);yl=a(Ze,"LI",{});var lT=n(yl);bu=l(lT,"save which state_dict keys we have"),lT.forEach(t),vu=d(Ze),wl=a(Ze,"LI",{});var iT=n(wl);yu=l(iT,"drop state_dict before the model is created, since the latter takes 1x model size CPU memory"),iT.forEach(t),wu=d(Ze),Ml=a(Ze,"LI",{});var dT=n(Ml);Mu=l(dT,`after the model has been instantiated switch to the meta device all params/buffers that
are going to be replaced from the loaded state_dict`),dT.forEach(t),Tu=d(Ze),Tl=a(Ze,"LI",{});var cT=n(Tl);$u=l(cT,"load state_dict 2nd time"),cT.forEach(t),xu=d(Ze),$l=a(Ze,"LI",{});var mT=n($l);ku=l(mT,"replace the params/buffers from the state_dict"),mT.forEach(t),Ze.forEach(t),Eu=d(W),xl=a(W,"P",{});var hT=n(xl);Pu=l(hT,"Currently, it can\u2019t handle deepspeed ZeRO stage 3 and ignores loading errors"),hT.forEach(t),W.forEach(t),ju=d(U),$t=a(U,"DIV",{class:!0});var bm=n($t);p(ar.$$.fragment,bm),Uu=d(bm),kl=a(bm,"P",{});var pT=n(kl);Ju=l(pT,"Returns the model\u2019s input embeddings."),pT.forEach(t),bm.forEach(t),Fu=d(U),xt=a(U,"DIV",{class:!0});var vm=n(xt);p(nr.$$.fragment,vm),Iu=d(vm),Cn=a(vm,"P",{});var lM=n(Cn);Zu=l(lM,`Get the memory footprint of a model. This will return the memory footprint of the current model in bytes.
Useful to benchmark the memory footprint of the current model and design some tests. Solution inspired from the
PyTorch discussions: `),sr=a(lM,"A",{href:!0,rel:!0});var fT=n(sr);Cu=l(fT,"https://discuss.pytorch.org/t/gpu-memory-that-model-uses/56822/2"),fT.forEach(t),lM.forEach(t),vm.forEach(t),Wu=d(U),kt=a(U,"DIV",{class:!0});var ym=n(kt);p(lr.$$.fragment,ym),Gu=d(ym),El=a(ym,"P",{});var uT=n(El);zu=l(uT,"Returns the model\u2019s output embeddings."),uT.forEach(t),ym.forEach(t),Bu=d(U),fe=a(U,"DIV",{class:!0});var os=n(fe);p(ir.$$.fragment,os),Du=d(os),Pl=a(os,"P",{});var gT=n(Pl);Ru=l(gT,"Deactivates gradient checkpointing for the current model."),gT.forEach(t),Vu=d(os),jl=a(os,"P",{});var _T=n(jl);Xu=l(_T,`Note that in other frameworks this feature can be referred to as \u201Cactivation checkpointing\u201D or \u201Ccheckpoint
activations\u201D.`),_T.forEach(t),os.forEach(t),Nu=d(U),ue=a(U,"DIV",{class:!0});var rs=n(ue);p(dr.$$.fragment,rs),Yu=d(rs),Ul=a(rs,"P",{});var bT=n(Ul);Au=l(bT,"Activates gradient checkpointing for the current model."),bT.forEach(t),qu=d(rs),Jl=a(rs,"P",{});var vT=n(Jl);Lu=l(vT,`Note that in other frameworks this feature can be referred to as \u201Cactivation checkpointing\u201D or \u201Ccheckpoint
activations\u201D.`),vT.forEach(t),rs.forEach(t),Su=d(U),Et=a(U,"DIV",{class:!0});var wm=n(Et);p(cr.$$.fragment,wm),Hu=d(wm),Le=a(wm,"P",{});var as=n(Le);Qu=l(as,"If needed prunes and maybe initializes weights. If using a custom "),Fl=a(as,"CODE",{});var yT=n(Fl);Ou=l(yT,"PreTrainedModel"),yT.forEach(t),Ku=l(as,`, you need to implement any
initialization logic in `),Il=a(as,"CODE",{});var wT=n(Il);eg=l(wT,"_init_weights"),wT.forEach(t),tg=l(as,"."),as.forEach(t),wm.forEach(t),og=d(U),Pt=a(U,"DIV",{class:!0});var Mm=n(Pt);p(mr.$$.fragment,Mm),rg=d(Mm),Zl=a(Mm,"P",{});var MT=n(Zl);ag=l(MT,`A method executed at the end of each Transformer model initialization, to execute code that needs the model\u2019s
modules properly initialized (such as weight initialization).`),MT.forEach(t),Mm.forEach(t),ng=d(U),jt=a(U,"DIV",{class:!0});var Tm=n(jt);p(hr.$$.fragment,Tm),sg=d(Tm),Cl=a(Tm,"P",{});var TT=n(Cl);lg=l(TT,"Prunes heads of the base model."),TT.forEach(t),Tm.forEach(t),ig=d(U),ge=a(U,"DIV",{class:!0});var ns=n(ge);p(pr.$$.fragment,ns),dg=d(ns),Wl=a(ns,"P",{});var $T=n(Wl);cg=l($T,`Register this class with a given auto class. This should only be used for custom models as the ones in the
library are already mapped with an auto class.`),$T.forEach(t),mg=d(ns),p(Ut.$$.fragment,ns),ns.forEach(t),hg=d(U),_e=a(U,"DIV",{class:!0});var ss=n(_e);p(fr.$$.fragment,ss),pg=d(ss),ur=a(ss,"P",{});var $m=n(ur);fg=l($m,"Resizes input token embeddings matrix of the model if "),Gl=a($m,"CODE",{});var xT=n(Gl);ug=l(xT,"new_num_tokens != config.vocab_size"),xT.forEach(t),gg=l($m,"."),$m.forEach(t),_g=d(ss),gr=a(ss,"P",{});var xm=n(gr);bg=l(xm,"Takes care of tying weights embeddings afterwards if the model class has a "),zl=a(xm,"CODE",{});var kT=n(zl);vg=l(kT,"tie_weights()"),kT.forEach(t),yg=l(xm," method."),xm.forEach(t),ss.forEach(t),wg=d(U),Jt=a(U,"DIV",{class:!0});var km=n(Jt);p(_r.$$.fragment,km),Mg=d(km),br=a(km,"P",{});var Em=n(br);Tg=l(Em,"Reverts the transformation from "),Wn=a(Em,"A",{href:!0});var ET=n(Wn);$g=l(ET,"to_bettertransformer()"),ET.forEach(t),xg=l(Em,` so that the original modeling is
used, for example in order to save the model.`),Em.forEach(t),km.forEach(t),kg=d(U),Ft=a(U,"DIV",{class:!0});var Pm=n(Ft);p(vr.$$.fragment,Pm),Eg=d(Pm),yr=a(Pm,"P",{});var jm=n(yr);Pg=l(jm,`Save a model and its configuration file to a directory, so that it can be re-loaded using the
`),Gn=a(jm,"A",{href:!0});var PT=n(Gn);jg=l(PT,"from_pretrained()"),PT.forEach(t),Ug=l(jm," class method."),jm.forEach(t),Pm.forEach(t),Jg=d(U),It=a(U,"DIV",{class:!0});var Um=n(It);p(wr.$$.fragment,Um),Fg=d(Um),Bl=a(Um,"P",{});var jT=n(Bl);Ig=l(jT,"Set model\u2019s input embeddings."),jT.forEach(t),Um.forEach(t),Zg=d(U),be=a(U,"DIV",{class:!0});var ls=n(be);p(Mr.$$.fragment,ls),Cg=d(ls),Dl=a(ls,"P",{});var UT=n(Dl);Wg=l(UT,"Tie the weights between the input embeddings and the output embeddings."),UT.forEach(t),Gg=d(ls),Tr=a(ls,"P",{});var Jm=n(Tr);zg=l(Jm,"If the "),Rl=a(Jm,"CODE",{});var JT=n(Rl);Bg=l(JT,"torchscript"),JT.forEach(t),Dg=l(Jm,` flag is set in the configuration, can\u2019t handle parameter sharing so we are cloning the
weights instead.`),Jm.forEach(t),ls.forEach(t),Rg=d(U),ve=a(U,"DIV",{class:!0});var is=n(ve);p($r.$$.fragment,is),Vg=d(is),Se=a(is,"P",{});var ds=n(Se);Xg=l(ds,"Converts the model to use "),xr=a(ds,"A",{href:!0,rel:!0});var FT=n(xr);Ng=l(FT,`PyTorch\u2019s native attention
implementation`),FT.forEach(t),Yg=l(ds,`, integrated to
Transformers through `),kr=a(ds,"A",{href:!0,rel:!0});var IT=n(kr);Ag=l(IT,"Optimum library"),IT.forEach(t),qg=l(ds,`. Only a
subset of all Transformers models are supported.`),ds.forEach(t),Lg=d(is),He=a(is,"P",{});var cs=n(He);Sg=l(cs,"PyTorch\u2019s attention fastpath allows to speed up inference through kernel fusions and the use of "),Er=a(cs,"A",{href:!0,rel:!0});var ZT=n(Er);Hg=l(ZT,`nested
tensors`),ZT.forEach(t),Qg=l(cs,". Detailed benchmarks can be found in "),Pr=a(cs,"A",{href:!0,rel:!0});var CT=n(Pr);Og=l(CT,`this blog
post`),CT.forEach(t),Kg=l(cs,"."),cs.forEach(t),is.forEach(t),e_=d(U),Zt=a(U,"DIV",{class:!0});var Fm=n(Zt);p(jr.$$.fragment,Fm),t_=d(Fm),Vl=a(Fm,"P",{});var WT=n(Vl);o_=l(WT,"Shows a one-time warning if the input_ids appear to contain padding and no attention mask was given."),WT.forEach(t),Fm.forEach(t),U.forEach(t),kc=d(o),zn=a(o,"A",{id:!0}),n(zn).forEach(t),Ec=d(o),Qe=a(o,"H3",{class:!0});var Im=n(Qe);Ct=a(Im,"A",{id:!0,class:!0,href:!0});var GT=n(Ct);Xl=a(GT,"SPAN",{});var zT=n(Xl);p(Ur.$$.fragment,zT),zT.forEach(t),GT.forEach(t),r_=d(Im),Nl=a(Im,"SPAN",{});var BT=n(Nl);a_=l(BT,"Large model loading"),BT.forEach(t),Im.forEach(t),Pc=d(o),ye=a(o,"P",{});var ms=n(ye);n_=l(ms,"In Transformers 4.20.0, the "),Bn=a(ms,"A",{href:!0});var DT=n(Bn);s_=l(DT,"from_pretrained()"),DT.forEach(t),l_=l(ms," method has been reworked to accommodate large models using "),Jr=a(ms,"A",{href:!0,rel:!0});var RT=n(Jr);i_=l(RT,"Accelerate"),RT.forEach(t),d_=l(ms,". This requires Accelerate >= 0.9.0 and PyTorch >= 1.9.0. Instead of creating the full model, then loading the pretrained weights inside it (which takes twice the size of the model in RAM, one for the randomly initialized model, one for the weights), there is an option to create the model as an empty shell, then only materialize its parameters when the pretrained weights are loaded."),ms.forEach(t),jc=d(o),Wt=a(o,"P",{});var Zm=n(Wt);c_=l(Zm,"This option can be activated with "),Yl=a(Zm,"CODE",{});var VT=n(Yl);m_=l(VT,"low_cpu_mem_usage=True"),VT.forEach(t),h_=l(Zm,". The model is first created on the Meta device (with empty weights) and the state dict is then loaded inside it (shard by shard in the case of a sharded checkpoint). This way the maximum RAM used is the full size of the model only."),Zm.forEach(t),Uc=d(o),p(Fr.$$.fragment,o),Jc=d(o),Gt=a(o,"P",{});var Cm=n(Gt);p_=l(Cm,"Moreover, you can directly place the model on different devices if it doesn\u2019t fully fit in RAM (only works for inference for now). With "),Al=a(Cm,"CODE",{});var XT=n(Al);f_=l(XT,'device_map="auto"'),XT.forEach(t),u_=l(Cm,", Accelerate will determine where to put each layer to maximize the use of your fastest devices (GPUs) and offload the rest on the CPU, or even the hard drive if you don\u2019t have enough GPU RAM (or CPU RAM). Even if the model is split across several devices, it will run as you would normally expect."),Cm.forEach(t),Fc=d(o),O=a(o,"P",{});var Bo=n(O);g_=l(Bo,"When passing a "),ql=a(Bo,"CODE",{});var NT=n(ql);__=l(NT,"device_map"),NT.forEach(t),b_=l(Bo,", "),Ll=a(Bo,"CODE",{});var YT=n(Ll);v_=l(YT,"low_cpu_mem_usage"),YT.forEach(t),y_=l(Bo," is automatically set to "),Sl=a(Bo,"CODE",{});var AT=n(Sl);w_=l(AT,"True"),AT.forEach(t),M_=l(Bo,", so you don\u2019t need to specify it:"),Bo.forEach(t),Ic=d(o),p(Ir.$$.fragment,o),Zc=d(o),zt=a(o,"P",{});var Wm=n(zt);T_=l(Wm,"You can inspect how the model was split across devices by looking at its "),Hl=a(Wm,"CODE",{});var qT=n(Hl);$_=l(qT,"hf_device_map"),qT.forEach(t),x_=l(Wm," attribute:"),Wm.forEach(t),Cc=d(o),p(Zr.$$.fragment,o),Wc=d(o),p(Cr.$$.fragment,o),Gc=d(o),Dn=a(o,"P",{});var LT=n(Dn);k_=l(LT,"You can also write your own device map following the same format (a dictionary layer name to device). It should map all parameters of the model to a given device, but you don\u2019t have to detail where all the submodules of one layer go if that layer is entirely on the same device. For instance, the following device map would work properly for T0pp (as long as you have the GPU memory):"),LT.forEach(t),zc=d(o),p(Wr.$$.fragment,o),Bc=d(o),Bt=a(o,"P",{});var Gm=n(Bt);E_=l(Gm,"Another way to minimize the memory impact of your model is to instantiate it at a lower precision dtype (like "),Ql=a(Gm,"CODE",{});var ST=n(Ql);P_=l(ST,"torch.float16"),ST.forEach(t),j_=l(Gm,") or use direct quantization techniques as described below."),Gm.forEach(t),Dc=d(o),Oe=a(o,"H3",{class:!0});var zm=n(Oe);Dt=a(zm,"A",{id:!0,class:!0,href:!0});var HT=n(Dt);Ol=a(HT,"SPAN",{});var QT=n(Ol);p(Gr.$$.fragment,QT),QT.forEach(t),HT.forEach(t),U_=d(zm),Kl=a(zm,"SPAN",{});var OT=n(Kl);J_=l(OT,"Model Instantiation dtype"),OT.forEach(t),zm.forEach(t),Rc=d(o),K=a(o,"P",{});var Do=n(K);F_=l(Do,"Under Pytorch a model normally gets instantiated with "),ei=a(Do,"CODE",{});var KT=n(ei);I_=l(KT,"torch.float32"),KT.forEach(t),Z_=l(Do,` format. This can be an issue if one tries to
load a model whose weights are in fp16, since it\u2019d require twice as much memory. To overcome this limitation, you can
either explicitly pass the desired `),ti=a(Do,"CODE",{});var e0=n(ti);C_=l(e0,"dtype"),e0.forEach(t),W_=l(Do," using "),oi=a(Do,"CODE",{});var t0=n(oi);G_=l(t0,"torch_dtype"),t0.forEach(t),z_=l(Do," argument:"),Do.forEach(t),Vc=d(o),p(zr.$$.fragment,o),Xc=d(o),we=a(o,"P",{});var hs=n(we);B_=l(hs,"or, if you want the model to always load in the most optimal memory pattern, you can use the special value "),ri=a(hs,"CODE",{});var o0=n(ri);D_=l(o0,'"auto"'),o0.forEach(t),R_=l(hs,`,
and then `),ai=a(hs,"CODE",{});var r0=n(ai);V_=l(r0,"dtype"),r0.forEach(t),X_=l(hs," will be automatically derived from the model\u2019s weights:"),hs.forEach(t),Nc=d(o),p(Br.$$.fragment,o),Yc=d(o),Rt=a(o,"P",{});var Bm=n(Rt);N_=l(Bm,"Models instantiated from scratch can also be told which "),ni=a(Bm,"CODE",{});var a0=n(ni);Y_=l(a0,"dtype"),a0.forEach(t),A_=l(Bm," to use with:"),Bm.forEach(t),Ac=d(o),p(Dr.$$.fragment,o),qc=d(o),Rn=a(o,"P",{});var n0=n(Rn);q_=l(n0,"Due to Pytorch design, this functionality is only available for floating dtypes."),n0.forEach(t),Lc=d(o),Ke=a(o,"H2",{class:!0});var Dm=n(Ke);Vt=a(Dm,"A",{id:!0,class:!0,href:!0});var s0=n(Vt);si=a(s0,"SPAN",{});var l0=n(si);p(Rr.$$.fragment,l0),l0.forEach(t),s0.forEach(t),L_=d(Dm),li=a(Dm,"SPAN",{});var i0=n(li);S_=l(i0,"ModuleUtilsMixin"),i0.forEach(t),Dm.forEach(t),Sc=d(o),C=a(o,"DIV",{class:!0});var G=n(C);p(Vr.$$.fragment,G),H_=d(G),Xr=a(G,"P",{});var Rm=n(Xr);Q_=l(Rm,"A few utilities for "),ii=a(Rm,"CODE",{});var d0=n(ii);O_=l(d0,"torch.nn.Modules"),d0.forEach(t),K_=l(Rm,", to be used as a mixin."),Rm.forEach(t),eb=d(G),Me=a(G,"DIV",{class:!0});var ps=n(Me);p(Nr.$$.fragment,ps),tb=d(ps),di=a(ps,"P",{});var c0=n(di);ob=l(c0,"Add a memory hook before and after each sub-module forward pass to record increase in memory consumption."),c0.forEach(t),rb=d(ps),et=a(ps,"P",{});var fs=n(et);ab=l(fs,"Increase in memory consumption is stored in a "),ci=a(fs,"CODE",{});var m0=n(ci);nb=l(m0,"mem_rss_diff"),m0.forEach(t),sb=l(fs,` attribute for each module and can be reset to zero
with `),mi=a(fs,"CODE",{});var h0=n(mi);lb=l(h0,"model.reset_memory_hooks_state()"),h0.forEach(t),ib=l(fs,"."),fs.forEach(t),ps.forEach(t),db=d(G),Xt=a(G,"DIV",{class:!0});var Vm=n(Xt);p(Yr.$$.fragment,Vm),cb=d(Vm),hi=a(Vm,"P",{});var p0=n(hi);mb=l(p0,"Helper function to estimate the total number of tokens from the model inputs."),p0.forEach(t),Vm.forEach(t),hb=d(G),Nt=a(G,"DIV",{class:!0});var Xm=n(Nt);p(Ar.$$.fragment,Xm),pb=d(Xm),tt=a(Xm,"P",{});var us=n(tt);fb=l(us,`Get number of (optionally, non-embeddings) floating-point operations for the forward and backward passes of a
batch with this transformer model. Default approximation neglects the quadratic dependency on the number of
tokens (valid if `),pi=a(us,"CODE",{});var f0=n(pi);ub=l(f0,"12 * d_model << sequence_length"),f0.forEach(t),gb=l(us,") as laid out in "),qr=a(us,"A",{href:!0,rel:!0});var u0=n(qr);_b=l(u0,`this
paper`),u0.forEach(t),bb=l(us,` section 2.1. Should be overridden for transformers with parameter
re-use e.g. Albert or Universal Transformers, or if doing long-range modeling with very high sequence lengths.`),us.forEach(t),Xm.forEach(t),vb=d(G),Yt=a(G,"DIV",{class:!0});var Nm=n(Yt);p(Lr.$$.fragment,Nm),yb=d(Nm),fi=a(Nm,"P",{});var g0=n(fi);wb=l(g0,"Makes broadcastable attention and causal masks so that future and masked tokens are ignored."),g0.forEach(t),Nm.forEach(t),Mb=d(G),At=a(G,"DIV",{class:!0});var Ym=n(At);p(Sr.$$.fragment,Ym),Tb=d(Ym),ui=a(Ym,"P",{});var _0=n(ui);$b=l(_0,"Prepare the head mask if needed."),_0.forEach(t),Ym.forEach(t),xb=d(G),qt=a(G,"DIV",{class:!0});var Am=n(qt);p(Hr.$$.fragment,Am),kb=d(Am),gi=a(Am,"P",{});var b0=n(gi);Eb=l(b0,"Invert an attention mask (e.g., switches 0. and 1.)."),b0.forEach(t),Am.forEach(t),Pb=d(G),Lt=a(G,"DIV",{class:!0});var qm=n(Lt);p(Qr.$$.fragment,qm),jb=d(qm),_i=a(qm,"P",{});var v0=n(_i);Ub=l(v0,"Get number of (optionally, trainable or non-embeddings) parameters in the module."),v0.forEach(t),qm.forEach(t),Jb=d(G),St=a(G,"DIV",{class:!0});var Lm=n(St);p(Or.$$.fragment,Lm),Fb=d(Lm),ot=a(Lm,"P",{});var gs=n(ot);Ib=l(gs,"Reset the "),bi=a(gs,"CODE",{});var y0=n(bi);Zb=l(y0,"mem_rss_diff"),y0.forEach(t),Cb=l(gs," attribute of each module (see "),Vn=a(gs,"A",{href:!0});var w0=n(Vn);Wb=l(w0,"add_memory_hooks()"),w0.forEach(t),Gb=l(gs,")."),gs.forEach(t),Lm.forEach(t),G.forEach(t),Hc=d(o),rt=a(o,"H2",{class:!0});var Sm=n(rt);Ht=a(Sm,"A",{id:!0,class:!0,href:!0});var M0=n(Ht);vi=a(M0,"SPAN",{});var T0=n(vi);p(Kr.$$.fragment,T0),T0.forEach(t),M0.forEach(t),zb=d(Sm),yi=a(Sm,"SPAN",{});var $0=n(yi);Bb=l($0,"TFPreTrainedModel"),$0.forEach(t),Sm.forEach(t),Qc=d(o),x=a(o,"DIV",{class:!0});var k=n(x);p(ea.$$.fragment,k),Db=d(k),wi=a(k,"P",{});var x0=n(wi);Rb=l(x0,"Base class for all TF models."),x0.forEach(t),Vb=d(k),Xn=a(k,"P",{});var iM=n(Xn);Nn=a(iM,"A",{href:!0});var k0=n(Nn);Xb=l(k0,"TFPreTrainedModel"),k0.forEach(t),Nb=l(iM,` takes care of storing the configuration of the models and handles methods for loading,
downloading and saving models as well as a few methods common to all models to:`),iM.forEach(t),Yb=d(k),ta=a(k,"UL",{});var Hm=n(ta);Mi=a(Hm,"LI",{});var E0=n(Mi);Ab=l(E0,"resize the input embeddings,"),E0.forEach(t),qb=d(Hm),Ti=a(Hm,"LI",{});var P0=n(Ti);Lb=l(P0,"prune heads in the self-attention heads."),P0.forEach(t),Hm.forEach(t),Sb=d(k),$i=a(k,"P",{});var j0=n($i);Hb=l(j0,"Class attributes (overridden by derived classes):"),j0.forEach(t),Qb=d(k),at=a(k,"UL",{});var _s=n(at);Te=a(_s,"LI",{});var bn=n(Te);xi=a(bn,"STRONG",{});var U0=n(xi);Ob=l(U0,"config_class"),U0.forEach(t),Kb=l(bn," ("),Yn=a(bn,"A",{href:!0});var J0=n(Yn);ev=l(J0,"PretrainedConfig"),J0.forEach(t),tv=l(bn,") \u2014 A subclass of "),An=a(bn,"A",{href:!0});var F0=n(An);ov=l(F0,"PretrainedConfig"),F0.forEach(t),rv=l(bn,` to use as configuration class
for this model architecture.`),bn.forEach(t),av=d(_s),Qt=a(_s,"LI",{});var bc=n(Qt);ki=a(bc,"STRONG",{});var I0=n(ki);nv=l(I0,"base_model_prefix"),I0.forEach(t),sv=l(bc," ("),Ei=a(bc,"CODE",{});var Z0=n(Ei);lv=l(Z0,"str"),Z0.forEach(t),iv=l(bc,`) \u2014 A string indicating the attribute associated to the base model in derived
classes of the same architecture adding modules on top of the base model.`),bc.forEach(t),dv=d(_s),R=a(_s,"LI",{});var de=n(R);Pi=a(de,"STRONG",{});var C0=n(Pi);cv=l(C0,"main_input_name"),C0.forEach(t),mv=l(de," ("),ji=a(de,"CODE",{});var W0=n(ji);hv=l(W0,"str"),W0.forEach(t),pv=l(de,") \u2014 The name of the principal input to the model (often "),Ui=a(de,"CODE",{});var G0=n(Ui);fv=l(G0,"input_ids"),G0.forEach(t),uv=l(de,` for NLP
models, `),Ji=a(de,"CODE",{});var z0=n(Ji);gv=l(z0,"pixel_values"),z0.forEach(t),_v=l(de," for vision models and "),Fi=a(de,"CODE",{});var B0=n(Fi);bv=l(B0,"input_values"),B0.forEach(t),vv=l(de," for speech models)."),de.forEach(t),_s.forEach(t),yv=d(k),$e=a(k,"DIV",{class:!0});var bs=n($e);p(oa.$$.fragment,bs),wv=d(bs),ra=a(bs,"P",{});var Qm=n(ra);Mv=l(Qm,"Upload the model files to the \u{1F917} Model Hub while synchronizing a local clone of the repo in "),Ii=a(Qm,"CODE",{});var D0=n(Ii);Tv=l(D0,"repo_path_or_name"),D0.forEach(t),$v=l(Qm,"."),Qm.forEach(t),xv=d(bs),p(Ot.$$.fragment,bs),bs.forEach(t),kv=d(k),Kt=a(k,"DIV",{class:!0});var Om=n(Kt);p(aa.$$.fragment,Om),Ev=d(Om),na=a(Om,"P",{});var Km=n(na);Pv=l(Km,"Returns whether this model can generate sequences with "),Zi=a(Km,"CODE",{});var R0=n(Zi);jv=l(R0,".generate()"),R0.forEach(t),Uv=l(Km,"."),Km.forEach(t),Om.forEach(t),Jv=d(k),eo=a(k,"DIV",{class:!0});var eh=n(eo);p(sa.$$.fragment,eh),Fv=d(eh),Ci=a(eh,"P",{});var V0=n(Ci);Iv=l(V0,`This is a thin wrapper that sets the model\u2019s loss output head as the loss if the user does not specify a loss
function themselves.`),V0.forEach(t),eh.forEach(t),Zv=d(k),to=a(k,"DIV",{class:!0});var th=n(to);p(la.$$.fragment,th),Cv=d(th),ia=a(th,"P",{});var oh=n(ia);Wv=l(oh,"Creates a draft of a model card using the information available to the "),Wi=a(oh,"CODE",{});var X0=n(Wi);Gv=l(X0,"Trainer"),X0.forEach(t),zv=l(oh,"."),oh.forEach(t),th.forEach(t),Bv=d(k),oo=a(k,"DIV",{class:!0});var rh=n(oo);p(da.$$.fragment,rh),Dv=d(rh),Gi=a(rh,"P",{});var N0=n(Gi);Rv=l(N0,"Method used for serving the model. This method is deprecated, and will be removed."),N0.forEach(t),rh.forEach(t),Vv=d(k),V=a(k,"DIV",{class:!0});var Ce=n(V);p(ca.$$.fragment,Ce),Xv=d(Ce),zi=a(Ce,"P",{});var Y0=n(zi);Nv=l(Y0,"Instantiate a pretrained TF 2.0 model from a pre-trained model configuration."),Y0.forEach(t),Yv=d(Ce),ma=a(Ce,"P",{});var ah=n(ma);Av=l(ah,"The warning "),Bi=a(ah,"EM",{});var A0=n(Bi);qv=l(A0,"Weights from XXX not initialized from pretrained model"),A0.forEach(t),Lv=l(ah,` means that the weights of XXX do not come
pretrained with the rest of the model. It is up to you to train those weights with a downstream fine-tuning
task.`),ah.forEach(t),Sv=d(Ce),ha=a(Ce,"P",{});var nh=n(ha);Hv=l(nh,"The warning "),Di=a(nh,"EM",{});var q0=n(Di);Qv=l(q0,"Weights from XXX not used in YYY"),q0.forEach(t),Ov=l(nh,` means that the layer XXX is not used by YYY, therefore those
weights are discarded.`),nh.forEach(t),Kv=d(Ce),p(ro.$$.fragment,Ce),Ce.forEach(t),ey=d(k),ao=a(k,"DIV",{class:!0});var sh=n(ao);p(pa.$$.fragment,sh),ty=d(sh),Ri=a(sh,"P",{});var L0=n(Ri);oy=l(L0,"Dict of bias attached to an LM head. The key represents the name of the bias attribute."),L0.forEach(t),sh.forEach(t),ry=d(k),no=a(k,"DIV",{class:!0});var lh=n(no);p(fa.$$.fragment,lh),ay=d(lh),Vi=a(lh,"P",{});var S0=n(Vi);ny=l(S0,"Prepare the head mask if needed."),S0.forEach(t),lh.forEach(t),sy=d(k),so=a(k,"DIV",{class:!0});var ih=n(so);p(ua.$$.fragment,ih),ly=d(ih),Xi=a(ih,"P",{});var H0=n(Xi);iy=l(H0,"Returns the model\u2019s input embeddings layer."),H0.forEach(t),ih.forEach(t),dy=d(k),lo=a(k,"DIV",{class:!0});var dh=n(lo);p(ga.$$.fragment,dh),cy=d(dh),Ni=a(dh,"P",{});var Q0=n(Ni);my=l(Q0,"The LM Head layer. This method must be overwritten by all the models that have a lm head."),Q0.forEach(t),dh.forEach(t),hy=d(k),io=a(k,"DIV",{class:!0});var ch=n(io);p(_a.$$.fragment,ch),py=d(ch),Yi=a(ch,"P",{});var O0=n(Yi);fy=l(O0,"Returns the model\u2019s output embeddings"),O0.forEach(t),ch.forEach(t),uy=d(k),co=a(k,"DIV",{class:!0});var mh=n(co);p(ba.$$.fragment,mh),gy=d(mh),Ai=a(mh,"P",{});var K0=n(Ai);_y=l(K0,`Get the layer that handles a bias attribute in case the model has an LM head with weights tied to the
embeddings`),K0.forEach(t),mh.forEach(t),by=d(k),mo=a(k,"DIV",{class:!0});var hh=n(mo);p(va.$$.fragment,hh),vy=d(hh),qi=a(hh,"P",{});var e$=n(qi);yy=l(e$,"Get the concatenated _prefix name of the bias from the model name to the parent layer"),e$.forEach(t),hh.forEach(t),wy=d(k),ho=a(k,"DIV",{class:!0});var ph=n(ho);p(ya.$$.fragment,ph),My=d(ph),Li=a(ph,"P",{});var t$=n(Li);Ty=l(t$,`Loads a saved checkpoint (model weights and optimizer state) from a repo. Returns the current epoch count when
the checkpoint was made.`),t$.forEach(t),ph.forEach(t),$y=d(k),po=a(k,"DIV",{class:!0});var fh=n(po);p(wa.$$.fragment,fh),xy=d(fh),q=a(fh,"P",{});var We=n(q);ky=l(We,"Wraps a HuggingFace "),Ma=a(We,"A",{href:!0,rel:!0});var o$=n(Ma);Ey=l(o$,"Dataset"),o$.forEach(t),Py=l(We," as a "),Si=a(We,"CODE",{});var r$=n(Si);jy=l(r$,"tf.data.Dataset"),r$.forEach(t),Uy=l(We,` with collation and batching. This method is
designed to create a \u201Cready-to-use\u201D dataset that can be passed directly to Keras methods like `),Hi=a(We,"CODE",{});var a$=n(Hi);Jy=l(a$,"fit()"),a$.forEach(t),Fy=l(We,` without
further modification. The method will drop columns from the dataset if they don\u2019t match input names for the
model. If you want to specify the column names to return rather than using the names that match this model, we
recommend using `),Qi=a(We,"CODE",{});var n$=n(Qi);Iy=l(n$,"Dataset.to_tf_dataset()"),n$.forEach(t),Zy=l(We," instead."),We.forEach(t),fh.forEach(t),Cy=d(k),fo=a(k,"DIV",{class:!0});var uh=n(fo);p(Ta.$$.fragment,uh),Wy=d(uh),Oi=a(uh,"P",{});var s$=n(Oi);Gy=l(s$,"Prunes heads of the base model."),s$.forEach(t),uh.forEach(t),zy=d(k),xe=a(k,"DIV",{class:!0});var vs=n(xe);p($a.$$.fragment,vs),By=d(vs),Ki=a(vs,"P",{});var l$=n(Ki);Dy=l(l$,`Register this class with a given auto class. This should only be used for custom models as the ones in the
library are already mapped with an auto class.`),l$.forEach(t),Ry=d(vs),p(uo.$$.fragment,vs),vs.forEach(t),Vy=d(k),ke=a(k,"DIV",{class:!0});var ys=n(ke);p(xa.$$.fragment,ys),Xy=d(ys),ka=a(ys,"P",{});var gh=n(ka);Ny=l(gh,"Resizes input token embeddings matrix of the model if "),ed=a(gh,"CODE",{});var i$=n(ed);Yy=l(i$,"new_num_tokens != config.vocab_size"),i$.forEach(t),Ay=l(gh,"."),gh.forEach(t),qy=d(ys),Ea=a(ys,"P",{});var _h=n(Ea);Ly=l(_h,"Takes care of tying weights embeddings afterwards if the model class has a "),td=a(_h,"CODE",{});var d$=n(td);Sy=l(d$,"tie_weights()"),d$.forEach(t),Hy=l(_h," method."),_h.forEach(t),ys.forEach(t),Qy=d(k),go=a(k,"DIV",{class:!0});var bh=n(go);p(Pa.$$.fragment,bh),Oy=d(bh),ja=a(bh,"P",{});var vh=n(ja);Ky=l(vh,`Save a model and its configuration file to a directory, so that it can be re-loaded using the
`),qn=a(vh,"A",{href:!0});var c$=n(qn);e1=l(c$,"from_pretrained()"),c$.forEach(t),t1=l(vh," class method."),vh.forEach(t),bh.forEach(t),o1=d(k),Ln=a(k,"DIV",{class:!0});var m$=n(Ln);p(Ua.$$.fragment,m$),m$.forEach(t),r1=d(k),_o=a(k,"DIV",{class:!0});var yh=n(_o);p(Ja.$$.fragment,yh),a1=d(yh),od=a(yh,"P",{});var h$=n(od);n1=l(h$,"Prepare the output of the saved model. Can be overridden if specific serving modifications are required."),h$.forEach(t),yh.forEach(t),s1=d(k),bo=a(k,"DIV",{class:!0});var wh=n(bo);p(Fa.$$.fragment,wh),l1=d(wh),rd=a(wh,"P",{});var p$=n(rd);i1=l(p$,"Set all the bias in the LM head."),p$.forEach(t),wh.forEach(t),d1=d(k),vo=a(k,"DIV",{class:!0});var Mh=n(vo);p(Ia.$$.fragment,Mh),c1=d(Mh),ad=a(Mh,"P",{});var f$=n(ad);m1=l(f$,"Set model\u2019s input embeddings"),f$.forEach(t),Mh.forEach(t),h1=d(k),yo=a(k,"DIV",{class:!0});var Th=n(yo);p(Za.$$.fragment,Th),p1=d(Th),nd=a(Th,"P",{});var u$=n(nd);f1=l(u$,"Set model\u2019s output embeddings"),u$.forEach(t),Th.forEach(t),u1=d(k),wo=a(k,"DIV",{class:!0});var $h=n(wo);p(Ca.$$.fragment,$h),g1=d($h),Wa=a($h,"P",{});var xh=n(Wa);_1=l(xh,"A modification of Keras\u2019s default "),sd=a(xh,"CODE",{});var g$=n(sd);b1=l(g$,"train_step"),g$.forEach(t),v1=l(xh,` that correctly handles matching outputs to labels for our models
and supports directly training on the loss output head. In addition, it ensures input keys are copied to the
labels where appropriate. It will also copy label keys into the input dict when using the dummy loss, to ensure
that they are available to the model during the forward pass.`),xh.forEach(t),$h.forEach(t),y1=d(k),Mo=a(k,"DIV",{class:!0});var kh=n(Mo);p(Ga.$$.fragment,kh),w1=d(kh),za=a(kh,"P",{});var Eh=n(za);M1=l(Eh,"A modification of Keras\u2019s default "),ld=a(Eh,"CODE",{});var _$=n(ld);T1=l(_$,"train_step"),_$.forEach(t),$1=l(Eh,` that correctly handles matching outputs to labels for our models
and supports directly training on the loss output head. In addition, it ensures input keys are copied to the
labels where appropriate. It will also copy label keys into the input dict when using the dummy loss, to ensure
that they are available to the model during the forward pass.`),Eh.forEach(t),kh.forEach(t),k.forEach(t),Oc=d(o),nt=a(o,"H2",{class:!0});var Ph=n(nt);To=a(Ph,"A",{id:!0,class:!0,href:!0});var b$=n(To);id=a(b$,"SPAN",{});var v$=n(id);p(Ba.$$.fragment,v$),v$.forEach(t),b$.forEach(t),x1=d(Ph),dd=a(Ph,"SPAN",{});var y$=n(dd);k1=l(y$,"TFModelUtilsMixin"),y$.forEach(t),Ph.forEach(t),Kc=d(o),re=a(o,"DIV",{class:!0});var ws=n(re);p(Da.$$.fragment,ws),E1=d(ws),Ra=a(ws,"P",{});var jh=n(Ra);P1=l(jh,"A few utilities for "),cd=a(jh,"CODE",{});var w$=n(cd);j1=l(w$,"tf.keras.Model"),w$.forEach(t),U1=l(jh,", to be used as a mixin."),jh.forEach(t),J1=d(ws),$o=a(ws,"DIV",{class:!0});var Uh=n($o);p(Va.$$.fragment,Uh),F1=d(Uh),md=a(Uh,"P",{});var M$=n(md);I1=l(M$,"Get the number of (optionally, trainable) parameters in the model."),M$.forEach(t),Uh.forEach(t),ws.forEach(t),em=d(o),st=a(o,"H2",{class:!0});var Jh=n(st);xo=a(Jh,"A",{id:!0,class:!0,href:!0});var T$=n(xo);hd=a(T$,"SPAN",{});var $$=n(hd);p(Xa.$$.fragment,$$),$$.forEach(t),T$.forEach(t),Z1=d(Jh),pd=a(Jh,"SPAN",{});var x$=n(pd);C1=l(x$,"FlaxPreTrainedModel"),x$.forEach(t),Jh.forEach(t),tm=d(o),J=a(o,"DIV",{class:!0});var Z=n(J);p(Na.$$.fragment,Z),W1=d(Z),fd=a(Z,"P",{});var k$=n(fd);G1=l(k$,"Base class for all models."),k$.forEach(t),z1=d(Z),Sn=a(Z,"P",{});var dM=n(Sn);Hn=a(dM,"A",{href:!0});var E$=n(Hn);B1=l(E$,"FlaxPreTrainedModel"),E$.forEach(t),D1=l(dM,` takes care of storing the configuration of the models and handles methods for loading,
downloading and saving models.`),dM.forEach(t),R1=d(Z),ud=a(Z,"P",{});var P$=n(ud);V1=l(P$,"Class attributes (overridden by derived classes):"),P$.forEach(t),X1=d(Z),lt=a(Z,"UL",{});var Ms=n(lt);Ee=a(Ms,"LI",{});var vn=n(Ee);gd=a(vn,"STRONG",{});var j$=n(gd);N1=l(j$,"config_class"),j$.forEach(t),Y1=l(vn," ("),Qn=a(vn,"A",{href:!0});var U$=n(Qn);A1=l(U$,"PretrainedConfig"),U$.forEach(t),q1=l(vn,") \u2014 A subclass of "),On=a(vn,"A",{href:!0});var J$=n(On);L1=l(J$,"PretrainedConfig"),J$.forEach(t),S1=l(vn,` to use as configuration class
for this model architecture.`),vn.forEach(t),H1=d(Ms),ko=a(Ms,"LI",{});var vc=n(ko);_d=a(vc,"STRONG",{});var F$=n(_d);Q1=l(F$,"base_model_prefix"),F$.forEach(t),O1=l(vc," ("),bd=a(vc,"CODE",{});var I$=n(bd);K1=l(I$,"str"),I$.forEach(t),ew=l(vc,`) \u2014 A string indicating the attribute associated to the base model in derived
classes of the same architecture adding modules on top of the base model.`),vc.forEach(t),tw=d(Ms),X=a(Ms,"LI",{});var ce=n(X);vd=a(ce,"STRONG",{});var Z$=n(vd);ow=l(Z$,"main_input_name"),Z$.forEach(t),rw=l(ce," ("),yd=a(ce,"CODE",{});var C$=n(yd);aw=l(C$,"str"),C$.forEach(t),nw=l(ce,") \u2014 The name of the principal input to the model (often "),wd=a(ce,"CODE",{});var W$=n(wd);sw=l(W$,"input_ids"),W$.forEach(t),lw=l(ce,` for NLP
models, `),Md=a(ce,"CODE",{});var G$=n(Md);iw=l(G$,"pixel_values"),G$.forEach(t),dw=l(ce," for vision models and "),Td=a(ce,"CODE",{});var z$=n(Td);cw=l(z$,"input_values"),z$.forEach(t),mw=l(ce," for speech models)."),ce.forEach(t),Ms.forEach(t),hw=d(Z),Pe=a(Z,"DIV",{class:!0});var Ts=n(Pe);p(Ya.$$.fragment,Ts),pw=d(Ts),Aa=a(Ts,"P",{});var Fh=n(Aa);fw=l(Fh,`Upload the model checkpoint to the \u{1F917} Model Hub while synchronizing a local clone of the repo in
`),$d=a(Fh,"CODE",{});var B$=n($d);uw=l(B$,"repo_path_or_name"),B$.forEach(t),gw=l(Fh,"."),Fh.forEach(t),_w=d(Ts),p(Eo.$$.fragment,Ts),Ts.forEach(t),bw=d(Z),Po=a(Z,"DIV",{class:!0});var Ih=n(Po);p(qa.$$.fragment,Ih),vw=d(Ih),ae=a(Ih,"P",{});var Ro=n(ae);yw=l(Ro,"Returns whether this model can generate sequences with "),xd=a(Ro,"CODE",{});var D$=n(xd);ww=l(D$,".generate()"),D$.forEach(t),Mw=l(Ro,`. Returns:
`),kd=a(Ro,"CODE",{});var R$=n(kd);Tw=l(R$,"bool"),R$.forEach(t),$w=l(Ro,": Whether this model can generate sequences with "),Ed=a(Ro,"CODE",{});var V$=n(Ed);xw=l(V$,".generate()"),V$.forEach(t),kw=l(Ro,"."),Ro.forEach(t),Ih.forEach(t),Ew=d(Z),N=a(Z,"DIV",{class:!0});var Ge=n(N);p(La.$$.fragment,Ge),Pw=d(Ge),Pd=a(Ge,"P",{});var X$=n(Pd);jw=l(X$,"Instantiate a pretrained flax model from a pre-trained model configuration."),X$.forEach(t),Uw=d(Ge),Sa=a(Ge,"P",{});var Zh=n(Sa);Jw=l(Zh,"The warning "),jd=a(Zh,"EM",{});var N$=n(jd);Fw=l(N$,"Weights from XXX not initialized from pretrained model"),N$.forEach(t),Iw=l(Zh,` means that the weights of XXX do not come
pretrained with the rest of the model. It is up to you to train those weights with a downstream fine-tuning
task.`),Zh.forEach(t),Zw=d(Ge),Ha=a(Ge,"P",{});var Ch=n(Ha);Cw=l(Ch,"The warning "),Ud=a(Ch,"EM",{});var Y$=n(Ud);Ww=l(Y$,"Weights from XXX not used in YYY"),Y$.forEach(t),Gw=l(Ch,` means that the layer XXX is not used by YYY, therefore those
weights are discarded.`),Ch.forEach(t),zw=d(Ge),p(jo.$$.fragment,Ge),Ge.forEach(t),Bw=d(Z),je=a(Z,"DIV",{class:!0});var $s=n(je);p(Qa.$$.fragment,$s),Dw=d($s),Oa=a($s,"P",{});var Wh=n(Oa);Rw=l(Wh,"This is the same as "),Jd=a(Wh,"CODE",{});var A$=n(Jd);Vw=l(A$,"flax.serialization.from_bytes"),A$.forEach(t),Xw=l(Wh,`
(https:lax.readthedocs.io/en/latest/_modules/flax/serialization.html#from_bytes) but for a sharded checkpoint.`),Wh.forEach(t),Nw=d($s),Fd=a($s,"P",{});var q$=n(Fd);Yw=l(q$,`This load is performed efficiently: each checkpoint shard is loaded one by one in RAM and deleted after being
loaded in the model.`),q$.forEach(t),$s.forEach(t),Aw=d(Z),Ue=a(Z,"DIV",{class:!0});var xs=n(Ue);p(Ka.$$.fragment,xs),qw=d(xs),Id=a(xs,"P",{});var L$=n(Id);Lw=l(L$,`Register this class with a given auto class. This should only be used for custom models as the ones in the
library are already mapped with an auto class.`),L$.forEach(t),Sw=d(xs),p(Uo.$$.fragment,xs),xs.forEach(t),Hw=d(Z),Jo=a(Z,"DIV",{class:!0});var Gh=n(Jo);p(en.$$.fragment,Gh),Qw=d(Gh),tn=a(Gh,"P",{});var zh=n(tn);Ow=l(zh,`Save a model and its configuration file to a directory, so that it can be re-loaded using the
`),Zd=a(zh,"CODE",{});var S$=n(Zd);Kw=l(S$,"[from_pretrained()](/docs/transformers/v4.31.0/en/main_classes/model#transformers.FlaxPreTrainedModel.from_pretrained)"),S$.forEach(t),e2=l(zh," class method"),zh.forEach(t),Gh.forEach(t),t2=d(Z),ee=a(Z,"DIV",{class:!0});var Vo=n(ee);p(on.$$.fragment,Vo),o2=d(Vo),L=a(Vo,"P",{});var ze=n(L);r2=l(ze,"Cast the floating-point "),Cd=a(ze,"CODE",{});var H$=n(Cd);a2=l(H$,"params"),H$.forEach(t),n2=l(ze," to "),Wd=a(ze,"CODE",{});var Q$=n(Wd);s2=l(Q$,"jax.numpy.bfloat16"),Q$.forEach(t),l2=l(ze,". This returns a new "),Gd=a(ze,"CODE",{});var O$=n(Gd);i2=l(O$,"params"),O$.forEach(t),d2=l(ze,` tree and does not cast
the `),zd=a(ze,"CODE",{});var K$=n(zd);c2=l(K$,"params"),K$.forEach(t),m2=l(ze," in place."),ze.forEach(t),h2=d(Vo),Bd=a(Vo,"P",{});var ex=n(Bd);p2=l(ex,`This method can be used on 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.`),ex.forEach(t),f2=d(Vo),p(Fo.$$.fragment,Vo),Vo.forEach(t),u2=d(Z),te=a(Z,"DIV",{class:!0});var Xo=n(te);p(rn.$$.fragment,Xo),g2=d(Xo),S=a(Xo,"P",{});var Be=n(S);_2=l(Be,"Cast the floating-point "),Dd=a(Be,"CODE",{});var tx=n(Dd);b2=l(tx,"parmas"),tx.forEach(t),v2=l(Be," to "),Rd=a(Be,"CODE",{});var ox=n(Rd);y2=l(ox,"jax.numpy.float16"),ox.forEach(t),w2=l(Be,". This returns a new "),Vd=a(Be,"CODE",{});var rx=n(Vd);M2=l(rx,"params"),rx.forEach(t),T2=l(Be,` tree and does not cast the
`),Xd=a(Be,"CODE",{});var ax=n(Xd);$2=l(ax,"params"),ax.forEach(t),x2=l(Be," in place."),Be.forEach(t),k2=d(Xo),Nd=a(Xo,"P",{});var nx=n(Nd);E2=l(nx,`This method can be used on 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.`),nx.forEach(t),P2=d(Xo),p(Io.$$.fragment,Xo),Xo.forEach(t),j2=d(Z),Je=a(Z,"DIV",{class:!0});var ks=n(Je);p(an.$$.fragment,ks),U2=d(ks),H=a(ks,"P",{});var De=n(H);J2=l(De,"Cast the floating-point "),Yd=a(De,"CODE",{});var sx=n(Yd);F2=l(sx,"parmas"),sx.forEach(t),I2=l(De," to "),Ad=a(De,"CODE",{});var lx=n(Ad);Z2=l(lx,"jax.numpy.float32"),lx.forEach(t),C2=l(De,`. This method can be used to explicitly convert the
model parameters to fp32 precision. This returns a new `),qd=a(De,"CODE",{});var ix=n(qd);W2=l(ix,"params"),ix.forEach(t),G2=l(De," tree and does not cast the "),Ld=a(De,"CODE",{});var dx=n(Ld);z2=l(dx,"params"),dx.forEach(t),B2=l(De," in place."),De.forEach(t),D2=d(ks),p(Zo.$$.fragment,ks),ks.forEach(t),Z.forEach(t),om=d(o),it=a(o,"H2",{class:!0});var Bh=n(it);Co=a(Bh,"A",{id:!0,class:!0,href:!0});var cx=n(Co);Sd=a(cx,"SPAN",{});var mx=n(Sd);p(nn.$$.fragment,mx),mx.forEach(t),cx.forEach(t),R2=d(Bh),Hd=a(Bh,"SPAN",{});var hx=n(Hd);V2=l(hx,"Pushing to the Hub"),hx.forEach(t),Bh.forEach(t),rm=d(o),ne=a(o,"DIV",{class:!0});var Es=n(ne);p(sn.$$.fragment,Es),X2=d(Es),Qd=a(Es,"P",{});var px=n(Qd);N2=l(px,"A Mixin containing the functionality to push a model or tokenizer to the hub."),px.forEach(t),Y2=d(Es),Fe=a(Es,"DIV",{class:!0});var Ps=n(Fe);p(ln.$$.fragment,Ps),A2=d(Ps),dn=a(Ps,"P",{});var Dh=n(dn);q2=l(Dh,`Upload the {object_files} to the \u{1F917} Model Hub while synchronizing a local clone of the repo in
`),Od=a(Dh,"CODE",{});var fx=n(Od);L2=l(fx,"repo_path_or_name"),fx.forEach(t),S2=l(Dh,"."),Dh.forEach(t),H2=d(Ps),p(Wo.$$.fragment,Ps),Ps.forEach(t),Es.forEach(t),am=d(o),dt=a(o,"H2",{class:!0});var Rh=n(dt);Go=a(Rh,"A",{id:!0,class:!0,href:!0});var ux=n(Go);Kd=a(ux,"SPAN",{});var gx=n(Kd);p(cn.$$.fragment,gx),gx.forEach(t),ux.forEach(t),Q2=d(Rh),ec=a(Rh,"SPAN",{});var _x=n(ec);O2=l(_x,"Sharded checkpoints"),_x.forEach(t),Rh.forEach(t),nm=d(o),se=a(o,"DIV",{class:!0});var js=n(se);p(mn.$$.fragment,js),K2=d(js),hn=a(js,"P",{});var Vh=n(hn);eM=l(Vh,`This is the same as
`),pn=a(Vh,"A",{href:!0,rel:!0});var bx=n(pn);tc=a(bx,"CODE",{});var vx=n(tc);tM=l(vx,"torch.nn.Module.load_state_dict"),vx.forEach(t),bx.forEach(t),oM=l(Vh,`
but for a sharded checkpoint.`),Vh.forEach(t),rM=d(js),oc=a(js,"P",{});var yx=n(oc);aM=l(yx,`This load is performed efficiently: each checkpoint shard is loaded one by one in RAM and deleted after being
loaded in the model.`),yx.forEach(t),js.forEach(t),this.h()},h(){m(v,"name","hf:doc:metadata"),m(v,"content",JSON.stringify(Rx)),m(y,"id","models"),m(y,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(y,"href","#models"),m(M,"class","relative group"),m(yn,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel"),m(wn,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.TFPreTrainedModel"),m(Mn,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.FlaxPreTrainedModel"),m(Tn,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel"),m($n,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.TFPreTrainedModel"),m(xn,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.modeling_utils.ModuleUtilsMixin"),m(kn,"href","/docs/transformers/v4.31.0/en/main_classes/text_generation#transformers.GenerationMixin"),m(En,"href","/docs/transformers/v4.31.0/en/main_classes/text_generation#transformers.TFGenerationMixin"),m(Pn,"href","/docs/transformers/v4.31.0/en/main_classes/text_generation#transformers.FlaxGenerationMixin"),m(ht,"id","transformers.PreTrainedModel"),m(ht,"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"),m(ht,"href","#transformers.PreTrainedModel"),m(Ye,"class","relative group"),m(Un,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel"),m(Jn,"href","/docs/transformers/v4.31.0/en/main_classes/configuration#transformers.PretrainedConfig"),m(Fn,"href","/docs/transformers/v4.31.0/en/main_classes/configuration#transformers.PretrainedConfig"),m(In,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel"),m(pe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(vt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(yt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(wt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(I,"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,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(sr,"href","https://discuss.pytorch.org/t/gpu-memory-that-model-uses/56822/2"),m(sr,"rel","nofollow"),m(xt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(kt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(fe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(ue,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Et,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Pt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(jt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(ge,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(_e,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Wn,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel.to_bettertransformer"),m(Jt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Gn,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained"),m(Ft,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(It,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(be,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(xr,"href","https://pytorch.org/docs/stable/generated/torch.nn.MultiheadAttention.html"),m(xr,"rel","nofollow"),m(kr,"href","https://huggingface.co/docs/optimum/bettertransformer/overview"),m(kr,"rel","nofollow"),m(Er,"href","https://pytorch.org/docs/stable/nested.html"),m(Er,"rel","nofollow"),m(Pr,"href","https://medium.com/pytorch/bettertransformer-out-of-the-box-performance-for-huggingface-transformers-3fbe27d50ab2"),m(Pr,"rel","nofollow"),m(ve,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Zt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(zn,"id","from_pretrained-torch-dtype"),m(Ct,"id","large-model-loading"),m(Ct,"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"),m(Ct,"href","#large-model-loading"),m(Qe,"class","relative group"),m(Bn,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained"),m(Jr,"href","https://huggingface.co/docs/accelerate/big_modeling"),m(Jr,"rel","nofollow"),m(Dt,"id","model-instantiation-dtype"),m(Dt,"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"),m(Dt,"href","#model-instantiation-dtype"),m(Oe,"class","relative group"),m(Vt,"id","transformers.modeling_utils.ModuleUtilsMixin"),m(Vt,"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"),m(Vt,"href","#transformers.modeling_utils.ModuleUtilsMixin"),m(Ke,"class","relative group"),m(Me,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Xt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(qr,"href","https://arxiv.org/pdf/2001.08361.pdf"),m(qr,"rel","nofollow"),m(Nt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Yt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(At,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(qt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Lt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Vn,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.modeling_utils.ModuleUtilsMixin.add_memory_hooks"),m(St,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Ht,"id","transformers.TFPreTrainedModel"),m(Ht,"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"),m(Ht,"href","#transformers.TFPreTrainedModel"),m(rt,"class","relative group"),m(Nn,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.TFPreTrainedModel"),m(Yn,"href","/docs/transformers/v4.31.0/en/main_classes/configuration#transformers.PretrainedConfig"),m(An,"href","/docs/transformers/v4.31.0/en/main_classes/configuration#transformers.PretrainedConfig"),m($e,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Kt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(eo,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(to,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(oo,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(ao,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(no,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(so,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(lo,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(io,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(co,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(mo,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(ho,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Ma,"href","https://huggingface.co/docs/datasets/v2.13.1/en/package_reference/main_classes#datasets.Dataset"),m(Ma,"rel","nofollow"),m(po,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(fo,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(xe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(ke,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(qn,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.TFPreTrainedModel.from_pretrained"),m(go,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Ln,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(_o,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(bo,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(vo,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(yo,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(wo,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Mo,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(To,"id","transformers.modeling_tf_utils.TFModelUtilsMixin"),m(To,"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"),m(To,"href","#transformers.modeling_tf_utils.TFModelUtilsMixin"),m(nt,"class","relative group"),m($o,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(re,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(xo,"id","transformers.FlaxPreTrainedModel"),m(xo,"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"),m(xo,"href","#transformers.FlaxPreTrainedModel"),m(st,"class","relative group"),m(Hn,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.FlaxPreTrainedModel"),m(Qn,"href","/docs/transformers/v4.31.0/en/main_classes/configuration#transformers.PretrainedConfig"),m(On,"href","/docs/transformers/v4.31.0/en/main_classes/configuration#transformers.PretrainedConfig"),m(Pe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Po,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(je,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Ue,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Jo,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(ee,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(te,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Je,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Co,"id","transformers.utils.PushToHubMixin"),m(Co,"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"),m(Co,"href","#transformers.utils.PushToHubMixin"),m(it,"class","relative group"),m(Fe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(ne,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Go,"id","transformers.modeling_utils.load_sharded_checkpoint"),m(Go,"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"),m(Go,"href","#transformers.modeling_utils.load_sharded_checkpoint"),m(dt,"class","relative group"),m(pn,"href","https://pytorch.org/docs/stable/generated/torch.nn.Module.html?highlight=load_state_dict#torch.nn.Module.load_state_dict"),m(pn,"rel","nofollow"),m(se,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(o,b){e(document.head,v),w(o,E,b),w(o,M,b),e(M,y),e(y,P),f(c,P,null),e(M,T),e(M,ct),e(ct,Nh),w(o,yc,b),w(o,Q,b),e(Q,Yh),e(Q,yn),e(yn,Ah),e(Q,qh),e(Q,wn),e(wn,Lh),e(Q,Sh),e(Q,Mn),e(Mn,Hh),e(Q,Qh),w(o,wc,b),w(o,Ne,b),e(Ne,Tn),e(Tn,Oh),e(Ne,Kh),e(Ne,$n),e($n,ep),e(Ne,tp),w(o,Mc,b),w(o,mt,b),e(mt,Us),e(Us,op),e(mt,rp),e(mt,Js),e(Js,ap),w(o,Tc,b),w(o,B,b),e(B,np),e(B,xn),e(xn,sp),e(B,lp),e(B,Fs),e(Fs,ip),e(B,dp),e(B,kn),e(kn,cp),e(B,mp),e(B,En),e(En,hp),e(B,pp),e(B,Pn),e(Pn,fp),e(B,up),w(o,$c,b),w(o,Ye,b),e(Ye,ht),e(ht,Is),f(No,Is,null),e(Ye,gp),e(Ye,Zs),e(Zs,_p),w(o,xc,b),w(o,j,b),f(Yo,j,null),e(j,bp),e(j,Cs),e(Cs,vp),e(j,yp),e(j,jn),e(jn,Un),e(Un,wp),e(jn,Mp),e(j,Tp),e(j,Ao),e(Ao,Ws),e(Ws,$p),e(Ao,xp),e(Ao,Gs),e(Gs,kp),e(j,Ep),e(j,zs),e(zs,Pp),e(j,jp),e(j,Y),e(Y,Bs),e(Bs,me),e(me,Ds),e(Ds,Up),e(me,Jp),e(me,Jn),e(Jn,Fp),e(me,Ip),e(me,Fn),e(Fn,Zp),e(me,Cp),e(Y,Wp),e(Y,qo),e(qo,he),e(he,Rs),e(Rs,Gp),e(he,zp),e(he,Vs),e(Vs,Bp),e(he,Dp),e(he,Xs),e(Xs,Rp),e(he,Vp),e(qo,Xp),e(qo,Ae),e(Ae,pt),e(pt,Ns),e(Ns,Np),e(pt,Yp),e(pt,In),e(In,Ap),e(pt,qp),e(Ae,Lp),e(Ae,ft),e(ft,Ys),e(Ys,Sp),e(ft,Hp),e(ft,As),e(As,Qp),e(ft,Op),e(Ae,Kp),e(Ae,ut),e(ut,qs),e(qs,ef),e(ut,tf),e(ut,Ls),e(Ls,of),e(ut,rf),e(Y,af),e(Y,Ss),e(Ss,gt),e(gt,Hs),e(Hs,nf),e(gt,sf),e(gt,Qs),e(Qs,lf),e(gt,df),e(Y,cf),e(Y,Os),e(Os,_t),e(_t,Ks),e(Ks,mf),e(_t,hf),e(_t,el),e(el,pf),e(_t,ff),e(Y,uf),e(Y,tl),e(tl,D),e(D,ol),e(ol,gf),e(D,_f),e(D,rl),e(rl,bf),e(D,vf),e(D,al),e(al,yf),e(D,wf),e(D,nl),e(nl,Mf),e(D,Tf),e(D,sl),e(sl,$f),e(D,xf),e(j,kf),e(j,pe),f(Lo,pe,null),e(pe,Ef),e(pe,So),e(So,Pf),e(So,ll),e(ll,jf),e(So,Uf),e(pe,Jf),f(bt,pe,null),e(j,Ff),e(j,vt),f(Ho,vt,null),e(vt,If),e(vt,Qo),e(Qo,Zf),e(Qo,il),e(il,Cf),e(Qo,Wf),e(j,Gf),e(j,yt),f(Oo,yt,null),e(yt,zf),e(yt,Ko),e(Ko,Bf),e(Ko,dl),e(dl,Df),e(Ko,Rf),e(j,Vf),e(j,wt),f(er,wt,null),e(wt,Xf),e(wt,cl),e(cl,Nf),e(j,Yf),e(j,I),f(tr,I,null),e(I,Af),e(I,ml),e(ml,qf),e(I,Lf),e(I,qe),e(qe,Sf),e(qe,hl),e(hl,Hf),e(qe,Qf),e(qe,pl),e(pl,Of),e(qe,Kf),e(I,eu),e(I,or),e(or,tu),e(or,fl),e(fl,ou),e(or,ru),e(I,au),e(I,rr),e(rr,nu),e(rr,ul),e(ul,su),e(rr,lu),e(I,iu),f(Mt,I,null),e(I,du),f(Tt,I,null),e(I,cu),e(I,gl),e(gl,Zn),e(Zn,_l),e(_l,mu),e(Zn,hu),e(I,pu),e(I,bl),e(bl,fu),e(I,uu),e(I,vl),e(vl,gu),e(I,_u),e(I,A),e(A,yl),e(yl,bu),e(A,vu),e(A,wl),e(wl,yu),e(A,wu),e(A,Ml),e(Ml,Mu),e(A,Tu),e(A,Tl),e(Tl,$u),e(A,xu),e(A,$l),e($l,ku),e(I,Eu),e(I,xl),e(xl,Pu),e(j,ju),e(j,$t),f(ar,$t,null),e($t,Uu),e($t,kl),e(kl,Ju),e(j,Fu),e(j,xt),f(nr,xt,null),e(xt,Iu),e(xt,Cn),e(Cn,Zu),e(Cn,sr),e(sr,Cu),e(j,Wu),e(j,kt),f(lr,kt,null),e(kt,Gu),e(kt,El),e(El,zu),e(j,Bu),e(j,fe),f(ir,fe,null),e(fe,Du),e(fe,Pl),e(Pl,Ru),e(fe,Vu),e(fe,jl),e(jl,Xu),e(j,Nu),e(j,ue),f(dr,ue,null),e(ue,Yu),e(ue,Ul),e(Ul,Au),e(ue,qu),e(ue,Jl),e(Jl,Lu),e(j,Su),e(j,Et),f(cr,Et,null),e(Et,Hu),e(Et,Le),e(Le,Qu),e(Le,Fl),e(Fl,Ou),e(Le,Ku),e(Le,Il),e(Il,eg),e(Le,tg),e(j,og),e(j,Pt),f(mr,Pt,null),e(Pt,rg),e(Pt,Zl),e(Zl,ag),e(j,ng),e(j,jt),f(hr,jt,null),e(jt,sg),e(jt,Cl),e(Cl,lg),e(j,ig),e(j,ge),f(pr,ge,null),e(ge,dg),e(ge,Wl),e(Wl,cg),e(ge,mg),f(Ut,ge,null),e(j,hg),e(j,_e),f(fr,_e,null),e(_e,pg),e(_e,ur),e(ur,fg),e(ur,Gl),e(Gl,ug),e(ur,gg),e(_e,_g),e(_e,gr),e(gr,bg),e(gr,zl),e(zl,vg),e(gr,yg),e(j,wg),e(j,Jt),f(_r,Jt,null),e(Jt,Mg),e(Jt,br),e(br,Tg),e(br,Wn),e(Wn,$g),e(br,xg),e(j,kg),e(j,Ft),f(vr,Ft,null),e(Ft,Eg),e(Ft,yr),e(yr,Pg),e(yr,Gn),e(Gn,jg),e(yr,Ug),e(j,Jg),e(j,It),f(wr,It,null),e(It,Fg),e(It,Bl),e(Bl,Ig),e(j,Zg),e(j,be),f(Mr,be,null),e(be,Cg),e(be,Dl),e(Dl,Wg),e(be,Gg),e(be,Tr),e(Tr,zg),e(Tr,Rl),e(Rl,Bg),e(Tr,Dg),e(j,Rg),e(j,ve),f($r,ve,null),e(ve,Vg),e(ve,Se),e(Se,Xg),e(Se,xr),e(xr,Ng),e(Se,Yg),e(Se,kr),e(kr,Ag),e(Se,qg),e(ve,Lg),e(ve,He),e(He,Sg),e(He,Er),e(Er,Hg),e(He,Qg),e(He,Pr),e(Pr,Og),e(He,Kg),e(j,e_),e(j,Zt),f(jr,Zt,null),e(Zt,t_),e(Zt,Vl),e(Vl,o_),w(o,kc,b),w(o,zn,b),w(o,Ec,b),w(o,Qe,b),e(Qe,Ct),e(Ct,Xl),f(Ur,Xl,null),e(Qe,r_),e(Qe,Nl),e(Nl,a_),w(o,Pc,b),w(o,ye,b),e(ye,n_),e(ye,Bn),e(Bn,s_),e(ye,l_),e(ye,Jr),e(Jr,i_),e(ye,d_),w(o,jc,b),w(o,Wt,b),e(Wt,c_),e(Wt,Yl),e(Yl,m_),e(Wt,h_),w(o,Uc,b),f(Fr,o,b),w(o,Jc,b),w(o,Gt,b),e(Gt,p_),e(Gt,Al),e(Al,f_),e(Gt,u_),w(o,Fc,b),w(o,O,b),e(O,g_),e(O,ql),e(ql,__),e(O,b_),e(O,Ll),e(Ll,v_),e(O,y_),e(O,Sl),e(Sl,w_),e(O,M_),w(o,Ic,b),f(Ir,o,b),w(o,Zc,b),w(o,zt,b),e(zt,T_),e(zt,Hl),e(Hl,$_),e(zt,x_),w(o,Cc,b),f(Zr,o,b),w(o,Wc,b),f(Cr,o,b),w(o,Gc,b),w(o,Dn,b),e(Dn,k_),w(o,zc,b),f(Wr,o,b),w(o,Bc,b),w(o,Bt,b),e(Bt,E_),e(Bt,Ql),e(Ql,P_),e(Bt,j_),w(o,Dc,b),w(o,Oe,b),e(Oe,Dt),e(Dt,Ol),f(Gr,Ol,null),e(Oe,U_),e(Oe,Kl),e(Kl,J_),w(o,Rc,b),w(o,K,b),e(K,F_),e(K,ei),e(ei,I_),e(K,Z_),e(K,ti),e(ti,C_),e(K,W_),e(K,oi),e(oi,G_),e(K,z_),w(o,Vc,b),f(zr,o,b),w(o,Xc,b),w(o,we,b),e(we,B_),e(we,ri),e(ri,D_),e(we,R_),e(we,ai),e(ai,V_),e(we,X_),w(o,Nc,b),f(Br,o,b),w(o,Yc,b),w(o,Rt,b),e(Rt,N_),e(Rt,ni),e(ni,Y_),e(Rt,A_),w(o,Ac,b),f(Dr,o,b),w(o,qc,b),w(o,Rn,b),e(Rn,q_),w(o,Lc,b),w(o,Ke,b),e(Ke,Vt),e(Vt,si),f(Rr,si,null),e(Ke,L_),e(Ke,li),e(li,S_),w(o,Sc,b),w(o,C,b),f(Vr,C,null),e(C,H_),e(C,Xr),e(Xr,Q_),e(Xr,ii),e(ii,O_),e(Xr,K_),e(C,eb),e(C,Me),f(Nr,Me,null),e(Me,tb),e(Me,di),e(di,ob),e(Me,rb),e(Me,et),e(et,ab),e(et,ci),e(ci,nb),e(et,sb),e(et,mi),e(mi,lb),e(et,ib),e(C,db),e(C,Xt),f(Yr,Xt,null),e(Xt,cb),e(Xt,hi),e(hi,mb),e(C,hb),e(C,Nt),f(Ar,Nt,null),e(Nt,pb),e(Nt,tt),e(tt,fb),e(tt,pi),e(pi,ub),e(tt,gb),e(tt,qr),e(qr,_b),e(tt,bb),e(C,vb),e(C,Yt),f(Lr,Yt,null),e(Yt,yb),e(Yt,fi),e(fi,wb),e(C,Mb),e(C,At),f(Sr,At,null),e(At,Tb),e(At,ui),e(ui,$b),e(C,xb),e(C,qt),f(Hr,qt,null),e(qt,kb),e(qt,gi),e(gi,Eb),e(C,Pb),e(C,Lt),f(Qr,Lt,null),e(Lt,jb),e(Lt,_i),e(_i,Ub),e(C,Jb),e(C,St),f(Or,St,null),e(St,Fb),e(St,ot),e(ot,Ib),e(ot,bi),e(bi,Zb),e(ot,Cb),e(ot,Vn),e(Vn,Wb),e(ot,Gb),w(o,Hc,b),w(o,rt,b),e(rt,Ht),e(Ht,vi),f(Kr,vi,null),e(rt,zb),e(rt,yi),e(yi,Bb),w(o,Qc,b),w(o,x,b),f(ea,x,null),e(x,Db),e(x,wi),e(wi,Rb),e(x,Vb),e(x,Xn),e(Xn,Nn),e(Nn,Xb),e(Xn,Nb),e(x,Yb),e(x,ta),e(ta,Mi),e(Mi,Ab),e(ta,qb),e(ta,Ti),e(Ti,Lb),e(x,Sb),e(x,$i),e($i,Hb),e(x,Qb),e(x,at),e(at,Te),e(Te,xi),e(xi,Ob),e(Te,Kb),e(Te,Yn),e(Yn,ev),e(Te,tv),e(Te,An),e(An,ov),e(Te,rv),e(at,av),e(at,Qt),e(Qt,ki),e(ki,nv),e(Qt,sv),e(Qt,Ei),e(Ei,lv),e(Qt,iv),e(at,dv),e(at,R),e(R,Pi),e(Pi,cv),e(R,mv),e(R,ji),e(ji,hv),e(R,pv),e(R,Ui),e(Ui,fv),e(R,uv),e(R,Ji),e(Ji,gv),e(R,_v),e(R,Fi),e(Fi,bv),e(R,vv),e(x,yv),e(x,$e),f(oa,$e,null),e($e,wv),e($e,ra),e(ra,Mv),e(ra,Ii),e(Ii,Tv),e(ra,$v),e($e,xv),f(Ot,$e,null),e(x,kv),e(x,Kt),f(aa,Kt,null),e(Kt,Ev),e(Kt,na),e(na,Pv),e(na,Zi),e(Zi,jv),e(na,Uv),e(x,Jv),e(x,eo),f(sa,eo,null),e(eo,Fv),e(eo,Ci),e(Ci,Iv),e(x,Zv),e(x,to),f(la,to,null),e(to,Cv),e(to,ia),e(ia,Wv),e(ia,Wi),e(Wi,Gv),e(ia,zv),e(x,Bv),e(x,oo),f(da,oo,null),e(oo,Dv),e(oo,Gi),e(Gi,Rv),e(x,Vv),e(x,V),f(ca,V,null),e(V,Xv),e(V,zi),e(zi,Nv),e(V,Yv),e(V,ma),e(ma,Av),e(ma,Bi),e(Bi,qv),e(ma,Lv),e(V,Sv),e(V,ha),e(ha,Hv),e(ha,Di),e(Di,Qv),e(ha,Ov),e(V,Kv),f(ro,V,null),e(x,ey),e(x,ao),f(pa,ao,null),e(ao,ty),e(ao,Ri),e(Ri,oy),e(x,ry),e(x,no),f(fa,no,null),e(no,ay),e(no,Vi),e(Vi,ny),e(x,sy),e(x,so),f(ua,so,null),e(so,ly),e(so,Xi),e(Xi,iy),e(x,dy),e(x,lo),f(ga,lo,null),e(lo,cy),e(lo,Ni),e(Ni,my),e(x,hy),e(x,io),f(_a,io,null),e(io,py),e(io,Yi),e(Yi,fy),e(x,uy),e(x,co),f(ba,co,null),e(co,gy),e(co,Ai),e(Ai,_y),e(x,by),e(x,mo),f(va,mo,null),e(mo,vy),e(mo,qi),e(qi,yy),e(x,wy),e(x,ho),f(ya,ho,null),e(ho,My),e(ho,Li),e(Li,Ty),e(x,$y),e(x,po),f(wa,po,null),e(po,xy),e(po,q),e(q,ky),e(q,Ma),e(Ma,Ey),e(q,Py),e(q,Si),e(Si,jy),e(q,Uy),e(q,Hi),e(Hi,Jy),e(q,Fy),e(q,Qi),e(Qi,Iy),e(q,Zy),e(x,Cy),e(x,fo),f(Ta,fo,null),e(fo,Wy),e(fo,Oi),e(Oi,Gy),e(x,zy),e(x,xe),f($a,xe,null),e(xe,By),e(xe,Ki),e(Ki,Dy),e(xe,Ry),f(uo,xe,null),e(x,Vy),e(x,ke),f(xa,ke,null),e(ke,Xy),e(ke,ka),e(ka,Ny),e(ka,ed),e(ed,Yy),e(ka,Ay),e(ke,qy),e(ke,Ea),e(Ea,Ly),e(Ea,td),e(td,Sy),e(Ea,Hy),e(x,Qy),e(x,go),f(Pa,go,null),e(go,Oy),e(go,ja),e(ja,Ky),e(ja,qn),e(qn,e1),e(ja,t1),e(x,o1),e(x,Ln),f(Ua,Ln,null),e(x,r1),e(x,_o),f(Ja,_o,null),e(_o,a1),e(_o,od),e(od,n1),e(x,s1),e(x,bo),f(Fa,bo,null),e(bo,l1),e(bo,rd),e(rd,i1),e(x,d1),e(x,vo),f(Ia,vo,null),e(vo,c1),e(vo,ad),e(ad,m1),e(x,h1),e(x,yo),f(Za,yo,null),e(yo,p1),e(yo,nd),e(nd,f1),e(x,u1),e(x,wo),f(Ca,wo,null),e(wo,g1),e(wo,Wa),e(Wa,_1),e(Wa,sd),e(sd,b1),e(Wa,v1),e(x,y1),e(x,Mo),f(Ga,Mo,null),e(Mo,w1),e(Mo,za),e(za,M1),e(za,ld),e(ld,T1),e(za,$1),w(o,Oc,b),w(o,nt,b),e(nt,To),e(To,id),f(Ba,id,null),e(nt,x1),e(nt,dd),e(dd,k1),w(o,Kc,b),w(o,re,b),f(Da,re,null),e(re,E1),e(re,Ra),e(Ra,P1),e(Ra,cd),e(cd,j1),e(Ra,U1),e(re,J1),e(re,$o),f(Va,$o,null),e($o,F1),e($o,md),e(md,I1),w(o,em,b),w(o,st,b),e(st,xo),e(xo,hd),f(Xa,hd,null),e(st,Z1),e(st,pd),e(pd,C1),w(o,tm,b),w(o,J,b),f(Na,J,null),e(J,W1),e(J,fd),e(fd,G1),e(J,z1),e(J,Sn),e(Sn,Hn),e(Hn,B1),e(Sn,D1),e(J,R1),e(J,ud),e(ud,V1),e(J,X1),e(J,lt),e(lt,Ee),e(Ee,gd),e(gd,N1),e(Ee,Y1),e(Ee,Qn),e(Qn,A1),e(Ee,q1),e(Ee,On),e(On,L1),e(Ee,S1),e(lt,H1),e(lt,ko),e(ko,_d),e(_d,Q1),e(ko,O1),e(ko,bd),e(bd,K1),e(ko,ew),e(lt,tw),e(lt,X),e(X,vd),e(vd,ow),e(X,rw),e(X,yd),e(yd,aw),e(X,nw),e(X,wd),e(wd,sw),e(X,lw),e(X,Md),e(Md,iw),e(X,dw),e(X,Td),e(Td,cw),e(X,mw),e(J,hw),e(J,Pe),f(Ya,Pe,null),e(Pe,pw),e(Pe,Aa),e(Aa,fw),e(Aa,$d),e($d,uw),e(Aa,gw),e(Pe,_w),f(Eo,Pe,null),e(J,bw),e(J,Po),f(qa,Po,null),e(Po,vw),e(Po,ae),e(ae,yw),e(ae,xd),e(xd,ww),e(ae,Mw),e(ae,kd),e(kd,Tw),e(ae,$w),e(ae,Ed),e(Ed,xw),e(ae,kw),e(J,Ew),e(J,N),f(La,N,null),e(N,Pw),e(N,Pd),e(Pd,jw),e(N,Uw),e(N,Sa),e(Sa,Jw),e(Sa,jd),e(jd,Fw),e(Sa,Iw),e(N,Zw),e(N,Ha),e(Ha,Cw),e(Ha,Ud),e(Ud,Ww),e(Ha,Gw),e(N,zw),f(jo,N,null),e(J,Bw),e(J,je),f(Qa,je,null),e(je,Dw),e(je,Oa),e(Oa,Rw),e(Oa,Jd),e(Jd,Vw),e(Oa,Xw),e(je,Nw),e(je,Fd),e(Fd,Yw),e(J,Aw),e(J,Ue),f(Ka,Ue,null),e(Ue,qw),e(Ue,Id),e(Id,Lw),e(Ue,Sw),f(Uo,Ue,null),e(J,Hw),e(J,Jo),f(en,Jo,null),e(Jo,Qw),e(Jo,tn),e(tn,Ow),e(tn,Zd),e(Zd,Kw),e(tn,e2),e(J,t2),e(J,ee),f(on,ee,null),e(ee,o2),e(ee,L),e(L,r2),e(L,Cd),e(Cd,a2),e(L,n2),e(L,Wd),e(Wd,s2),e(L,l2),e(L,Gd),e(Gd,i2),e(L,d2),e(L,zd),e(zd,c2),e(L,m2),e(ee,h2),e(ee,Bd),e(Bd,p2),e(ee,f2),f(Fo,ee,null),e(J,u2),e(J,te),f(rn,te,null),e(te,g2),e(te,S),e(S,_2),e(S,Dd),e(Dd,b2),e(S,v2),e(S,Rd),e(Rd,y2),e(S,w2),e(S,Vd),e(Vd,M2),e(S,T2),e(S,Xd),e(Xd,$2),e(S,x2),e(te,k2),e(te,Nd),e(Nd,E2),e(te,P2),f(Io,te,null),e(J,j2),e(J,Je),f(an,Je,null),e(Je,U2),e(Je,H),e(H,J2),e(H,Yd),e(Yd,F2),e(H,I2),e(H,Ad),e(Ad,Z2),e(H,C2),e(H,qd),e(qd,W2),e(H,G2),e(H,Ld),e(Ld,z2),e(H,B2),e(Je,D2),f(Zo,Je,null),w(o,om,b),w(o,it,b),e(it,Co),e(Co,Sd),f(nn,Sd,null),e(it,R2),e(it,Hd),e(Hd,V2),w(o,rm,b),w(o,ne,b),f(sn,ne,null),e(ne,X2),e(ne,Qd),e(Qd,N2),e(ne,Y2),e(ne,Fe),f(ln,Fe,null),e(Fe,A2),e(Fe,dn),e(dn,q2),e(dn,Od),e(Od,L2),e(dn,S2),e(Fe,H2),f(Wo,Fe,null),w(o,am,b),w(o,dt,b),e(dt,Go),e(Go,Kd),f(cn,Kd,null),e(dt,Q2),e(dt,ec),e(ec,O2),w(o,nm,b),w(o,se,b),f(mn,se,null),e(se,K2),e(se,hn),e(hn,eM),e(hn,pn),e(pn,tc),e(tc,tM),e(hn,oM),e(se,rM),e(se,oc),e(oc,aM),sm=!0},p(o,[b]){const fn={};b&2&&(fn.$$scope={dirty:b,ctx:o}),bt.$set(fn);const rc={};b&2&&(rc.$$scope={dirty:b,ctx:o}),Mt.$set(rc);const ac={};b&2&&(ac.$$scope={dirty:b,ctx:o}),Tt.$set(ac);const nc={};b&2&&(nc.$$scope={dirty:b,ctx:o}),Ut.$set(nc);const le={};b&2&&(le.$$scope={dirty:b,ctx:o}),Ot.$set(le);const sc={};b&2&&(sc.$$scope={dirty:b,ctx:o}),ro.$set(sc);const lc={};b&2&&(lc.$$scope={dirty:b,ctx:o}),uo.$set(lc);const ic={};b&2&&(ic.$$scope={dirty:b,ctx:o}),Eo.$set(ic);const zo={};b&2&&(zo.$$scope={dirty:b,ctx:o}),jo.$set(zo);const dc={};b&2&&(dc.$$scope={dirty:b,ctx:o}),Uo.$set(dc);const cc={};b&2&&(cc.$$scope={dirty:b,ctx:o}),Fo.$set(cc);const un={};b&2&&(un.$$scope={dirty:b,ctx:o}),Io.$set(un);const mc={};b&2&&(mc.$$scope={dirty:b,ctx:o}),Zo.$set(mc);const hc={};b&2&&(hc.$$scope={dirty:b,ctx:o}),Wo.$set(hc)},i(o){sm||(u(c.$$.fragment,o),u(No.$$.fragment,o),u(Yo.$$.fragment,o),u(Lo.$$.fragment,o),u(bt.$$.fragment,o),u(Ho.$$.fragment,o),u(Oo.$$.fragment,o),u(er.$$.fragment,o),u(tr.$$.fragment,o),u(Mt.$$.fragment,o),u(Tt.$$.fragment,o),u(ar.$$.fragment,o),u(nr.$$.fragment,o),u(lr.$$.fragment,o),u(ir.$$.fragment,o),u(dr.$$.fragment,o),u(cr.$$.fragment,o),u(mr.$$.fragment,o),u(hr.$$.fragment,o),u(pr.$$.fragment,o),u(Ut.$$.fragment,o),u(fr.$$.fragment,o),u(_r.$$.fragment,o),u(vr.$$.fragment,o),u(wr.$$.fragment,o),u(Mr.$$.fragment,o),u($r.$$.fragment,o),u(jr.$$.fragment,o),u(Ur.$$.fragment,o),u(Fr.$$.fragment,o),u(Ir.$$.fragment,o),u(Zr.$$.fragment,o),u(Cr.$$.fragment,o),u(Wr.$$.fragment,o),u(Gr.$$.fragment,o),u(zr.$$.fragment,o),u(Br.$$.fragment,o),u(Dr.$$.fragment,o),u(Rr.$$.fragment,o),u(Vr.$$.fragment,o),u(Nr.$$.fragment,o),u(Yr.$$.fragment,o),u(Ar.$$.fragment,o),u(Lr.$$.fragment,o),u(Sr.$$.fragment,o),u(Hr.$$.fragment,o),u(Qr.$$.fragment,o),u(Or.$$.fragment,o),u(Kr.$$.fragment,o),u(ea.$$.fragment,o),u(oa.$$.fragment,o),u(Ot.$$.fragment,o),u(aa.$$.fragment,o),u(sa.$$.fragment,o),u(la.$$.fragment,o),u(da.$$.fragment,o),u(ca.$$.fragment,o),u(ro.$$.fragment,o),u(pa.$$.fragment,o),u(fa.$$.fragment,o),u(ua.$$.fragment,o),u(ga.$$.fragment,o),u(_a.$$.fragment,o),u(ba.$$.fragment,o),u(va.$$.fragment,o),u(ya.$$.fragment,o),u(wa.$$.fragment,o),u(Ta.$$.fragment,o),u($a.$$.fragment,o),u(uo.$$.fragment,o),u(xa.$$.fragment,o),u(Pa.$$.fragment,o),u(Ua.$$.fragment,o),u(Ja.$$.fragment,o),u(Fa.$$.fragment,o),u(Ia.$$.fragment,o),u(Za.$$.fragment,o),u(Ca.$$.fragment,o),u(Ga.$$.fragment,o),u(Ba.$$.fragment,o),u(Da.$$.fragment,o),u(Va.$$.fragment,o),u(Xa.$$.fragment,o),u(Na.$$.fragment,o),u(Ya.$$.fragment,o),u(Eo.$$.fragment,o),u(qa.$$.fragment,o),u(La.$$.fragment,o),u(jo.$$.fragment,o),u(Qa.$$.fragment,o),u(Ka.$$.fragment,o),u(Uo.$$.fragment,o),u(en.$$.fragment,o),u(on.$$.fragment,o),u(Fo.$$.fragment,o),u(rn.$$.fragment,o),u(Io.$$.fragment,o),u(an.$$.fragment,o),u(Zo.$$.fragment,o),u(nn.$$.fragment,o),u(sn.$$.fragment,o),u(ln.$$.fragment,o),u(Wo.$$.fragment,o),u(cn.$$.fragment,o),u(mn.$$.fragment,o),sm=!0)},o(o){g(c.$$.fragment,o),g(No.$$.fragment,o),g(Yo.$$.fragment,o),g(Lo.$$.fragment,o),g(bt.$$.fragment,o),g(Ho.$$.fragment,o),g(Oo.$$.fragment,o),g(er.$$.fragment,o),g(tr.$$.fragment,o),g(Mt.$$.fragment,o),g(Tt.$$.fragment,o),g(ar.$$.fragment,o),g(nr.$$.fragment,o),g(lr.$$.fragment,o),g(ir.$$.fragment,o),g(dr.$$.fragment,o),g(cr.$$.fragment,o),g(mr.$$.fragment,o),g(hr.$$.fragment,o),g(pr.$$.fragment,o),g(Ut.$$.fragment,o),g(fr.$$.fragment,o),g(_r.$$.fragment,o),g(vr.$$.fragment,o),g(wr.$$.fragment,o),g(Mr.$$.fragment,o),g($r.$$.fragment,o),g(jr.$$.fragment,o),g(Ur.$$.fragment,o),g(Fr.$$.fragment,o),g(Ir.$$.fragment,o),g(Zr.$$.fragment,o),g(Cr.$$.fragment,o),g(Wr.$$.fragment,o),g(Gr.$$.fragment,o),g(zr.$$.fragment,o),g(Br.$$.fragment,o),g(Dr.$$.fragment,o),g(Rr.$$.fragment,o),g(Vr.$$.fragment,o),g(Nr.$$.fragment,o),g(Yr.$$.fragment,o),g(Ar.$$.fragment,o),g(Lr.$$.fragment,o),g(Sr.$$.fragment,o),g(Hr.$$.fragment,o),g(Qr.$$.fragment,o),g(Or.$$.fragment,o),g(Kr.$$.fragment,o),g(ea.$$.fragment,o),g(oa.$$.fragment,o),g(Ot.$$.fragment,o),g(aa.$$.fragment,o),g(sa.$$.fragment,o),g(la.$$.fragment,o),g(da.$$.fragment,o),g(ca.$$.fragment,o),g(ro.$$.fragment,o),g(pa.$$.fragment,o),g(fa.$$.fragment,o),g(ua.$$.fragment,o),g(ga.$$.fragment,o),g(_a.$$.fragment,o),g(ba.$$.fragment,o),g(va.$$.fragment,o),g(ya.$$.fragment,o),g(wa.$$.fragment,o),g(Ta.$$.fragment,o),g($a.$$.fragment,o),g(uo.$$.fragment,o),g(xa.$$.fragment,o),g(Pa.$$.fragment,o),g(Ua.$$.fragment,o),g(Ja.$$.fragment,o),g(Fa.$$.fragment,o),g(Ia.$$.fragment,o),g(Za.$$.fragment,o),g(Ca.$$.fragment,o),g(Ga.$$.fragment,o),g(Ba.$$.fragment,o),g(Da.$$.fragment,o),g(Va.$$.fragment,o),g(Xa.$$.fragment,o),g(Na.$$.fragment,o),g(Ya.$$.fragment,o),g(Eo.$$.fragment,o),g(qa.$$.fragment,o),g(La.$$.fragment,o),g(jo.$$.fragment,o),g(Qa.$$.fragment,o),g(Ka.$$.fragment,o),g(Uo.$$.fragment,o),g(en.$$.fragment,o),g(on.$$.fragment,o),g(Fo.$$.fragment,o),g(rn.$$.fragment,o),g(Io.$$.fragment,o),g(an.$$.fragment,o),g(Zo.$$.fragment,o),g(nn.$$.fragment,o),g(sn.$$.fragment,o),g(ln.$$.fragment,o),g(Wo.$$.fragment,o),g(cn.$$.fragment,o),g(mn.$$.fragment,o),sm=!1},d(o){t(v),o&&t(E),o&&t(M),_(c),o&&t(yc),o&&t(Q),o&&t(wc),o&&t(Ne),o&&t(Mc),o&&t(mt),o&&t(Tc),o&&t(B),o&&t($c),o&&t(Ye),_(No),o&&t(xc),o&&t(j),_(Yo),_(Lo),_(bt),_(Ho),_(Oo),_(er),_(tr),_(Mt),_(Tt),_(ar),_(nr),_(lr),_(ir),_(dr),_(cr),_(mr),_(hr),_(pr),_(Ut),_(fr),_(_r),_(vr),_(wr),_(Mr),_($r),_(jr),o&&t(kc),o&&t(zn),o&&t(Ec),o&&t(Qe),_(Ur),o&&t(Pc),o&&t(ye),o&&t(jc),o&&t(Wt),o&&t(Uc),_(Fr,o),o&&t(Jc),o&&t(Gt),o&&t(Fc),o&&t(O),o&&t(Ic),_(Ir,o),o&&t(Zc),o&&t(zt),o&&t(Cc),_(Zr,o),o&&t(Wc),_(Cr,o),o&&t(Gc),o&&t(Dn),o&&t(zc),_(Wr,o),o&&t(Bc),o&&t(Bt),o&&t(Dc),o&&t(Oe),_(Gr),o&&t(Rc),o&&t(K),o&&t(Vc),_(zr,o),o&&t(Xc),o&&t(we),o&&t(Nc),_(Br,o),o&&t(Yc),o&&t(Rt),o&&t(Ac),_(Dr,o),o&&t(qc),o&&t(Rn),o&&t(Lc),o&&t(Ke),_(Rr),o&&t(Sc),o&&t(C),_(Vr),_(Nr),_(Yr),_(Ar),_(Lr),_(Sr),_(Hr),_(Qr),_(Or),o&&t(Hc),o&&t(rt),_(Kr),o&&t(Qc),o&&t(x),_(ea),_(oa),_(Ot),_(aa),_(sa),_(la),_(da),_(ca),_(ro),_(pa),_(fa),_(ua),_(ga),_(_a),_(ba),_(va),_(ya),_(wa),_(Ta),_($a),_(uo),_(xa),_(Pa),_(Ua),_(Ja),_(Fa),_(Ia),_(Za),_(Ca),_(Ga),o&&t(Oc),o&&t(nt),_(Ba),o&&t(Kc),o&&t(re),_(Da),_(Va),o&&t(em),o&&t(st),_(Xa),o&&t(tm),o&&t(J),_(Na),_(Ya),_(Eo),_(qa),_(La),_(jo),_(Qa),_(Ka),_(Uo),_(en),_(on),_(Fo),_(rn),_(Io),_(an),_(Zo),o&&t(om),o&&t(it),_(nn),o&&t(rm),o&&t(ne),_(sn),_(ln),_(Wo),o&&t(am),o&&t(dt),_(cn),o&&t(nm),o&&t(se),_(mn)}}}const Rx={local:"models",sections:[{local:"transformers.PreTrainedModel",sections:[{local:"large-model-loading",title:"Large model loading"},{local:"model-instantiation-dtype",title:"Model Instantiation dtype"}],title:"PreTrainedModel"},{local:"transformers.modeling_utils.ModuleUtilsMixin",title:"ModuleUtilsMixin"},{local:"transformers.TFPreTrainedModel",title:"TFPreTrainedModel"},{local:"transformers.modeling_tf_utils.TFModelUtilsMixin",title:"TFModelUtilsMixin"},{local:"transformers.FlaxPreTrainedModel",title:"FlaxPreTrainedModel"},{local:"transformers.utils.PushToHubMixin",title:"Pushing to the Hub"},{local:"transformers.modeling_utils.load_sharded_checkpoint",title:"Sharded checkpoints"}],title:"Models"};function Vx(F){return xx(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Sx extends wx{constructor(v){super();Mx(this,v,Vx,Dx,Tx,{})}}export{Sx as default,Rx as metadata};
