import{S as Kn,i as Xn,s as Qn,e as r,k as p,w as E,t as i,M as Zn,c as n,d as t,m as h,a as s,x as w,h as c,b as f,G as o,g as _,y,q as F,o as $,B as T,v as ea,L as Et}from"../../chunks/vendor-hf-doc-builder.js";import{T as vt}from"../../chunks/Tip-hf-doc-builder.js";import{D as K}from"../../chunks/Docstring-hf-doc-builder.js";import{C as wt}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as Ee}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as bt}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function oa(I){let l,b,g,d,v;return d=new wt({props:{code:`from transformers import EfficientFormerConfig, EfficientFormerModel

# Initializing a EfficientFormer efficientformer-l1 style configuration
configuration = EfficientFormerConfig()

# Initializing a EfficientFormerModel (with random weights) from the efficientformer-l3 style configuration
model = EfficientFormerModel(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> EfficientFormerConfig, EfficientFormerModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a EfficientFormer efficientformer-l1 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = EfficientFormerConfig()

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

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

image_processor = AutoImageProcessor.from_pretrained("snap-research/efficientformer-l1-300")
model = EfficientFormerModel.from_pretrained("snap-research/efficientformer-l1-300")

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, EfficientFormerModel
<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;snap-research/efficientformer-l1-300&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = EfficientFormerModel.from_pretrained(<span class="hljs-string">&quot;snap-research/efficientformer-l1-300&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">197</span>, <span class="hljs-number">768</span>]`}}),{c(){l=r("p"),b=i("Example:"),g=p(),E(d.$$.fragment)},l(a){l=n(a,"P",{});var u=s(l);b=c(u,"Example:"),u.forEach(t),g=h(a),w(d.$$.fragment,a)},m(a,u){_(a,l,u),o(l,b),_(a,g,u),y(d,a,u),v=!0},p:Et,i(a){v||(F(d.$$.fragment,a),v=!0)},o(a){$(d.$$.fragment,a),v=!1},d(a){a&&t(l),a&&t(g),T(d,a)}}}function na(I){let l,b,g,d,v;return{c(){l=r("p"),b=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=r("code"),d=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(a){l=n(a,"P",{});var u=s(l);b=c(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=n(u,"CODE",{});var C=s(g);d=c(C,"Module"),C.forEach(t),v=c(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(t)},m(a,u){_(a,l,u),o(l,b),o(l,g),o(g,d),o(l,v)},d(a){a&&t(l)}}}function aa(I){let l,b,g,d,v;return d=new wt({props:{code:`from transformers import AutoImageProcessor, EfficientFormerForImageClassification
import torch
from datasets import load_dataset

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

image_processor = AutoImageProcessor.from_pretrained("snap-research/efficientformer-l1-300")
model = EfficientFormerForImageClassification.from_pretrained("snap-research/efficientformer-l1-300")

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, EfficientFormerForImageClassification
<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;snap-research/efficientformer-l1-300&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = EfficientFormerForImageClassification.from_pretrained(<span class="hljs-string">&quot;snap-research/efficientformer-l1-300&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(){l=r("p"),b=i("Example:"),g=p(),E(d.$$.fragment)},l(a){l=n(a,"P",{});var u=s(l);b=c(u,"Example:"),u.forEach(t),g=h(a),w(d.$$.fragment,a)},m(a,u){_(a,l,u),o(l,b),_(a,g,u),y(d,a,u),v=!0},p:Et,i(a){v||(F(d.$$.fragment,a),v=!0)},o(a){$(d.$$.fragment,a),v=!1},d(a){a&&t(l),a&&t(g),T(d,a)}}}function sa(I){let l,b;return{c(){l=r("p"),b=i(`This model supports inference-only. Fine-tuning with distillation (i.e. with a teacher) is not yet
supported.`)},l(g){l=n(g,"P",{});var d=s(l);b=c(d,`This model supports inference-only. Fine-tuning with distillation (i.e. with a teacher) is not yet
supported.`),d.forEach(t)},m(g,d){_(g,l,d),o(l,b)},d(g){g&&t(l)}}}function ia(I){let l,b,g,d,v;return{c(){l=r("p"),b=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=r("code"),d=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(a){l=n(a,"P",{});var u=s(l);b=c(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=n(u,"CODE",{});var C=s(g);d=c(C,"Module"),C.forEach(t),v=c(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(t)},m(a,u){_(a,l,u),o(l,b),o(l,g),o(g,d),o(l,v)},d(a){a&&t(l)}}}function ca(I){let l,b,g,d,v;return d=new wt({props:{code:`from transformers import AutoImageProcessor, EfficientFormerForImageClassificationWithTeacher
import torch
from datasets import load_dataset

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

image_processor = AutoImageProcessor.from_pretrained("snap-research/efficientformer-l1-300")
model = EfficientFormerForImageClassificationWithTeacher.from_pretrained("snap-research/efficientformer-l1-300")

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, EfficientFormerForImageClassificationWithTeacher
<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;snap-research/efficientformer-l1-300&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = EfficientFormerForImageClassificationWithTeacher.from_pretrained(<span class="hljs-string">&quot;snap-research/efficientformer-l1-300&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(){l=r("p"),b=i("Example:"),g=p(),E(d.$$.fragment)},l(a){l=n(a,"P",{});var u=s(l);b=c(u,"Example:"),u.forEach(t),g=h(a),w(d.$$.fragment,a)},m(a,u){_(a,l,u),o(l,b),_(a,g,u),y(d,a,u),v=!0},p:Et,i(a){v||(F(d.$$.fragment,a),v=!0)},o(a){$(d.$$.fragment,a),v=!1},d(a){a&&t(l),a&&t(g),T(d,a)}}}function la(I){let l,b,g,d,v,a,u,C,yt,Vo,D,X,ho,we,Ft,go,$t,Uo,Q,Tt,ye,It,xt,Bo,Ke,Ct,Ho,Xe,uo,Pt,Yo,z,kt,Fe,zt,jt,$e,Mt,Nt,Te,At,qt,Go,S,Z,_o,Ie,Lt,vo,Dt,Jo,Qe,bo,Ze,St,Ko,W,ee,Eo,xe,Wt,wo,Ot,Xo,P,Ce,Rt,O,Vt,eo,Ut,Bt,Pe,Ht,Yt,Gt,R,Jt,oo,Kt,Xt,to,Qt,Zt,er,oe,Qo,V,te,yo,ke,or,Fo,tr,Zo,A,ze,rr,$o,nr,ar,re,je,sr,To,ir,et,U,ne,Io,Me,cr,xo,lr,ot,q,Ne,fr,Ae,dr,qe,mr,pr,hr,j,Le,gr,B,ur,ro,_r,vr,Co,br,Er,wr,ae,yr,se,tt,H,ie,Po,De,Fr,ko,$r,rt,k,Se,Tr,zo,Ir,xr,We,Cr,Oe,Pr,kr,zr,M,Re,jr,Y,Mr,no,Nr,Ar,jo,qr,Lr,Dr,ce,Sr,le,nt,G,fe,Mo,Ve,Wr,No,Or,at,x,Ue,Rr,Ao,Vr,Ur,de,Br,Be,Hr,He,Yr,Gr,Jr,N,Ye,Kr,J,Xr,ao,Qr,Zr,qo,en,on,tn,me,rn,pe,st;return a=new Ee({}),we=new Ee({}),Ie=new Ee({}),xe=new Ee({}),Ce=new K({props:{name:"class transformers.EfficientFormerConfig",anchor:"transformers.EfficientFormerConfig",parameters:[{name:"depths",val:": typing.List[int] = [3, 2, 6, 4]"},{name:"hidden_sizes",val:": typing.List[int] = [48, 96, 224, 448]"},{name:"downsamples",val:": typing.List[bool] = [True, True, True, True]"},{name:"dim",val:": int = 448"},{name:"key_dim",val:": int = 32"},{name:"attention_ratio",val:": int = 4"},{name:"resolution",val:": int = 7"},{name:"num_hidden_layers",val:": int = 5"},{name:"num_attention_heads",val:": int = 8"},{name:"mlp_expansion_ratio",val:": int = 4"},{name:"hidden_dropout_prob",val:": float = 0.0"},{name:"patch_size",val:": int = 16"},{name:"num_channels",val:": int = 3"},{name:"pool_size",val:": int = 3"},{name:"downsample_patch_size",val:": int = 3"},{name:"downsample_stride",val:": int = 2"},{name:"downsample_pad",val:": int = 1"},{name:"drop_path_rate",val:": float = 0.0"},{name:"num_meta3d_blocks",val:": int = 1"},{name:"distillation",val:": bool = True"},{name:"use_layer_scale",val:": bool = True"},{name:"layer_scale_init_value",val:": float = 1e-05"},{name:"hidden_act",val:": str = 'gelu'"},{name:"initializer_range",val:": float = 0.02"},{name:"layer_norm_eps",val:": float = 1e-12"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.EfficientFormerConfig.depths",description:`<strong>depths</strong> (<code>List(int)</code>, <em>optional</em>, defaults to <code>[3, 2, 6, 4]</code>) &#x2014;
Depth of each stage.`,name:"depths"},{anchor:"transformers.EfficientFormerConfig.hidden_sizes",description:`<strong>hidden_sizes</strong> (<code>List(int)</code>, <em>optional</em>, defaults to <code>[48, 96, 224, 448]</code>) &#x2014;
Dimensionality of each stage.`,name:"hidden_sizes"},{anchor:"transformers.EfficientFormerConfig.downsamples",description:`<strong>downsamples</strong> (<code>List(bool)</code>, <em>optional</em>, defaults to <code>[True, True, True, True]</code>) &#x2014;
Whether or not to downsample inputs between two stages.`,name:"downsamples"},{anchor:"transformers.EfficientFormerConfig.dim",description:`<strong>dim</strong> (<code>int</code>, <em>optional</em>, defaults to 448) &#x2014;
Number of channels in Meta3D layers`,name:"dim"},{anchor:"transformers.EfficientFormerConfig.key_dim",description:`<strong>key_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 32) &#x2014;
The size of the key in meta3D block.`,name:"key_dim"},{anchor:"transformers.EfficientFormerConfig.attention_ratio",description:`<strong>attention_ratio</strong> (<code>int</code>, <em>optional</em>, defaults to 4) &#x2014;
Ratio of the dimension of the query and value to the dimension of the key in MSHA block`,name:"attention_ratio"},{anchor:"transformers.EfficientFormerConfig.resolution",description:`<strong>resolution</strong> (<code>int</code>, <em>optional</em>, defaults to 5) &#x2014;
Size of each patch`,name:"resolution"},{anchor:"transformers.EfficientFormerConfig.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 5) &#x2014;
Number of hidden layers in the Transformer encoder.`,name:"num_hidden_layers"},{anchor:"transformers.EfficientFormerConfig.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 8) &#x2014;
Number of attention heads for each attention layer in the 3D MetaBlock.`,name:"num_attention_heads"},{anchor:"transformers.EfficientFormerConfig.mlp_expansion_ratio",description:`<strong>mlp_expansion_ratio</strong> (<code>int</code>, <em>optional</em>, defaults to 4) &#x2014;
Ratio of size of the hidden dimensionality of an MLP to the dimensionality of its input.`,name:"mlp_expansion_ratio"},{anchor:"transformers.EfficientFormerConfig.hidden_dropout_prob",description:`<strong>hidden_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout probability for all fully connected layers in the embeddings and encoder.`,name:"hidden_dropout_prob"},{anchor:"transformers.EfficientFormerConfig.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, <em>optional</em>, defaults to 16) &#x2014;
The size (resolution) of each patch.`,name:"patch_size"},{anchor:"transformers.EfficientFormerConfig.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.EfficientFormerConfig.pool_size",description:`<strong>pool_size</strong> (<code>int</code>, <em>optional</em>, defaults to 3) &#x2014;
Kernel size of pooling layers.`,name:"pool_size"},{anchor:"transformers.EfficientFormerConfig.downsample_patch_size",description:`<strong>downsample_patch_size</strong> (<code>int</code>, <em>optional</em>, defaults to 3) &#x2014;
The size of patches in downsampling layers.`,name:"downsample_patch_size"},{anchor:"transformers.EfficientFormerConfig.downsample_stride",description:`<strong>downsample_stride</strong> (<code>int</code>, <em>optional</em>, defaults to 2) &#x2014;
The stride of convolution kernels in downsampling layers.`,name:"downsample_stride"},{anchor:"transformers.EfficientFormerConfig.downsample_pad",description:`<strong>downsample_pad</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
Padding in downsampling layers.`,name:"downsample_pad"},{anchor:"transformers.EfficientFormerConfig.drop_path_rate",description:`<strong>drop_path_rate</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
Rate at which to increase dropout probability in DropPath.`,name:"drop_path_rate"},{anchor:"transformers.EfficientFormerConfig.num_meta3d_blocks",description:`<strong>num_meta3d_blocks</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of 3D MetaBlocks in the last stage.`,name:"num_meta3d_blocks"},{anchor:"transformers.EfficientFormerConfig.distillation",description:`<strong>distillation</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to add a distillation head.`,name:"distillation"},{anchor:"transformers.EfficientFormerConfig.use_layer_scale",description:`<strong>use_layer_scale</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to scale outputs from token mixers.`,name:"use_layer_scale"},{anchor:"transformers.EfficientFormerConfig.layer_scale_init_value",description:`<strong>layer_scale_init_value</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-5) &#x2014;
Factor by which outputs from token mixers are scaled.`,name:"layer_scale_init_value"},{anchor:"transformers.EfficientFormerConfig.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code> or <code>function</code>, <em>optional</em>, defaults to <code>&quot;gelu&quot;</code>) &#x2014;
The non-linear activation function (function or string) in the encoder and pooler. If string, <code>&quot;gelu&quot;</code>,
<code>&quot;relu&quot;</code>, <code>&quot;selu&quot;</code> and <code>&quot;gelu_new&quot;</code> are supported.`,name:"hidden_act"},{anchor:"transformers.EfficientFormerConfig.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.EfficientFormerConfig.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"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/efficientformer/configuration_efficientformer.py#L32"}}),oe=new bt({props:{anchor:"transformers.EfficientFormerConfig.example",$$slots:{default:[oa]},$$scope:{ctx:I}}}),ke=new Ee({}),ze=new K({props:{name:"class transformers.EfficientFormerImageProcessor",anchor:"transformers.EfficientFormerImageProcessor",parameters:[{name:"do_resize",val:": bool = True"},{name:"size",val:": typing.Union[typing.Dict[str, int], NoneType] = None"},{name:"resample",val:": Resampling = <Resampling.BICUBIC: 3>"},{name:"do_center_crop",val:": bool = True"},{name:"do_rescale",val:": bool = True"},{name:"rescale_factor",val:": typing.Union[int, float] = 0.00392156862745098"},{name:"crop_size",val:": typing.Dict[str, int] = None"},{name:"do_normalize",val:": bool = True"},{name:"image_mean",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"image_std",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.EfficientFormerImageProcessor.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to resize the image&#x2019;s (height, width) dimensions to the specified <code>(size[&quot;height&quot;], size[&quot;width&quot;])</code>. Can be overridden by the <code>do_resize</code> parameter in the <code>preprocess</code> method.`,name:"do_resize"},{anchor:"transformers.EfficientFormerImageProcessor.size",description:`<strong>size</strong> (<code>dict</code>, <em>optional</em>, defaults to <code>{&quot;height&quot; -- 224, &quot;width&quot;: 224}</code>):
Size of the output image after resizing. Can be overridden by the <code>size</code> parameter in the <code>preprocess</code>
method.`,name:"size"},{anchor:"transformers.EfficientFormerImageProcessor.resample",description:`<strong>resample</strong> (<code>PILImageResampling</code>, <em>optional</em>, defaults to <code>PILImageResampling.BILINEAR</code>) &#x2014;
Resampling filter to use if resizing the image. Can be overridden by the <code>resample</code> parameter in the
<code>preprocess</code> method.`,name:"resample"},{anchor:"transformers.EfficientFormerImageProcessor.do_center_crop",description:`<strong>do_center_crop</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to center crop the image to the specified <code>crop_size</code>. Can be overridden by <code>do_center_crop</code> in the
<code>preprocess</code> method.`,name:"do_center_crop"},{anchor:"transformers.EfficientFormerImageProcessor.crop_size",description:`<strong>crop_size</strong> (<code>Dict[str, int]</code> <em>optional</em>, defaults to 224) &#x2014;
Size of the output image after applying <code>center_crop</code>. Can be overridden by <code>crop_size</code> in the <code>preprocess</code>
method.`,name:"crop_size"},{anchor:"transformers.EfficientFormerImageProcessor.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to rescale the image by the specified scale <code>rescale_factor</code>. Can be overridden by the <code>do_rescale</code>
parameter in the <code>preprocess</code> method.`,name:"do_rescale"},{anchor:"transformers.EfficientFormerImageProcessor.rescale_factor",description:`<strong>rescale_factor</strong> (<code>int</code> or <code>float</code>, <em>optional</em>, defaults to <code>1/255</code>) &#x2014;
Scale factor to use if rescaling the image. Can be overridden by the <code>rescale_factor</code> parameter in the
<code>preprocess</code> method.
do_normalize &#x2014;
Whether to normalize the image. Can be overridden by the <code>do_normalize</code> parameter in the <code>preprocess</code>
method.`,name:"rescale_factor"},{anchor:"transformers.EfficientFormerImageProcessor.image_mean",description:`<strong>image_mean</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>IMAGENET_STANDARD_MEAN</code>) &#x2014;
Mean to use if normalizing the image. This is a float or list of floats the length of the number of
channels in the image. Can be overridden by the <code>image_mean</code> parameter in the <code>preprocess</code> method.`,name:"image_mean"},{anchor:"transformers.EfficientFormerImageProcessor.image_std",description:`<strong>image_std</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>IMAGENET_STANDARD_STD</code>) &#x2014;
Standard deviation to use if normalizing the image. This is a float or list of floats the length of the
number of channels in the image. Can be overridden by the <code>image_std</code> parameter in the <code>preprocess</code> method.`,name:"image_std"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/efficientformer/image_processing_efficientformer.py#L46"}}),je=new K({props:{name:"preprocess",anchor:"transformers.EfficientFormerImageProcessor.preprocess",parameters:[{name:"images",val:": typing.Union[ForwardRef('PIL.Image.Image'), numpy.ndarray, ForwardRef('torch.Tensor'), typing.List[ForwardRef('PIL.Image.Image')], typing.List[numpy.ndarray], typing.List[ForwardRef('torch.Tensor')]]"},{name:"do_resize",val:": typing.Optional[bool] = None"},{name:"size",val:": typing.Dict[str, int] = None"},{name:"resample",val:": Resampling = None"},{name:"do_center_crop",val:": bool = None"},{name:"crop_size",val:": int = None"},{name:"do_rescale",val:": typing.Optional[bool] = None"},{name:"rescale_factor",val:": typing.Optional[float] = None"},{name:"do_normalize",val:": typing.Optional[bool] = None"},{name:"image_mean",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"image_std",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"return_tensors",val:": typing.Union[str, transformers.utils.generic.TensorType, NoneType] = None"},{name:"data_format",val:": typing.Union[str, transformers.image_utils.ChannelDimension] = <ChannelDimension.FIRST: 'channels_first'>"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.EfficientFormerImageProcessor.preprocess.images",description:`<strong>images</strong> (<code>ImageInput</code>) &#x2014;
Image to preprocess.`,name:"images"},{anchor:"transformers.EfficientFormerImageProcessor.preprocess.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_resize</code>) &#x2014;
Whether to resize the image.`,name:"do_resize"},{anchor:"transformers.EfficientFormerImageProcessor.preprocess.size",description:`<strong>size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>self.size</code>) &#x2014;
Dictionary in the format <code>{&quot;height&quot;: h, &quot;width&quot;: w}</code> specifying the size of the output image after
resizing.`,name:"size"},{anchor:"transformers.EfficientFormerImageProcessor.preprocess.resample",description:`<strong>resample</strong> (<code>PILImageResampling</code> filter, <em>optional</em>, defaults to <code>self.resample</code>) &#x2014;
<code>PILImageResampling</code> filter to use if resizing the image e.g. <code>PILImageResampling.BILINEAR</code>. Only has
an effect if <code>do_resize</code> is set to <code>True</code>.`,name:"resample"},{anchor:"transformers.EfficientFormerImageProcessor.preprocess.do_center_crop",description:`<strong>do_center_crop</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_center_crop</code>) &#x2014;
Whether to center crop the image.`,name:"do_center_crop"},{anchor:"transformers.EfficientFormerImageProcessor.preprocess.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_rescale</code>) &#x2014;
Whether to rescale the image values between [0 - 1].`,name:"do_rescale"},{anchor:"transformers.EfficientFormerImageProcessor.preprocess.rescale_factor",description:`<strong>rescale_factor</strong> (<code>float</code>, <em>optional</em>, defaults to <code>self.rescale_factor</code>) &#x2014;
Rescale factor to rescale the image by if <code>do_rescale</code> is set to <code>True</code>.`,name:"rescale_factor"},{anchor:"transformers.EfficientFormerImageProcessor.preprocess.crop_size",description:`<strong>crop_size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>self.crop_size</code>) &#x2014;
Size of the center crop. Only has an effect if <code>do_center_crop</code> is set to <code>True</code>.`,name:"crop_size"},{anchor:"transformers.EfficientFormerImageProcessor.preprocess.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_normalize</code>) &#x2014;
Whether to normalize the image.`,name:"do_normalize"},{anchor:"transformers.EfficientFormerImageProcessor.preprocess.image_mean",description:`<strong>image_mean</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>self.image_mean</code>) &#x2014;
Image mean to use if <code>do_normalize</code> is set to <code>True</code>.`,name:"image_mean"},{anchor:"transformers.EfficientFormerImageProcessor.preprocess.image_std",description:`<strong>image_std</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>self.image_std</code>) &#x2014;
Image standard deviation to use if <code>do_normalize</code> is set to <code>True</code>.`,name:"image_std"},{anchor:"transformers.EfficientFormerImageProcessor.preprocess.return_tensors",description:`<strong>return_tensors</strong> (<code>str</code> or <code>TensorType</code>, <em>optional</em>) &#x2014;
The type of tensors to return. Can be one of:<ul>
<li>Unset: Return a list of <code>np.ndarray</code>.</li>
<li><code>TensorType.TENSORFLOW</code> or <code>&apos;tf&apos;</code>: Return a batch of type <code>tf.Tensor</code>.</li>
<li><code>TensorType.PYTORCH</code> or <code>&apos;pt&apos;</code>: Return a batch of type <code>torch.Tensor</code>.</li>
<li><code>TensorType.NUMPY</code> or <code>&apos;np&apos;</code>: Return a batch of type <code>np.ndarray</code>.</li>
<li><code>TensorType.JAX</code> or <code>&apos;jax&apos;</code>: Return a batch of type <code>jax.numpy.ndarray</code>.</li>
</ul>`,name:"return_tensors"},{anchor:"transformers.EfficientFormerImageProcessor.preprocess.data_format",description:`<strong>data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>, defaults to <code>ChannelDimension.FIRST</code>) &#x2014;
The channel dimension format for the output image. Can be one of:<ul>
<li><code>&quot;channels_first&quot;</code> or <code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li>
<li><code>&quot;channels_last&quot;</code> or <code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.</li>
<li>Unset: Use the channel dimension format of the input image.</li>
</ul>`,name:"data_format"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/efficientformer/image_processing_efficientformer.py#L229"}}),Me=new Ee({}),Ne=new K({props:{name:"class transformers.EfficientFormerModel",anchor:"transformers.EfficientFormerModel",parameters:[{name:"config",val:": EfficientFormerConfig"}],parametersDescription:[{anchor:"transformers.EfficientFormerModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.27.1/en/model_doc/efficientformer#transformers.EfficientFormerConfig">EfficientFormerConfig</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/efficientformer/modeling_efficientformer.py#L546"}}),Le=new K({props:{name:"forward",anchor:"transformers.EfficientFormerModel.forward",parameters:[{name:"pixel_values",val:": typing.Optional[torch.Tensor] = 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.EfficientFormerModel.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/vit#transformers.ViTFeatureExtractor">ViTFeatureExtractor</a>. See
<a href="/docs/transformers/v4.27.1/en/model_doc/videomae#transformers.VideoMAEFeatureExtractor.__call__">ViTFeatureExtractor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.EfficientFormerModel.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.EfficientFormerModel.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.EfficientFormerModel.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/efficientformer/modeling_efficientformer.py#L558",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.27.1/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.27.1/en/model_doc/efficientformer#transformers.EfficientFormerConfig"
>EfficientFormerConfig</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>) \u2014 Last layer hidden-state of the first token of the sequence (classification token) after further processing
through the layers used for the auxiliary pretraining task. E.g. for BERT-family of models, this returns
the classification token after processing through a linear layer and a tanh activation function. The linear
layer weights are trained from the next sentence prediction (classification) objective during pretraining.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.27.1/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ae=new vt({props:{$$slots:{default:[ta]},$$scope:{ctx:I}}}),se=new bt({props:{anchor:"transformers.EfficientFormerModel.forward.example",$$slots:{default:[ra]},$$scope:{ctx:I}}}),De=new Ee({}),Se=new K({props:{name:"class transformers.EfficientFormerForImageClassification",anchor:"transformers.EfficientFormerForImageClassification",parameters:[{name:"config",val:": EfficientFormerConfig"}],parametersDescription:[{anchor:"transformers.EfficientFormerForImageClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.27.1/en/model_doc/efficientformer#transformers.EfficientFormerConfig">EfficientFormerConfig</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/efficientformer/modeling_efficientformer.py#L608"}}),Re=new K({props:{name:"forward",anchor:"transformers.EfficientFormerForImageClassification.forward",parameters:[{name:"pixel_values",val:": typing.Optional[torch.Tensor] = None"},{name:"labels",val:": typing.Optional[torch.Tensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.EfficientFormerForImageClassification.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/vit#transformers.ViTFeatureExtractor">ViTFeatureExtractor</a>. See
<a href="/docs/transformers/v4.27.1/en/model_doc/videomae#transformers.VideoMAEFeatureExtractor.__call__">ViTFeatureExtractor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.EfficientFormerForImageClassification.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.EfficientFormerForImageClassification.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.EfficientFormerForImageClassification.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.EfficientFormerForImageClassification.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/efficientformer/modeling_efficientformer.py#L623",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.27.1/en/main_classes/output#transformers.modeling_outputs.ImageClassifierOutput"
>transformers.modeling_outputs.ImageClassifierOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.27.1/en/model_doc/efficientformer#transformers.EfficientFormerConfig"
>EfficientFormerConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) \u2014 Classification (or regression if config.num_labels==1) loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.num_labels)</code>) \u2014 Classification (or regression if config.num_labels==1) scores (before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each stage) of shape <code>(batch_size, sequence_length, hidden_size)</code>. Hidden-states
(also called feature maps) of the model at the output of each stage.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, patch_size, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.27.1/en/main_classes/output#transformers.modeling_outputs.ImageClassifierOutput"
>transformers.modeling_outputs.ImageClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ce=new vt({props:{$$slots:{default:[na]},$$scope:{ctx:I}}}),le=new bt({props:{anchor:"transformers.EfficientFormerForImageClassification.forward.example",$$slots:{default:[aa]},$$scope:{ctx:I}}}),Ve=new Ee({}),Ue=new K({props:{name:"class transformers.EfficientFormerForImageClassificationWithTeacher",anchor:"transformers.EfficientFormerForImageClassificationWithTeacher",parameters:[{name:"config",val:": EfficientFormerConfig"}],parametersDescription:[{anchor:"transformers.EfficientFormerForImageClassificationWithTeacher.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.27.1/en/model_doc/efficientformer#transformers.EfficientFormerConfig">EfficientFormerConfig</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/efficientformer/modeling_efficientformer.py#L738"}}),de=new vt({props:{warning:!0,$$slots:{default:[sa]},$$scope:{ctx:I}}}),Ye=new K({props:{name:"forward",anchor:"transformers.EfficientFormerForImageClassificationWithTeacher.forward",parameters:[{name:"pixel_values",val:": typing.Optional[torch.Tensor] = 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.EfficientFormerForImageClassificationWithTeacher.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/vit#transformers.ViTFeatureExtractor">ViTFeatureExtractor</a>. See
<a href="/docs/transformers/v4.27.1/en/model_doc/videomae#transformers.VideoMAEFeatureExtractor.__call__">ViTFeatureExtractor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.EfficientFormerForImageClassificationWithTeacher.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.EfficientFormerForImageClassificationWithTeacher.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.EfficientFormerForImageClassificationWithTeacher.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/efficientformer/modeling_efficientformer.py#L755",returnDescription:`
<p>A <code>transformers.models.efficientformer.modeling_efficientformer.EfficientFormerForImageClassificationWithTeacherOutput</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/efficientformer#transformers.EfficientFormerConfig"
>EfficientFormerConfig</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 cls_logits and distillation logits.</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>
<li><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>. Attentions weights after the attention softmax, used to compute the weighted average in
the self-attention heads.</li>
</ul>
`,returnType:`
<p><code>transformers.models.efficientformer.modeling_efficientformer.EfficientFormerForImageClassificationWithTeacherOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),me=new vt({props:{$$slots:{default:[ia]},$$scope:{ctx:I}}}),pe=new bt({props:{anchor:"transformers.EfficientFormerForImageClassificationWithTeacher.forward.example",$$slots:{default:[ca]},$$scope:{ctx:I}}}),{c(){l=r("meta"),b=p(),g=r("h1"),d=r("a"),v=r("span"),E(a.$$.fragment),u=p(),C=r("span"),yt=i("EfficientFormer"),Vo=p(),D=r("h2"),X=r("a"),ho=r("span"),E(we.$$.fragment),Ft=p(),go=r("span"),$t=i("Overview"),Uo=p(),Q=r("p"),Tt=i("The EfficientFormer model was proposed in "),ye=r("a"),It=i("EfficientFormer: Vision Transformers at MobileNet Speed"),xt=i(`
by Yanyu Li, Geng Yuan, Yang Wen, Eric Hu, Georgios Evangelidis, Sergey Tulyakov, Yanzhi Wang, Jian Ren.  EfficientFormer proposes a
dimension-consistent pure transformer that can be run on mobile devices for dense prediction tasks like image classification, object
detection and semantic segmentation.`),Bo=p(),Ke=r("p"),Ct=i("The abstract from the paper is the following:"),Ho=p(),Xe=r("p"),uo=r("em"),Pt=i(`Vision Transformers (ViT) have shown rapid progress in computer vision tasks, achieving promising results on various benchmarks.
However, due to the massive number of parameters and model design, e.g., attention mechanism, ViT-based models are generally
times slower than lightweight convolutional networks. Therefore, the deployment of ViT for real-time applications is particularly
challenging, especially on resource-constrained hardware such as mobile devices. Recent efforts try to reduce the computation
complexity of ViT through network architecture search or hybrid design with MobileNet block, yet the inference speed is still
unsatisfactory. This leads to an important question: can transformers run as fast as MobileNet while obtaining high performance?
To answer this, we first revisit the network architecture and operators used in ViT-based models and identify inefficient designs.
Then we introduce a dimension-consistent pure transformer (without MobileNet blocks) as a design paradigm.
Finally, we perform latency-driven slimming to get a series of final models dubbed EfficientFormer.
Extensive experiments show the superiority of EfficientFormer in performance and speed on mobile devices.
Our fastest model, EfficientFormer-L1, achieves 79.2% top-1 accuracy on ImageNet-1K with only 1.6 ms inference latency on
iPhone 12 (compiled with CoreML), which { runs as fast as MobileNetV2\xD71.4 (1.6 ms, 74.7% top-1),} and our largest model,
EfficientFormer-L7, obtains 83.3% accuracy with only 7.0 ms latency. Our work proves that properly designed transformers can
reach extremely low latency on mobile devices while maintaining high performance.`),Yo=p(),z=r("p"),kt=i("This model was contributed by "),Fe=r("a"),zt=i("novice03"),jt=i(" and "),$e=r("a"),Mt=i("Bearnardd"),Nt=i(`.
The original code can be found `),Te=r("a"),At=i("here"),qt=i("."),Go=p(),S=r("h2"),Z=r("a"),_o=r("span"),E(Ie.$$.fragment),Lt=p(),vo=r("span"),Dt=i("Documentation resources"),Jo=p(),Qe=r("ul"),bo=r("li"),Ze=r("a"),St=i("Image classification task guide"),Ko=p(),W=r("h2"),ee=r("a"),Eo=r("span"),E(xe.$$.fragment),Wt=p(),wo=r("span"),Ot=i("EfficientFormerConfig"),Xo=p(),P=r("div"),E(Ce.$$.fragment),Rt=p(),O=r("p"),Vt=i("This is the configuration class to store the configuration of an "),eo=r("a"),Ut=i("EfficientFormerModel"),Bt=i(`. It is used to
instantiate an EfficientFormer 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 EfficientFormer
`),Pe=r("a"),Ht=i("snap-research/efficientformer-l1"),Yt=i(" architecture."),Gt=p(),R=r("p"),Jt=i("Configuration objects inherit from "),oo=r("a"),Kt=i("PretrainedConfig"),Xt=i(` and can be used to control the model outputs. Read the
documentation from `),to=r("a"),Qt=i("PretrainedConfig"),Zt=i(" for more information."),er=p(),E(oe.$$.fragment),Qo=p(),V=r("h2"),te=r("a"),yo=r("span"),E(ke.$$.fragment),or=p(),Fo=r("span"),tr=i("EfficientFormerImageProcessor"),Zo=p(),A=r("div"),E(ze.$$.fragment),rr=p(),$o=r("p"),nr=i("Constructs a EfficientFormer image processor."),ar=p(),re=r("div"),E(je.$$.fragment),sr=p(),To=r("p"),ir=i("Preprocess an image or batch of images."),et=p(),U=r("h2"),ne=r("a"),Io=r("span"),E(Me.$$.fragment),cr=p(),xo=r("span"),lr=i("EfficientFormerModel"),ot=p(),q=r("div"),E(Ne.$$.fragment),fr=p(),Ae=r("p"),dr=i(`The bare EfficientFormer Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),qe=r("a"),mr=i("nn.Module"),pr=i(` subclass. Use it as a
regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and behavior.`),hr=p(),j=r("div"),E(Le.$$.fragment),gr=p(),B=r("p"),ur=i("The "),ro=r("a"),_r=i("EfficientFormerModel"),vr=i(" forward method, overrides the "),Co=r("code"),br=i("__call__"),Er=i(" special method."),wr=p(),E(ae.$$.fragment),yr=p(),E(se.$$.fragment),tt=p(),H=r("h2"),ie=r("a"),Po=r("span"),E(De.$$.fragment),Fr=p(),ko=r("span"),$r=i("EfficientFormerForImageClassification"),rt=p(),k=r("div"),E(Se.$$.fragment),Tr=p(),zo=r("p"),Ir=i(`EfficientFormer 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.`),xr=p(),We=r("p"),Cr=i("This model is a PyTorch "),Oe=r("a"),Pr=i("nn.Module"),kr=i(` subclass. Use it as a
regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and behavior.`),zr=p(),M=r("div"),E(Re.$$.fragment),jr=p(),Y=r("p"),Mr=i("The "),no=r("a"),Nr=i("EfficientFormerForImageClassification"),Ar=i(" forward method, overrides the "),jo=r("code"),qr=i("__call__"),Lr=i(" special method."),Dr=p(),E(ce.$$.fragment),Sr=p(),E(le.$$.fragment),nt=p(),G=r("h2"),fe=r("a"),Mo=r("span"),E(Ve.$$.fragment),Wr=p(),No=r("span"),Or=i("EfficientFormerForImageClassificationWithTeacher"),at=p(),x=r("div"),E(Ue.$$.fragment),Rr=p(),Ao=r("p"),Vr=i(`EfficientFormer Model transformer with image classification heads on top (a linear layer on top of the final hidden
state of the [CLS] token and a linear layer on top of the final hidden state of the distillation token) e.g. for
ImageNet.`),Ur=p(),E(de.$$.fragment),Br=p(),Be=r("p"),Hr=i("This model is a PyTorch "),He=r("a"),Yr=i("nn.Module"),Gr=i(` subclass. Use it as a
regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and behavior.`),Jr=p(),N=r("div"),E(Ye.$$.fragment),Kr=p(),J=r("p"),Xr=i("The "),ao=r("a"),Qr=i("EfficientFormerForImageClassificationWithTeacher"),Zr=i(" forward method, overrides the "),qo=r("code"),en=i("__call__"),on=i(" special method."),tn=p(),E(me.$$.fragment),rn=p(),E(pe.$$.fragment),this.h()},l(e){const m=Zn('[data-svelte="svelte-1phssyn"]',document.head);l=n(m,"META",{name:!0,content:!0}),m.forEach(t),b=h(e),g=n(e,"H1",{class:!0});var Ge=s(g);d=n(Ge,"A",{id:!0,class:!0,href:!0});var Lo=s(d);v=n(Lo,"SPAN",{});var Do=s(v);w(a.$$.fragment,Do),Do.forEach(t),Lo.forEach(t),u=h(Ge),C=n(Ge,"SPAN",{});var So=s(C);yt=c(So,"EfficientFormer"),So.forEach(t),Ge.forEach(t),Vo=h(e),D=n(e,"H2",{class:!0});var Je=s(D);X=n(Je,"A",{id:!0,class:!0,href:!0});var Wo=s(X);ho=n(Wo,"SPAN",{});var Oo=s(ho);w(we.$$.fragment,Oo),Oo.forEach(t),Wo.forEach(t),Ft=h(Je),go=n(Je,"SPAN",{});var Ro=s(go);$t=c(Ro,"Overview"),Ro.forEach(t),Je.forEach(t),Uo=h(e),Q=n(e,"P",{});var it=s(Q);Tt=c(it,"The EfficientFormer model was proposed in "),ye=n(it,"A",{href:!0,rel:!0});var nn=s(ye);It=c(nn,"EfficientFormer: Vision Transformers at MobileNet Speed"),nn.forEach(t),xt=c(it,`
by Yanyu Li, Geng Yuan, Yang Wen, Eric Hu, Georgios Evangelidis, Sergey Tulyakov, Yanzhi Wang, Jian Ren.  EfficientFormer proposes a
dimension-consistent pure transformer that can be run on mobile devices for dense prediction tasks like image classification, object
detection and semantic segmentation.`),it.forEach(t),Bo=h(e),Ke=n(e,"P",{});var an=s(Ke);Ct=c(an,"The abstract from the paper is the following:"),an.forEach(t),Ho=h(e),Xe=n(e,"P",{});var sn=s(Xe);uo=n(sn,"EM",{});var cn=s(uo);Pt=c(cn,`Vision Transformers (ViT) have shown rapid progress in computer vision tasks, achieving promising results on various benchmarks.
However, due to the massive number of parameters and model design, e.g., attention mechanism, ViT-based models are generally
times slower than lightweight convolutional networks. Therefore, the deployment of ViT for real-time applications is particularly
challenging, especially on resource-constrained hardware such as mobile devices. Recent efforts try to reduce the computation
complexity of ViT through network architecture search or hybrid design with MobileNet block, yet the inference speed is still
unsatisfactory. This leads to an important question: can transformers run as fast as MobileNet while obtaining high performance?
To answer this, we first revisit the network architecture and operators used in ViT-based models and identify inefficient designs.
Then we introduce a dimension-consistent pure transformer (without MobileNet blocks) as a design paradigm.
Finally, we perform latency-driven slimming to get a series of final models dubbed EfficientFormer.
Extensive experiments show the superiority of EfficientFormer in performance and speed on mobile devices.
Our fastest model, EfficientFormer-L1, achieves 79.2% top-1 accuracy on ImageNet-1K with only 1.6 ms inference latency on
iPhone 12 (compiled with CoreML), which { runs as fast as MobileNetV2\xD71.4 (1.6 ms, 74.7% top-1),} and our largest model,
EfficientFormer-L7, obtains 83.3% accuracy with only 7.0 ms latency. Our work proves that properly designed transformers can
reach extremely low latency on mobile devices while maintaining high performance.`),cn.forEach(t),sn.forEach(t),Yo=h(e),z=n(e,"P",{});var he=s(z);kt=c(he,"This model was contributed by "),Fe=n(he,"A",{href:!0,rel:!0});var ln=s(Fe);zt=c(ln,"novice03"),ln.forEach(t),jt=c(he," and "),$e=n(he,"A",{href:!0,rel:!0});var fn=s($e);Mt=c(fn,"Bearnardd"),fn.forEach(t),Nt=c(he,`.
The original code can be found `),Te=n(he,"A",{href:!0,rel:!0});var dn=s(Te);At=c(dn,"here"),dn.forEach(t),qt=c(he,"."),he.forEach(t),Go=h(e),S=n(e,"H2",{class:!0});var ct=s(S);Z=n(ct,"A",{id:!0,class:!0,href:!0});var mn=s(Z);_o=n(mn,"SPAN",{});var pn=s(_o);w(Ie.$$.fragment,pn),pn.forEach(t),mn.forEach(t),Lt=h(ct),vo=n(ct,"SPAN",{});var hn=s(vo);Dt=c(hn,"Documentation resources"),hn.forEach(t),ct.forEach(t),Jo=h(e),Qe=n(e,"UL",{});var gn=s(Qe);bo=n(gn,"LI",{});var un=s(bo);Ze=n(un,"A",{href:!0});var _n=s(Ze);St=c(_n,"Image classification task guide"),_n.forEach(t),un.forEach(t),gn.forEach(t),Ko=h(e),W=n(e,"H2",{class:!0});var lt=s(W);ee=n(lt,"A",{id:!0,class:!0,href:!0});var vn=s(ee);Eo=n(vn,"SPAN",{});var bn=s(Eo);w(xe.$$.fragment,bn),bn.forEach(t),vn.forEach(t),Wt=h(lt),wo=n(lt,"SPAN",{});var En=s(wo);Ot=c(En,"EfficientFormerConfig"),En.forEach(t),lt.forEach(t),Xo=h(e),P=n(e,"DIV",{class:!0});var ge=s(P);w(Ce.$$.fragment,ge),Rt=h(ge),O=n(ge,"P",{});var so=s(O);Vt=c(so,"This is the configuration class to store the configuration of an "),eo=n(so,"A",{href:!0});var wn=s(eo);Ut=c(wn,"EfficientFormerModel"),wn.forEach(t),Bt=c(so,`. It is used to
instantiate an EfficientFormer 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 EfficientFormer
`),Pe=n(so,"A",{href:!0,rel:!0});var yn=s(Pe);Ht=c(yn,"snap-research/efficientformer-l1"),yn.forEach(t),Yt=c(so," architecture."),so.forEach(t),Gt=h(ge),R=n(ge,"P",{});var io=s(R);Jt=c(io,"Configuration objects inherit from "),oo=n(io,"A",{href:!0});var Fn=s(oo);Kt=c(Fn,"PretrainedConfig"),Fn.forEach(t),Xt=c(io,` and can be used to control the model outputs. Read the
documentation from `),to=n(io,"A",{href:!0});var $n=s(to);Qt=c($n,"PretrainedConfig"),$n.forEach(t),Zt=c(io," for more information."),io.forEach(t),er=h(ge),w(oe.$$.fragment,ge),ge.forEach(t),Qo=h(e),V=n(e,"H2",{class:!0});var ft=s(V);te=n(ft,"A",{id:!0,class:!0,href:!0});var Tn=s(te);yo=n(Tn,"SPAN",{});var In=s(yo);w(ke.$$.fragment,In),In.forEach(t),Tn.forEach(t),or=h(ft),Fo=n(ft,"SPAN",{});var xn=s(Fo);tr=c(xn,"EfficientFormerImageProcessor"),xn.forEach(t),ft.forEach(t),Zo=h(e),A=n(e,"DIV",{class:!0});var co=s(A);w(ze.$$.fragment,co),rr=h(co),$o=n(co,"P",{});var Cn=s($o);nr=c(Cn,"Constructs a EfficientFormer image processor."),Cn.forEach(t),ar=h(co),re=n(co,"DIV",{class:!0});var dt=s(re);w(je.$$.fragment,dt),sr=h(dt),To=n(dt,"P",{});var Pn=s(To);ir=c(Pn,"Preprocess an image or batch of images."),Pn.forEach(t),dt.forEach(t),co.forEach(t),et=h(e),U=n(e,"H2",{class:!0});var mt=s(U);ne=n(mt,"A",{id:!0,class:!0,href:!0});var kn=s(ne);Io=n(kn,"SPAN",{});var zn=s(Io);w(Me.$$.fragment,zn),zn.forEach(t),kn.forEach(t),cr=h(mt),xo=n(mt,"SPAN",{});var jn=s(xo);lr=c(jn,"EfficientFormerModel"),jn.forEach(t),mt.forEach(t),ot=h(e),q=n(e,"DIV",{class:!0});var lo=s(q);w(Ne.$$.fragment,lo),fr=h(lo),Ae=n(lo,"P",{});var pt=s(Ae);dr=c(pt,`The bare EfficientFormer Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),qe=n(pt,"A",{href:!0,rel:!0});var Mn=s(qe);mr=c(Mn,"nn.Module"),Mn.forEach(t),pr=c(pt,` subclass. Use it as a
regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and behavior.`),pt.forEach(t),hr=h(lo),j=n(lo,"DIV",{class:!0});var ue=s(j);w(Le.$$.fragment,ue),gr=h(ue),B=n(ue,"P",{});var fo=s(B);ur=c(fo,"The "),ro=n(fo,"A",{href:!0});var Nn=s(ro);_r=c(Nn,"EfficientFormerModel"),Nn.forEach(t),vr=c(fo," forward method, overrides the "),Co=n(fo,"CODE",{});var An=s(Co);br=c(An,"__call__"),An.forEach(t),Er=c(fo," special method."),fo.forEach(t),wr=h(ue),w(ae.$$.fragment,ue),yr=h(ue),w(se.$$.fragment,ue),ue.forEach(t),lo.forEach(t),tt=h(e),H=n(e,"H2",{class:!0});var ht=s(H);ie=n(ht,"A",{id:!0,class:!0,href:!0});var qn=s(ie);Po=n(qn,"SPAN",{});var Ln=s(Po);w(De.$$.fragment,Ln),Ln.forEach(t),qn.forEach(t),Fr=h(ht),ko=n(ht,"SPAN",{});var Dn=s(ko);$r=c(Dn,"EfficientFormerForImageClassification"),Dn.forEach(t),ht.forEach(t),rt=h(e),k=n(e,"DIV",{class:!0});var _e=s(k);w(Se.$$.fragment,_e),Tr=h(_e),zo=n(_e,"P",{});var Sn=s(zo);Ir=c(Sn,`EfficientFormer 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.`),Sn.forEach(t),xr=h(_e),We=n(_e,"P",{});var gt=s(We);Cr=c(gt,"This model is a PyTorch "),Oe=n(gt,"A",{href:!0,rel:!0});var Wn=s(Oe);Pr=c(Wn,"nn.Module"),Wn.forEach(t),kr=c(gt,` subclass. Use it as a
regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and behavior.`),gt.forEach(t),zr=h(_e),M=n(_e,"DIV",{class:!0});var ve=s(M);w(Re.$$.fragment,ve),jr=h(ve),Y=n(ve,"P",{});var mo=s(Y);Mr=c(mo,"The "),no=n(mo,"A",{href:!0});var On=s(no);Nr=c(On,"EfficientFormerForImageClassification"),On.forEach(t),Ar=c(mo," forward method, overrides the "),jo=n(mo,"CODE",{});var Rn=s(jo);qr=c(Rn,"__call__"),Rn.forEach(t),Lr=c(mo," special method."),mo.forEach(t),Dr=h(ve),w(ce.$$.fragment,ve),Sr=h(ve),w(le.$$.fragment,ve),ve.forEach(t),_e.forEach(t),nt=h(e),G=n(e,"H2",{class:!0});var ut=s(G);fe=n(ut,"A",{id:!0,class:!0,href:!0});var Vn=s(fe);Mo=n(Vn,"SPAN",{});var Un=s(Mo);w(Ve.$$.fragment,Un),Un.forEach(t),Vn.forEach(t),Wr=h(ut),No=n(ut,"SPAN",{});var Bn=s(No);Or=c(Bn,"EfficientFormerForImageClassificationWithTeacher"),Bn.forEach(t),ut.forEach(t),at=h(e),x=n(e,"DIV",{class:!0});var L=s(x);w(Ue.$$.fragment,L),Rr=h(L),Ao=n(L,"P",{});var Hn=s(Ao);Vr=c(Hn,`EfficientFormer Model transformer with image classification heads on top (a linear layer on top of the final hidden
state of the [CLS] token and a linear layer on top of the final hidden state of the distillation token) e.g. for
ImageNet.`),Hn.forEach(t),Ur=h(L),w(de.$$.fragment,L),Br=h(L),Be=n(L,"P",{});var _t=s(Be);Hr=c(_t,"This model is a PyTorch "),He=n(_t,"A",{href:!0,rel:!0});var Yn=s(He);Yr=c(Yn,"nn.Module"),Yn.forEach(t),Gr=c(_t,` subclass. Use it as a
regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and behavior.`),_t.forEach(t),Jr=h(L),N=n(L,"DIV",{class:!0});var be=s(N);w(Ye.$$.fragment,be),Kr=h(be),J=n(be,"P",{});var po=s(J);Xr=c(po,"The "),ao=n(po,"A",{href:!0});var Gn=s(ao);Qr=c(Gn,"EfficientFormerForImageClassificationWithTeacher"),Gn.forEach(t),Zr=c(po," forward method, overrides the "),qo=n(po,"CODE",{});var Jn=s(qo);en=c(Jn,"__call__"),Jn.forEach(t),on=c(po," special method."),po.forEach(t),tn=h(be),w(me.$$.fragment,be),rn=h(be),w(pe.$$.fragment,be),be.forEach(t),L.forEach(t),this.h()},h(){f(l,"name","hf:doc:metadata"),f(l,"content",JSON.stringify(fa)),f(d,"id","efficientformer"),f(d,"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"),f(d,"href","#efficientformer"),f(g,"class","relative group"),f(X,"id","overview"),f(X,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),f(X,"href","#overview"),f(D,"class","relative group"),f(ye,"href","https://arxiv.org/abs/2206.01191"),f(ye,"rel","nofollow"),f(Fe,"href","https://huggingface.co/novice03"),f(Fe,"rel","nofollow"),f($e,"href","https://huggingface.co/Bearnardd"),f($e,"rel","nofollow"),f(Te,"href","https://github.com/snap-research/EfficientFormer"),f(Te,"rel","nofollow"),f(Z,"id","documentation-resources"),f(Z,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),f(Z,"href","#documentation-resources"),f(S,"class","relative group"),f(Ze,"href","./tasks/image_classification"),f(ee,"id","transformers.EfficientFormerConfig"),f(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"),f(ee,"href","#transformers.EfficientFormerConfig"),f(W,"class","relative group"),f(eo,"href","/docs/transformers/v4.27.1/en/model_doc/efficientformer#transformers.EfficientFormerModel"),f(Pe,"href","https://huggingface.co/snap-research/efficientformer-l1"),f(Pe,"rel","nofollow"),f(oo,"href","/docs/transformers/v4.27.1/en/main_classes/configuration#transformers.PretrainedConfig"),f(to,"href","/docs/transformers/v4.27.1/en/main_classes/configuration#transformers.PretrainedConfig"),f(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(te,"id","transformers.EfficientFormerImageProcessor"),f(te,"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"),f(te,"href","#transformers.EfficientFormerImageProcessor"),f(V,"class","relative group"),f(re,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(ne,"id","transformers.EfficientFormerModel"),f(ne,"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"),f(ne,"href","#transformers.EfficientFormerModel"),f(U,"class","relative group"),f(qe,"href","https://pytorch.org/docs/stable/nn.html#nn.Module"),f(qe,"rel","nofollow"),f(ro,"href","/docs/transformers/v4.27.1/en/model_doc/efficientformer#transformers.EfficientFormerModel"),f(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(ie,"id","transformers.EfficientFormerForImageClassification"),f(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"),f(ie,"href","#transformers.EfficientFormerForImageClassification"),f(H,"class","relative group"),f(Oe,"href","https://pytorch.org/docs/stable/nn.html#nn.Module"),f(Oe,"rel","nofollow"),f(no,"href","/docs/transformers/v4.27.1/en/model_doc/efficientformer#transformers.EfficientFormerForImageClassification"),f(M,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(fe,"id","transformers.EfficientFormerForImageClassificationWithTeacher"),f(fe,"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"),f(fe,"href","#transformers.EfficientFormerForImageClassificationWithTeacher"),f(G,"class","relative group"),f(He,"href","https://pytorch.org/docs/stable/nn.html#nn.Module"),f(He,"rel","nofollow"),f(ao,"href","/docs/transformers/v4.27.1/en/model_doc/efficientformer#transformers.EfficientFormerForImageClassificationWithTeacher"),f(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(x,"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,m){o(document.head,l),_(e,b,m),_(e,g,m),o(g,d),o(d,v),y(a,v,null),o(g,u),o(g,C),o(C,yt),_(e,Vo,m),_(e,D,m),o(D,X),o(X,ho),y(we,ho,null),o(D,Ft),o(D,go),o(go,$t),_(e,Uo,m),_(e,Q,m),o(Q,Tt),o(Q,ye),o(ye,It),o(Q,xt),_(e,Bo,m),_(e,Ke,m),o(Ke,Ct),_(e,Ho,m),_(e,Xe,m),o(Xe,uo),o(uo,Pt),_(e,Yo,m),_(e,z,m),o(z,kt),o(z,Fe),o(Fe,zt),o(z,jt),o(z,$e),o($e,Mt),o(z,Nt),o(z,Te),o(Te,At),o(z,qt),_(e,Go,m),_(e,S,m),o(S,Z),o(Z,_o),y(Ie,_o,null),o(S,Lt),o(S,vo),o(vo,Dt),_(e,Jo,m),_(e,Qe,m),o(Qe,bo),o(bo,Ze),o(Ze,St),_(e,Ko,m),_(e,W,m),o(W,ee),o(ee,Eo),y(xe,Eo,null),o(W,Wt),o(W,wo),o(wo,Ot),_(e,Xo,m),_(e,P,m),y(Ce,P,null),o(P,Rt),o(P,O),o(O,Vt),o(O,eo),o(eo,Ut),o(O,Bt),o(O,Pe),o(Pe,Ht),o(O,Yt),o(P,Gt),o(P,R),o(R,Jt),o(R,oo),o(oo,Kt),o(R,Xt),o(R,to),o(to,Qt),o(R,Zt),o(P,er),y(oe,P,null),_(e,Qo,m),_(e,V,m),o(V,te),o(te,yo),y(ke,yo,null),o(V,or),o(V,Fo),o(Fo,tr),_(e,Zo,m),_(e,A,m),y(ze,A,null),o(A,rr),o(A,$o),o($o,nr),o(A,ar),o(A,re),y(je,re,null),o(re,sr),o(re,To),o(To,ir),_(e,et,m),_(e,U,m),o(U,ne),o(ne,Io),y(Me,Io,null),o(U,cr),o(U,xo),o(xo,lr),_(e,ot,m),_(e,q,m),y(Ne,q,null),o(q,fr),o(q,Ae),o(Ae,dr),o(Ae,qe),o(qe,mr),o(Ae,pr),o(q,hr),o(q,j),y(Le,j,null),o(j,gr),o(j,B),o(B,ur),o(B,ro),o(ro,_r),o(B,vr),o(B,Co),o(Co,br),o(B,Er),o(j,wr),y(ae,j,null),o(j,yr),y(se,j,null),_(e,tt,m),_(e,H,m),o(H,ie),o(ie,Po),y(De,Po,null),o(H,Fr),o(H,ko),o(ko,$r),_(e,rt,m),_(e,k,m),y(Se,k,null),o(k,Tr),o(k,zo),o(zo,Ir),o(k,xr),o(k,We),o(We,Cr),o(We,Oe),o(Oe,Pr),o(We,kr),o(k,zr),o(k,M),y(Re,M,null),o(M,jr),o(M,Y),o(Y,Mr),o(Y,no),o(no,Nr),o(Y,Ar),o(Y,jo),o(jo,qr),o(Y,Lr),o(M,Dr),y(ce,M,null),o(M,Sr),y(le,M,null),_(e,nt,m),_(e,G,m),o(G,fe),o(fe,Mo),y(Ve,Mo,null),o(G,Wr),o(G,No),o(No,Or),_(e,at,m),_(e,x,m),y(Ue,x,null),o(x,Rr),o(x,Ao),o(Ao,Vr),o(x,Ur),y(de,x,null),o(x,Br),o(x,Be),o(Be,Hr),o(Be,He),o(He,Yr),o(Be,Gr),o(x,Jr),o(x,N),y(Ye,N,null),o(N,Kr),o(N,J),o(J,Xr),o(J,ao),o(ao,Qr),o(J,Zr),o(J,qo),o(qo,en),o(J,on),o(N,tn),y(me,N,null),o(N,rn),y(pe,N,null),st=!0},p(e,[m]){const Ge={};m&2&&(Ge.$$scope={dirty:m,ctx:e}),oe.$set(Ge);const Lo={};m&2&&(Lo.$$scope={dirty:m,ctx:e}),ae.$set(Lo);const Do={};m&2&&(Do.$$scope={dirty:m,ctx:e}),se.$set(Do);const So={};m&2&&(So.$$scope={dirty:m,ctx:e}),ce.$set(So);const Je={};m&2&&(Je.$$scope={dirty:m,ctx:e}),le.$set(Je);const Wo={};m&2&&(Wo.$$scope={dirty:m,ctx:e}),de.$set(Wo);const Oo={};m&2&&(Oo.$$scope={dirty:m,ctx:e}),me.$set(Oo);const Ro={};m&2&&(Ro.$$scope={dirty:m,ctx:e}),pe.$set(Ro)},i(e){st||(F(a.$$.fragment,e),F(we.$$.fragment,e),F(Ie.$$.fragment,e),F(xe.$$.fragment,e),F(Ce.$$.fragment,e),F(oe.$$.fragment,e),F(ke.$$.fragment,e),F(ze.$$.fragment,e),F(je.$$.fragment,e),F(Me.$$.fragment,e),F(Ne.$$.fragment,e),F(Le.$$.fragment,e),F(ae.$$.fragment,e),F(se.$$.fragment,e),F(De.$$.fragment,e),F(Se.$$.fragment,e),F(Re.$$.fragment,e),F(ce.$$.fragment,e),F(le.$$.fragment,e),F(Ve.$$.fragment,e),F(Ue.$$.fragment,e),F(de.$$.fragment,e),F(Ye.$$.fragment,e),F(me.$$.fragment,e),F(pe.$$.fragment,e),st=!0)},o(e){$(a.$$.fragment,e),$(we.$$.fragment,e),$(Ie.$$.fragment,e),$(xe.$$.fragment,e),$(Ce.$$.fragment,e),$(oe.$$.fragment,e),$(ke.$$.fragment,e),$(ze.$$.fragment,e),$(je.$$.fragment,e),$(Me.$$.fragment,e),$(Ne.$$.fragment,e),$(Le.$$.fragment,e),$(ae.$$.fragment,e),$(se.$$.fragment,e),$(De.$$.fragment,e),$(Se.$$.fragment,e),$(Re.$$.fragment,e),$(ce.$$.fragment,e),$(le.$$.fragment,e),$(Ve.$$.fragment,e),$(Ue.$$.fragment,e),$(de.$$.fragment,e),$(Ye.$$.fragment,e),$(me.$$.fragment,e),$(pe.$$.fragment,e),st=!1},d(e){t(l),e&&t(b),e&&t(g),T(a),e&&t(Vo),e&&t(D),T(we),e&&t(Uo),e&&t(Q),e&&t(Bo),e&&t(Ke),e&&t(Ho),e&&t(Xe),e&&t(Yo),e&&t(z),e&&t(Go),e&&t(S),T(Ie),e&&t(Jo),e&&t(Qe),e&&t(Ko),e&&t(W),T(xe),e&&t(Xo),e&&t(P),T(Ce),T(oe),e&&t(Qo),e&&t(V),T(ke),e&&t(Zo),e&&t(A),T(ze),T(je),e&&t(et),e&&t(U),T(Me),e&&t(ot),e&&t(q),T(Ne),T(Le),T(ae),T(se),e&&t(tt),e&&t(H),T(De),e&&t(rt),e&&t(k),T(Se),T(Re),T(ce),T(le),e&&t(nt),e&&t(G),T(Ve),e&&t(at),e&&t(x),T(Ue),T(de),T(Ye),T(me),T(pe)}}}const fa={local:"efficientformer",sections:[{local:"overview",title:"Overview"},{local:"documentation-resources",title:"Documentation resources"},{local:"transformers.EfficientFormerConfig",title:"EfficientFormerConfig"},{local:"transformers.EfficientFormerImageProcessor",title:"EfficientFormerImageProcessor"},{local:"transformers.EfficientFormerModel",title:"EfficientFormerModel"},{local:"transformers.EfficientFormerForImageClassification",title:"EfficientFormerForImageClassification"},{local:"transformers.EfficientFormerForImageClassificationWithTeacher",title:"EfficientFormerForImageClassificationWithTeacher"}],title:"EfficientFormer"};function da(I){return ea(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class va extends Kn{constructor(l){super();Xn(this,l,da,la,Qn,{})}}export{va as default,fa as metadata};
