import{S as Ps,i as js,s as As,e as a,k as p,w,t as n,M as Fs,c as s,d as o,m as f,a as r,x as T,h as i,b as c,N as qs,G as t,g as m,y as M,q as $,o as y,B as N,v as zs,L as za}from"../../chunks/vendor-hf-doc-builder.js";import{T as xs}from"../../chunks/Tip-hf-doc-builder.js";import{D as Nt}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Oa}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as rt}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as qa}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";import{P as Os}from"../../chunks/PipelineTag-hf-doc-builder.js";function Ls(V){let h,b,_,u,v;return u=new Oa({props:{code:`from transformers import ViTMSNModel, ViTMSNConfig

# Initializing a ViT MSN vit-msn-base style configuration
configuration = ViTConfig()

# Initializing a model from the vit-msn-base style configuration
model = ViTMSNModel(configuration)

# Accessing the model configuration
configuration = model.config`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> ViTMSNModel, ViTMSNConfig

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

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model from the vit-msn-base style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ViTMSNModel(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`}}),{c(){h=a("p"),b=n("Example:"),_=p(),w(u.$$.fragment)},l(l){h=s(l,"P",{});var g=r(h);b=i(g,"Example:"),g.forEach(o),_=f(l),T(u.$$.fragment,l)},m(l,g){m(l,h,g),t(h,b),m(l,_,g),M(u,l,g),v=!0},p:za,i(l){v||($(u.$$.fragment,l),v=!0)},o(l){y(u.$$.fragment,l),v=!1},d(l){l&&o(h),l&&o(_),N(u,l)}}}function Ds(V){let h,b,_,u,v;return{c(){h=a("p"),b=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=a("code"),u=n("Module"),v=n(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){h=s(l,"P",{});var g=r(h);b=i(g,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=s(g,"CODE",{});var C=r(_);u=i(C,"Module"),C.forEach(o),v=i(g,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),g.forEach(o)},m(l,g){m(l,h,g),t(h,b),t(h,_),t(_,u),t(h,v)},d(l){l&&o(h)}}}function Bs(V){let h,b,_,u,v;return u=new Oa({props:{code:`from transformers import AutoImageProcessor, ViTMSNModel
import torch
from PIL import Image
import requests

url = "http://images.cocodataset.org/val2017/000000039769.jpg"
image = Image.open(requests.get(url, stream=True).raw)

image_processor = AutoImageProcessor.from_pretrained("facebook/vit-msn-small")
model = ViTMSNModel.from_pretrained("facebook/vit-msn-small")
inputs = image_processor(images=image, return_tensors="pt")
with torch.no_grad():
    outputs = model(**inputs)
last_hidden_states = outputs.last_hidden_state`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, ViTMSNModel
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<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-msn-small&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ViTMSNModel.from_pretrained(<span class="hljs-string">&quot;facebook/vit-msn-small&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><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    outputs = model(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_states = outputs.last_hidden_state`}}),{c(){h=a("p"),b=n("Examples:"),_=p(),w(u.$$.fragment)},l(l){h=s(l,"P",{});var g=r(h);b=i(g,"Examples:"),g.forEach(o),_=f(l),T(u.$$.fragment,l)},m(l,g){m(l,h,g),t(h,b),m(l,_,g),M(u,l,g),v=!0},p:za,i(l){v||($(u.$$.fragment,l),v=!0)},o(l){y(u.$$.fragment,l),v=!1},d(l){l&&o(h),l&&o(_),N(u,l)}}}function Ws(V){let h,b,_,u,v;return{c(){h=a("p"),b=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=a("code"),u=n("Module"),v=n(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){h=s(l,"P",{});var g=r(h);b=i(g,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=s(g,"CODE",{});var C=r(_);u=i(C,"Module"),C.forEach(o),v=i(g,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),g.forEach(o)},m(l,g){m(l,h,g),t(h,b),t(h,_),t(_,u),t(h,v)},d(l){l&&o(h)}}}function Hs(V){let h,b,_,u,v;return u=new Oa({props:{code:`from transformers import AutoImageProcessor, ViTMSNForImageClassification
import torch
from PIL import Image
import requests

torch.manual_seed(2)
url = "http://images.cocodataset.org/val2017/000000039769.jpg"
image = Image.open(requests.get(url, stream=True).raw)

image_processor = AutoImageProcessor.from_pretrained("facebook/vit-msn-small")
model = ViTMSNForImageClassification.from_pretrained("facebook/vit-msn-small")

inputs = image_processor(images=image, return_tensors="pt")
with torch.no_grad():
    logits = model(**inputs).logits
# model predicts one of the 1000 ImageNet classes
predicted_label = logits.argmax(-1).item()
print(model.config.id2label[predicted_label])`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, ViTMSNForImageClassification
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<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>torch.manual_seed(<span class="hljs-number">2</span>)
<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-msn-small&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ViTMSNForImageClassification.from_pretrained(<span class="hljs-string">&quot;facebook/vit-msn-small&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><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    logits = model(**inputs).logits
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># model predicts one of the 1000 ImageNet classes</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_label = logits.argmax(-<span class="hljs-number">1</span>).item()
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(model.config.id2label[predicted_label])
Kerry blue terrier`}}),{c(){h=a("p"),b=n("Examples:"),_=p(),w(u.$$.fragment)},l(l){h=s(l,"P",{});var g=r(h);b=i(g,"Examples:"),g.forEach(o),_=f(l),T(u.$$.fragment,l)},m(l,g){m(l,h,g),t(h,b),m(l,_,g),M(u,l,g),v=!0},p:za,i(l){v||($(u.$$.fragment,l),v=!0)},o(l){y(u.$$.fragment,l),v=!1},d(l){l&&o(h),l&&o(_),N(u,l)}}}function Rs(V){let h,b,_,u,v,l,g,C,to,St,q,K,nt,de,oo,it,ao,kt,U,so,me,ro,no,Vt,Fe,io,It,qe,lt,lo,Et,ze,co,Ct,j,ct,mo,ho,x,po,Oe,fo,uo,Le,go,_o,he,vo,bo,wo,dt,To,xt,J,La,Pt,pe,Mo,De,$o,jt,A,yo,fe,No,So,ue,ko,Vo,At,z,G,mt,ge,Io,ht,Eo,Ft,Be,Co,qt,_e,zt,Q,F,We,xo,Po,ve,jo,Ao,be,Fo,qo,zo,He,Oo,Re,Lo,Ot,Ke,Do,Lt,O,X,pt,we,Bo,ft,Wo,Dt,S,Te,Ho,L,Ro,Ue,Ko,Uo,Me,Jo,Go,Qo,D,Xo,Je,Yo,Zo,Ge,ea,ta,oa,Y,Bt,B,Z,ut,$e,aa,gt,sa,Wt,P,ye,ra,Ne,na,Se,ia,la,ca,I,ke,da,W,ma,Qe,ha,pa,_t,fa,ua,ga,ee,_a,te,Ht,H,oe,vt,Ve,va,bt,ba,Rt,k,Ie,wa,wt,Ta,Ma,Ee,$a,Ce,ya,Na,Sa,E,xe,ka,R,Va,Xe,Ia,Ea,Tt,Ca,xa,Pa,ae,ja,se,Kt;return l=new rt({}),de=new rt({}),ge=new rt({}),_e=new Os({props:{pipeline:"image-classification"}}),we=new rt({}),Te=new Nt({props:{name:"class transformers.ViTMSNConfig",anchor:"transformers.ViTMSNConfig",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-06"},{name:"image_size",val:" = 224"},{name:"patch_size",val:" = 16"},{name:"num_channels",val:" = 3"},{name:"qkv_bias",val:" = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.ViTMSNConfig.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.ViTMSNConfig.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.ViTMSNConfig.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.ViTMSNConfig.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.ViTMSNConfig.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.ViTMSNConfig.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.ViTMSNConfig.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.ViTMSNConfig.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.ViTMSNConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-06) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.ViTMSNConfig.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.ViTMSNConfig.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.ViTMSNConfig.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.ViTMSNConfig.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"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/vit_msn/configuration_vit_msn.py#L30"}}),Y=new qa({props:{anchor:"transformers.ViTMSNConfig.example",$$slots:{default:[Ls]},$$scope:{ctx:V}}}),$e=new rt({}),ye=new Nt({props:{name:"class transformers.ViTMSNModel",anchor:"transformers.ViTMSNModel",parameters:[{name:"config",val:": ViTMSNConfig"},{name:"use_mask_token",val:": bool = False"}],parametersDescription:[{anchor:"transformers.ViTMSNModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.29.0/en/model_doc/vit_msn#transformers.ViTMSNConfig">ViTMSNConfig</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.29.0/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.29.0/src/transformers/models/vit_msn/modeling_vit_msn.py#L492"}}),ke=new Nt({props:{name:"forward",anchor:"transformers.ViTMSNModel.forward",parameters:[{name:"pixel_values",val:": typing.Optional[torch.Tensor] = None"},{name:"bool_masked_pos",val:": typing.Optional[torch.BoolTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"interpolate_pos_encoding",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.ViTMSNModel.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.29.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.29.0/en/model_doc/dpt#transformers.DPTFeatureExtractor.__call__">ViTImageProcessor.<strong>call</strong>()</a>
for details.`,name:"pixel_values"},{anchor:"transformers.ViTMSNModel.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.ViTMSNModel.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.ViTMSNModel.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.ViTMSNModel.forward.interpolate_pos_encoding",description:`<strong>interpolate_pos_encoding</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to interpolate the pre-trained position encodings.`,name:"interpolate_pos_encoding"},{anchor:"transformers.ViTMSNModel.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.29.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.ViTMSNModel.forward.bool_masked_pos",description:`<strong>bool_masked_pos</strong> (<code>torch.BoolTensor</code> of shape <code>(batch_size, num_patches)</code>, <em>optional</em>) &#x2014;
Boolean masked positions. Indicates which patches are masked (1) and which aren&#x2019;t (0).`,name:"bool_masked_pos"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/vit_msn/modeling_vit_msn.py#L516",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutput"
>transformers.modeling_outputs.BaseModelOutput</a> 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.29.0/en/model_doc/vit_msn#transformers.ViTMSNConfig"
>ViTMSNConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) \u2014 Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><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>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><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>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.29.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutput"
>transformers.modeling_outputs.BaseModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ee=new xs({props:{$$slots:{default:[Ds]},$$scope:{ctx:V}}}),te=new qa({props:{anchor:"transformers.ViTMSNModel.forward.example",$$slots:{default:[Bs]},$$scope:{ctx:V}}}),Ve=new rt({}),Ie=new Nt({props:{name:"class transformers.ViTMSNForImageClassification",anchor:"transformers.ViTMSNForImageClassification",parameters:[{name:"config",val:": ViTMSNConfig"}],parametersDescription:[{anchor:"transformers.ViTMSNForImageClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.29.0/en/model_doc/vit_msn#transformers.ViTMSNConfig">ViTMSNConfig</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.29.0/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.29.0/src/transformers/models/vit_msn/modeling_vit_msn.py#L601"}}),xe=new Nt({props:{name:"forward",anchor:"transformers.ViTMSNForImageClassification.forward",parameters:[{name:"pixel_values",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"labels",val:": typing.Optional[torch.Tensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"interpolate_pos_encoding",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.ViTMSNForImageClassification.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.29.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.29.0/en/model_doc/dpt#transformers.DPTFeatureExtractor.__call__">ViTImageProcessor.<strong>call</strong>()</a>
for details.`,name:"pixel_values"},{anchor:"transformers.ViTMSNForImageClassification.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.ViTMSNForImageClassification.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.ViTMSNForImageClassification.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.ViTMSNForImageClassification.forward.interpolate_pos_encoding",description:`<strong>interpolate_pos_encoding</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to interpolate the pre-trained position encodings.`,name:"interpolate_pos_encoding"},{anchor:"transformers.ViTMSNForImageClassification.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.29.0/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.29.0/src/transformers/models/vit_msn/modeling_vit_msn.py#L614",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.0/en/main_classes/output#transformers.modeling_outputs.ImageClassifierOutput"
>transformers.modeling_outputs.ImageClassifierOutput</a> 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.29.0/en/model_doc/vit_msn#transformers.ViTMSNConfig"
>ViTMSNConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) \u2014 Classification (or regression if config.num_labels==1) loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.num_labels)</code>) \u2014 Classification (or regression if config.num_labels==1) scores (before SoftMax).</p>
</li>
<li>
<p><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>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each stage) of shape <code>(batch_size, sequence_length, hidden_size)</code>. Hidden-states
(also called feature maps) of the model at the output of each stage.</p>
</li>
<li>
<p><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>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, patch_size, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.29.0/en/main_classes/output#transformers.modeling_outputs.ImageClassifierOutput"
>transformers.modeling_outputs.ImageClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ae=new xs({props:{$$slots:{default:[Ws]},$$scope:{ctx:V}}}),se=new qa({props:{anchor:"transformers.ViTMSNForImageClassification.forward.example",$$slots:{default:[Hs]},$$scope:{ctx:V}}}),{c(){h=a("meta"),b=p(),_=a("h1"),u=a("a"),v=a("span"),w(l.$$.fragment),g=p(),C=a("span"),to=n("ViTMSN"),St=p(),q=a("h2"),K=a("a"),nt=a("span"),w(de.$$.fragment),oo=p(),it=a("span"),ao=n("Overview"),kt=p(),U=a("p"),so=n("The ViTMSN model was proposed in "),me=a("a"),ro=n("Masked Siamese Networks for Label-Efficient Learning"),no=n(` by Mahmoud Assran, Mathilde Caron, Ishan Misra, Piotr Bojanowski, Florian Bordes,
Pascal Vincent, Armand Joulin, Michael Rabbat, Nicolas Ballas. The paper presents a joint-embedding architecture to match the prototypes
of masked patches with that of the unmasked patches. With this setup, their method yields excellent performance in the low-shot and extreme low-shot
regimes.`),Vt=p(),Fe=a("p"),io=n("The abstract from the paper is the following:"),It=p(),qe=a("p"),lt=a("em"),lo=n(`We propose Masked Siamese Networks (MSN), a self-supervised learning framework for learning image representations. Our
approach matches the representation of an image view containing randomly masked patches to the representation of the original
unmasked image. This self-supervised pre-training strategy is particularly scalable when applied to Vision Transformers since only the
unmasked patches are processed by the network. As a result, MSNs improve the scalability of joint-embedding architectures,
while producing representations of a high semantic level that perform competitively on low-shot image classification. For instance,
on ImageNet-1K, with only 5,000 annotated images, our base MSN model achieves 72.4% top-1 accuracy,
and with 1% of ImageNet-1K labels, we achieve 75.7% top-1 accuracy, setting a new state-of-the-art for self-supervised learning on this benchmark.`),Et=p(),ze=a("p"),co=n("Tips:"),Ct=p(),j=a("ul"),ct=a("li"),mo=n(`MSN (masked siamese networks) is a method for self-supervised pre-training of Vision Transformers (ViTs). The pre-training
objective is to match the prototypes assigned to the unmasked views of the images to that of the masked views of the same images.`),ho=p(),x=a("li"),po=n(`The authors have only released pre-trained weights of the backbone (ImageNet-1k pre-training). So, to use that on your own image classification dataset,
use the `),Oe=a("a"),fo=n("ViTMSNForImageClassification"),uo=n(" class which is initialized from "),Le=a("a"),go=n("ViTMSNModel"),_o=n(`. Follow
`),he=a("a"),vo=n("this notebook"),bo=n(" for a detailed tutorial on fine-tuning."),wo=p(),dt=a("li"),To=n(`MSN is particularly useful in the low-shot and extreme low-shot regimes. Notably, it achieves 75.7% top-1 accuracy with only 1% of ImageNet-1K
labels when fine-tuned.`),xt=p(),J=a("img"),Pt=p(),pe=a("small"),Mo=n("MSN architecture. Taken from the "),De=a("a"),$o=n("original paper."),jt=p(),A=a("p"),yo=n("This model was contributed by "),fe=a("a"),No=n("sayakpaul"),So=n(". The original code can be found "),ue=a("a"),ko=n("here"),Vo=n("."),At=p(),z=a("h2"),G=a("a"),mt=a("span"),w(ge.$$.fragment),Io=p(),ht=a("span"),Eo=n("Resources"),Ft=p(),Be=a("p"),Co=n("A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with ViT MSN."),qt=p(),w(_e.$$.fragment),zt=p(),Q=a("ul"),F=a("li"),We=a("a"),xo=n("ViTMSNForImageClassification"),Po=n(" is supported by this "),ve=a("a"),jo=n("example script"),Ao=n(" and "),be=a("a"),Fo=n("notebook"),qo=n("."),zo=p(),He=a("li"),Oo=n("See also: "),Re=a("a"),Lo=n("Image classification task guide"),Ot=p(),Ke=a("p"),Do=n("If you\u2019re interested in submitting a resource to be included here, please feel free to open a Pull Request and we\u2019ll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource."),Lt=p(),O=a("h2"),X=a("a"),pt=a("span"),w(we.$$.fragment),Bo=p(),ft=a("span"),Wo=n("ViTMSNConfig"),Dt=p(),S=a("div"),w(Te.$$.fragment),Ho=p(),L=a("p"),Ro=n("This is the configuration class to store the configuration of a "),Ue=a("a"),Ko=n("ViTMSNModel"),Uo=n(`. It is used to instantiate an ViT
MSN 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
`),Me=a("a"),Jo=n("facebook/vit_msn_base"),Go=n(" architecture."),Qo=p(),D=a("p"),Xo=n("Configuration objects inherit from "),Je=a("a"),Yo=n("PretrainedConfig"),Zo=n(` and can be used to control the model outputs. Read the
documentation from `),Ge=a("a"),ea=n("PretrainedConfig"),ta=n(" for more information."),oa=p(),w(Y.$$.fragment),Bt=p(),B=a("h2"),Z=a("a"),ut=a("span"),w($e.$$.fragment),aa=p(),gt=a("span"),sa=n("ViTMSNModel"),Wt=p(),P=a("div"),w(ye.$$.fragment),ra=p(),Ne=a("p"),na=n(`The bare ViTMSN Model outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),Se=a("a"),ia=n("torch.nn.Module"),la=n(` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),ca=p(),I=a("div"),w(ke.$$.fragment),da=p(),W=a("p"),ma=n("The "),Qe=a("a"),ha=n("ViTMSNModel"),pa=n(" forward method, overrides the "),_t=a("code"),fa=n("__call__"),ua=n(" special method."),ga=p(),w(ee.$$.fragment),_a=p(),w(te.$$.fragment),Ht=p(),H=a("h2"),oe=a("a"),vt=a("span"),w(Ve.$$.fragment),va=p(),bt=a("span"),ba=n("ViTMSNForImageClassification"),Rt=p(),k=a("div"),w(Ie.$$.fragment),wa=p(),wt=a("p"),Ta=n("ViTMSN Model with an image classification head on top e.g. for ImageNet."),Ma=p(),Ee=a("p"),$a=n("This model is a PyTorch "),Ce=a("a"),ya=n("torch.nn.Module"),Na=n(` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Sa=p(),E=a("div"),w(xe.$$.fragment),ka=p(),R=a("p"),Va=n("The "),Xe=a("a"),Ia=n("ViTMSNForImageClassification"),Ea=n(" forward method, overrides the "),Tt=a("code"),Ca=n("__call__"),xa=n(" special method."),Pa=p(),w(ae.$$.fragment),ja=p(),w(se.$$.fragment),this.h()},l(e){const d=Fs('[data-svelte="svelte-1phssyn"]',document.head);h=s(d,"META",{name:!0,content:!0}),d.forEach(o),b=f(e),_=s(e,"H1",{class:!0});var Pe=r(_);u=s(Pe,"A",{id:!0,class:!0,href:!0});var Mt=r(u);v=s(Mt,"SPAN",{});var $t=r(v);T(l.$$.fragment,$t),$t.forEach(o),Mt.forEach(o),g=f(Pe),C=s(Pe,"SPAN",{});var yt=r(C);to=i(yt,"ViTMSN"),yt.forEach(o),Pe.forEach(o),St=f(e),q=s(e,"H2",{class:!0});var je=r(q);K=s(je,"A",{id:!0,class:!0,href:!0});var Da=r(K);nt=s(Da,"SPAN",{});var Ba=r(nt);T(de.$$.fragment,Ba),Ba.forEach(o),Da.forEach(o),oo=f(je),it=s(je,"SPAN",{});var Wa=r(it);ao=i(Wa,"Overview"),Wa.forEach(o),je.forEach(o),kt=f(e),U=s(e,"P",{});var Ut=r(U);so=i(Ut,"The ViTMSN model was proposed in "),me=s(Ut,"A",{href:!0,rel:!0});var Ha=r(me);ro=i(Ha,"Masked Siamese Networks for Label-Efficient Learning"),Ha.forEach(o),no=i(Ut,` by Mahmoud Assran, Mathilde Caron, Ishan Misra, Piotr Bojanowski, Florian Bordes,
Pascal Vincent, Armand Joulin, Michael Rabbat, Nicolas Ballas. The paper presents a joint-embedding architecture to match the prototypes
of masked patches with that of the unmasked patches. With this setup, their method yields excellent performance in the low-shot and extreme low-shot
regimes.`),Ut.forEach(o),Vt=f(e),Fe=s(e,"P",{});var Ra=r(Fe);io=i(Ra,"The abstract from the paper is the following:"),Ra.forEach(o),It=f(e),qe=s(e,"P",{});var Ka=r(qe);lt=s(Ka,"EM",{});var Ua=r(lt);lo=i(Ua,`We propose Masked Siamese Networks (MSN), a self-supervised learning framework for learning image representations. Our
approach matches the representation of an image view containing randomly masked patches to the representation of the original
unmasked image. This self-supervised pre-training strategy is particularly scalable when applied to Vision Transformers since only the
unmasked patches are processed by the network. As a result, MSNs improve the scalability of joint-embedding architectures,
while producing representations of a high semantic level that perform competitively on low-shot image classification. For instance,
on ImageNet-1K, with only 5,000 annotated images, our base MSN model achieves 72.4% top-1 accuracy,
and with 1% of ImageNet-1K labels, we achieve 75.7% top-1 accuracy, setting a new state-of-the-art for self-supervised learning on this benchmark.`),Ua.forEach(o),Ka.forEach(o),Et=f(e),ze=s(e,"P",{});var Ja=r(ze);co=i(Ja,"Tips:"),Ja.forEach(o),Ct=f(e),j=s(e,"UL",{});var Ye=r(j);ct=s(Ye,"LI",{});var Ga=r(ct);mo=i(Ga,`MSN (masked siamese networks) is a method for self-supervised pre-training of Vision Transformers (ViTs). The pre-training
objective is to match the prototypes assigned to the unmasked views of the images to that of the masked views of the same images.`),Ga.forEach(o),ho=f(Ye),x=s(Ye,"LI",{});var re=r(x);po=i(re,`The authors have only released pre-trained weights of the backbone (ImageNet-1k pre-training). So, to use that on your own image classification dataset,
use the `),Oe=s(re,"A",{href:!0});var Qa=r(Oe);fo=i(Qa,"ViTMSNForImageClassification"),Qa.forEach(o),uo=i(re," class which is initialized from "),Le=s(re,"A",{href:!0});var Xa=r(Le);go=i(Xa,"ViTMSNModel"),Xa.forEach(o),_o=i(re,`. Follow
`),he=s(re,"A",{href:!0,rel:!0});var Ya=r(he);vo=i(Ya,"this notebook"),Ya.forEach(o),bo=i(re," for a detailed tutorial on fine-tuning."),re.forEach(o),wo=f(Ye),dt=s(Ye,"LI",{});var Za=r(dt);To=i(Za,`MSN is particularly useful in the low-shot and extreme low-shot regimes. Notably, it achieves 75.7% top-1 accuracy with only 1% of ImageNet-1K
labels when fine-tuned.`),Za.forEach(o),Ye.forEach(o),xt=f(e),J=s(e,"IMG",{src:!0,alt:!0,width:!0}),Pt=f(e),pe=s(e,"SMALL",{});var Aa=r(pe);Mo=i(Aa,"MSN architecture. Taken from the "),De=s(Aa,"A",{href:!0});var es=r(De);$o=i(es,"original paper."),es.forEach(o),Aa.forEach(o),jt=f(e),A=s(e,"P",{});var Ze=r(A);yo=i(Ze,"This model was contributed by "),fe=s(Ze,"A",{href:!0,rel:!0});var ts=r(fe);No=i(ts,"sayakpaul"),ts.forEach(o),So=i(Ze,". The original code can be found "),ue=s(Ze,"A",{href:!0,rel:!0});var os=r(ue);ko=i(os,"here"),os.forEach(o),Vo=i(Ze,"."),Ze.forEach(o),At=f(e),z=s(e,"H2",{class:!0});var Jt=r(z);G=s(Jt,"A",{id:!0,class:!0,href:!0});var as=r(G);mt=s(as,"SPAN",{});var ss=r(mt);T(ge.$$.fragment,ss),ss.forEach(o),as.forEach(o),Io=f(Jt),ht=s(Jt,"SPAN",{});var rs=r(ht);Eo=i(rs,"Resources"),rs.forEach(o),Jt.forEach(o),Ft=f(e),Be=s(e,"P",{});var ns=r(Be);Co=i(ns,"A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with ViT MSN."),ns.forEach(o),qt=f(e),T(_e.$$.fragment,e),zt=f(e),Q=s(e,"UL",{});var Gt=r(Q);F=s(Gt,"LI",{});var Ae=r(F);We=s(Ae,"A",{href:!0});var is=r(We);xo=i(is,"ViTMSNForImageClassification"),is.forEach(o),Po=i(Ae," is supported by this "),ve=s(Ae,"A",{href:!0,rel:!0});var ls=r(ve);jo=i(ls,"example script"),ls.forEach(o),Ao=i(Ae," and "),be=s(Ae,"A",{href:!0,rel:!0});var cs=r(be);Fo=i(cs,"notebook"),cs.forEach(o),qo=i(Ae,"."),Ae.forEach(o),zo=f(Gt),He=s(Gt,"LI",{});var Fa=r(He);Oo=i(Fa,"See also: "),Re=s(Fa,"A",{href:!0});var ds=r(Re);Lo=i(ds,"Image classification task guide"),ds.forEach(o),Fa.forEach(o),Gt.forEach(o),Ot=f(e),Ke=s(e,"P",{});var ms=r(Ke);Do=i(ms,"If you\u2019re interested in submitting a resource to be included here, please feel free to open a Pull Request and we\u2019ll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource."),ms.forEach(o),Lt=f(e),O=s(e,"H2",{class:!0});var Qt=r(O);X=s(Qt,"A",{id:!0,class:!0,href:!0});var hs=r(X);pt=s(hs,"SPAN",{});var ps=r(pt);T(we.$$.fragment,ps),ps.forEach(o),hs.forEach(o),Bo=f(Qt),ft=s(Qt,"SPAN",{});var fs=r(ft);Wo=i(fs,"ViTMSNConfig"),fs.forEach(o),Qt.forEach(o),Dt=f(e),S=s(e,"DIV",{class:!0});var ne=r(S);T(Te.$$.fragment,ne),Ho=f(ne),L=s(ne,"P",{});var et=r(L);Ro=i(et,"This is the configuration class to store the configuration of a "),Ue=s(et,"A",{href:!0});var us=r(Ue);Ko=i(us,"ViTMSNModel"),us.forEach(o),Uo=i(et,`. It is used to instantiate an ViT
MSN 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
`),Me=s(et,"A",{href:!0,rel:!0});var gs=r(Me);Jo=i(gs,"facebook/vit_msn_base"),gs.forEach(o),Go=i(et," architecture."),et.forEach(o),Qo=f(ne),D=s(ne,"P",{});var tt=r(D);Xo=i(tt,"Configuration objects inherit from "),Je=s(tt,"A",{href:!0});var _s=r(Je);Yo=i(_s,"PretrainedConfig"),_s.forEach(o),Zo=i(tt,` and can be used to control the model outputs. Read the
documentation from `),Ge=s(tt,"A",{href:!0});var vs=r(Ge);ea=i(vs,"PretrainedConfig"),vs.forEach(o),ta=i(tt," for more information."),tt.forEach(o),oa=f(ne),T(Y.$$.fragment,ne),ne.forEach(o),Bt=f(e),B=s(e,"H2",{class:!0});var Xt=r(B);Z=s(Xt,"A",{id:!0,class:!0,href:!0});var bs=r(Z);ut=s(bs,"SPAN",{});var ws=r(ut);T($e.$$.fragment,ws),ws.forEach(o),bs.forEach(o),aa=f(Xt),gt=s(Xt,"SPAN",{});var Ts=r(gt);sa=i(Ts,"ViTMSNModel"),Ts.forEach(o),Xt.forEach(o),Wt=f(e),P=s(e,"DIV",{class:!0});var ot=r(P);T(ye.$$.fragment,ot),ra=f(ot),Ne=s(ot,"P",{});var Yt=r(Ne);na=i(Yt,`The bare ViTMSN Model outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),Se=s(Yt,"A",{href:!0,rel:!0});var Ms=r(Se);ia=i(Ms,"torch.nn.Module"),Ms.forEach(o),la=i(Yt,` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Yt.forEach(o),ca=f(ot),I=s(ot,"DIV",{class:!0});var ie=r(I);T(ke.$$.fragment,ie),da=f(ie),W=s(ie,"P",{});var at=r(W);ma=i(at,"The "),Qe=s(at,"A",{href:!0});var $s=r(Qe);ha=i($s,"ViTMSNModel"),$s.forEach(o),pa=i(at," forward method, overrides the "),_t=s(at,"CODE",{});var ys=r(_t);fa=i(ys,"__call__"),ys.forEach(o),ua=i(at," special method."),at.forEach(o),ga=f(ie),T(ee.$$.fragment,ie),_a=f(ie),T(te.$$.fragment,ie),ie.forEach(o),ot.forEach(o),Ht=f(e),H=s(e,"H2",{class:!0});var Zt=r(H);oe=s(Zt,"A",{id:!0,class:!0,href:!0});var Ns=r(oe);vt=s(Ns,"SPAN",{});var Ss=r(vt);T(Ve.$$.fragment,Ss),Ss.forEach(o),Ns.forEach(o),va=f(Zt),bt=s(Zt,"SPAN",{});var ks=r(bt);ba=i(ks,"ViTMSNForImageClassification"),ks.forEach(o),Zt.forEach(o),Rt=f(e),k=s(e,"DIV",{class:!0});var le=r(k);T(Ie.$$.fragment,le),wa=f(le),wt=s(le,"P",{});var Vs=r(wt);Ta=i(Vs,"ViTMSN Model with an image classification head on top e.g. for ImageNet."),Vs.forEach(o),Ma=f(le),Ee=s(le,"P",{});var eo=r(Ee);$a=i(eo,"This model is a PyTorch "),Ce=s(eo,"A",{href:!0,rel:!0});var Is=r(Ce);ya=i(Is,"torch.nn.Module"),Is.forEach(o),Na=i(eo,` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),eo.forEach(o),Sa=f(le),E=s(le,"DIV",{class:!0});var ce=r(E);T(xe.$$.fragment,ce),ka=f(ce),R=s(ce,"P",{});var st=r(R);Va=i(st,"The "),Xe=s(st,"A",{href:!0});var Es=r(Xe);Ia=i(Es,"ViTMSNForImageClassification"),Es.forEach(o),Ea=i(st," forward method, overrides the "),Tt=s(st,"CODE",{});var Cs=r(Tt);Ca=i(Cs,"__call__"),Cs.forEach(o),xa=i(st," special method."),st.forEach(o),Pa=f(ce),T(ae.$$.fragment,ce),ja=f(ce),T(se.$$.fragment,ce),ce.forEach(o),le.forEach(o),this.h()},h(){c(h,"name","hf:doc:metadata"),c(h,"content",JSON.stringify(Ks)),c(u,"id","vitmsn"),c(u,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(u,"href","#vitmsn"),c(_,"class","relative group"),c(K,"id","overview"),c(K,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(K,"href","#overview"),c(q,"class","relative group"),c(me,"href","https://arxiv.org/abs/2204.07141"),c(me,"rel","nofollow"),c(Oe,"href","/docs/transformers/v4.29.0/en/model_doc/vit_msn#transformers.ViTMSNForImageClassification"),c(Le,"href","/docs/transformers/v4.29.0/en/model_doc/vit_msn#transformers.ViTMSNModel"),c(he,"href","https://github.com/huggingface/notebooks/blob/main/examples/image_classification.ipynb"),c(he,"rel","nofollow"),qs(J.src,La="https://i.ibb.co/W6PQMdC/Screenshot-2022-09-13-at-9-08-40-AM.png")||c(J,"src",La),c(J,"alt","drawing"),c(J,"width","600"),c(De,"href","https://arxiv.org/abs/2204.07141"),c(fe,"href","https://huggingface.co/sayakpaul"),c(fe,"rel","nofollow"),c(ue,"href","https://github.com/facebookresearch/msn"),c(ue,"rel","nofollow"),c(G,"id","resources"),c(G,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(G,"href","#resources"),c(z,"class","relative group"),c(We,"href","/docs/transformers/v4.29.0/en/model_doc/vit_msn#transformers.ViTMSNForImageClassification"),c(ve,"href","https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-classification"),c(ve,"rel","nofollow"),c(be,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/image_classification.ipynb"),c(be,"rel","nofollow"),c(Re,"href","../tasks/image_classification"),c(X,"id","transformers.ViTMSNConfig"),c(X,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(X,"href","#transformers.ViTMSNConfig"),c(O,"class","relative group"),c(Ue,"href","/docs/transformers/v4.29.0/en/model_doc/vit_msn#transformers.ViTMSNModel"),c(Me,"href","https://huggingface.co/facebook/vit_msn_base"),c(Me,"rel","nofollow"),c(Je,"href","/docs/transformers/v4.29.0/en/main_classes/configuration#transformers.PretrainedConfig"),c(Ge,"href","/docs/transformers/v4.29.0/en/main_classes/configuration#transformers.PretrainedConfig"),c(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Z,"id","transformers.ViTMSNModel"),c(Z,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(Z,"href","#transformers.ViTMSNModel"),c(B,"class","relative group"),c(Se,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(Se,"rel","nofollow"),c(Qe,"href","/docs/transformers/v4.29.0/en/model_doc/vit_msn#transformers.ViTMSNModel"),c(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(oe,"id","transformers.ViTMSNForImageClassification"),c(oe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(oe,"href","#transformers.ViTMSNForImageClassification"),c(H,"class","relative group"),c(Ce,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(Ce,"rel","nofollow"),c(Xe,"href","/docs/transformers/v4.29.0/en/model_doc/vit_msn#transformers.ViTMSNForImageClassification"),c(E,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(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(e,d){t(document.head,h),m(e,b,d),m(e,_,d),t(_,u),t(u,v),M(l,v,null),t(_,g),t(_,C),t(C,to),m(e,St,d),m(e,q,d),t(q,K),t(K,nt),M(de,nt,null),t(q,oo),t(q,it),t(it,ao),m(e,kt,d),m(e,U,d),t(U,so),t(U,me),t(me,ro),t(U,no),m(e,Vt,d),m(e,Fe,d),t(Fe,io),m(e,It,d),m(e,qe,d),t(qe,lt),t(lt,lo),m(e,Et,d),m(e,ze,d),t(ze,co),m(e,Ct,d),m(e,j,d),t(j,ct),t(ct,mo),t(j,ho),t(j,x),t(x,po),t(x,Oe),t(Oe,fo),t(x,uo),t(x,Le),t(Le,go),t(x,_o),t(x,he),t(he,vo),t(x,bo),t(j,wo),t(j,dt),t(dt,To),m(e,xt,d),m(e,J,d),m(e,Pt,d),m(e,pe,d),t(pe,Mo),t(pe,De),t(De,$o),m(e,jt,d),m(e,A,d),t(A,yo),t(A,fe),t(fe,No),t(A,So),t(A,ue),t(ue,ko),t(A,Vo),m(e,At,d),m(e,z,d),t(z,G),t(G,mt),M(ge,mt,null),t(z,Io),t(z,ht),t(ht,Eo),m(e,Ft,d),m(e,Be,d),t(Be,Co),m(e,qt,d),M(_e,e,d),m(e,zt,d),m(e,Q,d),t(Q,F),t(F,We),t(We,xo),t(F,Po),t(F,ve),t(ve,jo),t(F,Ao),t(F,be),t(be,Fo),t(F,qo),t(Q,zo),t(Q,He),t(He,Oo),t(He,Re),t(Re,Lo),m(e,Ot,d),m(e,Ke,d),t(Ke,Do),m(e,Lt,d),m(e,O,d),t(O,X),t(X,pt),M(we,pt,null),t(O,Bo),t(O,ft),t(ft,Wo),m(e,Dt,d),m(e,S,d),M(Te,S,null),t(S,Ho),t(S,L),t(L,Ro),t(L,Ue),t(Ue,Ko),t(L,Uo),t(L,Me),t(Me,Jo),t(L,Go),t(S,Qo),t(S,D),t(D,Xo),t(D,Je),t(Je,Yo),t(D,Zo),t(D,Ge),t(Ge,ea),t(D,ta),t(S,oa),M(Y,S,null),m(e,Bt,d),m(e,B,d),t(B,Z),t(Z,ut),M($e,ut,null),t(B,aa),t(B,gt),t(gt,sa),m(e,Wt,d),m(e,P,d),M(ye,P,null),t(P,ra),t(P,Ne),t(Ne,na),t(Ne,Se),t(Se,ia),t(Ne,la),t(P,ca),t(P,I),M(ke,I,null),t(I,da),t(I,W),t(W,ma),t(W,Qe),t(Qe,ha),t(W,pa),t(W,_t),t(_t,fa),t(W,ua),t(I,ga),M(ee,I,null),t(I,_a),M(te,I,null),m(e,Ht,d),m(e,H,d),t(H,oe),t(oe,vt),M(Ve,vt,null),t(H,va),t(H,bt),t(bt,ba),m(e,Rt,d),m(e,k,d),M(Ie,k,null),t(k,wa),t(k,wt),t(wt,Ta),t(k,Ma),t(k,Ee),t(Ee,$a),t(Ee,Ce),t(Ce,ya),t(Ee,Na),t(k,Sa),t(k,E),M(xe,E,null),t(E,ka),t(E,R),t(R,Va),t(R,Xe),t(Xe,Ia),t(R,Ea),t(R,Tt),t(Tt,Ca),t(R,xa),t(E,Pa),M(ae,E,null),t(E,ja),M(se,E,null),Kt=!0},p(e,[d]){const Pe={};d&2&&(Pe.$$scope={dirty:d,ctx:e}),Y.$set(Pe);const Mt={};d&2&&(Mt.$$scope={dirty:d,ctx:e}),ee.$set(Mt);const $t={};d&2&&($t.$$scope={dirty:d,ctx:e}),te.$set($t);const yt={};d&2&&(yt.$$scope={dirty:d,ctx:e}),ae.$set(yt);const je={};d&2&&(je.$$scope={dirty:d,ctx:e}),se.$set(je)},i(e){Kt||($(l.$$.fragment,e),$(de.$$.fragment,e),$(ge.$$.fragment,e),$(_e.$$.fragment,e),$(we.$$.fragment,e),$(Te.$$.fragment,e),$(Y.$$.fragment,e),$($e.$$.fragment,e),$(ye.$$.fragment,e),$(ke.$$.fragment,e),$(ee.$$.fragment,e),$(te.$$.fragment,e),$(Ve.$$.fragment,e),$(Ie.$$.fragment,e),$(xe.$$.fragment,e),$(ae.$$.fragment,e),$(se.$$.fragment,e),Kt=!0)},o(e){y(l.$$.fragment,e),y(de.$$.fragment,e),y(ge.$$.fragment,e),y(_e.$$.fragment,e),y(we.$$.fragment,e),y(Te.$$.fragment,e),y(Y.$$.fragment,e),y($e.$$.fragment,e),y(ye.$$.fragment,e),y(ke.$$.fragment,e),y(ee.$$.fragment,e),y(te.$$.fragment,e),y(Ve.$$.fragment,e),y(Ie.$$.fragment,e),y(xe.$$.fragment,e),y(ae.$$.fragment,e),y(se.$$.fragment,e),Kt=!1},d(e){o(h),e&&o(b),e&&o(_),N(l),e&&o(St),e&&o(q),N(de),e&&o(kt),e&&o(U),e&&o(Vt),e&&o(Fe),e&&o(It),e&&o(qe),e&&o(Et),e&&o(ze),e&&o(Ct),e&&o(j),e&&o(xt),e&&o(J),e&&o(Pt),e&&o(pe),e&&o(jt),e&&o(A),e&&o(At),e&&o(z),N(ge),e&&o(Ft),e&&o(Be),e&&o(qt),N(_e,e),e&&o(zt),e&&o(Q),e&&o(Ot),e&&o(Ke),e&&o(Lt),e&&o(O),N(we),e&&o(Dt),e&&o(S),N(Te),N(Y),e&&o(Bt),e&&o(B),N($e),e&&o(Wt),e&&o(P),N(ye),N(ke),N(ee),N(te),e&&o(Ht),e&&o(H),N(Ve),e&&o(Rt),e&&o(k),N(Ie),N(xe),N(ae),N(se)}}}const Ks={local:"vitmsn",sections:[{local:"overview",title:"Overview"},{local:"resources",title:"Resources"},{local:"transformers.ViTMSNConfig",title:"ViTMSNConfig"},{local:"transformers.ViTMSNModel",title:"ViTMSNModel"},{local:"transformers.ViTMSNForImageClassification",title:"ViTMSNForImageClassification"}],title:"ViTMSN"};function Us(V){return zs(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class tr extends Ps{constructor(h){super();js(this,h,Us,Rs,As,{})}}export{tr as default,Ks as metadata};
