import{S as Dn,i as Rn,s as Bn,e as s,k as h,w,t as o,M as Hn,c as n,d as a,m as f,a as i,x as $,h as r,b as c,N as Un,G as e,g as v,y as L,q as y,o as T,B as x,v as Jn,L as Ya}from"../../chunks/vendor-hf-doc-builder.js";import{T as Ga}from"../../chunks/Tip-hf-doc-builder.js";import{D as oe}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Za}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as rt}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Xa}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Gn(I){let d,b,u,p,_;return p=new Za({props:{code:`from transformers import LevitModel, LevitConfig

# Initializing a LeViT levit-base-192 style configuration
configuration = LevitConfig()

# Initializing a model from the levit-base-192 style configuration
model = LevitModel(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> LevitModel, LevitConfig

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a LeViT levit-base-192 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = LevitConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model from the levit-base-192 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = LevitModel(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"),b=o("Example:"),u=h(),w(p.$$.fragment)},l(l){d=n(l,"P",{});var g=i(d);b=r(g,"Example:"),g.forEach(a),u=f(l),$(p.$$.fragment,l)},m(l,g){v(l,d,g),e(d,b),v(l,u,g),L(p,l,g),_=!0},p:Ya,i(l){_||(y(p.$$.fragment,l),_=!0)},o(l){T(p.$$.fragment,l),_=!1},d(l){l&&a(d),l&&a(u),x(p,l)}}}function Xn(I){let d,b;return{c(){d=s("p"),b=o(`NumPy arrays and PyTorch tensors are converted to PIL images when resizing, so the most efficient is to pass
PIL images.`)},l(u){d=n(u,"P",{});var p=i(d);b=r(p,`NumPy arrays and PyTorch tensors are converted to PIL images when resizing, so the most efficient is to pass
PIL images.`),p.forEach(a)},m(u,p){v(u,d,p),e(d,b)},d(u){u&&a(d)}}}function Yn(I){let d,b,u,p,_;return{c(){d=s("p"),b=o("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=s("code"),p=o("Module"),_=o(`
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){d=n(l,"P",{});var g=i(d);b=r(g,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=n(g,"CODE",{});var j=i(u);p=r(j,"Module"),j.forEach(a),_=r(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(a)},m(l,g){v(l,d,g),e(d,b),e(d,u),e(u,p),e(d,_)},d(l){l&&a(d)}}}function Zn(I){let d,b,u,p,_;return p=new Za({props:{code:`from transformers import LevitFeatureExtractor, LevitModel
import torch
from datasets import load_dataset

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

feature_extractor = LevitFeatureExtractor.from_pretrained("facebook/levit-128S")
model = LevitModel.from_pretrained("facebook/levit-128S")

inputs = feature_extractor(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> LevitFeatureExtractor, LevitModel
<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>feature_extractor = LevitFeatureExtractor.from_pretrained(<span class="hljs-string">&quot;facebook/levit-128S&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = LevitModel.from_pretrained(<span class="hljs-string">&quot;facebook/levit-128S&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = feature_extractor(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">16</span>, <span class="hljs-number">384</span>]`}}),{c(){d=s("p"),b=o("Example:"),u=h(),w(p.$$.fragment)},l(l){d=n(l,"P",{});var g=i(d);b=r(g,"Example:"),g.forEach(a),u=f(l),$(p.$$.fragment,l)},m(l,g){v(l,d,g),e(d,b),v(l,u,g),L(p,l,g),_=!0},p:Ya,i(l){_||(y(p.$$.fragment,l),_=!0)},o(l){T(p.$$.fragment,l),_=!1},d(l){l&&a(d),l&&a(u),x(p,l)}}}function Kn(I){let d,b,u,p,_;return{c(){d=s("p"),b=o("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=s("code"),p=o("Module"),_=o(`
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){d=n(l,"P",{});var g=i(d);b=r(g,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=n(g,"CODE",{});var j=i(u);p=r(j,"Module"),j.forEach(a),_=r(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(a)},m(l,g){v(l,d,g),e(d,b),e(d,u),e(u,p),e(d,_)},d(l){l&&a(d)}}}function Qn(I){let d,b,u,p,_;return p=new Za({props:{code:`from transformers import LevitFeatureExtractor, LevitForImageClassification
import torch
from datasets import load_dataset

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

feature_extractor = LevitFeatureExtractor.from_pretrained("facebook/levit-128S")
model = LevitForImageClassification.from_pretrained("facebook/levit-128S")

inputs = feature_extractor(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> LevitFeatureExtractor, LevitForImageClassification
<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>feature_extractor = LevitFeatureExtractor.from_pretrained(<span class="hljs-string">&quot;facebook/levit-128S&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = LevitForImageClassification.from_pretrained(<span class="hljs-string">&quot;facebook/levit-128S&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = feature_extractor(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])
tabby, tabby cat`}}),{c(){d=s("p"),b=o("Example:"),u=h(),w(p.$$.fragment)},l(l){d=n(l,"P",{});var g=i(d);b=r(g,"Example:"),g.forEach(a),u=f(l),$(p.$$.fragment,l)},m(l,g){v(l,d,g),e(d,b),v(l,u,g),L(p,l,g),_=!0},p:Ya,i(l){_||(y(p.$$.fragment,l),_=!0)},o(l){T(p.$$.fragment,l),_=!1},d(l){l&&a(d),l&&a(u),x(p,l)}}}function ei(I){let d,b,u,p,_;return{c(){d=s("p"),b=o("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=s("code"),p=o("Module"),_=o(`
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){d=n(l,"P",{});var g=i(d);b=r(g,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=n(g,"CODE",{});var j=i(u);p=r(j,"Module"),j.forEach(a),_=r(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(a)},m(l,g){v(l,d,g),e(d,b),e(d,u),e(u,p),e(d,_)},d(l){l&&a(d)}}}function ti(I){let d,b,u,p,_;return p=new Za({props:{code:`from transformers import LevitFeatureExtractor, LevitForImageClassificationWithTeacher
import torch
from datasets import load_dataset

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

feature_extractor = LevitFeatureExtractor.from_pretrained("facebook/levit-128S")
model = LevitForImageClassificationWithTeacher.from_pretrained("facebook/levit-128S")

inputs = feature_extractor(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> LevitFeatureExtractor, LevitForImageClassificationWithTeacher
<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>feature_extractor = LevitFeatureExtractor.from_pretrained(<span class="hljs-string">&quot;facebook/levit-128S&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = LevitForImageClassificationWithTeacher.from_pretrained(<span class="hljs-string">&quot;facebook/levit-128S&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = feature_extractor(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])
tabby, tabby cat`}}),{c(){d=s("p"),b=o("Example:"),u=h(),w(p.$$.fragment)},l(l){d=n(l,"P",{});var g=i(d);b=r(g,"Example:"),g.forEach(a),u=f(l),$(p.$$.fragment,l)},m(l,g){v(l,d,g),e(d,b),v(l,u,g),L(p,l,g),_=!0},p:Ya,i(l){_||(y(p.$$.fragment,l),_=!0)},o(l){T(p.$$.fragment,l),_=!1},d(l){l&&a(d),l&&a(u),x(p,l)}}}function ai(I){let d,b,u,p,_,l,g,j,Ka,va,H,re,St,Ie,Qa,qt,eo,_a,D,to,Fe,ao,oo,st,ro,so,ba,nt,no,wa,it,Ot,io,$a,se,As,La,ne,lo,lt,co,ho,ya,ct,fo,Ta,C,Dt,mo,po,U,uo,dt,go,vo,ht,_o,bo,wo,ke,$o,Ce,Lo,yo,To,E,xo,ft,Eo,Io,mt,Fo,ko,Rt,Co,jo,Bt,Po,Ao,Ht,Mo,zo,Ut,No,Vo,Jt,Wo,So,pt,qo,Oo,Do,ut,gt,Ro,Bo,Ho,k,Uo,je,Jo,Go,vt,Xo,Yo,_t,Zo,Ko,bt,Qo,er,wt,tr,ar,$t,or,rr,xa,R,sr,Pe,nr,ir,Ae,lr,cr,Ea,J,ie,Gt,Me,dr,Xt,hr,Ia,A,ze,fr,G,mr,Lt,pr,ur,Ne,gr,vr,_r,X,br,yt,wr,$r,Tt,Lr,yr,Tr,le,Fa,Y,ce,Yt,Ve,xr,Zt,Er,ka,M,We,Ir,Kt,Fr,kr,Se,Cr,xt,jr,Pr,Ar,B,qe,Mr,Qt,zr,Nr,de,Ca,Z,he,ea,Oe,Vr,ta,Wr,ja,O,De,Sr,Re,qr,Be,Or,Dr,Rr,V,He,Br,K,Hr,Et,Ur,Jr,aa,Gr,Xr,Yr,fe,Zr,me,Pa,Q,pe,oa,Ue,Kr,ra,Qr,Aa,z,Je,es,sa,ts,as,Ge,os,Xe,rs,ss,ns,W,Ye,is,ee,ls,It,cs,ds,na,hs,fs,ms,ue,ps,ge,Ma,te,ve,ia,Ze,us,la,gs,za,N,Ke,vs,ca,_s,bs,Qe,ws,et,$s,Ls,ys,S,tt,Ts,ae,xs,Ft,Es,Is,da,Fs,ks,Cs,_e,js,be,Na;return l=new rt({}),Ie=new rt({}),Me=new rt({}),ze=new oe({props:{name:"class transformers.LevitConfig",anchor:"transformers.LevitConfig",parameters:[{name:"image_size",val:" = 224"},{name:"num_channels",val:" = 3"},{name:"kernel_size",val:" = 3"},{name:"stride",val:" = 2"},{name:"padding",val:" = 1"},{name:"patch_size",val:" = 16"},{name:"hidden_sizes",val:" = [128, 256, 384]"},{name:"num_attention_heads",val:" = [4, 8, 12]"},{name:"depths",val:" = [4, 4, 4]"},{name:"key_dim",val:" = [16, 16, 16]"},{name:"drop_path_rate",val:" = 0"},{name:"mlp_ratio",val:" = [2, 2, 2]"},{name:"attention_ratio",val:" = [2, 2, 2]"},{name:"initializer_range",val:" = 0.02"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.LevitConfig.image_size",description:`<strong>image_size</strong> (<code>int</code>, <em>optional</em>, defaults to 224) &#x2014;
The size of the input image.`,name:"image_size"},{anchor:"transformers.LevitConfig.num_channels",description:`<strong>num_channels</strong> (<code>int</code>, <em>optional</em>, defaults to 3) &#x2014;
Number of channels in the input image.`,name:"num_channels"},{anchor:"transformers.LevitConfig.kernel_size",description:`<strong>kernel_size</strong> (<code>int</code>, <em>optional</em>, defaults to 3) &#x2014;
The kernel size for the initial convolution layers of patch embedding.`,name:"kernel_size"},{anchor:"transformers.LevitConfig.stride",description:`<strong>stride</strong> (<code>int</code>, <em>optional</em>, defaults to 2) &#x2014;
The stride size for the initial convolution layers of patch embedding.`,name:"stride"},{anchor:"transformers.LevitConfig.padding",description:`<strong>padding</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The padding size for the initial convolution layers of patch embedding.`,name:"padding"},{anchor:"transformers.LevitConfig.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, <em>optional</em>, defaults to 16) &#x2014;
The patch size for embeddings.`,name:"patch_size"},{anchor:"transformers.LevitConfig.hidden_sizes",description:`<strong>hidden_sizes</strong> (<code>List[int]</code>, <em>optional</em>, defaults to <code>[128, 256, 384]</code>) &#x2014;
Dimension of each of the encoder blocks.`,name:"hidden_sizes"},{anchor:"transformers.LevitConfig.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>List[int]</code>, <em>optional</em>, defaults to <code>[4, 8, 12]</code>) &#x2014;
Number of attention heads for each attention layer in each block of the Transformer encoder.`,name:"num_attention_heads"},{anchor:"transformers.LevitConfig.depths",description:`<strong>depths</strong> (<code>List[int]</code>, <em>optional</em>, defaults to <code>[4, 4, 4]</code>) &#x2014;
The number of layers in each encoder block.`,name:"depths"},{anchor:"transformers.LevitConfig.key_dim",description:`<strong>key_dim</strong> (<code>List[int]</code>, <em>optional</em>, defaults to <code>[16, 16, 16]</code>) &#x2014;
The size of key in each of the encoder blocks.`,name:"key_dim"},{anchor:"transformers.LevitConfig.drop_path_rate",description:`<strong>drop_path_rate</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
The dropout probability for stochastic depths, used in the blocks of the Transformer encoder.`,name:"drop_path_rate"},{anchor:"transformers.LevitConfig.mlp_ratios",description:`<strong>mlp_ratios</strong> (<code>List[int]</code>, <em>optional</em>, defaults to <code>[2, 2, 2]</code>) &#x2014;
Ratio of the size of the hidden layer compared to the size of the input layer of the Mix FFNs in the
encoder blocks.`,name:"mlp_ratios"},{anchor:"transformers.LevitConfig.attention_ratios",description:`<strong>attention_ratios</strong> (<code>List[int]</code>, <em>optional</em>, defaults to <code>[2, 2, 2]</code>) &#x2014;
Ratio of the size of the output dimension compared to input dimension of attention layers.`,name:"attention_ratios"},{anchor:"transformers.LevitConfig.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"}],source:"https://github.com/huggingface/transformers/blob/vr_17548/src/transformers/models/levit/configuration_levit.py#L29"}}),le=new Xa({props:{anchor:"transformers.LevitConfig.example",$$slots:{default:[Gn]},$$scope:{ctx:I}}}),Ve=new rt({}),We=new oe({props:{name:"class transformers.LevitFeatureExtractor",anchor:"transformers.LevitFeatureExtractor",parameters:[{name:"do_resize",val:" = True"},{name:"size",val:" = 224"},{name:"resample",val:" = <Resampling.BICUBIC: 3>"},{name:"do_center_crop",val:" = True"},{name:"do_normalize",val:" = True"},{name:"image_mean",val:" = [0.485, 0.456, 0.406]"},{name:"image_std",val:" = [0.229, 0.224, 0.225]"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.LevitFeatureExtractor.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to resize the shortest edge of the input to int(256/224 *<code>size</code>).`,name:"do_resize"},{anchor:"transformers.LevitFeatureExtractor.size",description:`<strong>size</strong> (<code>int</code> or <code>Tuple(int)</code>, <em>optional</em>, defaults to 224) &#x2014;
Resize the input to the given size. If a tuple is provided, it should be (width, height). If only an
integer is provided, then shorter side of input will be resized to &#x2018;size&#x2019;.`,name:"size"},{anchor:"transformers.LevitFeatureExtractor.resample",description:`<strong>resample</strong> (<code>int</code>, <em>optional</em>, defaults to <code>PIL.Image.BICUBIC</code>) &#x2014;
An optional resampling filter. This can be one of <code>PIL.Image.NEAREST</code>, <code>PIL.Image.BOX</code>,
<code>PIL.Image.BILINEAR</code>, <code>PIL.Image.HAMMING</code>, <code>PIL.Image.BICUBIC</code> or <code>PIL.Image.LANCZOS</code>. Only has an effect
if <code>do_resize</code> is set to <code>True</code>.`,name:"resample"},{anchor:"transformers.LevitFeatureExtractor.do_center_crop",description:`<strong>do_center_crop</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to center crop the input to <code>size</code>.`,name:"do_center_crop"},{anchor:"transformers.LevitFeatureExtractor.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to normalize the input with mean and standard deviation.`,name:"do_normalize"},{anchor:"transformers.LevitFeatureExtractor.image_mean",description:`<strong>image_mean</strong> (<code>List[int]</code>, defaults to <code>[0.229, 0.224, 0.225]</code>) &#x2014;
The sequence of means for each channel, to be used when normalizing images.`,name:"image_mean"},{anchor:"transformers.LevitFeatureExtractor.image_std",description:`<strong>image_std</strong> (<code>List[int]</code>, defaults to <code>[0.485, 0.456, 0.406]</code>) &#x2014;
The sequence of standard deviations for each channel, to be used when normalizing images.`,name:"image_std"}],source:"https://github.com/huggingface/transformers/blob/vr_17548/src/transformers/models/levit/feature_extraction_levit.py#L36"}}),qe=new oe({props:{name:"__call__",anchor:"transformers.LevitFeatureExtractor.__call__",parameters:[{name:"images",val:": typing.Union[PIL.Image.Image, numpy.ndarray, ForwardRef('torch.Tensor'), typing.List[PIL.Image.Image], typing.List[numpy.ndarray], typing.List[ForwardRef('torch.Tensor')]]"},{name:"return_tensors",val:": typing.Union[str, transformers.utils.generic.TensorType, NoneType] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.LevitFeatureExtractor.__call__.images",description:`<strong>images</strong> (<code>PIL.Image.Image</code>, <code>np.ndarray</code>, <code>torch.Tensor</code>, <code>List[PIL.Image.Image]</code>, <code>List[np.ndarray]</code>, <code>List[torch.Tensor]</code>) &#x2014;
The image or batch of images to be prepared. Each image can be a PIL image, NumPy array or PyTorch
tensor. In case of a NumPy array/PyTorch tensor, each image should be of shape (C, H, W), where C is a
number of channels, H and W are image height and width.`,name:"images"},{anchor:"transformers.LevitFeatureExtractor.__call__.return_tensors",description:`<strong>return_tensors</strong> (<code>str</code> or <a href="/docs/transformers/pr_17548/en/internal/file_utils#transformers.TensorType">TensorType</a>, <em>optional</em>, defaults to <code>&apos;np&apos;</code>) &#x2014;
If set, will return tensors of a particular framework. Acceptable values are:</p>
<ul>
<li><code>&apos;tf&apos;</code>: Return TensorFlow <code>tf.constant</code> objects.</li>
<li><code>&apos;pt&apos;</code>: Return PyTorch <code>torch.Tensor</code> objects.</li>
<li><code>&apos;np&apos;</code>: Return NumPy <code>np.ndarray</code> objects.</li>
<li><code>&apos;jax&apos;</code>: Return JAX <code>jnp.ndarray</code> objects.</li>
</ul>`,name:"return_tensors"}],source:"https://github.com/huggingface/transformers/blob/vr_17548/src/transformers/models/levit/feature_extraction_levit.py#L85",returnDescription:`
<p>A <a
  href="/docs/transformers/pr_17548/en/main_classes/feature_extractor#transformers.BatchFeature"
>BatchFeature</a> with the following fields:</p>
<ul>
<li><strong>pixel_values</strong> \u2014 Pixel values to be fed to a model, of shape (batch_size, num_channels, height,
width).</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/pr_17548/en/main_classes/feature_extractor#transformers.BatchFeature"
>BatchFeature</a></p>
`}}),de=new Ga({props:{warning:!0,$$slots:{default:[Xn]},$$scope:{ctx:I}}}),Oe=new rt({}),De=new oe({props:{name:"class transformers.LevitModel",anchor:"transformers.LevitModel",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.LevitModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_17548/en/model_doc/levit#transformers.LevitConfig">LevitConfig</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/pr_17548/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/vr_17548/src/transformers/models/levit/modeling_levit.py#L535"}}),He=new oe({props:{name:"forward",anchor:"transformers.LevitModel.forward",parameters:[{name:"pixel_values",val:": FloatTensor = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.LevitModel.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/pr_17548/en/model_doc/auto#transformers.AutoFeatureExtractor">AutoFeatureExtractor</a>. See
<code>AutoFeatureExtractor.__call__()</code> for details.`,name:"pixel_values"},{anchor:"transformers.LevitModel.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.LevitModel.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/pr_17548/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/vr_17548/src/transformers/models/levit/modeling_levit.py#L544",returnDescription:`
<p>A <code>transformers.modeling_outputs.BaseModelOutputWithPoolingAndNoAttention</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/pr_17548/en/model_doc/levit#transformers.LevitConfig"
>LevitConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</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>) \u2014 Last layer hidden-state after a pooling operation on the spatial dimensions.</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, num_channels, height, width)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
</ul>
`,returnType:`
<p><code>transformers.modeling_outputs.BaseModelOutputWithPoolingAndNoAttention</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),fe=new Ga({props:{$$slots:{default:[Yn]},$$scope:{ctx:I}}}),me=new Xa({props:{anchor:"transformers.LevitModel.forward.example",$$slots:{default:[Zn]},$$scope:{ctx:I}}}),Ue=new rt({}),Je=new oe({props:{name:"class transformers.LevitForImageClassification",anchor:"transformers.LevitForImageClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.LevitForImageClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_17548/en/model_doc/levit#transformers.LevitConfig">LevitConfig</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/pr_17548/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/vr_17548/src/transformers/models/levit/modeling_levit.py#L596"}}),Ye=new oe({props:{name:"forward",anchor:"transformers.LevitForImageClassification.forward",parameters:[{name:"pixel_values",val:": FloatTensor = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.LevitForImageClassification.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/pr_17548/en/model_doc/auto#transformers.AutoFeatureExtractor">AutoFeatureExtractor</a>. See
<code>AutoFeatureExtractor.__call__()</code> for details.`,name:"pixel_values"},{anchor:"transformers.LevitForImageClassification.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.LevitForImageClassification.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/pr_17548/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.LevitForImageClassification.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/vr_17548/src/transformers/models/levit/modeling_levit.py#L613",returnDescription:`
<p>A <a
  href="/docs/transformers/pr_17548/en/main_classes/output#transformers.modeling_outputs.ImageClassifierOutputWithNoAttention"
>transformers.modeling_outputs.ImageClassifierOutputWithNoAttention</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/pr_17548/en/model_doc/levit#transformers.LevitConfig"
>LevitConfig</a>) and inputs.</p>
<ul>
<li><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.</li>
<li><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).</li>
<li><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \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, num_channels, height, width)</code>. Hidden-states (also
called feature maps) of the model at the output of each stage.</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/pr_17548/en/main_classes/output#transformers.modeling_outputs.ImageClassifierOutputWithNoAttention"
>transformers.modeling_outputs.ImageClassifierOutputWithNoAttention</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ue=new Ga({props:{$$slots:{default:[Kn]},$$scope:{ctx:I}}}),ge=new Xa({props:{anchor:"transformers.LevitForImageClassification.forward.example",$$slots:{default:[Qn]},$$scope:{ctx:I}}}),Ze=new rt({}),Ke=new oe({props:{name:"class transformers.LevitForImageClassificationWithTeacher",anchor:"transformers.LevitForImageClassificationWithTeacher",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.LevitForImageClassificationWithTeacher.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_17548/en/model_doc/levit#transformers.LevitConfig">LevitConfig</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/pr_17548/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/vr_17548/src/transformers/models/levit/modeling_levit.py#L684"}}),tt=new oe({props:{name:"forward",anchor:"transformers.LevitForImageClassificationWithTeacher.forward",parameters:[{name:"pixel_values",val:": FloatTensor = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.LevitForImageClassificationWithTeacher.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/pr_17548/en/model_doc/auto#transformers.AutoFeatureExtractor">AutoFeatureExtractor</a>. See
<code>AutoFeatureExtractor.__call__()</code> for details.`,name:"pixel_values"},{anchor:"transformers.LevitForImageClassificationWithTeacher.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.LevitForImageClassificationWithTeacher.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/pr_17548/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/vr_17548/src/transformers/models/levit/modeling_levit.py#L706",returnDescription:`
<p>A <code>transformers.models.levit.modeling_levit.LevitForImageClassificationWithTeacherOutput</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/pr_17548/en/model_doc/levit#transformers.LevitConfig"
>LevitConfig</a>) and inputs.</p>
<ul>
<li><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.num_labels)</code>) \u2014 Prediction scores as the average of the <code>cls_logits</code> and <code>distillation_logits</code>.</li>
<li><strong>cls_logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.num_labels)</code>) \u2014 Prediction scores of the classification head (i.e. the linear layer on top of the final hidden state of the
class token).</li>
<li><strong>distillation_logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.num_labels)</code>) \u2014 Prediction scores of the distillation head (i.e. the linear layer on top of the final hidden state of the
distillation token).</li>
<li><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings + one for the output of each layer) of
shape <code>(batch_size, sequence_length, hidden_size)</code>. Hidden-states of the model at the output of each layer
plus the initial embedding outputs.</li>
</ul>
`,returnType:`
<p><code>transformers.models.levit.modeling_levit.LevitForImageClassificationWithTeacherOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),_e=new Ga({props:{$$slots:{default:[ei]},$$scope:{ctx:I}}}),be=new Xa({props:{anchor:"transformers.LevitForImageClassificationWithTeacher.forward.example",$$slots:{default:[ti]},$$scope:{ctx:I}}}),{c(){d=s("meta"),b=h(),u=s("h1"),p=s("a"),_=s("span"),w(l.$$.fragment),g=h(),j=s("span"),Ka=o("LeViT"),va=h(),H=s("h2"),re=s("a"),St=s("span"),w(Ie.$$.fragment),Qa=h(),qt=s("span"),eo=o("Overview"),_a=h(),D=s("p"),to=o("The LeViT model was proposed in "),Fe=s("a"),ao=o("LeViT: Introducing Convolutions to Vision Transformers"),oo=o(" by Ben Graham, Alaaeldin El-Nouby, Hugo Touvron, Pierre Stock, Armand Joulin, Herv\xE9 J\xE9gou, Matthijs Douze. LeViT improves the "),st=s("a"),ro=o("Vision Transformer (ViT)"),so=o(" in performance and efficiency by a few architectural differences such as activation maps with decreasing resolutions in Transformers and the introduction of an attention bias to integrate positional information."),ba=h(),nt=s("p"),no=o("The abstract from the paper is the following:"),wa=h(),it=s("p"),Ot=s("em"),io=o(`We design a family of image classification architectures that optimize the trade-off between accuracy
and efficiency in a high-speed regime. Our work exploits recent findings in attention-based architectures,
which are competitive on highly parallel processing hardware. We revisit principles from the extensive
literature on convolutional neural networks to apply them to transformers, in particular activation maps
with decreasing resolutions. We also introduce the attention bias, a new way to integrate positional information
in vision transformers. As a result, we propose LeVIT: a hybrid neural network for fast inference image classification.
We consider different measures of efficiency on different hardware platforms, so as to best reflect a wide range of
application scenarios. Our extensive experiments empirically validate our technical choices and show they are suitable
to most architectures. Overall, LeViT significantly outperforms existing convnets and vision transformers with respect
to the speed/accuracy tradeoff. For example, at 80% ImageNet top-1 accuracy, LeViT is 5 times faster than EfficientNet on CPU.`),$a=h(),se=s("img"),La=h(),ne=s("small"),lo=o("LeViT Architecture. Taken from the "),lt=s("a"),co=o("original paper"),ho=o("."),ya=h(),ct=s("p"),fo=o("Tips:"),Ta=h(),C=s("ul"),Dt=s("li"),mo=o("Compared to ViT, LeViT models use an additional distillation head to effectively learn from a teacher (which, in the LeViT paper, is a ResNet like-model). The distillation head is learned through backpropagation under supervision of a ResNet like-model. They also draw inspiration from convolution neural networks to use activation maps with decreasing resolutions to increase the efficiency."),po=h(),U=s("li"),uo=o(`There are 2 ways to fine-tune distilled models, either (1) in a classic way, by only placing a prediction head on top
of the final hidden state and not using the distillation head, or (2) by placing both a prediction head and distillation
head on top of the final hidden state. In that case, the prediction head is trained using regular cross-entropy between
the prediction of the head and the ground-truth label, while the distillation prediction head is trained using hard distillation
(cross-entropy between the prediction of the distillation head and the label predicted by the teacher). At inference time,
one takes the average prediction between both heads as final prediction. (2) is also called \u201Cfine-tuning with distillation\u201D,
because one relies on a teacher that has already been fine-tuned on the downstream dataset. In terms of models, (1) corresponds
to `),dt=s("a"),go=o("LevitForImageClassification"),vo=o(" and (2) corresponds to "),ht=s("a"),_o=o("LevitForImageClassificationWithTeacher"),bo=o("."),wo=h(),ke=s("li"),$o=o("All released checkpoints were pre-trained and fine-tuned on  "),Ce=s("a"),Lo=o("ImageNet-1k"),yo=o(`
(also referred to as ILSVRC 2012, a collection of 1.3 million images and 1,000 classes). only. No external data was used. This is in
contrast with the original ViT model, which used external data like the JFT-300M dataset/Imagenet-21k for
pre-training.`),To=h(),E=s("li"),xo=o("The authors of LeViT released 5 trained LeViT models, which you can directly plug into "),ft=s("a"),Eo=o("LevitModel"),Io=o(" or "),mt=s("a"),Fo=o("LevitForImageClassification"),ko=o(`.
Techniques like data augmentation, optimization, and regularization were used in order to simulate training on a much larger dataset
(while only using ImageNet-1k for pre-training). The 5 variants available are (all trained on images of size 224x224):
`),Rt=s("em"),Co=o("facebook/levit-128S"),jo=o(", "),Bt=s("em"),Po=o("facebook/levit-128"),Ao=o(", "),Ht=s("em"),Mo=o("facebook/levit-192"),zo=o(", "),Ut=s("em"),No=o("facebook/levit-256"),Vo=o(` and
`),Jt=s("em"),Wo=o("facebook/levit-384"),So=o(". Note that one should use "),pt=s("a"),qo=o("LevitFeatureExtractor"),Oo=o(` in order to
prepare images for the model.`),Do=h(),ut=s("li"),gt=s("a"),Ro=o("LevitForImageClassificationWithTeacher"),Bo=o(" currently supports only inference and not training or fine-tuning."),Ho=h(),k=s("li"),Uo=o("You can check out demo notebooks regarding inference as well as fine-tuning on custom data "),je=s("a"),Jo=o("here"),Go=o(`
(you can just replace `),vt=s("a"),Xo=o("ViTFeatureExtractor"),Yo=o(" by "),_t=s("a"),Zo=o("LevitFeatureExtractor"),Ko=o(" and "),bt=s("a"),Qo=o("ViTForImageClassification"),er=o(" by "),wt=s("a"),tr=o("LevitForImageClassification"),ar=o(" or "),$t=s("a"),or=o("LevitForImageClassificationWithTeacher"),rr=o(")."),xa=h(),R=s("p"),sr=o("This model was contributed by "),Pe=s("a"),nr=o("anugunj"),ir=o(". The original code can be found "),Ae=s("a"),lr=o("here"),cr=o("."),Ea=h(),J=s("h2"),ie=s("a"),Gt=s("span"),w(Me.$$.fragment),dr=h(),Xt=s("span"),hr=o("LevitConfig"),Ia=h(),A=s("div"),w(ze.$$.fragment),fr=h(),G=s("p"),mr=o("This is the configuration class to store the configuration of a "),Lt=s("a"),pr=o("LevitModel"),ur=o(`. It is used to instantiate a LeViT
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 LeViT
`),Ne=s("a"),gr=o("facebook/levit-base-192"),vr=o(" architecture."),_r=h(),X=s("p"),br=o("Configuration objects inherit from "),yt=s("a"),wr=o("PretrainedConfig"),$r=o(` and can be used to control the model outputs. Read the
documentation from `),Tt=s("a"),Lr=o("PretrainedConfig"),yr=o(" for more information."),Tr=h(),w(le.$$.fragment),Fa=h(),Y=s("h2"),ce=s("a"),Yt=s("span"),w(Ve.$$.fragment),xr=h(),Zt=s("span"),Er=o("LevitFeatureExtractor"),ka=h(),M=s("div"),w(We.$$.fragment),Ir=h(),Kt=s("p"),Fr=o("Constructs a LeViT feature extractor."),kr=h(),Se=s("p"),Cr=o("This feature extractor inherits from "),xt=s("a"),jr=o("FeatureExtractionMixin"),Pr=o(` which contains most of the main methods. Users
should refer to this superclass for more information regarding those methods.`),Ar=h(),B=s("div"),w(qe.$$.fragment),Mr=h(),Qt=s("p"),zr=o("Main method to prepare for the model one or several image(s)."),Nr=h(),w(de.$$.fragment),Ca=h(),Z=s("h2"),he=s("a"),ea=s("span"),w(Oe.$$.fragment),Vr=h(),ta=s("span"),Wr=o("LevitModel"),ja=h(),O=s("div"),w(De.$$.fragment),Sr=h(),Re=s("p"),qr=o(`The bare Levit model outputting raw features without any specific head on top.
This model is a PyTorch `),Be=s("a"),Or=o("torch.nn.Module"),Dr=o(` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Rr=h(),V=s("div"),w(He.$$.fragment),Br=h(),K=s("p"),Hr=o("The "),Et=s("a"),Ur=o("LevitModel"),Jr=o(" forward method, overrides the "),aa=s("code"),Gr=o("__call__"),Xr=o(" special method."),Yr=h(),w(fe.$$.fragment),Zr=h(),w(me.$$.fragment),Pa=h(),Q=s("h2"),pe=s("a"),oa=s("span"),w(Ue.$$.fragment),Kr=h(),ra=s("span"),Qr=o("LevitForImageClassification"),Aa=h(),z=s("div"),w(Je.$$.fragment),es=h(),sa=s("p"),ts=o(`Levit Model with an image classification head on top (a linear layer on top of the pooled features), e.g. for
ImageNet.`),as=h(),Ge=s("p"),os=o("This model is a PyTorch "),Xe=s("a"),rs=o("torch.nn.Module"),ss=o(` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),ns=h(),W=s("div"),w(Ye.$$.fragment),is=h(),ee=s("p"),ls=o("The "),It=s("a"),cs=o("LevitForImageClassification"),ds=o(" forward method, overrides the "),na=s("code"),hs=o("__call__"),fs=o(" special method."),ms=h(),w(ue.$$.fragment),ps=h(),w(ge.$$.fragment),Ma=h(),te=s("h2"),ve=s("a"),ia=s("span"),w(Ze.$$.fragment),us=h(),la=s("span"),gs=o("LevitForImageClassificationWithTeacher"),za=h(),N=s("div"),w(Ke.$$.fragment),vs=h(),ca=s("p"),_s=o(`LeViT Model transformer with image classification heads on top (a linear layer on top of the final hidden state and
a linear layer on top of the final hidden state of the distillation token) e.g. for ImageNet. .. warning::
This model supports inference-only. Fine-tuning with distillation (i.e. with a teacher) is not yet
supported.`),bs=h(),Qe=s("p"),ws=o("This model is a PyTorch "),et=s("a"),$s=o("torch.nn.Module"),Ls=o(` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),ys=h(),S=s("div"),w(tt.$$.fragment),Ts=h(),ae=s("p"),xs=o("The "),Ft=s("a"),Es=o("LevitForImageClassificationWithTeacher"),Is=o(" forward method, overrides the "),da=s("code"),Fs=o("__call__"),ks=o(" special method."),Cs=h(),w(_e.$$.fragment),js=h(),w(be.$$.fragment),this.h()},l(t){const m=Hn('[data-svelte="svelte-1phssyn"]',document.head);d=n(m,"META",{name:!0,content:!0}),m.forEach(a),b=f(t),u=n(t,"H1",{class:!0});var at=i(u);p=n(at,"A",{id:!0,class:!0,href:!0});var ha=i(p);_=n(ha,"SPAN",{});var fa=i(_);$(l.$$.fragment,fa),fa.forEach(a),ha.forEach(a),g=f(at),j=n(at,"SPAN",{});var ma=i(j);Ka=r(ma,"LeViT"),ma.forEach(a),at.forEach(a),va=f(t),H=n(t,"H2",{class:!0});var ot=i(H);re=n(ot,"A",{id:!0,class:!0,href:!0});var pa=i(re);St=n(pa,"SPAN",{});var ua=i(St);$(Ie.$$.fragment,ua),ua.forEach(a),pa.forEach(a),Qa=f(ot),qt=n(ot,"SPAN",{});var ga=i(qt);eo=r(ga,"Overview"),ga.forEach(a),ot.forEach(a),_a=f(t),D=n(t,"P",{});var kt=i(D);to=r(kt,"The LeViT model was proposed in "),Fe=n(kt,"A",{href:!0,rel:!0});var Ms=i(Fe);ao=r(Ms,"LeViT: Introducing Convolutions to Vision Transformers"),Ms.forEach(a),oo=r(kt," by Ben Graham, Alaaeldin El-Nouby, Hugo Touvron, Pierre Stock, Armand Joulin, Herv\xE9 J\xE9gou, Matthijs Douze. LeViT improves the "),st=n(kt,"A",{href:!0});var zs=i(st);ro=r(zs,"Vision Transformer (ViT)"),zs.forEach(a),so=r(kt," in performance and efficiency by a few architectural differences such as activation maps with decreasing resolutions in Transformers and the introduction of an attention bias to integrate positional information."),kt.forEach(a),ba=f(t),nt=n(t,"P",{});var Ns=i(nt);no=r(Ns,"The abstract from the paper is the following:"),Ns.forEach(a),wa=f(t),it=n(t,"P",{});var Vs=i(it);Ot=n(Vs,"EM",{});var Ws=i(Ot);io=r(Ws,`We design a family of image classification architectures that optimize the trade-off between accuracy
and efficiency in a high-speed regime. Our work exploits recent findings in attention-based architectures,
which are competitive on highly parallel processing hardware. We revisit principles from the extensive
literature on convolutional neural networks to apply them to transformers, in particular activation maps
with decreasing resolutions. We also introduce the attention bias, a new way to integrate positional information
in vision transformers. As a result, we propose LeVIT: a hybrid neural network for fast inference image classification.
We consider different measures of efficiency on different hardware platforms, so as to best reflect a wide range of
application scenarios. Our extensive experiments empirically validate our technical choices and show they are suitable
to most architectures. Overall, LeViT significantly outperforms existing convnets and vision transformers with respect
to the speed/accuracy tradeoff. For example, at 80% ImageNet top-1 accuracy, LeViT is 5 times faster than EfficientNet on CPU.`),Ws.forEach(a),Vs.forEach(a),$a=f(t),se=n(t,"IMG",{src:!0,alt:!0,width:!0}),La=f(t),ne=n(t,"SMALL",{});var Va=i(ne);lo=r(Va,"LeViT Architecture. Taken from the "),lt=n(Va,"A",{href:!0});var Ss=i(lt);co=r(Ss,"original paper"),Ss.forEach(a),ho=r(Va,"."),Va.forEach(a),ya=f(t),ct=n(t,"P",{});var qs=i(ct);fo=r(qs,"Tips:"),qs.forEach(a),Ta=f(t),C=n(t,"UL",{});var q=i(C);Dt=n(q,"LI",{});var Os=i(Dt);mo=r(Os,"Compared to ViT, LeViT models use an additional distillation head to effectively learn from a teacher (which, in the LeViT paper, is a ResNet like-model). The distillation head is learned through backpropagation under supervision of a ResNet like-model. They also draw inspiration from convolution neural networks to use activation maps with decreasing resolutions to increase the efficiency."),Os.forEach(a),po=f(q),U=n(q,"LI",{});var Ct=i(U);uo=r(Ct,`There are 2 ways to fine-tune distilled models, either (1) in a classic way, by only placing a prediction head on top
of the final hidden state and not using the distillation head, or (2) by placing both a prediction head and distillation
head on top of the final hidden state. In that case, the prediction head is trained using regular cross-entropy between
the prediction of the head and the ground-truth label, while the distillation prediction head is trained using hard distillation
(cross-entropy between the prediction of the distillation head and the label predicted by the teacher). At inference time,
one takes the average prediction between both heads as final prediction. (2) is also called \u201Cfine-tuning with distillation\u201D,
because one relies on a teacher that has already been fine-tuned on the downstream dataset. In terms of models, (1) corresponds
to `),dt=n(Ct,"A",{href:!0});var Ds=i(dt);go=r(Ds,"LevitForImageClassification"),Ds.forEach(a),vo=r(Ct," and (2) corresponds to "),ht=n(Ct,"A",{href:!0});var Rs=i(ht);_o=r(Rs,"LevitForImageClassificationWithTeacher"),Rs.forEach(a),bo=r(Ct,"."),Ct.forEach(a),wo=f(q),ke=n(q,"LI",{});var Wa=i(ke);$o=r(Wa,"All released checkpoints were pre-trained and fine-tuned on  "),Ce=n(Wa,"A",{href:!0,rel:!0});var Bs=i(Ce);Lo=r(Bs,"ImageNet-1k"),Bs.forEach(a),yo=r(Wa,`
(also referred to as ILSVRC 2012, a collection of 1.3 million images and 1,000 classes). only. No external data was used. This is in
contrast with the original ViT model, which used external data like the JFT-300M dataset/Imagenet-21k for
pre-training.`),Wa.forEach(a),To=f(q),E=n(q,"LI",{});var F=i(E);xo=r(F,"The authors of LeViT released 5 trained LeViT models, which you can directly plug into "),ft=n(F,"A",{href:!0});var Hs=i(ft);Eo=r(Hs,"LevitModel"),Hs.forEach(a),Io=r(F," or "),mt=n(F,"A",{href:!0});var Us=i(mt);Fo=r(Us,"LevitForImageClassification"),Us.forEach(a),ko=r(F,`.
Techniques like data augmentation, optimization, and regularization were used in order to simulate training on a much larger dataset
(while only using ImageNet-1k for pre-training). The 5 variants available are (all trained on images of size 224x224):
`),Rt=n(F,"EM",{});var Js=i(Rt);Co=r(Js,"facebook/levit-128S"),Js.forEach(a),jo=r(F,", "),Bt=n(F,"EM",{});var Gs=i(Bt);Po=r(Gs,"facebook/levit-128"),Gs.forEach(a),Ao=r(F,", "),Ht=n(F,"EM",{});var Xs=i(Ht);Mo=r(Xs,"facebook/levit-192"),Xs.forEach(a),zo=r(F,", "),Ut=n(F,"EM",{});var Ys=i(Ut);No=r(Ys,"facebook/levit-256"),Ys.forEach(a),Vo=r(F,` and
`),Jt=n(F,"EM",{});var Zs=i(Jt);Wo=r(Zs,"facebook/levit-384"),Zs.forEach(a),So=r(F,". Note that one should use "),pt=n(F,"A",{href:!0});var Ks=i(pt);qo=r(Ks,"LevitFeatureExtractor"),Ks.forEach(a),Oo=r(F,` in order to
prepare images for the model.`),F.forEach(a),Do=f(q),ut=n(q,"LI",{});var Ps=i(ut);gt=n(Ps,"A",{href:!0});var Qs=i(gt);Ro=r(Qs,"LevitForImageClassificationWithTeacher"),Qs.forEach(a),Bo=r(Ps," currently supports only inference and not training or fine-tuning."),Ps.forEach(a),Ho=f(q),k=n(q,"LI",{});var P=i(k);Uo=r(P,"You can check out demo notebooks regarding inference as well as fine-tuning on custom data "),je=n(P,"A",{href:!0,rel:!0});var en=i(je);Jo=r(en,"here"),en.forEach(a),Go=r(P,`
(you can just replace `),vt=n(P,"A",{href:!0});var tn=i(vt);Xo=r(tn,"ViTFeatureExtractor"),tn.forEach(a),Yo=r(P," by "),_t=n(P,"A",{href:!0});var an=i(_t);Zo=r(an,"LevitFeatureExtractor"),an.forEach(a),Ko=r(P," and "),bt=n(P,"A",{href:!0});var on=i(bt);Qo=r(on,"ViTForImageClassification"),on.forEach(a),er=r(P," by "),wt=n(P,"A",{href:!0});var rn=i(wt);tr=r(rn,"LevitForImageClassification"),rn.forEach(a),ar=r(P," or "),$t=n(P,"A",{href:!0});var sn=i($t);or=r(sn,"LevitForImageClassificationWithTeacher"),sn.forEach(a),rr=r(P,")."),P.forEach(a),q.forEach(a),xa=f(t),R=n(t,"P",{});var jt=i(R);sr=r(jt,"This model was contributed by "),Pe=n(jt,"A",{href:!0,rel:!0});var nn=i(Pe);nr=r(nn,"anugunj"),nn.forEach(a),ir=r(jt,". The original code can be found "),Ae=n(jt,"A",{href:!0,rel:!0});var ln=i(Ae);lr=r(ln,"here"),ln.forEach(a),cr=r(jt,"."),jt.forEach(a),Ea=f(t),J=n(t,"H2",{class:!0});var Sa=i(J);ie=n(Sa,"A",{id:!0,class:!0,href:!0});var cn=i(ie);Gt=n(cn,"SPAN",{});var dn=i(Gt);$(Me.$$.fragment,dn),dn.forEach(a),cn.forEach(a),dr=f(Sa),Xt=n(Sa,"SPAN",{});var hn=i(Xt);hr=r(hn,"LevitConfig"),hn.forEach(a),Sa.forEach(a),Ia=f(t),A=n(t,"DIV",{class:!0});var we=i(A);$(ze.$$.fragment,we),fr=f(we),G=n(we,"P",{});var Pt=i(G);mr=r(Pt,"This is the configuration class to store the configuration of a "),Lt=n(Pt,"A",{href:!0});var fn=i(Lt);pr=r(fn,"LevitModel"),fn.forEach(a),ur=r(Pt,`. It is used to instantiate a LeViT
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 LeViT
`),Ne=n(Pt,"A",{href:!0,rel:!0});var mn=i(Ne);gr=r(mn,"facebook/levit-base-192"),mn.forEach(a),vr=r(Pt," architecture."),Pt.forEach(a),_r=f(we),X=n(we,"P",{});var At=i(X);br=r(At,"Configuration objects inherit from "),yt=n(At,"A",{href:!0});var pn=i(yt);wr=r(pn,"PretrainedConfig"),pn.forEach(a),$r=r(At,` and can be used to control the model outputs. Read the
documentation from `),Tt=n(At,"A",{href:!0});var un=i(Tt);Lr=r(un,"PretrainedConfig"),un.forEach(a),yr=r(At," for more information."),At.forEach(a),Tr=f(we),$(le.$$.fragment,we),we.forEach(a),Fa=f(t),Y=n(t,"H2",{class:!0});var qa=i(Y);ce=n(qa,"A",{id:!0,class:!0,href:!0});var gn=i(ce);Yt=n(gn,"SPAN",{});var vn=i(Yt);$(Ve.$$.fragment,vn),vn.forEach(a),gn.forEach(a),xr=f(qa),Zt=n(qa,"SPAN",{});var _n=i(Zt);Er=r(_n,"LevitFeatureExtractor"),_n.forEach(a),qa.forEach(a),ka=f(t),M=n(t,"DIV",{class:!0});var $e=i(M);$(We.$$.fragment,$e),Ir=f($e),Kt=n($e,"P",{});var bn=i(Kt);Fr=r(bn,"Constructs a LeViT feature extractor."),bn.forEach(a),kr=f($e),Se=n($e,"P",{});var Oa=i(Se);Cr=r(Oa,"This feature extractor inherits from "),xt=n(Oa,"A",{href:!0});var wn=i(xt);jr=r(wn,"FeatureExtractionMixin"),wn.forEach(a),Pr=r(Oa,` which contains most of the main methods. Users
should refer to this superclass for more information regarding those methods.`),Oa.forEach(a),Ar=f($e),B=n($e,"DIV",{class:!0});var Mt=i(B);$(qe.$$.fragment,Mt),Mr=f(Mt),Qt=n(Mt,"P",{});var $n=i(Qt);zr=r($n,"Main method to prepare for the model one or several image(s)."),$n.forEach(a),Nr=f(Mt),$(de.$$.fragment,Mt),Mt.forEach(a),$e.forEach(a),Ca=f(t),Z=n(t,"H2",{class:!0});var Da=i(Z);he=n(Da,"A",{id:!0,class:!0,href:!0});var Ln=i(he);ea=n(Ln,"SPAN",{});var yn=i(ea);$(Oe.$$.fragment,yn),yn.forEach(a),Ln.forEach(a),Vr=f(Da),ta=n(Da,"SPAN",{});var Tn=i(ta);Wr=r(Tn,"LevitModel"),Tn.forEach(a),Da.forEach(a),ja=f(t),O=n(t,"DIV",{class:!0});var zt=i(O);$(De.$$.fragment,zt),Sr=f(zt),Re=n(zt,"P",{});var Ra=i(Re);qr=r(Ra,`The bare Levit model outputting raw features without any specific head on top.
This model is a PyTorch `),Be=n(Ra,"A",{href:!0,rel:!0});var xn=i(Be);Or=r(xn,"torch.nn.Module"),xn.forEach(a),Dr=r(Ra,` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Ra.forEach(a),Rr=f(zt),V=n(zt,"DIV",{class:!0});var Le=i(V);$(He.$$.fragment,Le),Br=f(Le),K=n(Le,"P",{});var Nt=i(K);Hr=r(Nt,"The "),Et=n(Nt,"A",{href:!0});var En=i(Et);Ur=r(En,"LevitModel"),En.forEach(a),Jr=r(Nt," forward method, overrides the "),aa=n(Nt,"CODE",{});var In=i(aa);Gr=r(In,"__call__"),In.forEach(a),Xr=r(Nt," special method."),Nt.forEach(a),Yr=f(Le),$(fe.$$.fragment,Le),Zr=f(Le),$(me.$$.fragment,Le),Le.forEach(a),zt.forEach(a),Pa=f(t),Q=n(t,"H2",{class:!0});var Ba=i(Q);pe=n(Ba,"A",{id:!0,class:!0,href:!0});var Fn=i(pe);oa=n(Fn,"SPAN",{});var kn=i(oa);$(Ue.$$.fragment,kn),kn.forEach(a),Fn.forEach(a),Kr=f(Ba),ra=n(Ba,"SPAN",{});var Cn=i(ra);Qr=r(Cn,"LevitForImageClassification"),Cn.forEach(a),Ba.forEach(a),Aa=f(t),z=n(t,"DIV",{class:!0});var ye=i(z);$(Je.$$.fragment,ye),es=f(ye),sa=n(ye,"P",{});var jn=i(sa);ts=r(jn,`Levit Model with an image classification head on top (a linear layer on top of the pooled features), e.g. for
ImageNet.`),jn.forEach(a),as=f(ye),Ge=n(ye,"P",{});var Ha=i(Ge);os=r(Ha,"This model is a PyTorch "),Xe=n(Ha,"A",{href:!0,rel:!0});var Pn=i(Xe);rs=r(Pn,"torch.nn.Module"),Pn.forEach(a),ss=r(Ha,` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Ha.forEach(a),ns=f(ye),W=n(ye,"DIV",{class:!0});var Te=i(W);$(Ye.$$.fragment,Te),is=f(Te),ee=n(Te,"P",{});var Vt=i(ee);ls=r(Vt,"The "),It=n(Vt,"A",{href:!0});var An=i(It);cs=r(An,"LevitForImageClassification"),An.forEach(a),ds=r(Vt," forward method, overrides the "),na=n(Vt,"CODE",{});var Mn=i(na);hs=r(Mn,"__call__"),Mn.forEach(a),fs=r(Vt," special method."),Vt.forEach(a),ms=f(Te),$(ue.$$.fragment,Te),ps=f(Te),$(ge.$$.fragment,Te),Te.forEach(a),ye.forEach(a),Ma=f(t),te=n(t,"H2",{class:!0});var Ua=i(te);ve=n(Ua,"A",{id:!0,class:!0,href:!0});var zn=i(ve);ia=n(zn,"SPAN",{});var Nn=i(ia);$(Ze.$$.fragment,Nn),Nn.forEach(a),zn.forEach(a),us=f(Ua),la=n(Ua,"SPAN",{});var Vn=i(la);gs=r(Vn,"LevitForImageClassificationWithTeacher"),Vn.forEach(a),Ua.forEach(a),za=f(t),N=n(t,"DIV",{class:!0});var xe=i(N);$(Ke.$$.fragment,xe),vs=f(xe),ca=n(xe,"P",{});var Wn=i(ca);_s=r(Wn,`LeViT Model transformer with image classification heads on top (a linear layer on top of the final hidden state and
a linear layer on top of the final hidden state of the distillation token) e.g. for ImageNet. .. warning::
This model supports inference-only. Fine-tuning with distillation (i.e. with a teacher) is not yet
supported.`),Wn.forEach(a),bs=f(xe),Qe=n(xe,"P",{});var Ja=i(Qe);ws=r(Ja,"This model is a PyTorch "),et=n(Ja,"A",{href:!0,rel:!0});var Sn=i(et);$s=r(Sn,"torch.nn.Module"),Sn.forEach(a),Ls=r(Ja,` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Ja.forEach(a),ys=f(xe),S=n(xe,"DIV",{class:!0});var Ee=i(S);$(tt.$$.fragment,Ee),Ts=f(Ee),ae=n(Ee,"P",{});var Wt=i(ae);xs=r(Wt,"The "),Ft=n(Wt,"A",{href:!0});var qn=i(Ft);Es=r(qn,"LevitForImageClassificationWithTeacher"),qn.forEach(a),Is=r(Wt," forward method, overrides the "),da=n(Wt,"CODE",{});var On=i(da);Fs=r(On,"__call__"),On.forEach(a),ks=r(Wt," special method."),Wt.forEach(a),Cs=f(Ee),$(_e.$$.fragment,Ee),js=f(Ee),$(be.$$.fragment,Ee),Ee.forEach(a),xe.forEach(a),this.h()},h(){c(d,"name","hf:doc:metadata"),c(d,"content",JSON.stringify(oi)),c(p,"id","levit"),c(p,"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(p,"href","#levit"),c(u,"class","relative group"),c(re,"id","overview"),c(re,"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(re,"href","#overview"),c(H,"class","relative group"),c(Fe,"href","https://arxiv.org/abs/2104.01136"),c(Fe,"rel","nofollow"),c(st,"href","vit"),Un(se.src,As="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/levit_architecture.png")||c(se,"src",As),c(se,"alt","drawing"),c(se,"width","600"),c(lt,"href","https://arxiv.org/abs/2104.01136"),c(dt,"href","/docs/transformers/pr_17548/en/model_doc/levit#transformers.LevitForImageClassification"),c(ht,"href","/docs/transformers/pr_17548/en/model_doc/levit#transformers.LevitForImageClassificationWithTeacher"),c(Ce,"href","https://huggingface.co/datasets/imagenet-1k"),c(Ce,"rel","nofollow"),c(ft,"href","/docs/transformers/pr_17548/en/model_doc/levit#transformers.LevitModel"),c(mt,"href","/docs/transformers/pr_17548/en/model_doc/levit#transformers.LevitForImageClassification"),c(pt,"href","/docs/transformers/pr_17548/en/model_doc/levit#transformers.LevitFeatureExtractor"),c(gt,"href","/docs/transformers/pr_17548/en/model_doc/levit#transformers.LevitForImageClassificationWithTeacher"),c(je,"href","https://github.com/NielsRogge/Transformers-Tutorials/tree/master/VisionTransformer"),c(je,"rel","nofollow"),c(vt,"href","/docs/transformers/pr_17548/en/model_doc/vit#transformers.ViTFeatureExtractor"),c(_t,"href","/docs/transformers/pr_17548/en/model_doc/levit#transformers.LevitFeatureExtractor"),c(bt,"href","/docs/transformers/pr_17548/en/model_doc/vit#transformers.ViTForImageClassification"),c(wt,"href","/docs/transformers/pr_17548/en/model_doc/levit#transformers.LevitForImageClassification"),c($t,"href","/docs/transformers/pr_17548/en/model_doc/levit#transformers.LevitForImageClassificationWithTeacher"),c(Pe,"href","https://huggingface.co/anugunj"),c(Pe,"rel","nofollow"),c(Ae,"href","https://github.com/facebookresearch/LeViT"),c(Ae,"rel","nofollow"),c(ie,"id","transformers.LevitConfig"),c(ie,"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(ie,"href","#transformers.LevitConfig"),c(J,"class","relative group"),c(Lt,"href","/docs/transformers/pr_17548/en/model_doc/levit#transformers.LevitModel"),c(Ne,"href","https://huggingface.co/facebook/levit-base-192"),c(Ne,"rel","nofollow"),c(yt,"href","/docs/transformers/pr_17548/en/main_classes/configuration#transformers.PretrainedConfig"),c(Tt,"href","/docs/transformers/pr_17548/en/main_classes/configuration#transformers.PretrainedConfig"),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(ce,"id","transformers.LevitFeatureExtractor"),c(ce,"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(ce,"href","#transformers.LevitFeatureExtractor"),c(Y,"class","relative group"),c(xt,"href","/docs/transformers/pr_17548/en/main_classes/feature_extractor#transformers.FeatureExtractionMixin"),c(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(M,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(he,"id","transformers.LevitModel"),c(he,"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(he,"href","#transformers.LevitModel"),c(Z,"class","relative group"),c(Be,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(Be,"rel","nofollow"),c(Et,"href","/docs/transformers/pr_17548/en/model_doc/levit#transformers.LevitModel"),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(O,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(pe,"id","transformers.LevitForImageClassification"),c(pe,"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(pe,"href","#transformers.LevitForImageClassification"),c(Q,"class","relative group"),c(Xe,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(Xe,"rel","nofollow"),c(It,"href","/docs/transformers/pr_17548/en/model_doc/levit#transformers.LevitForImageClassification"),c(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(ve,"id","transformers.LevitForImageClassificationWithTeacher"),c(ve,"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(ve,"href","#transformers.LevitForImageClassificationWithTeacher"),c(te,"class","relative group"),c(et,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(et,"rel","nofollow"),c(Ft,"href","/docs/transformers/pr_17548/en/model_doc/levit#transformers.LevitForImageClassificationWithTeacher"),c(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(t,m){e(document.head,d),v(t,b,m),v(t,u,m),e(u,p),e(p,_),L(l,_,null),e(u,g),e(u,j),e(j,Ka),v(t,va,m),v(t,H,m),e(H,re),e(re,St),L(Ie,St,null),e(H,Qa),e(H,qt),e(qt,eo),v(t,_a,m),v(t,D,m),e(D,to),e(D,Fe),e(Fe,ao),e(D,oo),e(D,st),e(st,ro),e(D,so),v(t,ba,m),v(t,nt,m),e(nt,no),v(t,wa,m),v(t,it,m),e(it,Ot),e(Ot,io),v(t,$a,m),v(t,se,m),v(t,La,m),v(t,ne,m),e(ne,lo),e(ne,lt),e(lt,co),e(ne,ho),v(t,ya,m),v(t,ct,m),e(ct,fo),v(t,Ta,m),v(t,C,m),e(C,Dt),e(Dt,mo),e(C,po),e(C,U),e(U,uo),e(U,dt),e(dt,go),e(U,vo),e(U,ht),e(ht,_o),e(U,bo),e(C,wo),e(C,ke),e(ke,$o),e(ke,Ce),e(Ce,Lo),e(ke,yo),e(C,To),e(C,E),e(E,xo),e(E,ft),e(ft,Eo),e(E,Io),e(E,mt),e(mt,Fo),e(E,ko),e(E,Rt),e(Rt,Co),e(E,jo),e(E,Bt),e(Bt,Po),e(E,Ao),e(E,Ht),e(Ht,Mo),e(E,zo),e(E,Ut),e(Ut,No),e(E,Vo),e(E,Jt),e(Jt,Wo),e(E,So),e(E,pt),e(pt,qo),e(E,Oo),e(C,Do),e(C,ut),e(ut,gt),e(gt,Ro),e(ut,Bo),e(C,Ho),e(C,k),e(k,Uo),e(k,je),e(je,Jo),e(k,Go),e(k,vt),e(vt,Xo),e(k,Yo),e(k,_t),e(_t,Zo),e(k,Ko),e(k,bt),e(bt,Qo),e(k,er),e(k,wt),e(wt,tr),e(k,ar),e(k,$t),e($t,or),e(k,rr),v(t,xa,m),v(t,R,m),e(R,sr),e(R,Pe),e(Pe,nr),e(R,ir),e(R,Ae),e(Ae,lr),e(R,cr),v(t,Ea,m),v(t,J,m),e(J,ie),e(ie,Gt),L(Me,Gt,null),e(J,dr),e(J,Xt),e(Xt,hr),v(t,Ia,m),v(t,A,m),L(ze,A,null),e(A,fr),e(A,G),e(G,mr),e(G,Lt),e(Lt,pr),e(G,ur),e(G,Ne),e(Ne,gr),e(G,vr),e(A,_r),e(A,X),e(X,br),e(X,yt),e(yt,wr),e(X,$r),e(X,Tt),e(Tt,Lr),e(X,yr),e(A,Tr),L(le,A,null),v(t,Fa,m),v(t,Y,m),e(Y,ce),e(ce,Yt),L(Ve,Yt,null),e(Y,xr),e(Y,Zt),e(Zt,Er),v(t,ka,m),v(t,M,m),L(We,M,null),e(M,Ir),e(M,Kt),e(Kt,Fr),e(M,kr),e(M,Se),e(Se,Cr),e(Se,xt),e(xt,jr),e(Se,Pr),e(M,Ar),e(M,B),L(qe,B,null),e(B,Mr),e(B,Qt),e(Qt,zr),e(B,Nr),L(de,B,null),v(t,Ca,m),v(t,Z,m),e(Z,he),e(he,ea),L(Oe,ea,null),e(Z,Vr),e(Z,ta),e(ta,Wr),v(t,ja,m),v(t,O,m),L(De,O,null),e(O,Sr),e(O,Re),e(Re,qr),e(Re,Be),e(Be,Or),e(Re,Dr),e(O,Rr),e(O,V),L(He,V,null),e(V,Br),e(V,K),e(K,Hr),e(K,Et),e(Et,Ur),e(K,Jr),e(K,aa),e(aa,Gr),e(K,Xr),e(V,Yr),L(fe,V,null),e(V,Zr),L(me,V,null),v(t,Pa,m),v(t,Q,m),e(Q,pe),e(pe,oa),L(Ue,oa,null),e(Q,Kr),e(Q,ra),e(ra,Qr),v(t,Aa,m),v(t,z,m),L(Je,z,null),e(z,es),e(z,sa),e(sa,ts),e(z,as),e(z,Ge),e(Ge,os),e(Ge,Xe),e(Xe,rs),e(Ge,ss),e(z,ns),e(z,W),L(Ye,W,null),e(W,is),e(W,ee),e(ee,ls),e(ee,It),e(It,cs),e(ee,ds),e(ee,na),e(na,hs),e(ee,fs),e(W,ms),L(ue,W,null),e(W,ps),L(ge,W,null),v(t,Ma,m),v(t,te,m),e(te,ve),e(ve,ia),L(Ze,ia,null),e(te,us),e(te,la),e(la,gs),v(t,za,m),v(t,N,m),L(Ke,N,null),e(N,vs),e(N,ca),e(ca,_s),e(N,bs),e(N,Qe),e(Qe,ws),e(Qe,et),e(et,$s),e(Qe,Ls),e(N,ys),e(N,S),L(tt,S,null),e(S,Ts),e(S,ae),e(ae,xs),e(ae,Ft),e(Ft,Es),e(ae,Is),e(ae,da),e(da,Fs),e(ae,ks),e(S,Cs),L(_e,S,null),e(S,js),L(be,S,null),Na=!0},p(t,[m]){const at={};m&2&&(at.$$scope={dirty:m,ctx:t}),le.$set(at);const ha={};m&2&&(ha.$$scope={dirty:m,ctx:t}),de.$set(ha);const fa={};m&2&&(fa.$$scope={dirty:m,ctx:t}),fe.$set(fa);const ma={};m&2&&(ma.$$scope={dirty:m,ctx:t}),me.$set(ma);const ot={};m&2&&(ot.$$scope={dirty:m,ctx:t}),ue.$set(ot);const pa={};m&2&&(pa.$$scope={dirty:m,ctx:t}),ge.$set(pa);const ua={};m&2&&(ua.$$scope={dirty:m,ctx:t}),_e.$set(ua);const ga={};m&2&&(ga.$$scope={dirty:m,ctx:t}),be.$set(ga)},i(t){Na||(y(l.$$.fragment,t),y(Ie.$$.fragment,t),y(Me.$$.fragment,t),y(ze.$$.fragment,t),y(le.$$.fragment,t),y(Ve.$$.fragment,t),y(We.$$.fragment,t),y(qe.$$.fragment,t),y(de.$$.fragment,t),y(Oe.$$.fragment,t),y(De.$$.fragment,t),y(He.$$.fragment,t),y(fe.$$.fragment,t),y(me.$$.fragment,t),y(Ue.$$.fragment,t),y(Je.$$.fragment,t),y(Ye.$$.fragment,t),y(ue.$$.fragment,t),y(ge.$$.fragment,t),y(Ze.$$.fragment,t),y(Ke.$$.fragment,t),y(tt.$$.fragment,t),y(_e.$$.fragment,t),y(be.$$.fragment,t),Na=!0)},o(t){T(l.$$.fragment,t),T(Ie.$$.fragment,t),T(Me.$$.fragment,t),T(ze.$$.fragment,t),T(le.$$.fragment,t),T(Ve.$$.fragment,t),T(We.$$.fragment,t),T(qe.$$.fragment,t),T(de.$$.fragment,t),T(Oe.$$.fragment,t),T(De.$$.fragment,t),T(He.$$.fragment,t),T(fe.$$.fragment,t),T(me.$$.fragment,t),T(Ue.$$.fragment,t),T(Je.$$.fragment,t),T(Ye.$$.fragment,t),T(ue.$$.fragment,t),T(ge.$$.fragment,t),T(Ze.$$.fragment,t),T(Ke.$$.fragment,t),T(tt.$$.fragment,t),T(_e.$$.fragment,t),T(be.$$.fragment,t),Na=!1},d(t){a(d),t&&a(b),t&&a(u),x(l),t&&a(va),t&&a(H),x(Ie),t&&a(_a),t&&a(D),t&&a(ba),t&&a(nt),t&&a(wa),t&&a(it),t&&a($a),t&&a(se),t&&a(La),t&&a(ne),t&&a(ya),t&&a(ct),t&&a(Ta),t&&a(C),t&&a(xa),t&&a(R),t&&a(Ea),t&&a(J),x(Me),t&&a(Ia),t&&a(A),x(ze),x(le),t&&a(Fa),t&&a(Y),x(Ve),t&&a(ka),t&&a(M),x(We),x(qe),x(de),t&&a(Ca),t&&a(Z),x(Oe),t&&a(ja),t&&a(O),x(De),x(He),x(fe),x(me),t&&a(Pa),t&&a(Q),x(Ue),t&&a(Aa),t&&a(z),x(Je),x(Ye),x(ue),x(ge),t&&a(Ma),t&&a(te),x(Ze),t&&a(za),t&&a(N),x(Ke),x(tt),x(_e),x(be)}}}const oi={local:"levit",sections:[{local:"overview",title:"Overview"},{local:"transformers.LevitConfig",title:"LevitConfig"},{local:"transformers.LevitFeatureExtractor",title:"LevitFeatureExtractor"},{local:"transformers.LevitModel",title:"LevitModel"},{local:"transformers.LevitForImageClassification",title:"LevitForImageClassification"},{local:"transformers.LevitForImageClassificationWithTeacher",title:"LevitForImageClassificationWithTeacher"}],title:"LeViT"};function ri(I){return Jn(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class hi extends Dn{constructor(d){super();Rn(this,d,ri,ai,Bn,{})}}export{hi as default,oi as metadata};
