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

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

					</div>`,name:"_fast_init(bool,"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_utils.py#L1833",parameterGroups:[{title:"Parameters for big model inference",parametersDescription:[{anchor:"transformers.PreTrainedModel.from_pretrained.low_cpu_mem_usage(bool,",description:`<strong>low_cpu_mem_usage(<code>bool</code>,</strong> <em>optional</em>) &#x2014;
Tries to not use more than 1x model size in CPU memory (including peak memory) while loading the model.
This is an experimental feature and a subject to change at any moment.`,name:"low_cpu_mem_usage(bool,"},{anchor:"transformers.PreTrainedModel.from_pretrained.torch_dtype",description:`<strong>torch_dtype</strong> (<code>str</code> or <code>torch.dtype</code>, <em>optional</em>) &#x2014;
Override the default <code>torch.dtype</code> and load the model under a specific <code>dtype</code>. The different options
are:</p>
<ol>
<li>
<p><code>torch.float16</code> or <code>torch.bfloat16</code> or <code>torch.float</code>: load in a specified
<code>dtype</code>, ignoring the model&#x2019;s <code>config.torch_dtype</code> if one exists. If not specified</p>
<ul>
<li>the model will get loaded in <code>torch.float</code> (fp32).</li>
</ul>
</li>
<li>
<p><code>&quot;auto&quot;</code> - A <code>torch_dtype</code> entry in the <code>config.json</code> file of the model will be
attempted to be used. If this entry isn&#x2019;t found then next check the <code>dtype</code> of the first weight in
the checkpoint that&#x2019;s of a floating point type and use that as <code>dtype</code>. This will load the model
using the <code>dtype</code> it was saved in at the end of the training. It can&#x2019;t be used as an indicator of how
the model was trained. Since it could be trained in one of half precision dtypes, but saved in fp32.</p>
</li>
</ol>
<tip>
<p>For some models the <code>dtype</code> they were trained in is unknown - you may try to check the model&#x2019;s paper or
reach out to the authors and ask them to add this information to the model&#x2019;s card and to insert the
<code>torch_dtype</code> entry in <code>config.json</code> on the hub.</p>
</tip>`,name:"torch_dtype"},{anchor:"transformers.PreTrainedModel.from_pretrained.device_map",description:`<strong>device_map</strong> (<code>str</code> or <code>Dict[str, Union[int, str, torch.device]]</code>, <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.quantization_config",description:`<strong>quantization_config</strong> (<code>Dict</code>, <em>optional</em>) &#x2014;
A dictionary of configuration parameters for the <code>bitsandbytes</code> library and loading the model using
advanced features such as offloading in fp32 on CPU or on disk.`,name:"quantization_config"},{anchor:"transformers.PreTrainedModel.from_pretrained.subfolder",description:`<strong>subfolder</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&quot;</code>) &#x2014;
In case the relevant files are located inside a subfolder of the model repo on huggingface.co, you can
specify the folder name here.`,name:"subfolder"},{anchor:"transformers.PreTrainedModel.from_pretrained.variant",description:`<strong>variant</strong> (<code>str</code>, <em>optional</em>) &#x2014;
If specified load weights from <code>variant</code> filename, <em>e.g.</em> pytorch_model.<variant>.bin. <code>variant</code> is
ignored when using <code>from_tf</code> or <code>from_flax</code>.</variant>`,name:"variant"},{anchor:"transformers.PreTrainedModel.from_pretrained.kwargs",description:`<strong>kwargs</strong> (remaining dictionary of keyword arguments, <em>optional</em>) &#x2014;
Can be used to update the configuration object (after it being loaded) and initiate the model (e.g.,
<code>output_attentions=True</code>). Behaves differently depending on whether a <code>config</code> is provided or
automatically loaded:</p>
<ul>
<li>If a configuration is provided with <code>config</code>, <code>**kwargs</code> will be directly passed to the
underlying model&#x2019;s <code>__init__</code> method (we assume all relevant updates to the configuration have
already been done)</li>
<li>If a configuration is not provided, <code>kwargs</code> will be first passed to the configuration class
initialization function (<a href="/docs/transformers/v4.27.1/en/main_classes/configuration#transformers.PretrainedConfig.from_pretrained">from_pretrained()</a>). Each key of <code>kwargs</code> that
corresponds to a configuration attribute will be used to override said attribute with the
supplied <code>kwargs</code> value. Remaining keys that do not correspond to any configuration attribute
will be passed to the underlying model&#x2019;s <code>__init__</code> function.</li>
</ul>`,name:"kwargs"}]}]}}),vt=new yp({props:{$$slots:{default:[F0]},$$scope:{ctx:q}}}),yt=new Be({props:{anchor:"transformers.PreTrainedModel.from_pretrained.example",$$slots:{default:[j0]},$$scope:{ctx:q}}}),Qo=new x({props:{name:"get_input_embeddings",anchor:"transformers.PreTrainedModel.get_input_embeddings",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_utils.py#L1167",returnDescription:`
<p>A torch module mapping vocabulary to hidden states.</p>
`,returnType:`
<p><code>nn.Module</code></p>
`}}),er=new x({props:{name:"get_memory_footprint",anchor:"transformers.PreTrainedModel.get_memory_footprint",parameters:[{name:"return_buffers",val:" = True"}],parametersDescription:[{anchor:"transformers.PreTrainedModel.get_memory_footprint.return_buffers",description:`<strong>return_buffers</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to return the size of the buffer tensors in the computation of the memory footprint. Buffers
are tensors that do not require gradients and not registered as parameters. E.g. mean and std in batch
norm layers. Please see: <a href="https://discuss.pytorch.org/t/what-pytorch-means-by-buffers/120266/2" rel="nofollow">https://discuss.pytorch.org/t/what-pytorch-means-by-buffers/120266/2</a>`,name:"return_buffers"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_utils.py#L1785"}}),or=new x({props:{name:"get_output_embeddings",anchor:"transformers.PreTrainedModel.get_output_embeddings",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_utils.py#L1193",returnDescription:`
<p>A torch module mapping hidden states to vocabulary.</p>
`,returnType:`
<p><code>nn.Module</code></p>
`}}),rr=new x({props:{name:"gradient_checkpointing_disable",anchor:"transformers.PreTrainedModel.gradient_checkpointing_disable",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_utils.py#L1587"}}),ar=new x({props:{name:"gradient_checkpointing_enable",anchor:"transformers.PreTrainedModel.gradient_checkpointing_enable",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_utils.py#L1576"}}),nr=new x({props:{name:"init_weights",anchor:"transformers.PreTrainedModel.init_weights",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_utils.py#L1542"}}),sr=new x({props:{name:"post_init",anchor:"transformers.PreTrainedModel.post_init",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_utils.py#L1057"}}),ir=new x({props:{name:"prune_heads",anchor:"transformers.PreTrainedModel.prune_heads",parameters:[{name:"heads_to_prune",val:": typing.Dict[int, typing.List[int]]"}],parametersDescription:[{anchor:"transformers.PreTrainedModel.prune_heads.heads_to_prune",description:`<strong>heads_to_prune</strong> (<code>Dict[int, List[int]]</code>) &#x2014;
Dictionary with keys being selected layer indices (<code>int</code>) and associated values being the list of heads
to prune in said layer (list of <code>int</code>). For instance {1: [0, 2], 2: [2, 3]} will prune heads 0 and 2 on
layer 1 and heads 2 and 3 on layer 2.`,name:"heads_to_prune"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_utils.py#L1559"}}),dr=new x({props:{name:"register_for_auto_class",anchor:"transformers.PreTrainedModel.register_for_auto_class",parameters:[{name:"auto_class",val:" = 'AutoModel'"}],parametersDescription:[{anchor:"transformers.PreTrainedModel.register_for_auto_class.auto_class",description:`<strong>auto_class</strong> (<code>str</code> or <code>type</code>, <em>optional</em>, defaults to <code>&quot;AutoModel&quot;</code>) &#x2014;
The auto class to register this new model with.`,name:"auto_class"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_utils.py#L3110"}}),Mt=new yp({props:{warning:!0,$$slots:{default:[D0]},$$scope:{ctx:q}}}),lr=new x({props:{name:"resize_token_embeddings",anchor:"transformers.PreTrainedModel.resize_token_embeddings",parameters:[{name:"new_num_tokens",val:": typing.Optional[int] = None"}],parametersDescription:[{anchor:"transformers.PreTrainedModel.resize_token_embeddings.new_num_tokens",description:`<strong>new_num_tokens</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The number of new tokens in the embedding matrix. Increasing the size will add newly initialized
vectors at the end. Reducing the size will remove vectors from the end. If not provided or <code>None</code>, just
returns a pointer to the input tokens <code>torch.nn.Embedding</code> module of the model without doing anything.`,name:"new_num_tokens"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_utils.py#L1333",returnDescription:`
<p>Pointer to the input tokens Embeddings Module of the model.</p>
`,returnType:`
<p><code>torch.nn.Embedding</code></p>
`}}),pr=new x({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 0x7f7528ca95e0>"},{name:"push_to_hub",val:": bool = False"},{name:"max_shard_size",val:": typing.Union[int, str] = '10GB'"},{name:"safe_serialization",val:": bool = False"},{name:"variant",val:": typing.Optional[str] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.PreTrainedModel.save_pretrained.save_directory",description:`<strong>save_directory</strong> (<code>str</code> or <code>os.PathLike</code>) &#x2014;
Directory to which to save. Will be created if it doesn&#x2019;t exist.`,name:"save_directory"},{anchor:"transformers.PreTrainedModel.save_pretrained.is_main_process",description:`<strong>is_main_process</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether the process calling this is the main process or not. Useful when in distributed training like
TPUs and need to call this function on all processes. In this case, set <code>is_main_process=True</code> only on
the main process to avoid race conditions.`,name:"is_main_process"},{anchor:"transformers.PreTrainedModel.save_pretrained.state_dict",description:`<strong>state_dict</strong> (nested dictionary of <code>torch.Tensor</code>) &#x2014;
The state dictionary of the model to save. Will default to <code>self.state_dict()</code>, but can be used to only
save parts of the model or if special precautions need to be taken when recovering the state dictionary
of a model (like when using model parallelism).`,name:"state_dict"},{anchor:"transformers.PreTrainedModel.save_pretrained.save_function",description:`<strong>save_function</strong> (<code>Callable</code>) &#x2014;
The function to use to save the state dictionary. Useful on distributed training like TPUs when one
need to replace <code>torch.save</code> by another method.`,name:"save_function"},{anchor:"transformers.PreTrainedModel.save_pretrained.push_to_hub",description:`<strong>push_to_hub</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to push your model to the Hugging Face model hub after saving it. You can specify the
repository you want to push to with <code>repo_id</code> (will default to the name of <code>save_directory</code> in your
namespace).`,name:"push_to_hub"},{anchor:"transformers.PreTrainedModel.save_pretrained.max_shard_size",description:`<strong>max_shard_size</strong> (<code>int</code> or <code>str</code>, <em>optional</em>, defaults to <code>&quot;10GB&quot;</code>) &#x2014;
The maximum size for a checkpoint before being sharded. Checkpoints shard will then be each of size
lower than this size. If expressed as a string, needs to be digits followed by a unit (like <code>&quot;5MB&quot;</code>).</p>
<div class="course-tip course-tip-orange bg-gradient-to-br dark:bg-gradient-to-r before:border-orange-500 dark:before:border-orange-800 from-orange-50 dark:from-gray-900 to-white dark:to-gray-950 border border-orange-50 text-orange-700 dark:text-gray-400">
						
