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 o,m as h,a as s,x as w,h as c,b as f,G as t,g as _,y,q as F,o as $,B as T,v as ea,L as Eo}from"../../chunks/vendor-hf-doc-builder.js";import{T as vo}from"../../chunks/Tip-hf-doc-builder.js";import{D as K}from"../../chunks/Docstring-hf-doc-builder.js";import{C as wo}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as Ee}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as bo}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function ta(I){let l,b,g,d,v;return d=new wo({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(o),g=h(a),w(d.$$.fragment,a)},m(a,u){_(a,l,u),t(l,b),_(a,g,u),y(d,a,u),v=!0},p:Eo,i(a){v||(F(d.$$.fragment,a),v=!0)},o(a){$(d.$$.fragment,a),v=!1},d(a){a&&o(l),a&&o(g),T(d,a)}}}function oa(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(o),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(o)},m(a,u){_(a,l,u),t(l,b),t(l,g),t(g,d),t(l,v)},d(a){a&&o(l)}}}function ra(I){let l,b,g,d,v;return d=new wo({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(o),g=h(a),w(d.$$.fragment,a)},m(a,u){_(a,l,u),t(l,b),_(a,g,u),y(d,a,u),v=!0},p:Eo,i(a){v||(F(d.$$.fragment,a),v=!0)},o(a){$(d.$$.fragment,a),v=!1},d(a){a&&o(l),a&&o(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(o),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(o)},m(a,u){_(a,l,u),t(l,b),t(l,g),t(g,d),t(l,v)},d(a){a&&o(l)}}}function aa(I){let l,b,g,d,v;return d=new wo({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(o),g=h(a),w(d.$$.fragment,a)},m(a,u){_(a,l,u),t(l,b),_(a,g,u),y(d,a,u),v=!0},p:Eo,i(a){v||(F(d.$$.fragment,a),v=!0)},o(a){$(d.$$.fragment,a),v=!1},d(a){a&&o(l),a&&o(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(o)},m(g,d){_(g,l,d),t(l,b)},d(g){g&&o(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(o),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(o)},m(a,u){_(a,l,u),t(l,b),t(l,g),t(g,d),t(l,v)},d(a){a&&o(l)}}}function ca(I){let l,b,g,d,v;return d=new wo({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(o),g=h(a),w(d.$$.fragment,a)},m(a,u){_(a,l,u),t(l,b),_(a,g,u),y(d,a,u),v=!0},p:Eo,i(a){v||(F(d.$$.fragment,a),v=!0)},o(a){$(d.$$.fragment,a),v=!1},d(a){a&&o(l),a&&o(g),T(d,a)}}}function la(I){let l,b,g,d,v,a,u,C,yo,Rt,L,X,pt,we,Fo,ht,$o,Vt,Q,To,ye,Io,xo,Ut,Ke,Co,Bt,Xe,gt,Po,Ht,z,ko,Fe,zo,jo,$e,Mo,No,Te,qo,Ao,Yt,S,Z,ut,Ie,Do,_t,Lo,Gt,Qe,vt,Ze,So,Jt,W,ee,bt,xe,Wo,Et,Oo,Kt,P,Ce,Ro,O,Vo,et,Uo,Bo,Pe,Ho,Yo,Go,R,Jo,tt,Ko,Xo,ot,Qo,Zo,er,te,Xt,V,oe,wt,ke,tr,yt,or,Qt,q,ze,rr,Ft,nr,ar,re,je,sr,$t,ir,Zt,U,ne,Tt,Me,cr,It,lr,eo,A,Ne,fr,qe,dr,Ae,mr,pr,hr,j,De,gr,B,ur,rt,_r,vr,xt,br,Er,wr,ae,yr,se,to,H,ie,Ct,Le,Fr,Pt,$r,oo,k,Se,Tr,kt,Ir,xr,We,Cr,Oe,Pr,kr,zr,M,Re,jr,Y,Mr,nt,Nr,qr,zt,Ar,Dr,Lr,ce,Sr,le,ro,G,fe,jt,Ve,Wr,Mt,Or,no,x,Ue,Rr,Nt,Vr,Ur,de,Br,Be,Hr,He,Yr,Gr,Jr,N,Ye,Kr,J,Xr,at,Qr,Zr,qt,en,tn,on,me,rn,pe,ao;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.29.0/src/transformers/models/efficientformer/configuration_efficientformer.py#L32"}}),te=new bo({props:{anchor:"transformers.EfficientFormerConfig.example",$$slots:{default:[ta]},$$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.29.0/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.29.0/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.29.0/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.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/efficientformer/modeling_efficientformer.py#L546"}}),De=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.29.0/en/model_doc/vit#transformers.ViTFeatureExtractor">ViTFeatureExtractor</a>. See
<a href="/docs/transformers/v4.29.0/en/model_doc/dpt#transformers.DPTFeatureExtractor.__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.29.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/efficientformer/modeling_efficientformer.py#L558",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.0/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.29.0/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.29.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ae=new vo({props:{$$slots:{default:[oa]},$$scope:{ctx:I}}}),se=new bo({props:{anchor:"transformers.EfficientFormerModel.forward.example",$$slots:{default:[ra]},$$scope:{ctx:I}}}),Le=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.29.0/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.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/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.29.0/en/model_doc/vit#transformers.ViTFeatureExtractor">ViTFeatureExtractor</a>. See
<a href="/docs/transformers/v4.29.0/en/model_doc/dpt#transformers.DPTFeatureExtractor.__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.29.0/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.29.0/src/transformers/models/efficientformer/modeling_efficientformer.py#L623",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.0/en/main_classes/output#transformers.modeling_outputs.ImageClassifierOutput"
>transformers.modeling_outputs.ImageClassifierOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.29.0/en/model_doc/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.29.0/en/main_classes/output#transformers.modeling_outputs.ImageClassifierOutput"
>transformers.modeling_outputs.ImageClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ce=new vo({props:{$$slots:{default:[na]},$$scope:{ctx:I}}}),le=new bo({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.29.0/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.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/efficientformer/modeling_efficientformer.py#L738"}}),de=new vo({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.29.0/en/model_doc/vit#transformers.ViTFeatureExtractor">ViTFeatureExtractor</a>. See
<a href="/docs/transformers/v4.29.0/en/model_doc/dpt#transformers.DPTFeatureExtractor.__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.29.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/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.29.0/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 vo({props:{$$slots:{default:[ia]},$$scope:{ctx:I}}}),pe=new bo({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"),yo=i("EfficientFormer"),Rt=p(),L=r("h2"),X=r("a"),pt=r("span"),E(we.$$.fragment),Fo=p(),ht=r("span"),$o=i("Overview"),Vt=p(),Q=r("p"),To=i("The EfficientFormer model was proposed in "),ye=r("a"),Io=i("EfficientFormer: Vision Transformers at MobileNet Speed"),xo=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.`),Ut=p(),Ke=r("p"),Co=i("The abstract from the paper is the following:"),Bt=p(),Xe=r("p"),gt=r("em"),Po=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.`),Ht=p(),z=r("p"),ko=i("This model was contributed by "),Fe=r("a"),zo=i("novice03"),jo=i(" and "),$e=r("a"),Mo=i("Bearnardd"),No=i(`.
The original code can be found `),Te=r("a"),qo=i("here"),Ao=i("."),Yt=p(),S=r("h2"),Z=r("a"),ut=r("span"),E(Ie.$$.fragment),Do=p(),_t=r("span"),Lo=i("Documentation resources"),Gt=p(),Qe=r("ul"),vt=r("li"),Ze=r("a"),So=i("Image classification task guide"),Jt=p(),W=r("h2"),ee=r("a"),bt=r("span"),E(xe.$$.fragment),Wo=p(),Et=r("span"),Oo=i("EfficientFormerConfig"),Kt=p(),P=r("div"),E(Ce.$$.fragment),Ro=p(),O=r("p"),Vo=i("This is the configuration class to store the configuration of an "),et=r("a"),Uo=i("EfficientFormerModel"),Bo=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"),Ho=i("snap-research/efficientformer-l1"),Yo=i(" architecture."),Go=p(),R=r("p"),Jo=i("Configuration objects inherit from "),tt=r("a"),Ko=i("PretrainedConfig"),Xo=i(` and can be used to control the model outputs. Read the
documentation from `),ot=r("a"),Qo=i("PretrainedConfig"),Zo=i(" for more information."),er=p(),E(te.$$.fragment),Xt=p(),V=r("h2"),oe=r("a"),wt=r("span"),E(ke.$$.fragment),tr=p(),yt=r("span"),or=i("EfficientFormerImageProcessor"),Qt=p(),q=r("div"),E(ze.$$.fragment),rr=p(),Ft=r("p"),nr=i("Constructs a EfficientFormer image processor."),ar=p(),re=r("div"),E(je.$$.fragment),sr=p(),$t=r("p"),ir=i("Preprocess an image or batch of images."),Zt=p(),U=r("h2"),ne=r("a"),Tt=r("span"),E(Me.$$.fragment),cr=p(),It=r("span"),lr=i("EfficientFormerModel"),eo=p(),A=r("div"),E(Ne.$$.fragment),fr=p(),qe=r("p"),dr=i(`The bare EfficientFormer Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),Ae=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(De.$$.fragment),gr=p(),B=r("p"),ur=i("The "),rt=r("a"),_r=i("EfficientFormerModel"),vr=i(" forward method, overrides the "),xt=r("code"),br=i("__call__"),Er=i(" special method."),wr=p(),E(ae.$$.fragment),yr=p(),E(se.$$.fragment),to=p(),H=r("h2"),ie=r("a"),Ct=r("span"),E(Le.$$.fragment),Fr=p(),Pt=r("span"),$r=i("EfficientFormerForImageClassification"),oo=p(),k=r("div"),E(Se.$$.fragment),Tr=p(),kt=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 "),nt=r("a"),Nr=i("EfficientFormerForImageClassification"),qr=i(" forward method, overrides the "),zt=r("code"),Ar=i("__call__"),Dr=i(" special method."),Lr=p(),E(ce.$$.fragment),Sr=p(),E(le.$$.fragment),ro=p(),G=r("h2"),fe=r("a"),jt=r("span"),E(Ve.$$.fragment),Wr=p(),Mt=r("span"),Or=i("EfficientFormerForImageClassificationWithTeacher"),no=p(),x=r("div"),E(Ue.$$.fragment),Rr=p(),Nt=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 "),at=r("a"),Qr=i("EfficientFormerForImageClassificationWithTeacher"),Zr=i(" forward method, overrides the "),qt=r("code"),en=i("__call__"),tn=i(" special method."),on=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(o),b=h(e),g=n(e,"H1",{class:!0});var Ge=s(g);d=n(Ge,"A",{id:!0,class:!0,href:!0});var At=s(d);v=n(At,"SPAN",{});var Dt=s(v);w(a.$$.fragment,Dt),Dt.forEach(o),At.forEach(o),u=h(Ge),C=n(Ge,"SPAN",{});var Lt=s(C);yo=c(Lt,"EfficientFormer"),Lt.forEach(o),Ge.forEach(o),Rt=h(e),L=n(e,"H2",{class:!0});var Je=s(L);X=n(Je,"A",{id:!0,class:!0,href:!0});var St=s(X);pt=n(St,"SPAN",{});var Wt=s(pt);w(we.$$.fragment,Wt),Wt.forEach(o),St.forEach(o),Fo=h(Je),ht=n(Je,"SPAN",{});var Ot=s(ht);$o=c(Ot,"Overview"),Ot.forEach(o),Je.forEach(o),Vt=h(e),Q=n(e,"P",{});var so=s(Q);To=c(so,"The EfficientFormer model was proposed in "),ye=n(so,"A",{href:!0,rel:!0});var nn=s(ye);Io=c(nn,"EfficientFormer: Vision Transformers at MobileNet Speed"),nn.forEach(o),xo=c(so,`
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.`),so.forEach(o),Ut=h(e),Ke=n(e,"P",{});var an=s(Ke);Co=c(an,"The abstract from the paper is the following:"),an.forEach(o),Bt=h(e),Xe=n(e,"P",{});var sn=s(Xe);gt=n(sn,"EM",{});var cn=s(gt);Po=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(o),sn.forEach(o),Ht=h(e),z=n(e,"P",{});var he=s(z);ko=c(he,"This model was contributed by "),Fe=n(he,"A",{href:!0,rel:!0});var ln=s(Fe);zo=c(ln,"novice03"),ln.forEach(o),jo=c(he," and "),$e=n(he,"A",{href:!0,rel:!0});var fn=s($e);Mo=c(fn,"Bearnardd"),fn.forEach(o),No=c(he,`.
The original code can be found `),Te=n(he,"A",{href:!0,rel:!0});var dn=s(Te);qo=c(dn,"here"),dn.forEach(o),Ao=c(he,"."),he.forEach(o),Yt=h(e),S=n(e,"H2",{class:!0});var io=s(S);Z=n(io,"A",{id:!0,class:!0,href:!0});var mn=s(Z);ut=n(mn,"SPAN",{});var pn=s(ut);w(Ie.$$.fragment,pn),pn.forEach(o),mn.forEach(o),Do=h(io),_t=n(io,"SPAN",{});var hn=s(_t);Lo=c(hn,"Documentation resources"),hn.forEach(o),io.forEach(o),Gt=h(e),Qe=n(e,"UL",{});var gn=s(Qe);vt=n(gn,"LI",{});var un=s(vt);Ze=n(un,"A",{href:!0});var _n=s(Ze);So=c(_n,"Image classification task guide"),_n.forEach(o),un.forEach(o),gn.forEach(o),Jt=h(e),W=n(e,"H2",{class:!0});var co=s(W);ee=n(co,"A",{id:!0,class:!0,href:!0});var vn=s(ee);bt=n(vn,"SPAN",{});var bn=s(bt);w(xe.$$.fragment,bn),bn.forEach(o),vn.forEach(o),Wo=h(co),Et=n(co,"SPAN",{});var En=s(Et);Oo=c(En,"EfficientFormerConfig"),En.forEach(o),co.forEach(o),Kt=h(e),P=n(e,"DIV",{class:!0});var ge=s(P);w(Ce.$$.fragment,ge),Ro=h(ge),O=n(ge,"P",{});var st=s(O);Vo=c(st,"This is the configuration class to store the configuration of an "),et=n(st,"A",{href:!0});var wn=s(et);Uo=c(wn,"EfficientFormerModel"),wn.forEach(o),Bo=c(st,`. 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(st,"A",{href:!0,rel:!0});var yn=s(Pe);Ho=c(yn,"snap-research/efficientformer-l1"),yn.forEach(o),Yo=c(st," architecture."),st.forEach(o),Go=h(ge),R=n(ge,"P",{});var it=s(R);Jo=c(it,"Configuration objects inherit from "),tt=n(it,"A",{href:!0});var Fn=s(tt);Ko=c(Fn,"PretrainedConfig"),Fn.forEach(o),Xo=c(it,` and can be used to control the model outputs. Read the
documentation from `),ot=n(it,"A",{href:!0});var $n=s(ot);Qo=c($n,"PretrainedConfig"),$n.forEach(o),Zo=c(it," for more information."),it.forEach(o),er=h(ge),w(te.$$.fragment,ge),ge.forEach(o),Xt=h(e),V=n(e,"H2",{class:!0});var lo=s(V);oe=n(lo,"A",{id:!0,class:!0,href:!0});var Tn=s(oe);wt=n(Tn,"SPAN",{});var In=s(wt);w(ke.$$.fragment,In),In.forEach(o),Tn.forEach(o),tr=h(lo),yt=n(lo,"SPAN",{});var xn=s(yt);or=c(xn,"EfficientFormerImageProcessor"),xn.forEach(o),lo.forEach(o),Qt=h(e),q=n(e,"DIV",{class:!0});var ct=s(q);w(ze.$$.fragment,ct),rr=h(ct),Ft=n(ct,"P",{});var Cn=s(Ft);nr=c(Cn,"Constructs a EfficientFormer image processor."),Cn.forEach(o),ar=h(ct),re=n(ct,"DIV",{class:!0});var fo=s(re);w(je.$$.fragment,fo),sr=h(fo),$t=n(fo,"P",{});var Pn=s($t);ir=c(Pn,"Preprocess an image or batch of images."),Pn.forEach(o),fo.forEach(o),ct.forEach(o),Zt=h(e),U=n(e,"H2",{class:!0});var mo=s(U);ne=n(mo,"A",{id:!0,class:!0,href:!0});var kn=s(ne);Tt=n(kn,"SPAN",{});var zn=s(Tt);w(Me.$$.fragment,zn),zn.forEach(o),kn.forEach(o),cr=h(mo),It=n(mo,"SPAN",{});var jn=s(It);lr=c(jn,"EfficientFormerModel"),jn.forEach(o),mo.forEach(o),eo=h(e),A=n(e,"DIV",{class:!0});var lt=s(A);w(Ne.$$.fragment,lt),fr=h(lt),qe=n(lt,"P",{});var po=s(qe);dr=c(po,`The bare EfficientFormer Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),Ae=n(po,"A",{href:!0,rel:!0});var Mn=s(Ae);mr=c(Mn,"nn.Module"),Mn.forEach(o),pr=c(po,` subclass. Use it as a
regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and behavior.`),po.forEach(o),hr=h(lt),j=n(lt,"DIV",{class:!0});var ue=s(j);w(De.$$.fragment,ue),gr=h(ue),B=n(ue,"P",{});var ft=s(B);ur=c(ft,"The "),rt=n(ft,"A",{href:!0});var Nn=s(rt);_r=c(Nn,"EfficientFormerModel"),Nn.forEach(o),vr=c(ft," forward method, overrides the "),xt=n(ft,"CODE",{});var qn=s(xt);br=c(qn,"__call__"),qn.forEach(o),Er=c(ft," special method."),ft.forEach(o),wr=h(ue),w(ae.$$.fragment,ue),yr=h(ue),w(se.$$.fragment,ue),ue.forEach(o),lt.forEach(o),to=h(e),H=n(e,"H2",{class:!0});var ho=s(H);ie=n(ho,"A",{id:!0,class:!0,href:!0});var An=s(ie);Ct=n(An,"SPAN",{});var Dn=s(Ct);w(Le.$$.fragment,Dn),Dn.forEach(o),An.forEach(o),Fr=h(ho),Pt=n(ho,"SPAN",{});var Ln=s(Pt);$r=c(Ln,"EfficientFormerForImageClassification"),Ln.forEach(o),ho.forEach(o),oo=h(e),k=n(e,"DIV",{class:!0});var _e=s(k);w(Se.$$.fragment,_e),Tr=h(_e),kt=n(_e,"P",{});var Sn=s(kt);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(o),xr=h(_e),We=n(_e,"P",{});var go=s(We);Cr=c(go,"This model is a PyTorch "),Oe=n(go,"A",{href:!0,rel:!0});var Wn=s(Oe);Pr=c(Wn,"nn.Module"),Wn.forEach(o),kr=c(go,` subclass. Use it as a
regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and behavior.`),go.forEach(o),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 dt=s(Y);Mr=c(dt,"The "),nt=n(dt,"A",{href:!0});var On=s(nt);Nr=c(On,"EfficientFormerForImageClassification"),On.forEach(o),qr=c(dt," forward method, overrides the "),zt=n(dt,"CODE",{});var Rn=s(zt);Ar=c(Rn,"__call__"),Rn.forEach(o),Dr=c(dt," special method."),dt.forEach(o),Lr=h(ve),w(ce.$$.fragment,ve),Sr=h(ve),w(le.$$.fragment,ve),ve.forEach(o),_e.forEach(o),ro=h(e),G=n(e,"H2",{class:!0});var uo=s(G);fe=n(uo,"A",{id:!0,class:!0,href:!0});var Vn=s(fe);jt=n(Vn,"SPAN",{});var Un=s(jt);w(Ve.$$.fragment,Un),Un.forEach(o),Vn.forEach(o),Wr=h(uo),Mt=n(uo,"SPAN",{});var Bn=s(Mt);Or=c(Bn,"EfficientFormerForImageClassificationWithTeacher"),Bn.forEach(o),uo.forEach(o),no=h(e),x=n(e,"DIV",{class:!0});var D=s(x);w(Ue.$$.fragment,D),Rr=h(D),Nt=n(D,"P",{});var Hn=s(Nt);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(o),Ur=h(D),w(de.$$.fragment,D),Br=h(D),Be=n(D,"P",{});var _o=s(Be);Hr=c(_o,"This model is a PyTorch "),He=n(_o,"A",{href:!0,rel:!0});var Yn=s(He);Yr=c(Yn,"nn.Module"),Yn.forEach(o),Gr=c(_o,` subclass. Use it as a
regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and behavior.`),_o.forEach(o),Jr=h(D),N=n(D,"DIV",{class:!0});var be=s(N);w(Ye.$$.fragment,be),Kr=h(be),J=n(be,"P",{});var mt=s(J);Xr=c(mt,"The "),at=n(mt,"A",{href:!0});var Gn=s(at);Qr=c(Gn,"EfficientFormerForImageClassificationWithTeacher"),Gn.forEach(o),Zr=c(mt," forward method, overrides the "),qt=n(mt,"CODE",{});var Jn=s(qt);en=c(Jn,"__call__"),Jn.forEach(o),tn=c(mt," special method."),mt.forEach(o),on=h(be),w(me.$$.fragment,be),rn=h(be),w(pe.$$.fragment,be),be.forEach(o),D.forEach(o),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(L,"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(et,"href","/docs/transformers/v4.29.0/en/model_doc/efficientformer#transformers.EfficientFormerModel"),f(Pe,"href","https://huggingface.co/snap-research/efficientformer-l1"),f(Pe,"rel","nofollow"),f(tt,"href","/docs/transformers/v4.29.0/en/main_classes/configuration#transformers.PretrainedConfig"),f(ot,"href","/docs/transformers/v4.29.0/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(oe,"id","transformers.EfficientFormerImageProcessor"),f(oe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),f(oe,"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(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(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(Ae,"href","https://pytorch.org/docs/stable/nn.html#nn.Module"),f(Ae,"rel","nofollow"),f(rt,"href","/docs/transformers/v4.29.0/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(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(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(nt,"href","/docs/transformers/v4.29.0/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(at,"href","/docs/transformers/v4.29.0/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){t(document.head,l),_(e,b,m),_(e,g,m),t(g,d),t(d,v),y(a,v,null),t(g,u),t(g,C),t(C,yo),_(e,Rt,m),_(e,L,m),t(L,X),t(X,pt),y(we,pt,null),t(L,Fo),t(L,ht),t(ht,$o),_(e,Vt,m),_(e,Q,m),t(Q,To),t(Q,ye),t(ye,Io),t(Q,xo),_(e,Ut,m),_(e,Ke,m),t(Ke,Co),_(e,Bt,m),_(e,Xe,m),t(Xe,gt),t(gt,Po),_(e,Ht,m),_(e,z,m),t(z,ko),t(z,Fe),t(Fe,zo),t(z,jo),t(z,$e),t($e,Mo),t(z,No),t(z,Te),t(Te,qo),t(z,Ao),_(e,Yt,m),_(e,S,m),t(S,Z),t(Z,ut),y(Ie,ut,null),t(S,Do),t(S,_t),t(_t,Lo),_(e,Gt,m),_(e,Qe,m),t(Qe,vt),t(vt,Ze),t(Ze,So),_(e,Jt,m),_(e,W,m),t(W,ee),t(ee,bt),y(xe,bt,null),t(W,Wo),t(W,Et),t(Et,Oo),_(e,Kt,m),_(e,P,m),y(Ce,P,null),t(P,Ro),t(P,O),t(O,Vo),t(O,et),t(et,Uo),t(O,Bo),t(O,Pe),t(Pe,Ho),t(O,Yo),t(P,Go),t(P,R),t(R,Jo),t(R,tt),t(tt,Ko),t(R,Xo),t(R,ot),t(ot,Qo),t(R,Zo),t(P,er),y(te,P,null),_(e,Xt,m),_(e,V,m),t(V,oe),t(oe,wt),y(ke,wt,null),t(V,tr),t(V,yt),t(yt,or),_(e,Qt,m),_(e,q,m),y(ze,q,null),t(q,rr),t(q,Ft),t(Ft,nr),t(q,ar),t(q,re),y(je,re,null),t(re,sr),t(re,$t),t($t,ir),_(e,Zt,m),_(e,U,m),t(U,ne),t(ne,Tt),y(Me,Tt,null),t(U,cr),t(U,It),t(It,lr),_(e,eo,m),_(e,A,m),y(Ne,A,null),t(A,fr),t(A,qe),t(qe,dr),t(qe,Ae),t(Ae,mr),t(qe,pr),t(A,hr),t(A,j),y(De,j,null),t(j,gr),t(j,B),t(B,ur),t(B,rt),t(rt,_r),t(B,vr),t(B,xt),t(xt,br),t(B,Er),t(j,wr),y(ae,j,null),t(j,yr),y(se,j,null),_(e,to,m),_(e,H,m),t(H,ie),t(ie,Ct),y(Le,Ct,null),t(H,Fr),t(H,Pt),t(Pt,$r),_(e,oo,m),_(e,k,m),y(Se,k,null),t(k,Tr),t(k,kt),t(kt,Ir),t(k,xr),t(k,We),t(We,Cr),t(We,Oe),t(Oe,Pr),t(We,kr),t(k,zr),t(k,M),y(Re,M,null),t(M,jr),t(M,Y),t(Y,Mr),t(Y,nt),t(nt,Nr),t(Y,qr),t(Y,zt),t(zt,Ar),t(Y,Dr),t(M,Lr),y(ce,M,null),t(M,Sr),y(le,M,null),_(e,ro,m),_(e,G,m),t(G,fe),t(fe,jt),y(Ve,jt,null),t(G,Wr),t(G,Mt),t(Mt,Or),_(e,no,m),_(e,x,m),y(Ue,x,null),t(x,Rr),t(x,Nt),t(Nt,Vr),t(x,Ur),y(de,x,null),t(x,Br),t(x,Be),t(Be,Hr),t(Be,He),t(He,Yr),t(Be,Gr),t(x,Jr),t(x,N),y(Ye,N,null),t(N,Kr),t(N,J),t(J,Xr),t(J,at),t(at,Qr),t(J,Zr),t(J,qt),t(qt,en),t(J,tn),t(N,on),y(me,N,null),t(N,rn),y(pe,N,null),ao=!0},p(e,[m]){const Ge={};m&2&&(Ge.$$scope={dirty:m,ctx:e}),te.$set(Ge);const At={};m&2&&(At.$$scope={dirty:m,ctx:e}),ae.$set(At);const Dt={};m&2&&(Dt.$$scope={dirty:m,ctx:e}),se.$set(Dt);const Lt={};m&2&&(Lt.$$scope={dirty:m,ctx:e}),ce.$set(Lt);const Je={};m&2&&(Je.$$scope={dirty:m,ctx:e}),le.$set(Je);const St={};m&2&&(St.$$scope={dirty:m,ctx:e}),de.$set(St);const Wt={};m&2&&(Wt.$$scope={dirty:m,ctx:e}),me.$set(Wt);const Ot={};m&2&&(Ot.$$scope={dirty:m,ctx:e}),pe.$set(Ot)},i(e){ao||(F(a.$$.fragment,e),F(we.$$.fragment,e),F(Ie.$$.fragment,e),F(xe.$$.fragment,e),F(Ce.$$.fragment,e),F(te.$$.fragment,e),F(ke.$$.fragment,e),F(ze.$$.fragment,e),F(je.$$.fragment,e),F(Me.$$.fragment,e),F(Ne.$$.fragment,e),F(De.$$.fragment,e),F(ae.$$.fragment,e),F(se.$$.fragment,e),F(Le.$$.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),ao=!0)},o(e){$(a.$$.fragment,e),$(we.$$.fragment,e),$(Ie.$$.fragment,e),$(xe.$$.fragment,e),$(Ce.$$.fragment,e),$(te.$$.fragment,e),$(ke.$$.fragment,e),$(ze.$$.fragment,e),$(je.$$.fragment,e),$(Me.$$.fragment,e),$(Ne.$$.fragment,e),$(De.$$.fragment,e),$(ae.$$.fragment,e),$(se.$$.fragment,e),$(Le.$$.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),ao=!1},d(e){o(l),e&&o(b),e&&o(g),T(a),e&&o(Rt),e&&o(L),T(we),e&&o(Vt),e&&o(Q),e&&o(Ut),e&&o(Ke),e&&o(Bt),e&&o(Xe),e&&o(Ht),e&&o(z),e&&o(Yt),e&&o(S),T(Ie),e&&o(Gt),e&&o(Qe),e&&o(Jt),e&&o(W),T(xe),e&&o(Kt),e&&o(P),T(Ce),T(te),e&&o(Xt),e&&o(V),T(ke),e&&o(Qt),e&&o(q),T(ze),T(je),e&&o(Zt),e&&o(U),T(Me),e&&o(eo),e&&o(A),T(Ne),T(De),T(ae),T(se),e&&o(to),e&&o(H),T(Le),e&&o(oo),e&&o(k),T(Se),T(Re),T(ce),T(le),e&&o(ro),e&&o(G),T(Ve),e&&o(no),e&&o(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};
