import{s as Mo,f as $o,o as xo,n as we}from"../chunks/scheduler.25b97de1.js";import{S as Fo,i as Vo,g as c,s as r,r as b,A as Co,h as m,f as n,c as i,j as re,u as y,x as g,k as Q,y as d,a as l,v,d as w,t as M,w as $}from"../chunks/index.d9030fc9.js";import{T as Re}from"../chunks/Tip.baa67368.js";import{D as be}from"../chunks/Docstring.ffac8efa.js";import{C as Se}from"../chunks/CodeBlock.e6cd0d95.js";import{F as Io,M as lo}from"../chunks/Markdown.7217f838.js";import{E as Oe}from"../chunks/ExampleCodeBlock.22dfe688.js";import{P as jo}from"../chunks/PipelineTag.5f100392.js";import{H as We,E as ko}from"../chunks/EditOnGithub.91d95064.js";function Uo(V){let t,p="Example:",o,a,_;return a=new Se({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFZpVENvbmZpZyUyQyUyMFZpVE1vZGVsJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMFZpVCUyMHZpdC1iYXNlLXBhdGNoMTYtMjI0JTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyMFZpVENvbmZpZygpJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMG1vZGVsJTIwKHdpdGglMjByYW5kb20lMjB3ZWlnaHRzKSUyMGZyb20lMjB0aGUlMjB2aXQtYmFzZS1wYXRjaDE2LTIyNCUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQW1vZGVsJTIwJTNEJTIwVmlUTW9kZWwoY29uZmlndXJhdGlvbiklMEElMEElMjMlMjBBY2Nlc3NpbmclMjB0aGUlMjBtb2RlbCUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwbW9kZWwuY29uZmln",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> ViTConfig, ViTModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a ViT vit-base-patch16-224 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = ViTConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model (with random weights) from the vit-base-patch16-224 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ViTModel(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(){t=c("p"),t.textContent=p,o=r(),b(a.$$.fragment)},l(s){t=m(s,"P",{"data-svelte-h":!0}),g(t)!=="svelte-11lpom8"&&(t.textContent=p),o=i(s),y(a.$$.fragment,s)},m(s,x){l(s,t,x),l(s,o,x),v(a,s,x),_=!0},p:we,i(s){_||(w(a.$$.fragment,s),_=!0)},o(s){M(a.$$.fragment,s),_=!1},d(s){s&&(n(t),n(o)),$(a,s)}}}function Jo(V){let t,p=`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(){t=c("p"),t.innerHTML=p},l(o){t=m(o,"P",{"data-svelte-h":!0}),g(t)!=="svelte-fincs2"&&(t.innerHTML=p)},m(o,a){l(o,t,a)},p:we,d(o){o&&n(t)}}}function No(V){let t,p="Example:",o,a,_;return a=new Se({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyMFZpVE1vZGVsJTBBaW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGF0YXNldHMlMjBpbXBvcnQlMjBsb2FkX2RhdGFzZXQlMEElMEFkYXRhc2V0JTIwJTNEJTIwbG9hZF9kYXRhc2V0KCUyMmh1Z2dpbmdmYWNlJTJGY2F0cy1pbWFnZSUyMiUyQyUyMHRydXN0X3JlbW90ZV9jb2RlJTNEVHJ1ZSklMEFpbWFnZSUyMCUzRCUyMGRhdGFzZXQlNUIlMjJ0ZXN0JTIyJTVEJTVCJTIyaW1hZ2UlMjIlNUQlNUIwJTVEJTBBJTBBaW1hZ2VfcHJvY2Vzc29yJTIwJTNEJTIwQXV0b0ltYWdlUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZ2aXQtYmFzZS1wYXRjaDE2LTIyNC1pbjIxayUyMiklMEFtb2RlbCUyMCUzRCUyMFZpVE1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZ2aXQtYmFzZS1wYXRjaDE2LTIyNC1pbjIxayUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjBpbWFnZV9wcm9jZXNzb3IoaW1hZ2UlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQXdpdGglMjB0b3JjaC5ub19ncmFkKCklM0ElMEElMjAlMjAlMjAlMjBvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpJTBBJTBBbGFzdF9oaWRkZW5fc3RhdGVzJTIwJTNEJTIwb3V0cHV0cy5sYXN0X2hpZGRlbl9zdGF0ZSUwQWxpc3QobGFzdF9oaWRkZW5fc3RhdGVzLnNoYXBlKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, ViTModel
<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>, trust_remote_code=<span class="hljs-literal">True</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-base-patch16-224-in21k&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ViTModel.from_pretrained(<span class="hljs-string">&quot;google/vit-base-patch16-224-in21k&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(){t=c("p"),t.textContent=p,o=r(),b(a.$$.fragment)},l(s){t=m(s,"P",{"data-svelte-h":!0}),g(t)!=="svelte-11lpom8"&&(t.textContent=p),o=i(s),y(a.$$.fragment,s)},m(s,x){l(s,t,x),l(s,o,x),v(a,s,x),_=!0},p:we,i(s){_||(w(a.$$.fragment,s),_=!0)},o(s){M(a.$$.fragment,s),_=!1},d(s){s&&(n(t),n(o)),$(a,s)}}}function zo(V){let t,p=`Note that we provide a script to pre-train this model on custom data in our <a href="https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-pretraining" rel="nofollow">examples
directory</a>.`;return{c(){t=c("p"),t.innerHTML=p},l(o){t=m(o,"P",{"data-svelte-h":!0}),g(t)!=="svelte-7i3y9o"&&(t.innerHTML=p)},m(o,a){l(o,t,a)},p:we,d(o){o&&n(t)}}}function Wo(V){let t,p=`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(){t=c("p"),t.innerHTML=p},l(o){t=m(o,"P",{"data-svelte-h":!0}),g(t)!=="svelte-fincs2"&&(t.innerHTML=p)},m(o,a){l(o,t,a)},p:we,d(o){o&&n(t)}}}function Zo(V){let t,p="Examples:",o,a,_;return a=new Se({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyMFZpVEZvck1hc2tlZEltYWdlTW9kZWxpbmclMEFpbXBvcnQlMjB0b3JjaCUwQWZyb20lMjBQSUwlMjBpbXBvcnQlMjBJbWFnZSUwQWltcG9ydCUyMHJlcXVlc3RzJTBBJTBBdXJsJTIwJTNEJTIwJTIyaHR0cCUzQSUyRiUyRmltYWdlcy5jb2NvZGF0YXNldC5vcmclMkZ2YWwyMDE3JTJGMDAwMDAwMDM5NzY5LmpwZyUyMiUwQWltYWdlJTIwJTNEJTIwSW1hZ2Uub3BlbihyZXF1ZXN0cy5nZXQodXJsJTJDJTIwc3RyZWFtJTNEVHJ1ZSkucmF3KSUwQSUwQWltYWdlX3Byb2Nlc3NvciUyMCUzRCUyMEF1dG9JbWFnZVByb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGdml0LWJhc2UtcGF0Y2gxNi0yMjQtaW4yMWslMjIpJTBBbW9kZWwlMjAlM0QlMjBWaVRGb3JNYXNrZWRJbWFnZU1vZGVsaW5nLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZ2aXQtYmFzZS1wYXRjaDE2LTIyNC1pbjIxayUyMiklMEElMEFudW1fcGF0Y2hlcyUyMCUzRCUyMChtb2RlbC5jb25maWcuaW1hZ2Vfc2l6ZSUyMCUyRiUyRiUyMG1vZGVsLmNvbmZpZy5wYXRjaF9zaXplKSUyMCoqJTIwMiUwQXBpeGVsX3ZhbHVlcyUyMCUzRCUyMGltYWdlX3Byb2Nlc3NvcihpbWFnZXMlM0RpbWFnZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpLnBpeGVsX3ZhbHVlcyUwQSUyMyUyMGNyZWF0ZSUyMHJhbmRvbSUyMGJvb2xlYW4lMjBtYXNrJTIwb2YlMjBzaGFwZSUyMChiYXRjaF9zaXplJTJDJTIwbnVtX3BhdGNoZXMpJTBBYm9vbF9tYXNrZWRfcG9zJTIwJTNEJTIwdG9yY2gucmFuZGludChsb3clM0QwJTJDJTIwaGlnaCUzRDIlMkMlMjBzaXplJTNEKDElMkMlMjBudW1fcGF0Y2hlcykpLmJvb2woKSUwQSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbChwaXhlbF92YWx1ZXMlMkMlMjBib29sX21hc2tlZF9wb3MlM0Rib29sX21hc2tlZF9wb3MpJTBBbG9zcyUyQyUyMHJlY29uc3RydWN0ZWRfcGl4ZWxfdmFsdWVzJTIwJTNEJTIwb3V0cHV0cy5sb3NzJTJDJTIwb3V0cHV0cy5yZWNvbnN0cnVjdGlvbiUwQWxpc3QocmVjb25zdHJ1Y3RlZF9waXhlbF92YWx1ZXMuc2hhcGUp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, ViTForMaskedImageModeling
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000039769.jpg&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = Image.<span class="hljs-built_in">open</span>(requests.get(url, stream=<span class="hljs-literal">True</span>).raw)

<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;google/vit-base-patch16-224-in21k&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ViTForMaskedImageModeling.from_pretrained(<span class="hljs-string">&quot;google/vit-base-patch16-224-in21k&quot;</span>)

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

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(pixel_values, bool_masked_pos=bool_masked_pos)
<span class="hljs-meta">&gt;&gt;&gt; </span>loss, reconstructed_pixel_values = outputs.loss, outputs.reconstruction
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">list</span>(reconstructed_pixel_values.shape)
[<span class="hljs-number">1</span>, <span class="hljs-number">3</span>, <span class="hljs-number">224</span>, <span class="hljs-number">224</span>]`,wrap:!1}}),{c(){t=c("p"),t.textContent=p,o=r(),b(a.$$.fragment)},l(s){t=m(s,"P",{"data-svelte-h":!0}),g(t)!=="svelte-kvfsh7"&&(t.textContent=p),o=i(s),y(a.$$.fragment,s)},m(s,x){l(s,t,x),l(s,o,x),v(a,s,x),_=!0},p:we,i(s){_||(w(a.$$.fragment,s),_=!0)},o(s){M(a.$$.fragment,s),_=!1},d(s){s&&(n(t),n(o)),$(a,s)}}}function Po(V){let t,p=`Note that it’s possible to fine-tune ViT on higher resolution images than the ones it has been trained on, by
setting <code>interpolate_pos_encoding</code> to <code>True</code> in the forward of the model. This will interpolate the pre-trained
position embeddings to the higher resolution.`;return{c(){t=c("p"),t.innerHTML=p},l(o){t=m(o,"P",{"data-svelte-h":!0}),g(t)!=="svelte-111lhr1"&&(t.innerHTML=p)},m(o,a){l(o,t,a)},p:we,d(o){o&&n(t)}}}function Lo(V){let t,p=`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(){t=c("p"),t.innerHTML=p},l(o){t=m(o,"P",{"data-svelte-h":!0}),g(t)!=="svelte-fincs2"&&(t.innerHTML=p)},m(o,a){l(o,t,a)},p:we,d(o){o&&n(t)}}}function Ro(V){let t,p="Example:",o,a,_;return a=new Se({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyMFZpVEZvckltYWdlQ2xhc3NpZmljYXRpb24lMEFpbXBvcnQlMjB0b3JjaCUwQWZyb20lMjBkYXRhc2V0cyUyMGltcG9ydCUyMGxvYWRfZGF0YXNldCUwQSUwQWRhdGFzZXQlMjAlM0QlMjBsb2FkX2RhdGFzZXQoJTIyaHVnZ2luZ2ZhY2UlMkZjYXRzLWltYWdlJTIyJTJDJTIwdHJ1c3RfcmVtb3RlX2NvZGUlM0RUcnVlKSUwQWltYWdlJTIwJTNEJTIwZGF0YXNldCU1QiUyMnRlc3QlMjIlNUQlNUIlMjJpbWFnZSUyMiU1RCU1QjAlNUQlMEElMEFpbWFnZV9wcm9jZXNzb3IlMjAlM0QlMjBBdXRvSW1hZ2VQcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMmdvb2dsZSUyRnZpdC1iYXNlLXBhdGNoMTYtMjI0JTIyKSUwQW1vZGVsJTIwJTNEJTIwVmlURm9ySW1hZ2VDbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGdml0LWJhc2UtcGF0Y2gxNi0yMjQlMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwaW1hZ2VfcHJvY2Vzc29yKGltYWdlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEElMEF3aXRoJTIwdG9yY2gubm9fZ3JhZCgpJTNBJTBBJTIwJTIwJTIwJTIwbG9naXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpLmxvZ2l0cyUwQSUwQSUyMyUyMG1vZGVsJTIwcHJlZGljdHMlMjBvbmUlMjBvZiUyMHRoZSUyMDEwMDAlMjBJbWFnZU5ldCUyMGNsYXNzZXMlMEFwcmVkaWN0ZWRfbGFiZWwlMjAlM0QlMjBsb2dpdHMuYXJnbWF4KC0xKS5pdGVtKCklMEFwcmludChtb2RlbC5jb25maWcuaWQybGFiZWwlNUJwcmVkaWN0ZWRfbGFiZWwlNUQp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, ViTForImageClassification
<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>, trust_remote_code=<span class="hljs-literal">True</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-base-patch16-224&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ViTForImageClassification.from_pretrained(<span class="hljs-string">&quot;google/vit-base-patch16-224&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`,wrap:!1}}),{c(){t=c("p"),t.textContent=p,o=r(),b(a.$$.fragment)},l(s){t=m(s,"P",{"data-svelte-h":!0}),g(t)!=="svelte-11lpom8"&&(t.textContent=p),o=i(s),y(a.$$.fragment,s)},m(s,x){l(s,t,x),l(s,o,x),v(a,s,x),_=!0},p:we,i(s){_||(w(a.$$.fragment,s),_=!0)},o(s){M(a.$$.fragment,s),_=!1},d(s){s&&(n(t),n(o)),$(a,s)}}}function Ho(V){let t,p,o,a,_,s,x=`The bare ViT 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.`,ie,j,L,le,N,S='The <a href="/docs/transformers/pr_30530/en/model_doc/vit#transformers.ViTModel">ViTModel</a> forward method, overrides the <code>__call__</code> special method.',de,u,W,G,E,Ce,ye,J,ce,pe,O,Ie='ViT Model with a decoder on top for masked image modeling, as proposed in <a href="https://arxiv.org/abs/2111.09886" rel="nofollow">SimMIM</a>.',je,Z,Ze,U,te=`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.`,xe,q,z,Fe,K,fe='The <a href="/docs/transformers/pr_30530/en/model_doc/vit#transformers.ViTForMaskedImageModeling">ViTForMaskedImageModeling</a> forward method, overrides the <code>__call__</code> special method.',Ve,oe,ke,ne,Me,se,ee,D,R,me,Ue,he=`ViT 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.`,Je,ge,P,ue,ve=`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.`,ae,T,C,H,B,X='The <a href="/docs/transformers/pr_30530/en/model_doc/vit#transformers.ViTForImageClassification">ViTForImageClassification</a> forward method, overrides the <code>__call__</code> special method.',$e,F,I,A,Y;return t=new We({props:{title:"ViTModel",local:"transformers.ViTModel",headingTag:"h2"}}),a=new be({props:{name:"class transformers.ViTModel",anchor:"transformers.ViTModel",parameters:[{name:"config",val:": ViTConfig"},{name:"add_pooling_layer",val:": bool = True"},{name:"use_mask_token",val:": bool = False"}],parametersDescription:[{anchor:"transformers.ViTModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_30530/en/model_doc/vit#transformers.ViTConfig">ViTConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/pr_30530/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/vr_30530/src/transformers/models/vit/modeling_vit.py#L563"}}),L=new be({props:{name:"forward",anchor:"transformers.ViTModel.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.ViTModel.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/pr_30530/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/pr_30530/en/model_doc/imagegpt#transformers.ImageGPTFeatureExtractor.__call__">ViTImageProcessor.<strong>call</strong>()</a>
for details.`,name:"pixel_values"},{anchor:"transformers.ViTModel.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.ViTModel.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.ViTModel.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.ViTModel.forward.interpolate_pos_encoding",description:`<strong>interpolate_pos_encoding</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to interpolate the pre-trained position encodings.`,name:"interpolate_pos_encoding"},{anchor:"transformers.ViTModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/pr_30530/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.ViTModel.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/vr_30530/src/transformers/models/vit/modeling_vit.py#L592",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/pr_30530/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/pr_30530/en/model_doc/vit#transformers.ViTConfig"
>ViTConfig</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/pr_30530/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),u=new Re({props:{$$slots:{default:[Jo]},$$scope:{ctx:V}}}),G=new Oe({props:{anchor:"transformers.ViTModel.forward.example",$$slots:{default:[No]},$$scope:{ctx:V}}}),Ce=new We({props:{title:"ViTForMaskedImageModeling",local:"transformers.ViTForMaskedImageModeling",headingTag:"h2"}}),ce=new be({props:{name:"class transformers.ViTForMaskedImageModeling",anchor:"transformers.ViTForMaskedImageModeling",parameters:[{name:"config",val:": ViTConfig"}],parametersDescription:[{anchor:"transformers.ViTForMaskedImageModeling.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_30530/en/model_doc/vit#transformers.ViTConfig">ViTConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/pr_30530/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/vr_30530/src/transformers/models/vit/modeling_vit.py#L677"}}),Z=new Re({props:{$$slots:{default:[zo]},$$scope:{ctx:V}}}),z=new be({props:{name:"forward",anchor:"transformers.ViTForMaskedImageModeling.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.ViTForMaskedImageModeling.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/pr_30530/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/pr_30530/en/model_doc/imagegpt#transformers.ImageGPTFeatureExtractor.__call__">ViTImageProcessor.<strong>call</strong>()</a>
for details.`,name:"pixel_values"},{anchor:"transformers.ViTForMaskedImageModeling.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.ViTForMaskedImageModeling.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.ViTForMaskedImageModeling.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.ViTForMaskedImageModeling.forward.interpolate_pos_encoding",description:`<strong>interpolate_pos_encoding</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to interpolate the pre-trained position encodings.`,name:"interpolate_pos_encoding"},{anchor:"transformers.ViTForMaskedImageModeling.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/pr_30530/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.ViTForMaskedImageModeling.forward.bool_masked_pos",description:`<strong>bool_masked_pos</strong> (<code>torch.BoolTensor</code> of shape <code>(batch_size, num_patches)</code>) &#x2014;
Boolean masked positions. Indicates which patches are masked (1) and which aren&#x2019;t (0).`,name:"bool_masked_pos"}],source:"https://github.com/huggingface/transformers/blob/vr_30530/src/transformers/models/vit/modeling_vit.py#L707",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <code>transformers.modeling_outputs.MaskedImageModelingOutput</code> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/pr_30530/en/model_doc/vit#transformers.ViTConfig"
>ViTConfig</a>) and inputs.</p>
<ul>
<li><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>bool_masked_pos</code> is provided) — Reconstruction loss.</li>
<li><strong>reconstruction</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) — Reconstructed / completed images.</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</li>
<li><strong>when</strong> <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.</li>
<li><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when</li>
<li><strong><code>config.output_attentions=True</code>):</strong>
Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, patch_size, sequence_length)</code>. Attentions weights after the attention softmax, used to compute the weighted average in
the self-attention heads.</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>transformers.modeling_outputs.MaskedImageModelingOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),oe=new Re({props:{$$slots:{default:[Wo]},$$scope:{ctx:V}}}),ne=new Oe({props:{anchor:"transformers.ViTForMaskedImageModeling.forward.example",$$slots:{default:[Zo]},$$scope:{ctx:V}}}),se=new We({props:{title:"ViTForImageClassification",local:"transformers.ViTForImageClassification",headingTag:"h2"}}),R=new be({props:{name:"class transformers.ViTForImageClassification",anchor:"transformers.ViTForImageClassification",parameters:[{name:"config",val:": ViTConfig"}],parametersDescription:[{anchor:"transformers.ViTForImageClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_30530/en/model_doc/vit#transformers.ViTConfig">ViTConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/pr_30530/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/vr_30530/src/transformers/models/vit/modeling_vit.py#L803"}}),ge=new Re({props:{$$slots:{default:[Po]},$$scope:{ctx:V}}}),C=new be({props:{name:"forward",anchor:"transformers.ViTForImageClassification.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.ViTForImageClassification.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/pr_30530/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/pr_30530/en/model_doc/imagegpt#transformers.ImageGPTFeatureExtractor.__call__">ViTImageProcessor.<strong>call</strong>()</a>
for details.`,name:"pixel_values"},{anchor:"transformers.ViTForImageClassification.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.ViTForImageClassification.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.ViTForImageClassification.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.ViTForImageClassification.forward.interpolate_pos_encoding",description:`<strong>interpolate_pos_encoding</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to interpolate the pre-trained position encodings.`,name:"interpolate_pos_encoding"},{anchor:"transformers.ViTForImageClassification.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/pr_30530/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.ViTForImageClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the image classification/regression loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>. If <code>config.num_labels == 1</code> a regression loss is computed (Mean-Square loss), If
<code>config.num_labels &gt; 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/vr_30530/src/transformers/models/vit/modeling_vit.py#L831",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/pr_30530/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/pr_30530/en/model_doc/vit#transformers.ViTConfig"
>ViTConfig</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/pr_30530/en/main_classes/output#transformers.modeling_outputs.ImageClassifierOutput"
>transformers.modeling_outputs.ImageClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),F=new Re({props:{$$slots:{default:[Lo]},$$scope:{ctx:V}}}),A=new Oe({props:{anchor:"transformers.ViTForImageClassification.forward.example",$$slots:{default:[Ro]},$$scope:{ctx:V}}}),{c(){b(t.$$.fragment),p=r(),o=c("div"),b(a.$$.fragment),_=r(),s=c("p"),s.innerHTML=x,ie=r(),j=c("div"),b(L.$$.fragment),le=r(),N=c("p"),N.innerHTML=S,de=r(),b(u.$$.fragment),W=r(),b(G.$$.fragment),E=r(),b(Ce.$$.fragment),ye=r(),J=c("div"),b(ce.$$.fragment),pe=r(),O=c("p"),O.innerHTML=Ie,je=r(),b(Z.$$.fragment),Ze=r(),U=c("p"),U.innerHTML=te,xe=r(),q=c("div"),b(z.$$.fragment),Fe=r(),K=c("p"),K.innerHTML=fe,Ve=r(),b(oe.$$.fragment),ke=r(),b(ne.$$.fragment),Me=r(),b(se.$$.fragment),ee=r(),D=c("div"),b(R.$$.fragment),me=r(),Ue=c("p"),Ue.textContent=he,Je=r(),b(ge.$$.fragment),P=r(),ue=c("p"),ue.innerHTML=ve,ae=r(),T=c("div"),b(C.$$.fragment),H=r(),B=c("p"),B.innerHTML=X,$e=r(),b(F.$$.fragment),I=r(),b(A.$$.fragment),this.h()},l(h){y(t.$$.fragment,h),p=i(h),o=m(h,"DIV",{class:!0});var k=re(o);y(a.$$.fragment,k),_=i(k),s=m(k,"P",{"data-svelte-h":!0}),g(s)!=="svelte-ulamh0"&&(s.innerHTML=x),ie=i(k),j=m(k,"DIV",{class:!0});var Ne=re(j);y(L.$$.fragment,Ne),le=i(Ne),N=m(Ne,"P",{"data-svelte-h":!0}),g(N)!=="svelte-16ecffn"&&(N.innerHTML=S),de=i(Ne),y(u.$$.fragment,Ne),W=i(Ne),y(G.$$.fragment,Ne),Ne.forEach(n),k.forEach(n),E=i(h),y(Ce.$$.fragment,h),ye=i(h),J=m(h,"DIV",{class:!0});var _e=re(J);y(ce.$$.fragment,_e),pe=i(_e),O=m(_e,"P",{"data-svelte-h":!0}),g(O)!=="svelte-hwvz1m"&&(O.innerHTML=Ie),je=i(_e),y(Z.$$.fragment,_e),Ze=i(_e),U=m(_e,"P",{"data-svelte-h":!0}),g(U)!=="svelte-1gjh92c"&&(U.innerHTML=te),xe=i(_e),q=m(_e,"DIV",{class:!0});var ze=re(q);y(z.$$.fragment,ze),Fe=i(ze),K=m(ze,"P",{"data-svelte-h":!0}),g(K)!=="svelte-1py4jjb"&&(K.innerHTML=fe),Ve=i(ze),y(oe.$$.fragment,ze),ke=i(ze),y(ne.$$.fragment,ze),ze.forEach(n),_e.forEach(n),Me=i(h),y(se.$$.fragment,h),ee=i(h),D=m(h,"DIV",{class:!0});var Te=re(D);y(R.$$.fragment,Te),me=i(Te),Ue=m(Te,"P",{"data-svelte-h":!0}),g(Ue)!=="svelte-ju5wm2"&&(Ue.textContent=he),Je=i(Te),y(ge.$$.fragment,Te),P=i(Te),ue=m(Te,"P",{"data-svelte-h":!0}),g(ue)!=="svelte-1gjh92c"&&(ue.innerHTML=ve),ae=i(Te),T=m(Te,"DIV",{class:!0});var Pe=re(T);y(C.$$.fragment,Pe),H=i(Pe),B=m(Pe,"P",{"data-svelte-h":!0}),g(B)!=="svelte-k0jap7"&&(B.innerHTML=X),$e=i(Pe),y(F.$$.fragment,Pe),I=i(Pe),y(A.$$.fragment,Pe),Pe.forEach(n),Te.forEach(n),this.h()},h(){Q(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Q(o,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Q(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Q(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Q(T,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Q(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(h,k){v(t,h,k),l(h,p,k),l(h,o,k),v(a,o,null),d(o,_),d(o,s),d(o,ie),d(o,j),v(L,j,null),d(j,le),d(j,N),d(j,de),v(u,j,null),d(j,W),v(G,j,null),l(h,E,k),v(Ce,h,k),l(h,ye,k),l(h,J,k),v(ce,J,null),d(J,pe),d(J,O),d(J,je),v(Z,J,null),d(J,Ze),d(J,U),d(J,xe),d(J,q),v(z,q,null),d(q,Fe),d(q,K),d(q,Ve),v(oe,q,null),d(q,ke),v(ne,q,null),l(h,Me,k),v(se,h,k),l(h,ee,k),l(h,D,k),v(R,D,null),d(D,me),d(D,Ue),d(D,Je),v(ge,D,null),d(D,P),d(D,ue),d(D,ae),d(D,T),v(C,T,null),d(T,H),d(T,B),d(T,$e),v(F,T,null),d(T,I),v(A,T,null),Y=!0},p(h,k){const Ne={};k&2&&(Ne.$$scope={dirty:k,ctx:h}),u.$set(Ne);const _e={};k&2&&(_e.$$scope={dirty:k,ctx:h}),G.$set(_e);const ze={};k&2&&(ze.$$scope={dirty:k,ctx:h}),Z.$set(ze);const Te={};k&2&&(Te.$$scope={dirty:k,ctx:h}),oe.$set(Te);const Pe={};k&2&&(Pe.$$scope={dirty:k,ctx:h}),ne.$set(Pe);const Ke={};k&2&&(Ke.$$scope={dirty:k,ctx:h}),ge.$set(Ke);const qe={};k&2&&(qe.$$scope={dirty:k,ctx:h}),F.$set(qe);const It={};k&2&&(It.$$scope={dirty:k,ctx:h}),A.$set(It)},i(h){Y||(w(t.$$.fragment,h),w(a.$$.fragment,h),w(L.$$.fragment,h),w(u.$$.fragment,h),w(G.$$.fragment,h),w(Ce.$$.fragment,h),w(ce.$$.fragment,h),w(Z.$$.fragment,h),w(z.$$.fragment,h),w(oe.$$.fragment,h),w(ne.$$.fragment,h),w(se.$$.fragment,h),w(R.$$.fragment,h),w(ge.$$.fragment,h),w(C.$$.fragment,h),w(F.$$.fragment,h),w(A.$$.fragment,h),Y=!0)},o(h){M(t.$$.fragment,h),M(a.$$.fragment,h),M(L.$$.fragment,h),M(u.$$.fragment,h),M(G.$$.fragment,h),M(Ce.$$.fragment,h),M(ce.$$.fragment,h),M(Z.$$.fragment,h),M(z.$$.fragment,h),M(oe.$$.fragment,h),M(ne.$$.fragment,h),M(se.$$.fragment,h),M(R.$$.fragment,h),M(ge.$$.fragment,h),M(C.$$.fragment,h),M(F.$$.fragment,h),M(A.$$.fragment,h),Y=!1},d(h){h&&(n(p),n(o),n(E),n(ye),n(J),n(Me),n(ee),n(D)),$(t,h),$(a),$(L),$(u),$(G),$(Ce,h),$(ce),$(Z),$(z),$(oe),$(ne),$(se,h),$(R),$(ge),$(C),$(F),$(A)}}}function Bo(V){let t,p;return t=new lo({props:{$$slots:{default:[Ho]},$$scope:{ctx:V}}}),{c(){b(t.$$.fragment)},l(o){y(t.$$.fragment,o)},m(o,a){v(t,o,a),p=!0},p(o,a){const _={};a&2&&(_.$$scope={dirty:a,ctx:o}),t.$set(_)},i(o){p||(w(t.$$.fragment,o),p=!0)},o(o){M(t.$$.fragment,o),p=!1},d(o){$(t,o)}}}function Go(V){let t,p="TensorFlow models and layers in <code>transformers</code> accept two formats as input:",o,a,_="<li>having all inputs as keyword arguments (like PyTorch models), or</li> <li>having all inputs as a list, tuple or dict in the first positional argument.</li>",s,x,ie=`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
and layers. Because of this support, when using methods like <code>model.fit()</code> things should “just work” for you - just
pass your inputs and labels in any format that <code>model.fit()</code> supports! If, however, you want to use the second
format outside of Keras methods like <code>fit()</code> and <code>predict()</code>, such as when creating your own layers or models with
the Keras <code>Functional</code> API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`,j,L,le=`<li>a single Tensor with <code>pixel_values</code> only and nothing else: <code>model(pixel_values)</code></li> <li>a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
<code>model([pixel_values, attention_mask])</code> or <code>model([pixel_values, attention_mask, token_type_ids])</code></li> <li>a dictionary with one or several input Tensors associated to the input names given in the docstring:
<code>model({&quot;pixel_values&quot;: pixel_values, &quot;token_type_ids&quot;: token_type_ids})</code></li>`,N,S,de=`Note that when creating models and layers with
<a href="https://keras.io/guides/making_new_layers_and_models_via_subclassing/" rel="nofollow">subclassing</a> then you don’t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`;return{c(){t=c("p"),t.innerHTML=p,o=r(),a=c("ul"),a.innerHTML=_,s=r(),x=c("p"),x.innerHTML=ie,j=r(),L=c("ul"),L.innerHTML=le,N=r(),S=c("p"),S.innerHTML=de},l(u){t=m(u,"P",{"data-svelte-h":!0}),g(t)!=="svelte-1ajbfxg"&&(t.innerHTML=p),o=i(u),a=m(u,"UL",{"data-svelte-h":!0}),g(a)!=="svelte-qm1t26"&&(a.innerHTML=_),s=i(u),x=m(u,"P",{"data-svelte-h":!0}),g(x)!=="svelte-1v9qsc5"&&(x.innerHTML=ie),j=i(u),L=m(u,"UL",{"data-svelte-h":!0}),g(L)!=="svelte-99h8aq"&&(L.innerHTML=le),N=i(u),S=m(u,"P",{"data-svelte-h":!0}),g(S)!=="svelte-1an3odd"&&(S.innerHTML=de)},m(u,W){l(u,t,W),l(u,o,W),l(u,a,W),l(u,s,W),l(u,x,W),l(u,j,W),l(u,L,W),l(u,N,W),l(u,S,W)},p:we,d(u){u&&(n(t),n(o),n(a),n(s),n(x),n(j),n(L),n(N),n(S))}}}function qo(V){let t,p=`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(){t=c("p"),t.innerHTML=p},l(o){t=m(o,"P",{"data-svelte-h":!0}),g(t)!=="svelte-fincs2"&&(t.innerHTML=p)},m(o,a){l(o,t,a)},p:we,d(o){o&&n(t)}}}function Eo(V){let t,p="Example:",o,a,_;return a=new Se({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyMFRGVmlUTW9kZWwlMEFmcm9tJTIwZGF0YXNldHMlMjBpbXBvcnQlMjBsb2FkX2RhdGFzZXQlMEElMEFkYXRhc2V0JTIwJTNEJTIwbG9hZF9kYXRhc2V0KCUyMmh1Z2dpbmdmYWNlJTJGY2F0cy1pbWFnZSUyMiUyQyUyMHRydXN0X3JlbW90ZV9jb2RlJTNEVHJ1ZSklMEFpbWFnZSUyMCUzRCUyMGRhdGFzZXQlNUIlMjJ0ZXN0JTIyJTVEJTVCJTIyaW1hZ2UlMjIlNUQlNUIwJTVEJTBBJTBBaW1hZ2VfcHJvY2Vzc29yJTIwJTNEJTIwQXV0b0ltYWdlUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZ2aXQtYmFzZS1wYXRjaDE2LTIyNC1pbjIxayUyMiklMEFtb2RlbCUyMCUzRCUyMFRGVmlUTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMmdvb2dsZSUyRnZpdC1iYXNlLXBhdGNoMTYtMjI0LWluMjFrJTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMGltYWdlX3Byb2Nlc3NvcihpbWFnZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIydGYlMjIpJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKSUwQSUwQWxhc3RfaGlkZGVuX3N0YXRlcyUyMCUzRCUyMG91dHB1dHMubGFzdF9oaWRkZW5fc3RhdGUlMEFsaXN0KGxhc3RfaGlkZGVuX3N0YXRlcy5zaGFwZSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, TFViTModel
<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>, trust_remote_code=<span class="hljs-literal">True</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-base-patch16-224-in21k&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFViTModel.from_pretrained(<span class="hljs-string">&quot;google/vit-base-patch16-224-in21k&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = image_processor(image, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </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(){t=c("p"),t.textContent=p,o=r(),b(a.$$.fragment)},l(s){t=m(s,"P",{"data-svelte-h":!0}),g(t)!=="svelte-11lpom8"&&(t.textContent=p),o=i(s),y(a.$$.fragment,s)},m(s,x){l(s,t,x),l(s,o,x),v(a,s,x),_=!0},p:we,i(s){_||(w(a.$$.fragment,s),_=!0)},o(s){M(a.$$.fragment,s),_=!1},d(s){s&&(n(t),n(o)),$(a,s)}}}function Xo(V){let t,p=`Note that it’s possible to fine-tune ViT on higher resolution images than the ones it has been trained on, by
setting <code>interpolate_pos_encoding</code> to <code>True</code> in the forward of the model. This will interpolate the pre-trained
position embeddings to the higher resolution.`;return{c(){t=c("p"),t.innerHTML=p},l(o){t=m(o,"P",{"data-svelte-h":!0}),g(t)!=="svelte-111lhr1"&&(t.innerHTML=p)},m(o,a){l(o,t,a)},p:we,d(o){o&&n(t)}}}function So(V){let t,p="TensorFlow models and layers in <code>transformers</code> accept two formats as input:",o,a,_="<li>having all inputs as keyword arguments (like PyTorch models), or</li> <li>having all inputs as a list, tuple or dict in the first positional argument.</li>",s,x,ie=`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
and layers. Because of this support, when using methods like <code>model.fit()</code> things should “just work” for you - just
pass your inputs and labels in any format that <code>model.fit()</code> supports! If, however, you want to use the second
format outside of Keras methods like <code>fit()</code> and <code>predict()</code>, such as when creating your own layers or models with
the Keras <code>Functional</code> API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`,j,L,le=`<li>a single Tensor with <code>pixel_values</code> only and nothing else: <code>model(pixel_values)</code></li> <li>a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
<code>model([pixel_values, attention_mask])</code> or <code>model([pixel_values, attention_mask, token_type_ids])</code></li> <li>a dictionary with one or several input Tensors associated to the input names given in the docstring:
<code>model({&quot;pixel_values&quot;: pixel_values, &quot;token_type_ids&quot;: token_type_ids})</code></li>`,N,S,de=`Note that when creating models and layers with
<a href="https://keras.io/guides/making_new_layers_and_models_via_subclassing/" rel="nofollow">subclassing</a> then you don’t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`;return{c(){t=c("p"),t.innerHTML=p,o=r(),a=c("ul"),a.innerHTML=_,s=r(),x=c("p"),x.innerHTML=ie,j=r(),L=c("ul"),L.innerHTML=le,N=r(),S=c("p"),S.innerHTML=de},l(u){t=m(u,"P",{"data-svelte-h":!0}),g(t)!=="svelte-1ajbfxg"&&(t.innerHTML=p),o=i(u),a=m(u,"UL",{"data-svelte-h":!0}),g(a)!=="svelte-qm1t26"&&(a.innerHTML=_),s=i(u),x=m(u,"P",{"data-svelte-h":!0}),g(x)!=="svelte-1v9qsc5"&&(x.innerHTML=ie),j=i(u),L=m(u,"UL",{"data-svelte-h":!0}),g(L)!=="svelte-99h8aq"&&(L.innerHTML=le),N=i(u),S=m(u,"P",{"data-svelte-h":!0}),g(S)!=="svelte-1an3odd"&&(S.innerHTML=de)},m(u,W){l(u,t,W),l(u,o,W),l(u,a,W),l(u,s,W),l(u,x,W),l(u,j,W),l(u,L,W),l(u,N,W),l(u,S,W)},p:we,d(u){u&&(n(t),n(o),n(a),n(s),n(x),n(j),n(L),n(N),n(S))}}}function Yo(V){let t,p=`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(){t=c("p"),t.innerHTML=p},l(o){t=m(o,"P",{"data-svelte-h":!0}),g(t)!=="svelte-fincs2"&&(t.innerHTML=p)},m(o,a){l(o,t,a)},p:we,d(o){o&&n(t)}}}function Do(V){let t,p="Example:",o,a,_;return a=new Se({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyMFRGVmlURm9ySW1hZ2VDbGFzc2lmaWNhdGlvbiUwQWltcG9ydCUyMHRlbnNvcmZsb3clMjBhcyUyMHRmJTBBZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBJTBBZGF0YXNldCUyMCUzRCUyMGxvYWRfZGF0YXNldCglMjJodWdnaW5nZmFjZSUyRmNhdHMtaW1hZ2UlMjIlMkMlMjB0cnVzdF9yZW1vdGVfY29kZSUzRFRydWUpJTBBaW1hZ2UlMjAlM0QlMjBkYXRhc2V0JTVCJTIydGVzdCUyMiU1RCU1QiUyMmltYWdlJTIyJTVEJTVCMCU1RCUwQSUwQWltYWdlX3Byb2Nlc3NvciUyMCUzRCUyMEF1dG9JbWFnZVByb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGdml0LWJhc2UtcGF0Y2gxNi0yMjQlMjIpJTBBbW9kZWwlMjAlM0QlMjBURlZpVEZvckltYWdlQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMmdvb2dsZSUyRnZpdC1iYXNlLXBhdGNoMTYtMjI0JTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMGltYWdlX3Byb2Nlc3NvcihpbWFnZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIydGYlMjIpJTBBbG9naXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpLmxvZ2l0cyUwQSUwQSUyMyUyMG1vZGVsJTIwcHJlZGljdHMlMjBvbmUlMjBvZiUyMHRoZSUyMDEwMDAlMjBJbWFnZU5ldCUyMGNsYXNzZXMlMEFwcmVkaWN0ZWRfbGFiZWwlMjAlM0QlMjBpbnQodGYubWF0aC5hcmdtYXgobG9naXRzJTJDJTIwYXhpcyUzRC0xKSklMEFwcmludChtb2RlbC5jb25maWcuaWQybGFiZWwlNUJwcmVkaWN0ZWRfbGFiZWwlNUQp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, TFViTForImageClassification
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf
<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>, trust_remote_code=<span class="hljs-literal">True</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-base-patch16-224&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFViTForImageClassification.from_pretrained(<span class="hljs-string">&quot;google/vit-base-patch16-224&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = image_processor(image, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </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 = <span class="hljs-built_in">int</span>(tf.math.argmax(logits, axis=-<span class="hljs-number">1</span>))
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(model.config.id2label[predicted_label])
Egyptian cat`,wrap:!1}}),{c(){t=c("p"),t.textContent=p,o=r(),b(a.$$.fragment)},l(s){t=m(s,"P",{"data-svelte-h":!0}),g(t)!=="svelte-11lpom8"&&(t.textContent=p),o=i(s),y(a.$$.fragment,s)},m(s,x){l(s,t,x),l(s,o,x),v(a,s,x),_=!0},p:we,i(s){_||(w(a.$$.fragment,s),_=!0)},o(s){M(a.$$.fragment,s),_=!1},d(s){s&&(n(t),n(o)),$(a,s)}}}function Ao(V){let t,p,o,a,_,s,x="The bare ViT Model transformer outputting raw hidden-states without any specific head on top.",ie,j,L=`This model inherits from <a href="/docs/transformers/pr_30530/en/main_classes/model#transformers.TFPreTrainedModel">TFPreTrainedModel</a>. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`,le,N,S=`This model is also a <a href="https://www.tensorflow.org/api_docs/python/tf/keras/Model" rel="nofollow">keras.Model</a> subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`,de,u,W,G,E,Ce,ye,J='The <a href="/docs/transformers/pr_30530/en/model_doc/vit#transformers.TFViTModel">TFViTModel</a> forward method, overrides the <code>__call__</code> special method.',ce,pe,O,Ie,je,Z,Ze,U,te,xe,q,z=`ViT 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.`,Fe,K,fe,Ve,oe=`This model inherits from <a href="/docs/transformers/pr_30530/en/main_classes/model#transformers.TFPreTrainedModel">TFPreTrainedModel</a>. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`,ke,ne,Me=`This model is also a <a href="https://www.tensorflow.org/api_docs/python/tf/keras/Model" rel="nofollow">keras.Model</a> subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`,se,ee,D,R,me,Ue,he,Je='The <a href="/docs/transformers/pr_30530/en/model_doc/vit#transformers.TFViTForImageClassification">TFViTForImageClassification</a> forward method, overrides the <code>__call__</code> special method.',ge,P,ue,ve,ae;return t=new We({props:{title:"TFViTModel",local:"transformers.TFViTModel",headingTag:"h2"}}),a=new be({props:{name:"class transformers.TFViTModel",anchor:"transformers.TFViTModel",parameters:[{name:"config",val:": ViTConfig"},{name:"*inputs",val:""},{name:"add_pooling_layer",val:" = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFViTModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_30530/en/model_doc/vit#transformers.ViTConfig">ViTConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/pr_30530/en/main_classes/model#transformers.TFPreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/vr_30530/src/transformers/models/vit/modeling_tf_vit.py#L736"}}),u=new Re({props:{$$slots:{default:[Go]},$$scope:{ctx:V}}}),E=new be({props:{name:"call",anchor:"transformers.TFViTModel.call",parameters:[{name:"pixel_values",val:": TFModelInputType | None = None"},{name:"head_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"output_attentions",val:": Optional[bool] = None"},{name:"output_hidden_states",val:": Optional[bool] = None"},{name:"interpolate_pos_encoding",val:": Optional[bool] = None"},{name:"return_dict",val:": Optional[bool] = None"},{name:"training",val:": bool = False"}],parametersDescription:[{anchor:"transformers.TFViTModel.call.pixel_values",description:`<strong>pixel_values</strong> (<code>np.ndarray</code>, <code>tf.Tensor</code>, <code>List[tf.Tensor]</code> \`<code>Dict[str, tf.Tensor]</code> or <code>Dict[str, np.ndarray]</code> and each example must have the shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/pr_30530/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/pr_30530/en/model_doc/imagegpt#transformers.ImageGPTFeatureExtractor.__call__">ViTImageProcessor.<strong>call</strong>()</a>
for details.`,name:"pixel_values"},{anchor:"transformers.TFViTModel.call.head_mask",description:`<strong>head_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</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.TFViTModel.call.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. This argument can be used only in eager mode, in graph mode the value in the
config will be used instead.`,name:"output_attentions"},{anchor:"transformers.TFViTModel.call.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. This argument can be used only in eager mode, in graph mode the value in the config will be
used instead.`,name:"output_hidden_states"},{anchor:"transformers.TFViTModel.call.interpolate_pos_encoding",description:`<strong>interpolate_pos_encoding</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to interpolate the pre-trained position encodings.`,name:"interpolate_pos_encoding"},{anchor:"transformers.TFViTModel.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/pr_30530/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple. This argument can be used in
eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFViTModel.call.training",description:`<strong>training</strong> (<code>bool</code>, <em>optional</em>, defaults to \`False&#x201C;) &#x2014;
Whether or not to use the model in training mode (some modules like dropout modules have different
behaviors between training and evaluation).`,name:"training"}],source:"https://github.com/huggingface/transformers/blob/vr_30530/src/transformers/models/vit/modeling_tf_vit.py#L746",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/pr_30530/en/main_classes/output#transformers.modeling_tf_outputs.TFBaseModelOutputWithPooling"
>transformers.modeling_tf_outputs.TFBaseModelOutputWithPooling</a> or a tuple of <code>tf.Tensor</code> (if
<code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various elements depending on the
configuration (<a
  href="/docs/transformers/pr_30530/en/model_doc/vit#transformers.ViTConfig"
>ViTConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>tf.Tensor</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>tf.Tensor</code> of shape <code>(batch_size, hidden_size)</code>) — Last layer hidden-state of the first token of the sequence (classification token) further processed by a
Linear layer and a Tanh activation function. The Linear layer weights are trained from the next sentence
prediction (classification) objective during pretraining.</p>
<p>This output is usually <em>not</em> a good summary of the semantic content of the input, you’re often better with
averaging or pooling the sequence of hidden-states for the whole input sequence.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(tf.Tensor)</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>tf.Tensor</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>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>tf.Tensor</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/pr_30530/en/main_classes/output#transformers.modeling_tf_outputs.TFBaseModelOutputWithPooling"
>transformers.modeling_tf_outputs.TFBaseModelOutputWithPooling</a> or <code>tuple(tf.Tensor)</code></p>
`}}),pe=new Re({props:{$$slots:{default:[qo]},$$scope:{ctx:V}}}),Ie=new Oe({props:{anchor:"transformers.TFViTModel.call.example",$$slots:{default:[Eo]},$$scope:{ctx:V}}}),Z=new We({props:{title:"TFViTForImageClassification",local:"transformers.TFViTForImageClassification",headingTag:"h2"}}),te=new be({props:{name:"class transformers.TFViTForImageClassification",anchor:"transformers.TFViTForImageClassification",parameters:[{name:"config",val:": ViTConfig"},{name:"*inputs",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFViTForImageClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_30530/en/model_doc/vit#transformers.ViTConfig">ViTConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/pr_30530/en/main_classes/model#transformers.TFPreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/vr_30530/src/transformers/models/vit/modeling_tf_vit.py#L815"}}),K=new Re({props:{$$slots:{default:[Xo]},$$scope:{ctx:V}}}),ee=new Re({props:{$$slots:{default:[So]},$$scope:{ctx:V}}}),me=new be({props:{name:"call",anchor:"transformers.TFViTForImageClassification.call",parameters:[{name:"pixel_values",val:": TFModelInputType | None = None"},{name:"head_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"output_attentions",val:": Optional[bool] = None"},{name:"output_hidden_states",val:": Optional[bool] = None"},{name:"interpolate_pos_encoding",val:": Optional[bool] = None"},{name:"return_dict",val:": Optional[bool] = None"},{name:"labels",val:": np.ndarray | tf.Tensor | None = None"},{name:"training",val:": Optional[bool] = False"}],parametersDescription:[{anchor:"transformers.TFViTForImageClassification.call.pixel_values",description:`<strong>pixel_values</strong> (<code>np.ndarray</code>, <code>tf.Tensor</code>, <code>List[tf.Tensor]</code> \`<code>Dict[str, tf.Tensor]</code> or <code>Dict[str, np.ndarray]</code> and each example must have the shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/pr_30530/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/pr_30530/en/model_doc/imagegpt#transformers.ImageGPTFeatureExtractor.__call__">ViTImageProcessor.<strong>call</strong>()</a>
for details.`,name:"pixel_values"},{anchor:"transformers.TFViTForImageClassification.call.head_mask",description:`<strong>head_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</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.TFViTForImageClassification.call.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. This argument can be used only in eager mode, in graph mode the value in the
config will be used instead.`,name:"output_attentions"},{anchor:"transformers.TFViTForImageClassification.call.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. This argument can be used only in eager mode, in graph mode the value in the config will be
used instead.`,name:"output_hidden_states"},{anchor:"transformers.TFViTForImageClassification.call.interpolate_pos_encoding",description:`<strong>interpolate_pos_encoding</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to interpolate the pre-trained position encodings.`,name:"interpolate_pos_encoding"},{anchor:"transformers.TFViTForImageClassification.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/pr_30530/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple. This argument can be used in
eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFViTForImageClassification.call.training",description:`<strong>training</strong> (<code>bool</code>, <em>optional</em>, defaults to \`False&#x201C;) &#x2014;
Whether or not to use the model in training mode (some modules like dropout modules have different
behaviors between training and evaluation).`,name:"training"},{anchor:"transformers.TFViTForImageClassification.call.labels",description:`<strong>labels</strong> (<code>tf.Tensor</code> or <code>np.ndarray</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the image classification/regression loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>. If <code>config.num_labels == 1</code> a regression loss is computed (Mean-Square loss), If
<code>config.num_labels &gt; 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/vr_30530/src/transformers/models/vit/modeling_tf_vit.py#L845",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/pr_30530/en/main_classes/output#transformers.modeling_tf_outputs.TFSequenceClassifierOutput"
>transformers.modeling_tf_outputs.TFSequenceClassifierOutput</a> or a tuple of <code>tf.Tensor</code> (if
<code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various elements depending on the
configuration (<a
  href="/docs/transformers/pr_30530/en/model_doc/vit#transformers.ViTConfig"
>ViTConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, )</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>tf.Tensor</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(tf.Tensor)</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>tf.Tensor</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>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>tf.Tensor</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/pr_30530/en/main_classes/output#transformers.modeling_tf_outputs.TFSequenceClassifierOutput"
>transformers.modeling_tf_outputs.TFSequenceClassifierOutput</a> or <code>tuple(tf.Tensor)</code></p>
`}}),P=new Re({props:{$$slots:{default:[Yo]},$$scope:{ctx:V}}}),ve=new Oe({props:{anchor:"transformers.TFViTForImageClassification.call.example",$$slots:{default:[Do]},$$scope:{ctx:V}}}),{c(){b(t.$$.fragment),p=r(),o=c("div"),b(a.$$.fragment),_=r(),s=c("p"),s.textContent=x,ie=r(),j=c("p"),j.innerHTML=L,le=r(),N=c("p"),N.innerHTML=S,de=r(),b(u.$$.fragment),W=r(),G=c("div"),b(E.$$.fragment),Ce=r(),ye=c("p"),ye.innerHTML=J,ce=r(),b(pe.$$.fragment),O=r(),b(Ie.$$.fragment),je=r(),b(Z.$$.fragment),Ze=r(),U=c("div"),b(te.$$.fragment),xe=r(),q=c("p"),q.textContent=z,Fe=r(),b(K.$$.fragment),fe=r(),Ve=c("p"),Ve.innerHTML=oe,ke=r(),ne=c("p"),ne.innerHTML=Me,se=r(),b(ee.$$.fragment),D=r(),R=c("div"),b(me.$$.fragment),Ue=r(),he=c("p"),he.innerHTML=Je,ge=r(),b(P.$$.fragment),ue=r(),b(ve.$$.fragment),this.h()},l(T){y(t.$$.fragment,T),p=i(T),o=m(T,"DIV",{class:!0});var C=re(o);y(a.$$.fragment,C),_=i(C),s=m(C,"P",{"data-svelte-h":!0}),g(s)!=="svelte-1vbye9a"&&(s.textContent=x),ie=i(C),j=m(C,"P",{"data-svelte-h":!0}),g(j)!=="svelte-13lt385"&&(j.innerHTML=L),le=i(C),N=m(C,"P",{"data-svelte-h":!0}),g(N)!=="svelte-1be7e3c"&&(N.innerHTML=S),de=i(C),y(u.$$.fragment,C),W=i(C),G=m(C,"DIV",{class:!0});var H=re(G);y(E.$$.fragment,H),Ce=i(H),ye=m(H,"P",{"data-svelte-h":!0}),g(ye)!=="svelte-11x35yb"&&(ye.innerHTML=J),ce=i(H),y(pe.$$.fragment,H),O=i(H),y(Ie.$$.fragment,H),H.forEach(n),C.forEach(n),je=i(T),y(Z.$$.fragment,T),Ze=i(T),U=m(T,"DIV",{class:!0});var B=re(U);y(te.$$.fragment,B),xe=i(B),q=m(B,"P",{"data-svelte-h":!0}),g(q)!=="svelte-ju5wm2"&&(q.textContent=z),Fe=i(B),y(K.$$.fragment,B),fe=i(B),Ve=m(B,"P",{"data-svelte-h":!0}),g(Ve)!=="svelte-13lt385"&&(Ve.innerHTML=oe),ke=i(B),ne=m(B,"P",{"data-svelte-h":!0}),g(ne)!=="svelte-1be7e3c"&&(ne.innerHTML=Me),se=i(B),y(ee.$$.fragment,B),D=i(B),R=m(B,"DIV",{class:!0});var X=re(R);y(me.$$.fragment,X),Ue=i(X),he=m(X,"P",{"data-svelte-h":!0}),g(he)!=="svelte-wn78pb"&&(he.innerHTML=Je),ge=i(X),y(P.$$.fragment,X),ue=i(X),y(ve.$$.fragment,X),X.forEach(n),B.forEach(n),this.h()},h(){Q(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Q(o,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Q(R,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Q(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(T,C){v(t,T,C),l(T,p,C),l(T,o,C),v(a,o,null),d(o,_),d(o,s),d(o,ie),d(o,j),d(o,le),d(o,N),d(o,de),v(u,o,null),d(o,W),d(o,G),v(E,G,null),d(G,Ce),d(G,ye),d(G,ce),v(pe,G,null),d(G,O),v(Ie,G,null),l(T,je,C),v(Z,T,C),l(T,Ze,C),l(T,U,C),v(te,U,null),d(U,xe),d(U,q),d(U,Fe),v(K,U,null),d(U,fe),d(U,Ve),d(U,ke),d(U,ne),d(U,se),v(ee,U,null),d(U,D),d(U,R),v(me,R,null),d(R,Ue),d(R,he),d(R,ge),v(P,R,null),d(R,ue),v(ve,R,null),ae=!0},p(T,C){const H={};C&2&&(H.$$scope={dirty:C,ctx:T}),u.$set(H);const B={};C&2&&(B.$$scope={dirty:C,ctx:T}),pe.$set(B);const X={};C&2&&(X.$$scope={dirty:C,ctx:T}),Ie.$set(X);const $e={};C&2&&($e.$$scope={dirty:C,ctx:T}),K.$set($e);const F={};C&2&&(F.$$scope={dirty:C,ctx:T}),ee.$set(F);const I={};C&2&&(I.$$scope={dirty:C,ctx:T}),P.$set(I);const A={};C&2&&(A.$$scope={dirty:C,ctx:T}),ve.$set(A)},i(T){ae||(w(t.$$.fragment,T),w(a.$$.fragment,T),w(u.$$.fragment,T),w(E.$$.fragment,T),w(pe.$$.fragment,T),w(Ie.$$.fragment,T),w(Z.$$.fragment,T),w(te.$$.fragment,T),w(K.$$.fragment,T),w(ee.$$.fragment,T),w(me.$$.fragment,T),w(P.$$.fragment,T),w(ve.$$.fragment,T),ae=!0)},o(T){M(t.$$.fragment,T),M(a.$$.fragment,T),M(u.$$.fragment,T),M(E.$$.fragment,T),M(pe.$$.fragment,T),M(Ie.$$.fragment,T),M(Z.$$.fragment,T),M(te.$$.fragment,T),M(K.$$.fragment,T),M(ee.$$.fragment,T),M(me.$$.fragment,T),M(P.$$.fragment,T),M(ve.$$.fragment,T),ae=!1},d(T){T&&(n(p),n(o),n(je),n(Ze),n(U)),$(t,T),$(a),$(u),$(E),$(pe),$(Ie),$(Z,T),$(te),$(K),$(ee),$(me),$(P),$(ve)}}}function Qo(V){let t,p;return t=new lo({props:{$$slots:{default:[Ao]},$$scope:{ctx:V}}}),{c(){b(t.$$.fragment)},l(o){y(t.$$.fragment,o)},m(o,a){v(t,o,a),p=!0},p(o,a){const _={};a&2&&(_.$$scope={dirty:a,ctx:o}),t.$set(_)},i(o){p||(w(t.$$.fragment,o),p=!0)},o(o){M(t.$$.fragment,o),p=!1},d(o){$(t,o)}}}function Oo(V){let t,p=`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(){t=c("p"),t.innerHTML=p},l(o){t=m(o,"P",{"data-svelte-h":!0}),g(t)!=="svelte-fincs2"&&(t.innerHTML=p)},m(o,a){l(o,t,a)},p:we,d(o){o&&n(t)}}}function Ko(V){let t,p="Examples:",o,a,_;return a=new Se({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyMEZsYXhWaVRNb2RlbCUwQWZyb20lMjBQSUwlMjBpbXBvcnQlMjBJbWFnZSUwQWltcG9ydCUyMHJlcXVlc3RzJTBBJTBBdXJsJTIwJTNEJTIwJTIyaHR0cCUzQSUyRiUyRmltYWdlcy5jb2NvZGF0YXNldC5vcmclMkZ2YWwyMDE3JTJGMDAwMDAwMDM5NzY5LmpwZyUyMiUwQWltYWdlJTIwJTNEJTIwSW1hZ2Uub3BlbihyZXF1ZXN0cy5nZXQodXJsJTJDJTIwc3RyZWFtJTNEVHJ1ZSkucmF3KSUwQSUwQWltYWdlX3Byb2Nlc3NvciUyMCUzRCUyMEF1dG9JbWFnZVByb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGdml0LWJhc2UtcGF0Y2gxNi0yMjQtaW4yMWslMjIpJTBBbW9kZWwlMjAlM0QlMjBGbGF4VmlUTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMmdvb2dsZSUyRnZpdC1iYXNlLXBhdGNoMTYtMjI0LWluMjFrJTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMGltYWdlX3Byb2Nlc3NvcihpbWFnZXMlM0RpbWFnZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIybnAlMjIpJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKSUwQWxhc3RfaGlkZGVuX3N0YXRlcyUyMCUzRCUyMG91dHB1dHMubGFzdF9oaWRkZW5fc3RhdGU=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, FlaxViTModel
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000039769.jpg&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = Image.<span class="hljs-built_in">open</span>(requests.get(url, stream=<span class="hljs-literal">True</span>).raw)

<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;google/vit-base-patch16-224-in21k&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = FlaxViTModel.from_pretrained(<span class="hljs-string">&quot;google/vit-base-patch16-224-in21k&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = image_processor(images=image, return_tensors=<span class="hljs-string">&quot;np&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_states = outputs.last_hidden_state`,wrap:!1}}),{c(){t=c("p"),t.textContent=p,o=r(),b(a.$$.fragment)},l(s){t=m(s,"P",{"data-svelte-h":!0}),g(t)!=="svelte-kvfsh7"&&(t.textContent=p),o=i(s),y(a.$$.fragment,s)},m(s,x){l(s,t,x),l(s,o,x),v(a,s,x),_=!0},p:we,i(s){_||(w(a.$$.fragment,s),_=!0)},o(s){M(a.$$.fragment,s),_=!1},d(s){s&&(n(t),n(o)),$(a,s)}}}function en(V){let t,p=`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(){t=c("p"),t.innerHTML=p},l(o){t=m(o,"P",{"data-svelte-h":!0}),g(t)!=="svelte-fincs2"&&(t.innerHTML=p)},m(o,a){l(o,t,a)},p:we,d(o){o&&n(t)}}}function tn(V){let t,p="Example:",o,a,_;return a=new Se({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyMEZsYXhWaVRGb3JJbWFnZUNsYXNzaWZpY2F0aW9uJTBBZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwamF4JTBBaW1wb3J0JTIwcmVxdWVzdHMlMEElMEF1cmwlMjAlM0QlMjAlMjJodHRwJTNBJTJGJTJGaW1hZ2VzLmNvY29kYXRhc2V0Lm9yZyUyRnZhbDIwMTclMkYwMDAwMDAwMzk3NjkuanBnJTIyJTBBaW1hZ2UlMjAlM0QlMjBJbWFnZS5vcGVuKHJlcXVlc3RzLmdldCh1cmwlMkMlMjBzdHJlYW0lM0RUcnVlKS5yYXcpJTBBJTBBaW1hZ2VfcHJvY2Vzc29yJTIwJTNEJTIwQXV0b0ltYWdlUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZ2aXQtYmFzZS1wYXRjaDE2LTIyNCUyMiklMEFtb2RlbCUyMCUzRCUyMEZsYXhWaVRGb3JJbWFnZUNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZ2aXQtYmFzZS1wYXRjaDE2LTIyNCUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjBpbWFnZV9wcm9jZXNzb3IoaW1hZ2VzJTNEaW1hZ2UlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMm5wJTIyKSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyklMEFsb2dpdHMlMjAlM0QlMjBvdXRwdXRzLmxvZ2l0cyUwQSUwQSUyMyUyMG1vZGVsJTIwcHJlZGljdHMlMjBvbmUlMjBvZiUyMHRoZSUyMDEwMDAlMjBJbWFnZU5ldCUyMGNsYXNzZXMlMEFwcmVkaWN0ZWRfY2xhc3NfaWR4JTIwJTNEJTIwamF4Lm51bXB5LmFyZ21heChsb2dpdHMlMkMlMjBheGlzJTNELTEpJTBBcHJpbnQoJTIyUHJlZGljdGVkJTIwY2xhc3MlM0ElMjIlMkMlMjBtb2RlbC5jb25maWcuaWQybGFiZWwlNUJwcmVkaWN0ZWRfY2xhc3NfaWR4Lml0ZW0oKSU1RCk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, FlaxViTForImageClassification
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> jax
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000039769.jpg&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = Image.<span class="hljs-built_in">open</span>(requests.get(url, stream=<span class="hljs-literal">True</span>).raw)

<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;google/vit-base-patch16-224&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = FlaxViTForImageClassification.from_pretrained(<span class="hljs-string">&quot;google/vit-base-patch16-224&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = image_processor(images=image, return_tensors=<span class="hljs-string">&quot;np&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = outputs.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_class_idx = jax.numpy.argmax(logits, axis=-<span class="hljs-number">1</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;Predicted class:&quot;</span>, model.config.id2label[predicted_class_idx.item()])`,wrap:!1}}),{c(){t=c("p"),t.textContent=p,o=r(),b(a.$$.fragment)},l(s){t=m(s,"P",{"data-svelte-h":!0}),g(t)!=="svelte-11lpom8"&&(t.textContent=p),o=i(s),y(a.$$.fragment,s)},m(s,x){l(s,t,x),l(s,o,x),v(a,s,x),_=!0},p:we,i(s){_||(w(a.$$.fragment,s),_=!0)},o(s){M(a.$$.fragment,s),_=!1},d(s){s&&(n(t),n(o)),$(a,s)}}}function on(V){let t,p,o,a,_,s,x="The bare ViT Model transformer outputting raw hidden-states without any specific head on top.",ie,j,L=`This model inherits from <a href="/docs/transformers/pr_30530/en/main_classes/model#transformers.FlaxPreTrainedModel">FlaxPreTrainedModel</a>. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading, saving and converting weights from PyTorch models)`,le,N,S=`This model is also a
<a href="https://flax.readthedocs.io/en/latest/api_reference/flax.linen/module.html" rel="nofollow">flax.linen.Module</a> subclass. Use it as
a regular Flax linen Module and refer to the Flax documentation for all matter related to general usage and
behavior.`,de,u,W="Finally, this model supports inherent JAX features such as:",G,E,Ce='<li><a href="https://jax.readthedocs.io/en/latest/jax.html#just-in-time-compilation-jit" rel="nofollow">Just-In-Time (JIT) compilation</a></li> <li><a href="https://jax.readthedocs.io/en/latest/jax.html#automatic-differentiation" rel="nofollow">Automatic Differentiation</a></li> <li><a href="https://jax.readthedocs.io/en/latest/jax.html#vectorization-vmap" rel="nofollow">Vectorization</a></li> <li><a href="https://jax.readthedocs.io/en/latest/jax.html#parallelization-pmap" rel="nofollow">Parallelization</a></li>',ye,J,ce,pe,O,Ie="The <code>FlaxViTPreTrainedModel</code> forward method, overrides the <code>__call__</code> special method.",je,Z,Ze,U,te,xe,q,z,Fe,K,fe,Ve=`ViT 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.`,oe,ke,ne=`This model inherits from <a href="/docs/transformers/pr_30530/en/main_classes/model#transformers.FlaxPreTrainedModel">FlaxPreTrainedModel</a>. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading, saving and converting weights from PyTorch models)`,Me,se,ee=`This model is also a
<a href="https://flax.readthedocs.io/en/latest/api_reference/flax.linen/module.html" rel="nofollow">flax.linen.Module</a> subclass. Use it as
a regular Flax linen Module and refer to the Flax documentation for all matter related to general usage and
behavior.`,D,R,me="Finally, this model supports inherent JAX features such as:",Ue,he,Je='<li><a href="https://jax.readthedocs.io/en/latest/jax.html#just-in-time-compilation-jit" rel="nofollow">Just-In-Time (JIT) compilation</a></li> <li><a href="https://jax.readthedocs.io/en/latest/jax.html#automatic-differentiation" rel="nofollow">Automatic Differentiation</a></li> <li><a href="https://jax.readthedocs.io/en/latest/jax.html#vectorization-vmap" rel="nofollow">Vectorization</a></li> <li><a href="https://jax.readthedocs.io/en/latest/jax.html#parallelization-pmap" rel="nofollow">Parallelization</a></li>',ge,P,ue,ve,ae,T="The <code>FlaxViTPreTrainedModel</code> forward method, overrides the <code>__call__</code> special method.",C,H,B,X,$e;return t=new We({props:{title:"FlaxVitModel",local:"transformers.FlaxViTModel",headingTag:"h2"}}),a=new be({props:{name:"class transformers.FlaxViTModel",anchor:"transformers.FlaxViTModel",parameters:[{name:"config",val:": ViTConfig"},{name:"input_shape",val:" = None"},{name:"seed",val:": int = 0"},{name:"dtype",val:": dtype = <class 'jax.numpy.float32'>"},{name:"_do_init",val:": bool = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.FlaxViTModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_30530/en/model_doc/vit#transformers.ViTConfig">ViTConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/pr_30530/en/main_classes/model#transformers.FlaxPreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"},{anchor:"transformers.FlaxViTModel.dtype",description:`<strong>dtype</strong> (<code>jax.numpy.dtype</code>, <em>optional</em>, defaults to <code>jax.numpy.float32</code>) &#x2014;
The data type of the computation. Can be one of <code>jax.numpy.float32</code>, <code>jax.numpy.float16</code> (on GPUs) and
<code>jax.numpy.bfloat16</code> (on TPUs).</p>
<p>This can be used to enable mixed-precision training or half-precision inference on GPUs or TPUs. If
specified all the computation will be performed with the given <code>dtype</code>.</p>
<p><strong>Note that this only specifies the dtype of the computation and does not influence the dtype of model
parameters.</strong></p>
<p>If you wish to change the dtype of the model parameters, see <a href="/docs/transformers/pr_30530/en/main_classes/model#transformers.FlaxPreTrainedModel.to_fp16">to_fp16()</a> and
<a href="/docs/transformers/pr_30530/en/main_classes/model#transformers.FlaxPreTrainedModel.to_bf16">to_bf16()</a>.`,name:"dtype"}],source:"https://github.com/huggingface/transformers/blob/vr_30530/src/transformers/models/vit/modeling_flax_vit.py#L552"}}),ce=new be({props:{name:"__call__",anchor:"transformers.FlaxViTModel.__call__",parameters:[{name:"pixel_values",val:""},{name:"params",val:": dict = None"},{name:"dropout_rng",val:": <function PRNGKey at 0x7f417b16a830> = None"},{name:"train",val:": bool = False"},{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"}],source:"https://github.com/huggingface/transformers/blob/vr_30530/src/transformers/models/vit/modeling_flax_vit.py#L472",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/pr_30530/en/main_classes/output#transformers.modeling_flax_outputs.FlaxBaseModelOutputWithPooling"
>transformers.modeling_flax_outputs.FlaxBaseModelOutputWithPooling</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 (<code>&lt;class 'transformers.models.vit.configuration_vit.ViTConfig'&gt;</code>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>jnp.ndarray</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>jnp.ndarray</code> of shape <code>(batch_size, hidden_size)</code>) — Last layer hidden-state of the first token of the sequence (classification token) further processed by 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(jnp.ndarray)</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>jnp.ndarray</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>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(jnp.ndarray)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>jnp.ndarray</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/pr_30530/en/main_classes/output#transformers.modeling_flax_outputs.FlaxBaseModelOutputWithPooling"
>transformers.modeling_flax_outputs.FlaxBaseModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Z=new Re({props:{$$slots:{default:[Oo]},$$scope:{ctx:V}}}),U=new Oe({props:{anchor:"transformers.FlaxViTModel.__call__.example",$$slots:{default:[Ko]},$$scope:{ctx:V}}}),xe=new We({props:{title:"FlaxViTForImageClassification",local:"transformers.FlaxViTForImageClassification",headingTag:"h2"}}),Fe=new be({props:{name:"class transformers.FlaxViTForImageClassification",anchor:"transformers.FlaxViTForImageClassification",parameters:[{name:"config",val:": ViTConfig"},{name:"input_shape",val:" = None"},{name:"seed",val:": int = 0"},{name:"dtype",val:": dtype = <class 'jax.numpy.float32'>"},{name:"_do_init",val:": bool = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.FlaxViTForImageClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_30530/en/model_doc/vit#transformers.ViTConfig">ViTConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/pr_30530/en/main_classes/model#transformers.FlaxPreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"},{anchor:"transformers.FlaxViTForImageClassification.dtype",description:`<strong>dtype</strong> (<code>jax.numpy.dtype</code>, <em>optional</em>, defaults to <code>jax.numpy.float32</code>) &#x2014;
The data type of the computation. Can be one of <code>jax.numpy.float32</code>, <code>jax.numpy.float16</code> (on GPUs) and
<code>jax.numpy.bfloat16</code> (on TPUs).</p>
<p>This can be used to enable mixed-precision training or half-precision inference on GPUs or TPUs. If
specified all the computation will be performed with the given <code>dtype</code>.</p>
<p><strong>Note that this only specifies the dtype of the computation and does not influence the dtype of model
parameters.</strong></p>
<p>If you wish to change the dtype of the model parameters, see <a href="/docs/transformers/pr_30530/en/main_classes/model#transformers.FlaxPreTrainedModel.to_fp16">to_fp16()</a> and
<a href="/docs/transformers/pr_30530/en/main_classes/model#transformers.FlaxPreTrainedModel.to_bf16">to_bf16()</a>.`,name:"dtype"}],source:"https://github.com/huggingface/transformers/blob/vr_30530/src/transformers/models/vit/modeling_flax_vit.py#L632"}}),ue=new be({props:{name:"__call__",anchor:"transformers.FlaxViTForImageClassification.__call__",parameters:[{name:"pixel_values",val:""},{name:"params",val:": dict = None"},{name:"dropout_rng",val:": <function PRNGKey at 0x7f417b16a830> = None"},{name:"train",val:": bool = False"},{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"}],source:"https://github.com/huggingface/transformers/blob/vr_30530/src/transformers/models/vit/modeling_flax_vit.py#L472",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/pr_30530/en/main_classes/output#transformers.modeling_flax_outputs.FlaxSequenceClassifierOutput"
>transformers.modeling_flax_outputs.FlaxSequenceClassifierOutput</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 (<code>&lt;class 'transformers.models.vit.configuration_vit.ViTConfig'&gt;</code>) and inputs.</p>
<ul>
<li>
<p><strong>logits</strong> (<code>jnp.ndarray</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(jnp.ndarray)</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>jnp.ndarray</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>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(jnp.ndarray)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>jnp.ndarray</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/pr_30530/en/main_classes/output#transformers.modeling_flax_outputs.FlaxSequenceClassifierOutput"
>transformers.modeling_flax_outputs.FlaxSequenceClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),H=new Re({props:{$$slots:{default:[en]},$$scope:{ctx:V}}}),X=new Oe({props:{anchor:"transformers.FlaxViTForImageClassification.__call__.example",$$slots:{default:[tn]},$$scope:{ctx:V}}}),{c(){b(t.$$.fragment),p=r(),o=c("div"),b(a.$$.fragment),_=r(),s=c("p"),s.textContent=x,ie=r(),j=c("p"),j.innerHTML=L,le=r(),N=c("p"),N.innerHTML=S,de=r(),u=c("p"),u.textContent=W,G=r(),E=c("ul"),E.innerHTML=Ce,ye=r(),J=c("div"),b(ce.$$.fragment),pe=r(),O=c("p"),O.innerHTML=Ie,je=r(),b(Z.$$.fragment),Ze=r(),b(U.$$.fragment),te=r(),b(xe.$$.fragment),q=r(),z=c("div"),b(Fe.$$.fragment),K=r(),fe=c("p"),fe.textContent=Ve,oe=r(),ke=c("p"),ke.innerHTML=ne,Me=r(),se=c("p"),se.innerHTML=ee,D=r(),R=c("p"),R.textContent=me,Ue=r(),he=c("ul"),he.innerHTML=Je,ge=r(),P=c("div"),b(ue.$$.fragment),ve=r(),ae=c("p"),ae.innerHTML=T,C=r(),b(H.$$.fragment),B=r(),b(X.$$.fragment),this.h()},l(F){y(t.$$.fragment,F),p=i(F),o=m(F,"DIV",{class:!0});var I=re(o);y(a.$$.fragment,I),_=i(I),s=m(I,"P",{"data-svelte-h":!0}),g(s)!=="svelte-1vbye9a"&&(s.textContent=x),ie=i(I),j=m(I,"P",{"data-svelte-h":!0}),g(j)!=="svelte-1wq6c50"&&(j.innerHTML=L),le=i(I),N=m(I,"P",{"data-svelte-h":!0}),g(N)!=="svelte-10nfsf3"&&(N.innerHTML=S),de=i(I),u=m(I,"P",{"data-svelte-h":!0}),g(u)!=="svelte-1pplc4a"&&(u.textContent=W),G=i(I),E=m(I,"UL",{"data-svelte-h":!0}),g(E)!=="svelte-1w7z84m"&&(E.innerHTML=Ce),ye=i(I),J=m(I,"DIV",{class:!0});var A=re(J);y(ce.$$.fragment,A),pe=i(A),O=m(A,"P",{"data-svelte-h":!0}),g(O)!=="svelte-8rbifc"&&(O.innerHTML=Ie),je=i(A),y(Z.$$.fragment,A),Ze=i(A),y(U.$$.fragment,A),A.forEach(n),I.forEach(n),te=i(F),y(xe.$$.fragment,F),q=i(F),z=m(F,"DIV",{class:!0});var Y=re(z);y(Fe.$$.fragment,Y),K=i(Y),fe=m(Y,"P",{"data-svelte-h":!0}),g(fe)!=="svelte-ju5wm2"&&(fe.textContent=Ve),oe=i(Y),ke=m(Y,"P",{"data-svelte-h":!0}),g(ke)!=="svelte-1wq6c50"&&(ke.innerHTML=ne),Me=i(Y),se=m(Y,"P",{"data-svelte-h":!0}),g(se)!=="svelte-10nfsf3"&&(se.innerHTML=ee),D=i(Y),R=m(Y,"P",{"data-svelte-h":!0}),g(R)!=="svelte-1pplc4a"&&(R.textContent=me),Ue=i(Y),he=m(Y,"UL",{"data-svelte-h":!0}),g(he)!=="svelte-1w7z84m"&&(he.innerHTML=Je),ge=i(Y),P=m(Y,"DIV",{class:!0});var h=re(P);y(ue.$$.fragment,h),ve=i(h),ae=m(h,"P",{"data-svelte-h":!0}),g(ae)!=="svelte-8rbifc"&&(ae.innerHTML=T),C=i(h),y(H.$$.fragment,h),B=i(h),y(X.$$.fragment,h),h.forEach(n),Y.forEach(n),this.h()},h(){Q(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Q(o,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Q(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Q(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(F,I){v(t,F,I),l(F,p,I),l(F,o,I),v(a,o,null),d(o,_),d(o,s),d(o,ie),d(o,j),d(o,le),d(o,N),d(o,de),d(o,u),d(o,G),d(o,E),d(o,ye),d(o,J),v(ce,J,null),d(J,pe),d(J,O),d(J,je),v(Z,J,null),d(J,Ze),v(U,J,null),l(F,te,I),v(xe,F,I),l(F,q,I),l(F,z,I),v(Fe,z,null),d(z,K),d(z,fe),d(z,oe),d(z,ke),d(z,Me),d(z,se),d(z,D),d(z,R),d(z,Ue),d(z,he),d(z,ge),d(z,P),v(ue,P,null),d(P,ve),d(P,ae),d(P,C),v(H,P,null),d(P,B),v(X,P,null),$e=!0},p(F,I){const A={};I&2&&(A.$$scope={dirty:I,ctx:F}),Z.$set(A);const Y={};I&2&&(Y.$$scope={dirty:I,ctx:F}),U.$set(Y);const h={};I&2&&(h.$$scope={dirty:I,ctx:F}),H.$set(h);const k={};I&2&&(k.$$scope={dirty:I,ctx:F}),X.$set(k)},i(F){$e||(w(t.$$.fragment,F),w(a.$$.fragment,F),w(ce.$$.fragment,F),w(Z.$$.fragment,F),w(U.$$.fragment,F),w(xe.$$.fragment,F),w(Fe.$$.fragment,F),w(ue.$$.fragment,F),w(H.$$.fragment,F),w(X.$$.fragment,F),$e=!0)},o(F){M(t.$$.fragment,F),M(a.$$.fragment,F),M(ce.$$.fragment,F),M(Z.$$.fragment,F),M(U.$$.fragment,F),M(xe.$$.fragment,F),M(Fe.$$.fragment,F),M(ue.$$.fragment,F),M(H.$$.fragment,F),M(X.$$.fragment,F),$e=!1},d(F){F&&(n(p),n(o),n(te),n(q),n(z)),$(t,F),$(a),$(ce),$(Z),$(U),$(xe,F),$(Fe),$(ue),$(H),$(X)}}}function nn(V){let t,p;return t=new lo({props:{$$slots:{default:[on]},$$scope:{ctx:V}}}),{c(){b(t.$$.fragment)},l(o){y(t.$$.fragment,o)},m(o,a){v(t,o,a),p=!0},p(o,a){const _={};a&2&&(_.$$scope={dirty:a,ctx:o}),t.$set(_)},i(o){p||(w(t.$$.fragment,o),p=!0)},o(o){M(t.$$.fragment,o),p=!1},d(o){$(t,o)}}}function sn(V){let t,p,o,a,_,s,x,ie,j,L=`The 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.`,le,N,S="The abstract from the paper is the following:",de,u,W=`<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>`,G,E,Ce,ye,J,ce='ViT architecture. Taken from the <a href="https://arxiv.org/abs/2010.11929">original paper.</a>',pe,O,Ie="Following the original Vision Transformer, some follow-up works have been made:",je,Z,Ze=`<li><p><a href="deit">DeiT</a> (Data-efficient Image Transformers) by Facebook AI. DeiT models are distilled vision transformers.
The authors of DeiT also released more efficiently trained ViT models, which you can directly plug into <a href="/docs/transformers/pr_30530/en/model_doc/vit#transformers.ViTModel">ViTModel</a> or
<a href="/docs/transformers/pr_30530/en/model_doc/vit#transformers.ViTForImageClassification">ViTForImageClassification</a>. There are 4 variants available (in 3 different sizes): <em>facebook/deit-tiny-patch16-224</em>,
<em>facebook/deit-small-patch16-224</em>, <em>facebook/deit-base-patch16-224</em> and <em>facebook/deit-base-patch16-384</em>. Note that one should
use <a href="/docs/transformers/pr_30530/en/model_doc/deit#transformers.DeiTImageProcessor">DeiTImageProcessor</a> in order to prepare images for the model.</p></li> <li><p><a href="beit">BEiT</a> (BERT pre-training of Image Transformers) by Microsoft Research. BEiT models outperform supervised pre-trained
vision transformers using a self-supervised method inspired by BERT (masked image modeling) and based on a VQ-VAE.</p></li> <li><p>DINO (a method for self-supervised training of Vision Transformers) by Facebook AI. Vision Transformers trained using
the DINO method show very interesting properties not seen with convolutional models. They are capable of segmenting
objects, without having ever been trained to do so. DINO checkpoints can be found on the <a href="https://huggingface.co/models?other=dino" rel="nofollow">hub</a>.</p></li> <li><p><a href="vit_mae">MAE</a> (Masked Autoencoders) by Facebook AI. By pre-training Vision Transformers to reconstruct pixel values for a high portion
(75%) of masked patches (using an asymmetric encoder-decoder architecture), the authors show that this simple method outperforms
supervised pre-training after fine-tuning.</p></li>`,U,te,xe=`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>.`,q,z,Fe=`Note that we converted the weights from Ross Wightman’s <a href="https://github.com/rwightman/pytorch-image-models" rel="nofollow">timm library</a>,
who already converted the weights from JAX to PyTorch. Credits go to him!`,K,fe,Ve,oe,ke=`<li>To feed images to the Transformer encoder, each image is split into a sequence of fixed-size non-overlapping patches,
which are then linearly embedded. A [CLS] token is added to serve as representation of an entire image, which can be
used for classification. The authors also add absolute position embeddings, and feed the resulting sequence of
vectors to a standard Transformer encoder.</li> <li>As the Vision Transformer expects each image to be of the same size (resolution), one can use
<a href="/docs/transformers/pr_30530/en/model_doc/vit#transformers.ViTImageProcessor">ViTImageProcessor</a> to resize (or rescale) and normalize images for the model.</li> <li>Both the patch resolution and image resolution used during pre-training or fine-tuning are reflected in the name of
each checkpoint. For example, <code>google/vit-base-patch16-224</code> refers to a base-sized architecture with patch
resolution of 16x16 and fine-tuning resolution of 224x224. All checkpoints can be found on the <a href="https://huggingface.co/models?search=vit" rel="nofollow">hub</a>.</li> <li>The available checkpoints are either (1) pre-trained on <a href="http://www.image-net.org/" rel="nofollow">ImageNet-21k</a> (a collection of
14 million images and 21k classes) only, or (2) also fine-tuned on <a href="http://www.image-net.org/challenges/LSVRC/2012/" rel="nofollow">ImageNet</a> (also referred to as ILSVRC 2012, a collection of 1.3 million
images and 1,000 classes).</li> <li>The Vision Transformer was pre-trained using a resolution of 224x224. During fine-tuning, it is often beneficial to
use a higher resolution than pre-training <a href="https://arxiv.org/abs/1906.06423" rel="nofollow">(Touvron et al., 2019)</a>, <a href="https://arxiv.org/abs/1912.11370" rel="nofollow">(Kolesnikov
et al., 2020)</a>. In order to fine-tune at higher resolution, the authors perform
2D interpolation of the pre-trained position embeddings, according to their location in the original image.</li> <li>The best results are obtained with supervised pre-training, which is not the case in NLP. The authors also performed
an experiment with a self-supervised pre-training objective, namely masked patched prediction (inspired by masked
language modeling). With this approach, the smaller ViT-B/16 model achieves 79.9% accuracy on ImageNet, a significant
improvement of 2% to training from scratch, but still 4% behind supervised pre-training.</li>`,ne,Me,se,ee,D=`PyTorch includes a native scaled dot-product attention (SDPA) operator as part of <code>torch.nn.functional</code>. This function
encompasses several implementations that can be applied depending on the inputs and the hardware in use. See the
<a href="https://pytorch.org/docs/stable/generated/torch.nn.functional.scaled_dot_product_attention.html" rel="nofollow">official documentation</a>
or the <a href="https://huggingface.co/docs/transformers/main/en/perf_infer_gpu_one#pytorch-scaled-dot-product-attention" rel="nofollow">GPU Inference</a>
page for more information.`,R,me,Ue=`SDPA is used by default for <code>torch&gt;=2.1.1</code> when an implementation is available, but you may also set
<code>attn_implementation=&quot;sdpa&quot;</code> in <code>from_pretrained()</code> to explicitly request SDPA to be used.`,he,Je,ge,P,ue="For the best speedups, we recommend loading the model in half-precision (e.g. <code>torch.float16</code> or <code>torch.bfloat16</code>).",ve,ae,T="On a local benchmark (A100-40GB, PyTorch 2.3.0, OS Ubuntu 22.04) with <code>float32</code> and <code>google/vit-base-patch16-224</code> model, we saw the following speedups during inference.",C,H,B="<thead><tr><th>Batch size</th> <th>Average inference time (ms), eager mode</th> <th>Average inference time (ms), sdpa model</th> <th>Speed up, Sdpa / Eager (x)</th></tr></thead> <tbody><tr><td>1</td> <td>7</td> <td>6</td> <td>1.17</td></tr> <tr><td>2</td> <td>8</td> <td>6</td> <td>1.33</td></tr> <tr><td>4</td> <td>8</td> <td>6</td> <td>1.33</td></tr> <tr><td>8</td> <td>8</td> <td>6</td> <td>1.33</td></tr></tbody>",X,$e,F,I,A=`Demo notebooks regarding inference as well as fine-tuning ViT on custom data can be found <a href="https://github.com/NielsRogge/Transformers-Tutorials/tree/master/VisionTransformer" rel="nofollow">here</a>.
A list of official Hugging Face and community (indicated by 🌎) resources to help you get started with ViT. 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.`,Y,h,k="<code>ViTForImageClassification</code> is supported by:",Ne,_e,ze,Te,Pe='<li>A blog post on how to <a href="https://huggingface.co/blog/fine-tune-vit" rel="nofollow">Fine-Tune ViT for Image Classification with Hugging Face Transformers</a></li> <li>A blog post on <a href="https://www.philschmid.de/image-classification-huggingface-transformers-keras" rel="nofollow">Image Classification with Hugging Face Transformers and <code>Keras</code></a></li> <li>A notebook on <a href="https://github.com/huggingface/notebooks/blob/main/examples/image_classification.ipynb" rel="nofollow">Fine-tuning for Image Classification with Hugging Face Transformers</a></li> <li>A notebook on how to <a href="https://github.com/NielsRogge/Transformers-Tutorials/blob/master/VisionTransformer/Fine_tuning_the_Vision_Transformer_on_CIFAR_10_with_the_%F0%9F%A4%97_Trainer.ipynb" rel="nofollow">Fine-tune the Vision Transformer on CIFAR-10 with the Hugging Face Trainer</a></li> <li>A notebook on how to <a href="https://github.com/NielsRogge/Transformers-Tutorials/blob/master/VisionTransformer/Fine_tuning_the_Vision_Transformer_on_CIFAR_10_with_PyTorch_Lightning.ipynb" rel="nofollow">Fine-tune the Vision Transformer on CIFAR-10 with PyTorch Lightning</a></li>',Ke,qe,It="⚗️ Optimization",kt,et,co='<li>A blog post on how to <a href="https://www.philschmid.de/optimizing-vision-transformer" rel="nofollow">Accelerate Vision Transformer (ViT) with Quantization using Optimum</a></li>',Ut,tt,mo="⚡️ Inference",Jt,ot,po='<li>A notebook on <a href="https://github.com/NielsRogge/Transformers-Tutorials/blob/master/VisionTransformer/Quick_demo_of_HuggingFace_version_of_Vision_Transformer_inference.ipynb" rel="nofollow">Quick demo: Vision Transformer (ViT) by Google Brain</a></li>',Nt,nt,fo="🚀 Deploy",zt,st,ho='<li>A blog post on <a href="https://huggingface.co/blog/tf-serving-vision" rel="nofollow">Deploying Tensorflow Vision Models in Hugging Face with TF Serving</a></li> <li>A blog post on <a href="https://huggingface.co/blog/deploy-vertex-ai" rel="nofollow">Deploying Hugging Face ViT on Vertex AI</a></li> <li>A blog post on <a href="https://huggingface.co/blog/deploy-tfserving-kubernetes" rel="nofollow">Deploying Hugging Face ViT on Kubernetes with TF Serving</a></li>',Wt,at,Zt,Le,rt,At,Tt,go=`This is the configuration class to store the configuration of a <a href="/docs/transformers/pr_30530/en/model_doc/vit#transformers.ViTModel">ViTModel</a>. It is used to instantiate an ViT
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
<a href="https://huggingface.co/google/vit-base-patch16-224" rel="nofollow">google/vit-base-patch16-224</a> architecture.`,Qt,bt,uo=`Configuration objects inherit from <a href="/docs/transformers/pr_30530/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/pr_30530/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,Ot,Ye,Pt,it,Lt,Xe,lt,Kt,De,dt,eo,yt,_o="Preprocess an image or a batch of images.",Rt,ct,Ht,He,mt,to,vt,To="Constructs a ViT image processor.",oo,Ae,pt,no,wt,bo="Preprocess an image or batch of images.",Bt,ft,Gt,Be,ht,so,Mt,yo="Constructs a ViT image processor.",ao,Ee,gt,ro,$t,vo="Preprocess an image or batch of images.",io,xt,wo=`do_convert_rgb (<code>bool</code>, <em>optional</em>):
Whether to convert the image to RGB.`,qt,Qe,Et,ut,Xt,jt,St;return _=new We({props:{title:"Vision Transformer (ViT)",local:"vision-transformer-vit",headingTag:"h1"}}),x=new We({props:{title:"Overview",local:"overview",headingTag:"h2"}}),fe=new We({props:{title:"Usage tips",local:"usage-tips",headingTag:"h2"}}),Me=new We({props:{title:"Using Scaled Dot Product Attention (SDPA)",local:"using-scaled-dot-product-attention-sdpa",headingTag:"h3"}}),Je=new Se({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFZpVEZvckltYWdlQ2xhc3NpZmljYXRpb24lMEFtb2RlbCUyMCUzRCUyMFZpVEZvckltYWdlQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMmdvb2dsZSUyRnZpdC1iYXNlLXBhdGNoMTYtMjI0JTIyJTJDJTIwYXR0bl9pbXBsZW1lbnRhdGlvbiUzRCUyMnNkcGElMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYpJTBBLi4u",highlighted:`from transformers import ViTForImageClassification
model = <span class="hljs-module-access"><span class="hljs-module"><span class="hljs-identifier">ViTForImageClassification</span>.</span></span>from<span class="hljs-constructor">_pretrained(<span class="hljs-string">&quot;google/vit-base-patch16-224&quot;</span>, <span class="hljs-params">attn_implementation</span>=<span class="hljs-string">&quot;sdpa&quot;</span>, <span class="hljs-params">torch_dtype</span>=<span class="hljs-params">torch</span>.<span class="hljs-params">float16</span>)</span>
...`,wrap:!1}}),$e=new We({props:{title:"Resources",local:"resources",headingTag:"h2"}}),_e=new jo({props:{pipeline:"image-classification"}}),at=new We({props:{title:"ViTConfig",local:"transformers.ViTConfig",headingTag:"h2"}}),rt=new be({props:{name:"class transformers.ViTConfig",anchor:"transformers.ViTConfig",parameters:[{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:" = 16"},{name:"num_channels",val:" = 3"},{name:"qkv_bias",val:" = True"},{name:"encoder_stride",val:" = 16"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.ViTConfig.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.ViTConfig.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.ViTConfig.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.ViTConfig.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.ViTConfig.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.ViTConfig.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.ViTConfig.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.ViTConfig.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.ViTConfig.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.ViTConfig.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.ViTConfig.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.ViTConfig.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.ViTConfig.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"},{anchor:"transformers.ViTConfig.encoder_stride",description:`<strong>encoder_stride</strong> (<code>int</code>, <em>optional</em>, defaults to 16) &#x2014;
Factor to increase the spatial resolution by in the decoder head for masked image modeling.`,name:"encoder_stride"}],source:"https://github.com/huggingface/transformers/blob/vr_30530/src/transformers/models/vit/configuration_vit.py#L30"}}),Ye=new Oe({props:{anchor:"transformers.ViTConfig.example",$$slots:{default:[Uo]},$$scope:{ctx:V}}}),it=new We({props:{title:"ViTFeatureExtractor",local:"transformers.ViTFeatureExtractor",headingTag:"h2"}}),lt=new be({props:{name:"class transformers.ViTFeatureExtractor",anchor:"transformers.ViTFeatureExtractor",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/vr_30530/src/transformers/models/vit/feature_extraction_vit.py#L26"}}),dt=new be({props:{name:"__call__",anchor:"transformers.ViTFeatureExtractor.__call__",parameters:[{name:"images",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/vr_30530/src/transformers/image_processing_utils.py#L39"}}),ct=new We({props:{title:"ViTImageProcessor",local:"transformers.ViTImageProcessor",headingTag:"h2"}}),mt=new be({props:{name:"class transformers.ViTImageProcessor",anchor:"transformers.ViTImageProcessor",parameters:[{name:"do_resize",val:": bool = True"},{name:"size",val:": typing.Optional[typing.Dict[str, int]] = None"},{name:"resample",val:": Resampling = <Resampling.BILINEAR: 2>"},{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:": typing.Optional[bool] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.ViTImageProcessor.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.ViTImageProcessor.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.ViTImageProcessor.resample",description:`<strong>resample</strong> (<code>PILImageResampling</code>, <em>optional</em>, defaults to <code>Resampling.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.ViTImageProcessor.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.ViTImageProcessor.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.`,name:"rescale_factor"},{anchor:"transformers.ViTImageProcessor.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to normalize the image. Can be overridden by the <code>do_normalize</code> parameter in the <code>preprocess</code>
method.`,name:"do_normalize"},{anchor:"transformers.ViTImageProcessor.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.ViTImageProcessor.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"},{anchor:"transformers.ViTImageProcessor.do_convert_rgb",description:`<strong>do_convert_rgb</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to convert the image to RGB.`,name:"do_convert_rgb"}],source:"https://github.com/huggingface/transformers/blob/vr_30530/src/transformers/models/vit/image_processing_vit.py#L42"}}),pt=new be({props:{name:"preprocess",anchor:"transformers.ViTImageProcessor.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_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:"input_data_format",val:": typing.Union[str, transformers.image_utils.ChannelDimension, NoneType] = None"},{name:"do_convert_rgb",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.ViTImageProcessor.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.ViTImageProcessor.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.ViTImageProcessor.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.ViTImageProcessor.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.ViTImageProcessor.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.ViTImageProcessor.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.ViTImageProcessor.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.ViTImageProcessor.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.ViTImageProcessor.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.ViTImageProcessor.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.ViTImageProcessor.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"},{anchor:"transformers.ViTImageProcessor.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"},{anchor:"transformers.ViTImageProcessor.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"}],source:"https://github.com/huggingface/transformers/blob/vr_30530/src/transformers/models/vit/image_processing_vit.py#L151"}}),ft=new We({props:{title:"ViTImageProcessorFast",local:"transformers.ViTImageProcessorFast",headingTag:"h2"}}),ht=new be({props:{name:"class transformers.ViTImageProcessorFast",anchor:"transformers.ViTImageProcessorFast",parameters:[{name:"do_resize",val:": bool = True"},{name:"size",val:": typing.Optional[typing.Dict[str, int]] = None"},{name:"resample",val:": Resampling = <Resampling.BILINEAR: 2>"},{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:": typing.Optional[bool] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.ViTImageProcessorFast.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.ViTImageProcessorFast.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.ViTImageProcessorFast.resample",description:`<strong>resample</strong> (<code>PILImageResampling</code>, <em>optional</em>, defaults to <code>Resampling.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.ViTImageProcessorFast.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.ViTImageProcessorFast.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.`,name:"rescale_factor"},{anchor:"transformers.ViTImageProcessorFast.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to normalize the image. Can be overridden by the <code>do_normalize</code> parameter in the <code>preprocess</code>
method.`,name:"do_normalize"},{anchor:"transformers.ViTImageProcessorFast.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.ViTImageProcessorFast.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"},{anchor:"transformers.ViTImageProcessorFast.do_convert_rgb",description:`<strong>do_convert_rgb</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to convert the image to RGB.`,name:"do_convert_rgb"}],source:"https://github.com/huggingface/transformers/blob/vr_30530/src/transformers/models/vit/image_processing_vit_fast.py#L50"}}),gt=new be({props:{name:"preprocess",anchor:"transformers.ViTImageProcessorFast.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_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] = 'pt'"},{name:"data_format",val:": typing.Union[str, transformers.image_utils.ChannelDimension] = <ChannelDimension.FIRST: 'channels_first'>"},{name:"input_data_format",val:": typing.Union[str, transformers.image_utils.ChannelDimension, NoneType] = None"},{name:"do_convert_rgb",val:": typing.Optional[bool] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.ViTImageProcessorFast.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.ViTImageProcessorFast.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.ViTImageProcessorFast.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.ViTImageProcessorFast.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.ViTImageProcessorFast.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.ViTImageProcessorFast.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.ViTImageProcessorFast.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.ViTImageProcessorFast.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.ViTImageProcessorFast.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.ViTImageProcessorFast.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. Only &#x201C;pt&#x201D; is supported`,name:"return_tensors"},{anchor:"transformers.ViTImageProcessorFast.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. The following formats are currently supported:<ul>
<li><code>&quot;channels_first&quot;</code> or <code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li>
</ul>`,name:"data_format"},{anchor:"transformers.ViTImageProcessorFast.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/vr_30530/src/transformers/models/vit/image_processing_vit_fast.py#L192"}}),Qe=new Io({props:{pytorch:!0,tensorflow:!0,jax:!0,$$slots:{jax:[nn],tensorflow:[Qo],pytorch:[Bo]},$$scope:{ctx:V}}}),ut=new ko({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/model_doc/vit.md"}}),{c(){t=c("meta"),p=r(),o=c("p"),a=r(),b(_.$$.fragment),s=r(),b(x.$$.fragment),ie=r(),j=c("p"),j.innerHTML=L,le=r(),N=c("p"),N.textContent=S,de=r(),u=c("p"),u.innerHTML=W,G=r(),E=c("img"),ye=r(),J=c("small"),J.innerHTML=ce,pe=r(),O=c("p"),O.textContent=Ie,je=r(),Z=c("ul"),Z.innerHTML=Ze,U=r(),te=c("p"),te.innerHTML=xe,q=r(),z=c("p"),z.innerHTML=Fe,K=r(),b(fe.$$.fragment),Ve=r(),oe=c("ul"),oe.innerHTML=ke,ne=r(),b(Me.$$.fragment),se=r(),ee=c("p"),ee.innerHTML=D,R=r(),me=c("p"),me.innerHTML=Ue,he=r(),b(Je.$$.fragment),ge=r(),P=c("p"),P.innerHTML=ue,ve=r(),ae=c("p"),ae.innerHTML=T,C=r(),H=c("table"),H.innerHTML=B,X=r(),b($e.$$.fragment),F=r(),I=c("p"),I.innerHTML=A,Y=r(),h=c("p"),h.innerHTML=k,Ne=r(),b(_e.$$.fragment),ze=r(),Te=c("ul"),Te.innerHTML=Pe,Ke=r(),qe=c("p"),qe.textContent=It,kt=r(),et=c("ul"),et.innerHTML=co,Ut=r(),tt=c("p"),tt.textContent=mo,Jt=r(),ot=c("ul"),ot.innerHTML=po,Nt=r(),nt=c("p"),nt.textContent=fo,zt=r(),st=c("ul"),st.innerHTML=ho,Wt=r(),b(at.$$.fragment),Zt=r(),Le=c("div"),b(rt.$$.fragment),At=r(),Tt=c("p"),Tt.innerHTML=go,Qt=r(),bt=c("p"),bt.innerHTML=uo,Ot=r(),b(Ye.$$.fragment),Pt=r(),b(it.$$.fragment),Lt=r(),Xe=c("div"),b(lt.$$.fragment),Kt=r(),De=c("div"),b(dt.$$.fragment),eo=r(),yt=c("p"),yt.textContent=_o,Rt=r(),b(ct.$$.fragment),Ht=r(),He=c("div"),b(mt.$$.fragment),to=r(),vt=c("p"),vt.textContent=To,oo=r(),Ae=c("div"),b(pt.$$.fragment),no=r(),wt=c("p"),wt.textContent=bo,Bt=r(),b(ft.$$.fragment),Gt=r(),Be=c("div"),b(ht.$$.fragment),so=r(),Mt=c("p"),Mt.textContent=yo,ao=r(),Ee=c("div"),b(gt.$$.fragment),ro=r(),$t=c("p"),$t.textContent=vo,io=r(),xt=c("p"),xt.innerHTML=wo,qt=r(),b(Qe.$$.fragment),Et=r(),b(ut.$$.fragment),Xt=r(),jt=c("p"),this.h()},l(e){const f=Co("svelte-u9bgzb",document.head);t=m(f,"META",{name:!0,content:!0}),f.forEach(n),p=i(e),o=m(e,"P",{}),re(o).forEach(n),a=i(e),y(_.$$.fragment,e),s=i(e),y(x.$$.fragment,e),ie=i(e),j=m(e,"P",{"data-svelte-h":!0}),g(j)!=="svelte-mxwj6a"&&(j.innerHTML=L),le=i(e),N=m(e,"P",{"data-svelte-h":!0}),g(N)!=="svelte-vfdo9a"&&(N.textContent=S),de=i(e),u=m(e,"P",{"data-svelte-h":!0}),g(u)!=="svelte-yjj3f8"&&(u.innerHTML=W),G=i(e),E=m(e,"IMG",{src:!0,alt:!0,width:!0}),ye=i(e),J=m(e,"SMALL",{"data-svelte-h":!0}),g(J)!=="svelte-7mkw5i"&&(J.innerHTML=ce),pe=i(e),O=m(e,"P",{"data-svelte-h":!0}),g(O)!=="svelte-ghhnmw"&&(O.textContent=Ie),je=i(e),Z=m(e,"UL",{"data-svelte-h":!0}),g(Z)!=="svelte-ny975j"&&(Z.innerHTML=Ze),U=i(e),te=m(e,"P",{"data-svelte-h":!0}),g(te)!=="svelte-pwnwoc"&&(te.innerHTML=xe),q=i(e),z=m(e,"P",{"data-svelte-h":!0}),g(z)!=="svelte-11xcw47"&&(z.innerHTML=Fe),K=i(e),y(fe.$$.fragment,e),Ve=i(e),oe=m(e,"UL",{"data-svelte-h":!0}),g(oe)!=="svelte-mfn5i1"&&(oe.innerHTML=ke),ne=i(e),y(Me.$$.fragment,e),se=i(e),ee=m(e,"P",{"data-svelte-h":!0}),g(ee)!=="svelte-1cid2pe"&&(ee.innerHTML=D),R=i(e),me=m(e,"P",{"data-svelte-h":!0}),g(me)!=="svelte-1x11lxg"&&(me.innerHTML=Ue),he=i(e),y(Je.$$.fragment,e),ge=i(e),P=m(e,"P",{"data-svelte-h":!0}),g(P)!=="svelte-djb2w0"&&(P.innerHTML=ue),ve=i(e),ae=m(e,"P",{"data-svelte-h":!0}),g(ae)!=="svelte-18g4o0h"&&(ae.innerHTML=T),C=i(e),H=m(e,"TABLE",{"data-svelte-h":!0}),g(H)!=="svelte-vyu660"&&(H.innerHTML=B),X=i(e),y($e.$$.fragment,e),F=i(e),I=m(e,"P",{"data-svelte-h":!0}),g(I)!=="svelte-152spv0"&&(I.innerHTML=A),Y=i(e),h=m(e,"P",{"data-svelte-h":!0}),g(h)!=="svelte-qrf7lp"&&(h.innerHTML=k),Ne=i(e),y(_e.$$.fragment,e),ze=i(e),Te=m(e,"UL",{"data-svelte-h":!0}),g(Te)!=="svelte-1fybkhs"&&(Te.innerHTML=Pe),Ke=i(e),qe=m(e,"P",{"data-svelte-h":!0}),g(qe)!=="svelte-liq2q7"&&(qe.textContent=It),kt=i(e),et=m(e,"UL",{"data-svelte-h":!0}),g(et)!=="svelte-1vxkfqp"&&(et.innerHTML=co),Ut=i(e),tt=m(e,"P",{"data-svelte-h":!0}),g(tt)!=="svelte-1wntqpp"&&(tt.textContent=mo),Jt=i(e),ot=m(e,"UL",{"data-svelte-h":!0}),g(ot)!=="svelte-1q3e2i6"&&(ot.innerHTML=po),Nt=i(e),nt=m(e,"P",{"data-svelte-h":!0}),g(nt)!=="svelte-lk14e4"&&(nt.textContent=fo),zt=i(e),st=m(e,"UL",{"data-svelte-h":!0}),g(st)!=="svelte-1e4wiq4"&&(st.innerHTML=ho),Wt=i(e),y(at.$$.fragment,e),Zt=i(e),Le=m(e,"DIV",{class:!0});var Ge=re(Le);y(rt.$$.fragment,Ge),At=i(Ge),Tt=m(Ge,"P",{"data-svelte-h":!0}),g(Tt)!=="svelte-15fc4if"&&(Tt.innerHTML=go),Qt=i(Ge),bt=m(Ge,"P",{"data-svelte-h":!0}),g(bt)!=="svelte-l1blo3"&&(bt.innerHTML=uo),Ot=i(Ge),y(Ye.$$.fragment,Ge),Ge.forEach(n),Pt=i(e),y(it.$$.fragment,e),Lt=i(e),Xe=m(e,"DIV",{class:!0});var _t=re(Xe);y(lt.$$.fragment,_t),Kt=i(_t),De=m(_t,"DIV",{class:!0});var Yt=re(De);y(dt.$$.fragment,Yt),eo=i(Yt),yt=m(Yt,"P",{"data-svelte-h":!0}),g(yt)!=="svelte-khengj"&&(yt.textContent=_o),Yt.forEach(n),_t.forEach(n),Rt=i(e),y(ct.$$.fragment,e),Ht=i(e),He=m(e,"DIV",{class:!0});var Ft=re(He);y(mt.$$.fragment,Ft),to=i(Ft),vt=m(Ft,"P",{"data-svelte-h":!0}),g(vt)!=="svelte-1ebexfn"&&(vt.textContent=To),oo=i(Ft),Ae=m(Ft,"DIV",{class:!0});var Dt=re(Ae);y(pt.$$.fragment,Dt),no=i(Dt),wt=m(Dt,"P",{"data-svelte-h":!0}),g(wt)!=="svelte-1x3yxsa"&&(wt.textContent=bo),Dt.forEach(n),Ft.forEach(n),Bt=i(e),y(ft.$$.fragment,e),Gt=i(e),Be=m(e,"DIV",{class:!0});var Vt=re(Be);y(ht.$$.fragment,Vt),so=i(Vt),Mt=m(Vt,"P",{"data-svelte-h":!0}),g(Mt)!=="svelte-1ebexfn"&&(Mt.textContent=yo),ao=i(Vt),Ee=m(Vt,"DIV",{class:!0});var Ct=re(Ee);y(gt.$$.fragment,Ct),ro=i(Ct),$t=m(Ct,"P",{"data-svelte-h":!0}),g($t)!=="svelte-1x3yxsa"&&($t.textContent=vo),io=i(Ct),xt=m(Ct,"P",{"data-svelte-h":!0}),g(xt)!=="svelte-zrybiv"&&(xt.innerHTML=wo),Ct.forEach(n),Vt.forEach(n),qt=i(e),y(Qe.$$.fragment,e),Et=i(e),y(ut.$$.fragment,e),Xt=i(e),jt=m(e,"P",{}),re(jt).forEach(n),this.h()},h(){Q(t,"name","hf:doc:metadata"),Q(t,"content",an),$o(E.src,Ce="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/model_doc/vit_architecture.jpg")||Q(E,"src",Ce),Q(E,"alt","drawing"),Q(E,"width","600"),Q(Le,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Q(De,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Q(Xe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Q(Ae,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Q(He,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Q(Ee,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Q(Be,"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,f){d(document.head,t),l(e,p,f),l(e,o,f),l(e,a,f),v(_,e,f),l(e,s,f),v(x,e,f),l(e,ie,f),l(e,j,f),l(e,le,f),l(e,N,f),l(e,de,f),l(e,u,f),l(e,G,f),l(e,E,f),l(e,ye,f),l(e,J,f),l(e,pe,f),l(e,O,f),l(e,je,f),l(e,Z,f),l(e,U,f),l(e,te,f),l(e,q,f),l(e,z,f),l(e,K,f),v(fe,e,f),l(e,Ve,f),l(e,oe,f),l(e,ne,f),v(Me,e,f),l(e,se,f),l(e,ee,f),l(e,R,f),l(e,me,f),l(e,he,f),v(Je,e,f),l(e,ge,f),l(e,P,f),l(e,ve,f),l(e,ae,f),l(e,C,f),l(e,H,f),l(e,X,f),v($e,e,f),l(e,F,f),l(e,I,f),l(e,Y,f),l(e,h,f),l(e,Ne,f),v(_e,e,f),l(e,ze,f),l(e,Te,f),l(e,Ke,f),l(e,qe,f),l(e,kt,f),l(e,et,f),l(e,Ut,f),l(e,tt,f),l(e,Jt,f),l(e,ot,f),l(e,Nt,f),l(e,nt,f),l(e,zt,f),l(e,st,f),l(e,Wt,f),v(at,e,f),l(e,Zt,f),l(e,Le,f),v(rt,Le,null),d(Le,At),d(Le,Tt),d(Le,Qt),d(Le,bt),d(Le,Ot),v(Ye,Le,null),l(e,Pt,f),v(it,e,f),l(e,Lt,f),l(e,Xe,f),v(lt,Xe,null),d(Xe,Kt),d(Xe,De),v(dt,De,null),d(De,eo),d(De,yt),l(e,Rt,f),v(ct,e,f),l(e,Ht,f),l(e,He,f),v(mt,He,null),d(He,to),d(He,vt),d(He,oo),d(He,Ae),v(pt,Ae,null),d(Ae,no),d(Ae,wt),l(e,Bt,f),v(ft,e,f),l(e,Gt,f),l(e,Be,f),v(ht,Be,null),d(Be,so),d(Be,Mt),d(Be,ao),d(Be,Ee),v(gt,Ee,null),d(Ee,ro),d(Ee,$t),d(Ee,io),d(Ee,xt),l(e,qt,f),v(Qe,e,f),l(e,Et,f),v(ut,e,f),l(e,Xt,f),l(e,jt,f),St=!0},p(e,[f]){const Ge={};f&2&&(Ge.$$scope={dirty:f,ctx:e}),Ye.$set(Ge);const _t={};f&2&&(_t.$$scope={dirty:f,ctx:e}),Qe.$set(_t)},i(e){St||(w(_.$$.fragment,e),w(x.$$.fragment,e),w(fe.$$.fragment,e),w(Me.$$.fragment,e),w(Je.$$.fragment,e),w($e.$$.fragment,e),w(_e.$$.fragment,e),w(at.$$.fragment,e),w(rt.$$.fragment,e),w(Ye.$$.fragment,e),w(it.$$.fragment,e),w(lt.$$.fragment,e),w(dt.$$.fragment,e),w(ct.$$.fragment,e),w(mt.$$.fragment,e),w(pt.$$.fragment,e),w(ft.$$.fragment,e),w(ht.$$.fragment,e),w(gt.$$.fragment,e),w(Qe.$$.fragment,e),w(ut.$$.fragment,e),St=!0)},o(e){M(_.$$.fragment,e),M(x.$$.fragment,e),M(fe.$$.fragment,e),M(Me.$$.fragment,e),M(Je.$$.fragment,e),M($e.$$.fragment,e),M(_e.$$.fragment,e),M(at.$$.fragment,e),M(rt.$$.fragment,e),M(Ye.$$.fragment,e),M(it.$$.fragment,e),M(lt.$$.fragment,e),M(dt.$$.fragment,e),M(ct.$$.fragment,e),M(mt.$$.fragment,e),M(pt.$$.fragment,e),M(ft.$$.fragment,e),M(ht.$$.fragment,e),M(gt.$$.fragment,e),M(Qe.$$.fragment,e),M(ut.$$.fragment,e),St=!1},d(e){e&&(n(p),n(o),n(a),n(s),n(ie),n(j),n(le),n(N),n(de),n(u),n(G),n(E),n(ye),n(J),n(pe),n(O),n(je),n(Z),n(U),n(te),n(q),n(z),n(K),n(Ve),n(oe),n(ne),n(se),n(ee),n(R),n(me),n(he),n(ge),n(P),n(ve),n(ae),n(C),n(H),n(X),n(F),n(I),n(Y),n(h),n(Ne),n(ze),n(Te),n(Ke),n(qe),n(kt),n(et),n(Ut),n(tt),n(Jt),n(ot),n(Nt),n(nt),n(zt),n(st),n(Wt),n(Zt),n(Le),n(Pt),n(Lt),n(Xe),n(Rt),n(Ht),n(He),n(Bt),n(Gt),n(Be),n(qt),n(Et),n(Xt),n(jt)),n(t),$(_,e),$(x,e),$(fe,e),$(Me,e),$(Je,e),$($e,e),$(_e,e),$(at,e),$(rt),$(Ye),$(it,e),$(lt),$(dt),$(ct,e),$(mt),$(pt),$(ft,e),$(ht),$(gt),$(Qe,e),$(ut,e)}}}const an='{"title":"Vision Transformer (ViT)","local":"vision-transformer-vit","sections":[{"title":"Overview","local":"overview","sections":[],"depth":2},{"title":"Usage tips","local":"usage-tips","sections":[{"title":"Using Scaled Dot Product Attention (SDPA)","local":"using-scaled-dot-product-attention-sdpa","sections":[],"depth":3}],"depth":2},{"title":"Resources","local":"resources","sections":[],"depth":2},{"title":"ViTConfig","local":"transformers.ViTConfig","sections":[],"depth":2},{"title":"ViTFeatureExtractor","local":"transformers.ViTFeatureExtractor","sections":[],"depth":2},{"title":"ViTImageProcessor","local":"transformers.ViTImageProcessor","sections":[],"depth":2},{"title":"ViTImageProcessorFast","local":"transformers.ViTImageProcessorFast","sections":[],"depth":2},{"title":"ViTModel","local":"transformers.ViTModel","sections":[],"depth":2},{"title":"ViTForMaskedImageModeling","local":"transformers.ViTForMaskedImageModeling","sections":[],"depth":2},{"title":"ViTForImageClassification","local":"transformers.ViTForImageClassification","sections":[],"depth":2},{"title":"TFViTModel","local":"transformers.TFViTModel","sections":[],"depth":2},{"title":"TFViTForImageClassification","local":"transformers.TFViTForImageClassification","sections":[],"depth":2},{"title":"FlaxVitModel","local":"transformers.FlaxViTModel","sections":[],"depth":2},{"title":"FlaxViTForImageClassification","local":"transformers.FlaxViTForImageClassification","sections":[],"depth":2}],"depth":1}';function rn(V){return xo(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class _n extends Fo{constructor(t){super(),Vo(this,t,rn,sn,Mo,{})}}export{_n as component};