<p>If a single weight of the model is bigger than <code>max_shard_size</code>, it will be in its own checkpoint shard
which will be bigger than <code>max_shard_size</code>.</p>

					</div>`,name:"max_shard_size"},{anchor:"transformers.PreTrainedModel.save_pretrained.safe_serialization",description:`<strong>safe_serialization</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to save the model using <code>safetensors</code> or the traditional PyTorch way (that uses <code>pickle</code>).`,name:"safe_serialization"},{anchor:"transformers.PreTrainedModel.save_pretrained.variant",description:`<strong>variant</strong> (<code>str</code>, <em>optional</em>) &#x2014;
If specified, weights are saved in the format pytorch_model.<variant>.bin.</variant></p>
<p>kwargs &#x2014;
Additional key word arguments passed along to the <a href="/docs/transformers/v4.27.1/en/internal/image_processing_utils#transformers.ImageProcessingMixin.push_to_hub">push_to_hub()</a> method.`,name:"variant"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_utils.py#L1607"}}),fr=new x({props:{name:"set_input_embeddings",anchor:"transformers.PreTrainedModel.set_input_embeddings",parameters:[{name:"value",val:": Module"}],parametersDescription:[{anchor:"transformers.PreTrainedModel.set_input_embeddings.value",description:"<strong>value</strong> (<code>nn.Module</code>) &#x2014; A module mapping vocabulary to hidden states.",name:"value"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_utils.py#L1180"}}),ur=new x({props:{name:"tie_weights",anchor:"transformers.PreTrainedModel.tie_weights",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_utils.py#L1217"}}),_r=new Ne({}),vr=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>)`}}),yr=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>)`}}),$r=new U({props:{code:"t0pp.hf_device_map",highlighted:"t0pp.hf_device_map"}}),wr=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>}`}}),Tr=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>}'}}),xr=new Ne({}),kr=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>)'}}),Mr=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)`}}),Er=new Ne({}),Fr=new x({props:{name:"class transformers.modeling_utils.ModuleUtilsMixin",anchor:"transformers.modeling_utils.ModuleUtilsMixin",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_utils.py#L690"}}),Dr=new x({props:{name:"add_memory_hooks",anchor:"transformers.modeling_utils.ModuleUtilsMixin.add_memory_hooks",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_utils.py#L721"}}),qr=new x({props:{name:"estimate_tokens",anchor:"transformers.modeling_utils.ModuleUtilsMixin.estimate_tokens",parameters:[{name:"input_dict",val:": typing.Dict[str, typing.Union[torch.Tensor, typing.Any]]"}],parametersDescription:[{anchor:"transformers.modeling_utils.ModuleUtilsMixin.estimate_tokens.inputs",description:"<strong>inputs</strong> (<code>dict</code>) &#x2014; The model inputs.",name:"inputs"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_utils.py#L925",returnDescription:`
<p>The total number of tokens.</p>
`,returnType:`
<p><code>int</code></p>
`}}),zr=new x({props:{name:"floating_point_ops",anchor:"transformers.modeling_utils.ModuleUtilsMixin.floating_point_ops",parameters:[{name:"input_dict",val:": typing.Dict[str, typing.Union[torch.Tensor, typing.Any]]"},{name:"exclude_embeddings",val:": bool = True"}],parametersDescription:[{anchor:"transformers.modeling_utils.ModuleUtilsMixin.floating_point_ops.batch_size",description:`<strong>batch_size</strong> (<code>int</code>) &#x2014;
The batch size for the forward pass.`,name:"batch_size"},{anchor:"transformers.modeling_utils.ModuleUtilsMixin.floating_point_ops.sequence_length",description:`<strong>sequence_length</strong> (<code>int</code>) &#x2014;
The number of tokens in each line of the batch.`,name:"sequence_length"},{anchor:"transformers.modeling_utils.ModuleUtilsMixin.floating_point_ops.exclude_embeddings",description:`<strong>exclude_embeddings</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to count embedding and softmax operations.`,name:"exclude_embeddings"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_utils.py#L946",returnDescription:`
<p>The number of floating-point operations.</p>
`,returnType:`
<p><code>int</code></p>
`}}),Cr=new x({props:{name:"get_extended_attention_mask",anchor:"transformers.modeling_utils.ModuleUtilsMixin.get_extended_attention_mask",parameters:[{name:"attention_mask",val:": Tensor"},{name:"input_shape",val:": typing.Tuple[int]"},{name:"device",val:": device = None"},{name:"dtype",val:": torch.float32 = None"}],parametersDescription:[{anchor:"transformers.modeling_utils.ModuleUtilsMixin.get_extended_attention_mask.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code>) &#x2014;
Mask with ones indicating tokens to attend to, zeros for tokens to ignore.`,name:"attention_mask"},{anchor:"transformers.modeling_utils.ModuleUtilsMixin.get_extended_attention_mask.input_shape",description:`<strong>input_shape</strong> (<code>Tuple[int]</code>) &#x2014;
The shape of the input to the model.`,name:"input_shape"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_utils.py#L809",returnDescription:`
<p><code>torch.Tensor</code> The extended attention mask, with a the same dtype as <code>attention_mask.dtype</code>.</p>
`}}),Ir=new x({props:{name:"get_head_mask",anchor:"transformers.modeling_utils.ModuleUtilsMixin.get_head_mask",parameters:[{name:"head_mask",val:": typing.Optional[torch.Tensor]"},{name:"num_hidden_layers",val:": int"},{name:"is_attention_chunked",val:": bool = False"}],parametersDescription:[{anchor:"transformers.modeling_utils.ModuleUtilsMixin.get_head_mask.head_mask",description:`<strong>head_mask</strong> (<code>torch.Tensor</code> with shape <code>[num_heads]</code> or <code>[num_hidden_layers x num_heads]</code>, <em>optional</em>) &#x2014;
The mask indicating if we should keep the heads or not (1.0 for keep, 0.0 for discard).`,name:"head_mask"},{anchor:"transformers.modeling_utils.ModuleUtilsMixin.get_head_mask.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>) &#x2014;
The number of hidden layers in the model.
is_attention_chunked &#x2014; (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>):
Whether or not the attentions scores are computed by chunks or not.`,name:"num_hidden_layers"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_utils.py#L861",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>
`}}),Lr=new x({props:{name:"invert_attention_mask",anchor:"transformers.modeling_utils.ModuleUtilsMixin.invert_attention_mask",parameters:[{name:"encoder_attention_mask",val:": Tensor"}],parametersDescription:[{anchor:"transformers.modeling_utils.ModuleUtilsMixin.invert_attention_mask.encoder_attention_mask",description:"<strong>encoder_attention_mask</strong> (<code>torch.Tensor</code>) &#x2014; An attention mask.",name:"encoder_attention_mask"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_utils.py#L757",returnDescription:`
<p>The inverted attention mask.</p>
`,returnType:`
<p><code>torch.Tensor</code></p>
`}}),Ur=new x({props:{name:"num_parameters",anchor:"transformers.modeling_utils.ModuleUtilsMixin.num_parameters",parameters:[{name:"only_trainable",val:": bool = False"},{name:"exclude_embeddings",val:": bool = False"}],parametersDescription:[{anchor:"transformers.modeling_utils.ModuleUtilsMixin.num_parameters.only_trainable",description:`<strong>only_trainable</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to return only the number of trainable parameters`,name:"only_trainable"},{anchor:"transformers.modeling_utils.ModuleUtilsMixin.num_parameters.exclude_embeddings",description:`<strong>exclude_embeddings</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to return only the number of non-embeddings parameters`,name:"exclude_embeddings"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_utils.py#L899",returnDescription:`
<p>The number of parameters.</p>
`,returnType:`
<p><code>int</code></p>
`}}),Or=new x({props:{name:"reset_memory_hooks_state",anchor:"transformers.modeling_utils.ModuleUtilsMixin.reset_memory_hooks_state",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_utils.py#L733"}}),Nr=new Ne({}),Br=new x({props:{name:"class transformers.TFPreTrainedModel",anchor:"transformers.TFPreTrainedModel",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_tf_utils.py#L1076"}}),Sr=new x({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:"max_shard_size",val:": typing.Union[int, str, NoneType] = '10GB'"},{name:"use_auth_token",val:": typing.Union[bool, str, NoneType] = None"},{name:"create_pr",val:": bool = False"},{name:"**base_model_card_args",val:""}],parametersDescription:[{anchor:"transformers.TFPreTrainedModel.push_to_hub.repo_id",description:`<strong>repo_id</strong> (<code>str</code>) &#x2014;
The name of the repository you want to push your model to. It should contain your organization name
when pushing to a given organization.`,name:"repo_id"},{anchor:"transformers.TFPreTrainedModel.push_to_hub.use_temp_dir",description:`<strong>use_temp_dir</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to use a temporary directory to store the files saved before they are pushed to the Hub.
Will default to <code>True</code> if there is no directory named like <code>repo_id</code>, <code>False</code> otherwise.`,name:"use_temp_dir"},{anchor:"transformers.TFPreTrainedModel.push_to_hub.commit_message",description:`<strong>commit_message</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Message to commit while pushing. Will default to <code>&quot;Upload model&quot;</code>.`,name:"commit_message"},{anchor:"transformers.TFPreTrainedModel.push_to_hub.private",description:`<strong>private</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not the repository created should be private.`,name:"private"},{anchor:"transformers.TFPreTrainedModel.push_to_hub.use_auth_token",description:`<strong>use_auth_token</strong> (<code>bool</code> or <code>str</code>, <em>optional</em>) &#x2014;
The token to use as HTTP bearer authorization for remote files. If <code>True</code>, will use the token generated
when running <code>huggingface-cli login</code> (stored in <code>~/.huggingface</code>). Will default to <code>True</code> if <code>repo_url</code>
is not specified.`,name:"use_auth_token"},{anchor:"transformers.TFPreTrainedModel.push_to_hub.max_shard_size",description:`<strong>max_shard_size</strong> (<code>int</code> or <code>str</code>, <em>optional</em>, defaults to <code>&quot;10GB&quot;</code>) &#x2014;
Only applicable for models. The maximum size for a checkpoint before being sharded. Checkpoints shard
will then be each of size lower than this size. If expressed as a string, needs to be digits followed
by a unit (like <code>&quot;5MB&quot;</code>).`,name:"max_shard_size"},{anchor:"transformers.TFPreTrainedModel.push_to_hub.create_pr",description:`<strong>create_pr</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to create a PR with the uploaded files or directly commit.`,name:"create_pr"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_tf_utils.py#L2902"}}),Gt=new Be({props:{anchor:"transformers.TFPreTrainedModel.push_to_hub.example",$$slots:{default:[q0]},$$scope:{ctx:q}}}),Vr=new x({props:{name:"can_generate",anchor:"transformers.TFPreTrainedModel.can_generate",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_tf_utils.py#L1204",returnDescription:`
<p>Whether this model can generate sequences with <code>.generate()</code>.</p>
`,returnType:`
<p><code>bool</code></p>
`}}),Gr=new x({props:{name:"compile",anchor:"transformers.TFPreTrainedModel.compile",parameters:[{name:"optimizer",val:" = 'rmsprop'"},{name:"loss",val:" = 'passthrough'"},{name:"metrics",val:" = None"},{name:"loss_weights",val:" = None"},{name:"weighted_metrics",val:" = None"},{name:"run_eagerly",val:" = None"},{name:"steps_per_execution",val:" = None"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_tf_utils.py#L1396"}}),Hr=new x({props:{name:"create_model_card",anchor:"transformers.TFPreTrainedModel.create_model_card",parameters:[{name:"output_dir",val:""},{name:"model_name",val:": str"},{name:"language",val:": typing.Optional[str] = None"},{name:"license",val:": typing.Optional[str] = None"},{name:"tags",val:": typing.Optional[str] = None"},{name:"finetuned_from",val:": typing.Optional[str] = None"},{name:"tasks",val:": typing.Optional[str] = None"},{name:"dataset_tags",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"dataset",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"dataset_args",val:": typing.Union[str, typing.List[str], NoneType] = None"}],parametersDescription:[{anchor:"transformers.TFPreTrainedModel.create_model_card.output_dir",description:`<strong>output_dir</strong> (<code>str</code> or <code>os.PathLike</code>) &#x2014;
The folder in which to create the model card.`,name:"output_dir"},{anchor:"transformers.TFPreTrainedModel.create_model_card.model_name",description:`<strong>model_name</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The name of the model.`,name:"model_name"},{anchor:"transformers.TFPreTrainedModel.create_model_card.language",description:`<strong>language</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The language of the model (if applicable)`,name:"language"},{anchor:"transformers.TFPreTrainedModel.create_model_card.license",description:`<strong>license</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The license of the model. Will default to the license of the pretrained model used, if the original
model given to the <code>Trainer</code> comes from a repo on the Hub.`,name:"license"},{anchor:"transformers.TFPreTrainedModel.create_model_card.tags",description:`<strong>tags</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
Some tags to be included in the metadata of the model card.`,name:"tags"},{anchor:"transformers.TFPreTrainedModel.create_model_card.finetuned_from",description:`<strong>finetuned_from</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The name of the model used to fine-tune this one (if applicable). Will default to the name of the repo
of the original model given to the <code>Trainer</code> (if it comes from the Hub).`,name:"finetuned_from"},{anchor:"transformers.TFPreTrainedModel.create_model_card.tasks",description:`<strong>tasks</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
One or several task identifiers, to be included in the metadata of the model card.`,name:"tasks"},{anchor:"transformers.TFPreTrainedModel.create_model_card.dataset_tags",description:`<strong>dataset_tags</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
One or several dataset tags, to be included in the metadata of the model card.`,name:"dataset_tags"},{anchor:"transformers.TFPreTrainedModel.create_model_card.dataset",description:`<strong>dataset</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
One or several dataset identifiers, to be included in the metadata of the model card.`,name:"dataset"},{anchor:"transformers.TFPreTrainedModel.create_model_card.dataset_args",description:`<strong>dataset_args</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
One or several dataset arguments, to be included in the metadata of the model card.`,name:"dataset_args"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_tf_utils.py#L1688"}}),Kr=new x({props:{name:"eager_serving",anchor:"transformers.TFPreTrainedModel.eager_serving",parameters:[{name:"inputs",val:""}],parametersDescription:[{anchor:"transformers.TFPreTrainedModel.eager_serving.inputs",description:`<strong>inputs</strong> (<code>Dict[str, tf.Tensor]</code>) &#x2014;
The input of the saved model as a dictionary of tensors.`,name:"inputs"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_tf_utils.py#L1160"}}),Jr=new x({props:{name:"from_pretrained",anchor:"transformers.TFPreTrainedModel.from_pretrained",parameters:[{name:"pretrained_model_name_or_path",val:""},{name:"*model_args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFPreTrainedModel.from_pretrained.pretrained_model_name_or_path",description:`<strong>pretrained_model_name_or_path</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Can be either:</p>
<ul>
<li>A string, the <em>model id</em> of a pretrained model hosted inside a model repo on huggingface.co.
Valid model ids can be located at the root-level, like <code>bert-base-uncased</code>, or namespaced under a
user or organization name, like <code>dbmdz/bert-base-german-cased</code>.</li>
<li>A path to a <em>directory</em> containing model weights saved using
<a href="/docs/transformers/v4.27.1/en/main_classes/model#transformers.TFPreTrainedModel.save_pretrained">save_pretrained()</a>, e.g., <code>./my_model_directory/</code>.</li>
<li>A path or url to a <em>PyTorch state_dict save file</em> (e.g, <code>./pt_model/pytorch_model.bin</code>). In this
case, <code>from_pt</code> should be set to <code>True</code> and a configuration object should be provided as <code>config</code>
argument. This loading path is slower than converting the PyTorch model in a TensorFlow model
using the provided conversion scripts and loading the TensorFlow model afterwards.</li>
<li><code>None</code> if you are both providing the configuration and state dictionary (resp. with keyword
arguments <code>config</code> and <code>state_dict</code>).</li>
</ul>`,name:"pretrained_model_name_or_path"},{anchor:"transformers.TFPreTrainedModel.from_pretrained.model_args",description:`<strong>model_args</strong> (sequence of positional arguments, <em>optional</em>) &#x2014;
All remaining positional arguments will be passed to the underlying model&#x2019;s <code>__init__</code> method.`,name:"model_args"},{anchor:"transformers.TFPreTrainedModel.from_pretrained.config",description:`<strong>config</strong> (<code>Union[PretrainedConfig, str]</code>, <em>optional</em>) &#x2014;
Can be either:</p>
<ul>
<li>an instance of a class derived from <a href="/docs/transformers/v4.27.1/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a>,</li>
<li>a string valid as input to <a href="/docs/transformers/v4.27.1/en/main_classes/configuration#transformers.PretrainedConfig.from_pretrained">from_pretrained()</a>.</li>
</ul>
<p>Configuration for the model to use instead of an automatically loaded configuration. Configuration can
be automatically loaded when:</p>
<ul>
<li>The model is a model provided by the library (loaded with the <em>model id</em> string of a pretrained
model).</li>
<li>The model was saved using <a href="/docs/transformers/v4.27.1/en/main_classes/model#transformers.TFPreTrainedModel.save_pretrained">save_pretrained()</a> and is reloaded by supplying the
save directory.</li>
<li>The model is loaded by supplying a local directory as <code>pretrained_model_name_or_path</code> and a
configuration JSON file named <em>config.json</em> is found in the directory.</li>
</ul>`,name:"config"},{anchor:"transformers.TFPreTrainedModel.from_pretrained.from_pt",description:`<strong>from_pt</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Load the model weights from a PyTorch state_dict save file (see docstring of
<code>pretrained_model_name_or_path</code> argument).`,name:"from_pt"},{anchor:"transformers.TFPreTrainedModel.from_pretrained.ignore_mismatched_sizes",description:`<strong>ignore_mismatched_sizes</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to raise an error if some of the weights from the checkpoint do not have the same size
as the weights of the model (if for instance, you are instantiating a model with 10 labels from a
checkpoint with 3 labels).`,name:"ignore_mismatched_sizes"},{anchor:"transformers.TFPreTrainedModel.from_pretrained.cache_dir",description:`<strong>cache_dir</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Path to a directory in which a downloaded pretrained model configuration should be cached if the
standard cache should not be used.`,name:"cache_dir"},{anchor:"transformers.TFPreTrainedModel.from_pretrained.force_download",description:`<strong>force_download</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to force the (re-)download of the model weights and configuration files, overriding the
cached versions if they exist.`,name:"force_download"},{anchor:"transformers.TFPreTrainedModel.from_pretrained.resume_download",description:`<strong>resume_download</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to delete incompletely received files. Will attempt to resume the download if such a
file exists.
proxies &#x2014;
(<code>Dict[str, str], </code>optional<code>): A dictionary of proxy servers to use by protocol or endpoint, e.g., </code>{&#x2018;http&#x2019;: &#x2018;foo.bar:3128&#x2019;, &#x2018;http://hostname&#x2019;: &#x2018;foo.bar:4012&#x2019;}<code>. The proxies are used on each request. output_loading_info(</code>bool<code>, *optional*, defaults to </code>False\`): Whether ot not to also return a
dictionary containing missing keys, unexpected keys and error messages.`,name:"resume_download"},{anchor:"transformers.TFPreTrainedModel.from_pretrained.local_files_only(bool,",description:`<strong>local_files_only(<code>bool</code>,</strong> <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to only look at local files (e.g., not try doanloading the model).`,name:"local_files_only(bool,"},{anchor:"transformers.TFPreTrainedModel.from_pretrained.use_auth_token",description:`<strong>use_auth_token</strong> (<code>str</code> or <code>bool</code>, <em>optional</em>) &#x2014;
The token to use as HTTP bearer authorization for remote files. If <code>True</code>, or not specified, will use
the token generated when running <code>huggingface-cli login</code> (stored in <code>~/.huggingface</code>).`,name:"use_auth_token"},{anchor:"transformers.TFPreTrainedModel.from_pretrained.revision",description:`<strong>revision</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;main&quot;</code>) &#x2014;
The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a
git-based system for storing models and other artifacts on huggingface.co, so <code>revision</code> can be any
identifier allowed by git.`,name:"revision"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_tf_utils.py#L2372"}}),Zt=new Be({props:{anchor:"transformers.TFPreTrainedModel.from_pretrained.example",$$slots:{default:[z0]},$$scope:{ctx:q}}}),ea=new x({props:{name:"get_bias",anchor:"transformers.TFPreTrainedModel.get_bias",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_tf_utils.py#L1828",returnDescription:`
<p>The weights representing the bias, None if not an LM model.</p>
`,returnType:`
<p><code>tf.Variable</code></p>
`}}),ta=new x({props:{name:"get_input_embeddings",anchor:"transformers.TFPreTrainedModel.get_input_embeddings",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_tf_utils.py#L1216",returnDescription:`
<p>The embeddings layer mapping vocabulary to hidden states.</p>
`,returnType:`
<p><code>tf.Variable</code></p>
`}}),oa=new x({props:{name:"get_lm_head",anchor:"transformers.TFPreTrainedModel.get_lm_head",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_tf_utils.py#L1861",returnDescription:`
<p>The LM head layer if the model has one, None if not.</p>
`,returnType:`
<p><code>tf.keras.layers.Layer</code></p>
`}}),ra=new x({props:{name:"get_output_embeddings",anchor:"transformers.TFPreTrainedModel.get_output_embeddings",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_tf_utils.py#L1768",returnDescription:`
<p>The new weights mapping vocabulary to hidden states.</p>
`,returnType:`
<p><code>tf.Variable</code></p>
`}}),aa=new x({props:{name:"get_output_layer_with_bias",anchor:"transformers.TFPreTrainedModel.get_output_layer_with_bias",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_tf_utils.py#L1805",returnDescription:`
<p>The layer that handles the bias, None if not an LM model.</p>
`,returnType:`
<p><code>tf.keras.layers.Layer</code></p>
`}}),na=new x({props:{name:"get_prefix_bias_name",anchor:"transformers.TFPreTrainedModel.get_prefix_bias_name",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_tf_utils.py#L1818",returnDescription:`
<p>The _prefix name of the bias.</p>
`,returnType:`
<p><code>str</code></p>
`}}),sa=new x({props:{name:"load_repo_checkpoint",anchor:"transformers.TFPreTrainedModel.load_repo_checkpoint",parameters:[{name:"repo_path_or_name",val:""}],parametersDescription:[{anchor:"transformers.TFPreTrainedModel.load_repo_checkpoint.repo_path_or_name",description:`<strong>repo_path_or_name</strong> (<code>str</code>) &#x2014;
Can either be a repository name for your {object} in the Hub or a path to a local folder (in which case
the repository will have the name of that local folder).`,name:"repo_path_or_name"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_tf_utils.py#L1243",returnDescription:`
<p>A dictionary of extra metadata from the checkpoint, most commonly an \u201Cepoch\u201D count.</p>
`,returnType:`
<p><code>dict</code></p>
`}}),ia=new x({props:{name:"prepare_tf_dataset",anchor:"transformers.TFPreTrainedModel.prepare_tf_dataset",parameters:[{name:"dataset",val:": datasets.Dataset"},{name:"batch_size",val:": int = 8"},{name:"shuffle",val:": bool = True"},{name:"tokenizer",val:": typing.Optional[ForwardRef('PreTrainedTokenizerBase')] = None"},{name:"collate_fn",val:": typing.Optional[typing.Callable] = None"},{name:"collate_fn_args",val:": typing.Union[typing.Dict[str, typing.Any], NoneType] = None"},{name:"drop_remainder",val:": typing.Optional[bool] = None"},{name:"prefetch",val:": bool = True"}],parametersDescription:[{anchor:"transformers.TFPreTrainedModel.prepare_tf_dataset.dataset",description:`<strong>dataset</strong> (<code>Any</code>) &#x2014;
A [~<code>datasets.Dataset</code>] to be wrapped as a <code>tf.data.Dataset</code>.`,name:"dataset"},{anchor:"transformers.TFPreTrainedModel.prepare_tf_dataset.batch_size",description:`<strong>batch_size</strong> (<code>int</code>, defaults to 8) &#x2014;
The size of batches to return.`,name:"batch_size"},{anchor:"transformers.TFPreTrainedModel.prepare_tf_dataset.shuffle",description:`<strong>shuffle</strong> (<code>bool</code>, defaults to <code>True</code>) &#x2014;
Whether to return samples from the dataset in random order. Usually <code>True</code> for training datasets and
<code>False</code> for validation/test datasets.`,name:"shuffle"},{anchor:"transformers.TFPreTrainedModel.prepare_tf_dataset.tokenizer",description:`<strong>tokenizer</strong> (<a href="/docs/transformers/v4.27.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase">PreTrainedTokenizerBase</a>, <em>optional</em>) &#x2014;
A <code>PreTrainedTokenizer</code> that will be used to pad samples to create batches. Has no effect if a specific
<code>collate_fn</code> is passed instead.`,name:"tokenizer"},{anchor:"transformers.TFPreTrainedModel.prepare_tf_dataset.collate_fn",description:`<strong>collate_fn</strong> (<code>Callable</code>, <em>optional</em>) &#x2014;
A function that collates samples from the dataset into a single batch. Defaults to
<code>DefaultDataCollator</code> if no <code>tokenizer</code> is supplied or <code>DataCollatorWithPadding</code> if a <code>tokenizer</code> is
passed.`,name:"collate_fn"},{anchor:"transformers.TFPreTrainedModel.prepare_tf_dataset.collate_fn_args",description:`<strong>collate_fn_args</strong> (<code>Dict[str, Any]</code>, <em>optional</em>) &#x2014;
A dict of arguments to pass to the <code>collate_fn</code> alongside the list of samples.`,name:"collate_fn_args"},{anchor:"transformers.TFPreTrainedModel.prepare_tf_dataset.drop_remainder",description:`<strong>drop_remainder</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to drop the final batch, if the batch_size does not evenly divide the dataset length. Defaults
to the same setting as <code>shuffle</code>.`,name:"drop_remainder"},{anchor:"transformers.TFPreTrainedModel.prepare_tf_dataset.prefetch",description:`<strong>prefetch</strong> (<code>bool</code>, defaults to <code>True</code>) &#x2014;
Whether to add prefetching to the end of the <code>tf.data</code> pipeline. This is almost always beneficial for
performance, but can be disabled in edge cases.`,name:"prefetch"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_tf_utils.py#L1297",returnDescription:`
<p>A <code>tf.data.Dataset</code> which is ready to pass to the Keras API.</p>
`,returnType:`
<p><code>Dataset</code></p>
`}}),da=new x({props:{name:"prune_heads",anchor:"transformers.TFPreTrainedModel.prune_heads",parameters:[{name:"heads_to_prune",val:""}],parametersDescription:[{anchor:"transformers.TFPreTrainedModel.prune_heads.heads_to_prune",description:`<strong>heads_to_prune</strong> (<code>Dict[int, List[int]]</code>) &#x2014;
Dictionary with keys being selected layer indices (<code>int</code>) and associated values being the list of heads
to prune in said layer (list of <code>int</code>). For instance {1: [0, 2], 2: [2, 3]} will prune heads 0 and 2 on
layer 1 and heads 2 and 3 on layer 2.`,name:"heads_to_prune"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_tf_utils.py#L2208"}}),la=new x({props:{name:"register_for_auto_class",anchor:"transformers.TFPreTrainedModel.register_for_auto_class",parameters:[{name:"auto_class",val:" = 'TFAutoModel'"}],parametersDescription:[{anchor:"transformers.TFPreTrainedModel.register_for_auto_class.auto_class",description:`<strong>auto_class</strong> (<code>str</code> or <code>type</code>, <em>optional</em>, defaults to <code>&quot;TFAutoModel&quot;</code>) &#x2014;
The auto class to register this new model with.`,name:"auto_class"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_tf_utils.py#L2998"}}),lo=new yp({props:{warning:!0,$$slots:{default:[A0]},$$scope:{ctx:q}}}),ca=new x({props:{name:"resize_token_embeddings",anchor:"transformers.TFPreTrainedModel.resize_token_embeddings",parameters:[{name:"new_num_tokens",val:": typing.Optional[int] = None"}],parametersDescription:[{anchor:"transformers.TFPreTrainedModel.resize_token_embeddings.new_num_tokens",description:`<strong>new_num_tokens</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The number of new tokens in the embedding matrix. Increasing the size will add newly initialized
vectors at the end. Reducing the size will remove vectors from the end. If not provided or <code>None</code>, just
returns a pointer to the input tokens without doing anything.`,name:"new_num_tokens"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_tf_utils.py#L1870",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>
`}}),ha=new x({props:{name:"save_pretrained",anchor:"transformers.TFPreTrainedModel.save_pretrained",parameters:[{name:"save_directory",val:""},{name:"saved_model",val:" = False"},{name:"version",val:" = 1"},{name:"push_to_hub",val:" = False"},{name:"signatures",val:" = None"},{name:"max_shard_size",val:": typing.Union[int, str] = '10GB'"},{name:"create_pr",val:": bool = False"},{name:"safe_serialization",val:": bool = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFPreTrainedModel.save_pretrained.save_directory",description:`<strong>save_directory</strong> (<code>str</code>) &#x2014;
Directory to which to save. Will be created if it doesn&#x2019;t exist.`,name:"save_directory"},{anchor:"transformers.TFPreTrainedModel.save_pretrained.saved_model",description:`<strong>saved_model</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
If the model has to be saved in saved model format as well or not.`,name:"saved_model"},{anchor:"transformers.TFPreTrainedModel.save_pretrained.version",description:`<strong>version</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The version of the saved model. A saved model needs to be versioned in order to be properly loaded by
TensorFlow Serving as detailed in the official documentation
<a href="https://www.tensorflow.org/tfx/serving/serving_basic" rel="nofollow">https://www.tensorflow.org/tfx/serving/serving_basic</a>`,name:"version"},{anchor:"transformers.TFPreTrainedModel.save_pretrained.push_to_hub",description:`<strong>push_to_hub</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to push your model to the Hugging Face model hub after saving it. You can specify the
repository you want to push to with <code>repo_id</code> (will default to the name of <code>save_directory</code> in your
namespace).`,name:"push_to_hub"},{anchor:"transformers.TFPreTrainedModel.save_pretrained.signatures",description:`<strong>signatures</strong> (<code>dict</code> or <code>tf.function</code>, <em>optional</em>) &#x2014;
Model&#x2019;s signature used for serving. This will be passed to the <code>signatures</code> argument of model.save().`,name:"signatures"},{anchor:"transformers.TFPreTrainedModel.save_pretrained.max_shard_size",description:`<strong>max_shard_size</strong> (<code>int</code> or <code>str</code>, <em>optional</em>, defaults to <code>&quot;10GB&quot;</code>) &#x2014;
The maximum size for a checkpoint before being sharded. Checkpoints shard will then be each of size
lower than this size. If expressed as a string, needs to be digits followed by a unit (like <code>&quot;5MB&quot;</code>).</p>
<div class="course-tip course-tip-orange bg-gradient-to-br dark:bg-gradient-to-r before:border-orange-500 dark:before:border-orange-800 from-orange-50 dark:from-gray-900 to-white dark:to-gray-950 border border-orange-50 text-orange-700 dark:text-gray-400">
						
<p>If a single weight of the model is bigger than <code>max_shard_size</code>, it will be in its own checkpoint shard
which will be bigger than <code>max_shard_size</code>.</p>

					</div>`,name:"max_shard_size"},{anchor:"transformers.TFPreTrainedModel.save_pretrained.create_pr",description:`<strong>create_pr</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to create a PR with the uploaded files or directly commit.`,name:"create_pr"},{anchor:"transformers.TFPreTrainedModel.save_pretrained.safe_serialization",description:`<strong>safe_serialization</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to save the model using <code>safetensors</code> or the traditional PyTorch way (that uses <code>pickle</code>).</p>
<p>kwargs &#x2014;
Additional key word arguments passed along to the <a href="/docs/transformers/v4.27.1/en/internal/image_processing_utils#transformers.ImageProcessingMixin.push_to_hub">push_to_hub()</a> method.`,name:"safe_serialization"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_tf_utils.py#L2220"}}),ua=new x({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"}]}}),ga=new x({props:{name:"serving_output",anchor:"transformers.TFPreTrainedModel.serving_output",parameters:[{name:"output",val:""}],parametersDescription:[{anchor:"transformers.TFPreTrainedModel.serving_output.output",description:`<strong>output</strong> (<code>TFBaseModelOutput</code>) &#x2014;
The output returned by the model.`,name:"output"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_tf_utils.py#L1194"}}),_a=new x({props:{name:"set_bias",anchor:"transformers.TFPreTrainedModel.set_bias",parameters:[{name:"value",val:""}],parametersDescription:[{anchor:"transformers.TFPreTrainedModel.set_bias.value",description:`<strong>value</strong> (<code>Dict[tf.Variable]</code>) &#x2014;
All the new bias attached to an LM head.`,name:"value"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_tf_utils.py#L1845"}}),ba=new x({props:{name:"set_input_embeddings",anchor:"transformers.TFPreTrainedModel.set_input_embeddings",parameters:[{name:"value",val:""}],parametersDescription:[{anchor:"transformers.TFPreTrainedModel.set_input_embeddings.value",description:`<strong>value</strong> (<code>tf.Variable</code>) &#x2014;
The new weights mapping hidden states to vocabulary.`,name:"value"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_tf_utils.py#L1748"}}),va=new x({props:{name:"set_output_embeddings",anchor:"transformers.TFPreTrainedModel.set_output_embeddings",parameters:[{name:"value",val:""}],parametersDescription:[{anchor:"transformers.TFPreTrainedModel.set_output_embeddings.value",description:`<strong>value</strong> (<code>tf.Variable</code>) &#x2014;
The new weights mapping hidden states to vocabulary.`,name:"value"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_tf_utils.py#L1788"}}),ya=new x({props:{name:"test_step",anchor:"transformers.TFPreTrainedModel.test_step",parameters:[{name:"data",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_tf_utils.py#L1584"}}),wa=new x({props:{name:"train_step",anchor:"transformers.TFPreTrainedModel.train_step",parameters:[{name:"data",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_tf_utils.py#L1476"}}),xa=new Ne({}),ka=new x({props:{name:"class transformers.modeling_tf_utils.TFModelUtilsMixin",anchor:"transformers.modeling_tf_utils.TFModelUtilsMixin",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_tf_utils.py#L112"}}),Ma=new x({props:{name:"num_parameters",anchor:"transformers.modeling_tf_utils.TFModelUtilsMixin.num_parameters",parameters:[{name:"only_trainable",val:": bool = False"}],parametersDescription:[{anchor:"transformers.modeling_tf_utils.TFModelUtilsMixin.num_parameters.only_trainable",description:`<strong>only_trainable</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to return only the number of trainable parameters`,name:"only_trainable"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_tf_utils.py#L117",returnDescription:`
<p>The number of parameters.</p>
`,returnType:`
<p><code>int</code></p>
`}}),Ea=new Ne({}),Fa=new x({props:{name:"class transformers.FlaxPreTrainedModel",anchor:"transformers.FlaxPreTrainedModel",parameters:[{name:"config",val:": PretrainedConfig"},{name:"module",val:": Module"},{name:"input_shape",val:": typing.Tuple = (1, 1)"},{name:"seed",val:": int = 0"},{name:"dtype",val:": dtype = <class 'jax.numpy.float32'>"},{name:"_do_init",val:": bool = True"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_flax_utils.py#L157"}}),ja=new x({props:{name:"push_to_hub",anchor:"transformers.FlaxPreTrainedModel.push_to_hub",parameters:[{name:"repo_id",val:": str"},{name:"use_temp_dir",val:": typing.Optional[bool] = None"},{name:"commit_message",val:": typing.Optional[str] = None"},{name:"private",val:": typing.Optional[bool] = None"},{name:"use_auth_token",val:": typing.Union[bool, str, NoneType] = None"},{name:"max_shard_size",val:": typing.Union[int, str, NoneType] = '10GB'"},{name:"create_pr",val:": bool = False"},{name:"**deprecated_kwargs",val:""}],parametersDescription:[{anchor:"transformers.FlaxPreTrainedModel.push_to_hub.repo_id",description:`<strong>repo_id</strong> (<code>str</code>) &#x2014;
The name of the repository you want to push your model to. It should contain your organization name
when pushing to a given organization.`,name:"repo_id"},{anchor:"transformers.FlaxPreTrainedModel.push_to_hub.use_temp_dir",description:`<strong>use_temp_dir</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to use a temporary directory to store the files saved before they are pushed to the Hub.
Will default to <code>True</code> if there is no directory named like <code>repo_id</code>, <code>False</code> otherwise.`,name:"use_temp_dir"},{anchor:"transformers.FlaxPreTrainedModel.push_to_hub.commit_message",description:`<strong>commit_message</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Message to commit while pushing. Will default to <code>&quot;Upload model&quot;</code>.`,name:"commit_message"},{anchor:"transformers.FlaxPreTrainedModel.push_to_hub.private",description:`<strong>private</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not the repository created should be private.`,name:"private"},{anchor:"transformers.FlaxPreTrainedModel.push_to_hub.use_auth_token",description:`<strong>use_auth_token</strong> (<code>bool</code> or <code>str</code>, <em>optional</em>) &#x2014;
The token to use as HTTP bearer authorization for remote files. If <code>True</code>, will use the token generated
when running <code>huggingface-cli login</code> (stored in <code>~/.huggingface</code>). Will default to <code>True</code> if <code>repo_url</code>
is not specified.`,name:"use_auth_token"},{anchor:"transformers.FlaxPreTrainedModel.push_to_hub.max_shard_size",description:`<strong>max_shard_size</strong> (<code>int</code> or <code>str</code>, <em>optional</em>, defaults to <code>&quot;10GB&quot;</code>) &#x2014;
Only applicable for models. The maximum size for a checkpoint before being sharded. Checkpoints shard
will then be each of size lower than this size. If expressed as a string, needs to be digits followed
by a unit (like <code>&quot;5MB&quot;</code>).`,name:"max_shard_size"},{anchor:"transformers.FlaxPreTrainedModel.push_to_hub.create_pr",description:`<strong>create_pr</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to create a PR with the uploaded files or directly commit.`,name:"create_pr"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/utils/hub.py#L703"}}),wo=new Be({props:{anchor:"transformers.FlaxPreTrainedModel.push_to_hub.example",$$slots:{default:[C0]},$$scope:{ctx:q}}}),qa=new x({props:{name:"can_generate",anchor:"transformers.FlaxPreTrainedModel.can_generate",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_flax_utils.py#L471"}}),za=new x({props:{name:"from_pretrained",anchor:"transformers.FlaxPreTrainedModel.from_pretrained",parameters:[{name:"pretrained_model_name_or_path",val:": typing.Union[str, os.PathLike]"},{name:"dtype",val:": dtype = <class 'jax.numpy.float32'>"},{name:"*model_args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.FlaxPreTrainedModel.from_pretrained.pretrained_model_name_or_path",description:`<strong>pretrained_model_name_or_path</strong> (<code>str</code> or <code>os.PathLike</code>) &#x2014;
Can be either:</p>
<ul>
<li>A string, the <em>model id</em> of a pretrained model hosted inside a model repo on huggingface.co.
Valid model ids can be located at the root-level, like <code>bert-base-uncased</code>, or namespaced under a
user or organization name, like <code>dbmdz/bert-base-german-cased</code>.</li>
<li>A path to a <em>directory</em> containing model weights saved using
<a href="/docs/transformers/v4.27.1/en/main_classes/model#transformers.FlaxPreTrainedModel.save_pretrained">save_pretrained()</a>, e.g., <code>./my_model_directory/</code>.</li>
<li>A path or url to a <em>pt index checkpoint file</em> (e.g, <code>./tf_model/model.ckpt.index</code>). In this case,
<code>from_pt</code> should be set to <code>True</code>.</li>
</ul>`,name:"pretrained_model_name_or_path"},{anchor:"transformers.FlaxPreTrainedModel.from_pretrained.dtype",description:`<strong>dtype</strong> (<code>jax.numpy.dtype</code>, <em>optional</em>, defaults to <code>jax.numpy.float32</code>) &#x2014;
The data type of the computation. Can be one of <code>jax.numpy.float32</code>, <code>jax.numpy.float16</code> (on GPUs) and
<code>jax.numpy.bfloat16</code> (on TPUs).</p>
<p>This can be used to enable mixed-precision training or half-precision inference on GPUs or TPUs. If
specified all the computation will be performed with the given <code>dtype</code>.</p>
<p><strong>Note that this only specifies the dtype of the computation and does not influence the dtype of model
parameters.</strong></p>
<p>If you wish to change the dtype of the model parameters, see <a href="/docs/transformers/v4.27.1/en/main_classes/model#transformers.FlaxPreTrainedModel.to_fp16">to_fp16()</a> and
<a href="/docs/transformers/v4.27.1/en/main_classes/model#transformers.FlaxPreTrainedModel.to_bf16">to_bf16()</a>.`,name:"dtype"},{anchor:"transformers.FlaxPreTrainedModel.from_pretrained.model_args",description:`<strong>model_args</strong> (sequence of positional arguments, <em>optional</em>) &#x2014;
All remaining positional arguments will be passed to the underlying model&#x2019;s <code>__init__</code> method.`,name:"model_args"},{anchor:"transformers.FlaxPreTrainedModel.from_pretrained.config",description:`<strong>config</strong> (<code>Union[PretrainedConfig, str, os.PathLike]</code>, <em>optional</em>) &#x2014;
Can be either:</p>
<ul>
<li>an instance of a class derived from <a href="/docs/transformers/v4.27.1/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a>,</li>
<li>a string or path valid as input to <a href="/docs/transformers/v4.27.1/en/main_classes/configuration#transformers.PretrainedConfig.from_pretrained">from_pretrained()</a>.</li>
</ul>
<p>Configuration for the model to use instead of an automatically loaded configuration. Configuration can
be automatically loaded when:</p>
<ul>
<li>The model is a model provided by the library (loaded with the <em>model id</em> string of a pretrained
model).</li>
<li>The model was saved using <a href="/docs/transformers/v4.27.1/en/main_classes/model#transformers.PreTrainedModel.save_pretrained">save_pretrained()</a> and is reloaded by supplying the
save directory.</li>
<li>The model is loaded by supplying a local directory as <code>pretrained_model_name_or_path</code> and a
configuration JSON file named <em>config.json</em> is found in the directory.</li>
</ul>`,name:"config"},{anchor:"transformers.FlaxPreTrainedModel.from_pretrained.cache_dir",description:`<strong>cache_dir</strong> (<code>Union[str, os.PathLike]</code>, <em>optional</em>) &#x2014;
Path to a directory in which a downloaded pretrained model configuration should be cached if the
standard cache should not be used.`,name:"cache_dir"},{anchor:"transformers.FlaxPreTrainedModel.from_pretrained.from_pt",description:`<strong>from_pt</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Load the model weights from a PyTorch checkpoint save file (see docstring of
<code>pretrained_model_name_or_path</code> argument).`,name:"from_pt"},{anchor:"transformers.FlaxPreTrainedModel.from_pretrained.ignore_mismatched_sizes",description:`<strong>ignore_mismatched_sizes</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to raise an error if some of the weights from the checkpoint do not have the same size
as the weights of the model (if for instance, you are instantiating a model with 10 labels from a
checkpoint with 3 labels).`,name:"ignore_mismatched_sizes"},{anchor:"transformers.FlaxPreTrainedModel.from_pretrained.force_download",description:`<strong>force_download</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to force the (re-)download of the model weights and configuration files, overriding the
cached versions if they exist.`,name:"force_download"},{anchor:"transformers.FlaxPreTrainedModel.from_pretrained.resume_download",description:`<strong>resume_download</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to delete incompletely received files. Will attempt to resume the download if such a
file exists.`,name:"resume_download"},{anchor:"transformers.FlaxPreTrainedModel.from_pretrained.proxies",description:`<strong>proxies</strong> (<code>Dict[str, str]</code>, <em>optional</em>) &#x2014;
A dictionary of proxy servers to use by protocol or endpoint, e.g., <code>{&apos;http&apos;: &apos;foo.bar:3128&apos;, &apos;http://hostname&apos;: &apos;foo.bar:4012&apos;}</code>. The proxies are used on each request.`,name:"proxies"},{anchor:"transformers.FlaxPreTrainedModel.from_pretrained.local_files_only(bool,",description:`<strong>local_files_only(<code>bool</code>,</strong> <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to only look at local files (i.e., do not try to download the model).`,name:"local_files_only(bool,"},{anchor:"transformers.FlaxPreTrainedModel.from_pretrained.use_auth_token",description:`<strong>use_auth_token</strong> (<code>str</code> or <code>bool</code>, <em>optional</em>) &#x2014;
The token to use as HTTP bearer authorization for remote files. If <code>True</code>, or not specified, will use
the token generated when running <code>huggingface-cli login</code> (stored in <code>~/.huggingface</code>).`,name:"use_auth_token"},{anchor:"transformers.FlaxPreTrainedModel.from_pretrained.revision",description:`<strong>revision</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;main&quot;</code>) &#x2014;
The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a
git-based system for storing models and other artifacts on huggingface.co, so <code>revision</code> can be any
identifier allowed by git.`,name:"revision"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_flax_utils.py#L481"}}),xo=new Be({props:{anchor:"transformers.FlaxPreTrainedModel.from_pretrained.example",$$slots:{default:[I0]},$$scope:{ctx:q}}}),Ia=new x({props:{name:"load_flax_sharded_weights",anchor:"transformers.FlaxPreTrainedModel.load_flax_sharded_weights",parameters:[{name:"shard_files",val:""}],parametersDescription:[{anchor:"transformers.FlaxPreTrainedModel.load_flax_sharded_weights.shard_files",description:`<strong>shard_files</strong> (<code>List[str]</code> &#x2014;
The list of shard files to load.`,name:"shard_files"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_flax_utils.py#L424",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>
`}}),Ua=new x({props:{name:"register_for_auto_class",anchor:"transformers.FlaxPreTrainedModel.register_for_auto_class",parameters:[{name:"auto_class",val:" = 'FlaxAutoModel'"}],parametersDescription:[{anchor:"transformers.FlaxPreTrainedModel.register_for_auto_class.auto_class",description:`<strong>auto_class</strong> (<code>str</code> or <code>type</code>, <em>optional</em>, defaults to <code>&quot;FlaxAutoModel&quot;</code>) &#x2014;
The auto class to register this new model with.`,name:"auto_class"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/modeling_flax_utils.py#L1111"}}),ko=new yp({props:{warning:!0,$$slots:{default:[L0]},$$scope:{ctx:q}}}),Oa=new x({props:{name:"save_pretrained",anchor:"transformers.FlaxPreTrainedModel.save_pretrained",parameters:[{name:"save_directory",val:": typing.Union[str, os.PathLike]"},{name:"params",val:" = None"},{name:"push_to_hub",val:" = False"},{name:"max_shard_size",val:" = '10GB'"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.FlaxPreTrainedModel.save_pretrained.save_directory",description:`<strong>save_directory</strong> (<code>str</code> or <code>os.PathLike</code>) &#x2014;
Directory to which to save. Will be created if it doesn&#x2019;t exist.`,name:"save_directory"},{anchor:"transformers.FlaxPreTrainedModel.save_pretrained.push_to_hub",description:`<strong>push_to_hub</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to push your model to the Hugging Face model hub after saving it. You can specify the
repository you want to push to with <code>repo_id</code> (will default to the name of <code>save_directory</code> in your
namespace).`,name:"push_to_hub"},{anchor:"transformers.FlaxPreTrainedModel.save_pretrained.max_shard_size",description:`<strong>max_shard_size</strong> (<code>int</code> or <code>str</code>, <em>optional</em>, defaults to <code>&quot;10GB&quot;</code>) &#x2014;
The maximum size for a checkpoint before being sharded. Checkpoints shard will then be each of size
lower than this size. If expressed as a string, needs to be digits followed by a unit (like <code>&quot;5MB&quot;</code>).</p>
<div class="course-tip course-tip-orange bg-gradient-to-br dark:bg-gradient-to-r before:border-orange-500 dark:before:border-orange-800 from-orange-50 dark:from-gray-900 to-white dark:to-gray-950 border border-orange-50 text-orange-700 dark:text-gray-400">
						
<p>If a single weight of the model is bigger than <code>max_shard_size</code>, it will be in its own checkpoint shard
which will be bigger than <code>max_shard_size</code>.</p>

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