import{s as Je,f as Ue,o as ze,n as me}from"../chunks/scheduler.9bc65507.js";import{S as Pe,i as Ze,g as h,s as l,r as b,A as We,h as u,f as a,c as d,j as fe,u as w,x as v,k as re,y as _,a as r,v as $,d as V,t as E,w as x}from"../chunks/index.707bf1b6.js";import{T as be}from"../chunks/Tip.c2ecdbf4.js";import{D as Me}from"../chunks/Docstring.17db21ae.js";import{C as xe}from"../chunks/CodeBlock.54a9f38d.js";import{F as He,M as Ce}from"../chunks/Markdown.8ab98a13.js";import{E as Ee}from"../chunks/ExampleCodeBlock.4f515aa9.js";import{H as Te}from"../chunks/Heading.342b1fa6.js";function Ie(A){let e,c="Example:",t,s,f;return s=new xe({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFZpVE1BRUNvbmZpZyUyQyUyMFZpVE1BRU1vZGVsJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMFZpVCUyME1BRSUyMHZpdC1tYWUtYmFzZSUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBWaVRNQUVDb25maWcoKSUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBtb2RlbCUyMCh3aXRoJTIwcmFuZG9tJTIwd2VpZ2h0cyklMjBmcm9tJTIwdGhlJTIwdml0LW1hZS1iYXNlJTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBbW9kZWwlMjAlM0QlMjBWaVRNQUVNb2RlbChjb25maWd1cmF0aW9uKSUwQSUwQSUyMyUyMEFjY2Vzc2luZyUyMHRoZSUyMG1vZGVsJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBtb2RlbC5jb25maWc=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> ViTMAEConfig, ViTMAEModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a ViT MAE vit-mae-base style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = ViTMAEConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model (with random weights) from the vit-mae-base style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ViTMAEModel(configuration)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Accessing the model configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = model.config`,wrap:!1}}),{c(){e=h("p"),e.textContent=c,t=l(),b(s.$$.fragment)},l(o){e=u(o,"P",{"data-svelte-h":!0}),v(e)!=="svelte-11lpom8"&&(e.textContent=c),t=d(o),w(s.$$.fragment,o)},m(o,g){r(o,e,g),r(o,t,g),$(s,o,g),f=!0},p:me,i(o){f||(V(s.$$.fragment,o),f=!0)},o(o){E(s.$$.fragment,o),f=!1},d(o){o&&(a(e),a(t)),x(s,o)}}}function Le(A){let e,c=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){e=h("p"),e.innerHTML=c},l(t){e=u(t,"P",{"data-svelte-h":!0}),v(e)!=="svelte-fincs2"&&(e.innerHTML=c)},m(t,s){r(t,e,s)},p:me,d(t){t&&a(e)}}}function qe(A){let e,c="Examples:",t,s,f;return s=new xe({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyMFZpVE1BRU1vZGVsJTBBZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEElMEF1cmwlMjAlM0QlMjAlMjJodHRwJTNBJTJGJTJGaW1hZ2VzLmNvY29kYXRhc2V0Lm9yZyUyRnZhbDIwMTclMkYwMDAwMDAwMzk3NjkuanBnJTIyJTBBaW1hZ2UlMjAlM0QlMjBJbWFnZS5vcGVuKHJlcXVlc3RzLmdldCh1cmwlMkMlMjBzdHJlYW0lM0RUcnVlKS5yYXcpJTBBJTBBaW1hZ2VfcHJvY2Vzc29yJTIwJTNEJTIwQXV0b0ltYWdlUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJmYWNlYm9vayUyRnZpdC1tYWUtYmFzZSUyMiklMEFtb2RlbCUyMCUzRCUyMFZpVE1BRU1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJmYWNlYm9vayUyRnZpdC1tYWUtYmFzZSUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjBpbWFnZV9wcm9jZXNzb3IoaW1hZ2VzJTNEaW1hZ2UlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyklMEFsYXN0X2hpZGRlbl9zdGF0ZXMlMjAlM0QlMjBvdXRwdXRzLmxhc3RfaGlkZGVuX3N0YXRl",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, ViTMAEModel
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000039769.jpg&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = Image.<span class="hljs-built_in">open</span>(requests.get(url, stream=<span class="hljs-literal">True</span>).raw)

<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;facebook/vit-mae-base&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ViTMAEModel.from_pretrained(<span class="hljs-string">&quot;facebook/vit-mae-base&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = image_processor(images=image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_states = outputs.last_hidden_state`,wrap:!1}}),{c(){e=h("p"),e.textContent=c,t=l(),b(s.$$.fragment)},l(o){e=u(o,"P",{"data-svelte-h":!0}),v(e)!=="svelte-kvfsh7"&&(e.textContent=c),t=d(o),w(s.$$.fragment,o)},m(o,g){r(o,e,g),r(o,t,g),$(s,o,g),f=!0},p:me,i(o){f||(V(s.$$.fragment,o),f=!0)},o(o){E(s.$$.fragment,o),f=!1},d(o){o&&(a(e),a(t)),x(s,o)}}}function Re(A){let e,c=`Note that we provide a script to pre-train this model on custom data in our <a href="https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-pretraining" rel="nofollow">examples
directory</a>.`;return{c(){e=h("p"),e.innerHTML=c},l(t){e=u(t,"P",{"data-svelte-h":!0}),v(e)!=="svelte-7i3y9o"&&(e.innerHTML=c)},m(t,s){r(t,e,s)},p:me,d(t){t&&a(e)}}}function Ne(A){let e,c=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){e=h("p"),e.innerHTML=c},l(t){e=u(t,"P",{"data-svelte-h":!0}),v(e)!=="svelte-fincs2"&&(e.innerHTML=c)},m(t,s){r(t,e,s)},p:me,d(t){t&&a(e)}}}function Be(A){let e,c="Examples:",t,s,f;return s=new xe({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyMFZpVE1BRUZvclByZVRyYWluaW5nJTBBZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEElMEF1cmwlMjAlM0QlMjAlMjJodHRwJTNBJTJGJTJGaW1hZ2VzLmNvY29kYXRhc2V0Lm9yZyUyRnZhbDIwMTclMkYwMDAwMDAwMzk3NjkuanBnJTIyJTBBaW1hZ2UlMjAlM0QlMjBJbWFnZS5vcGVuKHJlcXVlc3RzLmdldCh1cmwlMkMlMjBzdHJlYW0lM0RUcnVlKS5yYXcpJTBBJTBBaW1hZ2VfcHJvY2Vzc29yJTIwJTNEJTIwQXV0b0ltYWdlUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJmYWNlYm9vayUyRnZpdC1tYWUtYmFzZSUyMiklMEFtb2RlbCUyMCUzRCUyMFZpVE1BRUZvclByZVRyYWluaW5nLmZyb21fcHJldHJhaW5lZCglMjJmYWNlYm9vayUyRnZpdC1tYWUtYmFzZSUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjBpbWFnZV9wcm9jZXNzb3IoaW1hZ2VzJTNEaW1hZ2UlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyklMEFsb3NzJTIwJTNEJTIwb3V0cHV0cy5sb3NzJTBBbWFzayUyMCUzRCUyMG91dHB1dHMubWFzayUwQWlkc19yZXN0b3JlJTIwJTNEJTIwb3V0cHV0cy5pZHNfcmVzdG9yZQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, ViTMAEForPreTraining
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000039769.jpg&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = Image.<span class="hljs-built_in">open</span>(requests.get(url, stream=<span class="hljs-literal">True</span>).raw)

<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;facebook/vit-mae-base&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ViTMAEForPreTraining.from_pretrained(<span class="hljs-string">&quot;facebook/vit-mae-base&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = image_processor(images=image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = outputs.loss
<span class="hljs-meta">&gt;&gt;&gt; </span>mask = outputs.mask
<span class="hljs-meta">&gt;&gt;&gt; </span>ids_restore = outputs.ids_restore`,wrap:!1}}),{c(){e=h("p"),e.textContent=c,t=l(),b(s.$$.fragment)},l(o){e=u(o,"P",{"data-svelte-h":!0}),v(e)!=="svelte-kvfsh7"&&(e.textContent=c),t=d(o),w(s.$$.fragment,o)},m(o,g){r(o,e,g),r(o,t,g),$(s,o,g),f=!0},p:me,i(o){f||(V(s.$$.fragment,o),f=!0)},o(o){E(s.$$.fragment,o),f=!1},d(o){o&&(a(e),a(t)),x(s,o)}}}function Ge(A){let e,c,t,s,f,o,g=`The bare ViTMAE Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`,S,F,J,Q,j,Z='The <a href="/docs/transformers/main/en/model_doc/vit_mae#transformers.ViTMAEModel">ViTMAEModel</a> forward method, overrides the <code>__call__</code> special method.',U,i,C,B,te,se,D,z,Y,ie,R,ge="The ViTMAE Model transformer with the decoder on top for self-supervised pre-training.",W,H,le,N,ve=`This model is a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`,de,P,ne,oe,O,pe='The <a href="/docs/transformers/main/en/model_doc/vit_mae#transformers.ViTMAEForPreTraining">ViTMAEForPreTraining</a> forward method, overrides the <code>__call__</code> special method.',I,X,ce,q,_e;return e=new Te({props:{title:"ViTMAEModel",local:"transformers.ViTMAEModel",headingTag:"h2"}}),s=new Me({props:{name:"class transformers.ViTMAEModel",anchor:"transformers.ViTMAEModel",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.ViTMAEModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/vit_mae#transformers.ViTMAEConfig">ViTMAEConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/vit_mae/modeling_vit_mae.py#L627"}}),J=new Me({props:{name:"forward",anchor:"transformers.ViTMAEModel.forward",parameters:[{name:"pixel_values",val:": typing.Optional[torch.FloatTensor] = None"},{name:"noise",val:": typing.Optional[torch.FloatTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.ViTMAEModel.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/main/en/model_doc/dpt#transformers.DPTFeatureExtractor.__call__">ViTImageProcessor.<strong>call</strong>()</a>
for details.`,name:"pixel_values"},{anchor:"transformers.ViTMAEModel.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.ViTMAEModel.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.ViTMAEModel.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.ViTMAEModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/vit_mae/modeling_vit_mae.py#L651",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <code>transformers.models.vit_mae.modeling_vit_mae.ViTMAEModelOutput</code> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/vit_mae#transformers.ViTMAEConfig"
>ViTMAEConfig</a>) and inputs.</p>
<ul>
<li><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) — Sequence of hidden-states at the output of the last layer of the model.</li>
<li><strong>mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>) — Tensor indicating which patches are masked (1) and which are not (0).</li>
<li><strong>ids_restore</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) — Tensor containing the original index of the (shuffled) masked patches.</li>
<li><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings + one for the output of each layer) of
shape <code>(batch_size, sequence_length, hidden_size)</code>. Hidden-states of the model at the output of each layer
plus the initial embedding outputs.</li>
<li><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>. Attentions weights after the attention softmax, used to compute the weighted average in
the self-attention heads.</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>transformers.models.vit_mae.modeling_vit_mae.ViTMAEModelOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),i=new be({props:{$$slots:{default:[Le]},$$scope:{ctx:A}}}),B=new Ee({props:{anchor:"transformers.ViTMAEModel.forward.example",$$slots:{default:[qe]},$$scope:{ctx:A}}}),se=new Te({props:{title:"ViTMAEForPreTraining",local:"transformers.ViTMAEForPreTraining",headingTag:"h2"}}),Y=new Me({props:{name:"class transformers.ViTMAEForPreTraining",anchor:"transformers.ViTMAEForPreTraining",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.ViTMAEForPreTraining.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/vit_mae#transformers.ViTMAEConfig">ViTMAEConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/vit_mae/modeling_vit_mae.py#L833"}}),H=new be({props:{$$slots:{default:[Re]},$$scope:{ctx:A}}}),ne=new Me({props:{name:"forward",anchor:"transformers.ViTMAEForPreTraining.forward",parameters:[{name:"pixel_values",val:": typing.Optional[torch.FloatTensor] = None"},{name:"noise",val:": typing.Optional[torch.FloatTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.ViTMAEForPreTraining.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/main/en/model_doc/dpt#transformers.DPTFeatureExtractor.__call__">ViTImageProcessor.<strong>call</strong>()</a>
for details.`,name:"pixel_values"},{anchor:"transformers.ViTMAEForPreTraining.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.ViTMAEForPreTraining.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.ViTMAEForPreTraining.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.ViTMAEForPreTraining.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/vit_mae/modeling_vit_mae.py#L946",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <code>transformers.models.vit_mae.modeling_vit_mae.ViTMAEForPreTrainingOutput</code> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/vit_mae#transformers.ViTMAEConfig"
>ViTMAEConfig</a>) and inputs.</p>
<ul>
<li><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>) — Pixel reconstruction loss.</li>
<li><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, patch_size ** 2 * num_channels)</code>) — Pixel reconstruction logits.</li>
<li><strong>mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>) — Tensor indicating which patches are masked (1) and which are not (0).</li>
<li><strong>ids_restore</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) — Tensor containing the original index of the (shuffled) masked patches.</li>
<li><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings + one for the output of each layer) of
shape <code>(batch_size, sequence_length, hidden_size)</code>. Hidden-states of the model at the output of each layer
plus the initial embedding outputs.</li>
<li><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>. Attentions weights after the attention softmax, used to compute the weighted average in
the self-attention heads.</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>transformers.models.vit_mae.modeling_vit_mae.ViTMAEForPreTrainingOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),X=new be({props:{$$slots:{default:[Ne]},$$scope:{ctx:A}}}),q=new Ee({props:{anchor:"transformers.ViTMAEForPreTraining.forward.example",$$slots:{default:[Be]},$$scope:{ctx:A}}}),{c(){b(e.$$.fragment),c=l(),t=h("div"),b(s.$$.fragment),f=l(),o=h("p"),o.innerHTML=g,S=l(),F=h("div"),b(J.$$.fragment),Q=l(),j=h("p"),j.innerHTML=Z,U=l(),b(i.$$.fragment),C=l(),b(B.$$.fragment),te=l(),b(se.$$.fragment),D=l(),z=h("div"),b(Y.$$.fragment),ie=l(),R=h("p"),R.textContent=ge,W=l(),b(H.$$.fragment),le=l(),N=h("p"),N.innerHTML=ve,de=l(),P=h("div"),b(ne.$$.fragment),oe=l(),O=h("p"),O.innerHTML=pe,I=l(),b(X.$$.fragment),ce=l(),b(q.$$.fragment),this.h()},l(p){w(e.$$.fragment,p),c=d(p),t=u(p,"DIV",{class:!0});var M=fe(t);w(s.$$.fragment,M),f=d(M),o=u(M,"P",{"data-svelte-h":!0}),v(o)!=="svelte-okthft"&&(o.innerHTML=g),S=d(M),F=u(M,"DIV",{class:!0});var G=fe(F);w(J.$$.fragment,G),Q=d(G),j=u(G,"P",{"data-svelte-h":!0}),v(j)!=="svelte-579ik6"&&(j.innerHTML=Z),U=d(G),w(i.$$.fragment,G),C=d(G),w(B.$$.fragment,G),G.forEach(a),M.forEach(a),te=d(p),w(se.$$.fragment,p),D=d(p),z=u(p,"DIV",{class:!0});var k=fe(z);w(Y.$$.fragment,k),ie=d(k),R=u(k,"P",{"data-svelte-h":!0}),v(R)!=="svelte-10cjq04"&&(R.textContent=ge),W=d(k),w(H.$$.fragment,k),le=d(k),N=u(k,"P",{"data-svelte-h":!0}),v(N)!=="svelte-1gjh92c"&&(N.innerHTML=ve),de=d(k),P=u(k,"DIV",{class:!0});var L=fe(P);w(ne.$$.fragment,L),oe=d(L),O=u(L,"P",{"data-svelte-h":!0}),v(O)!=="svelte-ym1rz2"&&(O.innerHTML=pe),I=d(L),w(X.$$.fragment,L),ce=d(L),w(q.$$.fragment,L),L.forEach(a),k.forEach(a),this.h()},h(){re(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),re(t,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),re(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),re(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(p,M){$(e,p,M),r(p,c,M),r(p,t,M),$(s,t,null),_(t,f),_(t,o),_(t,S),_(t,F),$(J,F,null),_(F,Q),_(F,j),_(F,U),$(i,F,null),_(F,C),$(B,F,null),r(p,te,M),$(se,p,M),r(p,D,M),r(p,z,M),$(Y,z,null),_(z,ie),_(z,R),_(z,W),$(H,z,null),_(z,le),_(z,N),_(z,de),_(z,P),$(ne,P,null),_(P,oe),_(P,O),_(P,I),$(X,P,null),_(P,ce),$(q,P,null),_e=!0},p(p,M){const G={};M&2&&(G.$$scope={dirty:M,ctx:p}),i.$set(G);const k={};M&2&&(k.$$scope={dirty:M,ctx:p}),B.$set(k);const L={};M&2&&(L.$$scope={dirty:M,ctx:p}),H.$set(L);const m={};M&2&&(m.$$scope={dirty:M,ctx:p}),X.$set(m);const y={};M&2&&(y.$$scope={dirty:M,ctx:p}),q.$set(y)},i(p){_e||(V(e.$$.fragment,p),V(s.$$.fragment,p),V(J.$$.fragment,p),V(i.$$.fragment,p),V(B.$$.fragment,p),V(se.$$.fragment,p),V(Y.$$.fragment,p),V(H.$$.fragment,p),V(ne.$$.fragment,p),V(X.$$.fragment,p),V(q.$$.fragment,p),_e=!0)},o(p){E(e.$$.fragment,p),E(s.$$.fragment,p),E(J.$$.fragment,p),E(i.$$.fragment,p),E(B.$$.fragment,p),E(se.$$.fragment,p),E(Y.$$.fragment,p),E(H.$$.fragment,p),E(ne.$$.fragment,p),E(X.$$.fragment,p),E(q.$$.fragment,p),_e=!1},d(p){p&&(a(c),a(t),a(te),a(D),a(z)),x(e,p),x(s),x(J),x(i),x(B),x(se,p),x(Y),x(H),x(ne),x(X),x(q)}}}function Ye(A){let e,c;return e=new Ce({props:{$$slots:{default:[Ge]},$$scope:{ctx:A}}}),{c(){b(e.$$.fragment)},l(t){w(e.$$.fragment,t)},m(t,s){$(e,t,s),c=!0},p(t,s){const f={};s&2&&(f.$$scope={dirty:s,ctx:t}),e.$set(f)},i(t){c||(V(e.$$.fragment,t),c=!0)},o(t){E(e.$$.fragment,t),c=!1},d(t){x(e,t)}}}function Xe(A){let e,c="TensorFlow models and layers in <code>transformers</code> accept two formats as input:",t,s,f="<li>having all inputs as keyword arguments (like PyTorch models), or</li> <li>having all inputs as a list, tuple or dict in the first positional argument.</li>",o,g,S=`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
and layers. Because of this support, when using methods like <code>model.fit()</code> things should “just work” for you - just
pass your inputs and labels in any format that <code>model.fit()</code> supports! If, however, you want to use the second
format outside of Keras methods like <code>fit()</code> and <code>predict()</code>, such as when creating your own layers or models with
the Keras <code>Functional</code> API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`,F,J,Q=`<li>a single Tensor with <code>pixel_values</code> only and nothing else: <code>model(pixel_values)</code></li> <li>a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
<code>model([pixel_values, attention_mask])</code> or <code>model([pixel_values, attention_mask, token_type_ids])</code></li> <li>a dictionary with one or several input Tensors associated to the input names given in the docstring:
<code>model({&quot;pixel_values&quot;: pixel_values, &quot;token_type_ids&quot;: token_type_ids})</code></li>`,j,Z,U=`Note that when creating models and layers with
<a href="https://keras.io/guides/making_new_layers_and_models_via_subclassing/" rel="nofollow">subclassing</a> then you don’t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`;return{c(){e=h("p"),e.innerHTML=c,t=l(),s=h("ul"),s.innerHTML=f,o=l(),g=h("p"),g.innerHTML=S,F=l(),J=h("ul"),J.innerHTML=Q,j=l(),Z=h("p"),Z.innerHTML=U},l(i){e=u(i,"P",{"data-svelte-h":!0}),v(e)!=="svelte-1ajbfxg"&&(e.innerHTML=c),t=d(i),s=u(i,"UL",{"data-svelte-h":!0}),v(s)!=="svelte-qm1t26"&&(s.innerHTML=f),o=d(i),g=u(i,"P",{"data-svelte-h":!0}),v(g)!=="svelte-1v9qsc5"&&(g.innerHTML=S),F=d(i),J=u(i,"UL",{"data-svelte-h":!0}),v(J)!=="svelte-99h8aq"&&(J.innerHTML=Q),j=d(i),Z=u(i,"P",{"data-svelte-h":!0}),v(Z)!=="svelte-1an3odd"&&(Z.innerHTML=U)},m(i,C){r(i,e,C),r(i,t,C),r(i,s,C),r(i,o,C),r(i,g,C),r(i,F,C),r(i,J,C),r(i,j,C),r(i,Z,C)},p:me,d(i){i&&(a(e),a(t),a(s),a(o),a(g),a(F),a(J),a(j),a(Z))}}}function Se(A){let e,c=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){e=h("p"),e.innerHTML=c},l(t){e=u(t,"P",{"data-svelte-h":!0}),v(e)!=="svelte-fincs2"&&(e.innerHTML=c)},m(t,s){r(t,e,s)},p:me,d(t){t&&a(e)}}}function Qe(A){let e,c="Examples:",t,s,f;return s=new xe({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyMFRGVmlUTUFFTW9kZWwlMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEFpbXBvcnQlMjByZXF1ZXN0cyUwQSUwQXVybCUyMCUzRCUyMCUyMmh0dHAlM0ElMkYlMkZpbWFnZXMuY29jb2RhdGFzZXQub3JnJTJGdmFsMjAxNyUyRjAwMDAwMDAzOTc2OS5qcGclMjIlMEFpbWFnZSUyMCUzRCUyMEltYWdlLm9wZW4ocmVxdWVzdHMuZ2V0KHVybCUyQyUyMHN0cmVhbSUzRFRydWUpLnJhdyklMEElMEFpbWFnZV9wcm9jZXNzb3IlMjAlM0QlMjBBdXRvSW1hZ2VQcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMmZhY2Vib29rJTJGdml0LW1hZS1iYXNlJTIyKSUwQW1vZGVsJTIwJTNEJTIwVEZWaVRNQUVNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyZmFjZWJvb2slMkZ2aXQtbWFlLWJhc2UlMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwaW1hZ2VfcHJvY2Vzc29yKGltYWdlcyUzRGltYWdlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJ0ZiUyMiklMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpJTBBbGFzdF9oaWRkZW5fc3RhdGVzJTIwJTNEJTIwb3V0cHV0cy5sYXN0X2hpZGRlbl9zdGF0ZQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, TFViTMAEModel
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000039769.jpg&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = Image.<span class="hljs-built_in">open</span>(requests.get(url, stream=<span class="hljs-literal">True</span>).raw)

<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;facebook/vit-mae-base&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFViTMAEModel.from_pretrained(<span class="hljs-string">&quot;facebook/vit-mae-base&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = image_processor(images=image, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_states = outputs.last_hidden_state`,wrap:!1}}),{c(){e=h("p"),e.textContent=c,t=l(),b(s.$$.fragment)},l(o){e=u(o,"P",{"data-svelte-h":!0}),v(e)!=="svelte-kvfsh7"&&(e.textContent=c),t=d(o),w(s.$$.fragment,o)},m(o,g){r(o,e,g),r(o,t,g),$(s,o,g),f=!0},p:me,i(o){f||(V(s.$$.fragment,o),f=!0)},o(o){E(s.$$.fragment,o),f=!1},d(o){o&&(a(e),a(t)),x(s,o)}}}function De(A){let e,c="TensorFlow models and layers in <code>transformers</code> accept two formats as input:",t,s,f="<li>having all inputs as keyword arguments (like PyTorch models), or</li> <li>having all inputs as a list, tuple or dict in the first positional argument.</li>",o,g,S=`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
and layers. Because of this support, when using methods like <code>model.fit()</code> things should “just work” for you - just
pass your inputs and labels in any format that <code>model.fit()</code> supports! If, however, you want to use the second
format outside of Keras methods like <code>fit()</code> and <code>predict()</code>, such as when creating your own layers or models with
the Keras <code>Functional</code> API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`,F,J,Q=`<li>a single Tensor with <code>pixel_values</code> only and nothing else: <code>model(pixel_values)</code></li> <li>a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
<code>model([pixel_values, attention_mask])</code> or <code>model([pixel_values, attention_mask, token_type_ids])</code></li> <li>a dictionary with one or several input Tensors associated to the input names given in the docstring:
<code>model({&quot;pixel_values&quot;: pixel_values, &quot;token_type_ids&quot;: token_type_ids})</code></li>`,j,Z,U=`Note that when creating models and layers with
<a href="https://keras.io/guides/making_new_layers_and_models_via_subclassing/" rel="nofollow">subclassing</a> then you don’t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`;return{c(){e=h("p"),e.innerHTML=c,t=l(),s=h("ul"),s.innerHTML=f,o=l(),g=h("p"),g.innerHTML=S,F=l(),J=h("ul"),J.innerHTML=Q,j=l(),Z=h("p"),Z.innerHTML=U},l(i){e=u(i,"P",{"data-svelte-h":!0}),v(e)!=="svelte-1ajbfxg"&&(e.innerHTML=c),t=d(i),s=u(i,"UL",{"data-svelte-h":!0}),v(s)!=="svelte-qm1t26"&&(s.innerHTML=f),o=d(i),g=u(i,"P",{"data-svelte-h":!0}),v(g)!=="svelte-1v9qsc5"&&(g.innerHTML=S),F=d(i),J=u(i,"UL",{"data-svelte-h":!0}),v(J)!=="svelte-99h8aq"&&(J.innerHTML=Q),j=d(i),Z=u(i,"P",{"data-svelte-h":!0}),v(Z)!=="svelte-1an3odd"&&(Z.innerHTML=U)},m(i,C){r(i,e,C),r(i,t,C),r(i,s,C),r(i,o,C),r(i,g,C),r(i,F,C),r(i,J,C),r(i,j,C),r(i,Z,C)},p:me,d(i){i&&(a(e),a(t),a(s),a(o),a(g),a(F),a(J),a(j),a(Z))}}}function Oe(A){let e,c=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){e=h("p"),e.innerHTML=c},l(t){e=u(t,"P",{"data-svelte-h":!0}),v(e)!=="svelte-fincs2"&&(e.innerHTML=c)},m(t,s){r(t,e,s)},p:me,d(t){t&&a(e)}}}function Ke(A){let e,c="Examples:",t,s,f;return s=new xe({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyMFRGVmlUTUFFRm9yUHJlVHJhaW5pbmclMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEFpbXBvcnQlMjByZXF1ZXN0cyUwQSUwQXVybCUyMCUzRCUyMCUyMmh0dHAlM0ElMkYlMkZpbWFnZXMuY29jb2RhdGFzZXQub3JnJTJGdmFsMjAxNyUyRjAwMDAwMDAzOTc2OS5qcGclMjIlMEFpbWFnZSUyMCUzRCUyMEltYWdlLm9wZW4ocmVxdWVzdHMuZ2V0KHVybCUyQyUyMHN0cmVhbSUzRFRydWUpLnJhdyklMEElMEFpbWFnZV9wcm9jZXNzb3IlMjAlM0QlMjBBdXRvSW1hZ2VQcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMmZhY2Vib29rJTJGdml0LW1hZS1iYXNlJTIyKSUwQW1vZGVsJTIwJTNEJTIwVEZWaVRNQUVGb3JQcmVUcmFpbmluZy5mcm9tX3ByZXRyYWluZWQoJTIyZmFjZWJvb2slMkZ2aXQtbWFlLWJhc2UlMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwaW1hZ2VfcHJvY2Vzc29yKGltYWdlcyUzRGltYWdlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpJTBBbG9zcyUyMCUzRCUyMG91dHB1dHMubG9zcyUwQW1hc2slMjAlM0QlMjBvdXRwdXRzLm1hc2slMEFpZHNfcmVzdG9yZSUyMCUzRCUyMG91dHB1dHMuaWRzX3Jlc3RvcmU=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, TFViTMAEForPreTraining
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000039769.jpg&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = Image.<span class="hljs-built_in">open</span>(requests.get(url, stream=<span class="hljs-literal">True</span>).raw)

<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;facebook/vit-mae-base&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFViTMAEForPreTraining.from_pretrained(<span class="hljs-string">&quot;facebook/vit-mae-base&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = image_processor(images=image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = outputs.loss
<span class="hljs-meta">&gt;&gt;&gt; </span>mask = outputs.mask
<span class="hljs-meta">&gt;&gt;&gt; </span>ids_restore = outputs.ids_restore`,wrap:!1}}),{c(){e=h("p"),e.textContent=c,t=l(),b(s.$$.fragment)},l(o){e=u(o,"P",{"data-svelte-h":!0}),v(e)!=="svelte-kvfsh7"&&(e.textContent=c),t=d(o),w(s.$$.fragment,o)},m(o,g){r(o,e,g),r(o,t,g),$(s,o,g),f=!0},p:me,i(o){f||(V(s.$$.fragment,o),f=!0)},o(o){E(s.$$.fragment,o),f=!1},d(o){o&&(a(e),a(t)),x(s,o)}}}function et(A){let e,c,t,s,f,o,g=`The bare ViTMAE Model transformer outputting raw hidden-states without any specific head on top.
This model inherits from <a href="/docs/transformers/main/en/main_classes/model#transformers.TFPreTrainedModel">TFPreTrainedModel</a>. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`,S,F,J=`This model is also a <a href="https://www.tensorflow.org/api_docs/python/tf/keras/Model" rel="nofollow">tf.keras.Model</a> subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`,Q,j,Z,U,i,C,B,te='The <a href="/docs/transformers/main/en/model_doc/vit_mae#transformers.TFViTMAEModel">TFViTMAEModel</a> forward method, overrides the <code>__call__</code> special method.',se,D,z,Y,ie,R,ge,W,H,le,N,ve=`The ViTMAE Model transformer with the decoder on top for self-supervised pre-training.
This model inherits from <a href="/docs/transformers/main/en/main_classes/model#transformers.TFPreTrainedModel">TFPreTrainedModel</a>. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`,de,P,ne=`This model is also a <a href="https://www.tensorflow.org/api_docs/python/tf/keras/Model" rel="nofollow">tf.keras.Model</a> subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`,oe,O,pe,I,X,ce,q,_e='The <a href="/docs/transformers/main/en/model_doc/vit_mae#transformers.TFViTMAEForPreTraining">TFViTMAEForPreTraining</a> forward method, overrides the <code>__call__</code> special method.',p,M,G,k,L;return e=new Te({props:{title:"TFViTMAEModel",local:"transformers.TFViTMAEModel",headingTag:"h2"}}),s=new Me({props:{name:"class transformers.TFViTMAEModel",anchor:"transformers.TFViTMAEModel",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFViTMAEModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/vit_mae#transformers.ViTMAEConfig">ViTMAEConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.TFPreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/vit_mae/modeling_tf_vit_mae.py#L778"}}),j=new be({props:{$$slots:{default:[Xe]},$$scope:{ctx:A}}}),i=new Me({props:{name:"call",anchor:"transformers.TFViTMAEModel.call",parameters:[{name:"pixel_values",val:": TFModelInputType | None = None"},{name:"noise",val:": tf.Tensor = None"},{name:"head_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"output_attentions",val:": Optional[bool] = None"},{name:"output_hidden_states",val:": Optional[bool] = None"},{name:"return_dict",val:": Optional[bool] = None"},{name:"training",val:": bool = False"}],parametersDescription:[{anchor:"transformers.TFViTMAEModel.call.pixel_values",description:`<strong>pixel_values</strong> (<code>np.ndarray</code>, <code>tf.Tensor</code>, <code>List[tf.Tensor]</code> \`<code>Dict[str, tf.Tensor]</code> or <code>Dict[str, np.ndarray]</code> and each example must have the shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/main/en/model_doc/dpt#transformers.DPTFeatureExtractor.__call__">ViTImageProcessor.<strong>call</strong>()</a>
for details.`,name:"pixel_values"},{anchor:"transformers.TFViTMAEModel.call.head_mask",description:`<strong>head_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.TFViTMAEModel.call.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail. This argument can be used only in eager mode, in graph mode the value in the
config will be used instead.`,name:"output_attentions"},{anchor:"transformers.TFViTMAEModel.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
used instead.`,name:"output_hidden_states"},{anchor:"transformers.TFViTMAEModel.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple. This argument can be used
in eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFViTMAEModel.call.training",description:`<strong>training</strong> (<code>bool</code>, <em>optional</em>, defaults to \`False&#x201C;) &#x2014;
Whether or not to use the model in training mode (some modules like dropout modules have different
behaviors between training and evaluation).`,name:"training"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/vit_mae/modeling_tf_vit_mae.py#L787",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <code>transformers.models.vit_mae.modeling_tf_vit_mae.TFViTMAEModelOutput</code> or a tuple of <code>tf.Tensor</code> (if
<code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various elements depending on the
configuration (<a
  href="/docs/transformers/main/en/model_doc/vit_mae#transformers.ViTMAEConfig"
>ViTMAEConfig</a>) and inputs.</p>
<ul>
<li><strong>last_hidden_state</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) — Sequence of hidden-states at the output of the last layer of the model.</li>
<li><strong>mask</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) — Tensor indicating which patches are masked (1) and which are not (0).</li>
<li><strong>ids_restore</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) — Tensor containing the original index of the (shuffled) masked patches.</li>
<li><strong>hidden_states</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>tf.Tensor</code> (one for the output of the embeddings + one for the output of each layer) of shape
<code>(batch_size, sequence_length, hidden_size)</code>. Hidden-states of the model at the output of each layer plus
the initial embedding outputs.</li>
<li><strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>. Attentions weights after the attention softmax, used to compute the weighted average in
the self-attention heads.</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>transformers.models.vit_mae.modeling_tf_vit_mae.TFViTMAEModelOutput</code> or <code>tuple(tf.Tensor)</code></p>
`}}),D=new be({props:{$$slots:{default:[Se]},$$scope:{ctx:A}}}),Y=new Ee({props:{anchor:"transformers.TFViTMAEModel.call.example",$$slots:{default:[Qe]},$$scope:{ctx:A}}}),R=new Te({props:{title:"TFViTMAEForPreTraining",local:"transformers.TFViTMAEForPreTraining",headingTag:"h2"}}),H=new Me({props:{name:"class transformers.TFViTMAEForPreTraining",anchor:"transformers.TFViTMAEForPreTraining",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFViTMAEForPreTraining.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/vit_mae#transformers.ViTMAEConfig">ViTMAEConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.TFPreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/vit_mae/modeling_tf_vit_mae.py#L939"}}),O=new be({props:{$$slots:{default:[De]},$$scope:{ctx:A}}}),X=new Me({props:{name:"call",anchor:"transformers.TFViTMAEForPreTraining.call",parameters:[{name:"pixel_values",val:": TFModelInputType | None = None"},{name:"noise",val:": tf.Tensor = None"},{name:"head_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"output_attentions",val:": Optional[bool] = None"},{name:"output_hidden_states",val:": Optional[bool] = None"},{name:"return_dict",val:": Optional[bool] = None"},{name:"training",val:": bool = False"}],parametersDescription:[{anchor:"transformers.TFViTMAEForPreTraining.call.pixel_values",description:`<strong>pixel_values</strong> (<code>np.ndarray</code>, <code>tf.Tensor</code>, <code>List[tf.Tensor]</code> \`<code>Dict[str, tf.Tensor]</code> or <code>Dict[str, np.ndarray]</code> and each example must have the shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/main/en/model_doc/dpt#transformers.DPTFeatureExtractor.__call__">ViTImageProcessor.<strong>call</strong>()</a>
for details.`,name:"pixel_values"},{anchor:"transformers.TFViTMAEForPreTraining.call.head_mask",description:`<strong>head_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.TFViTMAEForPreTraining.call.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail. This argument can be used only in eager mode, in graph mode the value in the
config will be used instead.`,name:"output_attentions"},{anchor:"transformers.TFViTMAEForPreTraining.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
used instead.`,name:"output_hidden_states"},{anchor:"transformers.TFViTMAEForPreTraining.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple. This argument can be used
in eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFViTMAEForPreTraining.call.training",description:`<strong>training</strong> (<code>bool</code>, <em>optional</em>, defaults to \`False&#x201C;) &#x2014;
Whether or not to use the model in training mode (some modules like dropout modules have different
behaviors between training and evaluation).`,name:"training"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/vit_mae/modeling_tf_vit_mae.py#L1063",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <code>transformers.models.vit_mae.modeling_tf_vit_mae.TFViTMAEForPreTrainingOutput</code> or a tuple of <code>tf.Tensor</code> (if
<code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various elements depending on the
configuration (<a
  href="/docs/transformers/main/en/model_doc/vit_mae#transformers.ViTMAEConfig"
>ViTMAEConfig</a>) and inputs.</p>
<ul>
<li><strong>loss</strong> (<code>tf.Tensor</code> of shape <code>(1,)</code>) — Pixel reconstruction loss.</li>
<li><strong>logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, patch_size ** 2 * num_channels)</code>) — Pixel reconstruction logits.</li>
<li><strong>mask</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) — Tensor indicating which patches are masked (1) and which are not (0).</li>
<li><strong>ids_restore</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) — Tensor containing the original index of the (shuffled) masked patches.</li>
<li><strong>hidden_states</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>tf.Tensor</code> (one for the output of the embeddings + one for the output of each layer) of shape
<code>(batch_size, sequence_length, hidden_size)</code>. Hidden-states of the model at the output of each layer plus
the initial embedding outputs.</li>
<li><strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>. Attentions weights after the attention softmax, used to compute the weighted average in
the self-attention heads.</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>transformers.models.vit_mae.modeling_tf_vit_mae.TFViTMAEForPreTrainingOutput</code> or <code>tuple(tf.Tensor)</code></p>
`}}),M=new be({props:{$$slots:{default:[Oe]},$$scope:{ctx:A}}}),k=new Ee({props:{anchor:"transformers.TFViTMAEForPreTraining.call.example",$$slots:{default:[Ke]},$$scope:{ctx:A}}}),{c(){b(e.$$.fragment),c=l(),t=h("div"),b(s.$$.fragment),f=l(),o=h("p"),o.innerHTML=g,S=l(),F=h("p"),F.innerHTML=J,Q=l(),b(j.$$.fragment),Z=l(),U=h("div"),b(i.$$.fragment),C=l(),B=h("p"),B.innerHTML=te,se=l(),b(D.$$.fragment),z=l(),b(Y.$$.fragment),ie=l(),b(R.$$.fragment),ge=l(),W=h("div"),b(H.$$.fragment),le=l(),N=h("p"),N.innerHTML=ve,de=l(),P=h("p"),P.innerHTML=ne,oe=l(),b(O.$$.fragment),pe=l(),I=h("div"),b(X.$$.fragment),ce=l(),q=h("p"),q.innerHTML=_e,p=l(),b(M.$$.fragment),G=l(),b(k.$$.fragment),this.h()},l(m){w(e.$$.fragment,m),c=d(m),t=u(m,"DIV",{class:!0});var y=fe(t);w(s.$$.fragment,y),f=d(y),o=u(y,"P",{"data-svelte-h":!0}),v(o)!=="svelte-1fdtwjl"&&(o.innerHTML=g),S=d(y),F=u(y,"P",{"data-svelte-h":!0}),v(F)!=="svelte-1ivrf8m"&&(F.innerHTML=J),Q=d(y),w(j.$$.fragment,y),Z=d(y),U=u(y,"DIV",{class:!0});var ae=fe(U);w(i.$$.fragment,ae),C=d(ae),B=u(ae,"P",{"data-svelte-h":!0}),v(B)!=="svelte-1c9bdsm"&&(B.innerHTML=te),se=d(ae),w(D.$$.fragment,ae),z=d(ae),w(Y.$$.fragment,ae),ae.forEach(a),y.forEach(a),ie=d(m),w(R.$$.fragment,m),ge=d(m),W=u(m,"DIV",{class:!0});var ee=fe(W);w(H.$$.fragment,ee),le=d(ee),N=u(ee,"P",{"data-svelte-h":!0}),v(N)!=="svelte-gfhire"&&(N.innerHTML=ve),de=d(ee),P=u(ee,"P",{"data-svelte-h":!0}),v(P)!=="svelte-1ivrf8m"&&(P.innerHTML=ne),oe=d(ee),w(O.$$.fragment,ee),pe=d(ee),I=u(ee,"DIV",{class:!0});var K=fe(I);w(X.$$.fragment,K),ce=d(K),q=u(K,"P",{"data-svelte-h":!0}),v(q)!=="svelte-1ydaxfq"&&(q.innerHTML=_e),p=d(K),w(M.$$.fragment,K),G=d(K),w(k.$$.fragment,K),K.forEach(a),ee.forEach(a),this.h()},h(){re(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),re(t,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),re(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),re(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(m,y){$(e,m,y),r(m,c,y),r(m,t,y),$(s,t,null),_(t,f),_(t,o),_(t,S),_(t,F),_(t,Q),$(j,t,null),_(t,Z),_(t,U),$(i,U,null),_(U,C),_(U,B),_(U,se),$(D,U,null),_(U,z),$(Y,U,null),r(m,ie,y),$(R,m,y),r(m,ge,y),r(m,W,y),$(H,W,null),_(W,le),_(W,N),_(W,de),_(W,P),_(W,oe),$(O,W,null),_(W,pe),_(W,I),$(X,I,null),_(I,ce),_(I,q),_(I,p),$(M,I,null),_(I,G),$(k,I,null),L=!0},p(m,y){const ae={};y&2&&(ae.$$scope={dirty:y,ctx:m}),j.$set(ae);const ee={};y&2&&(ee.$$scope={dirty:y,ctx:m}),D.$set(ee);const K={};y&2&&(K.$$scope={dirty:y,ctx:m}),Y.$set(K);const $e={};y&2&&($e.$$scope={dirty:y,ctx:m}),O.$set($e);const we={};y&2&&(we.$$scope={dirty:y,ctx:m}),M.$set(we);const he={};y&2&&(he.$$scope={dirty:y,ctx:m}),k.$set(he)},i(m){L||(V(e.$$.fragment,m),V(s.$$.fragment,m),V(j.$$.fragment,m),V(i.$$.fragment,m),V(D.$$.fragment,m),V(Y.$$.fragment,m),V(R.$$.fragment,m),V(H.$$.fragment,m),V(O.$$.fragment,m),V(X.$$.fragment,m),V(M.$$.fragment,m),V(k.$$.fragment,m),L=!0)},o(m){E(e.$$.fragment,m),E(s.$$.fragment,m),E(j.$$.fragment,m),E(i.$$.fragment,m),E(D.$$.fragment,m),E(Y.$$.fragment,m),E(R.$$.fragment,m),E(H.$$.fragment,m),E(O.$$.fragment,m),E(X.$$.fragment,m),E(M.$$.fragment,m),E(k.$$.fragment,m),L=!1},d(m){m&&(a(c),a(t),a(ie),a(ge),a(W)),x(e,m),x(s),x(j),x(i),x(D),x(Y),x(R,m),x(H),x(O),x(X),x(M),x(k)}}}function tt(A){let e,c;return e=new Ce({props:{$$slots:{default:[et]},$$scope:{ctx:A}}}),{c(){b(e.$$.fragment)},l(t){w(e.$$.fragment,t)},m(t,s){$(e,t,s),c=!0},p(t,s){const f={};s&2&&(f.$$scope={dirty:s,ctx:t}),e.$set(f)},i(t){c||(V(e.$$.fragment,t),c=!0)},o(t){E(e.$$.fragment,t),c=!1},d(t){x(e,t)}}}function nt(A){let e,c,t,s,f,o,g,S,F,J=`The ViTMAE model was proposed in <a href="https://arxiv.org/abs/2111.06377v2" rel="nofollow">Masked Autoencoders Are Scalable Vision Learners</a> by Kaiming He, Xinlei Chen, Saining Xie, Yanghao Li,
Piotr Dollár, Ross Girshick. The paper shows that, by pre-training a Vision Transformer (ViT) to reconstruct pixel values for masked patches, one can get results after
fine-tuning that outperform supervised pre-training.`,Q,j,Z="The abstract from the paper is the following:",U,i,C=`<em>This paper shows that masked autoencoders (MAE) are scalable self-supervised learners for computer vision. Our MAE approach is simple: we mask random patches of the
input image and reconstruct the missing pixels. It is based on two core designs. First, we develop an asymmetric encoder-decoder architecture, with an encoder that operates
only on the visible subset of patches (without mask tokens), along with a lightweight decoder that reconstructs the original image from the latent representation and mask
tokens. Second, we find that masking a high proportion of the input image, e.g., 75%, yields a nontrivial and meaningful self-supervisory task. Coupling these two designs
enables us to train large models efficiently and effectively: we accelerate training (by 3x or more) and improve accuracy. Our scalable approach allows for learning high-capacity
models that generalize well: e.g., a vanilla ViT-Huge model achieves the best accuracy (87.8%) among methods that use only ImageNet-1K data. Transfer performance in downstream
tasks outperforms supervised pre-training and shows promising scaling behavior.</em>`,B,te,se,D,z,Y='MAE architecture. Taken from the <a href="https://arxiv.org/abs/2111.06377">original paper.</a>',ie,R,ge=`This model was contributed by <a href="https://huggingface.co/nielsr" rel="nofollow">nielsr</a>. TensorFlow version of the model was contributed by <a href="https://github.com/sayakpaul" rel="nofollow">sayakpaul</a> and
<a href="https://github.com/ariG23498" rel="nofollow">ariG23498</a> (equal contribution). The original code can be found <a href="https://github.com/facebookresearch/mae" rel="nofollow">here</a>.`,W,H,le,N,ve=`<li>MAE (masked auto encoding) is a method for self-supervised pre-training of Vision Transformers (ViTs). The pre-training objective is relatively simple:
by masking a large portion (75%) of the image patches, the model must reconstruct raw pixel values. One can use <a href="/docs/transformers/main/en/model_doc/vit_mae#transformers.ViTMAEForPreTraining">ViTMAEForPreTraining</a> for this purpose.</li> <li>After pre-training, one “throws away” the decoder used to reconstruct pixels, and one uses the encoder for fine-tuning/linear probing. This means that after
fine-tuning, one can directly plug in the weights into a <a href="/docs/transformers/main/en/model_doc/vit#transformers.ViTForImageClassification">ViTForImageClassification</a>.</li> <li>One can use <a href="/docs/transformers/main/en/model_doc/vit#transformers.ViTImageProcessor">ViTImageProcessor</a> to prepare images for the model. See the code examples for more info.</li> <li>Note that the encoder of MAE is only used to encode the visual patches. The encoded patches are then concatenated with mask tokens, which the decoder (which also
consists of Transformer blocks) takes as input. Each mask token is a shared, learned vector that indicates the presence of a missing patch to be predicted. Fixed
sin/cos position embeddings are added both to the input of the encoder and the decoder.</li> <li>For a visual understanding of how MAEs work you can check out this <a href="https://keras.io/examples/vision/masked_image_modeling/" rel="nofollow">post</a>.</li>`,de,P,ne,oe,O="A list of official Hugging Face and community (indicated by 🌎) resources to help you get started with ViTMAE.",pe,I,X='<li><a href="/docs/transformers/main/en/model_doc/vit_mae#transformers.ViTMAEForPreTraining">ViTMAEForPreTraining</a> is supported by this <a href="https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-pretraining" rel="nofollow">example script</a>, allowing you to pre-train the model from scratch/further pre-train the model on custom data.</li> <li>A notebook that illustrates how to visualize reconstructed pixel values with <a href="/docs/transformers/main/en/model_doc/vit_mae#transformers.ViTMAEForPreTraining">ViTMAEForPreTraining</a> can be found <a href="https://github.com/NielsRogge/Transformers-Tutorials/blob/master/ViTMAE/ViT_MAE_visualization_demo.ipynb" rel="nofollow">here</a>.</li>',ce,q,_e="If you’re interested in submitting a resource to be included here, please feel free to open a Pull Request and we’ll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource.",p,M,G,k,L,m,y,ae=`This is the configuration class to store the configuration of a <a href="/docs/transformers/main/en/model_doc/vit_mae#transformers.ViTMAEModel">ViTMAEModel</a>. It is used to instantiate an ViT
MAE model according to the specified arguments, defining the model architecture. Instantiating a configuration with
the defaults will yield a similar configuration to that of the ViT
<a href="https://huggingface.co/facebook/vit-mae-base" rel="nofollow">facebook/vit-mae-base</a> architecture.`,ee,K,$e=`Configuration objects inherit from <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> and can be used to control the model outputs. Read the
documentation from <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,we,he,Fe,ye,ke,Ve,Ae;return f=new Te({props:{title:"ViTMAE",local:"vitmae",headingTag:"h1"}}),g=new Te({props:{title:"Overview",local:"overview",headingTag:"h2"}}),H=new Te({props:{title:"Usage tips",local:"usage-tips",headingTag:"h2"}}),P=new Te({props:{title:"Resources",local:"resources",headingTag:"h2"}}),M=new Te({props:{title:"ViTMAEConfig",local:"transformers.ViTMAEConfig",headingTag:"h2"}}),L=new Me({props:{name:"class transformers.ViTMAEConfig",anchor:"transformers.ViTMAEConfig",parameters:[{name:"hidden_size",val:" = 768"},{name:"num_hidden_layers",val:" = 12"},{name:"num_attention_heads",val:" = 12"},{name:"intermediate_size",val:" = 3072"},{name:"hidden_act",val:" = 'gelu'"},{name:"hidden_dropout_prob",val:" = 0.0"},{name:"attention_probs_dropout_prob",val:" = 0.0"},{name:"initializer_range",val:" = 0.02"},{name:"layer_norm_eps",val:" = 1e-12"},{name:"image_size",val:" = 224"},{name:"patch_size",val:" = 16"},{name:"num_channels",val:" = 3"},{name:"qkv_bias",val:" = True"},{name:"decoder_num_attention_heads",val:" = 16"},{name:"decoder_hidden_size",val:" = 512"},{name:"decoder_num_hidden_layers",val:" = 8"},{name:"decoder_intermediate_size",val:" = 2048"},{name:"mask_ratio",val:" = 0.75"},{name:"norm_pix_loss",val:" = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.ViTMAEConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 768) &#x2014;
Dimensionality of the encoder layers and the pooler layer.`,name:"hidden_size"},{anchor:"transformers.ViTMAEConfig.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of hidden layers in the Transformer encoder.`,name:"num_hidden_layers"},{anchor:"transformers.ViTMAEConfig.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"num_attention_heads"},{anchor:"transformers.ViTMAEConfig.intermediate_size",description:`<strong>intermediate_size</strong> (<code>int</code>, <em>optional</em>, defaults to 3072) &#x2014;
Dimensionality of the &#x201C;intermediate&#x201D; (i.e., feed-forward) layer in the Transformer encoder.`,name:"intermediate_size"},{anchor:"transformers.ViTMAEConfig.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code> or <code>function</code>, <em>optional</em>, defaults to <code>&quot;gelu&quot;</code>) &#x2014;
The non-linear activation function (function or string) in the encoder and pooler. If string, <code>&quot;gelu&quot;</code>,
<code>&quot;relu&quot;</code>, <code>&quot;selu&quot;</code> and <code>&quot;gelu_new&quot;</code> are supported.`,name:"hidden_act"},{anchor:"transformers.ViTMAEConfig.hidden_dropout_prob",description:`<strong>hidden_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout probabilitiy for all fully connected layers in the embeddings, encoder, and pooler.`,name:"hidden_dropout_prob"},{anchor:"transformers.ViTMAEConfig.attention_probs_dropout_prob",description:`<strong>attention_probs_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout ratio for the attention probabilities.`,name:"attention_probs_dropout_prob"},{anchor:"transformers.ViTMAEConfig.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to 0.02) &#x2014;
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"initializer_range"},{anchor:"transformers.ViTMAEConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-12) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.ViTMAEConfig.image_size",description:`<strong>image_size</strong> (<code>int</code>, <em>optional</em>, defaults to 224) &#x2014;
The size (resolution) of each image.`,name:"image_size"},{anchor:"transformers.ViTMAEConfig.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, <em>optional</em>, defaults to 16) &#x2014;
The size (resolution) of each patch.`,name:"patch_size"},{anchor:"transformers.ViTMAEConfig.num_channels",description:`<strong>num_channels</strong> (<code>int</code>, <em>optional</em>, defaults to 3) &#x2014;
The number of input channels.`,name:"num_channels"},{anchor:"transformers.ViTMAEConfig.qkv_bias",description:`<strong>qkv_bias</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to add a bias to the queries, keys and values.`,name:"qkv_bias"},{anchor:"transformers.ViTMAEConfig.decoder_num_attention_heads",description:`<strong>decoder_num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 16) &#x2014;
Number of attention heads for each attention layer in the decoder.`,name:"decoder_num_attention_heads"},{anchor:"transformers.ViTMAEConfig.decoder_hidden_size",description:`<strong>decoder_hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
Dimensionality of the decoder.`,name:"decoder_hidden_size"},{anchor:"transformers.ViTMAEConfig.decoder_num_hidden_layers",description:`<strong>decoder_num_hidden_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 8) &#x2014;
Number of hidden layers in the decoder.`,name:"decoder_num_hidden_layers"},{anchor:"transformers.ViTMAEConfig.decoder_intermediate_size",description:`<strong>decoder_intermediate_size</strong> (<code>int</code>, <em>optional</em>, defaults to 2048) &#x2014;
Dimensionality of the &#x201C;intermediate&#x201D; (i.e., feed-forward) layer in the decoder.`,name:"decoder_intermediate_size"},{anchor:"transformers.ViTMAEConfig.mask_ratio",description:`<strong>mask_ratio</strong> (<code>float</code>, <em>optional</em>, defaults to 0.75) &#x2014;
The ratio of the number of masked tokens in the input sequence.`,name:"mask_ratio"},{anchor:"transformers.ViTMAEConfig.norm_pix_loss",description:`<strong>norm_pix_loss</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to train with normalized pixels (see Table 3 in the paper). Using normalized pixels improved
representation quality in the experiments of the authors.`,name:"norm_pix_loss"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/vit_mae/configuration_vit_mae.py#L29"}}),he=new Ee({props:{anchor:"transformers.ViTMAEConfig.example",$$slots:{default:[Ie]},$$scope:{ctx:A}}}),ye=new He({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[tt],pytorch:[Ye]},$$scope:{ctx:A}}}),{c(){e=h("meta"),c=l(),t=h("p"),s=l(),b(f.$$.fragment),o=l(),b(g.$$.fragment),S=l(),F=h("p"),F.innerHTML=J,Q=l(),j=h("p"),j.textContent=Z,U=l(),i=h("p"),i.innerHTML=C,B=l(),te=h("img"),D=l(),z=h("small"),z.innerHTML=Y,ie=l(),R=h("p"),R.innerHTML=ge,W=l(),b(H.$$.fragment),le=l(),N=h("ul"),N.innerHTML=ve,de=l(),b(P.$$.fragment),ne=l(),oe=h("p"),oe.textContent=O,pe=l(),I=h("ul"),I.innerHTML=X,ce=l(),q=h("p"),q.textContent=_e,p=l(),b(M.$$.fragment),G=l(),k=h("div"),b(L.$$.fragment),m=l(),y=h("p"),y.innerHTML=ae,ee=l(),K=h("p"),K.innerHTML=$e,we=l(),b(he.$$.fragment),Fe=l(),b(ye.$$.fragment),ke=l(),Ve=h("p"),this.h()},l(n){const T=We("svelte-u9bgzb",document.head);e=u(T,"META",{name:!0,content:!0}),T.forEach(a),c=d(n),t=u(n,"P",{}),fe(t).forEach(a),s=d(n),w(f.$$.fragment,n),o=d(n),w(g.$$.fragment,n),S=d(n),F=u(n,"P",{"data-svelte-h":!0}),v(F)!=="svelte-5dx8db"&&(F.innerHTML=J),Q=d(n),j=u(n,"P",{"data-svelte-h":!0}),v(j)!=="svelte-vfdo9a"&&(j.textContent=Z),U=d(n),i=u(n,"P",{"data-svelte-h":!0}),v(i)!=="svelte-11f68yf"&&(i.innerHTML=C),B=d(n),te=u(n,"IMG",{src:!0,alt:!0,width:!0}),D=d(n),z=u(n,"SMALL",{"data-svelte-h":!0}),v(z)!=="svelte-rtuuvp"&&(z.innerHTML=Y),ie=d(n),R=u(n,"P",{"data-svelte-h":!0}),v(R)!=="svelte-3rb8sy"&&(R.innerHTML=ge),W=d(n),w(H.$$.fragment,n),le=d(n),N=u(n,"UL",{"data-svelte-h":!0}),v(N)!=="svelte-jj54br"&&(N.innerHTML=ve),de=d(n),w(P.$$.fragment,n),ne=d(n),oe=u(n,"P",{"data-svelte-h":!0}),v(oe)!=="svelte-15wot93"&&(oe.textContent=O),pe=d(n),I=u(n,"UL",{"data-svelte-h":!0}),v(I)!=="svelte-chvuel"&&(I.innerHTML=X),ce=d(n),q=u(n,"P",{"data-svelte-h":!0}),v(q)!=="svelte-1xesile"&&(q.textContent=_e),p=d(n),w(M.$$.fragment,n),G=d(n),k=u(n,"DIV",{class:!0});var ue=fe(k);w(L.$$.fragment,ue),m=d(ue),y=u(ue,"P",{"data-svelte-h":!0}),v(y)!=="svelte-1uhocrp"&&(y.innerHTML=ae),ee=d(ue),K=u(ue,"P",{"data-svelte-h":!0}),v(K)!=="svelte-o55m63"&&(K.innerHTML=$e),we=d(ue),w(he.$$.fragment,ue),ue.forEach(a),Fe=d(n),w(ye.$$.fragment,n),ke=d(n),Ve=u(n,"P",{}),fe(Ve).forEach(a),this.h()},h(){re(e,"name","hf:doc:metadata"),re(e,"content",ot),Ue(te.src,se="https://user-images.githubusercontent.com/11435359/146857310-f258c86c-fde6-48e8-9cee-badd2b21bd2c.png")||re(te,"src",se),re(te,"alt","drawing"),re(te,"width","600"),re(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(n,T){_(document.head,e),r(n,c,T),r(n,t,T),r(n,s,T),$(f,n,T),r(n,o,T),$(g,n,T),r(n,S,T),r(n,F,T),r(n,Q,T),r(n,j,T),r(n,U,T),r(n,i,T),r(n,B,T),r(n,te,T),r(n,D,T),r(n,z,T),r(n,ie,T),r(n,R,T),r(n,W,T),$(H,n,T),r(n,le,T),r(n,N,T),r(n,de,T),$(P,n,T),r(n,ne,T),r(n,oe,T),r(n,pe,T),r(n,I,T),r(n,ce,T),r(n,q,T),r(n,p,T),$(M,n,T),r(n,G,T),r(n,k,T),$(L,k,null),_(k,m),_(k,y),_(k,ee),_(k,K),_(k,we),$(he,k,null),r(n,Fe,T),$(ye,n,T),r(n,ke,T),r(n,Ve,T),Ae=!0},p(n,[T]){const ue={};T&2&&(ue.$$scope={dirty:T,ctx:n}),he.$set(ue);const je={};T&2&&(je.$$scope={dirty:T,ctx:n}),ye.$set(je)},i(n){Ae||(V(f.$$.fragment,n),V(g.$$.fragment,n),V(H.$$.fragment,n),V(P.$$.fragment,n),V(M.$$.fragment,n),V(L.$$.fragment,n),V(he.$$.fragment,n),V(ye.$$.fragment,n),Ae=!0)},o(n){E(f.$$.fragment,n),E(g.$$.fragment,n),E(H.$$.fragment,n),E(P.$$.fragment,n),E(M.$$.fragment,n),E(L.$$.fragment,n),E(he.$$.fragment,n),E(ye.$$.fragment,n),Ae=!1},d(n){n&&(a(c),a(t),a(s),a(o),a(S),a(F),a(Q),a(j),a(U),a(i),a(B),a(te),a(D),a(z),a(ie),a(R),a(W),a(le),a(N),a(de),a(ne),a(oe),a(pe),a(I),a(ce),a(q),a(p),a(G),a(k),a(Fe),a(ke),a(Ve)),a(e),x(f,n),x(g,n),x(H,n),x(P,n),x(M,n),x(L),x(he),x(ye,n)}}}const ot='{"title":"ViTMAE","local":"vitmae","sections":[{"title":"Overview","local":"overview","sections":[],"depth":2},{"title":"Usage tips","local":"usage-tips","sections":[],"depth":2},{"title":"Resources","local":"resources","sections":[],"depth":2},{"title":"ViTMAEConfig","local":"transformers.ViTMAEConfig","sections":[],"depth":2},{"title":"ViTMAEModel","local":"transformers.ViTMAEModel","sections":[],"depth":2},{"title":"ViTMAEForPreTraining","local":"transformers.ViTMAEForPreTraining","sections":[],"depth":2},{"title":"TFViTMAEModel","local":"transformers.TFViTMAEModel","sections":[],"depth":2},{"title":"TFViTMAEForPreTraining","local":"transformers.TFViTMAEForPreTraining","sections":[],"depth":2}],"depth":1}';function st(A){return ze(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ht extends Pe{constructor(e){super(),Ze(this,e,st,nt,Je,{})}}export{ht as component};
