import{S as Js,i as Fs,s as xs,e as a,k as p,w as b,t as r,M as Ws,c as s,d as o,m as f,a as n,x as w,h as i,b as c,N as Us,G as t,g as m,y as T,q as y,o as N,B as $,v as Zs,L as Za}from"../../chunks/vendor-hf-doc-builder.js";import{T as js}from"../../chunks/Tip-hf-doc-builder.js";import{D as $t}from"../../chunks/Docstring-hf-doc-builder.js";import{C as za}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as nt}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Ua}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";import{P as zs}from"../../chunks/PipelineTag-hf-doc-builder.js";function Bs(k){let h,M,_,u,v;return u=new za({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFZpVE1TTk1vZGVsJTJDJTIwVmlUTVNOQ29uZmlnJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMFZpVCUyME1TTiUyMHZpdC1tc24tYmFzZSUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBWaVRDb25maWcoKSUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBtb2RlbCUyMGZyb20lMjB0aGUlMjB2aXQtbXNuLWJhc2UlMjBzdHlsZSUyMGNvbmZpZ3VyYXRpb24lMEFtb2RlbCUyMCUzRCUyMFZpVE1TTk1vZGVsKGNvbmZpZ3VyYXRpb24pJTBBJTBBJTIzJTIwQWNjZXNzaW5nJTIwdGhlJTIwbW9kZWwlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyMG1vZGVsLmNvbmZpZw==",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"),M=r("Example:"),_=p(),b(u.$$.fragment)},l(l){h=s(l,"P",{});var g=n(h);M=i(g,"Example:"),g.forEach(o),_=f(l),w(u.$$.fragment,l)},m(l,g){m(l,h,g),t(h,M),m(l,_,g),T(u,l,g),v=!0},p:Za,i(l){v||(y(u.$$.fragment,l),v=!0)},o(l){N(u.$$.fragment,l),v=!1},d(l){l&&o(h),l&&o(_),$(u,l)}}}function Ps(k){let h,M,_,u,v;return{c(){h=a("p"),M=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=a("code"),u=r("Module"),v=r(`
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=n(h);M=i(g,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=s(g,"CODE",{});var I=n(_);u=i(I,"Module"),I.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,M),t(h,_),t(_,u),t(h,v)},d(l){l&&o(h)}}}function As(k){let h,M,_,u,v;return u=new za({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyMFZpVE1TTk1vZGVsJTBBaW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEFpbXBvcnQlMjByZXF1ZXN0cyUwQSUwQXVybCUyMCUzRCUyMCUyMmh0dHAlM0ElMkYlMkZpbWFnZXMuY29jb2RhdGFzZXQub3JnJTJGdmFsMjAxNyUyRjAwMDAwMDAzOTc2OS5qcGclMjIlMEFpbWFnZSUyMCUzRCUyMEltYWdlLm9wZW4ocmVxdWVzdHMuZ2V0KHVybCUyQyUyMHN0cmVhbSUzRFRydWUpLnJhdyklMEElMEFpbWFnZV9wcm9jZXNzb3IlMjAlM0QlMjBBdXRvSW1hZ2VQcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMmZhY2Vib29rJTJGdml0LW1zbi1zbWFsbCUyMiklMEFtb2RlbCUyMCUzRCUyMFZpVE1TTk1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJmYWNlYm9vayUyRnZpdC1tc24tc21hbGwlMjIpJTBBaW5wdXRzJTIwJTNEJTIwaW1hZ2VfcHJvY2Vzc29yKGltYWdlcyUzRGltYWdlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEF3aXRoJTIwdG9yY2gubm9fZ3JhZCgpJTNBJTBBJTIwJTIwJTIwJTIwb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKSUwQWxhc3RfaGlkZGVuX3N0YXRlcyUyMCUzRCUyMG91dHB1dHMubGFzdF9oaWRkZW5fc3RhdGU=",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"),M=r("Examples:"),_=p(),b(u.$$.fragment)},l(l){h=s(l,"P",{});var g=n(h);M=i(g,"Examples:"),g.forEach(o),_=f(l),w(u.$$.fragment,l)},m(l,g){m(l,h,g),t(h,M),m(l,_,g),T(u,l,g),v=!0},p:Za,i(l){v||(y(u.$$.fragment,l),v=!0)},o(l){N(u.$$.fragment,l),v=!1},d(l){l&&o(h),l&&o(_),$(u,l)}}}function Gs(k){let h,M,_,u,v;return{c(){h=a("p"),M=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=a("code"),u=r("Module"),v=r(`
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=n(h);M=i(g,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=s(g,"CODE",{});var I=n(_);u=i(I,"Module"),I.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,M),t(h,_),t(_,u),t(h,v)},d(l){l&&o(h)}}}function Rs(k){let h,M,_,u,v;return u=new za({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyMFZpVE1TTkZvckltYWdlQ2xhc3NpZmljYXRpb24lMEFpbXBvcnQlMjB0b3JjaCUwQWZyb20lMjBQSUwlMjBpbXBvcnQlMjBJbWFnZSUwQWltcG9ydCUyMHJlcXVlc3RzJTBBJTBBdG9yY2gubWFudWFsX3NlZWQoMiklMEF1cmwlMjAlM0QlMjAlMjJodHRwJTNBJTJGJTJGaW1hZ2VzLmNvY29kYXRhc2V0Lm9yZyUyRnZhbDIwMTclMkYwMDAwMDAwMzk3NjkuanBnJTIyJTBBaW1hZ2UlMjAlM0QlMjBJbWFnZS5vcGVuKHJlcXVlc3RzLmdldCh1cmwlMkMlMjBzdHJlYW0lM0RUcnVlKS5yYXcpJTBBJTBBaW1hZ2VfcHJvY2Vzc29yJTIwJTNEJTIwQXV0b0ltYWdlUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJmYWNlYm9vayUyRnZpdC1tc24tc21hbGwlMjIpJTBBbW9kZWwlMjAlM0QlMjBWaVRNU05Gb3JJbWFnZUNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMjJmYWNlYm9vayUyRnZpdC1tc24tc21hbGwlMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwaW1hZ2VfcHJvY2Vzc29yKGltYWdlcyUzRGltYWdlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEF3aXRoJTIwdG9yY2gubm9fZ3JhZCgpJTNBJTBBJTIwJTIwJTIwJTIwbG9naXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpLmxvZ2l0cyUwQSUyMyUyMG1vZGVsJTIwcHJlZGljdHMlMjBvbmUlMjBvZiUyMHRoZSUyMDEwMDAlMjBJbWFnZU5ldCUyMGNsYXNzZXMlMEFwcmVkaWN0ZWRfbGFiZWwlMjAlM0QlMjBsb2dpdHMuYXJnbWF4KC0xKS5pdGVtKCklMEFwcmludChtb2RlbC5jb25maWcuaWQybGFiZWwlNUJwcmVkaWN0ZWRfbGFiZWwlNUQp",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"),M=r("Examples:"),_=p(),b(u.$$.fragment)},l(l){h=s(l,"P",{});var g=n(h);M=i(g,"Examples:"),g.forEach(o),_=f(l),w(u.$$.fragment,l)},m(l,g){m(l,h,g),t(h,M),m(l,_,g),T(u,l,g),v=!0},p:Za,i(l){v||(y(u.$$.fragment,l),v=!0)},o(l){N(u.$$.fragment,l),v=!1},d(l){l&&o(h),l&&o(_),$(u,l)}}}function qs(k){let h,M,_,u,v,l,g,I,to,Vt,U,Y,rt,de,oo,it,ao,St,X,so,me,no,ro,kt,We,io,Ct,Ue,lt,lo,Et,Ze,co,It,F,ct,mo,ho,j,po,ze,fo,uo,Be,go,_o,he,vo,Mo,bo,dt,wo,jt,H,Ba,Jt,pe,To,Pe,yo,Ft,x,No,fe,$o,Vo,ue,So,ko,xt,Z,O,mt,ge,Co,ht,Eo,Wt,Ae,Io,Ut,_e,Zt,L,W,Ge,jo,Jo,ve,Fo,xo,Me,Wo,Uo,Zo,Re,zo,qe,Bo,zt,Ye,Po,Bt,z,Q,pt,be,Ao,ft,Go,Pt,V,we,Ro,B,qo,Xe,Yo,Xo,Te,Ho,Oo,Lo,P,Qo,He,Do,Ko,Oe,ea,ta,oa,D,At,A,K,ut,ye,aa,gt,sa,Gt,J,Ne,na,$e,ra,Ve,ia,la,ca,C,Se,da,G,ma,Le,ha,pa,_t,fa,ua,ga,ee,_a,te,Rt,R,oe,vt,ke,va,Mt,Ma,qt,S,Ce,ba,bt,wa,Ta,Ee,ya,Ie,Na,$a,Va,E,je,Sa,q,ka,Qe,Ca,Ea,wt,Ia,ja,Ja,ae,Fa,se,Yt;return l=new nt({}),de=new nt({}),ge=new nt({}),_e=new zs({props:{pipeline:"image-classification"}}),be=new nt({}),we=new $t({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.31.0/src/transformers/models/vit_msn/configuration_vit_msn.py#L30"}}),D=new Ua({props:{anchor:"transformers.ViTMSNConfig.example",$$slots:{default:[Bs]},$$scope:{ctx:k}}}),ye=new nt({}),Ne=new $t({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.31.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.31.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.31.0/src/transformers/models/vit_msn/modeling_vit_msn.py#L492"}}),Se=new $t({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.31.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.31.0/en/model_doc/perceiver#transformers.PerceiverFeatureExtractor.__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.31.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.31.0/src/transformers/models/vit_msn/modeling_vit_msn.py#L516",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.31.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.31.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.31.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutput"
>transformers.modeling_outputs.BaseModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ee=new js({props:{$$slots:{default:[Ps]},$$scope:{ctx:k}}}),te=new Ua({props:{anchor:"transformers.ViTMSNModel.forward.example",$$slots:{default:[As]},$$scope:{ctx:k}}}),ke=new nt({}),Ce=new $t({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.31.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.31.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.31.0/src/transformers/models/vit_msn/modeling_vit_msn.py#L601"}}),je=new $t({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.31.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.31.0/en/model_doc/perceiver#transformers.PerceiverFeatureExtractor.__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.31.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.31.0/src/transformers/models/vit_msn/modeling_vit_msn.py#L614",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.31.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.31.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.31.0/en/main_classes/output#transformers.modeling_outputs.ImageClassifierOutput"
>transformers.modeling_outputs.ImageClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ae=new js({props:{$$slots:{default:[Gs]},$$scope:{ctx:k}}}),se=new Ua({props:{anchor:"transformers.ViTMSNForImageClassification.forward.example",$$slots:{default:[Rs]},$$scope:{ctx:k}}}),{c(){h=a("meta"),M=p(),_=a("h1"),u=a("a"),v=a("span"),b(l.$$.fragment),g=p(),I=a("span"),to=r("ViTMSN"),Vt=p(),U=a("h2"),Y=a("a"),rt=a("span"),b(de.$$.fragment),oo=p(),it=a("span"),ao=r("Overview"),St=p(),X=a("p"),so=r("The ViTMSN model was proposed in "),me=a("a"),no=r("Masked Siamese Networks for Label-Efficient Learning"),ro=r(` 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.`),kt=p(),We=a("p"),io=r("The abstract from the paper is the following:"),Ct=p(),Ue=a("p"),lt=a("em"),lo=r(`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=r("Tips:"),It=p(),F=a("ul"),ct=a("li"),mo=r(`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(),j=a("li"),po=r(`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 `),ze=a("a"),fo=r("ViTMSNForImageClassification"),uo=r(" class which is initialized from "),Be=a("a"),go=r("ViTMSNModel"),_o=r(`. Follow
`),he=a("a"),vo=r("this notebook"),Mo=r(" for a detailed tutorial on fine-tuning."),bo=p(),dt=a("li"),wo=r(`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.`),jt=p(),H=a("img"),Jt=p(),pe=a("small"),To=r("MSN architecture. Taken from the "),Pe=a("a"),yo=r("original paper."),Ft=p(),x=a("p"),No=r("This model was contributed by "),fe=a("a"),$o=r("sayakpaul"),Vo=r(". The original code can be found "),ue=a("a"),So=r("here"),ko=r("."),xt=p(),Z=a("h2"),O=a("a"),mt=a("span"),b(ge.$$.fragment),Co=p(),ht=a("span"),Eo=r("Resources"),Wt=p(),Ae=a("p"),Io=r("A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with ViT MSN."),Ut=p(),b(_e.$$.fragment),Zt=p(),L=a("ul"),W=a("li"),Ge=a("a"),jo=r("ViTMSNForImageClassification"),Jo=r(" is supported by this "),ve=a("a"),Fo=r("example script"),xo=r(" and "),Me=a("a"),Wo=r("notebook"),Uo=r("."),Zo=p(),Re=a("li"),zo=r("See also: "),qe=a("a"),Bo=r("Image classification task guide"),zt=p(),Ye=a("p"),Po=r("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."),Bt=p(),z=a("h2"),Q=a("a"),pt=a("span"),b(be.$$.fragment),Ao=p(),ft=a("span"),Go=r("ViTMSNConfig"),Pt=p(),V=a("div"),b(we.$$.fragment),Ro=p(),B=a("p"),qo=r("This is the configuration class to store the configuration of a "),Xe=a("a"),Yo=r("ViTMSNModel"),Xo=r(`. 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
`),Te=a("a"),Ho=r("facebook/vit_msn_base"),Oo=r(" architecture."),Lo=p(),P=a("p"),Qo=r("Configuration objects inherit from "),He=a("a"),Do=r("PretrainedConfig"),Ko=r(` and can be used to control the model outputs. Read the
documentation from `),Oe=a("a"),ea=r("PretrainedConfig"),ta=r(" for more information."),oa=p(),b(D.$$.fragment),At=p(),A=a("h2"),K=a("a"),ut=a("span"),b(ye.$$.fragment),aa=p(),gt=a("span"),sa=r("ViTMSNModel"),Gt=p(),J=a("div"),b(Ne.$$.fragment),na=p(),$e=a("p"),ra=r(`The bare ViTMSN Model outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),Ve=a("a"),ia=r("torch.nn.Module"),la=r(` 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(),C=a("div"),b(Se.$$.fragment),da=p(),G=a("p"),ma=r("The "),Le=a("a"),ha=r("ViTMSNModel"),pa=r(" forward method, overrides the "),_t=a("code"),fa=r("__call__"),ua=r(" special method."),ga=p(),b(ee.$$.fragment),_a=p(),b(te.$$.fragment),Rt=p(),R=a("h2"),oe=a("a"),vt=a("span"),b(ke.$$.fragment),va=p(),Mt=a("span"),Ma=r("ViTMSNForImageClassification"),qt=p(),S=a("div"),b(Ce.$$.fragment),ba=p(),bt=a("p"),wa=r("ViTMSN Model with an image classification head on top e.g. for ImageNet."),Ta=p(),Ee=a("p"),ya=r("This model is a PyTorch "),Ie=a("a"),Na=r("torch.nn.Module"),$a=r(` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Va=p(),E=a("div"),b(je.$$.fragment),Sa=p(),q=a("p"),ka=r("The "),Qe=a("a"),Ca=r("ViTMSNForImageClassification"),Ea=r(" forward method, overrides the "),wt=a("code"),Ia=r("__call__"),ja=r(" special method."),Ja=p(),b(ae.$$.fragment),Fa=p(),b(se.$$.fragment),this.h()},l(e){const d=Ws('[data-svelte="svelte-1phssyn"]',document.head);h=s(d,"META",{name:!0,content:!0}),d.forEach(o),M=f(e),_=s(e,"H1",{class:!0});var Je=n(_);u=s(Je,"A",{id:!0,class:!0,href:!0});var Tt=n(u);v=s(Tt,"SPAN",{});var yt=n(v);w(l.$$.fragment,yt),yt.forEach(o),Tt.forEach(o),g=f(Je),I=s(Je,"SPAN",{});var Nt=n(I);to=i(Nt,"ViTMSN"),Nt.forEach(o),Je.forEach(o),Vt=f(e),U=s(e,"H2",{class:!0});var Fe=n(U);Y=s(Fe,"A",{id:!0,class:!0,href:!0});var Pa=n(Y);rt=s(Pa,"SPAN",{});var Aa=n(rt);w(de.$$.fragment,Aa),Aa.forEach(o),Pa.forEach(o),oo=f(Fe),it=s(Fe,"SPAN",{});var Ga=n(it);ao=i(Ga,"Overview"),Ga.forEach(o),Fe.forEach(o),St=f(e),X=s(e,"P",{});var Xt=n(X);so=i(Xt,"The ViTMSN model was proposed in "),me=s(Xt,"A",{href:!0,rel:!0});var Ra=n(me);no=i(Ra,"Masked Siamese Networks for Label-Efficient Learning"),Ra.forEach(o),ro=i(Xt,` 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.`),Xt.forEach(o),kt=f(e),We=s(e,"P",{});var qa=n(We);io=i(qa,"The abstract from the paper is the following:"),qa.forEach(o),Ct=f(e),Ue=s(e,"P",{});var Ya=n(Ue);lt=s(Ya,"EM",{});var Xa=n(lt);lo=i(Xa,`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.`),Xa.forEach(o),Ya.forEach(o),Et=f(e),Ze=s(e,"P",{});var Ha=n(Ze);co=i(Ha,"Tips:"),Ha.forEach(o),It=f(e),F=s(e,"UL",{});var De=n(F);ct=s(De,"LI",{});var Oa=n(ct);mo=i(Oa,`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.`),Oa.forEach(o),ho=f(De),j=s(De,"LI",{});var ne=n(j);po=i(ne,`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 `),ze=s(ne,"A",{href:!0});var La=n(ze);fo=i(La,"ViTMSNForImageClassification"),La.forEach(o),uo=i(ne," class which is initialized from "),Be=s(ne,"A",{href:!0});var Qa=n(Be);go=i(Qa,"ViTMSNModel"),Qa.forEach(o),_o=i(ne,`. Follow
`),he=s(ne,"A",{href:!0,rel:!0});var Da=n(he);vo=i(Da,"this notebook"),Da.forEach(o),Mo=i(ne," for a detailed tutorial on fine-tuning."),ne.forEach(o),bo=f(De),dt=s(De,"LI",{});var Ka=n(dt);wo=i(Ka,`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.`),Ka.forEach(o),De.forEach(o),jt=f(e),H=s(e,"IMG",{src:!0,alt:!0,width:!0}),Jt=f(e),pe=s(e,"SMALL",{});var xa=n(pe);To=i(xa,"MSN architecture. Taken from the "),Pe=s(xa,"A",{href:!0});var es=n(Pe);yo=i(es,"original paper."),es.forEach(o),xa.forEach(o),Ft=f(e),x=s(e,"P",{});var Ke=n(x);No=i(Ke,"This model was contributed by "),fe=s(Ke,"A",{href:!0,rel:!0});var ts=n(fe);$o=i(ts,"sayakpaul"),ts.forEach(o),Vo=i(Ke,". The original code can be found "),ue=s(Ke,"A",{href:!0,rel:!0});var os=n(ue);So=i(os,"here"),os.forEach(o),ko=i(Ke,"."),Ke.forEach(o),xt=f(e),Z=s(e,"H2",{class:!0});var Ht=n(Z);O=s(Ht,"A",{id:!0,class:!0,href:!0});var as=n(O);mt=s(as,"SPAN",{});var ss=n(mt);w(ge.$$.fragment,ss),ss.forEach(o),as.forEach(o),Co=f(Ht),ht=s(Ht,"SPAN",{});var ns=n(ht);Eo=i(ns,"Resources"),ns.forEach(o),Ht.forEach(o),Wt=f(e),Ae=s(e,"P",{});var rs=n(Ae);Io=i(rs,"A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with ViT MSN."),rs.forEach(o),Ut=f(e),w(_e.$$.fragment,e),Zt=f(e),L=s(e,"UL",{});var Ot=n(L);W=s(Ot,"LI",{});var xe=n(W);Ge=s(xe,"A",{href:!0});var is=n(Ge);jo=i(is,"ViTMSNForImageClassification"),is.forEach(o),Jo=i(xe," is supported by this "),ve=s(xe,"A",{href:!0,rel:!0});var ls=n(ve);Fo=i(ls,"example script"),ls.forEach(o),xo=i(xe," and "),Me=s(xe,"A",{href:!0,rel:!0});var cs=n(Me);Wo=i(cs,"notebook"),cs.forEach(o),Uo=i(xe,"."),xe.forEach(o),Zo=f(Ot),Re=s(Ot,"LI",{});var Wa=n(Re);zo=i(Wa,"See also: "),qe=s(Wa,"A",{href:!0});var ds=n(qe);Bo=i(ds,"Image classification task guide"),ds.forEach(o),Wa.forEach(o),Ot.forEach(o),zt=f(e),Ye=s(e,"P",{});var ms=n(Ye);Po=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),Bt=f(e),z=s(e,"H2",{class:!0});var Lt=n(z);Q=s(Lt,"A",{id:!0,class:!0,href:!0});var hs=n(Q);pt=s(hs,"SPAN",{});var ps=n(pt);w(be.$$.fragment,ps),ps.forEach(o),hs.forEach(o),Ao=f(Lt),ft=s(Lt,"SPAN",{});var fs=n(ft);Go=i(fs,"ViTMSNConfig"),fs.forEach(o),Lt.forEach(o),Pt=f(e),V=s(e,"DIV",{class:!0});var re=n(V);w(we.$$.fragment,re),Ro=f(re),B=s(re,"P",{});var et=n(B);qo=i(et,"This is the configuration class to store the configuration of a "),Xe=s(et,"A",{href:!0});var us=n(Xe);Yo=i(us,"ViTMSNModel"),us.forEach(o),Xo=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
`),Te=s(et,"A",{href:!0,rel:!0});var gs=n(Te);Ho=i(gs,"facebook/vit_msn_base"),gs.forEach(o),Oo=i(et," architecture."),et.forEach(o),Lo=f(re),P=s(re,"P",{});var tt=n(P);Qo=i(tt,"Configuration objects inherit from "),He=s(tt,"A",{href:!0});var _s=n(He);Do=i(_s,"PretrainedConfig"),_s.forEach(o),Ko=i(tt,` and can be used to control the model outputs. Read the
documentation from `),Oe=s(tt,"A",{href:!0});var vs=n(Oe);ea=i(vs,"PretrainedConfig"),vs.forEach(o),ta=i(tt," for more information."),tt.forEach(o),oa=f(re),w(D.$$.fragment,re),re.forEach(o),At=f(e),A=s(e,"H2",{class:!0});var Qt=n(A);K=s(Qt,"A",{id:!0,class:!0,href:!0});var Ms=n(K);ut=s(Ms,"SPAN",{});var bs=n(ut);w(ye.$$.fragment,bs),bs.forEach(o),Ms.forEach(o),aa=f(Qt),gt=s(Qt,"SPAN",{});var ws=n(gt);sa=i(ws,"ViTMSNModel"),ws.forEach(o),Qt.forEach(o),Gt=f(e),J=s(e,"DIV",{class:!0});var ot=n(J);w(Ne.$$.fragment,ot),na=f(ot),$e=s(ot,"P",{});var Dt=n($e);ra=i(Dt,`The bare ViTMSN Model outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),Ve=s(Dt,"A",{href:!0,rel:!0});var Ts=n(Ve);ia=i(Ts,"torch.nn.Module"),Ts.forEach(o),la=i(Dt,` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Dt.forEach(o),ca=f(ot),C=s(ot,"DIV",{class:!0});var ie=n(C);w(Se.$$.fragment,ie),da=f(ie),G=s(ie,"P",{});var at=n(G);ma=i(at,"The "),Le=s(at,"A",{href:!0});var ys=n(Le);ha=i(ys,"ViTMSNModel"),ys.forEach(o),pa=i(at," forward method, overrides the "),_t=s(at,"CODE",{});var Ns=n(_t);fa=i(Ns,"__call__"),Ns.forEach(o),ua=i(at," special method."),at.forEach(o),ga=f(ie),w(ee.$$.fragment,ie),_a=f(ie),w(te.$$.fragment,ie),ie.forEach(o),ot.forEach(o),Rt=f(e),R=s(e,"H2",{class:!0});var Kt=n(R);oe=s(Kt,"A",{id:!0,class:!0,href:!0});var $s=n(oe);vt=s($s,"SPAN",{});var Vs=n(vt);w(ke.$$.fragment,Vs),Vs.forEach(o),$s.forEach(o),va=f(Kt),Mt=s(Kt,"SPAN",{});var Ss=n(Mt);Ma=i(Ss,"ViTMSNForImageClassification"),Ss.forEach(o),Kt.forEach(o),qt=f(e),S=s(e,"DIV",{class:!0});var le=n(S);w(Ce.$$.fragment,le),ba=f(le),bt=s(le,"P",{});var ks=n(bt);wa=i(ks,"ViTMSN Model with an image classification head on top e.g. for ImageNet."),ks.forEach(o),Ta=f(le),Ee=s(le,"P",{});var eo=n(Ee);ya=i(eo,"This model is a PyTorch "),Ie=s(eo,"A",{href:!0,rel:!0});var Cs=n(Ie);Na=i(Cs,"torch.nn.Module"),Cs.forEach(o),$a=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),Va=f(le),E=s(le,"DIV",{class:!0});var ce=n(E);w(je.$$.fragment,ce),Sa=f(ce),q=s(ce,"P",{});var st=n(q);ka=i(st,"The "),Qe=s(st,"A",{href:!0});var Es=n(Qe);Ca=i(Es,"ViTMSNForImageClassification"),Es.forEach(o),Ea=i(st," forward method, overrides the "),wt=s(st,"CODE",{});var Is=n(wt);Ia=i(Is,"__call__"),Is.forEach(o),ja=i(st," special method."),st.forEach(o),Ja=f(ce),w(ae.$$.fragment,ce),Fa=f(ce),w(se.$$.fragment,ce),ce.forEach(o),le.forEach(o),this.h()},h(){c(h,"name","hf:doc:metadata"),c(h,"content",JSON.stringify(Ys)),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(Y,"id","overview"),c(Y,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(Y,"href","#overview"),c(U,"class","relative group"),c(me,"href","https://arxiv.org/abs/2204.07141"),c(me,"rel","nofollow"),c(ze,"href","/docs/transformers/v4.31.0/en/model_doc/vit_msn#transformers.ViTMSNForImageClassification"),c(Be,"href","/docs/transformers/v4.31.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"),Us(H.src,Ba="https://i.ibb.co/W6PQMdC/Screenshot-2022-09-13-at-9-08-40-AM.png")||c(H,"src",Ba),c(H,"alt","drawing"),c(H,"width","600"),c(Pe,"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(O,"id","resources"),c(O,"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(O,"href","#resources"),c(Z,"class","relative group"),c(Ge,"href","/docs/transformers/v4.31.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(Me,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/image_classification.ipynb"),c(Me,"rel","nofollow"),c(qe,"href","../tasks/image_classification"),c(Q,"id","transformers.ViTMSNConfig"),c(Q,"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(Q,"href","#transformers.ViTMSNConfig"),c(z,"class","relative group"),c(Xe,"href","/docs/transformers/v4.31.0/en/model_doc/vit_msn#transformers.ViTMSNModel"),c(Te,"href","https://huggingface.co/facebook/vit_msn_base"),c(Te,"rel","nofollow"),c(He,"href","/docs/transformers/v4.31.0/en/main_classes/configuration#transformers.PretrainedConfig"),c(Oe,"href","/docs/transformers/v4.31.0/en/main_classes/configuration#transformers.PretrainedConfig"),c(V,"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,"id","transformers.ViTMSNModel"),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","#transformers.ViTMSNModel"),c(A,"class","relative group"),c(Ve,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(Ve,"rel","nofollow"),c(Le,"href","/docs/transformers/v4.31.0/en/model_doc/vit_msn#transformers.ViTMSNModel"),c(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(J,"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(R,"class","relative group"),c(Ie,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(Ie,"rel","nofollow"),c(Qe,"href","/docs/transformers/v4.31.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(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,d){t(document.head,h),m(e,M,d),m(e,_,d),t(_,u),t(u,v),T(l,v,null),t(_,g),t(_,I),t(I,to),m(e,Vt,d),m(e,U,d),t(U,Y),t(Y,rt),T(de,rt,null),t(U,oo),t(U,it),t(it,ao),m(e,St,d),m(e,X,d),t(X,so),t(X,me),t(me,no),t(X,ro),m(e,kt,d),m(e,We,d),t(We,io),m(e,Ct,d),m(e,Ue,d),t(Ue,lt),t(lt,lo),m(e,Et,d),m(e,Ze,d),t(Ze,co),m(e,It,d),m(e,F,d),t(F,ct),t(ct,mo),t(F,ho),t(F,j),t(j,po),t(j,ze),t(ze,fo),t(j,uo),t(j,Be),t(Be,go),t(j,_o),t(j,he),t(he,vo),t(j,Mo),t(F,bo),t(F,dt),t(dt,wo),m(e,jt,d),m(e,H,d),m(e,Jt,d),m(e,pe,d),t(pe,To),t(pe,Pe),t(Pe,yo),m(e,Ft,d),m(e,x,d),t(x,No),t(x,fe),t(fe,$o),t(x,Vo),t(x,ue),t(ue,So),t(x,ko),m(e,xt,d),m(e,Z,d),t(Z,O),t(O,mt),T(ge,mt,null),t(Z,Co),t(Z,ht),t(ht,Eo),m(e,Wt,d),m(e,Ae,d),t(Ae,Io),m(e,Ut,d),T(_e,e,d),m(e,Zt,d),m(e,L,d),t(L,W),t(W,Ge),t(Ge,jo),t(W,Jo),t(W,ve),t(ve,Fo),t(W,xo),t(W,Me),t(Me,Wo),t(W,Uo),t(L,Zo),t(L,Re),t(Re,zo),t(Re,qe),t(qe,Bo),m(e,zt,d),m(e,Ye,d),t(Ye,Po),m(e,Bt,d),m(e,z,d),t(z,Q),t(Q,pt),T(be,pt,null),t(z,Ao),t(z,ft),t(ft,Go),m(e,Pt,d),m(e,V,d),T(we,V,null),t(V,Ro),t(V,B),t(B,qo),t(B,Xe),t(Xe,Yo),t(B,Xo),t(B,Te),t(Te,Ho),t(B,Oo),t(V,Lo),t(V,P),t(P,Qo),t(P,He),t(He,Do),t(P,Ko),t(P,Oe),t(Oe,ea),t(P,ta),t(V,oa),T(D,V,null),m(e,At,d),m(e,A,d),t(A,K),t(K,ut),T(ye,ut,null),t(A,aa),t(A,gt),t(gt,sa),m(e,Gt,d),m(e,J,d),T(Ne,J,null),t(J,na),t(J,$e),t($e,ra),t($e,Ve),t(Ve,ia),t($e,la),t(J,ca),t(J,C),T(Se,C,null),t(C,da),t(C,G),t(G,ma),t(G,Le),t(Le,ha),t(G,pa),t(G,_t),t(_t,fa),t(G,ua),t(C,ga),T(ee,C,null),t(C,_a),T(te,C,null),m(e,Rt,d),m(e,R,d),t(R,oe),t(oe,vt),T(ke,vt,null),t(R,va),t(R,Mt),t(Mt,Ma),m(e,qt,d),m(e,S,d),T(Ce,S,null),t(S,ba),t(S,bt),t(bt,wa),t(S,Ta),t(S,Ee),t(Ee,ya),t(Ee,Ie),t(Ie,Na),t(Ee,$a),t(S,Va),t(S,E),T(je,E,null),t(E,Sa),t(E,q),t(q,ka),t(q,Qe),t(Qe,Ca),t(q,Ea),t(q,wt),t(wt,Ia),t(q,ja),t(E,Ja),T(ae,E,null),t(E,Fa),T(se,E,null),Yt=!0},p(e,[d]){const Je={};d&2&&(Je.$$scope={dirty:d,ctx:e}),D.$set(Je);const Tt={};d&2&&(Tt.$$scope={dirty:d,ctx:e}),ee.$set(Tt);const yt={};d&2&&(yt.$$scope={dirty:d,ctx:e}),te.$set(yt);const Nt={};d&2&&(Nt.$$scope={dirty:d,ctx:e}),ae.$set(Nt);const Fe={};d&2&&(Fe.$$scope={dirty:d,ctx:e}),se.$set(Fe)},i(e){Yt||(y(l.$$.fragment,e),y(de.$$.fragment,e),y(ge.$$.fragment,e),y(_e.$$.fragment,e),y(be.$$.fragment,e),y(we.$$.fragment,e),y(D.$$.fragment,e),y(ye.$$.fragment,e),y(Ne.$$.fragment,e),y(Se.$$.fragment,e),y(ee.$$.fragment,e),y(te.$$.fragment,e),y(ke.$$.fragment,e),y(Ce.$$.fragment,e),y(je.$$.fragment,e),y(ae.$$.fragment,e),y(se.$$.fragment,e),Yt=!0)},o(e){N(l.$$.fragment,e),N(de.$$.fragment,e),N(ge.$$.fragment,e),N(_e.$$.fragment,e),N(be.$$.fragment,e),N(we.$$.fragment,e),N(D.$$.fragment,e),N(ye.$$.fragment,e),N(Ne.$$.fragment,e),N(Se.$$.fragment,e),N(ee.$$.fragment,e),N(te.$$.fragment,e),N(ke.$$.fragment,e),N(Ce.$$.fragment,e),N(je.$$.fragment,e),N(ae.$$.fragment,e),N(se.$$.fragment,e),Yt=!1},d(e){o(h),e&&o(M),e&&o(_),$(l),e&&o(Vt),e&&o(U),$(de),e&&o(St),e&&o(X),e&&o(kt),e&&o(We),e&&o(Ct),e&&o(Ue),e&&o(Et),e&&o(Ze),e&&o(It),e&&o(F),e&&o(jt),e&&o(H),e&&o(Jt),e&&o(pe),e&&o(Ft),e&&o(x),e&&o(xt),e&&o(Z),$(ge),e&&o(Wt),e&&o(Ae),e&&o(Ut),$(_e,e),e&&o(Zt),e&&o(L),e&&o(zt),e&&o(Ye),e&&o(Bt),e&&o(z),$(be),e&&o(Pt),e&&o(V),$(we),$(D),e&&o(At),e&&o(A),$(ye),e&&o(Gt),e&&o(J),$(Ne),$(Se),$(ee),$(te),e&&o(Rt),e&&o(R),$(ke),e&&o(qt),e&&o(S),$(Ce),$(je),$(ae),$(se)}}}const Ys={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 Xs(k){return Zs(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class tn extends Js{constructor(h){super();Fs(this,h,Xs,qs,xs,{})}}export{tn as default,Ys as metadata};
