import{s as Ct,o as Vt,n as $e}from"../chunks/scheduler.9bc65507.js";import{S as Ht,i as It,g as c,s,r as h,A as xt,h as m,f as o,c as i,j as F,u as f,x as T,k as Z,y as p,a,v as g,d as u,t as b,w as _}from"../chunks/index.707bf1b6.js";import{T as Mt}from"../chunks/Tip.c2ecdbf4.js";import{D as me}from"../chunks/Docstring.17db21ae.js";import{C as it}from"../chunks/CodeBlock.54a9f38d.js";import{E as st}from"../chunks/ExampleCodeBlock.4f515aa9.js";import{P as zt}from"../chunks/PipelineTag.44585822.js";import{H as pe}from"../chunks/Heading.342b1fa6.js";function kt(C){let n,v="Example:",l,d,y;return d=new it({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFZpVEh5YnJpZENvbmZpZyUyQyUyMFZpVEh5YnJpZE1vZGVsJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMFZpVCUyMEh5YnJpZCUyMHZpdC1oeWJyaWQtYmFzZS1iaXQtMzg0JTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyMFZpVEh5YnJpZENvbmZpZygpJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMG1vZGVsJTIwKHdpdGglMjByYW5kb20lMjB3ZWlnaHRzKSUyMGZyb20lMjB0aGUlMjB2aXQtaHlicmlkLWJhc2UtYml0LTM4NCUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQW1vZGVsJTIwJTNEJTIwVmlUSHlicmlkTW9kZWwoY29uZmlndXJhdGlvbiklMEElMEElMjMlMjBBY2Nlc3NpbmclMjB0aGUlMjBtb2RlbCUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwbW9kZWwuY29uZmln",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> ViTHybridConfig, ViTHybridModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a ViT Hybrid vit-hybrid-base-bit-384 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = ViTHybridConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model (with random weights) from the vit-hybrid-base-bit-384 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ViTHybridModel(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`,wrap:!1}}),{c(){n=c("p"),n.textContent=v,l=s(),h(d.$$.fragment)},l(r){n=m(r,"P",{"data-svelte-h":!0}),T(n)!=="svelte-11lpom8"&&(n.textContent=v),l=i(r),f(d.$$.fragment,r)},m(r,w){a(r,n,w),a(r,l,w),g(d,r,w),y=!0},p:$e,i(r){y||(u(d.$$.fragment,r),y=!0)},o(r){b(d.$$.fragment,r),y=!1},d(r){r&&(o(n),o(l)),_(d,r)}}}function jt(C){let n,v=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){n=c("p"),n.innerHTML=v},l(l){n=m(l,"P",{"data-svelte-h":!0}),T(n)!=="svelte-fincs2"&&(n.innerHTML=v)},m(l,d){a(l,n,d)},p:$e,d(l){l&&o(n)}}}function Jt(C){let n,v="Example:",l,d,y;return d=new it({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyMFZpVEh5YnJpZE1vZGVsJTBBaW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGF0YXNldHMlMjBpbXBvcnQlMjBsb2FkX2RhdGFzZXQlMEElMEFkYXRhc2V0JTIwJTNEJTIwbG9hZF9kYXRhc2V0KCUyMmh1Z2dpbmdmYWNlJTJGY2F0cy1pbWFnZSUyMiklMEFpbWFnZSUyMCUzRCUyMGRhdGFzZXQlNUIlMjJ0ZXN0JTIyJTVEJTVCJTIyaW1hZ2UlMjIlNUQlNUIwJTVEJTBBJTBBaW1hZ2VfcHJvY2Vzc29yJTIwJTNEJTIwQXV0b0ltYWdlUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZ2aXQtaHlicmlkLWJhc2UtYml0LTM4NCUyMiklMEFtb2RlbCUyMCUzRCUyMFZpVEh5YnJpZE1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZ2aXQtaHlicmlkLWJhc2UtYml0LTM4NCUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjBpbWFnZV9wcm9jZXNzb3IoaW1hZ2UlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQXdpdGglMjB0b3JjaC5ub19ncmFkKCklM0ElMEElMjAlMjAlMjAlMjBvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpJTBBJTBBbGFzdF9oaWRkZW5fc3RhdGVzJTIwJTNEJTIwb3V0cHV0cy5sYXN0X2hpZGRlbl9zdGF0ZSUwQWxpc3QobGFzdF9oaWRkZW5fc3RhdGVzLnNoYXBlKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, ViTHybridModel
<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;google/vit-hybrid-base-bit-384&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ViTHybridModel.from_pretrained(<span class="hljs-string">&quot;google/vit-hybrid-base-bit-384&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>]`,wrap:!1}}),{c(){n=c("p"),n.textContent=v,l=s(),h(d.$$.fragment)},l(r){n=m(r,"P",{"data-svelte-h":!0}),T(n)!=="svelte-11lpom8"&&(n.textContent=v),l=i(r),f(d.$$.fragment,r)},m(r,w){a(r,n,w),a(r,l,w),g(d,r,w),y=!0},p:$e,i(r){y||(u(d.$$.fragment,r),y=!0)},o(r){b(d.$$.fragment,r),y=!1},d(r){r&&(o(n),o(l)),_(d,r)}}}function Ft(C){let n,v=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){n=c("p"),n.innerHTML=v},l(l){n=m(l,"P",{"data-svelte-h":!0}),T(n)!=="svelte-fincs2"&&(n.innerHTML=v)},m(l,d){a(l,n,d)},p:$e,d(l){l&&o(n)}}}function Zt(C){let n,v="Example:",l,d,y;return d=new it({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyMFZpVEh5YnJpZEZvckltYWdlQ2xhc3NpZmljYXRpb24lMEFpbXBvcnQlMjB0b3JjaCUwQWZyb20lMjBkYXRhc2V0cyUyMGltcG9ydCUyMGxvYWRfZGF0YXNldCUwQSUwQWRhdGFzZXQlMjAlM0QlMjBsb2FkX2RhdGFzZXQoJTIyaHVnZ2luZ2ZhY2UlMkZjYXRzLWltYWdlJTIyKSUwQWltYWdlJTIwJTNEJTIwZGF0YXNldCU1QiUyMnRlc3QlMjIlNUQlNUIlMjJpbWFnZSUyMiU1RCU1QjAlNUQlMEElMEFpbWFnZV9wcm9jZXNzb3IlMjAlM0QlMjBBdXRvSW1hZ2VQcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMmdvb2dsZSUyRnZpdC1oeWJyaWQtYmFzZS1iaXQtMzg0JTIyKSUwQW1vZGVsJTIwJTNEJTIwVmlUSHlicmlkRm9ySW1hZ2VDbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGdml0LWh5YnJpZC1iYXNlLWJpdC0zODQlMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwaW1hZ2VfcHJvY2Vzc29yKGltYWdlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEElMEF3aXRoJTIwdG9yY2gubm9fZ3JhZCgpJTNBJTBBJTIwJTIwJTIwJTIwbG9naXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpLmxvZ2l0cyUwQSUwQSUyMyUyMG1vZGVsJTIwcHJlZGljdHMlMjBvbmUlMjBvZiUyMHRoZSUyMDEwMDAlMjBJbWFnZU5ldCUyMGNsYXNzZXMlMEFwcmVkaWN0ZWRfbGFiZWwlMjAlM0QlMjBsb2dpdHMuYXJnbWF4KC0xKS5pdGVtKCklMEFwcmludChtb2RlbC5jb25maWcuaWQybGFiZWwlNUJwcmVkaWN0ZWRfbGFiZWwlNUQp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, ViTHybridForImageClassification
<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;google/vit-hybrid-base-bit-384&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ViTHybridForImageClassification.from_pretrained(<span class="hljs-string">&quot;google/vit-hybrid-base-bit-384&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])
tabby, tabby cat`,wrap:!1}}),{c(){n=c("p"),n.textContent=v,l=s(),h(d.$$.fragment)},l(r){n=m(r,"P",{"data-svelte-h":!0}),T(n)!=="svelte-11lpom8"&&(n.textContent=v),l=i(r),f(d.$$.fragment,r)},m(r,w){a(r,n,w),a(r,l,w),g(d,r,w),y=!0},p:$e,i(r){y||(u(d.$$.fragment,r),y=!0)},o(r){b(d.$$.fragment,r),y=!1},d(r){r&&(o(n),o(l)),_(d,r)}}}function Wt(C){let n,v,l,d,y,r,w,Me,L,lt=`The hybrid Vision Transformer (ViT) model was proposed in <a href="https://arxiv.org/abs/2010.11929" rel="nofollow">An Image is Worth 16x16 Words: Transformers for Image Recognition
at Scale</a> by Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk
Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, Jakob
Uszkoreit, Neil Houlsby. It’s the first paper that successfully trains a Transformer encoder on ImageNet, attaining
very good results compared to familiar convolutional architectures. ViT hybrid is a slight variant of the <a href="vit">plain Vision Transformer</a>,
by leveraging a convolutional backbone (specifically, <a href="bit">BiT</a>) whose features are used as initial “tokens” for the Transformer.`,Ce,q,dt="The abstract from the paper is the following:",Ve,S,ct=`<em>While the Transformer architecture has become the de-facto standard for natural language processing tasks, its
applications to computer vision remain limited. In vision, attention is either applied in conjunction with
convolutional networks, or used to replace certain components of convolutional networks while keeping their overall
structure in place. We show that this reliance on CNNs is not necessary and a pure transformer applied directly to
sequences of image patches can perform very well on image classification tasks. When pre-trained on large amounts of
data and transferred to multiple mid-sized or small image recognition benchmarks (ImageNet, CIFAR-100, VTAB, etc.),
Vision Transformer (ViT) attains excellent results compared to state-of-the-art convolutional networks while requiring
substantially fewer computational resources to train.</em>`,He,D,mt=`This model was contributed by <a href="https://huggingface.co/nielsr" rel="nofollow">nielsr</a>. The original code (written in JAX) can be
found <a href="https://github.com/google-research/vision_transformer" rel="nofollow">here</a>.`,Ie,Y,xe,X,pt="A list of official Hugging Face and community (indicated by 🌎) resources to help you get started with ViT Hybrid.",ze,Q,ke,A,ht='<li><a href="/docs/transformers/main/en/model_doc/vit_hybrid#transformers.ViTHybridForImageClassification">ViTHybridForImageClassification</a> is supported by this <a href="https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-classification" rel="nofollow">example script</a> and <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/image_classification.ipynb" rel="nofollow">notebook</a>.</li> <li>See also: <a href="../tasks/image_classification">Image classification task guide</a></li>',je,O,ft="If you’re interested in submitting a resource to be included here, please feel free to open a Pull Request and we’ll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource.",Je,K,Fe,$,ee,Ge,he,gt=`This is the configuration class to store the configuration of a <a href="/docs/transformers/main/en/model_doc/vit_hybrid#transformers.ViTHybridModel">ViTHybridModel</a>. It is used to instantiate a ViT
Hybrid model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield a similar configuration to that of the ViT Hybrid
<a href="https://huggingface.co/google/vit-hybrid-base-bit-384" rel="nofollow">google/vit-hybrid-base-bit-384</a> architecture.`,Le,fe,ut=`Configuration objects inherit from <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> and can be used to control the model outputs. Read the
documentation from <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,qe,W,Ze,te,We,I,oe,Se,ge,bt="Constructs a ViT Hybrid image processor.",De,U,ne,Ye,ue,_t="Preprocess an image or batch of images.",Ue,re,Ne,x,ae,Xe,be,yt=`The bare ViT Hybrid Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`,Qe,V,se,Ae,_e,Tt='The <a href="/docs/transformers/main/en/model_doc/vit_hybrid#transformers.ViTHybridModel">ViTHybridModel</a> forward method, overrides the <code>__call__</code> special method.',Oe,N,Ke,P,Pe,ie,Ee,M,le,et,ye,vt=`ViT Hybrid 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.`,tt,Te,wt=`This model is a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`,ot,H,de,nt,ve,$t='The <a href="/docs/transformers/main/en/model_doc/vit_hybrid#transformers.ViTHybridForImageClassification">ViTHybridForImageClassification</a> forward method, overrides the <code>__call__</code> special method.',rt,E,at,B,Be,we,Re;return y=new pe({props:{title:"Hybrid Vision Transformer (ViT Hybrid)",local:"hybrid-vision-transformer-vit-hybrid",headingTag:"h1"}}),w=new pe({props:{title:"Overview",local:"overview",headingTag:"h2"}}),Y=new pe({props:{title:"Resources",local:"resources",headingTag:"h2"}}),Q=new zt({props:{pipeline:"image-classification"}}),K=new pe({props:{title:"ViTHybridConfig",local:"transformers.ViTHybridConfig",headingTag:"h2"}}),ee=new me({props:{name:"class transformers.ViTHybridConfig",anchor:"transformers.ViTHybridConfig",parameters:[{name:"backbone_config",val:" = None"},{name:"hidden_size",val:" = 768"},{name:"num_hidden_layers",val:" = 12"},{name:"num_attention_heads",val:" = 12"},{name:"intermediate_size",val:" = 3072"},{name:"hidden_act",val:" = 'gelu'"},{name:"hidden_dropout_prob",val:" = 0.0"},{name:"attention_probs_dropout_prob",val:" = 0.0"},{name:"initializer_range",val:" = 0.02"},{name:"layer_norm_eps",val:" = 1e-12"},{name:"image_size",val:" = 224"},{name:"patch_size",val:" = 1"},{name:"num_channels",val:" = 3"},{name:"backbone_featmap_shape",val:" = [1, 1024, 24, 24]"},{name:"qkv_bias",val:" = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.ViTHybridConfig.backbone_config",description:`<strong>backbone_config</strong> (<code>Union[Dict[str, Any], PretrainedConfig]</code>, <em>optional</em>) &#x2014;
The configuration of the backbone in a dictionary or the config object of the backbone.`,name:"backbone_config"},{anchor:"transformers.ViTHybridConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 768) &#x2014;
Dimensionality of the encoder layers and the pooler layer.`,name:"hidden_size"},{anchor:"transformers.ViTHybridConfig.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of hidden layers in the Transformer encoder.`,name:"num_hidden_layers"},{anchor:"transformers.ViTHybridConfig.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"num_attention_heads"},{anchor:"transformers.ViTHybridConfig.intermediate_size",description:`<strong>intermediate_size</strong> (<code>int</code>, <em>optional</em>, defaults to 3072) &#x2014;
Dimensionality of the &#x201C;intermediate&#x201D; (i.e., feed-forward) layer in the Transformer encoder.`,name:"intermediate_size"},{anchor:"transformers.ViTHybridConfig.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.ViTHybridConfig.hidden_dropout_prob",description:`<strong>hidden_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.`,name:"hidden_dropout_prob"},{anchor:"transformers.ViTHybridConfig.attention_probs_dropout_prob",description:`<strong>attention_probs_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout ratio for the attention probabilities.`,name:"attention_probs_dropout_prob"},{anchor:"transformers.ViTHybridConfig.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.ViTHybridConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-12) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.ViTHybridConfig.image_size",description:`<strong>image_size</strong> (<code>int</code>, <em>optional</em>, defaults to 224) &#x2014;
The size (resolution) of each image.`,name:"image_size"},{anchor:"transformers.ViTHybridConfig.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The size (resolution) of each patch.`,name:"patch_size"},{anchor:"transformers.ViTHybridConfig.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.ViTHybridConfig.backbone_featmap_shape",description:`<strong>backbone_featmap_shape</strong> (<code>List[int]</code>, <em>optional</em>, defaults to <code>[1, 1024, 24, 24]</code>) &#x2014;
Used only for the <code>hybrid</code> embedding type. The shape of the feature maps of the backbone.`,name:"backbone_featmap_shape"},{anchor:"transformers.ViTHybridConfig.qkv_bias",description:`<strong>qkv_bias</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to add a bias to the queries, keys and values.`,name:"qkv_bias"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/vit_hybrid/configuration_vit_hybrid.py#L32"}}),W=new st({props:{anchor:"transformers.ViTHybridConfig.example",$$slots:{default:[kt]},$$scope:{ctx:C}}}),te=new pe({props:{title:"ViTHybridImageProcessor",local:"transformers.ViTHybridImageProcessor",headingTag:"h2"}}),oe=new me({props:{name:"class transformers.ViTHybridImageProcessor",anchor:"transformers.ViTHybridImageProcessor",parameters:[{name:"do_resize",val:": bool = True"},{name:"size",val:": typing.Dict[str, int] = None"},{name:"resample",val:": Resampling = <Resampling.BICUBIC: 3>"},{name:"do_center_crop",val:": bool = True"},{name:"crop_size",val:": typing.Dict[str, int] = None"},{name:"do_rescale",val:": bool = True"},{name:"rescale_factor",val:": typing.Union[int, float] = 0.00392156862745098"},{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:"do_convert_rgb",val:": bool = True"},{name:"use_square_size",val:": bool = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.ViTHybridImageProcessor.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</code>. Can be overridden by
<code>do_resize</code> in the <code>preprocess</code> method.`,name:"do_resize"},{anchor:"transformers.ViTHybridImageProcessor.size",description:`<strong>size</strong> (<code>Dict[str, int]</code> <em>optional</em>, defaults to <code>{&quot;shortest_edge&quot; -- 224}</code>):
Size of the image after resizing. The shortest edge of the image is resized to size[&#x201C;shortest_edge&#x201D;], with
the longest edge resized to keep the input aspect ratio. Can be overridden by <code>size</code> in the <code>preprocess</code>
method.`,name:"size"},{anchor:"transformers.ViTHybridImageProcessor.resample",description:`<strong>resample</strong> (<code>PILImageResampling</code>, <em>optional</em>, defaults to <code>PILImageResampling.BICUBIC</code>) &#x2014;
Resampling filter to use if resizing the image. Can be overridden by <code>resample</code> in the <code>preprocess</code> method.`,name:"resample"},{anchor:"transformers.ViTHybridImageProcessor.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.ViTHybridImageProcessor.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.ViTHybridImageProcessor.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 <code>do_rescale</code> in
the <code>preprocess</code> method.`,name:"do_rescale"},{anchor:"transformers.ViTHybridImageProcessor.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 <code>rescale_factor</code> in the <code>preprocess</code>
method.
do_normalize &#x2014;
Whether to normalize the image. Can be overridden by <code>do_normalize</code> in the <code>preprocess</code> method.`,name:"rescale_factor"},{anchor:"transformers.ViTHybridImageProcessor.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.ViTHybridImageProcessor.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.
Can be overridden by the <code>image_std</code> parameter in the <code>preprocess</code> method.`,name:"image_std"},{anchor:"transformers.ViTHybridImageProcessor.do_convert_rgb",description:`<strong>do_convert_rgb</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to convert the image to RGB.`,name:"do_convert_rgb"},{anchor:"transformers.ViTHybridImageProcessor.use_square_size",description:`<strong>use_square_size</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
The value to be passed to <code>get_size_dict</code> as <code>default_to_square</code> when computing the image size. If the
<code>size</code> argument in <code>get_size_dict</code> is an <code>int</code>, it determines whether to default to a square image or not.
Note that this attribute is not used in computing <code>crop_size</code> via calling <code>get_size_dict</code>.`,name:"use_square_size"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/vit_hybrid/image_processing_vit_hybrid.py#L50"}}),ne=new me({props:{name:"preprocess",anchor:"transformers.ViTHybridImageProcessor.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:": 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:": bool = None"},{name:"rescale_factor",val:": float = None"},{name:"do_normalize",val:": 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:"do_convert_rgb",val:": bool = None"},{name:"return_tensors",val:": typing.Union[str, transformers.utils.generic.TensorType, NoneType] = None"},{name:"data_format",val:": typing.Optional[transformers.image_utils.ChannelDimension] = <ChannelDimension.FIRST: 'channels_first'>"},{name:"input_data_format",val:": typing.Union[str, transformers.image_utils.ChannelDimension, NoneType] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.ViTHybridImageProcessor.preprocess.images",description:`<strong>images</strong> (<code>ImageInput</code>) &#x2014;
Image to preprocess. Expects a single or batch of images with pixel values ranging from 0 to 255. If
passing in images with pixel values between 0 and 1, set <code>do_rescale=False</code>.`,name:"images"},{anchor:"transformers.ViTHybridImageProcessor.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.ViTHybridImageProcessor.preprocess.size",description:`<strong>size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>self.size</code>) &#x2014;
Size of the image after resizing. Shortest edge of the image is resized to size[&#x201C;shortest_edge&#x201D;], with
the longest edge resized to keep the input aspect ratio.`,name:"size"},{anchor:"transformers.ViTHybridImageProcessor.preprocess.resample",description:`<strong>resample</strong> (<code>int</code>, <em>optional</em>, defaults to <code>self.resample</code>) &#x2014;
Resampling filter to use if resizing the image. This can be one of the enum <code>PILImageResampling</code>. Only
has an effect if <code>do_resize</code> is set to <code>True</code>.`,name:"resample"},{anchor:"transformers.ViTHybridImageProcessor.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.ViTHybridImageProcessor.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.ViTHybridImageProcessor.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.`,name:"do_rescale"},{anchor:"transformers.ViTHybridImageProcessor.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.ViTHybridImageProcessor.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.ViTHybridImageProcessor.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 for normalization. Only has an effect if <code>do_normalize</code> is set to <code>True</code>.`,name:"image_mean"},{anchor:"transformers.ViTHybridImageProcessor.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 for normalization. Only has an effect if <code>do_normalize</code> is set to
<code>True</code>.`,name:"image_std"},{anchor:"transformers.ViTHybridImageProcessor.preprocess.do_convert_rgb",description:`<strong>do_convert_rgb</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_convert_rgb</code>) &#x2014;
Whether to convert the image to RGB.`,name:"do_convert_rgb"},{anchor:"transformers.ViTHybridImageProcessor.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.ViTHybridImageProcessor.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>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li>
<li><code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.</li>
<li>Unset: defaults to the channel dimension format of the input image.</li>
</ul>`,name:"data_format"},{anchor:"transformers.ViTHybridImageProcessor.preprocess.input_data_format",description:`<strong>input_data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>) &#x2014;
The channel dimension format for the input image. If unset, the channel dimension format is inferred
from the input 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><code>&quot;none&quot;</code> or <code>ChannelDimension.NONE</code>: image in (height, width) format.</li>
</ul>`,name:"input_data_format"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/vit_hybrid/image_processing_vit_hybrid.py#L174"}}),re=new pe({props:{title:"ViTHybridModel",local:"transformers.ViTHybridModel",headingTag:"h2"}}),ae=new me({props:{name:"class transformers.ViTHybridModel",anchor:"transformers.ViTHybridModel",parameters:[{name:"config",val:": ViTHybridConfig"},{name:"add_pooling_layer",val:": bool = True"},{name:"use_mask_token",val:": bool = False"}],parametersDescription:[{anchor:"transformers.ViTHybridModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/vit_hybrid#transformers.ViTHybridConfig">ViTHybridConfig</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/main/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/main/src/transformers/models/vit_hybrid/modeling_vit_hybrid.py#L523"}}),se=new me({props:{name:"forward",anchor:"transformers.ViTHybridModel.forward",parameters:[{name:"pixel_values",val:": typing.Optional[torch.Tensor] = None"},{name:"bool_masked_pos",val:": typing.Optional[torch.BoolTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"interpolate_pos_encoding",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.ViTHybridModel.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/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/main/en/model_doc/dpt#transformers.DPTFeatureExtractor.__call__">ViTHybridImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.ViTHybridModel.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.ViTHybridModel.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.ViTHybridModel.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.ViTHybridModel.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/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.ViTHybridModel.forward.bool_masked_pos",description:`<strong>bool_masked_pos</strong> (<code>torch.BoolTensor</code> of shape <code>(batch_size, num_patches)</code>, <em>optional</em>) &#x2014;
Boolean masked positions. Indicates which patches are masked (1) and which aren&#x2019;t (0).`,name:"bool_masked_pos"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/vit_hybrid/modeling_vit_hybrid.py#L548",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/main/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/main/en/model_doc/vit_hybrid#transformers.ViTHybridConfig"
>ViTHybridConfig</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>) — 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>) — 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>) — 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>) — 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:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),N=new Mt({props:{$$slots:{default:[jt]},$$scope:{ctx:C}}}),P=new st({props:{anchor:"transformers.ViTHybridModel.forward.example",$$slots:{default:[Jt]},$$scope:{ctx:C}}}),ie=new pe({props:{title:"ViTHybridForImageClassification",local:"transformers.ViTHybridForImageClassification",headingTag:"h2"}}),le=new me({props:{name:"class transformers.ViTHybridForImageClassification",anchor:"transformers.ViTHybridForImageClassification",parameters:[{name:"config",val:": ViTHybridConfig"}],parametersDescription:[{anchor:"transformers.ViTHybridForImageClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/vit_hybrid#transformers.ViTHybridConfig">ViTHybridConfig</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/main/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/main/src/transformers/models/vit_hybrid/modeling_vit_hybrid.py#L642"}}),de=new me({props:{name:"forward",anchor:"transformers.ViTHybridForImageClassification.forward",parameters:[{name:"pixel_values",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"labels",val:": typing.Optional[torch.Tensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"interpolate_pos_encoding",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.ViTHybridForImageClassification.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/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/main/en/model_doc/dpt#transformers.DPTFeatureExtractor.__call__">ViTHybridImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.ViTHybridForImageClassification.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.ViTHybridForImageClassification.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.ViTHybridForImageClassification.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.ViTHybridForImageClassification.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/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.ViTHybridForImageClassification.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/main/src/transformers/models/vit_hybrid/modeling_vit_hybrid.py#L655",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/main/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/main/en/model_doc/vit_hybrid#transformers.ViTHybridConfig"
>ViTHybridConfig</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) — 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>) — 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>) — 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>) — 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:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.ImageClassifierOutput"
>transformers.modeling_outputs.ImageClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),E=new Mt({props:{$$slots:{default:[Ft]},$$scope:{ctx:C}}}),B=new st({props:{anchor:"transformers.ViTHybridForImageClassification.forward.example",$$slots:{default:[Zt]},$$scope:{ctx:C}}}),{c(){n=c("meta"),v=s(),l=c("p"),d=s(),h(y.$$.fragment),r=s(),h(w.$$.fragment),Me=s(),L=c("p"),L.innerHTML=lt,Ce=s(),q=c("p"),q.textContent=dt,Ve=s(),S=c("p"),S.innerHTML=ct,He=s(),D=c("p"),D.innerHTML=mt,Ie=s(),h(Y.$$.fragment),xe=s(),X=c("p"),X.textContent=pt,ze=s(),h(Q.$$.fragment),ke=s(),A=c("ul"),A.innerHTML=ht,je=s(),O=c("p"),O.textContent=ft,Je=s(),h(K.$$.fragment),Fe=s(),$=c("div"),h(ee.$$.fragment),Ge=s(),he=c("p"),he.innerHTML=gt,Le=s(),fe=c("p"),fe.innerHTML=ut,qe=s(),h(W.$$.fragment),Ze=s(),h(te.$$.fragment),We=s(),I=c("div"),h(oe.$$.fragment),Se=s(),ge=c("p"),ge.textContent=bt,De=s(),U=c("div"),h(ne.$$.fragment),Ye=s(),ue=c("p"),ue.textContent=_t,Ue=s(),h(re.$$.fragment),Ne=s(),x=c("div"),h(ae.$$.fragment),Xe=s(),be=c("p"),be.innerHTML=yt,Qe=s(),V=c("div"),h(se.$$.fragment),Ae=s(),_e=c("p"),_e.innerHTML=Tt,Oe=s(),h(N.$$.fragment),Ke=s(),h(P.$$.fragment),Pe=s(),h(ie.$$.fragment),Ee=s(),M=c("div"),h(le.$$.fragment),et=s(),ye=c("p"),ye.textContent=vt,tt=s(),Te=c("p"),Te.innerHTML=wt,ot=s(),H=c("div"),h(de.$$.fragment),nt=s(),ve=c("p"),ve.innerHTML=$t,rt=s(),h(E.$$.fragment),at=s(),h(B.$$.fragment),Be=s(),we=c("p"),this.h()},l(e){const t=xt("svelte-u9bgzb",document.head);n=m(t,"META",{name:!0,content:!0}),t.forEach(o),v=i(e),l=m(e,"P",{}),F(l).forEach(o),d=i(e),f(y.$$.fragment,e),r=i(e),f(w.$$.fragment,e),Me=i(e),L=m(e,"P",{"data-svelte-h":!0}),T(L)!=="svelte-6697c1"&&(L.innerHTML=lt),Ce=i(e),q=m(e,"P",{"data-svelte-h":!0}),T(q)!=="svelte-vfdo9a"&&(q.textContent=dt),Ve=i(e),S=m(e,"P",{"data-svelte-h":!0}),T(S)!=="svelte-yjj3f8"&&(S.innerHTML=ct),He=i(e),D=m(e,"P",{"data-svelte-h":!0}),T(D)!=="svelte-pwnwoc"&&(D.innerHTML=mt),Ie=i(e),f(Y.$$.fragment,e),xe=i(e),X=m(e,"P",{"data-svelte-h":!0}),T(X)!=="svelte-rhht3g"&&(X.textContent=pt),ze=i(e),f(Q.$$.fragment,e),ke=i(e),A=m(e,"UL",{"data-svelte-h":!0}),T(A)!=="svelte-y2ivb7"&&(A.innerHTML=ht),je=i(e),O=m(e,"P",{"data-svelte-h":!0}),T(O)!=="svelte-1xesile"&&(O.textContent=ft),Je=i(e),f(K.$$.fragment,e),Fe=i(e),$=m(e,"DIV",{class:!0});var z=F($);f(ee.$$.fragment,z),Ge=i(z),he=m(z,"P",{"data-svelte-h":!0}),T(he)!=="svelte-nac9fv"&&(he.innerHTML=gt),Le=i(z),fe=m(z,"P",{"data-svelte-h":!0}),T(fe)!=="svelte-o55m63"&&(fe.innerHTML=ut),qe=i(z),f(W.$$.fragment,z),z.forEach(o),Ze=i(e),f(te.$$.fragment,e),We=i(e),I=m(e,"DIV",{class:!0});var j=F(I);f(oe.$$.fragment,j),Se=i(j),ge=m(j,"P",{"data-svelte-h":!0}),T(ge)!=="svelte-p40nh7"&&(ge.textContent=bt),De=i(j),U=m(j,"DIV",{class:!0});var ce=F(U);f(ne.$$.fragment,ce),Ye=i(ce),ue=m(ce,"P",{"data-svelte-h":!0}),T(ue)!=="svelte-1x3yxsa"&&(ue.textContent=_t),ce.forEach(o),j.forEach(o),Ue=i(e),f(re.$$.fragment,e),Ne=i(e),x=m(e,"DIV",{class:!0});var J=F(x);f(ae.$$.fragment,J),Xe=i(J),be=m(J,"P",{"data-svelte-h":!0}),T(be)!=="svelte-9dwrv6"&&(be.innerHTML=yt),Qe=i(J),V=m(J,"DIV",{class:!0});var k=F(V);f(se.$$.fragment,k),Ae=i(k),_e=m(k,"P",{"data-svelte-h":!0}),T(_e)!=="svelte-13rm629"&&(_e.innerHTML=Tt),Oe=i(k),f(N.$$.fragment,k),Ke=i(k),f(P.$$.fragment,k),k.forEach(o),J.forEach(o),Pe=i(e),f(ie.$$.fragment,e),Ee=i(e),M=m(e,"DIV",{class:!0});var R=F(M);f(le.$$.fragment,R),et=i(R),ye=m(R,"P",{"data-svelte-h":!0}),T(ye)!=="svelte-hvti62"&&(ye.textContent=vt),tt=i(R),Te=m(R,"P",{"data-svelte-h":!0}),T(Te)!=="svelte-1gjh92c"&&(Te.innerHTML=wt),ot=i(R),H=m(R,"DIV",{class:!0});var G=F(H);f(de.$$.fragment,G),nt=i(G),ve=m(G,"P",{"data-svelte-h":!0}),T(ve)!=="svelte-1k2mfd9"&&(ve.innerHTML=$t),rt=i(G),f(E.$$.fragment,G),at=i(G),f(B.$$.fragment,G),G.forEach(o),R.forEach(o),Be=i(e),we=m(e,"P",{}),F(we).forEach(o),this.h()},h(){Z(n,"name","hf:doc:metadata"),Z(n,"content",Ut),Z($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(H,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(M,"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,t){p(document.head,n),a(e,v,t),a(e,l,t),a(e,d,t),g(y,e,t),a(e,r,t),g(w,e,t),a(e,Me,t),a(e,L,t),a(e,Ce,t),a(e,q,t),a(e,Ve,t),a(e,S,t),a(e,He,t),a(e,D,t),a(e,Ie,t),g(Y,e,t),a(e,xe,t),a(e,X,t),a(e,ze,t),g(Q,e,t),a(e,ke,t),a(e,A,t),a(e,je,t),a(e,O,t),a(e,Je,t),g(K,e,t),a(e,Fe,t),a(e,$,t),g(ee,$,null),p($,Ge),p($,he),p($,Le),p($,fe),p($,qe),g(W,$,null),a(e,Ze,t),g(te,e,t),a(e,We,t),a(e,I,t),g(oe,I,null),p(I,Se),p(I,ge),p(I,De),p(I,U),g(ne,U,null),p(U,Ye),p(U,ue),a(e,Ue,t),g(re,e,t),a(e,Ne,t),a(e,x,t),g(ae,x,null),p(x,Xe),p(x,be),p(x,Qe),p(x,V),g(se,V,null),p(V,Ae),p(V,_e),p(V,Oe),g(N,V,null),p(V,Ke),g(P,V,null),a(e,Pe,t),g(ie,e,t),a(e,Ee,t),a(e,M,t),g(le,M,null),p(M,et),p(M,ye),p(M,tt),p(M,Te),p(M,ot),p(M,H),g(de,H,null),p(H,nt),p(H,ve),p(H,rt),g(E,H,null),p(H,at),g(B,H,null),a(e,Be,t),a(e,we,t),Re=!0},p(e,[t]){const z={};t&2&&(z.$$scope={dirty:t,ctx:e}),W.$set(z);const j={};t&2&&(j.$$scope={dirty:t,ctx:e}),N.$set(j);const ce={};t&2&&(ce.$$scope={dirty:t,ctx:e}),P.$set(ce);const J={};t&2&&(J.$$scope={dirty:t,ctx:e}),E.$set(J);const k={};t&2&&(k.$$scope={dirty:t,ctx:e}),B.$set(k)},i(e){Re||(u(y.$$.fragment,e),u(w.$$.fragment,e),u(Y.$$.fragment,e),u(Q.$$.fragment,e),u(K.$$.fragment,e),u(ee.$$.fragment,e),u(W.$$.fragment,e),u(te.$$.fragment,e),u(oe.$$.fragment,e),u(ne.$$.fragment,e),u(re.$$.fragment,e),u(ae.$$.fragment,e),u(se.$$.fragment,e),u(N.$$.fragment,e),u(P.$$.fragment,e),u(ie.$$.fragment,e),u(le.$$.fragment,e),u(de.$$.fragment,e),u(E.$$.fragment,e),u(B.$$.fragment,e),Re=!0)},o(e){b(y.$$.fragment,e),b(w.$$.fragment,e),b(Y.$$.fragment,e),b(Q.$$.fragment,e),b(K.$$.fragment,e),b(ee.$$.fragment,e),b(W.$$.fragment,e),b(te.$$.fragment,e),b(oe.$$.fragment,e),b(ne.$$.fragment,e),b(re.$$.fragment,e),b(ae.$$.fragment,e),b(se.$$.fragment,e),b(N.$$.fragment,e),b(P.$$.fragment,e),b(ie.$$.fragment,e),b(le.$$.fragment,e),b(de.$$.fragment,e),b(E.$$.fragment,e),b(B.$$.fragment,e),Re=!1},d(e){e&&(o(v),o(l),o(d),o(r),o(Me),o(L),o(Ce),o(q),o(Ve),o(S),o(He),o(D),o(Ie),o(xe),o(X),o(ze),o(ke),o(A),o(je),o(O),o(Je),o(Fe),o($),o(Ze),o(We),o(I),o(Ue),o(Ne),o(x),o(Pe),o(Ee),o(M),o(Be),o(we)),o(n),_(y,e),_(w,e),_(Y,e),_(Q,e),_(K,e),_(ee),_(W),_(te,e),_(oe),_(ne),_(re,e),_(ae),_(se),_(N),_(P),_(ie,e),_(le),_(de),_(E),_(B)}}}const Ut='{"title":"Hybrid Vision Transformer (ViT Hybrid)","local":"hybrid-vision-transformer-vit-hybrid","sections":[{"title":"Overview","local":"overview","sections":[],"depth":2},{"title":"Resources","local":"resources","sections":[],"depth":2},{"title":"ViTHybridConfig","local":"transformers.ViTHybridConfig","sections":[],"depth":2},{"title":"ViTHybridImageProcessor","local":"transformers.ViTHybridImageProcessor","sections":[],"depth":2},{"title":"ViTHybridModel","local":"transformers.ViTHybridModel","sections":[],"depth":2},{"title":"ViTHybridForImageClassification","local":"transformers.ViTHybridForImageClassification","sections":[],"depth":2}],"depth":1}';function Nt(C){return Vt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Dt extends Ht{constructor(n){super(),It(this,n,Nt,Wt,Ct,{})}}export{Dt as component};
