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 y,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 ye}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.fef84341.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(),y(s.$$.fragment)},l(n){e=u(n,"P",{"data-svelte-h":!0}),v(e)!=="svelte-11lpom8"&&(e.textContent=c),t=d(n),w(s.$$.fragment,n)},m(n,g){r(n,e,g),r(n,t,g),$(s,n,g),f=!0},p:me,i(n){f||(V(s.$$.fragment,n),f=!0)},o(n){E(s.$$.fragment,n),f=!1},d(n){n&&(a(e),a(t)),x(s,n)}}}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 Re(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(),y(s.$$.fragment)},l(n){e=u(n,"P",{"data-svelte-h":!0}),v(e)!=="svelte-kvfsh7"&&(e.textContent=c),t=d(n),w(s.$$.fragment,n)},m(n,g){r(n,e,g),r(n,t,g),$(s,n,g),f=!0},p:me,i(n){f||(V(s.$$.fragment,n),f=!0)},o(n){E(s.$$.fragment,n),f=!1},d(n){n&&(a(e),a(t)),x(s,n)}}}function qe(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(),y(s.$$.fragment)},l(n){e=u(n,"P",{"data-svelte-h":!0}),v(e)!=="svelte-kvfsh7"&&(e.textContent=c),t=d(n),w(s.$$.fragment,n)},m(n,g){r(n,e,g),r(n,t,g),$(s,n,g),f=!0},p:me,i(n){f||(V(s.$$.fragment,n),f=!0)},o(n){E(s.$$.fragment,n),f=!1},d(n){n&&(a(e),a(t)),x(s,n)}}}function Ge(A){let e,c,t,s,f,n,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,k,J,Q,j,Z='The <a href="/docs/transformers/v4.39.2/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,q,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,oe,ne,O,pe='The <a href="/docs/transformers/v4.39.2/en/model_doc/vit_mae#transformers.ViTMAEForPreTraining">ViTMAEForPreTraining</a> forward method, overrides the <code>__call__</code> special method.',I,X,ce,R,_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/v4.39.2/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/v4.39.2/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/v4.39.2/src/transformers/models/vit_mae/modeling_vit_mae.py#L623"}}),J=new Me({props:{name:"forward",anchor:"transformers.ViTMAEModel.forward",parameters:[{name:"pixel_values",val:": Optional = None"},{name:"noise",val:": Optional = None"},{name:"head_mask",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = 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/v4.39.2/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.39.2/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/v4.39.2/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.39.2/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/v4.39.2/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 ye({props:{$$slots:{default:[Le]},$$scope:{ctx:A}}}),B=new Ee({props:{anchor:"transformers.ViTMAEModel.forward.example",$$slots:{default:[Re]},$$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/v4.39.2/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/v4.39.2/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/v4.39.2/src/transformers/models/vit_mae/modeling_vit_mae.py#L820"}}),H=new ye({props:{$$slots:{default:[qe]},$$scope:{ctx:A}}}),oe=new Me({props:{name:"forward",anchor:"transformers.ViTMAEForPreTraining.forward",parameters:[{name:"pixel_values",val:": Optional = None"},{name:"noise",val:": Optional = None"},{name:"head_mask",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = 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/v4.39.2/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.39.2/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/v4.39.2/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.39.2/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/v4.39.2/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 ye({props:{$$slots:{default:[Ne]},$$scope:{ctx:A}}}),R=new Ee({props:{anchor:"transformers.ViTMAEForPreTraining.forward.example",$$slots:{default:[Be]},$$scope:{ctx:A}}}),{c(){y(e.$$.fragment),c=l(),t=h("div"),y(s.$$.fragment),f=l(),n=h("p"),n.innerHTML=g,S=l(),k=h("div"),y(J.$$.fragment),Q=l(),j=h("p"),j.innerHTML=Z,U=l(),y(i.$$.fragment),C=l(),y(B.$$.fragment),te=l(),y(se.$$.fragment),D=l(),z=h("div"),y(Y.$$.fragment),ie=l(),q=h("p"),q.textContent=ge,W=l(),y(H.$$.fragment),le=l(),N=h("p"),N.innerHTML=ve,de=l(),P=h("div"),y(oe.$$.fragment),ne=l(),O=h("p"),O.innerHTML=pe,I=l(),y(X.$$.fragment),ce=l(),y(R.$$.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),n=u(M,"P",{"data-svelte-h":!0}),v(n)!=="svelte-okthft"&&(n.innerHTML=g),S=d(M),k=u(M,"DIV",{class:!0});var G=fe(k);w(J.$$.fragment,G),Q=d(G),j=u(G,"P",{"data-svelte-h":!0}),v(j)!=="svelte-zdcm37"&&(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 F=fe(z);w(Y.$$.fragment,F),ie=d(F),q=u(F,"P",{"data-svelte-h":!0}),v(q)!=="svelte-10cjq04"&&(q.textContent=ge),W=d(F),w(H.$$.fragment,F),le=d(F),N=u(F,"P",{"data-svelte-h":!0}),v(N)!=="svelte-1gjh92c"&&(N.innerHTML=ve),de=d(F),P=u(F,"DIV",{class:!0});var L=fe(P);w(oe.$$.fragment,L),ne=d(L),O=u(L,"P",{"data-svelte-h":!0}),v(O)!=="svelte-4aierv"&&(O.innerHTML=pe),I=d(L),w(X.$$.fragment,L),ce=d(L),w(R.$$.fragment,L),L.forEach(a),F.forEach(a),this.h()},h(){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"),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,n),_(t,S),_(t,k),$(J,k,null),_(k,Q),_(k,j),_(k,U),$(i,k,null),_(k,C),$(B,k,null),r(p,te,M),$(se,p,M),r(p,D,M),r(p,z,M),$(Y,z,null),_(z,ie),_(z,q),_(z,W),$(H,z,null),_(z,le),_(z,N),_(z,de),_(z,P),$(oe,P,null),_(P,ne),_(P,O),_(P,I),$(X,P,null),_(P,ce),$(R,P,null),_e=!0},p(p,M){const G={};M&2&&(G.$$scope={dirty:M,ctx:p}),i.$set(G);const F={};M&2&&(F.$$scope={dirty:M,ctx:p}),B.$set(F);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 b={};M&2&&(b.$$scope={dirty:M,ctx:p}),R.$set(b)},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(oe.$$.fragment,p),V(X.$$.fragment,p),V(R.$$.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(oe.$$.fragment,p),E(X.$$.fragment,p),E(R.$$.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(oe),x(X),x(R)}}}function Ye(A){let e,c;return e=new Ce({props:{$$slots:{default:[Ge]},$$scope:{ctx:A}}}),{c(){y(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>",n,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:`,k,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,n=l(),g=h("p"),g.innerHTML=S,k=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),n=d(i),g=u(i,"P",{"data-svelte-h":!0}),v(g)!=="svelte-1v9qsc5"&&(g.innerHTML=S),k=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,n,C),r(i,g,C),r(i,k,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(n),a(g),a(k),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(),y(s.$$.fragment)},l(n){e=u(n,"P",{"data-svelte-h":!0}),v(e)!=="svelte-kvfsh7"&&(e.textContent=c),t=d(n),w(s.$$.fragment,n)},m(n,g){r(n,e,g),r(n,t,g),$(s,n,g),f=!0},p:me,i(n){f||(V(s.$$.fragment,n),f=!0)},o(n){E(s.$$.fragment,n),f=!1},d(n){n&&(a(e),a(t)),x(s,n)}}}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>",n,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:`,k,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,n=l(),g=h("p"),g.innerHTML=S,k=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),n=d(i),g=u(i,"P",{"data-svelte-h":!0}),v(g)!=="svelte-1v9qsc5"&&(g.innerHTML=S),k=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,n,C),r(i,g,C),r(i,k,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(n),a(g),a(k),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(),y(s.$$.fragment)},l(n){e=u(n,"P",{"data-svelte-h":!0}),v(e)!=="svelte-kvfsh7"&&(e.textContent=c),t=d(n),w(s.$$.fragment,n)},m(n,g){r(n,e,g),r(n,t,g),$(s,n,g),f=!0},p:me,i(n){f||(V(s.$$.fragment,n),f=!0)},o(n){E(s.$$.fragment,n),f=!1},d(n){n&&(a(e),a(t)),x(s,n)}}}function et(A){let e,c,t,s,f,n,g=`The bare ViTMAE Model transformer outputting raw hidden-states without any specific head on top.
This model inherits from <a href="/docs/transformers/v4.39.2/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,k,J=`This model is also a <a href="https://www.tensorflow.org/api_docs/python/tf/keras/Model" rel="nofollow">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/v4.39.2/en/model_doc/vit_mae#transformers.TFViTMAEModel">TFViTMAEModel</a> forward method, overrides the <code>__call__</code> special method.',se,D,z,Y,ie,q,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/v4.39.2/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,oe=`This model is also a <a href="https://www.tensorflow.org/api_docs/python/tf/keras/Model" rel="nofollow">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.`,ne,O,pe,I,X,ce,R,_e='The <a href="/docs/transformers/v4.39.2/en/model_doc/vit_mae#transformers.TFViTMAEForPreTraining">TFViTMAEForPreTraining</a> forward method, overrides the <code>__call__</code> special method.',p,M,G,F,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:"config",val:": ViTMAEConfig"},{name:"*inputs",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFViTMAEModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.39.2/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/v4.39.2/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/v4.39.2/src/transformers/models/vit_mae/modeling_tf_vit_mae.py#L881"}}),j=new ye({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/v4.39.2/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.39.2/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/v4.39.2/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/v4.39.2/src/transformers/models/vit_mae/modeling_tf_vit_mae.py#L894",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/v4.39.2/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 ye({props:{$$slots:{default:[Se]},$$scope:{ctx:A}}}),Y=new Ee({props:{anchor:"transformers.TFViTMAEModel.call.example",$$slots:{default:[Qe]},$$scope:{ctx:A}}}),q=new Te({props:{title:"TFViTMAEForPreTraining",local:"transformers.TFViTMAEForPreTraining",headingTag:"h2"}}),H=new Me({props:{name:"class transformers.TFViTMAEForPreTraining",anchor:"transformers.TFViTMAEForPreTraining",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.TFViTMAEForPreTraining.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.39.2/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/v4.39.2/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/v4.39.2/src/transformers/models/vit_mae/modeling_tf_vit_mae.py#L1065"}}),O=new ye({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/v4.39.2/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.39.2/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/v4.39.2/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/v4.39.2/src/transformers/models/vit_mae/modeling_tf_vit_mae.py#L1193",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/v4.39.2/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 ye({props:{$$slots:{default:[Oe]},$$scope:{ctx:A}}}),F=new Ee({props:{anchor:"transformers.TFViTMAEForPreTraining.call.example",$$slots:{default:[Ke]},$$scope:{ctx:A}}}),{c(){y(e.$$.fragment),c=l(),t=h("div"),y(s.$$.fragment),f=l(),n=h("p"),n.innerHTML=g,S=l(),k=h("p"),k.innerHTML=J,Q=l(),y(j.$$.fragment),Z=l(),U=h("div"),y(i.$$.fragment),C=l(),B=h("p"),B.innerHTML=te,se=l(),y(D.$$.fragment),z=l(),y(Y.$$.fragment),ie=l(),y(q.$$.fragment),ge=l(),W=h("div"),y(H.$$.fragment),le=l(),N=h("p"),N.innerHTML=ve,de=l(),P=h("p"),P.innerHTML=oe,ne=l(),y(O.$$.fragment),pe=l(),I=h("div"),y(X.$$.fragment),ce=l(),R=h("p"),R.innerHTML=_e,p=l(),y(M.$$.fragment),G=l(),y(F.$$.fragment),this.h()},l(m){w(e.$$.fragment,m),c=d(m),t=u(m,"DIV",{class:!0});var b=fe(t);w(s.$$.fragment,b),f=d(b),n=u(b,"P",{"data-svelte-h":!0}),v(n)!=="svelte-1p3xldo"&&(n.innerHTML=g),S=d(b),k=u(b,"P",{"data-svelte-h":!0}),v(k)!=="svelte-1be7e3c"&&(k.innerHTML=J),Q=d(b),w(j.$$.fragment,b),Z=d(b),U=u(b,"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-7eiunn"&&(B.innerHTML=te),se=d(ae),w(D.$$.fragment,ae),z=d(ae),w(Y.$$.fragment,ae),ae.forEach(a),b.forEach(a),ie=d(m),w(q.$$.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-njkk6r"&&(N.innerHTML=ve),de=d(ee),P=u(ee,"P",{"data-svelte-h":!0}),v(P)!=="svelte-1be7e3c"&&(P.innerHTML=oe),ne=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),R=u(K,"P",{"data-svelte-h":!0}),v(R)!=="svelte-ei8l5v"&&(R.innerHTML=_e),p=d(K),w(M.$$.fragment,K),G=d(K),w(F.$$.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,b){$(e,m,b),r(m,c,b),r(m,t,b),$(s,t,null),_(t,f),_(t,n),_(t,S),_(t,k),_(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,b),$(q,m,b),r(m,ge,b),r(m,W,b),$(H,W,null),_(W,le),_(W,N),_(W,de),_(W,P),_(W,ne),$(O,W,null),_(W,pe),_(W,I),$(X,I,null),_(I,ce),_(I,R),_(I,p),$(M,I,null),_(I,G),$(F,I,null),L=!0},p(m,b){const ae={};b&2&&(ae.$$scope={dirty:b,ctx:m}),j.$set(ae);const ee={};b&2&&(ee.$$scope={dirty:b,ctx:m}),D.$set(ee);const K={};b&2&&(K.$$scope={dirty:b,ctx:m}),Y.$set(K);const $e={};b&2&&($e.$$scope={dirty:b,ctx:m}),O.$set($e);const we={};b&2&&(we.$$scope={dirty:b,ctx:m}),M.$set(we);const he={};b&2&&(he.$$scope={dirty:b,ctx:m}),F.$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(q.$$.fragment,m),V(H.$$.fragment,m),V(O.$$.fragment,m),V(X.$$.fragment,m),V(M.$$.fragment,m),V(F.$$.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(q.$$.fragment,m),E(H.$$.fragment,m),E(O.$$.fragment,m),E(X.$$.fragment,m),E(M.$$.fragment,m),E(F.$$.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(q,m),x(H),x(O),x(X),x(M),x(F)}}}function tt(A){let e,c;return e=new Ce({props:{$$slots:{default:[et]},$$scope:{ctx:A}}}),{c(){y(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 ot(A){let e,c,t,s,f,n,g,S,k,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,q,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/v4.39.2/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/v4.39.2/en/model_doc/vit#transformers.ViTForImageClassification">ViTForImageClassification</a>.</li> <li>One can use <a href="/docs/transformers/v4.39.2/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,oe,ne,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/v4.39.2/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/v4.39.2/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,R,_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,F,L,m,b,ae=`This is the configuration class to store the configuration of a <a href="/docs/transformers/v4.39.2/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/v4.39.2/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/v4.39.2/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,we,he,ke,be,Fe,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 probability 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/v4.39.2/src/transformers/models/vit_mae/configuration_vit_mae.py#L29"}}),he=new Ee({props:{anchor:"transformers.ViTMAEConfig.example",$$slots:{default:[Ie]},$$scope:{ctx:A}}}),be=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(),y(f.$$.fragment),n=l(),y(g.$$.fragment),S=l(),k=h("p"),k.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(),q=h("p"),q.innerHTML=ge,W=l(),y(H.$$.fragment),le=l(),N=h("ul"),N.innerHTML=ve,de=l(),y(P.$$.fragment),oe=l(),ne=h("p"),ne.textContent=O,pe=l(),I=h("ul"),I.innerHTML=X,ce=l(),R=h("p"),R.textContent=_e,p=l(),y(M.$$.fragment),G=l(),F=h("div"),y(L.$$.fragment),m=l(),b=h("p"),b.innerHTML=ae,ee=l(),K=h("p"),K.innerHTML=$e,we=l(),y(he.$$.fragment),ke=l(),y(be.$$.fragment),Fe=l(),Ve=h("p"),this.h()},l(o){const T=We("svelte-u9bgzb",document.head);e=u(T,"META",{name:!0,content:!0}),T.forEach(a),c=d(o),t=u(o,"P",{}),fe(t).forEach(a),s=d(o),w(f.$$.fragment,o),n=d(o),w(g.$$.fragment,o),S=d(o),k=u(o,"P",{"data-svelte-h":!0}),v(k)!=="svelte-5dx8db"&&(k.innerHTML=J),Q=d(o),j=u(o,"P",{"data-svelte-h":!0}),v(j)!=="svelte-vfdo9a"&&(j.textContent=Z),U=d(o),i=u(o,"P",{"data-svelte-h":!0}),v(i)!=="svelte-11f68yf"&&(i.innerHTML=C),B=d(o),te=u(o,"IMG",{src:!0,alt:!0,width:!0}),D=d(o),z=u(o,"SMALL",{"data-svelte-h":!0}),v(z)!=="svelte-rtuuvp"&&(z.innerHTML=Y),ie=d(o),q=u(o,"P",{"data-svelte-h":!0}),v(q)!=="svelte-3rb8sy"&&(q.innerHTML=ge),W=d(o),w(H.$$.fragment,o),le=d(o),N=u(o,"UL",{"data-svelte-h":!0}),v(N)!=="svelte-8x9snk"&&(N.innerHTML=ve),de=d(o),w(P.$$.fragment,o),oe=d(o),ne=u(o,"P",{"data-svelte-h":!0}),v(ne)!=="svelte-15wot93"&&(ne.textContent=O),pe=d(o),I=u(o,"UL",{"data-svelte-h":!0}),v(I)!=="svelte-1jc9ix5"&&(I.innerHTML=X),ce=d(o),R=u(o,"P",{"data-svelte-h":!0}),v(R)!=="svelte-1xesile"&&(R.textContent=_e),p=d(o),w(M.$$.fragment,o),G=d(o),F=u(o,"DIV",{class:!0});var ue=fe(F);w(L.$$.fragment,ue),m=d(ue),b=u(ue,"P",{"data-svelte-h":!0}),v(b)!=="svelte-9b31v8"&&(b.innerHTML=ae),ee=d(ue),K=u(ue,"P",{"data-svelte-h":!0}),v(K)!=="svelte-1wty4gf"&&(K.innerHTML=$e),we=d(ue),w(he.$$.fragment,ue),ue.forEach(a),ke=d(o),w(be.$$.fragment,o),Fe=d(o),Ve=u(o,"P",{}),fe(Ve).forEach(a),this.h()},h(){re(e,"name","hf:doc:metadata"),re(e,"content",nt),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(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(o,T){_(document.head,e),r(o,c,T),r(o,t,T),r(o,s,T),$(f,o,T),r(o,n,T),$(g,o,T),r(o,S,T),r(o,k,T),r(o,Q,T),r(o,j,T),r(o,U,T),r(o,i,T),r(o,B,T),r(o,te,T),r(o,D,T),r(o,z,T),r(o,ie,T),r(o,q,T),r(o,W,T),$(H,o,T),r(o,le,T),r(o,N,T),r(o,de,T),$(P,o,T),r(o,oe,T),r(o,ne,T),r(o,pe,T),r(o,I,T),r(o,ce,T),r(o,R,T),r(o,p,T),$(M,o,T),r(o,G,T),r(o,F,T),$(L,F,null),_(F,m),_(F,b),_(F,ee),_(F,K),_(F,we),$(he,F,null),r(o,ke,T),$(be,o,T),r(o,Fe,T),r(o,Ve,T),Ae=!0},p(o,[T]){const ue={};T&2&&(ue.$$scope={dirty:T,ctx:o}),he.$set(ue);const je={};T&2&&(je.$$scope={dirty:T,ctx:o}),be.$set(je)},i(o){Ae||(V(f.$$.fragment,o),V(g.$$.fragment,o),V(H.$$.fragment,o),V(P.$$.fragment,o),V(M.$$.fragment,o),V(L.$$.fragment,o),V(he.$$.fragment,o),V(be.$$.fragment,o),Ae=!0)},o(o){E(f.$$.fragment,o),E(g.$$.fragment,o),E(H.$$.fragment,o),E(P.$$.fragment,o),E(M.$$.fragment,o),E(L.$$.fragment,o),E(he.$$.fragment,o),E(be.$$.fragment,o),Ae=!1},d(o){o&&(a(c),a(t),a(s),a(n),a(S),a(k),a(Q),a(j),a(U),a(i),a(B),a(te),a(D),a(z),a(ie),a(q),a(W),a(le),a(N),a(de),a(oe),a(ne),a(pe),a(I),a(ce),a(R),a(p),a(G),a(F),a(ke),a(Fe),a(Ve)),a(e),x(f,o),x(g,o),x(H,o),x(P,o),x(M,o),x(L),x(he),x(be,o)}}}const nt='{"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,ot,Je,{})}}export{ht as component};
