import{S as ka,i as Ma,s as Ia,e as s,k as u,w as b,t as i,M as xa,c as n,d as o,m as g,a,x as $,h as l,b as c,G as t,g as h,y,q as S,o as T,B as k,v as Ea,L as Po}from"../../chunks/vendor-hf-doc-builder.js";import{T as jo}from"../../chunks/Tip-hf-doc-builder.js";import{D as Ke}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Co}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as Je}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Fo}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";import{P as ja}from"../../chunks/PipelineTag-hf-doc-builder.js";function Fa(M){let d,w,_,f,v;return f=new Co({props:{code:`from transformers import Swinv2Config, Swinv2Model

# Initializing a Swinv2 microsoft/swinv2-tiny-patch4-window8-256 style configuration
configuration = Swinv2Config()

# Initializing a model (with random weights) from the microsoft/swinv2-tiny-patch4-window8-256 style configuration
model = Swinv2Model(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> Swinv2Config, Swinv2Model

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a Swinv2 microsoft/swinv2-tiny-patch4-window8-256 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = Swinv2Config()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model (with random weights) from the microsoft/swinv2-tiny-patch4-window8-256 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Swinv2Model(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(){d=s("p"),w=i("Example:"),_=u(),b(f.$$.fragment)},l(r){d=n(r,"P",{});var m=a(d);w=l(m,"Example:"),m.forEach(o),_=g(r),$(f.$$.fragment,r)},m(r,m){h(r,d,m),t(d,w),h(r,_,m),y(f,r,m),v=!0},p:Po,i(r){v||(S(f.$$.fragment,r),v=!0)},o(r){T(f.$$.fragment,r),v=!1},d(r){r&&o(d),r&&o(_),k(f,r)}}}function Pa(M){let d,w,_,f,v;return{c(){d=s("p"),w=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=s("code"),f=i("Module"),v=i(`
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(r){d=n(r,"P",{});var m=a(d);w=l(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=n(m,"CODE",{});var I=a(_);f=l(I,"Module"),I.forEach(o),v=l(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(o)},m(r,m){h(r,d,m),t(d,w),t(d,_),t(_,f),t(d,v)},d(r){r&&o(d)}}}function Ca(M){let d,w,_,f,v;return f=new Co({props:{code:`from transformers import AutoImageProcessor, Swinv2Model
import torch
from datasets import load_dataset

dataset = load_dataset("huggingface/cats-image")
image = dataset["test"]["image"][0]

image_processor = AutoImageProcessor.from_pretrained("microsoft/swinv2-tiny-patch4-window8-256")
model = Swinv2Model.from_pretrained("microsoft/swinv2-tiny-patch4-window8-256")

inputs = image_processor(image, return_tensors="pt")

with torch.no_grad():
    outputs = model(**inputs)

last_hidden_states = outputs.last_hidden_state
list(last_hidden_states.shape)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, Swinv2Model
<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> datasets <span class="hljs-keyword">import</span> load_dataset

<span class="hljs-meta">&gt;&gt;&gt; </span>dataset = load_dataset(<span class="hljs-string">&quot;huggingface/cats-image&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>image = dataset[<span class="hljs-string">&quot;test&quot;</span>][<span class="hljs-string">&quot;image&quot;</span>][<span class="hljs-number">0</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;microsoft/swinv2-tiny-patch4-window8-256&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Swinv2Model.from_pretrained(<span class="hljs-string">&quot;microsoft/swinv2-tiny-patch4-window8-256&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = image_processor(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
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">list</span>(last_hidden_states.shape)
[<span class="hljs-number">1</span>, <span class="hljs-number">64</span>, <span class="hljs-number">768</span>]`}}),{c(){d=s("p"),w=i("Example:"),_=u(),b(f.$$.fragment)},l(r){d=n(r,"P",{});var m=a(d);w=l(m,"Example:"),m.forEach(o),_=g(r),$(f.$$.fragment,r)},m(r,m){h(r,d,m),t(d,w),h(r,_,m),y(f,r,m),v=!0},p:Po,i(r){v||(S(f.$$.fragment,r),v=!0)},o(r){T(f.$$.fragment,r),v=!1},d(r){r&&o(d),r&&o(_),k(f,r)}}}function Aa(M){let d,w,_,f,v;return{c(){d=s("p"),w=i("Note that we provide a script to pre-train this model on custom data in our "),_=s("a"),f=i(`examples
directory`),v=i("."),this.h()},l(r){d=n(r,"P",{});var m=a(d);w=l(m,"Note that we provide a script to pre-train this model on custom data in our "),_=n(m,"A",{href:!0,rel:!0});var I=a(_);f=l(I,`examples
directory`),I.forEach(o),v=l(m,"."),m.forEach(o),this.h()},h(){c(_,"href","https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-pretraining"),c(_,"rel","nofollow")},m(r,m){h(r,d,m),t(d,w),t(d,_),t(_,f),t(d,v)},d(r){r&&o(d)}}}function qa(M){let d,w,_,f,v;return{c(){d=s("p"),w=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=s("code"),f=i("Module"),v=i(`
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(r){d=n(r,"P",{});var m=a(d);w=l(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=n(m,"CODE",{});var I=a(_);f=l(I,"Module"),I.forEach(o),v=l(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(o)},m(r,m){h(r,d,m),t(d,w),t(d,_),t(_,f),t(d,v)},d(r){r&&o(d)}}}function za(M){let d,w,_,f,v;return f=new Co({props:{code:`from transformers import AutoImageProcessor, Swinv2ForMaskedImageModeling
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("microsoft/swinv2-tiny-patch4-window8-256")
model = Swinv2ForMaskedImageModeling.from_pretrained("microsoft/swinv2-tiny-patch4-window8-256")

num_patches = (model.config.image_size // model.config.patch_size) ** 2
pixel_values = image_processor(images=image, return_tensors="pt").pixel_values
# create random boolean mask of shape (batch_size, num_patches)
bool_masked_pos = torch.randint(low=0, high=2, size=(1, num_patches)).bool()

outputs = model(pixel_values, bool_masked_pos=bool_masked_pos)
loss, reconstructed_pixel_values = outputs.loss, outputs.logits
list(reconstructed_pixel_values.shape)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, Swinv2ForMaskedImageModeling
<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;microsoft/swinv2-tiny-patch4-window8-256&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Swinv2ForMaskedImageModeling.from_pretrained(<span class="hljs-string">&quot;microsoft/swinv2-tiny-patch4-window8-256&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>num_patches = (model.config.image_size // model.config.patch_size) ** <span class="hljs-number">2</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pixel_values = image_processor(images=image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).pixel_values
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># create random boolean mask of shape (batch_size, num_patches)</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>bool_masked_pos = torch.randint(low=<span class="hljs-number">0</span>, high=<span class="hljs-number">2</span>, size=(<span class="hljs-number">1</span>, num_patches)).<span class="hljs-built_in">bool</span>()

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(pixel_values, bool_masked_pos=bool_masked_pos)
<span class="hljs-meta">&gt;&gt;&gt; </span>loss, reconstructed_pixel_values = outputs.loss, outputs.logits
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">list</span>(reconstructed_pixel_values.shape)
[<span class="hljs-number">1</span>, <span class="hljs-number">3</span>, <span class="hljs-number">256</span>, <span class="hljs-number">256</span>]`}}),{c(){d=s("p"),w=i("Examples:"),_=u(),b(f.$$.fragment)},l(r){d=n(r,"P",{});var m=a(d);w=l(m,"Examples:"),m.forEach(o),_=g(r),$(f.$$.fragment,r)},m(r,m){h(r,d,m),t(d,w),h(r,_,m),y(f,r,m),v=!0},p:Po,i(r){v||(S(f.$$.fragment,r),v=!0)},o(r){T(f.$$.fragment,r),v=!1},d(r){r&&o(d),r&&o(_),k(f,r)}}}function Na(M){let d,w,_,f,v;return{c(){d=s("p"),w=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=s("code"),f=i("Module"),v=i(`
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(r){d=n(r,"P",{});var m=a(d);w=l(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=n(m,"CODE",{});var I=a(_);f=l(I,"Module"),I.forEach(o),v=l(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(o)},m(r,m){h(r,d,m),t(d,w),t(d,_),t(_,f),t(d,v)},d(r){r&&o(d)}}}function Oa(M){let d,w,_,f,v;return f=new Co({props:{code:`from transformers import AutoImageProcessor, Swinv2ForImageClassification
import torch
from datasets import load_dataset

dataset = load_dataset("huggingface/cats-image")
image = dataset["test"]["image"][0]

image_processor = AutoImageProcessor.from_pretrained("microsoft/swinv2-tiny-patch4-window8-256")
model = Swinv2ForImageClassification.from_pretrained("microsoft/swinv2-tiny-patch4-window8-256")

inputs = image_processor(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, Swinv2ForImageClassification
<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> datasets <span class="hljs-keyword">import</span> load_dataset

<span class="hljs-meta">&gt;&gt;&gt; </span>dataset = load_dataset(<span class="hljs-string">&quot;huggingface/cats-image&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>image = dataset[<span class="hljs-string">&quot;test&quot;</span>][<span class="hljs-string">&quot;image&quot;</span>][<span class="hljs-number">0</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;microsoft/swinv2-tiny-patch4-window8-256&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Swinv2ForImageClassification.from_pretrained(<span class="hljs-string">&quot;microsoft/swinv2-tiny-patch4-window8-256&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = image_processor(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])
Egyptian cat`}}),{c(){d=s("p"),w=i("Example:"),_=u(),b(f.$$.fragment)},l(r){d=n(r,"P",{});var m=a(d);w=l(m,"Example:"),m.forEach(o),_=g(r),$(f.$$.fragment,r)},m(r,m){h(r,d,m),t(d,w),h(r,_,m),y(f,r,m),v=!0},p:Po,i(r){v||(S(f.$$.fragment,r),v=!0)},o(r){T(f.$$.fragment,r),v=!1},d(r){r&&o(d),r&&o(_),k(f,r)}}}function La(M){let d,w,_,f,v,r,m,I,Ao,Yt,O,G,Tt,_e,qo,kt,zo,Gt,K,No,ve,Oo,Lo,Kt,Xe,Do,Jt,Qe,Mt,Vo,Xt,et,Ho,Qt,tt,we,Wo,ot,Ro,Uo,eo,q,Bo,be,Zo,Yo,$e,Go,Ko,to,L,J,It,ye,Jo,xt,Xo,oo,st,Qo,so,Se,no,X,z,nt,es,ts,Te,os,ss,ke,ns,as,rs,at,is,rt,ls,ao,it,ds,ro,lt,Q,dt,cs,ps,Me,ms,hs,io,ct,fs,lo,D,ee,Et,Ie,us,jt,gs,co,E,xe,_s,V,vs,pt,ws,bs,Ee,$s,ys,Ss,H,Ts,mt,ks,Ms,ht,Is,xs,Es,te,po,W,oe,Ft,je,js,Pt,Fs,mo,A,Fe,Ps,Pe,Cs,Ce,As,qs,zs,F,Ae,Ns,R,Os,ft,Ls,Ds,Ct,Vs,Hs,Ws,se,Rs,ne,ho,U,ae,At,qe,Us,qt,Bs,fo,x,ze,Zs,Ne,Ys,Oe,Gs,Ks,Js,re,Xs,Le,Qs,De,en,tn,on,P,Ve,sn,B,nn,ut,an,rn,zt,ln,dn,cn,ie,pn,le,uo,Z,de,Nt,He,mn,Ot,hn,go,j,We,fn,Lt,un,gn,Re,_n,Ue,vn,wn,bn,C,Be,$n,Y,yn,gt,Sn,Tn,Dt,kn,Mn,In,ce,xn,pe,_o;return r=new Je({}),_e=new Je({}),ye=new Je({}),Se=new ja({props:{pipeline:"image-classification"}}),Ie=new Je({}),xe=new Ke({props:{name:"class transformers.Swinv2Config",anchor:"transformers.Swinv2Config",parameters:[{name:"image_size",val:" = 224"},{name:"patch_size",val:" = 4"},{name:"num_channels",val:" = 3"},{name:"embed_dim",val:" = 96"},{name:"depths",val:" = [2, 2, 6, 2]"},{name:"num_heads",val:" = [3, 6, 12, 24]"},{name:"window_size",val:" = 7"},{name:"mlp_ratio",val:" = 4.0"},{name:"qkv_bias",val:" = True"},{name:"hidden_dropout_prob",val:" = 0.0"},{name:"attention_probs_dropout_prob",val:" = 0.0"},{name:"drop_path_rate",val:" = 0.1"},{name:"hidden_act",val:" = 'gelu'"},{name:"use_absolute_embeddings",val:" = False"},{name:"initializer_range",val:" = 0.02"},{name:"layer_norm_eps",val:" = 1e-05"},{name:"encoder_stride",val:" = 32"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Swinv2Config.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.Swinv2Config.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, <em>optional</em>, defaults to 4) &#x2014;
The size (resolution) of each patch.`,name:"patch_size"},{anchor:"transformers.Swinv2Config.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.Swinv2Config.embed_dim",description:`<strong>embed_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 96) &#x2014;
Dimensionality of patch embedding.`,name:"embed_dim"},{anchor:"transformers.Swinv2Config.depths",description:`<strong>depths</strong> (<code>list(int)</code>, <em>optional</em>, defaults to <code>[2, 2, 6, 2]</code>) &#x2014;
Depth of each layer in the Transformer encoder.`,name:"depths"},{anchor:"transformers.Swinv2Config.num_heads",description:`<strong>num_heads</strong> (<code>list(int)</code>, <em>optional</em>, defaults to <code>[3, 6, 12, 24]</code>) &#x2014;
Number of attention heads in each layer of the Transformer encoder.`,name:"num_heads"},{anchor:"transformers.Swinv2Config.window_size",description:`<strong>window_size</strong> (<code>int</code>, <em>optional</em>, defaults to 7) &#x2014;
Size of windows.`,name:"window_size"},{anchor:"transformers.Swinv2Config.mlp_ratio",description:`<strong>mlp_ratio</strong> (<code>float</code>, <em>optional</em>, defaults to 4.0) &#x2014;
Ratio of MLP hidden dimensionality to embedding dimensionality.`,name:"mlp_ratio"},{anchor:"transformers.Swinv2Config.qkv_bias",description:`<strong>qkv_bias</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not a learnable bias should be added to the queries, keys and values.`,name:"qkv_bias"},{anchor:"transformers.Swinv2Config.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 and encoder.`,name:"hidden_dropout_prob"},{anchor:"transformers.Swinv2Config.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.Swinv2Config.drop_path_rate",description:`<strong>drop_path_rate</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
Stochastic depth rate.`,name:"drop_path_rate"},{anchor:"transformers.Swinv2Config.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. 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.Swinv2Config.use_absolute_embeddings",description:`<strong>use_absolute_embeddings</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to add absolute position embeddings to the patch embeddings.`,name:"use_absolute_embeddings"},{anchor:"transformers.Swinv2Config.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.Swinv2Config.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-12) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.Swinv2Config.encoder_stride",description:`<strong>encoder_stride</strong> (<code>int</code>, <code>optional</code>, defaults to 32) &#x2014;
Factor to increase the spatial resolution by in the decoder head for masked image modeling.`,name:"encoder_stride"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/swinv2/configuration_swinv2.py#L30"}}),te=new Fo({props:{anchor:"transformers.Swinv2Config.example",$$slots:{default:[Fa]},$$scope:{ctx:M}}}),je=new Je({}),Fe=new Ke({props:{name:"class transformers.Swinv2Model",anchor:"transformers.Swinv2Model",parameters:[{name:"config",val:""},{name:"add_pooling_layer",val:" = True"},{name:"use_mask_token",val:" = False"}],parametersDescription:[{anchor:"transformers.Swinv2Model.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.27.1/en/model_doc/swinv2#transformers.Swinv2Config">Swinv2Config</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.27.1/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.27.1/src/transformers/models/swinv2/modeling_swinv2.py#L1015"}}),Ae=new Ke({props:{name:"forward",anchor:"transformers.Swinv2Model.forward",parameters:[{name:"pixel_values",val:": typing.Optional[torch.FloatTensor] = None"},{name:"bool_masked_pos",val:": typing.Optional[torch.BoolTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.Swinv2Model.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.27.1/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.27.1/en/model_doc/videomae#transformers.VideoMAEFeatureExtractor.__call__">ViTImageProcessor.<strong>call</strong>()</a>
for details.`,name:"pixel_values"},{anchor:"transformers.Swinv2Model.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.Swinv2Model.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.Swinv2Model.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.Swinv2Model.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.27.1/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.27.1/src/transformers/models/swinv2/modeling_swinv2.py#L1042",returnDescription:`
<p>A <code>transformers.models.swinv2.modeling_swinv2.Swinv2ModelOutput</code> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.27.1/en/model_doc/swinv2#transformers.Swinv2Config"
>Swinv2Config</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>pooler_output</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, hidden_size)</code>, <em>optional</em>, returned when <code>add_pooling_layer=True</code> is passed) \u2014 Average pooling of the last layer hidden-state.</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 + one for the output of each stage) 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 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 stage) 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>
<li>
<p><strong>reshaped_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 + one for the output of each stage) of
shape <code>(batch_size, hidden_size, height, width)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs reshaped to
include the spatial dimensions.</p>
</li>
</ul>
`,returnType:`
<p><code>transformers.models.swinv2.modeling_swinv2.Swinv2ModelOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),se=new jo({props:{$$slots:{default:[Pa]},$$scope:{ctx:M}}}),ne=new Fo({props:{anchor:"transformers.Swinv2Model.forward.example",$$slots:{default:[Ca]},$$scope:{ctx:M}}}),qe=new Je({}),ze=new Ke({props:{name:"class transformers.Swinv2ForMaskedImageModeling",anchor:"transformers.Swinv2ForMaskedImageModeling",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.Swinv2ForMaskedImageModeling.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.27.1/en/model_doc/swinv2#transformers.Swinv2Config">Swinv2Config</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.27.1/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.27.1/src/transformers/models/swinv2/modeling_swinv2.py#L1122"}}),re=new jo({props:{$$slots:{default:[Aa]},$$scope:{ctx:M}}}),Ve=new Ke({props:{name:"forward",anchor:"transformers.Swinv2ForMaskedImageModeling.forward",parameters:[{name:"pixel_values",val:": typing.Optional[torch.FloatTensor] = None"},{name:"bool_masked_pos",val:": typing.Optional[torch.BoolTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.Swinv2ForMaskedImageModeling.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.27.1/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.27.1/en/model_doc/videomae#transformers.VideoMAEFeatureExtractor.__call__">ViTImageProcessor.<strong>call</strong>()</a>
for details.`,name:"pixel_values"},{anchor:"transformers.Swinv2ForMaskedImageModeling.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.Swinv2ForMaskedImageModeling.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.Swinv2ForMaskedImageModeling.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.Swinv2ForMaskedImageModeling.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.27.1/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.Swinv2ForMaskedImageModeling.forward.bool_masked_pos",description:`<strong>bool_masked_pos</strong> (<code>torch.BoolTensor</code> of shape <code>(batch_size, num_patches)</code>) &#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.27.1/src/transformers/models/swinv2/modeling_swinv2.py#L1139",returnDescription:`
<p>A <code>transformers.models.swinv2.modeling_swinv2.Swinv2MaskedImageModelingOutput</code> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.27.1/en/model_doc/swinv2#transformers.Swinv2Config"
>Swinv2Config</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>bool_masked_pos</code> is provided) \u2014 Masked image modeling (MLM) loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) \u2014 Reconstructed pixel values.</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 + one for the output of each stage) 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 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 stage) 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>
<li>
<p><strong>reshaped_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 + one for the output of each stage) of
shape <code>(batch_size, hidden_size, height, width)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs reshaped to
include the spatial dimensions.</p>
</li>
</ul>
`,returnType:`
<p><code>transformers.models.swinv2.modeling_swinv2.Swinv2MaskedImageModelingOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ie=new jo({props:{$$slots:{default:[qa]},$$scope:{ctx:M}}}),le=new Fo({props:{anchor:"transformers.Swinv2ForMaskedImageModeling.forward.example",$$slots:{default:[za]},$$scope:{ctx:M}}}),He=new Je({}),We=new Ke({props:{name:"class transformers.Swinv2ForImageClassification",anchor:"transformers.Swinv2ForImageClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.Swinv2ForImageClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.27.1/en/model_doc/swinv2#transformers.Swinv2Config">Swinv2Config</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.27.1/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.27.1/src/transformers/models/swinv2/modeling_swinv2.py#L1234"}}),Be=new Ke({props:{name:"forward",anchor:"transformers.Swinv2ForImageClassification.forward",parameters:[{name:"pixel_values",val:": typing.Optional[torch.FloatTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.Swinv2ForImageClassification.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.27.1/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.27.1/en/model_doc/videomae#transformers.VideoMAEFeatureExtractor.__call__">ViTImageProcessor.<strong>call</strong>()</a>
for details.`,name:"pixel_values"},{anchor:"transformers.Swinv2ForImageClassification.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.Swinv2ForImageClassification.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.Swinv2ForImageClassification.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.Swinv2ForImageClassification.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.27.1/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.Swinv2ForImageClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the image classification/regression loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>. If <code>config.num_labels == 1</code> a regression loss is computed (Mean-Square loss), If
<code>config.num_labels &gt; 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/swinv2/modeling_swinv2.py#L1249",returnDescription:`
<p>A <code>transformers.models.swinv2.modeling_swinv2.Swinv2ImageClassifierOutput</code> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.27.1/en/model_doc/swinv2#transformers.Swinv2Config"
>Swinv2Config</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 + one for the output of each stage) 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 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 stage) 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>
<li>
<p><strong>reshaped_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 + one for the output of each stage) of
shape <code>(batch_size, hidden_size, height, width)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs reshaped to
include the spatial dimensions.</p>
</li>
</ul>
`,returnType:`
<p><code>transformers.models.swinv2.modeling_swinv2.Swinv2ImageClassifierOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ce=new jo({props:{$$slots:{default:[Na]},$$scope:{ctx:M}}}),pe=new Fo({props:{anchor:"transformers.Swinv2ForImageClassification.forward.example",$$slots:{default:[Oa]},$$scope:{ctx:M}}}),{c(){d=s("meta"),w=u(),_=s("h1"),f=s("a"),v=s("span"),b(r.$$.fragment),m=u(),I=s("span"),Ao=i("Swin Transformer V2"),Yt=u(),O=s("h2"),G=s("a"),Tt=s("span"),b(_e.$$.fragment),qo=u(),kt=s("span"),zo=i("Overview"),Gt=u(),K=s("p"),No=i("The Swin Transformer V2 model was proposed in "),ve=s("a"),Oo=i("Swin Transformer V2: Scaling Up Capacity and Resolution"),Lo=i(" by Ze Liu, Han Hu, Yutong Lin, Zhuliang Yao, Zhenda Xie, Yixuan Wei, Jia Ning, Yue Cao, Zheng Zhang, Li Dong, Furu Wei, Baining Guo."),Kt=u(),Xe=s("p"),Do=i("The abstract from the paper is the following:"),Jt=u(),Qe=s("p"),Mt=s("em"),Vo=i("Large-scale NLP models have been shown to significantly improve the performance on language tasks with no signs of saturation. They also demonstrate amazing few-shot capabilities like that of human beings. This paper aims to explore large-scale models in computer vision. We tackle three major issues in training and application of large vision models, including training instability, resolution gaps between pre-training and fine-tuning, and hunger on labelled data. Three main techniques are proposed: 1) a residual-post-norm method combined with cosine attention to improve training stability; 2) A log-spaced continuous position bias method to effectively transfer models pre-trained using low-resolution images to downstream tasks with high-resolution inputs; 3) A self-supervised pre-training method, SimMIM, to reduce the needs of vast labeled images. Through these techniques, this paper successfully trained a 3 billion-parameter Swin Transformer V2 model, which is the largest dense vision model to date, and makes it capable of training with images of up to 1,536\xD71,536 resolution. It set new performance records on 4 representative vision tasks, including ImageNet-V2 image classification, COCO object detection, ADE20K semantic segmentation, and Kinetics-400 video action classification. Also note our training is much more efficient than that in Google\u2019s billion-level visual models, which consumes 40 times less labelled data and 40 times less training time."),Xt=u(),et=s("p"),Ho=i("Tips:"),Qt=u(),tt=s("ul"),we=s("li"),Wo=i("One can use the "),ot=s("a"),Ro=i("AutoImageProcessor"),Uo=i(" API to prepare images for the model."),eo=u(),q=s("p"),Bo=i("This model was contributed by "),be=s("a"),Zo=i("nandwalritik"),Yo=i(`.
The original code can be found `),$e=s("a"),Go=i("here"),Ko=i("."),to=u(),L=s("h2"),J=s("a"),It=s("span"),b(ye.$$.fragment),Jo=u(),xt=s("span"),Xo=i("Resources"),oo=u(),st=s("p"),Qo=i("A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with Swin Transformer v2."),so=u(),b(Se.$$.fragment),no=u(),X=s("ul"),z=s("li"),nt=s("a"),es=i("Swinv2ForImageClassification"),ts=i(" is supported by this "),Te=s("a"),os=i("example script"),ss=i(" and "),ke=s("a"),ns=i("notebook"),as=i("."),rs=u(),at=s("li"),is=i("See also: "),rt=s("a"),ls=i("Image classification task guide"),ao=u(),it=s("p"),ds=i("Besides that:"),ro=u(),lt=s("ul"),Q=s("li"),dt=s("a"),cs=i("Swinv2ForMaskedImageModeling"),ps=i(" is supported by this "),Me=s("a"),ms=i("example script"),hs=i("."),io=u(),ct=s("p"),fs=i("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."),lo=u(),D=s("h2"),ee=s("a"),Et=s("span"),b(Ie.$$.fragment),us=u(),jt=s("span"),gs=i("Swinv2Config"),co=u(),E=s("div"),b(xe.$$.fragment),_s=u(),V=s("p"),vs=i("This is the configuration class to store the configuration of a "),pt=s("a"),ws=i("Swinv2Model"),bs=i(`. It is used to instantiate a Swin
Transformer v2 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 Swin Transformer v2
`),Ee=s("a"),$s=i("microsoft/swinv2-tiny-patch4-window8-256"),ys=i(`
architecture.`),Ss=u(),H=s("p"),Ts=i("Configuration objects inherit from "),mt=s("a"),ks=i("PretrainedConfig"),Ms=i(` and can be used to control the model outputs. Read the
documentation from `),ht=s("a"),Is=i("PretrainedConfig"),xs=i(" for more information."),Es=u(),b(te.$$.fragment),po=u(),W=s("h2"),oe=s("a"),Ft=s("span"),b(je.$$.fragment),js=u(),Pt=s("span"),Fs=i("Swinv2Model"),mo=u(),A=s("div"),b(Fe.$$.fragment),Ps=u(),Pe=s("p"),Cs=i(`The bare Swinv2 Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),Ce=s("a"),As=i("torch.nn.Module"),qs=i(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),zs=u(),F=s("div"),b(Ae.$$.fragment),Ns=u(),R=s("p"),Os=i("The "),ft=s("a"),Ls=i("Swinv2Model"),Ds=i(" forward method, overrides the "),Ct=s("code"),Vs=i("__call__"),Hs=i(" special method."),Ws=u(),b(se.$$.fragment),Rs=u(),b(ne.$$.fragment),ho=u(),U=s("h2"),ae=s("a"),At=s("span"),b(qe.$$.fragment),Us=u(),qt=s("span"),Bs=i("Swinv2ForMaskedImageModeling"),fo=u(),x=s("div"),b(ze.$$.fragment),Zs=u(),Ne=s("p"),Ys=i(`Swinv2 Model with a decoder on top for masked image modeling, as proposed in
`),Oe=s("a"),Gs=i("SimMIM"),Ks=i("."),Js=u(),b(re.$$.fragment),Xs=u(),Le=s("p"),Qs=i("This model is a PyTorch "),De=s("a"),en=i("torch.nn.Module"),tn=i(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),on=u(),P=s("div"),b(Ve.$$.fragment),sn=u(),B=s("p"),nn=i("The "),ut=s("a"),an=i("Swinv2ForMaskedImageModeling"),rn=i(" forward method, overrides the "),zt=s("code"),ln=i("__call__"),dn=i(" special method."),cn=u(),b(ie.$$.fragment),pn=u(),b(le.$$.fragment),uo=u(),Z=s("h2"),de=s("a"),Nt=s("span"),b(He.$$.fragment),mn=u(),Ot=s("span"),hn=i("Swinv2ForImageClassification"),go=u(),j=s("div"),b(We.$$.fragment),fn=u(),Lt=s("p"),un=i(`Swinv2 Model transformer with an image classification head on top (a linear layer on top of the final hidden state
of the [CLS] token) e.g. for ImageNet.`),gn=u(),Re=s("p"),_n=i("This model is a PyTorch "),Ue=s("a"),vn=i("torch.nn.Module"),wn=i(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),bn=u(),C=s("div"),b(Be.$$.fragment),$n=u(),Y=s("p"),yn=i("The "),gt=s("a"),Sn=i("Swinv2ForImageClassification"),Tn=i(" forward method, overrides the "),Dt=s("code"),kn=i("__call__"),Mn=i(" special method."),In=u(),b(ce.$$.fragment),xn=u(),b(pe.$$.fragment),this.h()},l(e){const p=xa('[data-svelte="svelte-1phssyn"]',document.head);d=n(p,"META",{name:!0,content:!0}),p.forEach(o),w=g(e),_=n(e,"H1",{class:!0});var Ze=a(_);f=n(Ze,"A",{id:!0,class:!0,href:!0});var Vt=a(f);v=n(Vt,"SPAN",{});var Ht=a(v);$(r.$$.fragment,Ht),Ht.forEach(o),Vt.forEach(o),m=g(Ze),I=n(Ze,"SPAN",{});var Wt=a(I);Ao=l(Wt,"Swin Transformer V2"),Wt.forEach(o),Ze.forEach(o),Yt=g(e),O=n(e,"H2",{class:!0});var Ye=a(O);G=n(Ye,"A",{id:!0,class:!0,href:!0});var Rt=a(G);Tt=n(Rt,"SPAN",{});var Ut=a(Tt);$(_e.$$.fragment,Ut),Ut.forEach(o),Rt.forEach(o),qo=g(Ye),kt=n(Ye,"SPAN",{});var Bt=a(kt);zo=l(Bt,"Overview"),Bt.forEach(o),Ye.forEach(o),Gt=g(e),K=n(e,"P",{});var vo=a(K);No=l(vo,"The Swin Transformer V2 model was proposed in "),ve=n(vo,"A",{href:!0,rel:!0});var jn=a(ve);Oo=l(jn,"Swin Transformer V2: Scaling Up Capacity and Resolution"),jn.forEach(o),Lo=l(vo," by Ze Liu, Han Hu, Yutong Lin, Zhuliang Yao, Zhenda Xie, Yixuan Wei, Jia Ning, Yue Cao, Zheng Zhang, Li Dong, Furu Wei, Baining Guo."),vo.forEach(o),Kt=g(e),Xe=n(e,"P",{});var Fn=a(Xe);Do=l(Fn,"The abstract from the paper is the following:"),Fn.forEach(o),Jt=g(e),Qe=n(e,"P",{});var Pn=a(Qe);Mt=n(Pn,"EM",{});var Cn=a(Mt);Vo=l(Cn,"Large-scale NLP models have been shown to significantly improve the performance on language tasks with no signs of saturation. They also demonstrate amazing few-shot capabilities like that of human beings. This paper aims to explore large-scale models in computer vision. We tackle three major issues in training and application of large vision models, including training instability, resolution gaps between pre-training and fine-tuning, and hunger on labelled data. Three main techniques are proposed: 1) a residual-post-norm method combined with cosine attention to improve training stability; 2) A log-spaced continuous position bias method to effectively transfer models pre-trained using low-resolution images to downstream tasks with high-resolution inputs; 3) A self-supervised pre-training method, SimMIM, to reduce the needs of vast labeled images. Through these techniques, this paper successfully trained a 3 billion-parameter Swin Transformer V2 model, which is the largest dense vision model to date, and makes it capable of training with images of up to 1,536\xD71,536 resolution. It set new performance records on 4 representative vision tasks, including ImageNet-V2 image classification, COCO object detection, ADE20K semantic segmentation, and Kinetics-400 video action classification. Also note our training is much more efficient than that in Google\u2019s billion-level visual models, which consumes 40 times less labelled data and 40 times less training time."),Cn.forEach(o),Pn.forEach(o),Xt=g(e),et=n(e,"P",{});var An=a(et);Ho=l(An,"Tips:"),An.forEach(o),Qt=g(e),tt=n(e,"UL",{});var qn=a(tt);we=n(qn,"LI",{});var wo=a(we);Wo=l(wo,"One can use the "),ot=n(wo,"A",{href:!0});var zn=a(ot);Ro=l(zn,"AutoImageProcessor"),zn.forEach(o),Uo=l(wo," API to prepare images for the model."),wo.forEach(o),qn.forEach(o),eo=g(e),q=n(e,"P",{});var _t=a(q);Bo=l(_t,"This model was contributed by "),be=n(_t,"A",{href:!0,rel:!0});var Nn=a(be);Zo=l(Nn,"nandwalritik"),Nn.forEach(o),Yo=l(_t,`.
The original code can be found `),$e=n(_t,"A",{href:!0,rel:!0});var On=a($e);Go=l(On,"here"),On.forEach(o),Ko=l(_t,"."),_t.forEach(o),to=g(e),L=n(e,"H2",{class:!0});var bo=a(L);J=n(bo,"A",{id:!0,class:!0,href:!0});var Ln=a(J);It=n(Ln,"SPAN",{});var Dn=a(It);$(ye.$$.fragment,Dn),Dn.forEach(o),Ln.forEach(o),Jo=g(bo),xt=n(bo,"SPAN",{});var Vn=a(xt);Xo=l(Vn,"Resources"),Vn.forEach(o),bo.forEach(o),oo=g(e),st=n(e,"P",{});var Hn=a(st);Qo=l(Hn,"A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with Swin Transformer v2."),Hn.forEach(o),so=g(e),$(Se.$$.fragment,e),no=g(e),X=n(e,"UL",{});var $o=a(X);z=n($o,"LI",{});var Ge=a(z);nt=n(Ge,"A",{href:!0});var Wn=a(nt);es=l(Wn,"Swinv2ForImageClassification"),Wn.forEach(o),ts=l(Ge," is supported by this "),Te=n(Ge,"A",{href:!0,rel:!0});var Rn=a(Te);os=l(Rn,"example script"),Rn.forEach(o),ss=l(Ge," and "),ke=n(Ge,"A",{href:!0,rel:!0});var Un=a(ke);ns=l(Un,"notebook"),Un.forEach(o),as=l(Ge,"."),Ge.forEach(o),rs=g($o),at=n($o,"LI",{});var En=a(at);is=l(En,"See also: "),rt=n(En,"A",{href:!0});var Bn=a(rt);ls=l(Bn,"Image classification task guide"),Bn.forEach(o),En.forEach(o),$o.forEach(o),ao=g(e),it=n(e,"P",{});var Zn=a(it);ds=l(Zn,"Besides that:"),Zn.forEach(o),ro=g(e),lt=n(e,"UL",{});var Yn=a(lt);Q=n(Yn,"LI",{});var Zt=a(Q);dt=n(Zt,"A",{href:!0});var Gn=a(dt);cs=l(Gn,"Swinv2ForMaskedImageModeling"),Gn.forEach(o),ps=l(Zt," is supported by this "),Me=n(Zt,"A",{href:!0,rel:!0});var Kn=a(Me);ms=l(Kn,"example script"),Kn.forEach(o),hs=l(Zt,"."),Zt.forEach(o),Yn.forEach(o),io=g(e),ct=n(e,"P",{});var Jn=a(ct);fs=l(Jn,"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."),Jn.forEach(o),lo=g(e),D=n(e,"H2",{class:!0});var yo=a(D);ee=n(yo,"A",{id:!0,class:!0,href:!0});var Xn=a(ee);Et=n(Xn,"SPAN",{});var Qn=a(Et);$(Ie.$$.fragment,Qn),Qn.forEach(o),Xn.forEach(o),us=g(yo),jt=n(yo,"SPAN",{});var ea=a(jt);gs=l(ea,"Swinv2Config"),ea.forEach(o),yo.forEach(o),co=g(e),E=n(e,"DIV",{class:!0});var me=a(E);$(xe.$$.fragment,me),_s=g(me),V=n(me,"P",{});var vt=a(V);vs=l(vt,"This is the configuration class to store the configuration of a "),pt=n(vt,"A",{href:!0});var ta=a(pt);ws=l(ta,"Swinv2Model"),ta.forEach(o),bs=l(vt,`. It is used to instantiate a Swin
Transformer v2 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 Swin Transformer v2
`),Ee=n(vt,"A",{href:!0,rel:!0});var oa=a(Ee);$s=l(oa,"microsoft/swinv2-tiny-patch4-window8-256"),oa.forEach(o),ys=l(vt,`
architecture.`),vt.forEach(o),Ss=g(me),H=n(me,"P",{});var wt=a(H);Ts=l(wt,"Configuration objects inherit from "),mt=n(wt,"A",{href:!0});var sa=a(mt);ks=l(sa,"PretrainedConfig"),sa.forEach(o),Ms=l(wt,` and can be used to control the model outputs. Read the
documentation from `),ht=n(wt,"A",{href:!0});var na=a(ht);Is=l(na,"PretrainedConfig"),na.forEach(o),xs=l(wt," for more information."),wt.forEach(o),Es=g(me),$(te.$$.fragment,me),me.forEach(o),po=g(e),W=n(e,"H2",{class:!0});var So=a(W);oe=n(So,"A",{id:!0,class:!0,href:!0});var aa=a(oe);Ft=n(aa,"SPAN",{});var ra=a(Ft);$(je.$$.fragment,ra),ra.forEach(o),aa.forEach(o),js=g(So),Pt=n(So,"SPAN",{});var ia=a(Pt);Fs=l(ia,"Swinv2Model"),ia.forEach(o),So.forEach(o),mo=g(e),A=n(e,"DIV",{class:!0});var bt=a(A);$(Fe.$$.fragment,bt),Ps=g(bt),Pe=n(bt,"P",{});var To=a(Pe);Cs=l(To,`The bare Swinv2 Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),Ce=n(To,"A",{href:!0,rel:!0});var la=a(Ce);As=l(la,"torch.nn.Module"),la.forEach(o),qs=l(To,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),To.forEach(o),zs=g(bt),F=n(bt,"DIV",{class:!0});var he=a(F);$(Ae.$$.fragment,he),Ns=g(he),R=n(he,"P",{});var $t=a(R);Os=l($t,"The "),ft=n($t,"A",{href:!0});var da=a(ft);Ls=l(da,"Swinv2Model"),da.forEach(o),Ds=l($t," forward method, overrides the "),Ct=n($t,"CODE",{});var ca=a(Ct);Vs=l(ca,"__call__"),ca.forEach(o),Hs=l($t," special method."),$t.forEach(o),Ws=g(he),$(se.$$.fragment,he),Rs=g(he),$(ne.$$.fragment,he),he.forEach(o),bt.forEach(o),ho=g(e),U=n(e,"H2",{class:!0});var ko=a(U);ae=n(ko,"A",{id:!0,class:!0,href:!0});var pa=a(ae);At=n(pa,"SPAN",{});var ma=a(At);$(qe.$$.fragment,ma),ma.forEach(o),pa.forEach(o),Us=g(ko),qt=n(ko,"SPAN",{});var ha=a(qt);Bs=l(ha,"Swinv2ForMaskedImageModeling"),ha.forEach(o),ko.forEach(o),fo=g(e),x=n(e,"DIV",{class:!0});var N=a(x);$(ze.$$.fragment,N),Zs=g(N),Ne=n(N,"P",{});var Mo=a(Ne);Ys=l(Mo,`Swinv2 Model with a decoder on top for masked image modeling, as proposed in
`),Oe=n(Mo,"A",{href:!0,rel:!0});var fa=a(Oe);Gs=l(fa,"SimMIM"),fa.forEach(o),Ks=l(Mo,"."),Mo.forEach(o),Js=g(N),$(re.$$.fragment,N),Xs=g(N),Le=n(N,"P",{});var Io=a(Le);Qs=l(Io,"This model is a PyTorch "),De=n(Io,"A",{href:!0,rel:!0});var ua=a(De);en=l(ua,"torch.nn.Module"),ua.forEach(o),tn=l(Io,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Io.forEach(o),on=g(N),P=n(N,"DIV",{class:!0});var fe=a(P);$(Ve.$$.fragment,fe),sn=g(fe),B=n(fe,"P",{});var yt=a(B);nn=l(yt,"The "),ut=n(yt,"A",{href:!0});var ga=a(ut);an=l(ga,"Swinv2ForMaskedImageModeling"),ga.forEach(o),rn=l(yt," forward method, overrides the "),zt=n(yt,"CODE",{});var _a=a(zt);ln=l(_a,"__call__"),_a.forEach(o),dn=l(yt," special method."),yt.forEach(o),cn=g(fe),$(ie.$$.fragment,fe),pn=g(fe),$(le.$$.fragment,fe),fe.forEach(o),N.forEach(o),uo=g(e),Z=n(e,"H2",{class:!0});var xo=a(Z);de=n(xo,"A",{id:!0,class:!0,href:!0});var va=a(de);Nt=n(va,"SPAN",{});var wa=a(Nt);$(He.$$.fragment,wa),wa.forEach(o),va.forEach(o),mn=g(xo),Ot=n(xo,"SPAN",{});var ba=a(Ot);hn=l(ba,"Swinv2ForImageClassification"),ba.forEach(o),xo.forEach(o),go=g(e),j=n(e,"DIV",{class:!0});var ue=a(j);$(We.$$.fragment,ue),fn=g(ue),Lt=n(ue,"P",{});var $a=a(Lt);un=l($a,`Swinv2 Model transformer with an image classification head on top (a linear layer on top of the final hidden state
of the [CLS] token) e.g. for ImageNet.`),$a.forEach(o),gn=g(ue),Re=n(ue,"P",{});var Eo=a(Re);_n=l(Eo,"This model is a PyTorch "),Ue=n(Eo,"A",{href:!0,rel:!0});var ya=a(Ue);vn=l(ya,"torch.nn.Module"),ya.forEach(o),wn=l(Eo,` sub-class. 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),bn=g(ue),C=n(ue,"DIV",{class:!0});var ge=a(C);$(Be.$$.fragment,ge),$n=g(ge),Y=n(ge,"P",{});var St=a(Y);yn=l(St,"The "),gt=n(St,"A",{href:!0});var Sa=a(gt);Sn=l(Sa,"Swinv2ForImageClassification"),Sa.forEach(o),Tn=l(St," forward method, overrides the "),Dt=n(St,"CODE",{});var Ta=a(Dt);kn=l(Ta,"__call__"),Ta.forEach(o),Mn=l(St," special method."),St.forEach(o),In=g(ge),$(ce.$$.fragment,ge),xn=g(ge),$(pe.$$.fragment,ge),ge.forEach(o),ue.forEach(o),this.h()},h(){c(d,"name","hf:doc:metadata"),c(d,"content",JSON.stringify(Da)),c(f,"id","swin-transformer-v2"),c(f,"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(f,"href","#swin-transformer-v2"),c(_,"class","relative group"),c(G,"id","overview"),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","#overview"),c(O,"class","relative group"),c(ve,"href","https://arxiv.org/abs/2111.09883"),c(ve,"rel","nofollow"),c(ot,"href","/docs/transformers/v4.27.1/en/model_doc/auto#transformers.AutoImageProcessor"),c(be,"href","https://huggingface.co/nandwalritik"),c(be,"rel","nofollow"),c($e,"href","https://github.com/microsoft/Swin-Transformer"),c($e,"rel","nofollow"),c(J,"id","resources"),c(J,"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(J,"href","#resources"),c(L,"class","relative group"),c(nt,"href","/docs/transformers/v4.27.1/en/model_doc/swinv2#transformers.Swinv2ForImageClassification"),c(Te,"href","https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-classification"),c(Te,"rel","nofollow"),c(ke,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/image_classification.ipynb"),c(ke,"rel","nofollow"),c(rt,"href","./tasks/image_classification"),c(dt,"href","/docs/transformers/v4.27.1/en/model_doc/swinv2#transformers.Swinv2ForMaskedImageModeling"),c(Me,"href","https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-pretraining"),c(Me,"rel","nofollow"),c(ee,"id","transformers.Swinv2Config"),c(ee,"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(ee,"href","#transformers.Swinv2Config"),c(D,"class","relative group"),c(pt,"href","/docs/transformers/v4.27.1/en/model_doc/swinv2#transformers.Swinv2Model"),c(Ee,"href","https://huggingface.co/microsoft/swinv2-tiny-patch4-window8-256"),c(Ee,"rel","nofollow"),c(mt,"href","/docs/transformers/v4.27.1/en/main_classes/configuration#transformers.PretrainedConfig"),c(ht,"href","/docs/transformers/v4.27.1/en/main_classes/configuration#transformers.PretrainedConfig"),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(oe,"id","transformers.Swinv2Model"),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.Swinv2Model"),c(W,"class","relative group"),c(Ce,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(Ce,"rel","nofollow"),c(ft,"href","/docs/transformers/v4.27.1/en/model_doc/swinv2#transformers.Swinv2Model"),c(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(ae,"id","transformers.Swinv2ForMaskedImageModeling"),c(ae,"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(ae,"href","#transformers.Swinv2ForMaskedImageModeling"),c(U,"class","relative group"),c(Oe,"href","https://arxiv.org/abs/2111.09886"),c(Oe,"rel","nofollow"),c(De,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(De,"rel","nofollow"),c(ut,"href","/docs/transformers/v4.27.1/en/model_doc/swinv2#transformers.Swinv2ForMaskedImageModeling"),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(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(de,"id","transformers.Swinv2ForImageClassification"),c(de,"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(de,"href","#transformers.Swinv2ForImageClassification"),c(Z,"class","relative group"),c(Ue,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(Ue,"rel","nofollow"),c(gt,"href","/docs/transformers/v4.27.1/en/model_doc/swinv2#transformers.Swinv2ForImageClassification"),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")},m(e,p){t(document.head,d),h(e,w,p),h(e,_,p),t(_,f),t(f,v),y(r,v,null),t(_,m),t(_,I),t(I,Ao),h(e,Yt,p),h(e,O,p),t(O,G),t(G,Tt),y(_e,Tt,null),t(O,qo),t(O,kt),t(kt,zo),h(e,Gt,p),h(e,K,p),t(K,No),t(K,ve),t(ve,Oo),t(K,Lo),h(e,Kt,p),h(e,Xe,p),t(Xe,Do),h(e,Jt,p),h(e,Qe,p),t(Qe,Mt),t(Mt,Vo),h(e,Xt,p),h(e,et,p),t(et,Ho),h(e,Qt,p),h(e,tt,p),t(tt,we),t(we,Wo),t(we,ot),t(ot,Ro),t(we,Uo),h(e,eo,p),h(e,q,p),t(q,Bo),t(q,be),t(be,Zo),t(q,Yo),t(q,$e),t($e,Go),t(q,Ko),h(e,to,p),h(e,L,p),t(L,J),t(J,It),y(ye,It,null),t(L,Jo),t(L,xt),t(xt,Xo),h(e,oo,p),h(e,st,p),t(st,Qo),h(e,so,p),y(Se,e,p),h(e,no,p),h(e,X,p),t(X,z),t(z,nt),t(nt,es),t(z,ts),t(z,Te),t(Te,os),t(z,ss),t(z,ke),t(ke,ns),t(z,as),t(X,rs),t(X,at),t(at,is),t(at,rt),t(rt,ls),h(e,ao,p),h(e,it,p),t(it,ds),h(e,ro,p),h(e,lt,p),t(lt,Q),t(Q,dt),t(dt,cs),t(Q,ps),t(Q,Me),t(Me,ms),t(Q,hs),h(e,io,p),h(e,ct,p),t(ct,fs),h(e,lo,p),h(e,D,p),t(D,ee),t(ee,Et),y(Ie,Et,null),t(D,us),t(D,jt),t(jt,gs),h(e,co,p),h(e,E,p),y(xe,E,null),t(E,_s),t(E,V),t(V,vs),t(V,pt),t(pt,ws),t(V,bs),t(V,Ee),t(Ee,$s),t(V,ys),t(E,Ss),t(E,H),t(H,Ts),t(H,mt),t(mt,ks),t(H,Ms),t(H,ht),t(ht,Is),t(H,xs),t(E,Es),y(te,E,null),h(e,po,p),h(e,W,p),t(W,oe),t(oe,Ft),y(je,Ft,null),t(W,js),t(W,Pt),t(Pt,Fs),h(e,mo,p),h(e,A,p),y(Fe,A,null),t(A,Ps),t(A,Pe),t(Pe,Cs),t(Pe,Ce),t(Ce,As),t(Pe,qs),t(A,zs),t(A,F),y(Ae,F,null),t(F,Ns),t(F,R),t(R,Os),t(R,ft),t(ft,Ls),t(R,Ds),t(R,Ct),t(Ct,Vs),t(R,Hs),t(F,Ws),y(se,F,null),t(F,Rs),y(ne,F,null),h(e,ho,p),h(e,U,p),t(U,ae),t(ae,At),y(qe,At,null),t(U,Us),t(U,qt),t(qt,Bs),h(e,fo,p),h(e,x,p),y(ze,x,null),t(x,Zs),t(x,Ne),t(Ne,Ys),t(Ne,Oe),t(Oe,Gs),t(Ne,Ks),t(x,Js),y(re,x,null),t(x,Xs),t(x,Le),t(Le,Qs),t(Le,De),t(De,en),t(Le,tn),t(x,on),t(x,P),y(Ve,P,null),t(P,sn),t(P,B),t(B,nn),t(B,ut),t(ut,an),t(B,rn),t(B,zt),t(zt,ln),t(B,dn),t(P,cn),y(ie,P,null),t(P,pn),y(le,P,null),h(e,uo,p),h(e,Z,p),t(Z,de),t(de,Nt),y(He,Nt,null),t(Z,mn),t(Z,Ot),t(Ot,hn),h(e,go,p),h(e,j,p),y(We,j,null),t(j,fn),t(j,Lt),t(Lt,un),t(j,gn),t(j,Re),t(Re,_n),t(Re,Ue),t(Ue,vn),t(Re,wn),t(j,bn),t(j,C),y(Be,C,null),t(C,$n),t(C,Y),t(Y,yn),t(Y,gt),t(gt,Sn),t(Y,Tn),t(Y,Dt),t(Dt,kn),t(Y,Mn),t(C,In),y(ce,C,null),t(C,xn),y(pe,C,null),_o=!0},p(e,[p]){const Ze={};p&2&&(Ze.$$scope={dirty:p,ctx:e}),te.$set(Ze);const Vt={};p&2&&(Vt.$$scope={dirty:p,ctx:e}),se.$set(Vt);const Ht={};p&2&&(Ht.$$scope={dirty:p,ctx:e}),ne.$set(Ht);const Wt={};p&2&&(Wt.$$scope={dirty:p,ctx:e}),re.$set(Wt);const Ye={};p&2&&(Ye.$$scope={dirty:p,ctx:e}),ie.$set(Ye);const Rt={};p&2&&(Rt.$$scope={dirty:p,ctx:e}),le.$set(Rt);const Ut={};p&2&&(Ut.$$scope={dirty:p,ctx:e}),ce.$set(Ut);const Bt={};p&2&&(Bt.$$scope={dirty:p,ctx:e}),pe.$set(Bt)},i(e){_o||(S(r.$$.fragment,e),S(_e.$$.fragment,e),S(ye.$$.fragment,e),S(Se.$$.fragment,e),S(Ie.$$.fragment,e),S(xe.$$.fragment,e),S(te.$$.fragment,e),S(je.$$.fragment,e),S(Fe.$$.fragment,e),S(Ae.$$.fragment,e),S(se.$$.fragment,e),S(ne.$$.fragment,e),S(qe.$$.fragment,e),S(ze.$$.fragment,e),S(re.$$.fragment,e),S(Ve.$$.fragment,e),S(ie.$$.fragment,e),S(le.$$.fragment,e),S(He.$$.fragment,e),S(We.$$.fragment,e),S(Be.$$.fragment,e),S(ce.$$.fragment,e),S(pe.$$.fragment,e),_o=!0)},o(e){T(r.$$.fragment,e),T(_e.$$.fragment,e),T(ye.$$.fragment,e),T(Se.$$.fragment,e),T(Ie.$$.fragment,e),T(xe.$$.fragment,e),T(te.$$.fragment,e),T(je.$$.fragment,e),T(Fe.$$.fragment,e),T(Ae.$$.fragment,e),T(se.$$.fragment,e),T(ne.$$.fragment,e),T(qe.$$.fragment,e),T(ze.$$.fragment,e),T(re.$$.fragment,e),T(Ve.$$.fragment,e),T(ie.$$.fragment,e),T(le.$$.fragment,e),T(He.$$.fragment,e),T(We.$$.fragment,e),T(Be.$$.fragment,e),T(ce.$$.fragment,e),T(pe.$$.fragment,e),_o=!1},d(e){o(d),e&&o(w),e&&o(_),k(r),e&&o(Yt),e&&o(O),k(_e),e&&o(Gt),e&&o(K),e&&o(Kt),e&&o(Xe),e&&o(Jt),e&&o(Qe),e&&o(Xt),e&&o(et),e&&o(Qt),e&&o(tt),e&&o(eo),e&&o(q),e&&o(to),e&&o(L),k(ye),e&&o(oo),e&&o(st),e&&o(so),k(Se,e),e&&o(no),e&&o(X),e&&o(ao),e&&o(it),e&&o(ro),e&&o(lt),e&&o(io),e&&o(ct),e&&o(lo),e&&o(D),k(Ie),e&&o(co),e&&o(E),k(xe),k(te),e&&o(po),e&&o(W),k(je),e&&o(mo),e&&o(A),k(Fe),k(Ae),k(se),k(ne),e&&o(ho),e&&o(U),k(qe),e&&o(fo),e&&o(x),k(ze),k(re),k(Ve),k(ie),k(le),e&&o(uo),e&&o(Z),k(He),e&&o(go),e&&o(j),k(We),k(Be),k(ce),k(pe)}}}const Da={local:"swin-transformer-v2",sections:[{local:"overview",title:"Overview"},{local:"resources",title:"Resources"},{local:"transformers.Swinv2Config",title:"Swinv2Config"},{local:"transformers.Swinv2Model",title:"Swinv2Model"},{local:"transformers.Swinv2ForMaskedImageModeling",title:"Swinv2ForMaskedImageModeling"},{local:"transformers.Swinv2ForImageClassification",title:"Swinv2ForImageClassification"}],title:"Swin Transformer V2"};function Va(M){return Ea(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ga extends ka{constructor(d){super();Ma(this,d,Va,La,Ia,{})}}export{Ga as default,Da as metadata};
