import{S as nx,i as sx,s as ix,e as r,k as d,w as u,t as s,M as dx,c as a,d as t,m as l,a as n,x as g,h as i,b as m,G as e,g as $,y as _,q as b,o as v,B as y,v as lx,L as Be}from"../../chunks/vendor-hf-doc-builder.js";import{T as Bm}from"../../chunks/Tip-hf-doc-builder.js";import{D as k}from"../../chunks/Docstring-hf-doc-builder.js";import{C as U}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as Oe}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Ne}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function cx(z){let h,P,w,f,E;return f=new U({props:{code:`from transformers import AutoModel

model = AutoModel.from_pretrained("bert-base-cased")

# Push the model to your namespace with the name "my-finetuned-bert".
model.push_to_hub("my-finetuned-bert")

# Push the model to an organization with the name "my-finetuned-bert".
model.push_to_hub("huggingface/my-finetuned-bert")`,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(){h=r("p"),P=s("Examples:"),w=d(),u(f.$$.fragment)},l(c){h=a(c,"P",{});var T=n(h);P=i(T,"Examples:"),T.forEach(t),w=l(c),g(f.$$.fragment,c)},m(c,T){$(c,h,T),e(h,P),$(c,w,T),_(f,c,T),E=!0},p:Be,i(c){E||(b(f.$$.fragment,c),E=!0)},o(c){v(f.$$.fragment,c),E=!1},d(c){c&&t(h),c&&t(w),y(f,c)}}}function mx(z){let h,P,w,f,E;return{c(){h=r("p"),P=s("Activate the special "),w=r("a"),f=s("\u201Coffline-mode\u201D"),E=s(` to
use this method in a firewalled environment.`),this.h()},l(c){h=a(c,"P",{});var T=n(h);P=i(T,"Activate the special "),w=a(T,"A",{href:!0,rel:!0});var nt=n(w);f=i(nt,"\u201Coffline-mode\u201D"),nt.forEach(t),E=i(T,` to
use this method in a firewalled environment.`),T.forEach(t),this.h()},h(){m(w,"href","https://huggingface.co/transformers/installation.html#offline-mode"),m(w,"rel","nofollow")},m(c,T){$(c,h,T),e(h,P),e(h,w),e(w,f),e(h,E)},d(c){c&&t(h)}}}function px(z){let h,P,w,f,E;return f=new U({props:{code:`from transformers import BertConfig, BertModel

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

model = TFAutoModel.from_pretrained("bert-base-cased")

# Push the model to your namespace with the name "my-finetuned-bert".
model.push_to_hub("my-finetuned-bert")

# Push the model to an organization with the name "my-finetuned-bert".
model.push_to_hub("huggingface/my-finetuned-bert")`,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(){h=r("p"),P=s("Examples:"),w=d(),u(f.$$.fragment)},l(c){h=a(c,"P",{});var T=n(h);P=i(T,"Examples:"),T.forEach(t),w=l(c),g(f.$$.fragment,c)},m(c,T){$(c,h,T),e(h,P),$(c,w,T),_(f,c,T),E=!0},p:Be,i(c){E||(b(f.$$.fragment,c),E=!0)},o(c){v(f.$$.fragment,c),E=!1},d(c){c&&t(h),c&&t(w),y(f,c)}}}function ux(z){let h,P,w,f,E;return f=new U({props:{code:`from transformers import BertConfig, TFBertModel

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

model = FlaxAutoModel.from_pretrained("bert-base-cased")

# Push the model to your namespace with the name "my-finetuned-bert".
model.push_to_hub("my-finetuned-bert")

# Push the model to an organization with the name "my-finetuned-bert".
model.push_to_hub("huggingface/my-finetuned-bert")`,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(){h=r("p"),P=s("Examples:"),w=d(),u(f.$$.fragment)},l(c){h=a(c,"P",{});var T=n(h);P=i(T,"Examples:"),T.forEach(t),w=l(c),g(f.$$.fragment,c)},m(c,T){$(c,h,T),e(h,P),$(c,w,T),_(f,c,T),E=!0},p:Be,i(c){E||(b(f.$$.fragment,c),E=!0)},o(c){v(f.$$.fragment,c),E=!1},d(c){c&&t(h),c&&t(w),y(f,c)}}}function bx(z){let h,P,w,f,E;return f=new U({props:{code:`from transformers import BertConfig, FlaxBertModel

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

# load model
model = FlaxBertModel.from_pretrained("bert-base-cased")
# By default, the model parameters will be in fp32 precision, to cast these to bfloat16 precision
model.params = model.to_bf16(model.params)
# If you want don't want to cast certain parameters (for example layer norm bias and scale)
# then pass the mask as follows
from flax import traverse_util

model = FlaxBertModel.from_pretrained("bert-base-cased")
flat_params = traverse_util.flatten_dict(model.params)
mask = {
    path: (path[-2] != ("LayerNorm", "bias") and path[-2:] != ("LayerNorm", "scale"))
    for path in flat_params
}
mask = traverse_util.unflatten_dict(mask)
model.params = model.to_bf16(model.params, mask)`,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(){h=r("p"),P=s("Examples:"),w=d(),u(f.$$.fragment)},l(c){h=a(c,"P",{});var T=n(h);P=i(T,"Examples:"),T.forEach(t),w=l(c),g(f.$$.fragment,c)},m(c,T){$(c,h,T),e(h,P),$(c,w,T),_(f,c,T),E=!0},p:Be,i(c){E||(b(f.$$.fragment,c),E=!0)},o(c){v(f.$$.fragment,c),E=!1},d(c){c&&t(h),c&&t(w),y(f,c)}}}function $x(z){let h,P,w,f,E;return f=new U({props:{code:`from transformers import FlaxBertModel

# load model
model = FlaxBertModel.from_pretrained("bert-base-cased")
# By default, the model params will be in fp32, to cast these to float16
model.params = model.to_fp16(model.params)
# If you want don't want to cast certain parameters (for example layer norm bias and scale)
# then pass the mask as follows
from flax import traverse_util

model = FlaxBertModel.from_pretrained("bert-base-cased")
flat_params = traverse_util.flatten_dict(model.params)
mask = {
    path: (path[-2] != ("LayerNorm", "bias") and path[-2:] != ("LayerNorm", "scale"))
    for path in flat_params
}
mask = traverse_util.unflatten_dict(mask)
model.params = model.to_fp16(model.params, mask)`,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(){h=r("p"),P=s("Examples:"),w=d(),u(f.$$.fragment)},l(c){h=a(c,"P",{});var T=n(h);P=i(T,"Examples:"),T.forEach(t),w=l(c),g(f.$$.fragment,c)},m(c,T){$(c,h,T),e(h,P),$(c,w,T),_(f,c,T),E=!0},p:Be,i(c){E||(b(f.$$.fragment,c),E=!0)},o(c){v(f.$$.fragment,c),E=!1},d(c){c&&t(h),c&&t(w),y(f,c)}}}function wx(z){let h,P,w,f,E;return f=new U({props:{code:`from transformers import FlaxBertModel

# Download model and configuration from huggingface.co
model = FlaxBertModel.from_pretrained("bert-base-cased")
# By default, the model params will be in fp32, to illustrate the use of this method,
# we'll first cast to fp16 and back to fp32
model.params = model.to_f16(model.params)
# now cast back to fp32
model.params = model.to_fp32(model.params)`,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(){h=r("p"),P=s("Examples:"),w=d(),u(f.$$.fragment)},l(c){h=a(c,"P",{});var T=n(h);P=i(T,"Examples:"),T.forEach(t),w=l(c),g(f.$$.fragment,c)},m(c,T){$(c,h,T),e(h,P),$(c,w,T),_(f,c,T),E=!0},p:Be,i(c){E||(b(f.$$.fragment,c),E=!0)},o(c){v(f.$$.fragment,c),E=!1},d(c){c&&t(h),c&&t(w),y(f,c)}}}function Tx(z){let h,P,w,f,E;return f=new U({props:{code:`from transformers import {object_class}

{object} = {object_class}.from_pretrained("bert-base-cased")

# Push the {object} to your namespace with the name "my-finetuned-bert".
{object}.push_to_hub("my-finetuned-bert")

# Push the {object} to an organization with the name "my-finetuned-bert".
{object}.push_to_hub("huggingface/my-finetuned-bert")`,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(){h=r("p"),P=s("Examples:"),w=d(),u(f.$$.fragment)},l(c){h=a(c,"P",{});var T=n(h);P=i(T,"Examples:"),T.forEach(t),w=l(c),g(f.$$.fragment,c)},m(c,T){$(c,h,T),e(h,P),$(c,w,T),_(f,c,T),E=!0},p:Be,i(c){E||(b(f.$$.fragment,c),E=!0)},o(c){v(f.$$.fragment,c),E=!1},d(c){c&&t(h),c&&t(w),y(f,c)}}}function xx(z){let h,P,w,f,E,c,T,nt,Wm,Fl,K,Sm,Sa,Xm,Vm,Xa,Gm,Rm,Va,Hm,Ym,jl,We,Ga,Jm,Km,Ra,Zm,Qm,Dl,st,Hn,ep,tp,Yn,op,zl,O,rp,Ha,ap,np,Jn,sp,ip,Ya,dp,lp,Ja,cp,mp,Ka,pp,hp,Al,Se,it,Kn,Do,fp,Zn,up,ql,F,zo,gp,Qn,_p,bp,Za,Qa,vp,yp,$p,Ao,es,wp,Tp,ts,xp,kp,os,Pp,Mp,V,rs,ce,as,Ep,Fp,en,jp,Dp,tn,zp,Ap,qp,qo,me,ns,Cp,Ip,ss,Lp,Up,is,Op,Np,Bp,Xe,dt,ds,Wp,Sp,on,Xp,Vp,Gp,lt,ls,Rp,Hp,cs,Yp,Jp,Kp,ct,ms,Zp,Qp,ps,eh,th,oh,hs,mt,fs,rh,ah,us,nh,sh,ih,gs,pt,_s,dh,lh,bs,ch,mh,ph,vs,N,ys,hh,fh,$s,uh,gh,ws,_h,bh,Ts,vh,yh,xs,$h,wh,Th,pe,Co,xh,Io,kh,ks,Ph,Mh,Eh,ht,Fh,A,Lo,jh,Ps,Dh,zh,Ve,Ah,Ms,qh,Ch,Es,Ih,Lh,Uh,Uo,Oh,Fs,Nh,Bh,Wh,Oo,Sh,js,Xh,Vh,Gh,ft,Rh,ut,Hh,Ds,rn,zs,Yh,Jh,Kh,As,Zh,Qh,qs,ef,tf,G,Cs,of,rf,Is,af,nf,Ls,sf,df,Us,lf,cf,Os,mf,pf,Ns,hf,ff,gt,No,uf,Bs,gf,_f,_t,Bo,bf,an,vf,Wo,yf,$f,bt,So,wf,Ws,Tf,xf,he,Xo,kf,Ss,Pf,Mf,Xs,Ef,Ff,fe,Vo,jf,Vs,Df,zf,Gs,Af,qf,vt,Go,Cf,Rs,If,Lf,yt,Ro,Uf,Hs,Of,Nf,$t,Ho,Bf,Ys,Wf,Sf,ue,Yo,Xf,Js,Vf,Gf,wt,Rf,ge,Jo,Hf,Ko,Yf,Ks,Jf,Kf,Zf,Zo,Qf,Zs,eu,tu,ou,Tt,Qo,ru,er,au,nn,nu,su,iu,xt,tr,du,Qs,lu,cu,_e,or,mu,ei,pu,hu,rr,fu,ti,uu,gu,Cl,sn,Il,Ge,kt,oi,ar,_u,ri,bu,Ll,be,vu,dn,yu,$u,nr,wu,Tu,Ul,Pt,xu,ai,ku,Pu,Ol,sr,Nl,Mt,Mu,ni,Eu,Fu,Bl,Z,ju,si,Du,zu,ii,Au,qu,di,Cu,Iu,Wl,ir,Sl,Et,Lu,li,Uu,Ou,Xl,dr,Vl,lr,Gl,ln,Nu,Rl,cr,Hl,Ft,Bu,ci,Wu,Su,Yl,Re,jt,mi,mr,Xu,pi,Vu,Jl,Q,Gu,hi,Ru,Hu,fi,Yu,Ju,ui,Ku,Zu,Kl,pr,Zl,ve,Qu,gi,eg,tg,_i,og,rg,Ql,hr,ec,Dt,ag,bi,ng,sg,tc,fr,oc,cn,ig,rc,He,zt,vi,ur,dg,yi,lg,ac,C,gr,cg,_r,mg,$i,pg,hg,fg,ye,br,ug,wi,gg,_g,Ye,bg,Ti,vg,yg,xi,$g,wg,Tg,At,vr,xg,ki,kg,Pg,qt,yr,Mg,Je,Eg,Pi,Fg,jg,$r,Dg,zg,Ag,Ct,wr,qg,Mi,Cg,Ig,It,Tr,Lg,Ei,Ug,Og,Lt,xr,Ng,Fi,Bg,Wg,Ut,kr,Sg,ji,Xg,Vg,Ot,Pr,Gg,Ke,Rg,Di,Hg,Yg,mn,Jg,Kg,nc,Ze,Nt,zi,Mr,Zg,Ai,Qg,sc,x,Er,e_,qi,t_,o_,pn,hn,r_,a_,n_,Fr,Ci,s_,i_,Ii,d_,l_,Li,c_,m_,Qe,$e,Ui,p_,h_,fn,f_,u_,un,g_,__,b_,Bt,Oi,v_,y_,Ni,$_,w_,T_,B,Bi,x_,k_,Wi,P_,M_,Si,E_,F_,Xi,j_,D_,Vi,z_,A_,q_,we,jr,C_,Dr,I_,Gi,L_,U_,O_,Wt,N_,St,zr,B_,Ri,W_,S_,Xt,Ar,X_,qr,V_,Hi,G_,R_,H_,Vt,Cr,Y_,Yi,J_,K_,W,Ir,Z_,Ji,Q_,eb,Lr,tb,Ki,ob,rb,ab,Ur,nb,Zi,sb,ib,db,Gt,lb,Rt,Or,cb,Qi,mb,pb,Ht,Nr,hb,ed,fb,ub,Yt,Br,gb,td,_b,bb,Jt,Wr,vb,od,yb,$b,Kt,Sr,wb,rd,Tb,xb,Zt,Xr,kb,ad,Pb,Mb,Qt,Vr,Eb,nd,Fb,jb,eo,Gr,Db,R,zb,Rr,Ab,qb,sd,Cb,Ib,id,Lb,Ub,dd,Ob,Nb,Bb,to,Hr,Wb,ld,Sb,Xb,Te,Yr,Vb,cd,Gb,Rb,oo,Hb,xe,Jr,Yb,Kr,Jb,md,Kb,Zb,Qb,Zr,ev,pd,tv,ov,rv,ro,Qr,av,ea,nv,gn,sv,iv,dv,ao,ta,lv,hd,cv,mv,no,oa,pv,fd,hv,fv,so,ra,uv,ud,gv,_v,io,aa,bv,gd,vv,yv,lo,na,$v,_d,wv,Tv,co,sa,xv,ia,kv,bd,Pv,Mv,Ev,mo,da,Fv,la,jv,vd,Dv,zv,ic,et,po,yd,ca,Av,$d,qv,dc,re,ma,Cv,pa,Iv,wd,Lv,Uv,Ov,ho,ha,Nv,Td,Bv,lc,tt,fo,xd,fa,Wv,kd,Sv,cc,D,ua,Xv,Pd,Vv,Gv,_n,bn,Rv,Hv,Yv,Md,Jv,Kv,ot,ke,Ed,Zv,Qv,vn,ey,ty,yn,oy,ry,ay,uo,Fd,ny,sy,jd,iy,dy,ly,S,Dd,cy,my,zd,py,hy,Ad,fy,uy,qd,gy,_y,Cd,by,vy,yy,Pe,ga,$y,_a,wy,Id,Ty,xy,ky,go,Py,X,ba,My,Ld,Ey,Fy,va,jy,Ud,Dy,zy,Ay,ya,qy,Od,Cy,Iy,Ly,_o,Uy,Me,$a,Oy,wa,Ny,Nd,By,Wy,Sy,Bd,Xy,Vy,Ee,Ta,Gy,Wd,Ry,Hy,bo,Yy,vo,xa,Jy,ka,Ky,Sd,Zy,Qy,e1,ee,Pa,t1,H,o1,Xd,r1,a1,Vd,n1,s1,Gd,i1,d1,Rd,l1,c1,m1,Hd,p1,h1,yo,f1,te,Ma,u1,Y,g1,Yd,_1,b1,Jd,v1,y1,Kd,$1,w1,Zd,T1,x1,k1,Qd,P1,M1,$o,E1,Fe,Ea,F1,J,j1,el,D1,z1,tl,A1,q1,ol,C1,I1,rl,L1,U1,O1,wo,mc,rt,To,al,Fa,N1,nl,B1,pc,ae,ja,W1,sl,S1,X1,je,Da,V1,za,G1,il,R1,H1,Y1,xo,hc,at,ko,dl,Aa,J1,ll,K1,fc,ne,qa,Z1,Ca,Q1,Ia,cl,e2,t2,o2,ml,r2,uc;return c=new Oe({}),Do=new Oe({}),zo=new k({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.25.1/src/transformers/modeling_utils.py#L911"}}),Co=new k({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:"**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"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/utils/hub.py#L712"}}),ht=new Ne({props:{anchor:"transformers.PreTrainedModel.push_to_hub.example",$$slots:{default:[cx]},$$scope:{ctx:z}}}),Lo=new k({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:"**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.25.1/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.25.1/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a>,</li>
<li>a string or path valid as input to <a href="/docs/transformers/v4.25.1/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.25.1/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.25.1/en/main_classes/model#transformers.PreTrainedModel.save_pretrained">save_pretrained()</a> and
<a href="/docs/transformers/v4.25.1/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.use_auth_token",description:`<strong>use_auth_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:"use_auth_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.`,name:"revision"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/modeling_utils.py#L1704",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 this dtype. If <code>&quot;auto&quot;</code> is passed the dtype
will be automatically derived from the model&#x2019;s weights.`,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>, <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.</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.load_in_8bit_threshold",description:`<strong>load_in_8bit_threshold</strong> (<code>float</code>, <em>optional</em>, defaults to 6) &#x2014;
Works together with <code>load_in_8bit</code>. This corresponds to the outlier threshold for outlier detection as
described in <code>GPT3.int8() : 8-bit Matrix Multiplication for Transformers at Scale</code> paper. Any hidden
states value that is above this threshold will be considered an outlier and the operation on those
values will be done in fp16. Values are usually normally distributed, that is, most values are in the
range [-3.5, 3.5], but there are some exceptional systematic outliers that are very differently
distributed for large models. These outliers are often in the interval [-60, -6] or [6, 60]. Int8
quantization works well for values of magnitude ~5, but beyond that, there is a significant performance
penalty. A good default threshold is 6, but a lower threshold might be needed for more unstable models
(small models, fine-tuning).`,name:"load_in_8bit_threshold"},{anchor:"transformers.PreTrainedModel.from_pretrained.load_in_8bit_skip_modules",description:`<strong>load_in_8bit_skip_modules</strong> (<code>List[str]</code>, <em>optional</em>) &#x2014;
An explicit list of the modules that we do not want to convert in 8-bit. This is useful for models such
as Jukebox that has several heads in different places and not necessarily at the last position.`,name:"load_in_8bit_skip_modules"},{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.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.25.1/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"}]}]}}),ft=new Bm({props:{$$slots:{default:[mx]},$$scope:{ctx:z}}}),ut=new Ne({props:{anchor:"transformers.PreTrainedModel.from_pretrained.example",$$slots:{default:[px]},$$scope:{ctx:z}}}),No=new k({props:{name:"get_input_embeddings",anchor:"transformers.PreTrainedModel.get_input_embeddings",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/modeling_utils.py#L1066",returnDescription:`
<p>A torch module mapping vocabulary to hidden states.</p>
`,returnType:`
<p><code>nn.Module</code></p>
`}}),Bo=new k({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.25.1/src/transformers/modeling_utils.py#L1656"}}),So=new k({props:{name:"get_output_embeddings",anchor:"transformers.PreTrainedModel.get_output_embeddings",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/modeling_utils.py#L1092",returnDescription:`
<p>A torch module mapping hidden states to vocabulary.</p>
`,returnType:`
<p><code>nn.Module</code></p>
`}}),Xo=new k({props:{name:"gradient_checkpointing_disable",anchor:"transformers.PreTrainedModel.gradient_checkpointing_disable",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/modeling_utils.py#L1476"}}),Vo=new k({props:{name:"gradient_checkpointing_enable",anchor:"transformers.PreTrainedModel.gradient_checkpointing_enable",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/modeling_utils.py#L1465"}}),Go=new k({props:{name:"init_weights",anchor:"transformers.PreTrainedModel.init_weights",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/modeling_utils.py#L1432"}}),Ro=new k({props:{name:"post_init",anchor:"transformers.PreTrainedModel.post_init",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/modeling_utils.py#L985"}}),Ho=new k({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.25.1/src/transformers/modeling_utils.py#L1448"}}),Yo=new k({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.25.1/src/transformers/modeling_utils.py#L2785"}}),wt=new Bm({props:{warning:!0,$$slots:{default:[hx]},$$scope:{ctx:z}}}),Jo=new k({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.25.1/src/transformers/modeling_utils.py#L1223",returnDescription:`
<p>Pointer to the input tokens Embeddings Module of the model.</p>
`,returnType:`
<p><code>torch.nn.Embedding</code></p>
`}}),Qo=new k({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 0x7fe13d86c310>"},{name:"push_to_hub",val:": bool = False"},{name:"max_shard_size",val:": typing.Union[int, str] = '10GB'"},{name:"safe_serialization",val:": bool = False"},{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>).</p>
<p>kwargs &#x2014;
Additional key word arguments passed along to the <a href="/docs/transformers/v4.25.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.push_to_hub">push_to_hub()</a> method.`,name:"safe_serialization"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/modeling_utils.py#L1496"}}),tr=new k({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.25.1/src/transformers/modeling_utils.py#L1079"}}),or=new k({props:{name:"tie_weights",anchor:"transformers.PreTrainedModel.tie_weights",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/modeling_utils.py#L1107"}}),ar=new Oe({}),sr=new U({props:{code:`from transformers import AutoModelForSeq2SeqLM

t0pp = AutoModelForSeq2SeqLM.from_pretrained("bigscience/T0pp", low_cpu_mem_usage=True)`,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 U({props:{code:`from transformers import AutoModelForSeq2SeqLM

t0pp = AutoModelForSeq2SeqLM.from_pretrained("bigscience/T0pp", device_map="auto")`,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>)`}}),dr=new U({props:{code:"t0pp.hf_device_map",highlighted:"t0pp.hf_device_map"}}),lr=new U({props:{code:`{'shared': 0,
 'decoder.embed_tokens': 0,
 'encoder': 0,
 'decoder.block.0': 0,
 'decoder.block.1': 1,
 'decoder.block.2': 1,
 'decoder.block.3': 1,
 'decoder.block.4': 1,
 'decoder.block.5': 1,
 'decoder.block.6': 1,
 'decoder.block.7': 1,
 'decoder.block.8': 1,
 'decoder.block.9': 1,
 'decoder.block.10': 1,
 'decoder.block.11': 1,
 'decoder.block.12': 1,
 'decoder.block.13': 1,
 'decoder.block.14': 1,
 'decoder.block.15': 1,
 'decoder.block.16': 1,
 'decoder.block.17': 1,
 'decoder.block.18': 1,
 'decoder.block.19': 1,
 'decoder.block.20': 1,
 'decoder.block.21': 1,
 'decoder.block.22': 'cpu',
 'decoder.block.23': 'cpu',
 'decoder.final_layer_norm': 'cpu',
 'decoder.dropout': 'cpu',
 'lm_head': 'cpu'}`,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>}`}}),cr=new U({props:{code:'device_map = {"shared": 0, "encoder": 0, "decoder": 1, "lm_head": 1}',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>}'}}),mr=new Oe({}),pr=new U({props:{code:'model = T5ForConditionalGeneration.from_pretrained("t5", torch_dtype=torch.float16)',highlighted:'model = T5ForConditionalGeneration.from_pretrained(<span class="hljs-string">&quot;t5&quot;</span>, torch_dtype=torch.float16)'}}),hr=new U({props:{code:'model = T5ForConditionalGeneration.from_pretrained("t5", torch_dtype="auto")',highlighted:'model = T5ForConditionalGeneration.from_pretrained(<span class="hljs-string">&quot;t5&quot;</span>, torch_dtype=<span class="hljs-string">&quot;auto&quot;</span>)'}}),fr=new U({props:{code:`config = T5Config.from_pretrained("t5")
model = AutoModel.from_config(config)`,highlighted:`config = T5Config.from_pretrained(<span class="hljs-string">&quot;t5&quot;</span>)
model = AutoModel.from_config(config)`}}),ur=new Oe({}),gr=new k({props:{name:"class transformers.modeling_utils.ModuleUtilsMixin",anchor:"transformers.modeling_utils.ModuleUtilsMixin",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/modeling_utils.py#L628"}}),br=new k({props:{name:"add_memory_hooks",anchor:"transformers.modeling_utils.ModuleUtilsMixin.add_memory_hooks",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/modeling_utils.py#L659"}}),vr=new k({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.25.1/src/transformers/modeling_utils.py#L863",returnDescription:`
<p>The total number of tokens.</p>
`,returnType:`
<p><code>int</code></p>
`}}),yr=new k({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.25.1/src/transformers/modeling_utils.py#L884",returnDescription:`
<p>The number of floating-point operations.</p>
`,returnType:`
<p><code>int</code></p>
`}}),wr=new k({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:": <property object at 0x7fe13accc720> = 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.25.1/src/transformers/modeling_utils.py#L747",returnDescription:`
<p><code>torch.Tensor</code> The extended attention mask, with a the same dtype as <code>attention_mask.dtype</code>.</p>
`}}),Tr=new k({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.
is_attention_chunked &#x2014; (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>):
Whether or not the attentions scores are computed by chunks or not.`,name:"num_hidden_layers"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/modeling_utils.py#L799",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>
`}}),xr=new k({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.25.1/src/transformers/modeling_utils.py#L695",returnDescription:`
<p>The inverted attention mask.</p>
`,returnType:`
<p><code>torch.Tensor</code></p>
`}}),kr=new k({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.25.1/src/transformers/modeling_utils.py#L837",returnDescription:`
<p>The number of parameters.</p>
`,returnType:`
<p><code>int</code></p>
`}}),Pr=new k({props:{name:"reset_memory_hooks_state",anchor:"transformers.modeling_utils.ModuleUtilsMixin.reset_memory_hooks_state",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/modeling_utils.py#L671"}}),Mr=new Oe({}),Er=new k({props:{name:"class transformers.TFPreTrainedModel",anchor:"transformers.TFPreTrainedModel",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/modeling_tf_utils.py#L1075"}}),jr=new k({props:{name:"push_to_hub",anchor:"transformers.TFPreTrainedModel.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:"**model_card_kwargs",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>).
model_card_kwargs &#x2014;
Additional keyword arguments passed along to the <a href="/docs/transformers/v4.25.1/en/main_classes/model#transformers.TFPreTrainedModel.create_model_card">create_model_card()</a> method.`,name:"max_shard_size"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/modeling_tf_utils.py#L2833"}}),Wt=new Ne({props:{anchor:"transformers.TFPreTrainedModel.push_to_hub.example",$$slots:{default:[fx]},$$scope:{ctx:z}}}),zr=new k({props:{name:"compile",anchor:"transformers.TFPreTrainedModel.compile",parameters:[{name:"optimizer",val:" = 'rmsprop'"},{name:"loss",val:" = 'passthrough'"},{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.25.1/src/transformers/modeling_tf_utils.py#L1382"}}),Ar=new k({props:{name:"create_model_card",anchor:"transformers.TFPreTrainedModel.create_model_card",parameters:[{name:"output_dir",val:""},{name:"model_name",val:": str"},{name:"language",val:": typing.Optional[str] = None"},{name:"license",val:": typing.Optional[str] = None"},{name:"tags",val:": typing.Optional[str] = None"},{name:"finetuned_from",val:": typing.Optional[str] = None"},{name:"tasks",val:": typing.Optional[str] = None"},{name:"dataset_tags",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"dataset",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"dataset_args",val:": typing.Union[str, typing.List[str], NoneType] = 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.25.1/src/transformers/modeling_tf_utils.py#L1673"}}),Cr=new k({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.25.1/src/transformers/modeling_tf_utils.py#L1158"}}),Ir=new k({props:{name:"from_pretrained",anchor:"transformers.TFPreTrainedModel.from_pretrained",parameters:[{name:"pretrained_model_name_or_path",val:""},{name:"*model_args",val:""},{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.25.1/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.25.1/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a>,</li>
<li>a string valid as input to <a href="/docs/transformers/v4.25.1/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.25.1/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.
from_pt &#x2014; (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>):
Load the model weights from a PyTorch state_dict save file (see docstring of
<code>pretrained_model_name_or_path</code> argument).</li>
</ul>`,name:"config"},{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.use_auth_token",description:`<strong>use_auth_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:"use_auth_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.25.1/src/transformers/modeling_tf_utils.py#L2351"}}),Gt=new Ne({props:{anchor:"transformers.TFPreTrainedModel.from_pretrained.example",$$slots:{default:[ux]},$$scope:{ctx:z}}}),Or=new k({props:{name:"get_bias",anchor:"transformers.TFPreTrainedModel.get_bias",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/modeling_tf_utils.py#L1813",returnDescription:`
<p>The weights representing the bias, None if not an LM model.</p>
`,returnType:`
<p><code>tf.Variable</code></p>
`}}),Nr=new k({props:{name:"get_input_embeddings",anchor:"transformers.TFPreTrainedModel.get_input_embeddings",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/modeling_tf_utils.py#L1202",returnDescription:`
<p>The embeddings layer mapping vocabulary to hidden states.</p>
`,returnType:`
<p><code>tf.Variable</code></p>
`}}),Br=new k({props:{name:"get_lm_head",anchor:"transformers.TFPreTrainedModel.get_lm_head",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/modeling_tf_utils.py#L1846",returnDescription:`
<p>The LM head layer if the model has one, None if not.</p>
`,returnType:`
<p><code>tf.keras.layers.Layer</code></p>
`}}),Wr=new k({props:{name:"get_output_embeddings",anchor:"transformers.TFPreTrainedModel.get_output_embeddings",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/modeling_tf_utils.py#L1753",returnDescription:`
<p>The new weights mapping vocabulary to hidden states.</p>
`,returnType:`
<p><code>tf.Variable</code></p>
`}}),Sr=new k({props:{name:"get_output_layer_with_bias",anchor:"transformers.TFPreTrainedModel.get_output_layer_with_bias",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/modeling_tf_utils.py#L1790",returnDescription:`
<p>The layer that handles the bias, None if not an LM model.</p>
`,returnType:`
<p><code>tf.keras.layers.Layer</code></p>
`}}),Xr=new k({props:{name:"get_prefix_bias_name",anchor:"transformers.TFPreTrainedModel.get_prefix_bias_name",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/modeling_tf_utils.py#L1803",returnDescription:`
<p>The _prefix name of the bias.</p>
`,returnType:`
<p><code>str</code></p>
`}}),Vr=new k({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.25.1/src/transformers/modeling_tf_utils.py#L1229",returnDescription:`
<p>A dictionary of extra metadata from the checkpoint, most commonly an \u201Cepoch\u201D count.</p>
`,returnType:`
<p><code>dict</code></p>
`}}),Gr=new k({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:": typing.Optional[ForwardRef('PreTrainedTokenizerBase')] = None"},{name:"collate_fn",val:": typing.Optional[typing.Callable] = None"},{name:"collate_fn_args",val:": typing.Union[typing.Dict[str, typing.Any], NoneType] = None"},{name:"drop_remainder",val:": typing.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.25.1/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.25.1/src/transformers/modeling_tf_utils.py#L1283",returnDescription:`
<p>A <code>tf.data.Dataset</code> which is ready to pass to the Keras API.</p>
`,returnType:`
<p><code>Dataset</code></p>
`}}),Hr=new k({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.25.1/src/transformers/modeling_tf_utils.py#L2193"}}),Yr=new k({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.25.1/src/transformers/modeling_tf_utils.py#L2923"}}),oo=new Bm({props:{warning:!0,$$slots:{default:[gx]},$$scope:{ctx:z}}}),Jr=new k({props:{name:"resize_token_embeddings",anchor:"transformers.TFPreTrainedModel.resize_token_embeddings",parameters:[{name:"new_num_tokens",val:": typing.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.25.1/src/transformers/modeling_tf_utils.py#L1855",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>
`}}),Qr=new k({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:": typing.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>).</p>
<p>kwargs &#x2014;
Additional key word arguments passed along to the <a href="/docs/transformers/v4.25.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.push_to_hub">push_to_hub()</a> method.`,name:"safe_serialization"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/modeling_tf_utils.py#L2205"}}),ta=new k({props:{name:"serving",anchor:"transformers.TFPreTrainedModel.serving",parameters:[{name:"inputs",val:""}],parametersDescription:[{anchor:"transformers.TFPreTrainedModel.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"}]}}),oa=new k({props:{name:"serving_output",anchor:"transformers.TFPreTrainedModel.serving_output",parameters:[{name:"output",val:""}],parametersDescription:[{anchor:"transformers.TFPreTrainedModel.serving_output.output",description:`<strong>output</strong> (<code>TFBaseModelOutput</code>) &#x2014;
The output returned by the model.`,name:"output"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/modeling_tf_utils.py#L1192"}}),ra=new k({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.25.1/src/transformers/modeling_tf_utils.py#L1830"}}),aa=new k({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.25.1/src/transformers/modeling_tf_utils.py#L1733"}}),na=new k({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.25.1/src/transformers/modeling_tf_utils.py#L1773"}}),sa=new k({props:{name:"test_step",anchor:"transformers.TFPreTrainedModel.test_step",parameters:[{name:"data",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/modeling_tf_utils.py#L1570"}}),da=new k({props:{name:"train_step",anchor:"transformers.TFPreTrainedModel.train_step",parameters:[{name:"data",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/modeling_tf_utils.py#L1462"}}),ca=new Oe({}),ma=new k({props:{name:"class transformers.modeling_tf_utils.TFModelUtilsMixin",anchor:"transformers.modeling_tf_utils.TFModelUtilsMixin",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/modeling_tf_utils.py#L112"}}),ha=new k({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.25.1/src/transformers/modeling_tf_utils.py#L117",returnDescription:`
<p>The number of parameters.</p>
`,returnType:`
<p><code>int</code></p>
`}}),fa=new Oe({}),ua=new k({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.25.1/src/transformers/modeling_flax_utils.py#L157"}}),ga=new k({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:"**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"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/utils/hub.py#L712"}}),go=new Ne({props:{anchor:"transformers.FlaxPreTrainedModel.push_to_hub.example",$$slots:{default:[_x]},$$scope:{ctx:z}}}),ba=new k({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:"**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.25.1/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.25.1/en/main_classes/model#transformers.FlaxPreTrainedModel.to_fp16">to_fp16()</a> and
<a href="/docs/transformers/v4.25.1/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.25.1/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a>,</li>
<li>a string or path valid as input to <a href="/docs/transformers/v4.25.1/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.25.1/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.use_auth_token",description:`<strong>use_auth_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:"use_auth_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.25.1/src/transformers/modeling_flax_utils.py#L470"}}),_o=new Ne({props:{anchor:"transformers.FlaxPreTrainedModel.from_pretrained.example",$$slots:{default:[bx]},$$scope:{ctx:z}}}),$a=new k({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.25.1/src/transformers/modeling_flax_utils.py#L423",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>
`}}),Ta=new k({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.25.1/src/transformers/modeling_flax_utils.py#L1047"}}),bo=new Bm({props:{warning:!0,$$slots:{default:[vx]},$$scope:{ctx:z}}}),xa=new k({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>
<p>kwargs &#x2014;
Additional key word arguments passed along to the <a href="/docs/transformers/v4.25.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.push_to_hub">push_to_hub()</a> method.`,name:"max_shard_size"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/modeling_flax_utils.py#L950"}}),Pa=new k({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.25.1/src/transformers/modeling_flax_utils.py#L318"}}),yo=new Ne({props:{anchor:"transformers.FlaxPreTrainedModel.to_bf16.example",$$slots:{default:[yx]},$$scope:{ctx:z}}}),Ma=new k({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.25.1/src/transformers/modeling_flax_utils.py#L384"}}),$o=new Ne({props:{anchor:"transformers.FlaxPreTrainedModel.to_fp16.example",$$slots:{default:[$x]},$$scope:{ctx:z}}}),Ea=new k({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.25.1/src/transformers/modeling_flax_utils.py#L357"}}),wo=new Ne({props:{anchor:"transformers.FlaxPreTrainedModel.to_fp32.example",$$slots:{default:[wx]},$$scope:{ctx:z}}}),Fa=new Oe({}),ja=new k({props:{name:"class transformers.utils.PushToHubMixin",anchor:"transformers.utils.PushToHubMixin",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/utils/hub.py#L627"}}),Da=new k({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:"**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"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/utils/hub.py#L712"}}),xo=new Ne({props:{anchor:"transformers.utils.PushToHubMixin.push_to_hub.example",$$slots:{default:[Tx]},$$scope:{ctx:z}}}),Aa=new Oe({}),qa=new k({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"}],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"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/modeling_utils.py#L323",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(){h=r("meta"),P=d(),w=r("h1"),f=r("a"),E=r("span"),u(c.$$.fragment),T=d(),nt=r("span"),Wm=s("Models"),Fl=d(),K=r("p"),Sm=s("The base classes "),Sa=r("a"),Xm=s("PreTrainedModel"),Vm=s(", "),Xa=r("a"),Gm=s("TFPreTrainedModel"),Rm=s(`, and
`),Va=r("a"),Hm=s("FlaxPreTrainedModel"),Ym=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).`),jl=d(),We=r("p"),Ga=r("a"),Jm=s("PreTrainedModel"),Km=s(" and "),Ra=r("a"),Zm=s("TFPreTrainedModel"),Qm=s(` also implement a few methods which
are common among all the models to:`),Dl=d(),st=r("ul"),Hn=r("li"),ep=s("resize the input token embeddings when new tokens are added to the vocabulary"),tp=d(),Yn=r("li"),op=s("prune the attention heads of the model."),zl=d(),O=r("p"),rp=s("The other methods that are common to each model are defined in "),Ha=r("a"),ap=s("ModuleUtilsMixin"),np=s(`
(for the PyTorch models) and `),Jn=r("code"),sp=s("~modeling_tf_utils.TFModuleUtilsMixin"),ip=s(` (for the TensorFlow models) or
for text generation, `),Ya=r("a"),dp=s("GenerationMixin"),lp=s(` (for the PyTorch models),
`),Ja=r("a"),cp=s("TFGenerationMixin"),mp=s(` (for the TensorFlow models) and
`),Ka=r("a"),pp=s("FlaxGenerationMixin"),hp=s(" (for the Flax/JAX models)."),Al=d(),Se=r("h2"),it=r("a"),Kn=r("span"),u(Do.$$.fragment),fp=d(),Zn=r("span"),up=s("PreTrainedModel"),ql=d(),F=r("div"),u(zo.$$.fragment),gp=d(),Qn=r("p"),_p=s("Base class for all models."),bp=d(),Za=r("p"),Qa=r("a"),vp=s("PreTrainedModel"),yp=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:`),$p=d(),Ao=r("ul"),es=r("li"),wp=s("resize the input embeddings,"),Tp=d(),ts=r("li"),xp=s("prune heads in the self-attention heads."),kp=d(),os=r("p"),Pp=s("Class attributes (overridden by derived classes):"),Mp=d(),V=r("ul"),rs=r("li"),ce=r("p"),as=r("strong"),Ep=s("config_class"),Fp=s(" ("),en=r("a"),jp=s("PretrainedConfig"),Dp=s(") \u2014 A subclass of "),tn=r("a"),zp=s("PretrainedConfig"),Ap=s(` to use as configuration class
for this model architecture.`),qp=d(),qo=r("li"),me=r("p"),ns=r("strong"),Cp=s("load_tf_weights"),Ip=s(" ("),ss=r("code"),Lp=s("Callable"),Up=s(") \u2014 A python "),is=r("em"),Op=s("method"),Np=s(` for loading a TensorFlow checkpoint in a PyTorch model,
taking as arguments:`),Bp=d(),Xe=r("ul"),dt=r("li"),ds=r("strong"),Wp=s("model"),Sp=s(" ("),on=r("a"),Xp=s("PreTrainedModel"),Vp=s(") \u2014 An instance of the model on which to load the TensorFlow checkpoint."),Gp=d(),lt=r("li"),ls=r("strong"),Rp=s("config"),Hp=s(" ("),cs=r("code"),Yp=s("PreTrainedConfig"),Jp=s(") \u2014 An instance of the configuration associated to the model."),Kp=d(),ct=r("li"),ms=r("strong"),Zp=s("path"),Qp=s(" ("),ps=r("code"),eh=s("str"),th=s(") \u2014 A path to the TensorFlow checkpoint."),oh=d(),hs=r("li"),mt=r("p"),fs=r("strong"),rh=s("base_model_prefix"),ah=s(" ("),us=r("code"),nh=s("str"),sh=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.`),ih=d(),gs=r("li"),pt=r("p"),_s=r("strong"),dh=s("is_parallelizable"),lh=s(" ("),bs=r("code"),ch=s("bool"),mh=s(") \u2014 A flag indicating whether this model supports model parallelization."),ph=d(),vs=r("li"),N=r("p"),ys=r("strong"),hh=s("main_input_name"),fh=s(" ("),$s=r("code"),uh=s("str"),gh=s(") \u2014 The name of the principal input to the model (often "),ws=r("code"),_h=s("input_ids"),bh=s(` for NLP
models, `),Ts=r("code"),vh=s("pixel_values"),yh=s(" for vision models and "),xs=r("code"),$h=s("input_values"),wh=s(" for speech models)."),Th=d(),pe=r("div"),u(Co.$$.fragment),xh=d(),Io=r("p"),kh=s(`Upload the model file to the \u{1F917} Model Hub while synchronizing a local clone of the repo in
`),ks=r("code"),Ph=s("repo_path_or_name"),Mh=s("."),Eh=d(),u(ht.$$.fragment),Fh=d(),A=r("div"),u(Lo.$$.fragment),jh=d(),Ps=r("p"),Dh=s("Instantiate a pretrained pytorch model from a pre-trained model configuration."),zh=d(),Ve=r("p"),Ah=s("The model is set in evaluation mode by default using "),Ms=r("code"),qh=s("model.eval()"),Ch=s(` (Dropout modules are deactivated). To train
the model, you should first set it back in training mode with `),Es=r("code"),Ih=s("model.train()"),Lh=s("."),Uh=d(),Uo=r("p"),Oh=s("The warning "),Fs=r("em"),Nh=s("Weights from XXX not initialized from pretrained model"),Bh=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.`),Wh=d(),Oo=r("p"),Sh=s("The warning "),js=r("em"),Xh=s("Weights from XXX not used in YYY"),Vh=s(` means that the layer XXX is not used by YYY, therefore those
weights are discarded.`),Gh=d(),u(ft.$$.fragment),Rh=d(),u(ut.$$.fragment),Hh=d(),Ds=r("ul"),rn=r("li"),zs=r("code"),Yh=s("low_cpu_mem_usage"),Jh=s(" algorithm:"),Kh=d(),As=r("p"),Zh=s("This is an experimental function that loads the model using ~1x model size CPU memory"),Qh=d(),qs=r("p"),ef=s("Here is how it works:"),tf=d(),G=r("ol"),Cs=r("li"),of=s("save which state_dict keys we have"),rf=d(),Is=r("li"),af=s("drop state_dict before the model is created, since the latter takes 1x model size CPU memory"),nf=d(),Ls=r("li"),sf=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`),df=d(),Us=r("li"),lf=s("load state_dict 2nd time"),cf=d(),Os=r("li"),mf=s("replace the params/buffers from the state_dict"),pf=d(),Ns=r("p"),hf=s("Currently, it can\u2019t handle deepspeed ZeRO stage 3 and ignores loading errors"),ff=d(),gt=r("div"),u(No.$$.fragment),uf=d(),Bs=r("p"),gf=s("Returns the model\u2019s input embeddings."),_f=d(),_t=r("div"),u(Bo.$$.fragment),bf=d(),an=r("p"),vf=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: `),Wo=r("a"),yf=s("https://discuss.pytorch.org/t/gpu-memory-that-model-uses/56822/2"),$f=d(),bt=r("div"),u(So.$$.fragment),wf=d(),Ws=r("p"),Tf=s("Returns the model\u2019s output embeddings."),xf=d(),he=r("div"),u(Xo.$$.fragment),kf=d(),Ss=r("p"),Pf=s("Deactivates gradient checkpointing for the current model."),Mf=d(),Xs=r("p"),Ef=s(`Note that in other frameworks this feature can be referred to as \u201Cactivation checkpointing\u201D or \u201Ccheckpoint
activations\u201D.`),Ff=d(),fe=r("div"),u(Vo.$$.fragment),jf=d(),Vs=r("p"),Df=s("Activates gradient checkpointing for the current model."),zf=d(),Gs=r("p"),Af=s(`Note that in other frameworks this feature can be referred to as \u201Cactivation checkpointing\u201D or \u201Ccheckpoint
activations\u201D.`),qf=d(),vt=r("div"),u(Go.$$.fragment),Cf=d(),Rs=r("p"),If=s("If needed prunes and maybe initializes weights."),Lf=d(),yt=r("div"),u(Ro.$$.fragment),Uf=d(),Hs=r("p"),Of=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).`),Nf=d(),$t=r("div"),u(Ho.$$.fragment),Bf=d(),Ys=r("p"),Wf=s("Prunes heads of the base model."),Sf=d(),ue=r("div"),u(Yo.$$.fragment),Xf=d(),Js=r("p"),Vf=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.`),Gf=d(),u(wt.$$.fragment),Rf=d(),ge=r("div"),u(Jo.$$.fragment),Hf=d(),Ko=r("p"),Yf=s("Resizes input token embeddings matrix of the model if "),Ks=r("code"),Jf=s("new_num_tokens != config.vocab_size"),Kf=s("."),Zf=d(),Zo=r("p"),Qf=s("Takes care of tying weights embeddings afterwards if the model class has a "),Zs=r("code"),eu=s("tie_weights()"),tu=s(" method."),ou=d(),Tt=r("div"),u(Qo.$$.fragment),ru=d(),er=r("p"),au=s(`Save a model and its configuration file to a directory, so that it can be re-loaded using the
`),nn=r("a"),nu=s("from_pretrained()"),su=s(" class method."),iu=d(),xt=r("div"),u(tr.$$.fragment),du=d(),Qs=r("p"),lu=s("Set model\u2019s input embeddings."),cu=d(),_e=r("div"),u(or.$$.fragment),mu=d(),ei=r("p"),pu=s("Tie the weights between the input embeddings and the output embeddings."),hu=d(),rr=r("p"),fu=s("If the "),ti=r("code"),uu=s("torchscript"),gu=s(` flag is set in the configuration, can\u2019t handle parameter sharing so we are cloning the
weights instead.`),Cl=d(),sn=r("a"),Il=d(),Ge=r("h3"),kt=r("a"),oi=r("span"),u(ar.$$.fragment),_u=d(),ri=r("span"),bu=s("Large model loading"),Ll=d(),be=r("p"),vu=s("In Transformers 4.20.0, the "),dn=r("a"),yu=s("from_pretrained()"),$u=s(" method has been reworked to accommodate large models using "),nr=r("a"),wu=s("Accelerate"),Tu=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."),Ul=d(),Pt=r("p"),xu=s("This option can be activated with "),ai=r("code"),ku=s("low_cpu_mem_usage=True"),Pu=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."),Ol=d(),u(sr.$$.fragment),Nl=d(),Mt=r("p"),Mu=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 "),ni=r("code"),Eu=s('device_map="auto"'),Fu=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."),Bl=d(),Z=r("p"),ju=s("When passing a "),si=r("code"),Du=s("device_map"),zu=s(", "),ii=r("code"),Au=s("low_cpu_mem_usage"),qu=s(" is automatically set to "),di=r("code"),Cu=s("True"),Iu=s(", so you don\u2019t need to specify it:"),Wl=d(),u(ir.$$.fragment),Sl=d(),Et=r("p"),Lu=s("You can inspect how the model was split across devices by looking at its "),li=r("code"),Uu=s("hf_device_map"),Ou=s(" attribute:"),Xl=d(),u(dr.$$.fragment),Vl=d(),u(lr.$$.fragment),Gl=d(),ln=r("p"),Nu=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 submosules 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):"),Rl=d(),u(cr.$$.fragment),Hl=d(),Ft=r("p"),Bu=s("Another way to minimize the memory impact of your model is to instantiate it at a lower precision dtype (like "),ci=r("code"),Wu=s("torch.float16"),Su=s(") or use direct quantization techniques as described below."),Yl=d(),Re=r("h3"),jt=r("a"),mi=r("span"),u(mr.$$.fragment),Xu=d(),pi=r("span"),Vu=s("Model Instantiation dtype"),Jl=d(),Q=r("p"),Gu=s("Under Pytorch a model normally gets instantiated with "),hi=r("code"),Ru=s("torch.float32"),Hu=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 `),fi=r("code"),Yu=s("dtype"),Ju=s(" using "),ui=r("code"),Ku=s("torch_dtype"),Zu=s(" argument:"),Kl=d(),u(pr.$$.fragment),Zl=d(),ve=r("p"),Qu=s("or, if you want the model to always load in the most optimal memory pattern, you can use the special value "),gi=r("code"),eg=s('"auto"'),tg=s(`,
and then `),_i=r("code"),og=s("dtype"),rg=s(" will be automatically derived from the model\u2019s weights:"),Ql=d(),u(hr.$$.fragment),ec=d(),Dt=r("p"),ag=s("Models instantiated from scratch can also be told which "),bi=r("code"),ng=s("dtype"),sg=s(" to use with:"),tc=d(),u(fr.$$.fragment),oc=d(),cn=r("p"),ig=s("Due to Pytorch design, this functionality is only available for floating dtypes."),rc=d(),He=r("h2"),zt=r("a"),vi=r("span"),u(ur.$$.fragment),dg=d(),yi=r("span"),lg=s("ModuleUtilsMixin"),ac=d(),C=r("div"),u(gr.$$.fragment),cg=d(),_r=r("p"),mg=s("A few utilities for "),$i=r("code"),pg=s("torch.nn.Modules"),hg=s(", to be used as a mixin."),fg=d(),ye=r("div"),u(br.$$.fragment),ug=d(),wi=r("p"),gg=s("Add a memory hook before and after each sub-module forward pass to record increase in memory consumption."),_g=d(),Ye=r("p"),bg=s("Increase in memory consumption is stored in a "),Ti=r("code"),vg=s("mem_rss_diff"),yg=s(` attribute for each module and can be reset to zero
with `),xi=r("code"),$g=s("model.reset_memory_hooks_state()"),wg=s("."),Tg=d(),At=r("div"),u(vr.$$.fragment),xg=d(),ki=r("p"),kg=s("Helper function to estimate the total number of tokens from the model inputs."),Pg=d(),qt=r("div"),u(yr.$$.fragment),Mg=d(),Je=r("p"),Eg=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"),Fg=s("12 * d_model << sequence_length"),jg=s(") as laid out in "),$r=r("a"),Dg=s(`this
paper`),zg=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.`),Ag=d(),Ct=r("div"),u(wr.$$.fragment),qg=d(),Mi=r("p"),Cg=s("Makes broadcastable attention and causal masks so that future and masked tokens are ignored."),Ig=d(),It=r("div"),u(Tr.$$.fragment),Lg=d(),Ei=r("p"),Ug=s("Prepare the head mask if needed."),Og=d(),Lt=r("div"),u(xr.$$.fragment),Ng=d(),Fi=r("p"),Bg=s("Invert an attention mask (e.g., switches 0. and 1.)."),Wg=d(),Ut=r("div"),u(kr.$$.fragment),Sg=d(),ji=r("p"),Xg=s("Get number of (optionally, trainable or non-embeddings) parameters in the module."),Vg=d(),Ot=r("div"),u(Pr.$$.fragment),Gg=d(),Ke=r("p"),Rg=s("Reset the "),Di=r("code"),Hg=s("mem_rss_diff"),Yg=s(" attribute of each module (see "),mn=r("a"),Jg=s("add_memory_hooks()"),Kg=s(")."),nc=d(),Ze=r("h2"),Nt=r("a"),zi=r("span"),u(Mr.$$.fragment),Zg=d(),Ai=r("span"),Qg=s("TFPreTrainedModel"),sc=d(),x=r("div"),u(Er.$$.fragment),e_=d(),qi=r("p"),t_=s("Base class for all TF models."),o_=d(),pn=r("p"),hn=r("a"),r_=s("TFPreTrainedModel"),a_=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:`),n_=d(),Fr=r("ul"),Ci=r("li"),s_=s("resize the input embeddings,"),i_=d(),Ii=r("li"),d_=s("prune heads in the self-attention heads."),l_=d(),Li=r("p"),c_=s("Class attributes (overridden by derived classes):"),m_=d(),Qe=r("ul"),$e=r("li"),Ui=r("strong"),p_=s("config_class"),h_=s(" ("),fn=r("a"),f_=s("PretrainedConfig"),u_=s(") \u2014 A subclass of "),un=r("a"),g_=s("PretrainedConfig"),__=s(` to use as configuration class
for this model architecture.`),b_=d(),Bt=r("li"),Oi=r("strong"),v_=s("base_model_prefix"),y_=s(" ("),Ni=r("code"),$_=s("str"),w_=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.`),T_=d(),B=r("li"),Bi=r("strong"),x_=s("main_input_name"),k_=s(" ("),Wi=r("code"),P_=s("str"),M_=s(") \u2014 The name of the principal input to the model (often "),Si=r("code"),E_=s("input_ids"),F_=s(` for NLP
models, `),Xi=r("code"),j_=s("pixel_values"),D_=s(" for vision models and "),Vi=r("code"),z_=s("input_values"),A_=s(" for speech models)."),q_=d(),we=r("div"),u(jr.$$.fragment),C_=d(),Dr=r("p"),I_=s("Upload the model files to the \u{1F917} Model Hub while synchronizing a local clone of the repo in "),Gi=r("code"),L_=s("repo_path_or_name"),U_=s("."),O_=d(),u(Wt.$$.fragment),N_=d(),St=r("div"),u(zr.$$.fragment),B_=d(),Ri=r("p"),W_=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.`),S_=d(),Xt=r("div"),u(Ar.$$.fragment),X_=d(),qr=r("p"),V_=s("Creates a draft of a model card using the information available to the "),Hi=r("code"),G_=s("Trainer"),R_=s("."),H_=d(),Vt=r("div"),u(Cr.$$.fragment),Y_=d(),Yi=r("p"),J_=s(`Method used for serving the model. Intended not to be compiled with a tf.function decorator so that we can use
it to generate multiple signatures later.`),K_=d(),W=r("div"),u(Ir.$$.fragment),Z_=d(),Ji=r("p"),Q_=s("Instantiate a pretrained TF 2.0 model from a pre-trained model configuration."),eb=d(),Lr=r("p"),tb=s("The warning "),Ki=r("em"),ob=s("Weights from XXX not initialized from pretrained model"),rb=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.`),ab=d(),Ur=r("p"),nb=s("The warning "),Zi=r("em"),sb=s("Weights from XXX not used in YYY"),ib=s(` means that the layer XXX is not used by YYY, therefore those
weights are discarded.`),db=d(),u(Gt.$$.fragment),lb=d(),Rt=r("div"),u(Or.$$.fragment),cb=d(),Qi=r("p"),mb=s("Dict of bias attached to an LM head. The key represents the name of the bias attribute."),pb=d(),Ht=r("div"),u(Nr.$$.fragment),hb=d(),ed=r("p"),fb=s("Returns the model\u2019s input embeddings layer."),ub=d(),Yt=r("div"),u(Br.$$.fragment),gb=d(),td=r("p"),_b=s("The LM Head layer. This method must be overwritten by all the models that have a lm head."),bb=d(),Jt=r("div"),u(Wr.$$.fragment),vb=d(),od=r("p"),yb=s("Returns the model\u2019s output embeddings"),$b=d(),Kt=r("div"),u(Sr.$$.fragment),wb=d(),rd=r("p"),Tb=s(`Get the layer that handles a bias attribute in case the model has an LM head with weights tied to the
embeddings`),xb=d(),Zt=r("div"),u(Xr.$$.fragment),kb=d(),ad=r("p"),Pb=s("Get the concatenated _prefix name of the bias from the model name to the parent layer"),Mb=d(),Qt=r("div"),u(Vr.$$.fragment),Eb=d(),nd=r("p"),Fb=s(`Loads a saved checkpoint (model weights and optimizer state) from a repo. Returns the current epoch count when
the checkpoint was made.`),jb=d(),eo=r("div"),u(Gr.$$.fragment),Db=d(),R=r("p"),zb=s("Wraps a HuggingFace "),Rr=r("a"),Ab=s("Dataset"),qb=s(" as a "),sd=r("code"),Cb=s("tf.data.Dataset"),Ib=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 `),id=r("code"),Lb=s("fit()"),Ub=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 `),dd=r("code"),Ob=s("Dataset.to_tf_dataset()"),Nb=s(" instead."),Bb=d(),to=r("div"),u(Hr.$$.fragment),Wb=d(),ld=r("p"),Sb=s("Prunes heads of the base model."),Xb=d(),Te=r("div"),u(Yr.$$.fragment),Vb=d(),cd=r("p"),Gb=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.`),Rb=d(),u(oo.$$.fragment),Hb=d(),xe=r("div"),u(Jr.$$.fragment),Yb=d(),Kr=r("p"),Jb=s("Resizes input token embeddings matrix of the model if "),md=r("code"),Kb=s("new_num_tokens != config.vocab_size"),Zb=s("."),Qb=d(),Zr=r("p"),ev=s("Takes care of tying weights embeddings afterwards if the model class has a "),pd=r("code"),tv=s("tie_weights()"),ov=s(" method."),rv=d(),ro=r("div"),u(Qr.$$.fragment),av=d(),ea=r("p"),nv=s(`Save a model and its configuration file to a directory, so that it can be re-loaded using the
`),gn=r("a"),sv=s("from_pretrained()"),iv=s(" class method."),dv=d(),ao=r("div"),u(ta.$$.fragment),lv=d(),hd=r("p"),cv=s("Method used for serving the model."),mv=d(),no=r("div"),u(oa.$$.fragment),pv=d(),fd=r("p"),hv=s("Prepare the output of the saved model. Each model must implement this function."),fv=d(),so=r("div"),u(ra.$$.fragment),uv=d(),ud=r("p"),gv=s("Set all the bias in the LM head."),_v=d(),io=r("div"),u(aa.$$.fragment),bv=d(),gd=r("p"),vv=s("Set model\u2019s input embeddings"),yv=d(),lo=r("div"),u(na.$$.fragment),$v=d(),_d=r("p"),wv=s("Set model\u2019s output embeddings"),Tv=d(),co=r("div"),u(sa.$$.fragment),xv=d(),ia=r("p"),kv=s("A modification of Keras\u2019s default "),bd=r("code"),Pv=s("train_step"),Mv=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.`),Ev=d(),mo=r("div"),u(da.$$.fragment),Fv=d(),la=r("p"),jv=s("A modification of Keras\u2019s default "),vd=r("code"),Dv=s("train_step"),zv=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.`),ic=d(),et=r("h2"),po=r("a"),yd=r("span"),u(ca.$$.fragment),Av=d(),$d=r("span"),qv=s("TFModelUtilsMixin"),dc=d(),re=r("div"),u(ma.$$.fragment),Cv=d(),pa=r("p"),Iv=s("A few utilities for "),wd=r("code"),Lv=s("tf.keras.Model"),Uv=s(", to be used as a mixin."),Ov=d(),ho=r("div"),u(ha.$$.fragment),Nv=d(),Td=r("p"),Bv=s("Get the number of (optionally, trainable) parameters in the model."),lc=d(),tt=r("h2"),fo=r("a"),xd=r("span"),u(fa.$$.fragment),Wv=d(),kd=r("span"),Sv=s("FlaxPreTrainedModel"),cc=d(),D=r("div"),u(ua.$$.fragment),Xv=d(),Pd=r("p"),Vv=s("Base class for all models."),Gv=d(),_n=r("p"),bn=r("a"),Rv=s("FlaxPreTrainedModel"),Hv=s(` takes care of storing the configuration of the models and handles methods for loading,
downloading and saving models.`),Yv=d(),Md=r("p"),Jv=s("Class attributes (overridden by derived classes):"),Kv=d(),ot=r("ul"),ke=r("li"),Ed=r("strong"),Zv=s("config_class"),Qv=s(" ("),vn=r("a"),ey=s("PretrainedConfig"),ty=s(") \u2014 A subclass of "),yn=r("a"),oy=s("PretrainedConfig"),ry=s(` to use as configuration class
for this model architecture.`),ay=d(),uo=r("li"),Fd=r("strong"),ny=s("base_model_prefix"),sy=s(" ("),jd=r("code"),iy=s("str"),dy=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.`),ly=d(),S=r("li"),Dd=r("strong"),cy=s("main_input_name"),my=s(" ("),zd=r("code"),py=s("str"),hy=s(") \u2014 The name of the principal input to the model (often "),Ad=r("code"),fy=s("input_ids"),uy=s(` for NLP
models, `),qd=r("code"),gy=s("pixel_values"),_y=s(" for vision models and "),Cd=r("code"),by=s("input_values"),vy=s(" for speech models)."),yy=d(),Pe=r("div"),u(ga.$$.fragment),$y=d(),_a=r("p"),wy=s(`Upload the model checkpoint to the \u{1F917} Model Hub while synchronizing a local clone of the repo in
`),Id=r("code"),Ty=s("repo_path_or_name"),xy=s("."),ky=d(),u(go.$$.fragment),Py=d(),X=r("div"),u(ba.$$.fragment),My=d(),Ld=r("p"),Ey=s("Instantiate a pretrained flax model from a pre-trained model configuration."),Fy=d(),va=r("p"),jy=s("The warning "),Ud=r("em"),Dy=s("Weights from XXX not initialized from pretrained model"),zy=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.`),Ay=d(),ya=r("p"),qy=s("The warning "),Od=r("em"),Cy=s("Weights from XXX not used in YYY"),Iy=s(` means that the layer XXX is not used by YYY, therefore those
weights are discarded.`),Ly=d(),u(_o.$$.fragment),Uy=d(),Me=r("div"),u($a.$$.fragment),Oy=d(),wa=r("p"),Ny=s("This is the same as "),Nd=r("code"),By=s("flax.serialization.from_bytes"),Wy=s(`
(https:lax.readthedocs.io/en/latest/_modules/flax/serialization.html#from_bytes) but for a sharded checkpoint.`),Sy=d(),Bd=r("p"),Xy=s(`This load is performed efficiently: each checkpoint shard is loaded one by one in RAM and deleted after being
loaded in the model.`),Vy=d(),Ee=r("div"),u(Ta.$$.fragment),Gy=d(),Wd=r("p"),Ry=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.`),Hy=d(),u(bo.$$.fragment),Yy=d(),vo=r("div"),u(xa.$$.fragment),Jy=d(),ka=r("p"),Ky=s(`Save a model and its configuration file to a directory, so that it can be re-loaded using the
`),Sd=r("code"),Zy=s("[from_pretrained()](/docs/transformers/v4.25.1/en/main_classes/model#transformers.FlaxPreTrainedModel.from_pretrained)"),Qy=s(" class method"),e1=d(),ee=r("div"),u(Pa.$$.fragment),t1=d(),H=r("p"),o1=s("Cast the floating-point "),Xd=r("code"),r1=s("params"),a1=s(" to "),Vd=r("code"),n1=s("jax.numpy.bfloat16"),s1=s(". This returns a new "),Gd=r("code"),i1=s("params"),d1=s(` tree and does not cast
the `),Rd=r("code"),l1=s("params"),c1=s(" in place."),m1=d(),Hd=r("p"),p1=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.`),h1=d(),u(yo.$$.fragment),f1=d(),te=r("div"),u(Ma.$$.fragment),u1=d(),Y=r("p"),g1=s("Cast the floating-point "),Yd=r("code"),_1=s("parmas"),b1=s(" to "),Jd=r("code"),v1=s("jax.numpy.float16"),y1=s(". This returns a new "),Kd=r("code"),$1=s("params"),w1=s(` tree and does not cast the
`),Zd=r("code"),T1=s("params"),x1=s(" in place."),k1=d(),Qd=r("p"),P1=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.`),M1=d(),u($o.$$.fragment),E1=d(),Fe=r("div"),u(Ea.$$.fragment),F1=d(),J=r("p"),j1=s("Cast the floating-point "),el=r("code"),D1=s("parmas"),z1=s(" to "),tl=r("code"),A1=s("jax.numpy.float32"),q1=s(`. This method can be used to explicitly convert the
model parameters to fp32 precision. This returns a new `),ol=r("code"),C1=s("params"),I1=s(" tree and does not cast the "),rl=r("code"),L1=s("params"),U1=s(" in place."),O1=d(),u(wo.$$.fragment),mc=d(),rt=r("h2"),To=r("a"),al=r("span"),u(Fa.$$.fragment),N1=d(),nl=r("span"),B1=s("Pushing to the Hub"),pc=d(),ae=r("div"),u(ja.$$.fragment),W1=d(),sl=r("p"),S1=s("A Mixin containing the functionality to push a model or tokenizer to the hub."),X1=d(),je=r("div"),u(Da.$$.fragment),V1=d(),za=r("p"),G1=s(`Upload the {object_files} to the \u{1F917} Model Hub while synchronizing a local clone of the repo in
`),il=r("code"),R1=s("repo_path_or_name"),H1=s("."),Y1=d(),u(xo.$$.fragment),hc=d(),at=r("h2"),ko=r("a"),dl=r("span"),u(Aa.$$.fragment),J1=d(),ll=r("span"),K1=s("Sharded checkpoints"),fc=d(),ne=r("div"),u(qa.$$.fragment),Z1=d(),Ca=r("p"),Q1=s(`This is the same as
`),Ia=r("a"),cl=r("code"),e2=s("torch.nn.Module.load_state_dict"),t2=s(`
but for a sharded checkpoint.`),o2=d(),ml=r("p"),r2=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 p=dx('[data-svelte="svelte-1phssyn"]',document.head);h=a(p,"META",{name:!0,content:!0}),p.forEach(t),P=l(o),w=a(o,"H1",{class:!0});var La=n(w);f=a(La,"A",{id:!0,class:!0,href:!0});var pl=n(f);E=a(pl,"SPAN",{});var hl=n(E);g(c.$$.fragment,hl),hl.forEach(t),pl.forEach(t),T=l(La),nt=a(La,"SPAN",{});var fl=n(nt);Wm=i(fl,"Models"),fl.forEach(t),La.forEach(t),Fl=l(o),K=a(o,"P",{});var se=n(K);Sm=i(se,"The base classes "),Sa=a(se,"A",{href:!0});var ul=n(Sa);Xm=i(ul,"PreTrainedModel"),ul.forEach(t),Vm=i(se,", "),Xa=a(se,"A",{href:!0});var gl=n(Xa);Gm=i(gl,"TFPreTrainedModel"),gl.forEach(t),Rm=i(se,`, and
`),Va=a(se,"A",{href:!0});var _l=n(Va);Hm=i(_l,"FlaxPreTrainedModel"),_l.forEach(t),Ym=i(se,` 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).`),se.forEach(t),jl=l(o),We=a(o,"P",{});var Po=n(We);Ga=a(Po,"A",{href:!0});var bl=n(Ga);Jm=i(bl,"PreTrainedModel"),bl.forEach(t),Km=i(Po," and "),Ra=a(Po,"A",{href:!0});var vl=n(Ra);Zm=i(vl,"TFPreTrainedModel"),vl.forEach(t),Qm=i(Po,` also implement a few methods which
are common among all the models to:`),Po.forEach(t),Dl=l(o),st=a(o,"UL",{});var Ua=n(st);Hn=a(Ua,"LI",{});var yl=n(Hn);ep=i(yl,"resize the input token embeddings when new tokens are added to the vocabulary"),yl.forEach(t),tp=l(Ua),Yn=a(Ua,"LI",{});var $l=n(Yn);op=i($l,"prune the attention heads of the model."),$l.forEach(t),Ua.forEach(t),zl=l(o),O=a(o,"P",{});var oe=n(O);rp=i(oe,"The other methods that are common to each model are defined in "),Ha=a(oe,"A",{href:!0});var l2=n(Ha);ap=i(l2,"ModuleUtilsMixin"),l2.forEach(t),np=i(oe,`
(for the PyTorch models) and `),Jn=a(oe,"CODE",{});var c2=n(Jn);sp=i(c2,"~modeling_tf_utils.TFModuleUtilsMixin"),c2.forEach(t),ip=i(oe,` (for the TensorFlow models) or
for text generation, `),Ya=a(oe,"A",{href:!0});var m2=n(Ya);dp=i(m2,"GenerationMixin"),m2.forEach(t),lp=i(oe,` (for the PyTorch models),
`),Ja=a(oe,"A",{href:!0});var p2=n(Ja);cp=i(p2,"TFGenerationMixin"),p2.forEach(t),mp=i(oe,` (for the TensorFlow models) and
`),Ka=a(oe,"A",{href:!0});var h2=n(Ka);pp=i(h2,"FlaxGenerationMixin"),h2.forEach(t),hp=i(oe," (for the Flax/JAX models)."),oe.forEach(t),Al=l(o),Se=a(o,"H2",{class:!0});var gc=n(Se);it=a(gc,"A",{id:!0,class:!0,href:!0});var f2=n(it);Kn=a(f2,"SPAN",{});var u2=n(Kn);g(Do.$$.fragment,u2),u2.forEach(t),f2.forEach(t),fp=l(gc),Zn=a(gc,"SPAN",{});var g2=n(Zn);up=i(g2,"PreTrainedModel"),g2.forEach(t),gc.forEach(t),ql=l(o),F=a(o,"DIV",{class:!0});var j=n(F);g(zo.$$.fragment,j),gp=l(j),Qn=a(j,"P",{});var _2=n(Qn);_p=i(_2,"Base class for all models."),_2.forEach(t),bp=l(j),Za=a(j,"P",{});var a2=n(Za);Qa=a(a2,"A",{href:!0});var b2=n(Qa);vp=i(b2,"PreTrainedModel"),b2.forEach(t),yp=i(a2,` 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:`),a2.forEach(t),$p=l(j),Ao=a(j,"UL",{});var _c=n(Ao);es=a(_c,"LI",{});var v2=n(es);wp=i(v2,"resize the input embeddings,"),v2.forEach(t),Tp=l(_c),ts=a(_c,"LI",{});var y2=n(ts);xp=i(y2,"prune heads in the self-attention heads."),y2.forEach(t),_c.forEach(t),kp=l(j),os=a(j,"P",{});var $2=n(os);Pp=i($2,"Class attributes (overridden by derived classes):"),$2.forEach(t),Mp=l(j),V=a(j,"UL",{});var De=n(V);rs=a(De,"LI",{});var w2=n(rs);ce=a(w2,"P",{});var Oa=n(ce);as=a(Oa,"STRONG",{});var T2=n(as);Ep=i(T2,"config_class"),T2.forEach(t),Fp=i(Oa," ("),en=a(Oa,"A",{href:!0});var x2=n(en);jp=i(x2,"PretrainedConfig"),x2.forEach(t),Dp=i(Oa,") \u2014 A subclass of "),tn=a(Oa,"A",{href:!0});var k2=n(tn);zp=i(k2,"PretrainedConfig"),k2.forEach(t),Ap=i(Oa,` to use as configuration class
for this model architecture.`),Oa.forEach(t),w2.forEach(t),qp=l(De),qo=a(De,"LI",{});var bc=n(qo);me=a(bc,"P",{});var Na=n(me);ns=a(Na,"STRONG",{});var P2=n(ns);Cp=i(P2,"load_tf_weights"),P2.forEach(t),Ip=i(Na," ("),ss=a(Na,"CODE",{});var M2=n(ss);Lp=i(M2,"Callable"),M2.forEach(t),Up=i(Na,") \u2014 A python "),is=a(Na,"EM",{});var E2=n(is);Op=i(E2,"method"),E2.forEach(t),Np=i(Na,` for loading a TensorFlow checkpoint in a PyTorch model,
taking as arguments:`),Na.forEach(t),Bp=l(bc),Xe=a(bc,"UL",{});var $n=n(Xe);dt=a($n,"LI",{});var wl=n(dt);ds=a(wl,"STRONG",{});var F2=n(ds);Wp=i(F2,"model"),F2.forEach(t),Sp=i(wl," ("),on=a(wl,"A",{href:!0});var j2=n(on);Xp=i(j2,"PreTrainedModel"),j2.forEach(t),Vp=i(wl,") \u2014 An instance of the model on which to load the TensorFlow checkpoint."),wl.forEach(t),Gp=l($n),lt=a($n,"LI",{});var Tl=n(lt);ls=a(Tl,"STRONG",{});var D2=n(ls);Rp=i(D2,"config"),D2.forEach(t),Hp=i(Tl," ("),cs=a(Tl,"CODE",{});var z2=n(cs);Yp=i(z2,"PreTrainedConfig"),z2.forEach(t),Jp=i(Tl,") \u2014 An instance of the configuration associated to the model."),Tl.forEach(t),Kp=l($n),ct=a($n,"LI",{});var xl=n(ct);ms=a(xl,"STRONG",{});var A2=n(ms);Zp=i(A2,"path"),A2.forEach(t),Qp=i(xl," ("),ps=a(xl,"CODE",{});var q2=n(ps);eh=i(q2,"str"),q2.forEach(t),th=i(xl,") \u2014 A path to the TensorFlow checkpoint."),xl.forEach(t),$n.forEach(t),bc.forEach(t),oh=l(De),hs=a(De,"LI",{});var C2=n(hs);mt=a(C2,"P",{});var kl=n(mt);fs=a(kl,"STRONG",{});var I2=n(fs);rh=i(I2,"base_model_prefix"),I2.forEach(t),ah=i(kl," ("),us=a(kl,"CODE",{});var L2=n(us);nh=i(L2,"str"),L2.forEach(t),sh=i(kl,`) \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.`),kl.forEach(t),C2.forEach(t),ih=l(De),gs=a(De,"LI",{});var U2=n(gs);pt=a(U2,"P",{});var Pl=n(pt);_s=a(Pl,"STRONG",{});var O2=n(_s);dh=i(O2,"is_parallelizable"),O2.forEach(t),lh=i(Pl," ("),bs=a(Pl,"CODE",{});var N2=n(bs);ch=i(N2,"bool"),N2.forEach(t),mh=i(Pl,") \u2014 A flag indicating whether this model supports model parallelization."),Pl.forEach(t),U2.forEach(t),ph=l(De),vs=a(De,"LI",{});var B2=n(vs);N=a(B2,"P",{});var ie=n(N);ys=a(ie,"STRONG",{});var W2=n(ys);hh=i(W2,"main_input_name"),W2.forEach(t),fh=i(ie," ("),$s=a(ie,"CODE",{});var S2=n($s);uh=i(S2,"str"),S2.forEach(t),gh=i(ie,") \u2014 The name of the principal input to the model (often "),ws=a(ie,"CODE",{});var X2=n(ws);_h=i(X2,"input_ids"),X2.forEach(t),bh=i(ie,` for NLP
models, `),Ts=a(ie,"CODE",{});var V2=n(Ts);vh=i(V2,"pixel_values"),V2.forEach(t),yh=i(ie," for vision models and "),xs=a(ie,"CODE",{});var G2=n(xs);$h=i(G2,"input_values"),G2.forEach(t),wh=i(ie," for speech models)."),ie.forEach(t),B2.forEach(t),De.forEach(t),Th=l(j),pe=a(j,"DIV",{class:!0});var wn=n(pe);g(Co.$$.fragment,wn),xh=l(wn),Io=a(wn,"P",{});var vc=n(Io);kh=i(vc,`Upload the model file to the \u{1F917} Model Hub while synchronizing a local clone of the repo in
`),ks=a(vc,"CODE",{});var R2=n(ks);Ph=i(R2,"repo_path_or_name"),R2.forEach(t),Mh=i(vc,"."),vc.forEach(t),Eh=l(wn),g(ht.$$.fragment,wn),wn.forEach(t),Fh=l(j),A=a(j,"DIV",{class:!0});var I=n(A);g(Lo.$$.fragment,I),jh=l(I),Ps=a(I,"P",{});var H2=n(Ps);Dh=i(H2,"Instantiate a pretrained pytorch model from a pre-trained model configuration."),H2.forEach(t),zh=l(I),Ve=a(I,"P",{});var Tn=n(Ve);Ah=i(Tn,"The model is set in evaluation mode by default using "),Ms=a(Tn,"CODE",{});var Y2=n(Ms);qh=i(Y2,"model.eval()"),Y2.forEach(t),Ch=i(Tn,` (Dropout modules are deactivated). To train
the model, you should first set it back in training mode with `),Es=a(Tn,"CODE",{});var J2=n(Es);Ih=i(J2,"model.train()"),J2.forEach(t),Lh=i(Tn,"."),Tn.forEach(t),Uh=l(I),Uo=a(I,"P",{});var yc=n(Uo);Oh=i(yc,"The warning "),Fs=a(yc,"EM",{});var K2=n(Fs);Nh=i(K2,"Weights from XXX not initialized from pretrained model"),K2.forEach(t),Bh=i(yc,` 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.`),yc.forEach(t),Wh=l(I),Oo=a(I,"P",{});var $c=n(Oo);Sh=i($c,"The warning "),js=a($c,"EM",{});var Z2=n(js);Xh=i(Z2,"Weights from XXX not used in YYY"),Z2.forEach(t),Vh=i($c,` means that the layer XXX is not used by YYY, therefore those
weights are discarded.`),$c.forEach(t),Gh=l(I),g(ft.$$.fragment,I),Rh=l(I),g(ut.$$.fragment,I),Hh=l(I),Ds=a(I,"UL",{});var Q2=n(Ds);rn=a(Q2,"LI",{});var n2=n(rn);zs=a(n2,"CODE",{});var e$=n(zs);Yh=i(e$,"low_cpu_mem_usage"),e$.forEach(t),Jh=i(n2," algorithm:"),n2.forEach(t),Q2.forEach(t),Kh=l(I),As=a(I,"P",{});var t$=n(As);Zh=i(t$,"This is an experimental function that loads the model using ~1x model size CPU memory"),t$.forEach(t),Qh=l(I),qs=a(I,"P",{});var o$=n(qs);ef=i(o$,"Here is how it works:"),o$.forEach(t),tf=l(I),G=a(I,"OL",{});var ze=n(G);Cs=a(ze,"LI",{});var r$=n(Cs);of=i(r$,"save which state_dict keys we have"),r$.forEach(t),rf=l(ze),Is=a(ze,"LI",{});var a$=n(Is);af=i(a$,"drop state_dict before the model is created, since the latter takes 1x model size CPU memory"),a$.forEach(t),nf=l(ze),Ls=a(ze,"LI",{});var n$=n(Ls);sf=i(n$,`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`),n$.forEach(t),df=l(ze),Us=a(ze,"LI",{});var s$=n(Us);lf=i(s$,"load state_dict 2nd time"),s$.forEach(t),cf=l(ze),Os=a(ze,"LI",{});var i$=n(Os);mf=i(i$,"replace the params/buffers from the state_dict"),i$.forEach(t),ze.forEach(t),pf=l(I),Ns=a(I,"P",{});var d$=n(Ns);hf=i(d$,"Currently, it can\u2019t handle deepspeed ZeRO stage 3 and ignores loading errors"),d$.forEach(t),I.forEach(t),ff=l(j),gt=a(j,"DIV",{class:!0});var wc=n(gt);g(No.$$.fragment,wc),uf=l(wc),Bs=a(wc,"P",{});var l$=n(Bs);gf=i(l$,"Returns the model\u2019s input embeddings."),l$.forEach(t),wc.forEach(t),_f=l(j),_t=a(j,"DIV",{class:!0});var Tc=n(_t);g(Bo.$$.fragment,Tc),bf=l(Tc),an=a(Tc,"P",{});var s2=n(an);vf=i(s2,`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: `),Wo=a(s2,"A",{href:!0,rel:!0});var c$=n(Wo);yf=i(c$,"https://discuss.pytorch.org/t/gpu-memory-that-model-uses/56822/2"),c$.forEach(t),s2.forEach(t),Tc.forEach(t),$f=l(j),bt=a(j,"DIV",{class:!0});var xc=n(bt);g(So.$$.fragment,xc),wf=l(xc),Ws=a(xc,"P",{});var m$=n(Ws);Tf=i(m$,"Returns the model\u2019s output embeddings."),m$.forEach(t),xc.forEach(t),xf=l(j),he=a(j,"DIV",{class:!0});var xn=n(he);g(Xo.$$.fragment,xn),kf=l(xn),Ss=a(xn,"P",{});var p$=n(Ss);Pf=i(p$,"Deactivates gradient checkpointing for the current model."),p$.forEach(t),Mf=l(xn),Xs=a(xn,"P",{});var h$=n(Xs);Ef=i(h$,`Note that in other frameworks this feature can be referred to as \u201Cactivation checkpointing\u201D or \u201Ccheckpoint
activations\u201D.`),h$.forEach(t),xn.forEach(t),Ff=l(j),fe=a(j,"DIV",{class:!0});var kn=n(fe);g(Vo.$$.fragment,kn),jf=l(kn),Vs=a(kn,"P",{});var f$=n(Vs);Df=i(f$,"Activates gradient checkpointing for the current model."),f$.forEach(t),zf=l(kn),Gs=a(kn,"P",{});var u$=n(Gs);Af=i(u$,`Note that in other frameworks this feature can be referred to as \u201Cactivation checkpointing\u201D or \u201Ccheckpoint
activations\u201D.`),u$.forEach(t),kn.forEach(t),qf=l(j),vt=a(j,"DIV",{class:!0});var kc=n(vt);g(Go.$$.fragment,kc),Cf=l(kc),Rs=a(kc,"P",{});var g$=n(Rs);If=i(g$,"If needed prunes and maybe initializes weights."),g$.forEach(t),kc.forEach(t),Lf=l(j),yt=a(j,"DIV",{class:!0});var Pc=n(yt);g(Ro.$$.fragment,Pc),Uf=l(Pc),Hs=a(Pc,"P",{});var _$=n(Hs);Of=i(_$,`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).`),_$.forEach(t),Pc.forEach(t),Nf=l(j),$t=a(j,"DIV",{class:!0});var Mc=n($t);g(Ho.$$.fragment,Mc),Bf=l(Mc),Ys=a(Mc,"P",{});var b$=n(Ys);Wf=i(b$,"Prunes heads of the base model."),b$.forEach(t),Mc.forEach(t),Sf=l(j),ue=a(j,"DIV",{class:!0});var Pn=n(ue);g(Yo.$$.fragment,Pn),Xf=l(Pn),Js=a(Pn,"P",{});var v$=n(Js);Vf=i(v$,`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.`),v$.forEach(t),Gf=l(Pn),g(wt.$$.fragment,Pn),Pn.forEach(t),Rf=l(j),ge=a(j,"DIV",{class:!0});var Mn=n(ge);g(Jo.$$.fragment,Mn),Hf=l(Mn),Ko=a(Mn,"P",{});var Ec=n(Ko);Yf=i(Ec,"Resizes input token embeddings matrix of the model if "),Ks=a(Ec,"CODE",{});var y$=n(Ks);Jf=i(y$,"new_num_tokens != config.vocab_size"),y$.forEach(t),Kf=i(Ec,"."),Ec.forEach(t),Zf=l(Mn),Zo=a(Mn,"P",{});var Fc=n(Zo);Qf=i(Fc,"Takes care of tying weights embeddings afterwards if the model class has a "),Zs=a(Fc,"CODE",{});var $$=n(Zs);eu=i($$,"tie_weights()"),$$.forEach(t),tu=i(Fc," method."),Fc.forEach(t),Mn.forEach(t),ou=l(j),Tt=a(j,"DIV",{class:!0});var jc=n(Tt);g(Qo.$$.fragment,jc),ru=l(jc),er=a(jc,"P",{});var Dc=n(er);au=i(Dc,`Save a model and its configuration file to a directory, so that it can be re-loaded using the
`),nn=a(Dc,"A",{href:!0});var w$=n(nn);nu=i(w$,"from_pretrained()"),w$.forEach(t),su=i(Dc," class method."),Dc.forEach(t),jc.forEach(t),iu=l(j),xt=a(j,"DIV",{class:!0});var zc=n(xt);g(tr.$$.fragment,zc),du=l(zc),Qs=a(zc,"P",{});var T$=n(Qs);lu=i(T$,"Set model\u2019s input embeddings."),T$.forEach(t),zc.forEach(t),cu=l(j),_e=a(j,"DIV",{class:!0});var En=n(_e);g(or.$$.fragment,En),mu=l(En),ei=a(En,"P",{});var x$=n(ei);pu=i(x$,"Tie the weights between the input embeddings and the output embeddings."),x$.forEach(t),hu=l(En),rr=a(En,"P",{});var Ac=n(rr);fu=i(Ac,"If the "),ti=a(Ac,"CODE",{});var k$=n(ti);uu=i(k$,"torchscript"),k$.forEach(t),gu=i(Ac,` flag is set in the configuration, can\u2019t handle parameter sharing so we are cloning the
weights instead.`),Ac.forEach(t),En.forEach(t),j.forEach(t),Cl=l(o),sn=a(o,"A",{id:!0}),n(sn).forEach(t),Il=l(o),Ge=a(o,"H3",{class:!0});var qc=n(Ge);kt=a(qc,"A",{id:!0,class:!0,href:!0});var P$=n(kt);oi=a(P$,"SPAN",{});var M$=n(oi);g(ar.$$.fragment,M$),M$.forEach(t),P$.forEach(t),_u=l(qc),ri=a(qc,"SPAN",{});var E$=n(ri);bu=i(E$,"Large model loading"),E$.forEach(t),qc.forEach(t),Ll=l(o),be=a(o,"P",{});var Fn=n(be);vu=i(Fn,"In Transformers 4.20.0, the "),dn=a(Fn,"A",{href:!0});var F$=n(dn);yu=i(F$,"from_pretrained()"),F$.forEach(t),$u=i(Fn," method has been reworked to accommodate large models using "),nr=a(Fn,"A",{href:!0,rel:!0});var j$=n(nr);wu=i(j$,"Accelerate"),j$.forEach(t),Tu=i(Fn,". 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."),Fn.forEach(t),Ul=l(o),Pt=a(o,"P",{});var Cc=n(Pt);xu=i(Cc,"This option can be activated with "),ai=a(Cc,"CODE",{});var D$=n(ai);ku=i(D$,"low_cpu_mem_usage=True"),D$.forEach(t),Pu=i(Cc,". 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."),Cc.forEach(t),Ol=l(o),g(sr.$$.fragment,o),Nl=l(o),Mt=a(o,"P",{});var Ic=n(Mt);Mu=i(Ic,"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 "),ni=a(Ic,"CODE",{});var z$=n(ni);Eu=i(z$,'device_map="auto"'),z$.forEach(t),Fu=i(Ic,", 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."),Ic.forEach(t),Bl=l(o),Z=a(o,"P",{});var Mo=n(Z);ju=i(Mo,"When passing a "),si=a(Mo,"CODE",{});var A$=n(si);Du=i(A$,"device_map"),A$.forEach(t),zu=i(Mo,", "),ii=a(Mo,"CODE",{});var q$=n(ii);Au=i(q$,"low_cpu_mem_usage"),q$.forEach(t),qu=i(Mo," is automatically set to "),di=a(Mo,"CODE",{});var C$=n(di);Cu=i(C$,"True"),C$.forEach(t),Iu=i(Mo,", so you don\u2019t need to specify it:"),Mo.forEach(t),Wl=l(o),g(ir.$$.fragment,o),Sl=l(o),Et=a(o,"P",{});var Lc=n(Et);Lu=i(Lc,"You can inspect how the model was split across devices by looking at its "),li=a(Lc,"CODE",{});var I$=n(li);Uu=i(I$,"hf_device_map"),I$.forEach(t),Ou=i(Lc," attribute:"),Lc.forEach(t),Xl=l(o),g(dr.$$.fragment,o),Vl=l(o),g(lr.$$.fragment,o),Gl=l(o),ln=a(o,"P",{});var L$=n(ln);Nu=i(L$,"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 submosules 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):"),L$.forEach(t),Rl=l(o),g(cr.$$.fragment,o),Hl=l(o),Ft=a(o,"P",{});var Uc=n(Ft);Bu=i(Uc,"Another way to minimize the memory impact of your model is to instantiate it at a lower precision dtype (like "),ci=a(Uc,"CODE",{});var U$=n(ci);Wu=i(U$,"torch.float16"),U$.forEach(t),Su=i(Uc,") or use direct quantization techniques as described below."),Uc.forEach(t),Yl=l(o),Re=a(o,"H3",{class:!0});var Oc=n(Re);jt=a(Oc,"A",{id:!0,class:!0,href:!0});var O$=n(jt);mi=a(O$,"SPAN",{});var N$=n(mi);g(mr.$$.fragment,N$),N$.forEach(t),O$.forEach(t),Xu=l(Oc),pi=a(Oc,"SPAN",{});var B$=n(pi);Vu=i(B$,"Model Instantiation dtype"),B$.forEach(t),Oc.forEach(t),Jl=l(o),Q=a(o,"P",{});var Eo=n(Q);Gu=i(Eo,"Under Pytorch a model normally gets instantiated with "),hi=a(Eo,"CODE",{});var W$=n(hi);Ru=i(W$,"torch.float32"),W$.forEach(t),Hu=i(Eo,` 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 `),fi=a(Eo,"CODE",{});var S$=n(fi);Yu=i(S$,"dtype"),S$.forEach(t),Ju=i(Eo," using "),ui=a(Eo,"CODE",{});var X$=n(ui);Ku=i(X$,"torch_dtype"),X$.forEach(t),Zu=i(Eo," argument:"),Eo.forEach(t),Kl=l(o),g(pr.$$.fragment,o),Zl=l(o),ve=a(o,"P",{});var jn=n(ve);Qu=i(jn,"or, if you want the model to always load in the most optimal memory pattern, you can use the special value "),gi=a(jn,"CODE",{});var V$=n(gi);eg=i(V$,'"auto"'),V$.forEach(t),tg=i(jn,`,
and then `),_i=a(jn,"CODE",{});var G$=n(_i);og=i(G$,"dtype"),G$.forEach(t),rg=i(jn," will be automatically derived from the model\u2019s weights:"),jn.forEach(t),Ql=l(o),g(hr.$$.fragment,o),ec=l(o),Dt=a(o,"P",{});var Nc=n(Dt);ag=i(Nc,"Models instantiated from scratch can also be told which "),bi=a(Nc,"CODE",{});var R$=n(bi);ng=i(R$,"dtype"),R$.forEach(t),sg=i(Nc," to use with:"),Nc.forEach(t),tc=l(o),g(fr.$$.fragment,o),oc=l(o),cn=a(o,"P",{});var H$=n(cn);ig=i(H$,"Due to Pytorch design, this functionality is only available for floating dtypes."),H$.forEach(t),rc=l(o),He=a(o,"H2",{class:!0});var Bc=n(He);zt=a(Bc,"A",{id:!0,class:!0,href:!0});var Y$=n(zt);vi=a(Y$,"SPAN",{});var J$=n(vi);g(ur.$$.fragment,J$),J$.forEach(t),Y$.forEach(t),dg=l(Bc),yi=a(Bc,"SPAN",{});var K$=n(yi);lg=i(K$,"ModuleUtilsMixin"),K$.forEach(t),Bc.forEach(t),ac=l(o),C=a(o,"DIV",{class:!0});var L=n(C);g(gr.$$.fragment,L),cg=l(L),_r=a(L,"P",{});var Wc=n(_r);mg=i(Wc,"A few utilities for "),$i=a(Wc,"CODE",{});var Z$=n($i);pg=i(Z$,"torch.nn.Modules"),Z$.forEach(t),hg=i(Wc,", to be used as a mixin."),Wc.forEach(t),fg=l(L),ye=a(L,"DIV",{class:!0});var Dn=n(ye);g(br.$$.fragment,Dn),ug=l(Dn),wi=a(Dn,"P",{});var Q$=n(wi);gg=i(Q$,"Add a memory hook before and after each sub-module forward pass to record increase in memory consumption."),Q$.forEach(t),_g=l(Dn),Ye=a(Dn,"P",{});var zn=n(Ye);bg=i(zn,"Increase in memory consumption is stored in a "),Ti=a(zn,"CODE",{});var ew=n(Ti);vg=i(ew,"mem_rss_diff"),ew.forEach(t),yg=i(zn,` attribute for each module and can be reset to zero
with `),xi=a(zn,"CODE",{});var tw=n(xi);$g=i(tw,"model.reset_memory_hooks_state()"),tw.forEach(t),wg=i(zn,"."),zn.forEach(t),Dn.forEach(t),Tg=l(L),At=a(L,"DIV",{class:!0});var Sc=n(At);g(vr.$$.fragment,Sc),xg=l(Sc),ki=a(Sc,"P",{});var ow=n(ki);kg=i(ow,"Helper function to estimate the total number of tokens from the model inputs."),ow.forEach(t),Sc.forEach(t),Pg=l(L),qt=a(L,"DIV",{class:!0});var Xc=n(qt);g(yr.$$.fragment,Xc),Mg=l(Xc),Je=a(Xc,"P",{});var An=n(Je);Eg=i(An,`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(An,"CODE",{});var rw=n(Pi);Fg=i(rw,"12 * d_model << sequence_length"),rw.forEach(t),jg=i(An,") as laid out in "),$r=a(An,"A",{href:!0,rel:!0});var aw=n($r);Dg=i(aw,`this
paper`),aw.forEach(t),zg=i(An,` 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.`),An.forEach(t),Xc.forEach(t),Ag=l(L),Ct=a(L,"DIV",{class:!0});var Vc=n(Ct);g(wr.$$.fragment,Vc),qg=l(Vc),Mi=a(Vc,"P",{});var nw=n(Mi);Cg=i(nw,"Makes broadcastable attention and causal masks so that future and masked tokens are ignored."),nw.forEach(t),Vc.forEach(t),Ig=l(L),It=a(L,"DIV",{class:!0});var Gc=n(It);g(Tr.$$.fragment,Gc),Lg=l(Gc),Ei=a(Gc,"P",{});var sw=n(Ei);Ug=i(sw,"Prepare the head mask if needed."),sw.forEach(t),Gc.forEach(t),Og=l(L),Lt=a(L,"DIV",{class:!0});var Rc=n(Lt);g(xr.$$.fragment,Rc),Ng=l(Rc),Fi=a(Rc,"P",{});var iw=n(Fi);Bg=i(iw,"Invert an attention mask (e.g., switches 0. and 1.)."),iw.forEach(t),Rc.forEach(t),Wg=l(L),Ut=a(L,"DIV",{class:!0});var Hc=n(Ut);g(kr.$$.fragment,Hc),Sg=l(Hc),ji=a(Hc,"P",{});var dw=n(ji);Xg=i(dw,"Get number of (optionally, trainable or non-embeddings) parameters in the module."),dw.forEach(t),Hc.forEach(t),Vg=l(L),Ot=a(L,"DIV",{class:!0});var Yc=n(Ot);g(Pr.$$.fragment,Yc),Gg=l(Yc),Ke=a(Yc,"P",{});var qn=n(Ke);Rg=i(qn,"Reset the "),Di=a(qn,"CODE",{});var lw=n(Di);Hg=i(lw,"mem_rss_diff"),lw.forEach(t),Yg=i(qn," attribute of each module (see "),mn=a(qn,"A",{href:!0});var cw=n(mn);Jg=i(cw,"add_memory_hooks()"),cw.forEach(t),Kg=i(qn,")."),qn.forEach(t),Yc.forEach(t),L.forEach(t),nc=l(o),Ze=a(o,"H2",{class:!0});var Jc=n(Ze);Nt=a(Jc,"A",{id:!0,class:!0,href:!0});var mw=n(Nt);zi=a(mw,"SPAN",{});var pw=n(zi);g(Mr.$$.fragment,pw),pw.forEach(t),mw.forEach(t),Zg=l(Jc),Ai=a(Jc,"SPAN",{});var hw=n(Ai);Qg=i(hw,"TFPreTrainedModel"),hw.forEach(t),Jc.forEach(t),sc=l(o),x=a(o,"DIV",{class:!0});var M=n(x);g(Er.$$.fragment,M),e_=l(M),qi=a(M,"P",{});var fw=n(qi);t_=i(fw,"Base class for all TF models."),fw.forEach(t),o_=l(M),pn=a(M,"P",{});var i2=n(pn);hn=a(i2,"A",{href:!0});var uw=n(hn);r_=i(uw,"TFPreTrainedModel"),uw.forEach(t),a_=i(i2,` 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:`),i2.forEach(t),n_=l(M),Fr=a(M,"UL",{});var Kc=n(Fr);Ci=a(Kc,"LI",{});var gw=n(Ci);s_=i(gw,"resize the input embeddings,"),gw.forEach(t),i_=l(Kc),Ii=a(Kc,"LI",{});var _w=n(Ii);d_=i(_w,"prune heads in the self-attention heads."),_w.forEach(t),Kc.forEach(t),l_=l(M),Li=a(M,"P",{});var bw=n(Li);c_=i(bw,"Class attributes (overridden by derived classes):"),bw.forEach(t),m_=l(M),Qe=a(M,"UL",{});var Cn=n(Qe);$e=a(Cn,"LI",{});var Ba=n($e);Ui=a(Ba,"STRONG",{});var vw=n(Ui);p_=i(vw,"config_class"),vw.forEach(t),h_=i(Ba," ("),fn=a(Ba,"A",{href:!0});var yw=n(fn);f_=i(yw,"PretrainedConfig"),yw.forEach(t),u_=i(Ba,") \u2014 A subclass of "),un=a(Ba,"A",{href:!0});var $w=n(un);g_=i($w,"PretrainedConfig"),$w.forEach(t),__=i(Ba,` to use as configuration class
for this model architecture.`),Ba.forEach(t),b_=l(Cn),Bt=a(Cn,"LI",{});var Ml=n(Bt);Oi=a(Ml,"STRONG",{});var ww=n(Oi);v_=i(ww,"base_model_prefix"),ww.forEach(t),y_=i(Ml," ("),Ni=a(Ml,"CODE",{});var Tw=n(Ni);$_=i(Tw,"str"),Tw.forEach(t),w_=i(Ml,`) \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.`),Ml.forEach(t),T_=l(Cn),B=a(Cn,"LI",{});var de=n(B);Bi=a(de,"STRONG",{});var xw=n(Bi);x_=i(xw,"main_input_name"),xw.forEach(t),k_=i(de," ("),Wi=a(de,"CODE",{});var kw=n(Wi);P_=i(kw,"str"),kw.forEach(t),M_=i(de,") \u2014 The name of the principal input to the model (often "),Si=a(de,"CODE",{});var Pw=n(Si);E_=i(Pw,"input_ids"),Pw.forEach(t),F_=i(de,` for NLP
models, `),Xi=a(de,"CODE",{});var Mw=n(Xi);j_=i(Mw,"pixel_values"),Mw.forEach(t),D_=i(de," for vision models and "),Vi=a(de,"CODE",{});var Ew=n(Vi);z_=i(Ew,"input_values"),Ew.forEach(t),A_=i(de," for speech models)."),de.forEach(t),Cn.forEach(t),q_=l(M),we=a(M,"DIV",{class:!0});var In=n(we);g(jr.$$.fragment,In),C_=l(In),Dr=a(In,"P",{});var Zc=n(Dr);I_=i(Zc,"Upload the model files to the \u{1F917} Model Hub while synchronizing a local clone of the repo in "),Gi=a(Zc,"CODE",{});var Fw=n(Gi);L_=i(Fw,"repo_path_or_name"),Fw.forEach(t),U_=i(Zc,"."),Zc.forEach(t),O_=l(In),g(Wt.$$.fragment,In),In.forEach(t),N_=l(M),St=a(M,"DIV",{class:!0});var Qc=n(St);g(zr.$$.fragment,Qc),B_=l(Qc),Ri=a(Qc,"P",{});var jw=n(Ri);W_=i(jw,`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.`),jw.forEach(t),Qc.forEach(t),S_=l(M),Xt=a(M,"DIV",{class:!0});var em=n(Xt);g(Ar.$$.fragment,em),X_=l(em),qr=a(em,"P",{});var tm=n(qr);V_=i(tm,"Creates a draft of a model card using the information available to the "),Hi=a(tm,"CODE",{});var Dw=n(Hi);G_=i(Dw,"Trainer"),Dw.forEach(t),R_=i(tm,"."),tm.forEach(t),em.forEach(t),H_=l(M),Vt=a(M,"DIV",{class:!0});var om=n(Vt);g(Cr.$$.fragment,om),Y_=l(om),Yi=a(om,"P",{});var zw=n(Yi);J_=i(zw,`Method used for serving the model. Intended not to be compiled with a tf.function decorator so that we can use
it to generate multiple signatures later.`),zw.forEach(t),om.forEach(t),K_=l(M),W=a(M,"DIV",{class:!0});var Ae=n(W);g(Ir.$$.fragment,Ae),Z_=l(Ae),Ji=a(Ae,"P",{});var Aw=n(Ji);Q_=i(Aw,"Instantiate a pretrained TF 2.0 model from a pre-trained model configuration."),Aw.forEach(t),eb=l(Ae),Lr=a(Ae,"P",{});var rm=n(Lr);tb=i(rm,"The warning "),Ki=a(rm,"EM",{});var qw=n(Ki);ob=i(qw,"Weights from XXX not initialized from pretrained model"),qw.forEach(t),rb=i(rm,` 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.`),rm.forEach(t),ab=l(Ae),Ur=a(Ae,"P",{});var am=n(Ur);nb=i(am,"The warning "),Zi=a(am,"EM",{});var Cw=n(Zi);sb=i(Cw,"Weights from XXX not used in YYY"),Cw.forEach(t),ib=i(am,` means that the layer XXX is not used by YYY, therefore those
weights are discarded.`),am.forEach(t),db=l(Ae),g(Gt.$$.fragment,Ae),Ae.forEach(t),lb=l(M),Rt=a(M,"DIV",{class:!0});var nm=n(Rt);g(Or.$$.fragment,nm),cb=l(nm),Qi=a(nm,"P",{});var Iw=n(Qi);mb=i(Iw,"Dict of bias attached to an LM head. The key represents the name of the bias attribute."),Iw.forEach(t),nm.forEach(t),pb=l(M),Ht=a(M,"DIV",{class:!0});var sm=n(Ht);g(Nr.$$.fragment,sm),hb=l(sm),ed=a(sm,"P",{});var Lw=n(ed);fb=i(Lw,"Returns the model\u2019s input embeddings layer."),Lw.forEach(t),sm.forEach(t),ub=l(M),Yt=a(M,"DIV",{class:!0});var im=n(Yt);g(Br.$$.fragment,im),gb=l(im),td=a(im,"P",{});var Uw=n(td);_b=i(Uw,"The LM Head layer. This method must be overwritten by all the models that have a lm head."),Uw.forEach(t),im.forEach(t),bb=l(M),Jt=a(M,"DIV",{class:!0});var dm=n(Jt);g(Wr.$$.fragment,dm),vb=l(dm),od=a(dm,"P",{});var Ow=n(od);yb=i(Ow,"Returns the model\u2019s output embeddings"),Ow.forEach(t),dm.forEach(t),$b=l(M),Kt=a(M,"DIV",{class:!0});var lm=n(Kt);g(Sr.$$.fragment,lm),wb=l(lm),rd=a(lm,"P",{});var Nw=n(rd);Tb=i(Nw,`Get the layer that handles a bias attribute in case the model has an LM head with weights tied to the
embeddings`),Nw.forEach(t),lm.forEach(t),xb=l(M),Zt=a(M,"DIV",{class:!0});var cm=n(Zt);g(Xr.$$.fragment,cm),kb=l(cm),ad=a(cm,"P",{});var Bw=n(ad);Pb=i(Bw,"Get the concatenated _prefix name of the bias from the model name to the parent layer"),Bw.forEach(t),cm.forEach(t),Mb=l(M),Qt=a(M,"DIV",{class:!0});var mm=n(Qt);g(Vr.$$.fragment,mm),Eb=l(mm),nd=a(mm,"P",{});var Ww=n(nd);Fb=i(Ww,`Loads a saved checkpoint (model weights and optimizer state) from a repo. Returns the current epoch count when
the checkpoint was made.`),Ww.forEach(t),mm.forEach(t),jb=l(M),eo=a(M,"DIV",{class:!0});var pm=n(eo);g(Gr.$$.fragment,pm),Db=l(pm),R=a(pm,"P",{});var qe=n(R);zb=i(qe,"Wraps a HuggingFace "),Rr=a(qe,"A",{href:!0,rel:!0});var Sw=n(Rr);Ab=i(Sw,"Dataset"),Sw.forEach(t),qb=i(qe," as a "),sd=a(qe,"CODE",{});var Xw=n(sd);Cb=i(Xw,"tf.data.Dataset"),Xw.forEach(t),Ib=i(qe,` 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 `),id=a(qe,"CODE",{});var Vw=n(id);Lb=i(Vw,"fit()"),Vw.forEach(t),Ub=i(qe,` 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 `),dd=a(qe,"CODE",{});var Gw=n(dd);Ob=i(Gw,"Dataset.to_tf_dataset()"),Gw.forEach(t),Nb=i(qe," instead."),qe.forEach(t),pm.forEach(t),Bb=l(M),to=a(M,"DIV",{class:!0});var hm=n(to);g(Hr.$$.fragment,hm),Wb=l(hm),ld=a(hm,"P",{});var Rw=n(ld);Sb=i(Rw,"Prunes heads of the base model."),Rw.forEach(t),hm.forEach(t),Xb=l(M),Te=a(M,"DIV",{class:!0});var Ln=n(Te);g(Yr.$$.fragment,Ln),Vb=l(Ln),cd=a(Ln,"P",{});var Hw=n(cd);Gb=i(Hw,`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.`),Hw.forEach(t),Rb=l(Ln),g(oo.$$.fragment,Ln),Ln.forEach(t),Hb=l(M),xe=a(M,"DIV",{class:!0});var Un=n(xe);g(Jr.$$.fragment,Un),Yb=l(Un),Kr=a(Un,"P",{});var fm=n(Kr);Jb=i(fm,"Resizes input token embeddings matrix of the model if "),md=a(fm,"CODE",{});var Yw=n(md);Kb=i(Yw,"new_num_tokens != config.vocab_size"),Yw.forEach(t),Zb=i(fm,"."),fm.forEach(t),Qb=l(Un),Zr=a(Un,"P",{});var um=n(Zr);ev=i(um,"Takes care of tying weights embeddings afterwards if the model class has a "),pd=a(um,"CODE",{});var Jw=n(pd);tv=i(Jw,"tie_weights()"),Jw.forEach(t),ov=i(um," method."),um.forEach(t),Un.forEach(t),rv=l(M),ro=a(M,"DIV",{class:!0});var gm=n(ro);g(Qr.$$.fragment,gm),av=l(gm),ea=a(gm,"P",{});var _m=n(ea);nv=i(_m,`Save a model and its configuration file to a directory, so that it can be re-loaded using the
`),gn=a(_m,"A",{href:!0});var Kw=n(gn);sv=i(Kw,"from_pretrained()"),Kw.forEach(t),iv=i(_m," class method."),_m.forEach(t),gm.forEach(t),dv=l(M),ao=a(M,"DIV",{class:!0});var bm=n(ao);g(ta.$$.fragment,bm),lv=l(bm),hd=a(bm,"P",{});var Zw=n(hd);cv=i(Zw,"Method used for serving the model."),Zw.forEach(t),bm.forEach(t),mv=l(M),no=a(M,"DIV",{class:!0});var vm=n(no);g(oa.$$.fragment,vm),pv=l(vm),fd=a(vm,"P",{});var Qw=n(fd);hv=i(Qw,"Prepare the output of the saved model. Each model must implement this function."),Qw.forEach(t),vm.forEach(t),fv=l(M),so=a(M,"DIV",{class:!0});var ym=n(so);g(ra.$$.fragment,ym),uv=l(ym),ud=a(ym,"P",{});var eT=n(ud);gv=i(eT,"Set all the bias in the LM head."),eT.forEach(t),ym.forEach(t),_v=l(M),io=a(M,"DIV",{class:!0});var $m=n(io);g(aa.$$.fragment,$m),bv=l($m),gd=a($m,"P",{});var tT=n(gd);vv=i(tT,"Set model\u2019s input embeddings"),tT.forEach(t),$m.forEach(t),yv=l(M),lo=a(M,"DIV",{class:!0});var wm=n(lo);g(na.$$.fragment,wm),$v=l(wm),_d=a(wm,"P",{});var oT=n(_d);wv=i(oT,"Set model\u2019s output embeddings"),oT.forEach(t),wm.forEach(t),Tv=l(M),co=a(M,"DIV",{class:!0});var Tm=n(co);g(sa.$$.fragment,Tm),xv=l(Tm),ia=a(Tm,"P",{});var xm=n(ia);kv=i(xm,"A modification of Keras\u2019s default "),bd=a(xm,"CODE",{});var rT=n(bd);Pv=i(rT,"train_step"),rT.forEach(t),Mv=i(xm,` 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.`),xm.forEach(t),Tm.forEach(t),Ev=l(M),mo=a(M,"DIV",{class:!0});var km=n(mo);g(da.$$.fragment,km),Fv=l(km),la=a(km,"P",{});var Pm=n(la);jv=i(Pm,"A modification of Keras\u2019s default "),vd=a(Pm,"CODE",{});var aT=n(vd);Dv=i(aT,"train_step"),aT.forEach(t),zv=i(Pm,` 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.`),Pm.forEach(t),km.forEach(t),M.forEach(t),ic=l(o),et=a(o,"H2",{class:!0});var Mm=n(et);po=a(Mm,"A",{id:!0,class:!0,href:!0});var nT=n(po);yd=a(nT,"SPAN",{});var sT=n(yd);g(ca.$$.fragment,sT),sT.forEach(t),nT.forEach(t),Av=l(Mm),$d=a(Mm,"SPAN",{});var iT=n($d);qv=i(iT,"TFModelUtilsMixin"),iT.forEach(t),Mm.forEach(t),dc=l(o),re=a(o,"DIV",{class:!0});var On=n(re);g(ma.$$.fragment,On),Cv=l(On),pa=a(On,"P",{});var Em=n(pa);Iv=i(Em,"A few utilities for "),wd=a(Em,"CODE",{});var dT=n(wd);Lv=i(dT,"tf.keras.Model"),dT.forEach(t),Uv=i(Em,", to be used as a mixin."),Em.forEach(t),Ov=l(On),ho=a(On,"DIV",{class:!0});var Fm=n(ho);g(ha.$$.fragment,Fm),Nv=l(Fm),Td=a(Fm,"P",{});var lT=n(Td);Bv=i(lT,"Get the number of (optionally, trainable) parameters in the model."),lT.forEach(t),Fm.forEach(t),On.forEach(t),lc=l(o),tt=a(o,"H2",{class:!0});var jm=n(tt);fo=a(jm,"A",{id:!0,class:!0,href:!0});var cT=n(fo);xd=a(cT,"SPAN",{});var mT=n(xd);g(fa.$$.fragment,mT),mT.forEach(t),cT.forEach(t),Wv=l(jm),kd=a(jm,"SPAN",{});var pT=n(kd);Sv=i(pT,"FlaxPreTrainedModel"),pT.forEach(t),jm.forEach(t),cc=l(o),D=a(o,"DIV",{class:!0});var q=n(D);g(ua.$$.fragment,q),Xv=l(q),Pd=a(q,"P",{});var hT=n(Pd);Vv=i(hT,"Base class for all models."),hT.forEach(t),Gv=l(q),_n=a(q,"P",{});var d2=n(_n);bn=a(d2,"A",{href:!0});var fT=n(bn);Rv=i(fT,"FlaxPreTrainedModel"),fT.forEach(t),Hv=i(d2,` takes care of storing the configuration of the models and handles methods for loading,
downloading and saving models.`),d2.forEach(t),Yv=l(q),Md=a(q,"P",{});var uT=n(Md);Jv=i(uT,"Class attributes (overridden by derived classes):"),uT.forEach(t),Kv=l(q),ot=a(q,"UL",{});var Nn=n(ot);ke=a(Nn,"LI",{});var Wa=n(ke);Ed=a(Wa,"STRONG",{});var gT=n(Ed);Zv=i(gT,"config_class"),gT.forEach(t),Qv=i(Wa," ("),vn=a(Wa,"A",{href:!0});var _T=n(vn);ey=i(_T,"PretrainedConfig"),_T.forEach(t),ty=i(Wa,") \u2014 A subclass of "),yn=a(Wa,"A",{href:!0});var bT=n(yn);oy=i(bT,"PretrainedConfig"),bT.forEach(t),ry=i(Wa,` to use as configuration class
for this model architecture.`),Wa.forEach(t),ay=l(Nn),uo=a(Nn,"LI",{});var El=n(uo);Fd=a(El,"STRONG",{});var vT=n(Fd);ny=i(vT,"base_model_prefix"),vT.forEach(t),sy=i(El," ("),jd=a(El,"CODE",{});var yT=n(jd);iy=i(yT,"str"),yT.forEach(t),dy=i(El,`) \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.`),El.forEach(t),ly=l(Nn),S=a(Nn,"LI",{});var le=n(S);Dd=a(le,"STRONG",{});var $T=n(Dd);cy=i($T,"main_input_name"),$T.forEach(t),my=i(le," ("),zd=a(le,"CODE",{});var wT=n(zd);py=i(wT,"str"),wT.forEach(t),hy=i(le,") \u2014 The name of the principal input to the model (often "),Ad=a(le,"CODE",{});var TT=n(Ad);fy=i(TT,"input_ids"),TT.forEach(t),uy=i(le,` for NLP
models, `),qd=a(le,"CODE",{});var xT=n(qd);gy=i(xT,"pixel_values"),xT.forEach(t),_y=i(le," for vision models and "),Cd=a(le,"CODE",{});var kT=n(Cd);by=i(kT,"input_values"),kT.forEach(t),vy=i(le," for speech models)."),le.forEach(t),Nn.forEach(t),yy=l(q),Pe=a(q,"DIV",{class:!0});var Bn=n(Pe);g(ga.$$.fragment,Bn),$y=l(Bn),_a=a(Bn,"P",{});var Dm=n(_a);wy=i(Dm,`Upload the model checkpoint to the \u{1F917} Model Hub while synchronizing a local clone of the repo in
`),Id=a(Dm,"CODE",{});var PT=n(Id);Ty=i(PT,"repo_path_or_name"),PT.forEach(t),xy=i(Dm,"."),Dm.forEach(t),ky=l(Bn),g(go.$$.fragment,Bn),Bn.forEach(t),Py=l(q),X=a(q,"DIV",{class:!0});var Ce=n(X);g(ba.$$.fragment,Ce),My=l(Ce),Ld=a(Ce,"P",{});var MT=n(Ld);Ey=i(MT,"Instantiate a pretrained flax model from a pre-trained model configuration."),MT.forEach(t),Fy=l(Ce),va=a(Ce,"P",{});var zm=n(va);jy=i(zm,"The warning "),Ud=a(zm,"EM",{});var ET=n(Ud);Dy=i(ET,"Weights from XXX not initialized from pretrained model"),ET.forEach(t),zy=i(zm,` 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.`),zm.forEach(t),Ay=l(Ce),ya=a(Ce,"P",{});var Am=n(ya);qy=i(Am,"The warning "),Od=a(Am,"EM",{});var FT=n(Od);Cy=i(FT,"Weights from XXX not used in YYY"),FT.forEach(t),Iy=i(Am,` means that the layer XXX is not used by YYY, therefore those
weights are discarded.`),Am.forEach(t),Ly=l(Ce),g(_o.$$.fragment,Ce),Ce.forEach(t),Uy=l(q),Me=a(q,"DIV",{class:!0});var Wn=n(Me);g($a.$$.fragment,Wn),Oy=l(Wn),wa=a(Wn,"P",{});var qm=n(wa);Ny=i(qm,"This is the same as "),Nd=a(qm,"CODE",{});var jT=n(Nd);By=i(jT,"flax.serialization.from_bytes"),jT.forEach(t),Wy=i(qm,`
(https:lax.readthedocs.io/en/latest/_modules/flax/serialization.html#from_bytes) but for a sharded checkpoint.`),qm.forEach(t),Sy=l(Wn),Bd=a(Wn,"P",{});var DT=n(Bd);Xy=i(DT,`This load is performed efficiently: each checkpoint shard is loaded one by one in RAM and deleted after being
loaded in the model.`),DT.forEach(t),Wn.forEach(t),Vy=l(q),Ee=a(q,"DIV",{class:!0});var Sn=n(Ee);g(Ta.$$.fragment,Sn),Gy=l(Sn),Wd=a(Sn,"P",{});var zT=n(Wd);Ry=i(zT,`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.`),zT.forEach(t),Hy=l(Sn),g(bo.$$.fragment,Sn),Sn.forEach(t),Yy=l(q),vo=a(q,"DIV",{class:!0});var Cm=n(vo);g(xa.$$.fragment,Cm),Jy=l(Cm),ka=a(Cm,"P",{});var Im=n(ka);Ky=i(Im,`Save a model and its configuration file to a directory, so that it can be re-loaded using the
`),Sd=a(Im,"CODE",{});var AT=n(Sd);Zy=i(AT,"[from_pretrained()](/docs/transformers/v4.25.1/en/main_classes/model#transformers.FlaxPreTrainedModel.from_pretrained)"),AT.forEach(t),Qy=i(Im," class method"),Im.forEach(t),Cm.forEach(t),e1=l(q),ee=a(q,"DIV",{class:!0});var Fo=n(ee);g(Pa.$$.fragment,Fo),t1=l(Fo),H=a(Fo,"P",{});var Ie=n(H);o1=i(Ie,"Cast the floating-point "),Xd=a(Ie,"CODE",{});var qT=n(Xd);r1=i(qT,"params"),qT.forEach(t),a1=i(Ie," to "),Vd=a(Ie,"CODE",{});var CT=n(Vd);n1=i(CT,"jax.numpy.bfloat16"),CT.forEach(t),s1=i(Ie,". This returns a new "),Gd=a(Ie,"CODE",{});var IT=n(Gd);i1=i(IT,"params"),IT.forEach(t),d1=i(Ie,` tree and does not cast
the `),Rd=a(Ie,"CODE",{});var LT=n(Rd);l1=i(LT,"params"),LT.forEach(t),c1=i(Ie," in place."),Ie.forEach(t),m1=l(Fo),Hd=a(Fo,"P",{});var UT=n(Hd);p1=i(UT,`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.`),UT.forEach(t),h1=l(Fo),g(yo.$$.fragment,Fo),Fo.forEach(t),f1=l(q),te=a(q,"DIV",{class:!0});var jo=n(te);g(Ma.$$.fragment,jo),u1=l(jo),Y=a(jo,"P",{});var Le=n(Y);g1=i(Le,"Cast the floating-point "),Yd=a(Le,"CODE",{});var OT=n(Yd);_1=i(OT,"parmas"),OT.forEach(t),b1=i(Le," to "),Jd=a(Le,"CODE",{});var NT=n(Jd);v1=i(NT,"jax.numpy.float16"),NT.forEach(t),y1=i(Le,". This returns a new "),Kd=a(Le,"CODE",{});var BT=n(Kd);$1=i(BT,"params"),BT.forEach(t),w1=i(Le,` tree and does not cast the
`),Zd=a(Le,"CODE",{});var WT=n(Zd);T1=i(WT,"params"),WT.forEach(t),x1=i(Le," in place."),Le.forEach(t),k1=l(jo),Qd=a(jo,"P",{});var ST=n(Qd);P1=i(ST,`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.`),ST.forEach(t),M1=l(jo),g($o.$$.fragment,jo),jo.forEach(t),E1=l(q),Fe=a(q,"DIV",{class:!0});var Xn=n(Fe);g(Ea.$$.fragment,Xn),F1=l(Xn),J=a(Xn,"P",{});var Ue=n(J);j1=i(Ue,"Cast the floating-point "),el=a(Ue,"CODE",{});var XT=n(el);D1=i(XT,"parmas"),XT.forEach(t),z1=i(Ue," to "),tl=a(Ue,"CODE",{});var VT=n(tl);A1=i(VT,"jax.numpy.float32"),VT.forEach(t),q1=i(Ue,`. This method can be used to explicitly convert the
model parameters to fp32 precision. This returns a new `),ol=a(Ue,"CODE",{});var GT=n(ol);C1=i(GT,"params"),GT.forEach(t),I1=i(Ue," tree and does not cast the "),rl=a(Ue,"CODE",{});var RT=n(rl);L1=i(RT,"params"),RT.forEach(t),U1=i(Ue," in place."),Ue.forEach(t),O1=l(Xn),g(wo.$$.fragment,Xn),Xn.forEach(t),q.forEach(t),mc=l(o),rt=a(o,"H2",{class:!0});var Lm=n(rt);To=a(Lm,"A",{id:!0,class:!0,href:!0});var HT=n(To);al=a(HT,"SPAN",{});var YT=n(al);g(Fa.$$.fragment,YT),YT.forEach(t),HT.forEach(t),N1=l(Lm),nl=a(Lm,"SPAN",{});var JT=n(nl);B1=i(JT,"Pushing to the Hub"),JT.forEach(t),Lm.forEach(t),pc=l(o),ae=a(o,"DIV",{class:!0});var Vn=n(ae);g(ja.$$.fragment,Vn),W1=l(Vn),sl=a(Vn,"P",{});var KT=n(sl);S1=i(KT,"A Mixin containing the functionality to push a model or tokenizer to the hub."),KT.forEach(t),X1=l(Vn),je=a(Vn,"DIV",{class:!0});var Gn=n(je);g(Da.$$.fragment,Gn),V1=l(Gn),za=a(Gn,"P",{});var Um=n(za);G1=i(Um,`Upload the {object_files} to the \u{1F917} Model Hub while synchronizing a local clone of the repo in
`),il=a(Um,"CODE",{});var ZT=n(il);R1=i(ZT,"repo_path_or_name"),ZT.forEach(t),H1=i(Um,"."),Um.forEach(t),Y1=l(Gn),g(xo.$$.fragment,Gn),Gn.forEach(t),Vn.forEach(t),hc=l(o),at=a(o,"H2",{class:!0});var Om=n(at);ko=a(Om,"A",{id:!0,class:!0,href:!0});var QT=n(ko);dl=a(QT,"SPAN",{});var ex=n(dl);g(Aa.$$.fragment,ex),ex.forEach(t),QT.forEach(t),J1=l(Om),ll=a(Om,"SPAN",{});var tx=n(ll);K1=i(tx,"Sharded checkpoints"),tx.forEach(t),Om.forEach(t),fc=l(o),ne=a(o,"DIV",{class:!0});var Rn=n(ne);g(qa.$$.fragment,Rn),Z1=l(Rn),Ca=a(Rn,"P",{});var Nm=n(Ca);Q1=i(Nm,`This is the same as
`),Ia=a(Nm,"A",{href:!0,rel:!0});var ox=n(Ia);cl=a(ox,"CODE",{});var rx=n(cl);e2=i(rx,"torch.nn.Module.load_state_dict"),rx.forEach(t),ox.forEach(t),t2=i(Nm,`
but for a sharded checkpoint.`),Nm.forEach(t),o2=l(Rn),ml=a(Rn,"P",{});var ax=n(ml);r2=i(ax,`This load is performed efficiently: each checkpoint shard is loaded one by one in RAM and deleted after being
loaded in the model.`),ax.forEach(t),Rn.forEach(t),this.h()},h(){m(h,"name","hf:doc:metadata"),m(h,"content",JSON.stringify(kx)),m(f,"id","models"),m(f,"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(f,"href","#models"),m(w,"class","relative group"),m(Sa,"href","/docs/transformers/v4.25.1/en/main_classes/model#transformers.PreTrainedModel"),m(Xa,"href","/docs/transformers/v4.25.1/en/main_classes/model#transformers.TFPreTrainedModel"),m(Va,"href","/docs/transformers/v4.25.1/en/main_classes/model#transformers.FlaxPreTrainedModel"),m(Ga,"href","/docs/transformers/v4.25.1/en/main_classes/model#transformers.PreTrainedModel"),m(Ra,"href","/docs/transformers/v4.25.1/en/main_classes/model#transformers.TFPreTrainedModel"),m(Ha,"href","/docs/transformers/v4.25.1/en/main_classes/model#transformers.modeling_utils.ModuleUtilsMixin"),m(Ya,"href","/docs/transformers/v4.25.1/en/main_classes/text_generation#transformers.GenerationMixin"),m(Ja,"href","/docs/transformers/v4.25.1/en/main_classes/text_generation#transformers.TFGenerationMixin"),m(Ka,"href","/docs/transformers/v4.25.1/en/main_classes/text_generation#transformers.FlaxGenerationMixin"),m(it,"id","transformers.PreTrainedModel"),m(it,"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(it,"href","#transformers.PreTrainedModel"),m(Se,"class","relative group"),m(Qa,"href","/docs/transformers/v4.25.1/en/main_classes/model#transformers.PreTrainedModel"),m(en,"href","/docs/transformers/v4.25.1/en/main_classes/configuration#transformers.PretrainedConfig"),m(tn,"href","/docs/transformers/v4.25.1/en/main_classes/configuration#transformers.PretrainedConfig"),m(on,"href","/docs/transformers/v4.25.1/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(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(gt,"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,"href","https://discuss.pytorch.org/t/gpu-memory-that-model-uses/56822/2"),m(Wo,"rel","nofollow"),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(bt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(he,"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(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($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(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(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(nn,"href","/docs/transformers/v4.25.1/en/main_classes/model#transformers.PreTrainedModel.from_pretrained"),m(Tt,"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(_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(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(sn,"id","from_pretrained-torch-dtype"),m(kt,"id","large-model-loading"),m(kt,"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(kt,"href","#large-model-loading"),m(Ge,"class","relative group"),m(dn,"href","/docs/transformers/v4.25.1/en/main_classes/model#transformers.PreTrainedModel.from_pretrained"),m(nr,"href","https://huggingface.co/docs/accelerate/big_modeling"),m(nr,"rel","nofollow"),m(jt,"id","model-instantiation-dtype"),m(jt,"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(jt,"href","#model-instantiation-dtype"),m(Re,"class","relative group"),m(zt,"id","transformers.modeling_utils.ModuleUtilsMixin"),m(zt,"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(zt,"href","#transformers.modeling_utils.ModuleUtilsMixin"),m(He,"class","relative group"),m(ye,"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($r,"href","https://arxiv.org/pdf/2001.08361.pdf"),m($r,"rel","nofollow"),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(Ct,"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(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(Ut,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(mn,"href","/docs/transformers/v4.25.1/en/main_classes/model#transformers.modeling_utils.ModuleUtilsMixin.add_memory_hooks"),m(Ot,"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(Nt,"id","transformers.TFPreTrainedModel"),m(Nt,"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(Nt,"href","#transformers.TFPreTrainedModel"),m(Ze,"class","relative group"),m(hn,"href","/docs/transformers/v4.25.1/en/main_classes/model#transformers.TFPreTrainedModel"),m(fn,"href","/docs/transformers/v4.25.1/en/main_classes/configuration#transformers.PretrainedConfig"),m(un,"href","/docs/transformers/v4.25.1/en/main_classes/configuration#transformers.PretrainedConfig"),m(we,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),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(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(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(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Rt,"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,"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(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(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(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(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(Rr,"href","https://huggingface.co/docs/datasets/v2.7.1/en/package_reference/main_classes#datasets.Dataset"),m(Rr,"rel","nofollow"),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(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(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(gn,"href","/docs/transformers/v4.25.1/en/main_classes/model#transformers.TFPreTrainedModel.from_pretrained"),m(ro,"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(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(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(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(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(po,"id","transformers.modeling_tf_utils.TFModelUtilsMixin"),m(po,"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(po,"href","#transformers.modeling_tf_utils.TFModelUtilsMixin"),m(et,"class","relative group"),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(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(fo,"id","transformers.FlaxPreTrainedModel"),m(fo,"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(fo,"href","#transformers.FlaxPreTrainedModel"),m(tt,"class","relative group"),m(bn,"href","/docs/transformers/v4.25.1/en/main_classes/model#transformers.FlaxPreTrainedModel"),m(vn,"href","/docs/transformers/v4.25.1/en/main_classes/configuration#transformers.PretrainedConfig"),m(yn,"href","/docs/transformers/v4.25.1/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(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(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(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(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(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(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(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(To,"id","transformers.utils.PushToHubMixin"),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.utils.PushToHubMixin"),m(rt,"class","relative group"),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(ae,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(ko,"id","transformers.modeling_utils.load_sharded_checkpoint"),m(ko,"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(ko,"href","#transformers.modeling_utils.load_sharded_checkpoint"),m(at,"class","relative group"),m(Ia,"href","https://pytorch.org/docs/stable/generated/torch.nn.Module.html?highlight=load_state_dict#torch.nn.Module.load_state_dict"),m(Ia,"rel","nofollow"),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(o,p){e(document.head,h),$(o,P,p),$(o,w,p),e(w,f),e(f,E),_(c,E,null),e(w,T),e(w,nt),e(nt,Wm),$(o,Fl,p),$(o,K,p),e(K,Sm),e(K,Sa),e(Sa,Xm),e(K,Vm),e(K,Xa),e(Xa,Gm),e(K,Rm),e(K,Va),e(Va,Hm),e(K,Ym),$(o,jl,p),$(o,We,p),e(We,Ga),e(Ga,Jm),e(We,Km),e(We,Ra),e(Ra,Zm),e(We,Qm),$(o,Dl,p),$(o,st,p),e(st,Hn),e(Hn,ep),e(st,tp),e(st,Yn),e(Yn,op),$(o,zl,p),$(o,O,p),e(O,rp),e(O,Ha),e(Ha,ap),e(O,np),e(O,Jn),e(Jn,sp),e(O,ip),e(O,Ya),e(Ya,dp),e(O,lp),e(O,Ja),e(Ja,cp),e(O,mp),e(O,Ka),e(Ka,pp),e(O,hp),$(o,Al,p),$(o,Se,p),e(Se,it),e(it,Kn),_(Do,Kn,null),e(Se,fp),e(Se,Zn),e(Zn,up),$(o,ql,p),$(o,F,p),_(zo,F,null),e(F,gp),e(F,Qn),e(Qn,_p),e(F,bp),e(F,Za),e(Za,Qa),e(Qa,vp),e(Za,yp),e(F,$p),e(F,Ao),e(Ao,es),e(es,wp),e(Ao,Tp),e(Ao,ts),e(ts,xp),e(F,kp),e(F,os),e(os,Pp),e(F,Mp),e(F,V),e(V,rs),e(rs,ce),e(ce,as),e(as,Ep),e(ce,Fp),e(ce,en),e(en,jp),e(ce,Dp),e(ce,tn),e(tn,zp),e(ce,Ap),e(V,qp),e(V,qo),e(qo,me),e(me,ns),e(ns,Cp),e(me,Ip),e(me,ss),e(ss,Lp),e(me,Up),e(me,is),e(is,Op),e(me,Np),e(qo,Bp),e(qo,Xe),e(Xe,dt),e(dt,ds),e(ds,Wp),e(dt,Sp),e(dt,on),e(on,Xp),e(dt,Vp),e(Xe,Gp),e(Xe,lt),e(lt,ls),e(ls,Rp),e(lt,Hp),e(lt,cs),e(cs,Yp),e(lt,Jp),e(Xe,Kp),e(Xe,ct),e(ct,ms),e(ms,Zp),e(ct,Qp),e(ct,ps),e(ps,eh),e(ct,th),e(V,oh),e(V,hs),e(hs,mt),e(mt,fs),e(fs,rh),e(mt,ah),e(mt,us),e(us,nh),e(mt,sh),e(V,ih),e(V,gs),e(gs,pt),e(pt,_s),e(_s,dh),e(pt,lh),e(pt,bs),e(bs,ch),e(pt,mh),e(V,ph),e(V,vs),e(vs,N),e(N,ys),e(ys,hh),e(N,fh),e(N,$s),e($s,uh),e(N,gh),e(N,ws),e(ws,_h),e(N,bh),e(N,Ts),e(Ts,vh),e(N,yh),e(N,xs),e(xs,$h),e(N,wh),e(F,Th),e(F,pe),_(Co,pe,null),e(pe,xh),e(pe,Io),e(Io,kh),e(Io,ks),e(ks,Ph),e(Io,Mh),e(pe,Eh),_(ht,pe,null),e(F,Fh),e(F,A),_(Lo,A,null),e(A,jh),e(A,Ps),e(Ps,Dh),e(A,zh),e(A,Ve),e(Ve,Ah),e(Ve,Ms),e(Ms,qh),e(Ve,Ch),e(Ve,Es),e(Es,Ih),e(Ve,Lh),e(A,Uh),e(A,Uo),e(Uo,Oh),e(Uo,Fs),e(Fs,Nh),e(Uo,Bh),e(A,Wh),e(A,Oo),e(Oo,Sh),e(Oo,js),e(js,Xh),e(Oo,Vh),e(A,Gh),_(ft,A,null),e(A,Rh),_(ut,A,null),e(A,Hh),e(A,Ds),e(Ds,rn),e(rn,zs),e(zs,Yh),e(rn,Jh),e(A,Kh),e(A,As),e(As,Zh),e(A,Qh),e(A,qs),e(qs,ef),e(A,tf),e(A,G),e(G,Cs),e(Cs,of),e(G,rf),e(G,Is),e(Is,af),e(G,nf),e(G,Ls),e(Ls,sf),e(G,df),e(G,Us),e(Us,lf),e(G,cf),e(G,Os),e(Os,mf),e(A,pf),e(A,Ns),e(Ns,hf),e(F,ff),e(F,gt),_(No,gt,null),e(gt,uf),e(gt,Bs),e(Bs,gf),e(F,_f),e(F,_t),_(Bo,_t,null),e(_t,bf),e(_t,an),e(an,vf),e(an,Wo),e(Wo,yf),e(F,$f),e(F,bt),_(So,bt,null),e(bt,wf),e(bt,Ws),e(Ws,Tf),e(F,xf),e(F,he),_(Xo,he,null),e(he,kf),e(he,Ss),e(Ss,Pf),e(he,Mf),e(he,Xs),e(Xs,Ef),e(F,Ff),e(F,fe),_(Vo,fe,null),e(fe,jf),e(fe,Vs),e(Vs,Df),e(fe,zf),e(fe,Gs),e(Gs,Af),e(F,qf),e(F,vt),_(Go,vt,null),e(vt,Cf),e(vt,Rs),e(Rs,If),e(F,Lf),e(F,yt),_(Ro,yt,null),e(yt,Uf),e(yt,Hs),e(Hs,Of),e(F,Nf),e(F,$t),_(Ho,$t,null),e($t,Bf),e($t,Ys),e(Ys,Wf),e(F,Sf),e(F,ue),_(Yo,ue,null),e(ue,Xf),e(ue,Js),e(Js,Vf),e(ue,Gf),_(wt,ue,null),e(F,Rf),e(F,ge),_(Jo,ge,null),e(ge,Hf),e(ge,Ko),e(Ko,Yf),e(Ko,Ks),e(Ks,Jf),e(Ko,Kf),e(ge,Zf),e(ge,Zo),e(Zo,Qf),e(Zo,Zs),e(Zs,eu),e(Zo,tu),e(F,ou),e(F,Tt),_(Qo,Tt,null),e(Tt,ru),e(Tt,er),e(er,au),e(er,nn),e(nn,nu),e(er,su),e(F,iu),e(F,xt),_(tr,xt,null),e(xt,du),e(xt,Qs),e(Qs,lu),e(F,cu),e(F,_e),_(or,_e,null),e(_e,mu),e(_e,ei),e(ei,pu),e(_e,hu),e(_e,rr),e(rr,fu),e(rr,ti),e(ti,uu),e(rr,gu),$(o,Cl,p),$(o,sn,p),$(o,Il,p),$(o,Ge,p),e(Ge,kt),e(kt,oi),_(ar,oi,null),e(Ge,_u),e(Ge,ri),e(ri,bu),$(o,Ll,p),$(o,be,p),e(be,vu),e(be,dn),e(dn,yu),e(be,$u),e(be,nr),e(nr,wu),e(be,Tu),$(o,Ul,p),$(o,Pt,p),e(Pt,xu),e(Pt,ai),e(ai,ku),e(Pt,Pu),$(o,Ol,p),_(sr,o,p),$(o,Nl,p),$(o,Mt,p),e(Mt,Mu),e(Mt,ni),e(ni,Eu),e(Mt,Fu),$(o,Bl,p),$(o,Z,p),e(Z,ju),e(Z,si),e(si,Du),e(Z,zu),e(Z,ii),e(ii,Au),e(Z,qu),e(Z,di),e(di,Cu),e(Z,Iu),$(o,Wl,p),_(ir,o,p),$(o,Sl,p),$(o,Et,p),e(Et,Lu),e(Et,li),e(li,Uu),e(Et,Ou),$(o,Xl,p),_(dr,o,p),$(o,Vl,p),_(lr,o,p),$(o,Gl,p),$(o,ln,p),e(ln,Nu),$(o,Rl,p),_(cr,o,p),$(o,Hl,p),$(o,Ft,p),e(Ft,Bu),e(Ft,ci),e(ci,Wu),e(Ft,Su),$(o,Yl,p),$(o,Re,p),e(Re,jt),e(jt,mi),_(mr,mi,null),e(Re,Xu),e(Re,pi),e(pi,Vu),$(o,Jl,p),$(o,Q,p),e(Q,Gu),e(Q,hi),e(hi,Ru),e(Q,Hu),e(Q,fi),e(fi,Yu),e(Q,Ju),e(Q,ui),e(ui,Ku),e(Q,Zu),$(o,Kl,p),_(pr,o,p),$(o,Zl,p),$(o,ve,p),e(ve,Qu),e(ve,gi),e(gi,eg),e(ve,tg),e(ve,_i),e(_i,og),e(ve,rg),$(o,Ql,p),_(hr,o,p),$(o,ec,p),$(o,Dt,p),e(Dt,ag),e(Dt,bi),e(bi,ng),e(Dt,sg),$(o,tc,p),_(fr,o,p),$(o,oc,p),$(o,cn,p),e(cn,ig),$(o,rc,p),$(o,He,p),e(He,zt),e(zt,vi),_(ur,vi,null),e(He,dg),e(He,yi),e(yi,lg),$(o,ac,p),$(o,C,p),_(gr,C,null),e(C,cg),e(C,_r),e(_r,mg),e(_r,$i),e($i,pg),e(_r,hg),e(C,fg),e(C,ye),_(br,ye,null),e(ye,ug),e(ye,wi),e(wi,gg),e(ye,_g),e(ye,Ye),e(Ye,bg),e(Ye,Ti),e(Ti,vg),e(Ye,yg),e(Ye,xi),e(xi,$g),e(Ye,wg),e(C,Tg),e(C,At),_(vr,At,null),e(At,xg),e(At,ki),e(ki,kg),e(C,Pg),e(C,qt),_(yr,qt,null),e(qt,Mg),e(qt,Je),e(Je,Eg),e(Je,Pi),e(Pi,Fg),e(Je,jg),e(Je,$r),e($r,Dg),e(Je,zg),e(C,Ag),e(C,Ct),_(wr,Ct,null),e(Ct,qg),e(Ct,Mi),e(Mi,Cg),e(C,Ig),e(C,It),_(Tr,It,null),e(It,Lg),e(It,Ei),e(Ei,Ug),e(C,Og),e(C,Lt),_(xr,Lt,null),e(Lt,Ng),e(Lt,Fi),e(Fi,Bg),e(C,Wg),e(C,Ut),_(kr,Ut,null),e(Ut,Sg),e(Ut,ji),e(ji,Xg),e(C,Vg),e(C,Ot),_(Pr,Ot,null),e(Ot,Gg),e(Ot,Ke),e(Ke,Rg),e(Ke,Di),e(Di,Hg),e(Ke,Yg),e(Ke,mn),e(mn,Jg),e(Ke,Kg),$(o,nc,p),$(o,Ze,p),e(Ze,Nt),e(Nt,zi),_(Mr,zi,null),e(Ze,Zg),e(Ze,Ai),e(Ai,Qg),$(o,sc,p),$(o,x,p),_(Er,x,null),e(x,e_),e(x,qi),e(qi,t_),e(x,o_),e(x,pn),e(pn,hn),e(hn,r_),e(pn,a_),e(x,n_),e(x,Fr),e(Fr,Ci),e(Ci,s_),e(Fr,i_),e(Fr,Ii),e(Ii,d_),e(x,l_),e(x,Li),e(Li,c_),e(x,m_),e(x,Qe),e(Qe,$e),e($e,Ui),e(Ui,p_),e($e,h_),e($e,fn),e(fn,f_),e($e,u_),e($e,un),e(un,g_),e($e,__),e(Qe,b_),e(Qe,Bt),e(Bt,Oi),e(Oi,v_),e(Bt,y_),e(Bt,Ni),e(Ni,$_),e(Bt,w_),e(Qe,T_),e(Qe,B),e(B,Bi),e(Bi,x_),e(B,k_),e(B,Wi),e(Wi,P_),e(B,M_),e(B,Si),e(Si,E_),e(B,F_),e(B,Xi),e(Xi,j_),e(B,D_),e(B,Vi),e(Vi,z_),e(B,A_),e(x,q_),e(x,we),_(jr,we,null),e(we,C_),e(we,Dr),e(Dr,I_),e(Dr,Gi),e(Gi,L_),e(Dr,U_),e(we,O_),_(Wt,we,null),e(x,N_),e(x,St),_(zr,St,null),e(St,B_),e(St,Ri),e(Ri,W_),e(x,S_),e(x,Xt),_(Ar,Xt,null),e(Xt,X_),e(Xt,qr),e(qr,V_),e(qr,Hi),e(Hi,G_),e(qr,R_),e(x,H_),e(x,Vt),_(Cr,Vt,null),e(Vt,Y_),e(Vt,Yi),e(Yi,J_),e(x,K_),e(x,W),_(Ir,W,null),e(W,Z_),e(W,Ji),e(Ji,Q_),e(W,eb),e(W,Lr),e(Lr,tb),e(Lr,Ki),e(Ki,ob),e(Lr,rb),e(W,ab),e(W,Ur),e(Ur,nb),e(Ur,Zi),e(Zi,sb),e(Ur,ib),e(W,db),_(Gt,W,null),e(x,lb),e(x,Rt),_(Or,Rt,null),e(Rt,cb),e(Rt,Qi),e(Qi,mb),e(x,pb),e(x,Ht),_(Nr,Ht,null),e(Ht,hb),e(Ht,ed),e(ed,fb),e(x,ub),e(x,Yt),_(Br,Yt,null),e(Yt,gb),e(Yt,td),e(td,_b),e(x,bb),e(x,Jt),_(Wr,Jt,null),e(Jt,vb),e(Jt,od),e(od,yb),e(x,$b),e(x,Kt),_(Sr,Kt,null),e(Kt,wb),e(Kt,rd),e(rd,Tb),e(x,xb),e(x,Zt),_(Xr,Zt,null),e(Zt,kb),e(Zt,ad),e(ad,Pb),e(x,Mb),e(x,Qt),_(Vr,Qt,null),e(Qt,Eb),e(Qt,nd),e(nd,Fb),e(x,jb),e(x,eo),_(Gr,eo,null),e(eo,Db),e(eo,R),e(R,zb),e(R,Rr),e(Rr,Ab),e(R,qb),e(R,sd),e(sd,Cb),e(R,Ib),e(R,id),e(id,Lb),e(R,Ub),e(R,dd),e(dd,Ob),e(R,Nb),e(x,Bb),e(x,to),_(Hr,to,null),e(to,Wb),e(to,ld),e(ld,Sb),e(x,Xb),e(x,Te),_(Yr,Te,null),e(Te,Vb),e(Te,cd),e(cd,Gb),e(Te,Rb),_(oo,Te,null),e(x,Hb),e(x,xe),_(Jr,xe,null),e(xe,Yb),e(xe,Kr),e(Kr,Jb),e(Kr,md),e(md,Kb),e(Kr,Zb),e(xe,Qb),e(xe,Zr),e(Zr,ev),e(Zr,pd),e(pd,tv),e(Zr,ov),e(x,rv),e(x,ro),_(Qr,ro,null),e(ro,av),e(ro,ea),e(ea,nv),e(ea,gn),e(gn,sv),e(ea,iv),e(x,dv),e(x,ao),_(ta,ao,null),e(ao,lv),e(ao,hd),e(hd,cv),e(x,mv),e(x,no),_(oa,no,null),e(no,pv),e(no,fd),e(fd,hv),e(x,fv),e(x,so),_(ra,so,null),e(so,uv),e(so,ud),e(ud,gv),e(x,_v),e(x,io),_(aa,io,null),e(io,bv),e(io,gd),e(gd,vv),e(x,yv),e(x,lo),_(na,lo,null),e(lo,$v),e(lo,_d),e(_d,wv),e(x,Tv),e(x,co),_(sa,co,null),e(co,xv),e(co,ia),e(ia,kv),e(ia,bd),e(bd,Pv),e(ia,Mv),e(x,Ev),e(x,mo),_(da,mo,null),e(mo,Fv),e(mo,la),e(la,jv),e(la,vd),e(vd,Dv),e(la,zv),$(o,ic,p),$(o,et,p),e(et,po),e(po,yd),_(ca,yd,null),e(et,Av),e(et,$d),e($d,qv),$(o,dc,p),$(o,re,p),_(ma,re,null),e(re,Cv),e(re,pa),e(pa,Iv),e(pa,wd),e(wd,Lv),e(pa,Uv),e(re,Ov),e(re,ho),_(ha,ho,null),e(ho,Nv),e(ho,Td),e(Td,Bv),$(o,lc,p),$(o,tt,p),e(tt,fo),e(fo,xd),_(fa,xd,null),e(tt,Wv),e(tt,kd),e(kd,Sv),$(o,cc,p),$(o,D,p),_(ua,D,null),e(D,Xv),e(D,Pd),e(Pd,Vv),e(D,Gv),e(D,_n),e(_n,bn),e(bn,Rv),e(_n,Hv),e(D,Yv),e(D,Md),e(Md,Jv),e(D,Kv),e(D,ot),e(ot,ke),e(ke,Ed),e(Ed,Zv),e(ke,Qv),e(ke,vn),e(vn,ey),e(ke,ty),e(ke,yn),e(yn,oy),e(ke,ry),e(ot,ay),e(ot,uo),e(uo,Fd),e(Fd,ny),e(uo,sy),e(uo,jd),e(jd,iy),e(uo,dy),e(ot,ly),e(ot,S),e(S,Dd),e(Dd,cy),e(S,my),e(S,zd),e(zd,py),e(S,hy),e(S,Ad),e(Ad,fy),e(S,uy),e(S,qd),e(qd,gy),e(S,_y),e(S,Cd),e(Cd,by),e(S,vy),e(D,yy),e(D,Pe),_(ga,Pe,null),e(Pe,$y),e(Pe,_a),e(_a,wy),e(_a,Id),e(Id,Ty),e(_a,xy),e(Pe,ky),_(go,Pe,null),e(D,Py),e(D,X),_(ba,X,null),e(X,My),e(X,Ld),e(Ld,Ey),e(X,Fy),e(X,va),e(va,jy),e(va,Ud),e(Ud,Dy),e(va,zy),e(X,Ay),e(X,ya),e(ya,qy),e(ya,Od),e(Od,Cy),e(ya,Iy),e(X,Ly),_(_o,X,null),e(D,Uy),e(D,Me),_($a,Me,null),e(Me,Oy),e(Me,wa),e(wa,Ny),e(wa,Nd),e(Nd,By),e(wa,Wy),e(Me,Sy),e(Me,Bd),e(Bd,Xy),e(D,Vy),e(D,Ee),_(Ta,Ee,null),e(Ee,Gy),e(Ee,Wd),e(Wd,Ry),e(Ee,Hy),_(bo,Ee,null),e(D,Yy),e(D,vo),_(xa,vo,null),e(vo,Jy),e(vo,ka),e(ka,Ky),e(ka,Sd),e(Sd,Zy),e(ka,Qy),e(D,e1),e(D,ee),_(Pa,ee,null),e(ee,t1),e(ee,H),e(H,o1),e(H,Xd),e(Xd,r1),e(H,a1),e(H,Vd),e(Vd,n1),e(H,s1),e(H,Gd),e(Gd,i1),e(H,d1),e(H,Rd),e(Rd,l1),e(H,c1),e(ee,m1),e(ee,Hd),e(Hd,p1),e(ee,h1),_(yo,ee,null),e(D,f1),e(D,te),_(Ma,te,null),e(te,u1),e(te,Y),e(Y,g1),e(Y,Yd),e(Yd,_1),e(Y,b1),e(Y,Jd),e(Jd,v1),e(Y,y1),e(Y,Kd),e(Kd,$1),e(Y,w1),e(Y,Zd),e(Zd,T1),e(Y,x1),e(te,k1),e(te,Qd),e(Qd,P1),e(te,M1),_($o,te,null),e(D,E1),e(D,Fe),_(Ea,Fe,null),e(Fe,F1),e(Fe,J),e(J,j1),e(J,el),e(el,D1),e(J,z1),e(J,tl),e(tl,A1),e(J,q1),e(J,ol),e(ol,C1),e(J,I1),e(J,rl),e(rl,L1),e(J,U1),e(Fe,O1),_(wo,Fe,null),$(o,mc,p),$(o,rt,p),e(rt,To),e(To,al),_(Fa,al,null),e(rt,N1),e(rt,nl),e(nl,B1),$(o,pc,p),$(o,ae,p),_(ja,ae,null),e(ae,W1),e(ae,sl),e(sl,S1),e(ae,X1),e(ae,je),_(Da,je,null),e(je,V1),e(je,za),e(za,G1),e(za,il),e(il,R1),e(za,H1),e(je,Y1),_(xo,je,null),$(o,hc,p),$(o,at,p),e(at,ko),e(ko,dl),_(Aa,dl,null),e(at,J1),e(at,ll),e(ll,K1),$(o,fc,p),$(o,ne,p),_(qa,ne,null),e(ne,Z1),e(ne,Ca),e(Ca,Q1),e(Ca,Ia),e(Ia,cl),e(cl,e2),e(Ca,t2),e(ne,o2),e(ne,ml),e(ml,r2),uc=!0},p(o,[p]){const La={};p&2&&(La.$$scope={dirty:p,ctx:o}),ht.$set(La);const pl={};p&2&&(pl.$$scope={dirty:p,ctx:o}),ft.$set(pl);const hl={};p&2&&(hl.$$scope={dirty:p,ctx:o}),ut.$set(hl);const fl={};p&2&&(fl.$$scope={dirty:p,ctx:o}),wt.$set(fl);const se={};p&2&&(se.$$scope={dirty:p,ctx:o}),Wt.$set(se);const ul={};p&2&&(ul.$$scope={dirty:p,ctx:o}),Gt.$set(ul);const gl={};p&2&&(gl.$$scope={dirty:p,ctx:o}),oo.$set(gl);const _l={};p&2&&(_l.$$scope={dirty:p,ctx:o}),go.$set(_l);const Po={};p&2&&(Po.$$scope={dirty:p,ctx:o}),_o.$set(Po);const bl={};p&2&&(bl.$$scope={dirty:p,ctx:o}),bo.$set(bl);const vl={};p&2&&(vl.$$scope={dirty:p,ctx:o}),yo.$set(vl);const Ua={};p&2&&(Ua.$$scope={dirty:p,ctx:o}),$o.$set(Ua);const yl={};p&2&&(yl.$$scope={dirty:p,ctx:o}),wo.$set(yl);const $l={};p&2&&($l.$$scope={dirty:p,ctx:o}),xo.$set($l)},i(o){uc||(b(c.$$.fragment,o),b(Do.$$.fragment,o),b(zo.$$.fragment,o),b(Co.$$.fragment,o),b(ht.$$.fragment,o),b(Lo.$$.fragment,o),b(ft.$$.fragment,o),b(ut.$$.fragment,o),b(No.$$.fragment,o),b(Bo.$$.fragment,o),b(So.$$.fragment,o),b(Xo.$$.fragment,o),b(Vo.$$.fragment,o),b(Go.$$.fragment,o),b(Ro.$$.fragment,o),b(Ho.$$.fragment,o),b(Yo.$$.fragment,o),b(wt.$$.fragment,o),b(Jo.$$.fragment,o),b(Qo.$$.fragment,o),b(tr.$$.fragment,o),b(or.$$.fragment,o),b(ar.$$.fragment,o),b(sr.$$.fragment,o),b(ir.$$.fragment,o),b(dr.$$.fragment,o),b(lr.$$.fragment,o),b(cr.$$.fragment,o),b(mr.$$.fragment,o),b(pr.$$.fragment,o),b(hr.$$.fragment,o),b(fr.$$.fragment,o),b(ur.$$.fragment,o),b(gr.$$.fragment,o),b(br.$$.fragment,o),b(vr.$$.fragment,o),b(yr.$$.fragment,o),b(wr.$$.fragment,o),b(Tr.$$.fragment,o),b(xr.$$.fragment,o),b(kr.$$.fragment,o),b(Pr.$$.fragment,o),b(Mr.$$.fragment,o),b(Er.$$.fragment,o),b(jr.$$.fragment,o),b(Wt.$$.fragment,o),b(zr.$$.fragment,o),b(Ar.$$.fragment,o),b(Cr.$$.fragment,o),b(Ir.$$.fragment,o),b(Gt.$$.fragment,o),b(Or.$$.fragment,o),b(Nr.$$.fragment,o),b(Br.$$.fragment,o),b(Wr.$$.fragment,o),b(Sr.$$.fragment,o),b(Xr.$$.fragment,o),b(Vr.$$.fragment,o),b(Gr.$$.fragment,o),b(Hr.$$.fragment,o),b(Yr.$$.fragment,o),b(oo.$$.fragment,o),b(Jr.$$.fragment,o),b(Qr.$$.fragment,o),b(ta.$$.fragment,o),b(oa.$$.fragment,o),b(ra.$$.fragment,o),b(aa.$$.fragment,o),b(na.$$.fragment,o),b(sa.$$.fragment,o),b(da.$$.fragment,o),b(ca.$$.fragment,o),b(ma.$$.fragment,o),b(ha.$$.fragment,o),b(fa.$$.fragment,o),b(ua.$$.fragment,o),b(ga.$$.fragment,o),b(go.$$.fragment,o),b(ba.$$.fragment,o),b(_o.$$.fragment,o),b($a.$$.fragment,o),b(Ta.$$.fragment,o),b(bo.$$.fragment,o),b(xa.$$.fragment,o),b(Pa.$$.fragment,o),b(yo.$$.fragment,o),b(Ma.$$.fragment,o),b($o.$$.fragment,o),b(Ea.$$.fragment,o),b(wo.$$.fragment,o),b(Fa.$$.fragment,o),b(ja.$$.fragment,o),b(Da.$$.fragment,o),b(xo.$$.fragment,o),b(Aa.$$.fragment,o),b(qa.$$.fragment,o),uc=!0)},o(o){v(c.$$.fragment,o),v(Do.$$.fragment,o),v(zo.$$.fragment,o),v(Co.$$.fragment,o),v(ht.$$.fragment,o),v(Lo.$$.fragment,o),v(ft.$$.fragment,o),v(ut.$$.fragment,o),v(No.$$.fragment,o),v(Bo.$$.fragment,o),v(So.$$.fragment,o),v(Xo.$$.fragment,o),v(Vo.$$.fragment,o),v(Go.$$.fragment,o),v(Ro.$$.fragment,o),v(Ho.$$.fragment,o),v(Yo.$$.fragment,o),v(wt.$$.fragment,o),v(Jo.$$.fragment,o),v(Qo.$$.fragment,o),v(tr.$$.fragment,o),v(or.$$.fragment,o),v(ar.$$.fragment,o),v(sr.$$.fragment,o),v(ir.$$.fragment,o),v(dr.$$.fragment,o),v(lr.$$.fragment,o),v(cr.$$.fragment,o),v(mr.$$.fragment,o),v(pr.$$.fragment,o),v(hr.$$.fragment,o),v(fr.$$.fragment,o),v(ur.$$.fragment,o),v(gr.$$.fragment,o),v(br.$$.fragment,o),v(vr.$$.fragment,o),v(yr.$$.fragment,o),v(wr.$$.fragment,o),v(Tr.$$.fragment,o),v(xr.$$.fragment,o),v(kr.$$.fragment,o),v(Pr.$$.fragment,o),v(Mr.$$.fragment,o),v(Er.$$.fragment,o),v(jr.$$.fragment,o),v(Wt.$$.fragment,o),v(zr.$$.fragment,o),v(Ar.$$.fragment,o),v(Cr.$$.fragment,o),v(Ir.$$.fragment,o),v(Gt.$$.fragment,o),v(Or.$$.fragment,o),v(Nr.$$.fragment,o),v(Br.$$.fragment,o),v(Wr.$$.fragment,o),v(Sr.$$.fragment,o),v(Xr.$$.fragment,o),v(Vr.$$.fragment,o),v(Gr.$$.fragment,o),v(Hr.$$.fragment,o),v(Yr.$$.fragment,o),v(oo.$$.fragment,o),v(Jr.$$.fragment,o),v(Qr.$$.fragment,o),v(ta.$$.fragment,o),v(oa.$$.fragment,o),v(ra.$$.fragment,o),v(aa.$$.fragment,o),v(na.$$.fragment,o),v(sa.$$.fragment,o),v(da.$$.fragment,o),v(ca.$$.fragment,o),v(ma.$$.fragment,o),v(ha.$$.fragment,o),v(fa.$$.fragment,o),v(ua.$$.fragment,o),v(ga.$$.fragment,o),v(go.$$.fragment,o),v(ba.$$.fragment,o),v(_o.$$.fragment,o),v($a.$$.fragment,o),v(Ta.$$.fragment,o),v(bo.$$.fragment,o),v(xa.$$.fragment,o),v(Pa.$$.fragment,o),v(yo.$$.fragment,o),v(Ma.$$.fragment,o),v($o.$$.fragment,o),v(Ea.$$.fragment,o),v(wo.$$.fragment,o),v(Fa.$$.fragment,o),v(ja.$$.fragment,o),v(Da.$$.fragment,o),v(xo.$$.fragment,o),v(Aa.$$.fragment,o),v(qa.$$.fragment,o),uc=!1},d(o){t(h),o&&t(P),o&&t(w),y(c),o&&t(Fl),o&&t(K),o&&t(jl),o&&t(We),o&&t(Dl),o&&t(st),o&&t(zl),o&&t(O),o&&t(Al),o&&t(Se),y(Do),o&&t(ql),o&&t(F),y(zo),y(Co),y(ht),y(Lo),y(ft),y(ut),y(No),y(Bo),y(So),y(Xo),y(Vo),y(Go),y(Ro),y(Ho),y(Yo),y(wt),y(Jo),y(Qo),y(tr),y(or),o&&t(Cl),o&&t(sn),o&&t(Il),o&&t(Ge),y(ar),o&&t(Ll),o&&t(be),o&&t(Ul),o&&t(Pt),o&&t(Ol),y(sr,o),o&&t(Nl),o&&t(Mt),o&&t(Bl),o&&t(Z),o&&t(Wl),y(ir,o),o&&t(Sl),o&&t(Et),o&&t(Xl),y(dr,o),o&&t(Vl),y(lr,o),o&&t(Gl),o&&t(ln),o&&t(Rl),y(cr,o),o&&t(Hl),o&&t(Ft),o&&t(Yl),o&&t(Re),y(mr),o&&t(Jl),o&&t(Q),o&&t(Kl),y(pr,o),o&&t(Zl),o&&t(ve),o&&t(Ql),y(hr,o),o&&t(ec),o&&t(Dt),o&&t(tc),y(fr,o),o&&t(oc),o&&t(cn),o&&t(rc),o&&t(He),y(ur),o&&t(ac),o&&t(C),y(gr),y(br),y(vr),y(yr),y(wr),y(Tr),y(xr),y(kr),y(Pr),o&&t(nc),o&&t(Ze),y(Mr),o&&t(sc),o&&t(x),y(Er),y(jr),y(Wt),y(zr),y(Ar),y(Cr),y(Ir),y(Gt),y(Or),y(Nr),y(Br),y(Wr),y(Sr),y(Xr),y(Vr),y(Gr),y(Hr),y(Yr),y(oo),y(Jr),y(Qr),y(ta),y(oa),y(ra),y(aa),y(na),y(sa),y(da),o&&t(ic),o&&t(et),y(ca),o&&t(dc),o&&t(re),y(ma),y(ha),o&&t(lc),o&&t(tt),y(fa),o&&t(cc),o&&t(D),y(ua),y(ga),y(go),y(ba),y(_o),y($a),y(Ta),y(bo),y(xa),y(Pa),y(yo),y(Ma),y($o),y(Ea),y(wo),o&&t(mc),o&&t(rt),y(Fa),o&&t(pc),o&&t(ae),y(ja),y(Da),y(xo),o&&t(hc),o&&t(at),y(Aa),o&&t(fc),o&&t(ne),y(qa)}}}const kx={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 Px(z){return lx(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ax extends nx{constructor(h){super();sx(this,h,Px,xx,ix,{})}}export{Ax as default,kx as metadata};
