import{s as vo,f as yo,o as wo,n as we}from"../chunks/scheduler.25b97de1.js";import{S as Mo,i as $o,g as d,s as i,r as b,A as xo,h as c,f as n,c as l,j as re,u as v,x as g,k as Q,y as m,a as r,v as y,d as w,t as M,w as $}from"../chunks/index.d9030fc9.js";import{T as Le}from"../chunks/Tip.baa67368.js";import{D as be}from"../chunks/Docstring.e257edda.js";import{C as Xe}from"../chunks/CodeBlock.e6cd0d95.js";import{F as Vo,M as ro}from"../chunks/Markdown.7217f838.js";import{E as Oe}from"../chunks/ExampleCodeBlock.20db4b6e.js";import{P as Fo}from"../chunks/PipelineTag.5f100392.js";import{H as Ze,E as Co}from"../chunks/EditOnGithub.91d95064.js";function Io(F){let t,p="Example:",o,a,_;return a=new Xe({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=d("p"),t.textContent=p,o=i(),b(a.$$.fragment)},l(s){t=c(s,"P",{"data-svelte-h":!0}),g(t)!=="svelte-11lpom8"&&(t.textContent=p),o=l(s),v(a.$$.fragment,s)},m(s,x){r(s,t,x),r(s,o,x),y(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(F){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=d("p"),t.innerHTML=p},l(o){t=c(o,"P",{"data-svelte-h":!0}),g(t)!=="svelte-fincs2"&&(t.innerHTML=p)},m(o,a){r(o,t,a)},p:we,d(o){o&&n(t)}}}function ko(F){let t,p="Example:",o,a,_;return a=new Xe({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=d("p"),t.textContent=p,o=i(),b(a.$$.fragment)},l(s){t=c(s,"P",{"data-svelte-h":!0}),g(t)!=="svelte-11lpom8"&&(t.textContent=p),o=l(s),v(a.$$.fragment,s)},m(s,x){r(s,t,x),r(s,o,x),y(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 Uo(F){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=d("p"),t.innerHTML=p},l(o){t=c(o,"P",{"data-svelte-h":!0}),g(t)!=="svelte-7i3y9o"&&(t.innerHTML=p)},m(o,a){r(o,t,a)},p:we,d(o){o&&n(t)}}}function Jo(F){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=d("p"),t.innerHTML=p},l(o){t=c(o,"P",{"data-svelte-h":!0}),g(t)!=="svelte-fincs2"&&(t.innerHTML=p)},m(o,a){r(o,t,a)},p:we,d(o){o&&n(t)}}}function zo(F){let t,p="Examples:",o,a,_;return a=new Xe({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=d("p"),t.textContent=p,o=i(),b(a.$$.fragment)},l(s){t=c(s,"P",{"data-svelte-h":!0}),g(t)!=="svelte-kvfsh7"&&(t.textContent=p),o=l(s),v(a.$$.fragment,s)},m(s,x){r(s,t,x),r(s,o,x),y(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 Wo(F){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=d("p"),t.innerHTML=p},l(o){t=c(o,"P",{"data-svelte-h":!0}),g(t)!=="svelte-111lhr1"&&(t.innerHTML=p)},m(o,a){r(o,t,a)},p:we,d(o){o&&n(t)}}}function Zo(F){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=d("p"),t.innerHTML=p},l(o){t=c(o,"P",{"data-svelte-h":!0}),g(t)!=="svelte-fincs2"&&(t.innerHTML=p)},m(o,a){r(o,t,a)},p:we,d(o){o&&n(t)}}}function No(F){let t,p="Example:",o,a,_;return a=new Xe({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=d("p"),t.textContent=p,o=i(),b(a.$$.fragment)},l(s){t=c(s,"P",{"data-svelte-h":!0}),g(t)!=="svelte-11lpom8"&&(t.textContent=p),o=l(s),v(a.$$.fragment,s)},m(s,x){r(s,t,x),r(s,o,x),y(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(F){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,R,le,z,S='The <a href="/docs/transformers/pr_30623/en/model_doc/vit#transformers.ViTModel">ViTModel</a> forward method, overrides the <code>__call__</code> special method.',de,u,Z,G,E,Ce,ve,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,N,Ne,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,W,Ve,K,fe='The <a href="/docs/transformers/pr_30623/en/model_doc/vit#transformers.ViTForMaskedImageModeling">ViTForMaskedImageModeling</a> forward method, overrides the <code>__call__</code> special method.',Fe,oe,ke,ne,Me,se,ee,D,L,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,ye=`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_30623/en/model_doc/vit#transformers.ViTForImageClassification">ViTForImageClassification</a> forward method, overrides the <code>__call__</code> special method.',$e,V,I,A,Y;return t=new Ze({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_30623/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_30623/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_30623/src/transformers/models/vit/modeling_vit.py#L538"}}),R=new be({props:{name:"forward",anchor:"transformers.ViTModel.forward",parameters:[{name:"pixel_values",val:": Optional = None"},{name:"bool_masked_pos",val:": Optional = None"},{name:"head_mask",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"interpolate_pos_encoding",val:": Optional = None"},{name:"return_dict",val:": Optional = 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_30623/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/pr_30623/en/model_doc/perceiver#transformers.PerceiverFeatureExtractor.__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_30623/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_30623/src/transformers/models/vit/modeling_vit.py#L567",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/pr_30623/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_30623/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_30623/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),u=new Le({props:{$$slots:{default:[jo]},$$scope:{ctx:F}}}),G=new Oe({props:{anchor:"transformers.ViTModel.forward.example",$$slots:{default:[ko]},$$scope:{ctx:F}}}),Ce=new Ze({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_30623/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_30623/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_30623/src/transformers/models/vit/modeling_vit.py#L652"}}),N=new Le({props:{$$slots:{default:[Uo]},$$scope:{ctx:F}}}),W=new be({props:{name:"forward",anchor:"transformers.ViTForMaskedImageModeling.forward",parameters:[{name:"pixel_values",val:": Optional = None"},{name:"bool_masked_pos",val:": Optional = None"},{name:"head_mask",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"interpolate_pos_encoding",val:": Optional = None"},{name:"return_dict",val:": Optional = 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_30623/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/pr_30623/en/model_doc/perceiver#transformers.PerceiverFeatureExtractor.__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_30623/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_30623/src/transformers/models/vit/modeling_vit.py#L682",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_30623/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 Le({props:{$$slots:{default:[Jo]},$$scope:{ctx:F}}}),ne=new Oe({props:{anchor:"transformers.ViTForMaskedImageModeling.forward.example",$$slots:{default:[zo]},$$scope:{ctx:F}}}),se=new Ze({props:{title:"ViTForImageClassification",local:"transformers.ViTForImageClassification",headingTag:"h2"}}),L=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_30623/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_30623/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_30623/src/transformers/models/vit/modeling_vit.py#L778"}}),ge=new Le({props:{$$slots:{default:[Wo]},$$scope:{ctx:F}}}),C=new be({props:{name:"forward",anchor:"transformers.ViTForImageClassification.forward",parameters:[{name:"pixel_values",val:": Optional = None"},{name:"head_mask",val:": Optional = None"},{name:"labels",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"interpolate_pos_encoding",val:": Optional = None"},{name:"return_dict",val:": Optional = 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_30623/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/pr_30623/en/model_doc/perceiver#transformers.PerceiverFeatureExtractor.__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_30623/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_30623/src/transformers/models/vit/modeling_vit.py#L806",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/pr_30623/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_30623/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_30623/en/main_classes/output#transformers.modeling_outputs.ImageClassifierOutput"
>transformers.modeling_outputs.ImageClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),V=new Le({props:{$$slots:{default:[Zo]},$$scope:{ctx:F}}}),A=new Oe({props:{anchor:"transformers.ViTForImageClassification.forward.example",$$slots:{default:[No]},$$scope:{ctx:F}}}),{c(){b(t.$$.fragment),p=i(),o=d("div"),b(a.$$.fragment),_=i(),s=d("p"),s.innerHTML=x,ie=i(),j=d("div"),b(R.$$.fragment),le=i(),z=d("p"),z.innerHTML=S,de=i(),b(u.$$.fragment),Z=i(),b(G.$$.fragment),E=i(),b(Ce.$$.fragment),ve=i(),J=d("div"),b(ce.$$.fragment),pe=i(),O=d("p"),O.innerHTML=Ie,je=i(),b(N.$$.fragment),Ne=i(),U=d("p"),U.innerHTML=te,xe=i(),q=d("div"),b(W.$$.fragment),Ve=i(),K=d("p"),K.innerHTML=fe,Fe=i(),b(oe.$$.fragment),ke=i(),b(ne.$$.fragment),Me=i(),b(se.$$.fragment),ee=i(),D=d("div"),b(L.$$.fragment),me=i(),Ue=d("p"),Ue.textContent=he,Je=i(),b(ge.$$.fragment),P=i(),ue=d("p"),ue.innerHTML=ye,ae=i(),T=d("div"),b(C.$$.fragment),H=i(),B=d("p"),B.innerHTML=X,$e=i(),b(V.$$.fragment),I=i(),b(A.$$.fragment),this.h()},l(h){v(t.$$.fragment,h),p=l(h),o=c(h,"DIV",{class:!0});var k=re(o);v(a.$$.fragment,k),_=l(k),s=c(k,"P",{"data-svelte-h":!0}),g(s)!=="svelte-ulamh0"&&(s.innerHTML=x),ie=l(k),j=c(k,"DIV",{class:!0});var ze=re(j);v(R.$$.fragment,ze),le=l(ze),z=c(ze,"P",{"data-svelte-h":!0}),g(z)!=="svelte-3uwnv0"&&(z.innerHTML=S),de=l(ze),v(u.$$.fragment,ze),Z=l(ze),v(G.$$.fragment,ze),ze.forEach(n),k.forEach(n),E=l(h),v(Ce.$$.fragment,h),ve=l(h),J=c(h,"DIV",{class:!0});var _e=re(J);v(ce.$$.fragment,_e),pe=l(_e),O=c(_e,"P",{"data-svelte-h":!0}),g(O)!=="svelte-hwvz1m"&&(O.innerHTML=Ie),je=l(_e),v(N.$$.fragment,_e),Ne=l(_e),U=c(_e,"P",{"data-svelte-h":!0}),g(U)!=="svelte-1gjh92c"&&(U.innerHTML=te),xe=l(_e),q=c(_e,"DIV",{class:!0});var We=re(q);v(W.$$.fragment,We),Ve=l(We),K=c(We,"P",{"data-svelte-h":!0}),g(K)!=="svelte-1n4n93k"&&(K.innerHTML=fe),Fe=l(We),v(oe.$$.fragment,We),ke=l(We),v(ne.$$.fragment,We),We.forEach(n),_e.forEach(n),Me=l(h),v(se.$$.fragment,h),ee=l(h),D=c(h,"DIV",{class:!0});var Te=re(D);v(L.$$.fragment,Te),me=l(Te),Ue=c(Te,"P",{"data-svelte-h":!0}),g(Ue)!=="svelte-ju5wm2"&&(Ue.textContent=he),Je=l(Te),v(ge.$$.fragment,Te),P=l(Te),ue=c(Te,"P",{"data-svelte-h":!0}),g(ue)!=="svelte-1gjh92c"&&(ue.innerHTML=ye),ae=l(Te),T=c(Te,"DIV",{class:!0});var Pe=re(T);v(C.$$.fragment,Pe),H=l(Pe),B=c(Pe,"P",{"data-svelte-h":!0}),g(B)!=="svelte-10xtcj8"&&(B.innerHTML=X),$e=l(Pe),v(V.$$.fragment,Pe),I=l(Pe),v(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){y(t,h,k),r(h,p,k),r(h,o,k),y(a,o,null),m(o,_),m(o,s),m(o,ie),m(o,j),y(R,j,null),m(j,le),m(j,z),m(j,de),y(u,j,null),m(j,Z),y(G,j,null),r(h,E,k),y(Ce,h,k),r(h,ve,k),r(h,J,k),y(ce,J,null),m(J,pe),m(J,O),m(J,je),y(N,J,null),m(J,Ne),m(J,U),m(J,xe),m(J,q),y(W,q,null),m(q,Ve),m(q,K),m(q,Fe),y(oe,q,null),m(q,ke),y(ne,q,null),r(h,Me,k),y(se,h,k),r(h,ee,k),r(h,D,k),y(L,D,null),m(D,me),m(D,Ue),m(D,Je),y(ge,D,null),m(D,P),m(D,ue),m(D,ae),m(D,T),y(C,T,null),m(T,H),m(T,B),m(T,$e),y(V,T,null),m(T,I),y(A,T,null),Y=!0},p(h,k){const ze={};k&2&&(ze.$$scope={dirty:k,ctx:h}),u.$set(ze);const _e={};k&2&&(_e.$$scope={dirty:k,ctx:h}),G.$set(_e);const We={};k&2&&(We.$$scope={dirty:k,ctx:h}),N.$set(We);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}),V.$set(qe);const Ft={};k&2&&(Ft.$$scope={dirty:k,ctx:h}),A.$set(Ft)},i(h){Y||(w(t.$$.fragment,h),w(a.$$.fragment,h),w(R.$$.fragment,h),w(u.$$.fragment,h),w(G.$$.fragment,h),w(Ce.$$.fragment,h),w(ce.$$.fragment,h),w(N.$$.fragment,h),w(W.$$.fragment,h),w(oe.$$.fragment,h),w(ne.$$.fragment,h),w(se.$$.fragment,h),w(L.$$.fragment,h),w(ge.$$.fragment,h),w(C.$$.fragment,h),w(V.$$.fragment,h),w(A.$$.fragment,h),Y=!0)},o(h){M(t.$$.fragment,h),M(a.$$.fragment,h),M(R.$$.fragment,h),M(u.$$.fragment,h),M(G.$$.fragment,h),M(Ce.$$.fragment,h),M(ce.$$.fragment,h),M(N.$$.fragment,h),M(W.$$.fragment,h),M(oe.$$.fragment,h),M(ne.$$.fragment,h),M(se.$$.fragment,h),M(L.$$.fragment,h),M(ge.$$.fragment,h),M(C.$$.fragment,h),M(V.$$.fragment,h),M(A.$$.fragment,h),Y=!1},d(h){h&&(n(p),n(o),n(E),n(ve),n(J),n(Me),n(ee),n(D)),$(t,h),$(a),$(R),$(u),$(G),$(Ce,h),$(ce),$(N),$(W),$(oe),$(ne),$(se,h),$(L),$(ge),$(C),$(V),$(A)}}}function Ro(F){let t,p;return t=new ro({props:{$$slots:{default:[Po]},$$scope:{ctx:F}}}),{c(){b(t.$$.fragment)},l(o){v(t.$$.fragment,o)},m(o,a){y(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 Lo(F){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,R,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>`,z,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=d("p"),t.innerHTML=p,o=i(),a=d("ul"),a.innerHTML=_,s=i(),x=d("p"),x.innerHTML=ie,j=i(),R=d("ul"),R.innerHTML=le,z=i(),S=d("p"),S.innerHTML=de},l(u){t=c(u,"P",{"data-svelte-h":!0}),g(t)!=="svelte-1ajbfxg"&&(t.innerHTML=p),o=l(u),a=c(u,"UL",{"data-svelte-h":!0}),g(a)!=="svelte-qm1t26"&&(a.innerHTML=_),s=l(u),x=c(u,"P",{"data-svelte-h":!0}),g(x)!=="svelte-1v9qsc5"&&(x.innerHTML=ie),j=l(u),R=c(u,"UL",{"data-svelte-h":!0}),g(R)!=="svelte-99h8aq"&&(R.innerHTML=le),z=l(u),S=c(u,"P",{"data-svelte-h":!0}),g(S)!=="svelte-1an3odd"&&(S.innerHTML=de)},m(u,Z){r(u,t,Z),r(u,o,Z),r(u,a,Z),r(u,s,Z),r(u,x,Z),r(u,j,Z),r(u,R,Z),r(u,z,Z),r(u,S,Z)},p:we,d(u){u&&(n(t),n(o),n(a),n(s),n(x),n(j),n(R),n(z),n(S))}}}function Ho(F){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=d("p"),t.innerHTML=p},l(o){t=c(o,"P",{"data-svelte-h":!0}),g(t)!=="svelte-fincs2"&&(t.innerHTML=p)},m(o,a){r(o,t,a)},p:we,d(o){o&&n(t)}}}function Bo(F){let t,p="Example:",o,a,_;return a=new Xe({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=d("p"),t.textContent=p,o=i(),b(a.$$.fragment)},l(s){t=c(s,"P",{"data-svelte-h":!0}),g(t)!=="svelte-11lpom8"&&(t.textContent=p),o=l(s),v(a.$$.fragment,s)},m(s,x){r(s,t,x),r(s,o,x),y(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 Go(F){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=d("p"),t.innerHTML=p},l(o){t=c(o,"P",{"data-svelte-h":!0}),g(t)!=="svelte-111lhr1"&&(t.innerHTML=p)},m(o,a){r(o,t,a)},p:we,d(o){o&&n(t)}}}function qo(F){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,R,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>`,z,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=d("p"),t.innerHTML=p,o=i(),a=d("ul"),a.innerHTML=_,s=i(),x=d("p"),x.innerHTML=ie,j=i(),R=d("ul"),R.innerHTML=le,z=i(),S=d("p"),S.innerHTML=de},l(u){t=c(u,"P",{"data-svelte-h":!0}),g(t)!=="svelte-1ajbfxg"&&(t.innerHTML=p),o=l(u),a=c(u,"UL",{"data-svelte-h":!0}),g(a)!=="svelte-qm1t26"&&(a.innerHTML=_),s=l(u),x=c(u,"P",{"data-svelte-h":!0}),g(x)!=="svelte-1v9qsc5"&&(x.innerHTML=ie),j=l(u),R=c(u,"UL",{"data-svelte-h":!0}),g(R)!=="svelte-99h8aq"&&(R.innerHTML=le),z=l(u),S=c(u,"P",{"data-svelte-h":!0}),g(S)!=="svelte-1an3odd"&&(S.innerHTML=de)},m(u,Z){r(u,t,Z),r(u,o,Z),r(u,a,Z),r(u,s,Z),r(u,x,Z),r(u,j,Z),r(u,R,Z),r(u,z,Z),r(u,S,Z)},p:we,d(u){u&&(n(t),n(o),n(a),n(s),n(x),n(j),n(R),n(z),n(S))}}}function Eo(F){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=d("p"),t.innerHTML=p},l(o){t=c(o,"P",{"data-svelte-h":!0}),g(t)!=="svelte-fincs2"&&(t.innerHTML=p)},m(o,a){r(o,t,a)},p:we,d(o){o&&n(t)}}}function Xo(F){let t,p="Example:",o,a,_;return a=new Xe({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=d("p"),t.textContent=p,o=i(),b(a.$$.fragment)},l(s){t=c(s,"P",{"data-svelte-h":!0}),g(t)!=="svelte-11lpom8"&&(t.textContent=p),o=l(s),v(a.$$.fragment,s)},m(s,x){r(s,t,x),r(s,o,x),y(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 So(F){let t,p,o,a,_,s,x="The bare ViT Model transformer outputting raw hidden-states without any specific head on top.",ie,j,R=`This model inherits from <a href="/docs/transformers/pr_30623/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,z,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,Z,G,E,Ce,ve,J='The <a href="/docs/transformers/pr_30623/en/model_doc/vit#transformers.TFViTModel">TFViTModel</a> forward method, overrides the <code>__call__</code> special method.',ce,pe,O,Ie,je,N,Ne,U,te,xe,q,W=`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.`,Ve,K,fe,Fe,oe=`This model inherits from <a href="/docs/transformers/pr_30623/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,L,me,Ue,he,Je='The <a href="/docs/transformers/pr_30623/en/model_doc/vit#transformers.TFViTForImageClassification">TFViTForImageClassification</a> forward method, overrides the <code>__call__</code> special method.',ge,P,ue,ye,ae;return t=new Ze({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_30623/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_30623/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_30623/src/transformers/models/vit/modeling_tf_vit.py#L736"}}),u=new Le({props:{$$slots:{default:[Lo]},$$scope:{ctx:F}}}),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_30623/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/pr_30623/en/model_doc/perceiver#transformers.PerceiverFeatureExtractor.__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_30623/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_30623/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_30623/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_30623/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_30623/en/main_classes/output#transformers.modeling_tf_outputs.TFBaseModelOutputWithPooling"
>transformers.modeling_tf_outputs.TFBaseModelOutputWithPooling</a> or <code>tuple(tf.Tensor)</code></p>
`}}),pe=new Le({props:{$$slots:{default:[Ho]},$$scope:{ctx:F}}}),Ie=new Oe({props:{anchor:"transformers.TFViTModel.call.example",$$slots:{default:[Bo]},$$scope:{ctx:F}}}),N=new Ze({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_30623/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_30623/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_30623/src/transformers/models/vit/modeling_tf_vit.py#L815"}}),K=new Le({props:{$$slots:{default:[Go]},$$scope:{ctx:F}}}),ee=new Le({props:{$$slots:{default:[qo]},$$scope:{ctx:F}}}),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_30623/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/pr_30623/en/model_doc/perceiver#transformers.PerceiverFeatureExtractor.__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_30623/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_30623/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_30623/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_30623/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_30623/en/main_classes/output#transformers.modeling_tf_outputs.TFSequenceClassifierOutput"
>transformers.modeling_tf_outputs.TFSequenceClassifierOutput</a> or <code>tuple(tf.Tensor)</code></p>
`}}),P=new Le({props:{$$slots:{default:[Eo]},$$scope:{ctx:F}}}),ye=new Oe({props:{anchor:"transformers.TFViTForImageClassification.call.example",$$slots:{default:[Xo]},$$scope:{ctx:F}}}),{c(){b(t.$$.fragment),p=i(),o=d("div"),b(a.$$.fragment),_=i(),s=d("p"),s.textContent=x,ie=i(),j=d("p"),j.innerHTML=R,le=i(),z=d("p"),z.innerHTML=S,de=i(),b(u.$$.fragment),Z=i(),G=d("div"),b(E.$$.fragment),Ce=i(),ve=d("p"),ve.innerHTML=J,ce=i(),b(pe.$$.fragment),O=i(),b(Ie.$$.fragment),je=i(),b(N.$$.fragment),Ne=i(),U=d("div"),b(te.$$.fragment),xe=i(),q=d("p"),q.textContent=W,Ve=i(),b(K.$$.fragment),fe=i(),Fe=d("p"),Fe.innerHTML=oe,ke=i(),ne=d("p"),ne.innerHTML=Me,se=i(),b(ee.$$.fragment),D=i(),L=d("div"),b(me.$$.fragment),Ue=i(),he=d("p"),he.innerHTML=Je,ge=i(),b(P.$$.fragment),ue=i(),b(ye.$$.fragment),this.h()},l(T){v(t.$$.fragment,T),p=l(T),o=c(T,"DIV",{class:!0});var C=re(o);v(a.$$.fragment,C),_=l(C),s=c(C,"P",{"data-svelte-h":!0}),g(s)!=="svelte-1vbye9a"&&(s.textContent=x),ie=l(C),j=c(C,"P",{"data-svelte-h":!0}),g(j)!=="svelte-1lnvfl4"&&(j.innerHTML=R),le=l(C),z=c(C,"P",{"data-svelte-h":!0}),g(z)!=="svelte-1be7e3c"&&(z.innerHTML=S),de=l(C),v(u.$$.fragment,C),Z=l(C),G=c(C,"DIV",{class:!0});var H=re(G);v(E.$$.fragment,H),Ce=l(H),ve=c(H,"P",{"data-svelte-h":!0}),g(ve)!=="svelte-2upito"&&(ve.innerHTML=J),ce=l(H),v(pe.$$.fragment,H),O=l(H),v(Ie.$$.fragment,H),H.forEach(n),C.forEach(n),je=l(T),v(N.$$.fragment,T),Ne=l(T),U=c(T,"DIV",{class:!0});var B=re(U);v(te.$$.fragment,B),xe=l(B),q=c(B,"P",{"data-svelte-h":!0}),g(q)!=="svelte-ju5wm2"&&(q.textContent=W),Ve=l(B),v(K.$$.fragment,B),fe=l(B),Fe=c(B,"P",{"data-svelte-h":!0}),g(Fe)!=="svelte-1lnvfl4"&&(Fe.innerHTML=oe),ke=l(B),ne=c(B,"P",{"data-svelte-h":!0}),g(ne)!=="svelte-1be7e3c"&&(ne.innerHTML=Me),se=l(B),v(ee.$$.fragment,B),D=l(B),L=c(B,"DIV",{class:!0});var X=re(L);v(me.$$.fragment,X),Ue=l(X),he=c(X,"P",{"data-svelte-h":!0}),g(he)!=="svelte-1jop1a0"&&(he.innerHTML=Je),ge=l(X),v(P.$$.fragment,X),ue=l(X),v(ye.$$.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(L,"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){y(t,T,C),r(T,p,C),r(T,o,C),y(a,o,null),m(o,_),m(o,s),m(o,ie),m(o,j),m(o,le),m(o,z),m(o,de),y(u,o,null),m(o,Z),m(o,G),y(E,G,null),m(G,Ce),m(G,ve),m(G,ce),y(pe,G,null),m(G,O),y(Ie,G,null),r(T,je,C),y(N,T,C),r(T,Ne,C),r(T,U,C),y(te,U,null),m(U,xe),m(U,q),m(U,Ve),y(K,U,null),m(U,fe),m(U,Fe),m(U,ke),m(U,ne),m(U,se),y(ee,U,null),m(U,D),m(U,L),y(me,L,null),m(L,Ue),m(L,he),m(L,ge),y(P,L,null),m(L,ue),y(ye,L,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 V={};C&2&&(V.$$scope={dirty:C,ctx:T}),ee.$set(V);const I={};C&2&&(I.$$scope={dirty:C,ctx:T}),P.$set(I);const A={};C&2&&(A.$$scope={dirty:C,ctx:T}),ye.$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(N.$$.fragment,T),w(te.$$.fragment,T),w(K.$$.fragment,T),w(ee.$$.fragment,T),w(me.$$.fragment,T),w(P.$$.fragment,T),w(ye.$$.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(N.$$.fragment,T),M(te.$$.fragment,T),M(K.$$.fragment,T),M(ee.$$.fragment,T),M(me.$$.fragment,T),M(P.$$.fragment,T),M(ye.$$.fragment,T),ae=!1},d(T){T&&(n(p),n(o),n(je),n(Ne),n(U)),$(t,T),$(a),$(u),$(E),$(pe),$(Ie),$(N,T),$(te),$(K),$(ee),$(me),$(P),$(ye)}}}function Yo(F){let t,p;return t=new ro({props:{$$slots:{default:[So]},$$scope:{ctx:F}}}),{c(){b(t.$$.fragment)},l(o){v(t.$$.fragment,o)},m(o,a){y(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 Do(F){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=d("p"),t.innerHTML=p},l(o){t=c(o,"P",{"data-svelte-h":!0}),g(t)!=="svelte-fincs2"&&(t.innerHTML=p)},m(o,a){r(o,t,a)},p:we,d(o){o&&n(t)}}}function Ao(F){let t,p="Examples:",o,a,_;return a=new Xe({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=d("p"),t.textContent=p,o=i(),b(a.$$.fragment)},l(s){t=c(s,"P",{"data-svelte-h":!0}),g(t)!=="svelte-kvfsh7"&&(t.textContent=p),o=l(s),v(a.$$.fragment,s)},m(s,x){r(s,t,x),r(s,o,x),y(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 Qo(F){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=d("p"),t.innerHTML=p},l(o){t=c(o,"P",{"data-svelte-h":!0}),g(t)!=="svelte-fincs2"&&(t.innerHTML=p)},m(o,a){r(o,t,a)},p:we,d(o){o&&n(t)}}}function Oo(F){let t,p="Example:",o,a,_;return a=new Xe({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=d("p"),t.textContent=p,o=i(),b(a.$$.fragment)},l(s){t=c(s,"P",{"data-svelte-h":!0}),g(t)!=="svelte-11lpom8"&&(t.textContent=p),o=l(s),v(a.$$.fragment,s)},m(s,x){r(s,t,x),r(s,o,x),y(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 Ko(F){let t,p,o,a,_,s,x="The bare ViT Model transformer outputting raw hidden-states without any specific head on top.",ie,j,R=`This model inherits from <a href="/docs/transformers/pr_30623/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,z,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,Z="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>',ve,J,ce,pe,O,Ie="The <code>FlaxViTPreTrainedModel</code> forward method, overrides the <code>__call__</code> special method.",je,N,Ne,U,te,xe,q,W,Ve,K,fe,Fe=`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_30623/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,L,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,ye,ae,T="The <code>FlaxViTPreTrainedModel</code> forward method, overrides the <code>__call__</code> special method.",C,H,B,X,$e;return t=new Ze({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_30623/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_30623/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_30623/en/main_classes/model#transformers.FlaxPreTrainedModel.to_fp16">to_fp16()</a> and
<a href="/docs/transformers/pr_30623/en/main_classes/model#transformers.FlaxPreTrainedModel.to_bf16">to_bf16()</a>.`,name:"dtype"}],source:"https://github.com/huggingface/transformers/blob/vr_30623/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:": PRNGKey = None"},{name:"train",val:": bool = False"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = None"}],source:"https://github.com/huggingface/transformers/blob/vr_30623/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_30623/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_30623/en/main_classes/output#transformers.modeling_flax_outputs.FlaxBaseModelOutputWithPooling"
>transformers.modeling_flax_outputs.FlaxBaseModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),N=new Le({props:{$$slots:{default:[Do]},$$scope:{ctx:F}}}),U=new Oe({props:{anchor:"transformers.FlaxViTModel.__call__.example",$$slots:{default:[Ao]},$$scope:{ctx:F}}}),xe=new Ze({props:{title:"FlaxViTForImageClassification",local:"transformers.FlaxViTForImageClassification",headingTag:"h2"}}),Ve=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_30623/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_30623/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_30623/en/main_classes/model#transformers.FlaxPreTrainedModel.to_fp16">to_fp16()</a> and
<a href="/docs/transformers/pr_30623/en/main_classes/model#transformers.FlaxPreTrainedModel.to_bf16">to_bf16()</a>.`,name:"dtype"}],source:"https://github.com/huggingface/transformers/blob/vr_30623/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:": PRNGKey = None"},{name:"train",val:": bool = False"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = None"}],source:"https://github.com/huggingface/transformers/blob/vr_30623/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_30623/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_30623/en/main_classes/output#transformers.modeling_flax_outputs.FlaxSequenceClassifierOutput"
>transformers.modeling_flax_outputs.FlaxSequenceClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),H=new Le({props:{$$slots:{default:[Qo]},$$scope:{ctx:F}}}),X=new Oe({props:{anchor:"transformers.FlaxViTForImageClassification.__call__.example",$$slots:{default:[Oo]},$$scope:{ctx:F}}}),{c(){b(t.$$.fragment),p=i(),o=d("div"),b(a.$$.fragment),_=i(),s=d("p"),s.textContent=x,ie=i(),j=d("p"),j.innerHTML=R,le=i(),z=d("p"),z.innerHTML=S,de=i(),u=d("p"),u.textContent=Z,G=i(),E=d("ul"),E.innerHTML=Ce,ve=i(),J=d("div"),b(ce.$$.fragment),pe=i(),O=d("p"),O.innerHTML=Ie,je=i(),b(N.$$.fragment),Ne=i(),b(U.$$.fragment),te=i(),b(xe.$$.fragment),q=i(),W=d("div"),b(Ve.$$.fragment),K=i(),fe=d("p"),fe.textContent=Fe,oe=i(),ke=d("p"),ke.innerHTML=ne,Me=i(),se=d("p"),se.innerHTML=ee,D=i(),L=d("p"),L.textContent=me,Ue=i(),he=d("ul"),he.innerHTML=Je,ge=i(),P=d("div"),b(ue.$$.fragment),ye=i(),ae=d("p"),ae.innerHTML=T,C=i(),b(H.$$.fragment),B=i(),b(X.$$.fragment),this.h()},l(V){v(t.$$.fragment,V),p=l(V),o=c(V,"DIV",{class:!0});var I=re(o);v(a.$$.fragment,I),_=l(I),s=c(I,"P",{"data-svelte-h":!0}),g(s)!=="svelte-1vbye9a"&&(s.textContent=x),ie=l(I),j=c(I,"P",{"data-svelte-h":!0}),g(j)!=="svelte-52vnf5"&&(j.innerHTML=R),le=l(I),z=c(I,"P",{"data-svelte-h":!0}),g(z)!=="svelte-10nfsf3"&&(z.innerHTML=S),de=l(I),u=c(I,"P",{"data-svelte-h":!0}),g(u)!=="svelte-1pplc4a"&&(u.textContent=Z),G=l(I),E=c(I,"UL",{"data-svelte-h":!0}),g(E)!=="svelte-1w7z84m"&&(E.innerHTML=Ce),ve=l(I),J=c(I,"DIV",{class:!0});var A=re(J);v(ce.$$.fragment,A),pe=l(A),O=c(A,"P",{"data-svelte-h":!0}),g(O)!=="svelte-8rbifc"&&(O.innerHTML=Ie),je=l(A),v(N.$$.fragment,A),Ne=l(A),v(U.$$.fragment,A),A.forEach(n),I.forEach(n),te=l(V),v(xe.$$.fragment,V),q=l(V),W=c(V,"DIV",{class:!0});var Y=re(W);v(Ve.$$.fragment,Y),K=l(Y),fe=c(Y,"P",{"data-svelte-h":!0}),g(fe)!=="svelte-ju5wm2"&&(fe.textContent=Fe),oe=l(Y),ke=c(Y,"P",{"data-svelte-h":!0}),g(ke)!=="svelte-52vnf5"&&(ke.innerHTML=ne),Me=l(Y),se=c(Y,"P",{"data-svelte-h":!0}),g(se)!=="svelte-10nfsf3"&&(se.innerHTML=ee),D=l(Y),L=c(Y,"P",{"data-svelte-h":!0}),g(L)!=="svelte-1pplc4a"&&(L.textContent=me),Ue=l(Y),he=c(Y,"UL",{"data-svelte-h":!0}),g(he)!=="svelte-1w7z84m"&&(he.innerHTML=Je),ge=l(Y),P=c(Y,"DIV",{class:!0});var h=re(P);v(ue.$$.fragment,h),ye=l(h),ae=c(h,"P",{"data-svelte-h":!0}),g(ae)!=="svelte-8rbifc"&&(ae.innerHTML=T),C=l(h),v(H.$$.fragment,h),B=l(h),v(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(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(V,I){y(t,V,I),r(V,p,I),r(V,o,I),y(a,o,null),m(o,_),m(o,s),m(o,ie),m(o,j),m(o,le),m(o,z),m(o,de),m(o,u),m(o,G),m(o,E),m(o,ve),m(o,J),y(ce,J,null),m(J,pe),m(J,O),m(J,je),y(N,J,null),m(J,Ne),y(U,J,null),r(V,te,I),y(xe,V,I),r(V,q,I),r(V,W,I),y(Ve,W,null),m(W,K),m(W,fe),m(W,oe),m(W,ke),m(W,Me),m(W,se),m(W,D),m(W,L),m(W,Ue),m(W,he),m(W,ge),m(W,P),y(ue,P,null),m(P,ye),m(P,ae),m(P,C),y(H,P,null),m(P,B),y(X,P,null),$e=!0},p(V,I){const A={};I&2&&(A.$$scope={dirty:I,ctx:V}),N.$set(A);const Y={};I&2&&(Y.$$scope={dirty:I,ctx:V}),U.$set(Y);const h={};I&2&&(h.$$scope={dirty:I,ctx:V}),H.$set(h);const k={};I&2&&(k.$$scope={dirty:I,ctx:V}),X.$set(k)},i(V){$e||(w(t.$$.fragment,V),w(a.$$.fragment,V),w(ce.$$.fragment,V),w(N.$$.fragment,V),w(U.$$.fragment,V),w(xe.$$.fragment,V),w(Ve.$$.fragment,V),w(ue.$$.fragment,V),w(H.$$.fragment,V),w(X.$$.fragment,V),$e=!0)},o(V){M(t.$$.fragment,V),M(a.$$.fragment,V),M(ce.$$.fragment,V),M(N.$$.fragment,V),M(U.$$.fragment,V),M(xe.$$.fragment,V),M(Ve.$$.fragment,V),M(ue.$$.fragment,V),M(H.$$.fragment,V),M(X.$$.fragment,V),$e=!1},d(V){V&&(n(p),n(o),n(te),n(q),n(W)),$(t,V),$(a),$(ce),$(N),$(U),$(xe,V),$(Ve),$(ue),$(H),$(X)}}}function en(F){let t,p;return t=new ro({props:{$$slots:{default:[Ko]},$$scope:{ctx:F}}}),{c(){b(t.$$.fragment)},l(o){v(t.$$.fragment,o)},m(o,a){y(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 tn(F){let t,p,o,a,_,s,x,ie,j,R=`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,z,S="The abstract from the paper is the following:",de,u,Z=`<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,ve,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,N,Ne=`<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_30623/en/model_doc/vit#transformers.ViTModel">ViTModel</a> or
<a href="/docs/transformers/pr_30623/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_30623/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,W,Ve=`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,Fe,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_30623/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.`,L,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>).",ye,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,V,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:",ze,_e,We,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,Ft="⚗️ Optimization",It,et,io='<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>',jt,tt,lo="⚡️ Inference",kt,ot,co='<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>',Ut,nt,mo="🚀 Deploy",Jt,st,po='<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>',zt,at,Wt,Re,rt,Dt,Tt,fo=`This is the configuration class to store the configuration of a <a href="/docs/transformers/pr_30623/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.`,At,bt,ho=`Configuration objects inherit from <a href="/docs/transformers/pr_30623/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_30623/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,Qt,Se,Zt,it,Nt,Ee,lt,Ot,Ye,dt,Kt,vt,go="Preprocess an image or a batch of images.",Pt,ct,Rt,He,mt,eo,yt,uo="Constructs a ViT image processor.",to,De,pt,oo,wt,_o="Preprocess an image or batch of images.",Lt,ft,Ht,Be,ht,no,Mt,To="Constructs a ViT image processor.",so,Ae,gt,ao,$t,bo="Preprocess an image or batch of images.",Bt,Qe,Gt,ut,qt,Ct,Et;return _=new Ze({props:{title:"Vision Transformer (ViT)",local:"vision-transformer-vit",headingTag:"h1"}}),x=new Ze({props:{title:"Overview",local:"overview",headingTag:"h2"}}),fe=new Ze({props:{title:"Usage tips",local:"usage-tips",headingTag:"h2"}}),Me=new Ze({props:{title:"Using Scaled Dot Product Attention (SDPA)",local:"using-scaled-dot-product-attention-sdpa",headingTag:"h3"}}),Je=new Xe({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 Ze({props:{title:"Resources",local:"resources",headingTag:"h2"}}),_e=new Fo({props:{pipeline:"image-classification"}}),at=new Ze({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_30623/src/transformers/models/vit/configuration_vit.py#L30"}}),Se=new Oe({props:{anchor:"transformers.ViTConfig.example",$$slots:{default:[Io]},$$scope:{ctx:F}}}),it=new Ze({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_30623/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_30623/src/transformers/image_processing_utils.py#L39"}}),ct=new Ze({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:": Optional = None"},{name:"resample",val:": Resampling = <Resampling.BILINEAR: 2>"},{name:"do_rescale",val:": bool = True"},{name:"rescale_factor",val:": Union = 0.00392156862745098"},{name:"do_normalize",val:": bool = True"},{name:"image_mean",val:": Union = None"},{name:"image_std",val:": Union = 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"}],source:"https://github.com/huggingface/transformers/blob/vr_30623/src/transformers/models/vit/image_processing_vit.py#L43"}}),pt=new be({props:{name:"preprocess",anchor:"transformers.ViTImageProcessor.preprocess",parameters:[{name:"images",val:": Union"},{name:"do_resize",val:": Optional = None"},{name:"size",val:": Dict = None"},{name:"resample",val:": Resampling = None"},{name:"do_rescale",val:": Optional = None"},{name:"rescale_factor",val:": Optional = None"},{name:"do_normalize",val:": Optional = None"},{name:"image_mean",val:": Union = None"},{name:"image_std",val:": Union = None"},{name:"return_tensors",val:": Union = None"},{name:"data_format",val:": Union = <ChannelDimension.FIRST: 'channels_first'>"},{name:"input_data_format",val:": Union = None"},{name:"**kwargs",val:""}],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"}],source:"https://github.com/huggingface/transformers/blob/vr_30623/src/transformers/models/vit/image_processing_vit.py#L162"}}),ft=new Ze({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:": Optional = None"},{name:"resample",val:": Resampling = <Resampling.BILINEAR: 2>"},{name:"do_rescale",val:": bool = True"},{name:"rescale_factor",val:": Union = 0.00392156862745098"},{name:"do_normalize",val:": bool = True"},{name:"image_mean",val:": Union = None"},{name:"image_std",val:": Union = 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"}],source:"https://github.com/huggingface/transformers/blob/vr_30623/src/transformers/models/vit/image_processing_vit_fast.py#L50"}}),gt=new be({props:{name:"preprocess",anchor:"transformers.ViTImageProcessorFast.preprocess",parameters:[{name:"images",val:": Union"},{name:"do_resize",val:": Optional = None"},{name:"size",val:": Dict = None"},{name:"resample",val:": Resampling = None"},{name:"do_rescale",val:": Optional = None"},{name:"rescale_factor",val:": Optional = None"},{name:"do_normalize",val:": Optional = None"},{name:"image_mean",val:": Union = None"},{name:"image_std",val:": Union = None"},{name:"return_tensors",val:": Union = 'pt'"},{name:"data_format",val:": Union = <ChannelDimension.FIRST: 'channels_first'>"},{name:"input_data_format",val:": Union = 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_30623/src/transformers/models/vit/image_processing_vit_fast.py#L189"}}),Qe=new Vo({props:{pytorch:!0,tensorflow:!0,jax:!0,$$slots:{jax:[en],tensorflow:[Yo],pytorch:[Ro]},$$scope:{ctx:F}}}),ut=new Co({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/model_doc/vit.md"}}),{c(){t=d("meta"),p=i(),o=d("p"),a=i(),b(_.$$.fragment),s=i(),b(x.$$.fragment),ie=i(),j=d("p"),j.innerHTML=R,le=i(),z=d("p"),z.textContent=S,de=i(),u=d("p"),u.innerHTML=Z,G=i(),E=d("img"),ve=i(),J=d("small"),J.innerHTML=ce,pe=i(),O=d("p"),O.textContent=Ie,je=i(),N=d("ul"),N.innerHTML=Ne,U=i(),te=d("p"),te.innerHTML=xe,q=i(),W=d("p"),W.innerHTML=Ve,K=i(),b(fe.$$.fragment),Fe=i(),oe=d("ul"),oe.innerHTML=ke,ne=i(),b(Me.$$.fragment),se=i(),ee=d("p"),ee.innerHTML=D,L=i(),me=d("p"),me.innerHTML=Ue,he=i(),b(Je.$$.fragment),ge=i(),P=d("p"),P.innerHTML=ue,ye=i(),ae=d("p"),ae.innerHTML=T,C=i(),H=d("table"),H.innerHTML=B,X=i(),b($e.$$.fragment),V=i(),I=d("p"),I.innerHTML=A,Y=i(),h=d("p"),h.innerHTML=k,ze=i(),b(_e.$$.fragment),We=i(),Te=d("ul"),Te.innerHTML=Pe,Ke=i(),qe=d("p"),qe.textContent=Ft,It=i(),et=d("ul"),et.innerHTML=io,jt=i(),tt=d("p"),tt.textContent=lo,kt=i(),ot=d("ul"),ot.innerHTML=co,Ut=i(),nt=d("p"),nt.textContent=mo,Jt=i(),st=d("ul"),st.innerHTML=po,zt=i(),b(at.$$.fragment),Wt=i(),Re=d("div"),b(rt.$$.fragment),Dt=i(),Tt=d("p"),Tt.innerHTML=fo,At=i(),bt=d("p"),bt.innerHTML=ho,Qt=i(),b(Se.$$.fragment),Zt=i(),b(it.$$.fragment),Nt=i(),Ee=d("div"),b(lt.$$.fragment),Ot=i(),Ye=d("div"),b(dt.$$.fragment),Kt=i(),vt=d("p"),vt.textContent=go,Pt=i(),b(ct.$$.fragment),Rt=i(),He=d("div"),b(mt.$$.fragment),eo=i(),yt=d("p"),yt.textContent=uo,to=i(),De=d("div"),b(pt.$$.fragment),oo=i(),wt=d("p"),wt.textContent=_o,Lt=i(),b(ft.$$.fragment),Ht=i(),Be=d("div"),b(ht.$$.fragment),no=i(),Mt=d("p"),Mt.textContent=To,so=i(),Ae=d("div"),b(gt.$$.fragment),ao=i(),$t=d("p"),$t.textContent=bo,Bt=i(),b(Qe.$$.fragment),Gt=i(),b(ut.$$.fragment),qt=i(),Ct=d("p"),this.h()},l(e){const f=xo("svelte-u9bgzb",document.head);t=c(f,"META",{name:!0,content:!0}),f.forEach(n),p=l(e),o=c(e,"P",{}),re(o).forEach(n),a=l(e),v(_.$$.fragment,e),s=l(e),v(x.$$.fragment,e),ie=l(e),j=c(e,"P",{"data-svelte-h":!0}),g(j)!=="svelte-mxwj6a"&&(j.innerHTML=R),le=l(e),z=c(e,"P",{"data-svelte-h":!0}),g(z)!=="svelte-vfdo9a"&&(z.textContent=S),de=l(e),u=c(e,"P",{"data-svelte-h":!0}),g(u)!=="svelte-yjj3f8"&&(u.innerHTML=Z),G=l(e),E=c(e,"IMG",{src:!0,alt:!0,width:!0}),ve=l(e),J=c(e,"SMALL",{"data-svelte-h":!0}),g(J)!=="svelte-7mkw5i"&&(J.innerHTML=ce),pe=l(e),O=c(e,"P",{"data-svelte-h":!0}),g(O)!=="svelte-ghhnmw"&&(O.textContent=Ie),je=l(e),N=c(e,"UL",{"data-svelte-h":!0}),g(N)!=="svelte-j3dtx6"&&(N.innerHTML=Ne),U=l(e),te=c(e,"P",{"data-svelte-h":!0}),g(te)!=="svelte-pwnwoc"&&(te.innerHTML=xe),q=l(e),W=c(e,"P",{"data-svelte-h":!0}),g(W)!=="svelte-11xcw47"&&(W.innerHTML=Ve),K=l(e),v(fe.$$.fragment,e),Fe=l(e),oe=c(e,"UL",{"data-svelte-h":!0}),g(oe)!=="svelte-kzedgi"&&(oe.innerHTML=ke),ne=l(e),v(Me.$$.fragment,e),se=l(e),ee=c(e,"P",{"data-svelte-h":!0}),g(ee)!=="svelte-1cid2pe"&&(ee.innerHTML=D),L=l(e),me=c(e,"P",{"data-svelte-h":!0}),g(me)!=="svelte-1x11lxg"&&(me.innerHTML=Ue),he=l(e),v(Je.$$.fragment,e),ge=l(e),P=c(e,"P",{"data-svelte-h":!0}),g(P)!=="svelte-djb2w0"&&(P.innerHTML=ue),ye=l(e),ae=c(e,"P",{"data-svelte-h":!0}),g(ae)!=="svelte-18g4o0h"&&(ae.innerHTML=T),C=l(e),H=c(e,"TABLE",{"data-svelte-h":!0}),g(H)!=="svelte-vyu660"&&(H.innerHTML=B),X=l(e),v($e.$$.fragment,e),V=l(e),I=c(e,"P",{"data-svelte-h":!0}),g(I)!=="svelte-152spv0"&&(I.innerHTML=A),Y=l(e),h=c(e,"P",{"data-svelte-h":!0}),g(h)!=="svelte-qrf7lp"&&(h.innerHTML=k),ze=l(e),v(_e.$$.fragment,e),We=l(e),Te=c(e,"UL",{"data-svelte-h":!0}),g(Te)!=="svelte-1fybkhs"&&(Te.innerHTML=Pe),Ke=l(e),qe=c(e,"P",{"data-svelte-h":!0}),g(qe)!=="svelte-liq2q7"&&(qe.textContent=Ft),It=l(e),et=c(e,"UL",{"data-svelte-h":!0}),g(et)!=="svelte-1vxkfqp"&&(et.innerHTML=io),jt=l(e),tt=c(e,"P",{"data-svelte-h":!0}),g(tt)!=="svelte-1wntqpp"&&(tt.textContent=lo),kt=l(e),ot=c(e,"UL",{"data-svelte-h":!0}),g(ot)!=="svelte-1q3e2i6"&&(ot.innerHTML=co),Ut=l(e),nt=c(e,"P",{"data-svelte-h":!0}),g(nt)!=="svelte-lk14e4"&&(nt.textContent=mo),Jt=l(e),st=c(e,"UL",{"data-svelte-h":!0}),g(st)!=="svelte-1e4wiq4"&&(st.innerHTML=po),zt=l(e),v(at.$$.fragment,e),Wt=l(e),Re=c(e,"DIV",{class:!0});var Ge=re(Re);v(rt.$$.fragment,Ge),Dt=l(Ge),Tt=c(Ge,"P",{"data-svelte-h":!0}),g(Tt)!=="svelte-ids410"&&(Tt.innerHTML=fo),At=l(Ge),bt=c(Ge,"P",{"data-svelte-h":!0}),g(bt)!=="svelte-fjppdv"&&(bt.innerHTML=ho),Qt=l(Ge),v(Se.$$.fragment,Ge),Ge.forEach(n),Zt=l(e),v(it.$$.fragment,e),Nt=l(e),Ee=c(e,"DIV",{class:!0});var _t=re(Ee);v(lt.$$.fragment,_t),Ot=l(_t),Ye=c(_t,"DIV",{class:!0});var Xt=re(Ye);v(dt.$$.fragment,Xt),Kt=l(Xt),vt=c(Xt,"P",{"data-svelte-h":!0}),g(vt)!=="svelte-khengj"&&(vt.textContent=go),Xt.forEach(n),_t.forEach(n),Pt=l(e),v(ct.$$.fragment,e),Rt=l(e),He=c(e,"DIV",{class:!0});var xt=re(He);v(mt.$$.fragment,xt),eo=l(xt),yt=c(xt,"P",{"data-svelte-h":!0}),g(yt)!=="svelte-1ebexfn"&&(yt.textContent=uo),to=l(xt),De=c(xt,"DIV",{class:!0});var St=re(De);v(pt.$$.fragment,St),oo=l(St),wt=c(St,"P",{"data-svelte-h":!0}),g(wt)!=="svelte-1x3yxsa"&&(wt.textContent=_o),St.forEach(n),xt.forEach(n),Lt=l(e),v(ft.$$.fragment,e),Ht=l(e),Be=c(e,"DIV",{class:!0});var Vt=re(Be);v(ht.$$.fragment,Vt),no=l(Vt),Mt=c(Vt,"P",{"data-svelte-h":!0}),g(Mt)!=="svelte-1ebexfn"&&(Mt.textContent=To),so=l(Vt),Ae=c(Vt,"DIV",{class:!0});var Yt=re(Ae);v(gt.$$.fragment,Yt),ao=l(Yt),$t=c(Yt,"P",{"data-svelte-h":!0}),g($t)!=="svelte-1x3yxsa"&&($t.textContent=bo),Yt.forEach(n),Vt.forEach(n),Bt=l(e),v(Qe.$$.fragment,e),Gt=l(e),v(ut.$$.fragment,e),qt=l(e),Ct=c(e,"P",{}),re(Ct).forEach(n),this.h()},h(){Q(t,"name","hf:doc:metadata"),Q(t,"content",on),yo(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(Re,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Q(Ye,"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(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(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(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(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){m(document.head,t),r(e,p,f),r(e,o,f),r(e,a,f),y(_,e,f),r(e,s,f),y(x,e,f),r(e,ie,f),r(e,j,f),r(e,le,f),r(e,z,f),r(e,de,f),r(e,u,f),r(e,G,f),r(e,E,f),r(e,ve,f),r(e,J,f),r(e,pe,f),r(e,O,f),r(e,je,f),r(e,N,f),r(e,U,f),r(e,te,f),r(e,q,f),r(e,W,f),r(e,K,f),y(fe,e,f),r(e,Fe,f),r(e,oe,f),r(e,ne,f),y(Me,e,f),r(e,se,f),r(e,ee,f),r(e,L,f),r(e,me,f),r(e,he,f),y(Je,e,f),r(e,ge,f),r(e,P,f),r(e,ye,f),r(e,ae,f),r(e,C,f),r(e,H,f),r(e,X,f),y($e,e,f),r(e,V,f),r(e,I,f),r(e,Y,f),r(e,h,f),r(e,ze,f),y(_e,e,f),r(e,We,f),r(e,Te,f),r(e,Ke,f),r(e,qe,f),r(e,It,f),r(e,et,f),r(e,jt,f),r(e,tt,f),r(e,kt,f),r(e,ot,f),r(e,Ut,f),r(e,nt,f),r(e,Jt,f),r(e,st,f),r(e,zt,f),y(at,e,f),r(e,Wt,f),r(e,Re,f),y(rt,Re,null),m(Re,Dt),m(Re,Tt),m(Re,At),m(Re,bt),m(Re,Qt),y(Se,Re,null),r(e,Zt,f),y(it,e,f),r(e,Nt,f),r(e,Ee,f),y(lt,Ee,null),m(Ee,Ot),m(Ee,Ye),y(dt,Ye,null),m(Ye,Kt),m(Ye,vt),r(e,Pt,f),y(ct,e,f),r(e,Rt,f),r(e,He,f),y(mt,He,null),m(He,eo),m(He,yt),m(He,to),m(He,De),y(pt,De,null),m(De,oo),m(De,wt),r(e,Lt,f),y(ft,e,f),r(e,Ht,f),r(e,Be,f),y(ht,Be,null),m(Be,no),m(Be,Mt),m(Be,so),m(Be,Ae),y(gt,Ae,null),m(Ae,ao),m(Ae,$t),r(e,Bt,f),y(Qe,e,f),r(e,Gt,f),y(ut,e,f),r(e,qt,f),r(e,Ct,f),Et=!0},p(e,[f]){const Ge={};f&2&&(Ge.$$scope={dirty:f,ctx:e}),Se.$set(Ge);const _t={};f&2&&(_t.$$scope={dirty:f,ctx:e}),Qe.$set(_t)},i(e){Et||(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(Se.$$.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),Et=!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(Se.$$.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),Et=!1},d(e){e&&(n(p),n(o),n(a),n(s),n(ie),n(j),n(le),n(z),n(de),n(u),n(G),n(E),n(ve),n(J),n(pe),n(O),n(je),n(N),n(U),n(te),n(q),n(W),n(K),n(Fe),n(oe),n(ne),n(se),n(ee),n(L),n(me),n(he),n(ge),n(P),n(ye),n(ae),n(C),n(H),n(X),n(V),n(I),n(Y),n(h),n(ze),n(We),n(Te),n(Ke),n(qe),n(It),n(et),n(jt),n(tt),n(kt),n(ot),n(Ut),n(nt),n(Jt),n(st),n(zt),n(Wt),n(Re),n(Zt),n(Nt),n(Ee),n(Pt),n(Rt),n(He),n(Lt),n(Ht),n(Be),n(Bt),n(Gt),n(qt),n(Ct)),n(t),$(_,e),$(x,e),$(fe,e),$(Me,e),$(Je,e),$($e,e),$(_e,e),$(at,e),$(rt),$(Se),$(it,e),$(lt),$(dt),$(ct,e),$(mt),$(pt),$(ft,e),$(ht),$(gt),$(Qe,e),$(ut,e)}}}const on='{"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 nn(F){return wo(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class hn extends Mo{constructor(t){super(),$o(this,t,nn,tn,vo,{})}}export{hn as component};
