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