import{S as n_,i as r_,s as i_,e as a,k as h,w as y,t as r,M as l_,c as s,d as t,m as p,a as n,x as w,h as i,b as d,N as d_,G as e,g as f,y as M,q as $,o as E,B as V,v as c_,L as Oo}from"../../chunks/vendor-hf-doc-builder.js";import{T as Le}from"../../chunks/Tip-hf-doc-builder.js";import{D as H}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Qo}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as Ve}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Ho}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";import{P as s_}from"../../chunks/PipelineTag-hf-doc-builder.js";function h_(I){let c,T,g,_,v;return _=new Qo({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`}}),{c(){c=a("p"),T=r("Example:"),g=h(),y(_.$$.fragment)},l(l){c=s(l,"P",{});var u=n(c);T=i(u,"Example:"),u.forEach(t),g=p(l),w(_.$$.fragment,l)},m(l,u){f(l,c,u),e(c,T),f(l,g,u),M(_,l,u),v=!0},p:Oo,i(l){v||($(_.$$.fragment,l),v=!0)},o(l){E(_.$$.fragment,l),v=!1},d(l){l&&t(c),l&&t(g),V(_,l)}}}function p_(I){let c,T,g,_,v;return{c(){c=a("p"),T=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=a("code"),_=r("Module"),v=r(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){c=s(l,"P",{});var u=n(c);T=i(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(u,"CODE",{});var F=n(g);_=i(F,"Module"),F.forEach(t),v=i(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(t)},m(l,u){f(l,c,u),e(c,T),e(c,g),e(g,_),e(c,v)},d(l){l&&t(c)}}}function m_(I){let c,T,g,_,v;return _=new Qo({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyMFZpVE1vZGVsJTBBaW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGF0YXNldHMlMjBpbXBvcnQlMjBsb2FkX2RhdGFzZXQlMEElMEFkYXRhc2V0JTIwJTNEJTIwbG9hZF9kYXRhc2V0KCUyMmh1Z2dpbmdmYWNlJTJGY2F0cy1pbWFnZSUyMiklMEFpbWFnZSUyMCUzRCUyMGRhdGFzZXQlNUIlMjJ0ZXN0JTIyJTVEJTVCJTIyaW1hZ2UlMjIlNUQlNUIwJTVEJTBBJTBBaW1hZ2VfcHJvY2Vzc29yJTIwJTNEJTIwQXV0b0ltYWdlUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZ2aXQtYmFzZS1wYXRjaDE2LTIyNC1pbjIxayUyMiklMEFtb2RlbCUyMCUzRCUyMFZpVE1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZ2aXQtYmFzZS1wYXRjaDE2LTIyNC1pbjIxayUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjBpbWFnZV9wcm9jZXNzb3IoaW1hZ2UlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQXdpdGglMjB0b3JjaC5ub19ncmFkKCklM0ElMEElMjAlMjAlMjAlMjBvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpJTBBJTBBbGFzdF9oaWRkZW5fc3RhdGVzJTIwJTNEJTIwb3V0cHV0cy5sYXN0X2hpZGRlbl9zdGF0ZSUwQWxpc3QobGFzdF9oaWRkZW5fc3RhdGVzLnNoYXBlKQ==",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>)
<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>]`}}),{c(){c=a("p"),T=r("Example:"),g=h(),y(_.$$.fragment)},l(l){c=s(l,"P",{});var u=n(c);T=i(u,"Example:"),u.forEach(t),g=p(l),w(_.$$.fragment,l)},m(l,u){f(l,c,u),e(c,T),f(l,g,u),M(_,l,u),v=!0},p:Oo,i(l){v||($(_.$$.fragment,l),v=!0)},o(l){E(_.$$.fragment,l),v=!1},d(l){l&&t(c),l&&t(g),V(_,l)}}}function f_(I){let c,T,g,_,v;return{c(){c=a("p"),T=r("Note that we provide a script to pre-train this model on custom data in our "),g=a("a"),_=r(`examples
directory`),v=r("."),this.h()},l(l){c=s(l,"P",{});var u=n(c);T=i(u,"Note that we provide a script to pre-train this model on custom data in our "),g=s(u,"A",{href:!0,rel:!0});var F=n(g);_=i(F,`examples
directory`),F.forEach(t),v=i(u,"."),u.forEach(t),this.h()},h(){d(g,"href","https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-pretraining"),d(g,"rel","nofollow")},m(l,u){f(l,c,u),e(c,T),e(c,g),e(g,_),e(c,v)},d(l){l&&t(c)}}}function u_(I){let c,T,g,_,v;return{c(){c=a("p"),T=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=a("code"),_=r("Module"),v=r(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){c=s(l,"P",{});var u=n(c);T=i(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(u,"CODE",{});var F=n(g);_=i(F,"Module"),F.forEach(t),v=i(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(t)},m(l,u){f(l,c,u),e(c,T),e(c,g),e(g,_),e(c,v)},d(l){l&&t(c)}}}function g_(I){let c,T,g,_,v;return _=new Qo({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>]`}}),{c(){c=a("p"),T=r("Examples:"),g=h(),y(_.$$.fragment)},l(l){c=s(l,"P",{});var u=n(c);T=i(u,"Examples:"),u.forEach(t),g=p(l),w(_.$$.fragment,l)},m(l,u){f(l,c,u),e(c,T),f(l,g,u),M(_,l,u),v=!0},p:Oo,i(l){v||($(_.$$.fragment,l),v=!0)},o(l){E(_.$$.fragment,l),v=!1},d(l){l&&t(c),l&&t(g),V(_,l)}}}function __(I){let c,T,g,_,v,l,u,F;return{c(){c=a("p"),T=r(`Note that it\u2019s possible to fine-tune ViT on higher resolution images than the ones it has been trained on, by
setting `),g=a("code"),_=r("interpolate_pos_encoding"),v=r(" to "),l=a("code"),u=r("True"),F=r(` in the forward of the model. This will interpolate the pre-trained
position embeddings to the higher resolution.`)},l(W){c=s(W,"P",{});var C=n(c);T=i(C,`Note that it\u2019s possible to fine-tune ViT on higher resolution images than the ones it has been trained on, by
setting `),g=s(C,"CODE",{});var N=n(g);_=i(N,"interpolate_pos_encoding"),N.forEach(t),v=i(C," to "),l=s(C,"CODE",{});var P=n(l);u=i(P,"True"),P.forEach(t),F=i(C,` in the forward of the model. This will interpolate the pre-trained
position embeddings to the higher resolution.`),C.forEach(t)},m(W,C){f(W,c,C),e(c,T),e(c,g),e(g,_),e(c,v),e(c,l),e(l,u),e(c,F)},d(W){W&&t(c)}}}function v_(I){let c,T,g,_,v;return{c(){c=a("p"),T=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=a("code"),_=r("Module"),v=r(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){c=s(l,"P",{});var u=n(c);T=i(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(u,"CODE",{});var F=n(g);_=i(F,"Module"),F.forEach(t),v=i(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(t)},m(l,u){f(l,c,u),e(c,T),e(c,g),e(g,_),e(c,v)},d(l){l&&t(c)}}}function T_(I){let c,T,g,_,v;return _=new Qo({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyMFZpVEZvckltYWdlQ2xhc3NpZmljYXRpb24lMEFpbXBvcnQlMjB0b3JjaCUwQWZyb20lMjBkYXRhc2V0cyUyMGltcG9ydCUyMGxvYWRfZGF0YXNldCUwQSUwQWRhdGFzZXQlMjAlM0QlMjBsb2FkX2RhdGFzZXQoJTIyaHVnZ2luZ2ZhY2UlMkZjYXRzLWltYWdlJTIyKSUwQWltYWdlJTIwJTNEJTIwZGF0YXNldCU1QiUyMnRlc3QlMjIlNUQlNUIlMjJpbWFnZSUyMiU1RCU1QjAlNUQlMEElMEFpbWFnZV9wcm9jZXNzb3IlMjAlM0QlMjBBdXRvSW1hZ2VQcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMmdvb2dsZSUyRnZpdC1iYXNlLXBhdGNoMTYtMjI0JTIyKSUwQW1vZGVsJTIwJTNEJTIwVmlURm9ySW1hZ2VDbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGdml0LWJhc2UtcGF0Y2gxNi0yMjQlMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwaW1hZ2VfcHJvY2Vzc29yKGltYWdlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEElMEF3aXRoJTIwdG9yY2gubm9fZ3JhZCgpJTNBJTBBJTIwJTIwJTIwJTIwbG9naXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpLmxvZ2l0cyUwQSUwQSUyMyUyMG1vZGVsJTIwcHJlZGljdHMlMjBvbmUlMjBvZiUyMHRoZSUyMDEwMDAlMjBJbWFnZU5ldCUyMGNsYXNzZXMlMEFwcmVkaWN0ZWRfbGFiZWwlMjAlM0QlMjBsb2dpdHMuYXJnbWF4KC0xKS5pdGVtKCklMEFwcmludChtb2RlbC5jb25maWcuaWQybGFiZWwlNUJwcmVkaWN0ZWRfbGFiZWwlNUQp",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>)
<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`}}),{c(){c=a("p"),T=r("Example:"),g=h(),y(_.$$.fragment)},l(l){c=s(l,"P",{});var u=n(c);T=i(u,"Example:"),u.forEach(t),g=p(l),w(_.$$.fragment,l)},m(l,u){f(l,c,u),e(c,T),f(l,g,u),M(_,l,u),v=!0},p:Oo,i(l){v||($(_.$$.fragment,l),v=!0)},o(l){E(_.$$.fragment,l),v=!1},d(l){l&&t(c),l&&t(g),V(_,l)}}}function b_(I){let c,T,g,_,v,l,u,F,W,C,N,P,ne,k,qe,K,Xe,Ce,D,Ye,re,ie,He,Ue,O,Oe,Je,Q,Fe,Qe,ve,J,A,Ne,U,le,Ke,L,et,tt,z,Ie,de,ot,ce,he,Te,at,ee,st,R,nt,pe,B,rt,Z,it,lt;return{c(){c=a("p"),T=r("TensorFlow models and layers in "),g=a("code"),_=r("transformers"),v=r(" accept two formats as input:"),l=h(),u=a("ul"),F=a("li"),W=r("having all inputs as keyword arguments (like PyTorch models), or"),C=h(),N=a("li"),P=r("having all inputs as a list, tuple or dict in the first positional argument."),ne=h(),k=a("p"),qe=r(`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 `),K=a("code"),Xe=r("model.fit()"),Ce=r(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),D=a("code"),Ye=r("model.fit()"),re=r(` supports! If, however, you want to use the second
format outside of Keras methods like `),ie=a("code"),He=r("fit()"),Ue=r(" and "),O=a("code"),Oe=r("predict()"),Je=r(`, such as when creating your own layers or models with
the Keras `),Q=a("code"),Fe=r("Functional"),Qe=r(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),ve=h(),J=a("ul"),A=a("li"),Ne=r("a single Tensor with "),U=a("code"),le=r("pixel_values"),Ke=r(" only and nothing else: "),L=a("code"),et=r("model(pixel_values)"),tt=h(),z=a("li"),Ie=r(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),de=a("code"),ot=r("model([pixel_values, attention_mask])"),ce=r(" or "),he=a("code"),Te=r("model([pixel_values, attention_mask, token_type_ids])"),at=h(),ee=a("li"),st=r(`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),R=a("code"),nt=r('model({"pixel_values": pixel_values, "token_type_ids": token_type_ids})'),pe=h(),B=a("p"),rt=r(`Note that when creating models and layers with
`),Z=a("a"),it=r("subclassing"),lt=r(` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),this.h()},l(b){c=s(b,"P",{});var x=n(c);T=i(x,"TensorFlow models and layers in "),g=s(x,"CODE",{});var Tt=n(g);_=i(Tt,"transformers"),Tt.forEach(t),v=i(x," accept two formats as input:"),x.forEach(t),l=p(b),u=s(b,"UL",{});var te=n(u);F=s(te,"LI",{});var bt=n(F);W=i(bt,"having all inputs as keyword arguments (like PyTorch models), or"),bt.forEach(t),C=p(te),N=s(te,"LI",{});var yt=n(N);P=i(yt,"having all inputs as a list, tuple or dict in the first positional argument."),yt.forEach(t),te.forEach(t),ne=p(b),k=s(b,"P",{});var j=n(k);qe=i(j,`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 `),K=s(j,"CODE",{});var wt=n(K);Xe=i(wt,"model.fit()"),wt.forEach(t),Ce=i(j,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),D=s(j,"CODE",{});var Mt=n(D);Ye=i(Mt,"model.fit()"),Mt.forEach(t),re=i(j,` supports! If, however, you want to use the second
format outside of Keras methods like `),ie=s(j,"CODE",{});var $t=n(ie);He=i($t,"fit()"),$t.forEach(t),Ue=i(j," and "),O=s(j,"CODE",{});var me=n(O);Oe=i(me,"predict()"),me.forEach(t),Je=i(j,`, such as when creating your own layers or models with
the Keras `),Q=s(j,"CODE",{});var Et=n(Q);Fe=i(Et,"Functional"),Et.forEach(t),Qe=i(j,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),j.forEach(t),ve=p(b),J=s(b,"UL",{});var G=n(J);A=s(G,"LI",{});var fe=n(A);Ne=i(fe,"a single Tensor with "),U=s(fe,"CODE",{});var Vt=n(U);le=i(Vt,"pixel_values"),Vt.forEach(t),Ke=i(fe," only and nothing else: "),L=s(fe,"CODE",{});var ke=n(L);et=i(ke,"model(pixel_values)"),ke.forEach(t),fe.forEach(t),tt=p(G),z=s(G,"LI",{});var ue=n(z);Ie=i(ue,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),de=s(ue,"CODE",{});var Ft=n(de);ot=i(Ft,"model([pixel_values, attention_mask])"),Ft.forEach(t),ce=i(ue," or "),he=s(ue,"CODE",{});var It=n(he);Te=i(It,"model([pixel_values, attention_mask, token_type_ids])"),It.forEach(t),ue.forEach(t),at=p(G),ee=s(G,"LI",{});var xe=n(ee);st=i(xe,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),R=s(xe,"CODE",{});var kt=n(R);nt=i(kt,'model({"pixel_values": pixel_values, "token_type_ids": token_type_ids})'),kt.forEach(t),xe.forEach(t),G.forEach(t),pe=p(b),B=s(b,"P",{});var be=n(B);rt=i(be,`Note that when creating models and layers with
`),Z=s(be,"A",{href:!0,rel:!0});var ye=n(Z);it=i(ye,"subclassing"),ye.forEach(t),lt=i(be,` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),be.forEach(t),this.h()},h(){d(Z,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),d(Z,"rel","nofollow")},m(b,x){f(b,c,x),e(c,T),e(c,g),e(g,_),e(c,v),f(b,l,x),f(b,u,x),e(u,F),e(F,W),e(u,C),e(u,N),e(N,P),f(b,ne,x),f(b,k,x),e(k,qe),e(k,K),e(K,Xe),e(k,Ce),e(k,D),e(D,Ye),e(k,re),e(k,ie),e(ie,He),e(k,Ue),e(k,O),e(O,Oe),e(k,Je),e(k,Q),e(Q,Fe),e(k,Qe),f(b,ve,x),f(b,J,x),e(J,A),e(A,Ne),e(A,U),e(U,le),e(A,Ke),e(A,L),e(L,et),e(J,tt),e(J,z),e(z,Ie),e(z,de),e(de,ot),e(z,ce),e(z,he),e(he,Te),e(J,at),e(J,ee),e(ee,st),e(ee,R),e(R,nt),f(b,pe,x),f(b,B,x),e(B,rt),e(B,Z),e(Z,it),e(B,lt)},d(b){b&&t(c),b&&t(l),b&&t(u),b&&t(ne),b&&t(k),b&&t(ve),b&&t(J),b&&t(pe),b&&t(B)}}}function y_(I){let c,T,g,_,v;return{c(){c=a("p"),T=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=a("code"),_=r("Module"),v=r(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){c=s(l,"P",{});var u=n(c);T=i(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(u,"CODE",{});var F=n(g);_=i(F,"Module"),F.forEach(t),v=i(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(t)},m(l,u){f(l,c,u),e(c,T),e(c,g),e(g,_),e(c,v)},d(l){l&&t(c)}}}function w_(I){let c,T,g,_,v;return _=new Qo({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyMFRGVmlUTW9kZWwlMEFmcm9tJTIwZGF0YXNldHMlMjBpbXBvcnQlMjBsb2FkX2RhdGFzZXQlMEElMEFkYXRhc2V0JTIwJTNEJTIwbG9hZF9kYXRhc2V0KCUyMmh1Z2dpbmdmYWNlJTJGY2F0cy1pbWFnZSUyMiklMEFpbWFnZSUyMCUzRCUyMGRhdGFzZXQlNUIlMjJ0ZXN0JTIyJTVEJTVCJTIyaW1hZ2UlMjIlNUQlNUIwJTVEJTBBJTBBaW1hZ2VfcHJvY2Vzc29yJTIwJTNEJTIwQXV0b0ltYWdlUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZ2aXQtYmFzZS1wYXRjaDE2LTIyNC1pbjIxayUyMiklMEFtb2RlbCUyMCUzRCUyMFRGVmlUTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMmdvb2dsZSUyRnZpdC1iYXNlLXBhdGNoMTYtMjI0LWluMjFrJTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMGltYWdlX3Byb2Nlc3NvcihpbWFnZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIydGYlMjIpJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKSUwQSUwQWxhc3RfaGlkZGVuX3N0YXRlcyUyMCUzRCUyMG91dHB1dHMubGFzdF9oaWRkZW5fc3RhdGUlMEFsaXN0KGxhc3RfaGlkZGVuX3N0YXRlcy5zaGFwZSk=",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>)
<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>]`}}),{c(){c=a("p"),T=r("Example:"),g=h(),y(_.$$.fragment)},l(l){c=s(l,"P",{});var u=n(c);T=i(u,"Example:"),u.forEach(t),g=p(l),w(_.$$.fragment,l)},m(l,u){f(l,c,u),e(c,T),f(l,g,u),M(_,l,u),v=!0},p:Oo,i(l){v||($(_.$$.fragment,l),v=!0)},o(l){E(_.$$.fragment,l),v=!1},d(l){l&&t(c),l&&t(g),V(_,l)}}}function M_(I){let c,T,g,_,v,l,u,F;return{c(){c=a("p"),T=r(`Note that it\u2019s possible to fine-tune ViT on higher resolution images than the ones it has been trained on, by
setting `),g=a("code"),_=r("interpolate_pos_encoding"),v=r(" to "),l=a("code"),u=r("True"),F=r(` in the forward of the model. This will interpolate the pre-trained
position embeddings to the higher resolution.`)},l(W){c=s(W,"P",{});var C=n(c);T=i(C,`Note that it\u2019s possible to fine-tune ViT on higher resolution images than the ones it has been trained on, by
setting `),g=s(C,"CODE",{});var N=n(g);_=i(N,"interpolate_pos_encoding"),N.forEach(t),v=i(C," to "),l=s(C,"CODE",{});var P=n(l);u=i(P,"True"),P.forEach(t),F=i(C,` in the forward of the model. This will interpolate the pre-trained
position embeddings to the higher resolution.`),C.forEach(t)},m(W,C){f(W,c,C),e(c,T),e(c,g),e(g,_),e(c,v),e(c,l),e(l,u),e(c,F)},d(W){W&&t(c)}}}function $_(I){let c,T,g,_,v,l,u,F,W,C,N,P,ne,k,qe,K,Xe,Ce,D,Ye,re,ie,He,Ue,O,Oe,Je,Q,Fe,Qe,ve,J,A,Ne,U,le,Ke,L,et,tt,z,Ie,de,ot,ce,he,Te,at,ee,st,R,nt,pe,B,rt,Z,it,lt;return{c(){c=a("p"),T=r("TensorFlow models and layers in "),g=a("code"),_=r("transformers"),v=r(" accept two formats as input:"),l=h(),u=a("ul"),F=a("li"),W=r("having all inputs as keyword arguments (like PyTorch models), or"),C=h(),N=a("li"),P=r("having all inputs as a list, tuple or dict in the first positional argument."),ne=h(),k=a("p"),qe=r(`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 `),K=a("code"),Xe=r("model.fit()"),Ce=r(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),D=a("code"),Ye=r("model.fit()"),re=r(` supports! If, however, you want to use the second
format outside of Keras methods like `),ie=a("code"),He=r("fit()"),Ue=r(" and "),O=a("code"),Oe=r("predict()"),Je=r(`, such as when creating your own layers or models with
the Keras `),Q=a("code"),Fe=r("Functional"),Qe=r(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),ve=h(),J=a("ul"),A=a("li"),Ne=r("a single Tensor with "),U=a("code"),le=r("pixel_values"),Ke=r(" only and nothing else: "),L=a("code"),et=r("model(pixel_values)"),tt=h(),z=a("li"),Ie=r(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),de=a("code"),ot=r("model([pixel_values, attention_mask])"),ce=r(" or "),he=a("code"),Te=r("model([pixel_values, attention_mask, token_type_ids])"),at=h(),ee=a("li"),st=r(`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),R=a("code"),nt=r('model({"pixel_values": pixel_values, "token_type_ids": token_type_ids})'),pe=h(),B=a("p"),rt=r(`Note that when creating models and layers with
`),Z=a("a"),it=r("subclassing"),lt=r(` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),this.h()},l(b){c=s(b,"P",{});var x=n(c);T=i(x,"TensorFlow models and layers in "),g=s(x,"CODE",{});var Tt=n(g);_=i(Tt,"transformers"),Tt.forEach(t),v=i(x," accept two formats as input:"),x.forEach(t),l=p(b),u=s(b,"UL",{});var te=n(u);F=s(te,"LI",{});var bt=n(F);W=i(bt,"having all inputs as keyword arguments (like PyTorch models), or"),bt.forEach(t),C=p(te),N=s(te,"LI",{});var yt=n(N);P=i(yt,"having all inputs as a list, tuple or dict in the first positional argument."),yt.forEach(t),te.forEach(t),ne=p(b),k=s(b,"P",{});var j=n(k);qe=i(j,`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 `),K=s(j,"CODE",{});var wt=n(K);Xe=i(wt,"model.fit()"),wt.forEach(t),Ce=i(j,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),D=s(j,"CODE",{});var Mt=n(D);Ye=i(Mt,"model.fit()"),Mt.forEach(t),re=i(j,` supports! If, however, you want to use the second
format outside of Keras methods like `),ie=s(j,"CODE",{});var $t=n(ie);He=i($t,"fit()"),$t.forEach(t),Ue=i(j," and "),O=s(j,"CODE",{});var me=n(O);Oe=i(me,"predict()"),me.forEach(t),Je=i(j,`, such as when creating your own layers or models with
the Keras `),Q=s(j,"CODE",{});var Et=n(Q);Fe=i(Et,"Functional"),Et.forEach(t),Qe=i(j,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),j.forEach(t),ve=p(b),J=s(b,"UL",{});var G=n(J);A=s(G,"LI",{});var fe=n(A);Ne=i(fe,"a single Tensor with "),U=s(fe,"CODE",{});var Vt=n(U);le=i(Vt,"pixel_values"),Vt.forEach(t),Ke=i(fe," only and nothing else: "),L=s(fe,"CODE",{});var ke=n(L);et=i(ke,"model(pixel_values)"),ke.forEach(t),fe.forEach(t),tt=p(G),z=s(G,"LI",{});var ue=n(z);Ie=i(ue,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),de=s(ue,"CODE",{});var Ft=n(de);ot=i(Ft,"model([pixel_values, attention_mask])"),Ft.forEach(t),ce=i(ue," or "),he=s(ue,"CODE",{});var It=n(he);Te=i(It,"model([pixel_values, attention_mask, token_type_ids])"),It.forEach(t),ue.forEach(t),at=p(G),ee=s(G,"LI",{});var xe=n(ee);st=i(xe,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),R=s(xe,"CODE",{});var kt=n(R);nt=i(kt,'model({"pixel_values": pixel_values, "token_type_ids": token_type_ids})'),kt.forEach(t),xe.forEach(t),G.forEach(t),pe=p(b),B=s(b,"P",{});var be=n(B);rt=i(be,`Note that when creating models and layers with
`),Z=s(be,"A",{href:!0,rel:!0});var ye=n(Z);it=i(ye,"subclassing"),ye.forEach(t),lt=i(be,` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),be.forEach(t),this.h()},h(){d(Z,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),d(Z,"rel","nofollow")},m(b,x){f(b,c,x),e(c,T),e(c,g),e(g,_),e(c,v),f(b,l,x),f(b,u,x),e(u,F),e(F,W),e(u,C),e(u,N),e(N,P),f(b,ne,x),f(b,k,x),e(k,qe),e(k,K),e(K,Xe),e(k,Ce),e(k,D),e(D,Ye),e(k,re),e(k,ie),e(ie,He),e(k,Ue),e(k,O),e(O,Oe),e(k,Je),e(k,Q),e(Q,Fe),e(k,Qe),f(b,ve,x),f(b,J,x),e(J,A),e(A,Ne),e(A,U),e(U,le),e(A,Ke),e(A,L),e(L,et),e(J,tt),e(J,z),e(z,Ie),e(z,de),e(de,ot),e(z,ce),e(z,he),e(he,Te),e(J,at),e(J,ee),e(ee,st),e(ee,R),e(R,nt),f(b,pe,x),f(b,B,x),e(B,rt),e(B,Z),e(Z,it),e(B,lt)},d(b){b&&t(c),b&&t(l),b&&t(u),b&&t(ne),b&&t(k),b&&t(ve),b&&t(J),b&&t(pe),b&&t(B)}}}function E_(I){let c,T,g,_,v;return{c(){c=a("p"),T=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=a("code"),_=r("Module"),v=r(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){c=s(l,"P",{});var u=n(c);T=i(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(u,"CODE",{});var F=n(g);_=i(F,"Module"),F.forEach(t),v=i(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(t)},m(l,u){f(l,c,u),e(c,T),e(c,g),e(g,_),e(c,v)},d(l){l&&t(c)}}}function V_(I){let c,T,g,_,v;return _=new Qo({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyMFRGVmlURm9ySW1hZ2VDbGFzc2lmaWNhdGlvbiUwQWltcG9ydCUyMHRlbnNvcmZsb3clMjBhcyUyMHRmJTBBZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBJTBBZGF0YXNldCUyMCUzRCUyMGxvYWRfZGF0YXNldCglMjJodWdnaW5nZmFjZSUyRmNhdHMtaW1hZ2UlMjIpJTBBaW1hZ2UlMjAlM0QlMjBkYXRhc2V0JTVCJTIydGVzdCUyMiU1RCU1QiUyMmltYWdlJTIyJTVEJTVCMCU1RCUwQSUwQWltYWdlX3Byb2Nlc3NvciUyMCUzRCUyMEF1dG9JbWFnZVByb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGdml0LWJhc2UtcGF0Y2gxNi0yMjQlMjIpJTBBbW9kZWwlMjAlM0QlMjBURlZpVEZvckltYWdlQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMmdvb2dsZSUyRnZpdC1iYXNlLXBhdGNoMTYtMjI0JTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMGltYWdlX3Byb2Nlc3NvcihpbWFnZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIydGYlMjIpJTBBbG9naXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpLmxvZ2l0cyUwQSUwQSUyMyUyMG1vZGVsJTIwcHJlZGljdHMlMjBvbmUlMjBvZiUyMHRoZSUyMDEwMDAlMjBJbWFnZU5ldCUyMGNsYXNzZXMlMEFwcmVkaWN0ZWRfbGFiZWwlMjAlM0QlMjBpbnQodGYubWF0aC5hcmdtYXgobG9naXRzJTJDJTIwYXhpcyUzRC0xKSklMEFwcmludChtb2RlbC5jb25maWcuaWQybGFiZWwlNUJwcmVkaWN0ZWRfbGFiZWwlNUQp",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>)
<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`}}),{c(){c=a("p"),T=r("Example:"),g=h(),y(_.$$.fragment)},l(l){c=s(l,"P",{});var u=n(c);T=i(u,"Example:"),u.forEach(t),g=p(l),w(_.$$.fragment,l)},m(l,u){f(l,c,u),e(c,T),f(l,g,u),M(_,l,u),v=!0},p:Oo,i(l){v||($(_.$$.fragment,l),v=!0)},o(l){E(_.$$.fragment,l),v=!1},d(l){l&&t(c),l&&t(g),V(_,l)}}}function F_(I){let c,T,g,_,v;return{c(){c=a("p"),T=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=a("code"),_=r("Module"),v=r(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){c=s(l,"P",{});var u=n(c);T=i(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(u,"CODE",{});var F=n(g);_=i(F,"Module"),F.forEach(t),v=i(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(t)},m(l,u){f(l,c,u),e(c,T),e(c,g),e(g,_),e(c,v)},d(l){l&&t(c)}}}function I_(I){let c,T,g,_,v;return _=new Qo({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`}}),{c(){c=a("p"),T=r("Examples:"),g=h(),y(_.$$.fragment)},l(l){c=s(l,"P",{});var u=n(c);T=i(u,"Examples:"),u.forEach(t),g=p(l),w(_.$$.fragment,l)},m(l,u){f(l,c,u),e(c,T),f(l,g,u),M(_,l,u),v=!0},p:Oo,i(l){v||($(_.$$.fragment,l),v=!0)},o(l){E(_.$$.fragment,l),v=!1},d(l){l&&t(c),l&&t(g),V(_,l)}}}function k_(I){let c,T,g,_,v;return{c(){c=a("p"),T=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=a("code"),_=r("Module"),v=r(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){c=s(l,"P",{});var u=n(c);T=i(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(u,"CODE",{});var F=n(g);_=i(F,"Module"),F.forEach(t),v=i(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(t)},m(l,u){f(l,c,u),e(c,T),e(c,g),e(g,_),e(c,v)},d(l){l&&t(c)}}}function x_(I){let c,T,g,_,v;return _=new Qo({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()])`}}),{c(){c=a("p"),T=r("Example:"),g=h(),y(_.$$.fragment)},l(l){c=s(l,"P",{});var u=n(c);T=i(u,"Example:"),u.forEach(t),g=p(l),w(_.$$.fragment,l)},m(l,u){f(l,c,u),e(c,T),f(l,g,u),M(_,l,u),v=!0},p:Oo,i(l){v||($(_.$$.fragment,l),v=!0)},o(l){E(_.$$.fragment,l),v=!1},d(l){l&&t(c),l&&t(g),V(_,l)}}}function j_(I){let c,T,g,_,v,l,u,F,W,C,N,P,ne,k,qe,K,Xe,Ce,D,Ye,re,ie,He,Ue,O,Oe,Je,Q,Fe,Qe,ve,J,A,Ne,U,le,Ke,L,et,tt,z,Ie,de,ot,ce,he,Te,at,ee,st,R,nt,pe,B,rt,Z,it,lt,b,x,Tt,te,bt,yt,j,wt,Mt,$t,me,Et,G,fe,Vt,ke,ue,Ft,It,xe,kt,be,ye,ff,ui,Ko,Jl,Js,Nl,gi,Ns,Wl,_i,We,Ln,S,Ws,Zl,Pl,Zs,Al,zl,Ps,Rl,Bl,qn,Gl,Dl,Xn,Sl,Ll,Yn,ql,Xl,Hn,Yl,Hl,As,Ol,Ql,Kl,On,zs,Rs,ed,td,od,Qn,ea,ad,ta,sd,nd,rd,Kn,Bs,Gs,id,ld,vi,mt,dd,oa,cd,hd,aa,pd,md,Ti,eo,fd,sa,ud,gd,bi,xt,to,er,na,_d,tr,vd,yi,Ds,Td,wi,ra,Mi,Ze,ft,Ss,bd,yd,ia,wd,Md,la,$d,Ed,Vd,jt,Fd,Ls,Id,kd,da,xd,jd,Cd,Ct,Ud,qs,Jd,Nd,ca,Wd,Zd,Pd,or,Xs,Ad,$i,Ys,zd,Ei,Hs,oo,Os,Rd,Bd,ha,Gd,Dd,Vi,Qs,Sd,Fi,Ut,ao,ar,pa,Ld,sr,qd,Ii,Ks,Xd,ki,ma,nr,Yd,Hd,xi,fa,ji,we,en,Od,ua,Qd,Kd,tn,ec,so,tc,rr,oc,ac,on,sc,ga,nc,rc,an,ic,_a,lc,dc,sn,cc,va,hc,Ci,nn,pc,Ui,rn,ln,mc,Ta,fc,Ji,dn,uc,Ni,cn,hn,gc,ba,_c,Wi,pn,vc,Zi,ut,mn,Tc,ya,bc,yc,fn,wc,wa,Mc,$c,un,Ec,Ma,Vc,Pi,Jt,no,ir,$a,Fc,lr,Ic,Ai,je,Ea,kc,Nt,xc,gn,jc,Cc,Va,Uc,Jc,Nc,Wt,Wc,_n,Zc,Pc,vn,Ac,zc,Rc,ro,zi,Zt,io,dr,Fa,Bc,cr,Gc,Ri,Pt,Ia,Dc,lo,ka,Sc,hr,Lc,Bi,At,co,pr,xa,qc,mr,Xc,Gi,dt,ja,Yc,fr,Hc,Oc,ho,Ca,Qc,ur,Kc,Di,zt,po,gr,Ua,eh,_r,th,Si,ct,Ja,oh,Na,ah,Wa,sh,nh,rh,Pe,Za,ih,Rt,lh,Tn,dh,ch,vr,hh,ph,mh,mo,fh,fo,Li,Bt,uo,Tr,Pa,uh,br,gh,qi,ge,Aa,_h,za,vh,Ra,Th,bh,yh,go,wh,Ba,Mh,Ga,$h,Eh,Vh,Ae,Da,Fh,Gt,Ih,bn,kh,xh,yr,jh,Ch,Uh,_o,Jh,vo,Xi,Dt,To,wr,Sa,Nh,Mr,Wh,Yi,_e,La,Zh,$r,Ph,Ah,bo,zh,qa,Rh,Xa,Bh,Gh,Dh,ze,Ya,Sh,St,Lh,yn,qh,Xh,Er,Yh,Hh,Oh,yo,Qh,wo,Hi,Lt,Mo,Vr,Ha,Kh,Fr,ep,Oi,oe,Oa,tp,Ir,op,ap,Qa,sp,wn,np,rp,ip,Ka,lp,es,dp,cp,hp,$o,pp,Re,ts,mp,qt,fp,Mn,up,gp,kr,_p,vp,Tp,Eo,bp,Vo,Qi,Xt,Fo,xr,os,yp,jr,wp,Ki,q,as,Mp,Cr,$p,Ep,Io,Vp,ss,Fp,$n,Ip,kp,xp,ns,jp,rs,Cp,Up,Jp,ko,Np,Be,is,Wp,Yt,Zp,En,Pp,Ap,Ur,zp,Rp,Bp,xo,Gp,jo,el,Ht,Co,Jr,ls,Dp,Nr,Sp,tl,X,ds,Lp,Wr,qp,Xp,cs,Yp,Vn,Hp,Op,Qp,hs,Kp,ps,em,tm,om,Zr,am,sm,ht,Pr,ms,nm,rm,Ar,fs,im,lm,zr,us,dm,cm,Rr,gs,hm,pm,Ge,_s,mm,Ot,fm,Br,um,gm,Gr,_m,vm,Tm,Uo,bm,Jo,ol,Qt,No,Dr,vs,ym,Sr,wm,al,Y,Ts,Mm,Lr,$m,Em,bs,Vm,Fn,Fm,Im,km,ys,xm,ws,jm,Cm,Um,qr,Jm,Nm,pt,Xr,Ms,Wm,Zm,Yr,$s,Pm,Am,Hr,Es,zm,Rm,Or,Vs,Bm,Gm,De,Fs,Dm,Kt,Sm,Qr,Lm,qm,Kr,Xm,Ym,Hm,Wo,Om,Zo,sl;return l=new Ve({}),k=new Ve({}),na=new Ve({}),ra=new s_({props:{pipeline:"image-classification"}}),pa=new Ve({}),fa=new s_({props:{pipeline:"image-classification"}}),$a=new Ve({}),Ea=new H({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 <code>224</code>) &#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 <code>16</code>) &#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 <code>3</code>) &#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>, <code>optional</code>, 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/v4.33.0/src/transformers/models/vit/configuration_vit.py#L35"}}),ro=new Ho({props:{anchor:"transformers.ViTConfig.example",$$slots:{default:[h_]},$$scope:{ctx:I}}}),Fa=new Ve({}),Ia=new H({props:{name:"class transformers.ViTFeatureExtractor",anchor:"transformers.ViTFeatureExtractor",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/models/vit/feature_extraction_vit.py#L26"}}),ka=new H({props:{name:"__call__",anchor:"transformers.ViTFeatureExtractor.__call__",parameters:[{name:"images",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/image_processing_utils.py#L544"}}),xa=new Ve({}),ja=new H({props:{name:"class transformers.ViTImageProcessor",anchor:"transformers.ViTImageProcessor",parameters:[{name:"do_resize",val:": bool = True"},{name:"size",val:": typing.Union[typing.Dict[str, int], NoneType] = None"},{name:"resample",val:": Resampling = <Resampling.BILINEAR: 2>"},{name:"do_rescale",val:": bool = True"},{name:"rescale_factor",val:": typing.Union[int, float] = 0.00392156862745098"},{name:"do_normalize",val:": bool = True"},{name:"image_mean",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"image_std",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"**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>PILImageResampling.BILINEAR</code>) &#x2014;
Resampling filter to use if resizing the image. Can be overridden by the <code>resample</code> parameter in the
<code>preprocess</code> method.`,name:"resample"},{anchor:"transformers.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/v4.33.0/src/transformers/models/vit/image_processing_vit.py#L41"}}),Ca=new H({props:{name:"preprocess",anchor:"transformers.ViTImageProcessor.preprocess",parameters:[{name:"images",val:": typing.Union[ForwardRef('PIL.Image.Image'), numpy.ndarray, ForwardRef('torch.Tensor'), typing.List[ForwardRef('PIL.Image.Image')], typing.List[numpy.ndarray], typing.List[ForwardRef('torch.Tensor')]]"},{name:"do_resize",val:": typing.Optional[bool] = None"},{name:"size",val:": typing.Dict[str, int] = None"},{name:"resample",val:": Resampling = None"},{name:"do_rescale",val:": typing.Optional[bool] = None"},{name:"rescale_factor",val:": typing.Optional[float] = None"},{name:"do_normalize",val:": typing.Optional[bool] = None"},{name:"image_mean",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"image_std",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"return_tensors",val:": typing.Union[transformers.utils.generic.TensorType, str, NoneType] = None"},{name:"data_format",val:": typing.Union[str, transformers.image_utils.ChannelDimension] = <ChannelDimension.FIRST: 'channels_first'>"},{name:"input_data_format",val:": typing.Union[str, transformers.image_utils.ChannelDimension, NoneType] = None"},{name:"**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/v4.33.0/src/transformers/models/vit/image_processing_vit.py#L146"}}),Ua=new Ve({}),Ja=new H({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/v4.33.0/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/v4.33.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/models/vit/modeling_vit.py#L515"}}),Za=new H({props:{name:"forward",anchor:"transformers.ViTModel.forward",parameters:[{name:"pixel_values",val:": typing.Optional[torch.Tensor] = None"},{name:"bool_masked_pos",val:": typing.Optional[torch.BoolTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"interpolate_pos_encoding",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.ViTModel.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/v4.33.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.33.0/en/model_doc/donut#transformers.DonutFeatureExtractor.__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/v4.33.0/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/v4.33.0/src/transformers/models/vit/modeling_vit.py#L540",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.33.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.33.0/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>) \u2014 Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>pooler_output</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, hidden_size)</code>) \u2014 Last layer hidden-state of the first token of the sequence (classification token) after further processing
through the layers used for the auxiliary pretraining task. E.g. for BERT-family of models, this returns
the classification token after processing through a linear layer and a tanh activation function. The linear
layer weights are trained from the next sentence prediction (classification) objective during pretraining.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.33.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),mo=new Le({props:{$$slots:{default:[p_]},$$scope:{ctx:I}}}),fo=new Ho({props:{anchor:"transformers.ViTModel.forward.example",$$slots:{default:[m_]},$$scope:{ctx:I}}}),Pa=new Ve({}),Aa=new H({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/v4.33.0/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/v4.33.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/models/vit/modeling_vit.py#L637"}}),go=new Le({props:{$$slots:{default:[f_]},$$scope:{ctx:I}}}),Da=new H({props:{name:"forward",anchor:"transformers.ViTForMaskedImageModeling.forward",parameters:[{name:"pixel_values",val:": typing.Optional[torch.Tensor] = None"},{name:"bool_masked_pos",val:": typing.Optional[torch.BoolTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"interpolate_pos_encoding",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.ViTForMaskedImageModeling.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/v4.33.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.33.0/en/model_doc/donut#transformers.DonutFeatureExtractor.__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/v4.33.0/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/v4.33.0/src/transformers/models/vit/modeling_vit.py#L655",returnDescription:`
<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/v4.33.0/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) \u2014 Reconstruction loss.</li>
<li><strong>reconstruction</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) \u2014 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>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each stage) of shape <code>(batch_size, sequence_length, hidden_size)</code>. Hidden-states
(also called feature maps) of the model at the output of each stage.</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:`
<p><code>transformers.modeling_outputs.MaskedImageModelingOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),_o=new Le({props:{$$slots:{default:[u_]},$$scope:{ctx:I}}}),vo=new Ho({props:{anchor:"transformers.ViTForMaskedImageModeling.forward.example",$$slots:{default:[g_]},$$scope:{ctx:I}}}),Sa=new Ve({}),La=new H({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/v4.33.0/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/v4.33.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/models/vit/modeling_vit.py#L766"}}),bo=new Le({props:{$$slots:{default:[__]},$$scope:{ctx:I}}}),Ya=new H({props:{name:"forward",anchor:"transformers.ViTForImageClassification.forward",parameters:[{name:"pixel_values",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"labels",val:": typing.Optional[torch.Tensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"interpolate_pos_encoding",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.ViTForImageClassification.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/v4.33.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.33.0/en/model_doc/donut#transformers.DonutFeatureExtractor.__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/v4.33.0/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/v4.33.0/src/transformers/models/vit/modeling_vit.py#L779",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.33.0/en/main_classes/output#transformers.modeling_outputs.ImageClassifierOutput"
>transformers.modeling_outputs.ImageClassifierOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.33.0/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) \u2014 Classification (or regression if config.num_labels==1) loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.num_labels)</code>) \u2014 Classification (or regression if config.num_labels==1) scores (before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each stage) of shape <code>(batch_size, sequence_length, hidden_size)</code>. Hidden-states
(also called feature maps) of the model at the output of each stage.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, patch_size, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.33.0/en/main_classes/output#transformers.modeling_outputs.ImageClassifierOutput"
>transformers.modeling_outputs.ImageClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),yo=new Le({props:{$$slots:{default:[v_]},$$scope:{ctx:I}}}),wo=new Ho({props:{anchor:"transformers.ViTForImageClassification.forward.example",$$slots:{default:[T_]},$$scope:{ctx:I}}}),Ha=new Ve({}),Oa=new H({props:{name:"class transformers.TFViTModel",anchor:"transformers.TFViTModel",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFViTModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.33.0/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/v4.33.0/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/v4.33.0/src/transformers/models/vit/modeling_tf_vit.py#L631"}}),$o=new Le({props:{$$slots:{default:[b_]},$$scope:{ctx:I}}}),ts=new H({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/v4.33.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.33.0/en/model_doc/donut#transformers.DonutFeatureExtractor.__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/v4.33.0/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/v4.33.0/src/transformers/models/vit/modeling_tf_vit.py#L637",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.33.0/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/v4.33.0/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>) \u2014 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>) \u2014 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\u2019re 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>) \u2014 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>) \u2014 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:`
<p><a
  href="/docs/transformers/v4.33.0/en/main_classes/output#transformers.modeling_tf_outputs.TFBaseModelOutputWithPooling"
>transformers.modeling_tf_outputs.TFBaseModelOutputWithPooling</a> or <code>tuple(tf.Tensor)</code></p>
`}}),Eo=new Le({props:{$$slots:{default:[y_]},$$scope:{ctx:I}}}),Vo=new Ho({props:{anchor:"transformers.TFViTModel.call.example",$$slots:{default:[w_]},$$scope:{ctx:I}}}),os=new Ve({}),as=new H({props:{name:"class transformers.TFViTForImageClassification",anchor:"transformers.TFViTForImageClassification",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFViTForImageClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.33.0/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/v4.33.0/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/v4.33.0/src/transformers/models/vit/modeling_tf_vit.py#L704"}}),Io=new Le({props:{$$slots:{default:[M_]},$$scope:{ctx:I}}}),ko=new Le({props:{$$slots:{default:[$_]},$$scope:{ctx:I}}}),is=new H({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/v4.33.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.33.0/en/model_doc/donut#transformers.DonutFeatureExtractor.__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/v4.33.0/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/v4.33.0/src/transformers/models/vit/modeling_tf_vit.py#L718",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.33.0/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/v4.33.0/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) \u2014 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>) \u2014 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>) \u2014 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>) \u2014 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:`
<p><a
  href="/docs/transformers/v4.33.0/en/main_classes/output#transformers.modeling_tf_outputs.TFSequenceClassifierOutput"
>transformers.modeling_tf_outputs.TFSequenceClassifierOutput</a> or <code>tuple(tf.Tensor)</code></p>
`}}),xo=new Le({props:{$$slots:{default:[E_]},$$scope:{ctx:I}}}),jo=new Ho({props:{anchor:"transformers.TFViTForImageClassification.call.example",$$slots:{default:[V_]},$$scope:{ctx:I}}}),ls=new Ve({}),ds=new H({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/v4.33.0/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/v4.33.0/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/v4.33.0/en/main_classes/model#transformers.FlaxPreTrainedModel.to_fp16">to_fp16()</a> and
<a href="/docs/transformers/v4.33.0/en/main_classes/model#transformers.FlaxPreTrainedModel.to_bf16">to_bf16()</a>.`,name:"dtype"}],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/models/vit/modeling_flax_vit.py#L555"}}),_s=new H({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:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/models/vit/modeling_flax_vit.py#L471",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.33.0/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>) \u2014 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>) \u2014 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>) \u2014 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>) \u2014 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:`
<p><a
  href="/docs/transformers/v4.33.0/en/main_classes/output#transformers.modeling_flax_outputs.FlaxBaseModelOutputWithPooling"
>transformers.modeling_flax_outputs.FlaxBaseModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Uo=new Le({props:{$$slots:{default:[F_]},$$scope:{ctx:I}}}),Jo=new Ho({props:{anchor:"transformers.FlaxViTModel.__call__.example",$$slots:{default:[I_]},$$scope:{ctx:I}}}),vs=new Ve({}),Ts=new H({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/v4.33.0/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/v4.33.0/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/v4.33.0/en/main_classes/model#transformers.FlaxPreTrainedModel.to_fp16">to_fp16()</a> and
<a href="/docs/transformers/v4.33.0/en/main_classes/model#transformers.FlaxPreTrainedModel.to_bf16">to_bf16()</a>.`,name:"dtype"}],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/models/vit/modeling_flax_vit.py#L638"}}),Fs=new H({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:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/models/vit/modeling_flax_vit.py#L471",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.33.0/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>) \u2014 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>) \u2014 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>) \u2014 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:`
<p><a
  href="/docs/transformers/v4.33.0/en/main_classes/output#transformers.modeling_flax_outputs.FlaxSequenceClassifierOutput"
>transformers.modeling_flax_outputs.FlaxSequenceClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Wo=new Le({props:{$$slots:{default:[k_]},$$scope:{ctx:I}}}),Zo=new Ho({props:{anchor:"transformers.FlaxViTForImageClassification.__call__.example",$$slots:{default:[x_]},$$scope:{ctx:I}}}),{c(){c=a("meta"),T=h(),g=a("h1"),_=a("a"),v=a("span"),y(l.$$.fragment),u=h(),F=a("span"),W=r("Vision Transformer (ViT)"),C=h(),N=a("h2"),P=a("a"),ne=a("span"),y(k.$$.fragment),qe=h(),K=a("span"),Xe=r("Overview"),Ce=h(),D=a("p"),Ye=r("The Vision Transformer (ViT) model was proposed in "),re=a("a"),ie=r(`An Image is Worth 16x16 Words: Transformers for Image Recognition
at Scale`),He=r(` 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\u2019s the first paper that successfully trains a Transformer encoder on ImageNet, attaining
very good results compared to familiar convolutional architectures.`),Ue=h(),O=a("p"),Oe=r("The abstract from the paper is the following:"),Je=h(),Q=a("p"),Fe=a("em"),Qe=r(`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.`),ve=h(),J=a("p"),A=r("Tips:"),Ne=h(),U=a("ul"),le=a("li"),Ke=r("Demo notebooks regarding inference as well as fine-tuning ViT on custom data can be found "),L=a("a"),et=r("here"),tt=r("."),z=h(),Ie=a("li"),de=r(`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.`),ot=h(),ce=a("li"),he=r(`As the Vision Transformer expects each image to be of the same size (resolution), one can use
`),Te=a("a"),at=r("ViTImageProcessor"),ee=r(" to resize (or rescale) and normalize images for the model."),st=h(),R=a("li"),nt=r(`Both the patch resolution and image resolution used during pre-training or fine-tuning are reflected in the name of
each checkpoint. For example, `),pe=a("code"),B=r("google/vit-base-patch16-224"),rt=r(` refers to a base-sized architecture with patch
resolution of 16x16 and fine-tuning resolution of 224x224. All checkpoints can be found on the `),Z=a("a"),it=r("hub"),lt=r("."),b=h(),x=a("li"),Tt=r("The available checkpoints are either (1) pre-trained on "),te=a("a"),bt=r("ImageNet-21k"),yt=r(` (a collection of
14 million images and 21k classes) only, or (2) also fine-tuned on `),j=a("a"),wt=r("ImageNet"),Mt=r(` (also referred to as ILSVRC 2012, a collection of 1.3 million
images and 1,000 classes).`),$t=h(),me=a("li"),Et=r(`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 `),G=a("a"),fe=r("(Touvron et al., 2019)"),Vt=r(", "),ke=a("a"),ue=r(`(Kolesnikov
et al., 2020)`),Ft=r(`. 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.`),It=h(),xe=a("li"),kt=r(`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.`),be=h(),ye=a("img"),ui=h(),Ko=a("small"),Jl=r("ViT architecture. Taken from the "),Js=a("a"),Nl=r("original paper."),gi=h(),Ns=a("p"),Wl=r("Following the original Vision Transformer, some follow-up works have been made:"),_i=h(),We=a("ul"),Ln=a("li"),S=a("p"),Ws=a("a"),Zl=r("DeiT"),Pl=r(` (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 `),Zs=a("a"),Al=r("ViTModel"),zl=r(` or
`),Ps=a("a"),Rl=r("ViTForImageClassification"),Bl=r(". There are 4 variants available (in 3 different sizes): "),qn=a("em"),Gl=r("facebook/deit-tiny-patch16-224"),Dl=r(`,
`),Xn=a("em"),Sl=r("facebook/deit-small-patch16-224"),Ll=r(", "),Yn=a("em"),ql=r("facebook/deit-base-patch16-224"),Xl=r(" and "),Hn=a("em"),Yl=r("facebook/deit-base-patch16-384"),Hl=r(`. Note that one should
use `),As=a("a"),Ol=r("DeiTImageProcessor"),Ql=r(" in order to prepare images for the model."),Kl=h(),On=a("li"),zs=a("p"),Rs=a("a"),ed=r("BEiT"),td=r(` (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.`),od=h(),Qn=a("li"),ea=a("p"),ad=r(`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 `),ta=a("a"),sd=r("hub"),nd=r("."),rd=h(),Kn=a("li"),Bs=a("p"),Gs=a("a"),id=r("MAE"),ld=r(` (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.`),vi=h(),mt=a("p"),dd=r("This model was contributed by "),oa=a("a"),cd=r("nielsr"),hd=r(`. The original code (written in JAX) can be
found `),aa=a("a"),pd=r("here"),md=r("."),Ti=h(),eo=a("p"),fd=r("Note that we converted the weights from Ross Wightman\u2019s "),sa=a("a"),ud=r("timm library"),gd=r(`, who already converted the weights from JAX to PyTorch. Credits
go to him!`),bi=h(),xt=a("h2"),to=a("a"),er=a("span"),y(na.$$.fragment),_d=h(),tr=a("span"),vd=r("Resources"),yi=h(),Ds=a("p"),Td=r("A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with ViT."),wi=h(),y(ra.$$.fragment),Mi=h(),Ze=a("ul"),ft=a("li"),Ss=a("a"),bd=r("ViTForImageClassification"),yd=r(" is supported by this "),ia=a("a"),wd=r("example script"),Md=r(" and "),la=a("a"),$d=r("notebook"),Ed=r("."),Vd=h(),jt=a("li"),Fd=r("A blog on fine-tuning "),Ls=a("a"),Id=r("ViTForImageClassification"),kd=r(" on a custom dataset can be found "),da=a("a"),xd=r("here"),jd=r("."),Cd=h(),Ct=a("li"),Ud=r("More demo notebooks to fine-tune "),qs=a("a"),Jd=r("ViTForImageClassification"),Nd=r(" can be found "),ca=a("a"),Wd=r("here"),Zd=r("."),Pd=h(),or=a("li"),Xs=a("a"),Ad=r("Image classification task guide"),$i=h(),Ys=a("p"),zd=r("Besides that:"),Ei=h(),Hs=a("ul"),oo=a("li"),Os=a("a"),Rd=r("ViTForMaskedImageModeling"),Bd=r(" is supported by this "),ha=a("a"),Gd=r("example script"),Dd=r("."),Vi=h(),Qs=a("p"),Sd=r("If you\u2019re interested in submitting a resource to be included here, please feel free to open a Pull Request and we\u2019ll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource."),Fi=h(),Ut=a("h2"),ao=a("a"),ar=a("span"),y(pa.$$.fragment),Ld=h(),sr=a("span"),qd=r("Resources"),Ii=h(),Ks=a("p"),Xd=r("A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with ViT. If you\u2019re interested in submitting a resource to be included here, please feel free to open a Pull Request and we\u2019ll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource."),ki=h(),ma=a("p"),nr=a("code"),Yd=r("ViTForImageClassification"),Hd=r(" is supported by:"),xi=h(),y(fa.$$.fragment),ji=h(),we=a("ul"),en=a("li"),Od=r("A blog post on how to "),ua=a("a"),Qd=r("Fine-Tune ViT for Image Classification with Hugging Face Transformers"),Kd=h(),tn=a("li"),ec=r("A blog post on "),so=a("a"),tc=r("Image Classification with Hugging Face Transformers and "),rr=a("code"),oc=r("Keras"),ac=h(),on=a("li"),sc=r("A notebook on "),ga=a("a"),nc=r("Fine-tuning for Image Classification with Hugging Face Transformers"),rc=h(),an=a("li"),ic=r("A notebook on how to "),_a=a("a"),lc=r("Fine-tune the Vision Transformer on CIFAR-10 with the Hugging Face Trainer"),dc=h(),sn=a("li"),cc=r("A notebook on how to "),va=a("a"),hc=r("Fine-tune the Vision Transformer on CIFAR-10 with PyTorch Lightning"),Ci=h(),nn=a("p"),pc=r("\u2697\uFE0F Optimization"),Ui=h(),rn=a("ul"),ln=a("li"),mc=r("A blog post on how to "),Ta=a("a"),fc=r("Accelerate Vision Transformer (ViT) with Quantization using Optimum"),Ji=h(),dn=a("p"),uc=r("\u26A1\uFE0F Inference"),Ni=h(),cn=a("ul"),hn=a("li"),gc=r("A notebook on "),ba=a("a"),_c=r("Quick demo: Vision Transformer (ViT) by Google Brain"),Wi=h(),pn=a("p"),vc=r("\u{1F680} Deploy"),Zi=h(),ut=a("ul"),mn=a("li"),Tc=r("A blog post on "),ya=a("a"),bc=r("Deploying Tensorflow Vision Models in Hugging Face with TF Serving"),yc=h(),fn=a("li"),wc=r("A blog post on "),wa=a("a"),Mc=r("Deploying Hugging Face ViT on Vertex AI"),$c=h(),un=a("li"),Ec=r("A blog post on "),Ma=a("a"),Vc=r("Deploying Hugging Face ViT on Kubernetes with TF Serving"),Pi=h(),Jt=a("h2"),no=a("a"),ir=a("span"),y($a.$$.fragment),Fc=h(),lr=a("span"),Ic=r("ViTConfig"),Ai=h(),je=a("div"),y(Ea.$$.fragment),kc=h(),Nt=a("p"),xc=r("This is the configuration class to store the configuration of a "),gn=a("a"),jc=r("ViTModel"),Cc=r(`. 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
`),Va=a("a"),Uc=r("google/vit-base-patch16-224"),Jc=r(" architecture."),Nc=h(),Wt=a("p"),Wc=r("Configuration objects inherit from "),_n=a("a"),Zc=r("PretrainedConfig"),Pc=r(` and can be used to control the model outputs. Read the
documentation from `),vn=a("a"),Ac=r("PretrainedConfig"),zc=r(" for more information."),Rc=h(),y(ro.$$.fragment),zi=h(),Zt=a("h2"),io=a("a"),dr=a("span"),y(Fa.$$.fragment),Bc=h(),cr=a("span"),Gc=r("ViTFeatureExtractor"),Ri=h(),Pt=a("div"),y(Ia.$$.fragment),Dc=h(),lo=a("div"),y(ka.$$.fragment),Sc=h(),hr=a("p"),Lc=r("Preprocess an image or a batch of images."),Bi=h(),At=a("h2"),co=a("a"),pr=a("span"),y(xa.$$.fragment),qc=h(),mr=a("span"),Xc=r("ViTImageProcessor"),Gi=h(),dt=a("div"),y(ja.$$.fragment),Yc=h(),fr=a("p"),Hc=r("Constructs a ViT image processor."),Oc=h(),ho=a("div"),y(Ca.$$.fragment),Qc=h(),ur=a("p"),Kc=r("Preprocess an image or batch of images."),Di=h(),zt=a("h2"),po=a("a"),gr=a("span"),y(Ua.$$.fragment),eh=h(),_r=a("span"),th=r("ViTModel"),Si=h(),ct=a("div"),y(Ja.$$.fragment),oh=h(),Na=a("p"),ah=r(`The bare ViT Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),Wa=a("a"),sh=r("torch.nn.Module"),nh=r(` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),rh=h(),Pe=a("div"),y(Za.$$.fragment),ih=h(),Rt=a("p"),lh=r("The "),Tn=a("a"),dh=r("ViTModel"),ch=r(" forward method, overrides the "),vr=a("code"),hh=r("__call__"),ph=r(" special method."),mh=h(),y(mo.$$.fragment),fh=h(),y(fo.$$.fragment),Li=h(),Bt=a("h2"),uo=a("a"),Tr=a("span"),y(Pa.$$.fragment),uh=h(),br=a("span"),gh=r("ViTForMaskedImageModeling"),qi=h(),ge=a("div"),y(Aa.$$.fragment),_h=h(),za=a("p"),vh=r("ViT Model with a decoder on top for masked image modeling, as proposed in "),Ra=a("a"),Th=r("SimMIM"),bh=r("."),yh=h(),y(go.$$.fragment),wh=h(),Ba=a("p"),Mh=r("This model is a PyTorch "),Ga=a("a"),$h=r("torch.nn.Module"),Eh=r(` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Vh=h(),Ae=a("div"),y(Da.$$.fragment),Fh=h(),Gt=a("p"),Ih=r("The "),bn=a("a"),kh=r("ViTForMaskedImageModeling"),xh=r(" forward method, overrides the "),yr=a("code"),jh=r("__call__"),Ch=r(" special method."),Uh=h(),y(_o.$$.fragment),Jh=h(),y(vo.$$.fragment),Xi=h(),Dt=a("h2"),To=a("a"),wr=a("span"),y(Sa.$$.fragment),Nh=h(),Mr=a("span"),Wh=r("ViTForImageClassification"),Yi=h(),_e=a("div"),y(La.$$.fragment),Zh=h(),$r=a("p"),Ph=r(`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.`),Ah=h(),y(bo.$$.fragment),zh=h(),qa=a("p"),Rh=r("This model is a PyTorch "),Xa=a("a"),Bh=r("torch.nn.Module"),Gh=r(` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Dh=h(),ze=a("div"),y(Ya.$$.fragment),Sh=h(),St=a("p"),Lh=r("The "),yn=a("a"),qh=r("ViTForImageClassification"),Xh=r(" forward method, overrides the "),Er=a("code"),Yh=r("__call__"),Hh=r(" special method."),Oh=h(),y(yo.$$.fragment),Qh=h(),y(wo.$$.fragment),Hi=h(),Lt=a("h2"),Mo=a("a"),Vr=a("span"),y(Ha.$$.fragment),Kh=h(),Fr=a("span"),ep=r("TFViTModel"),Oi=h(),oe=a("div"),y(Oa.$$.fragment),tp=h(),Ir=a("p"),op=r("The bare ViT Model transformer outputting raw hidden-states without any specific head on top."),ap=h(),Qa=a("p"),sp=r("This model inherits from "),wn=a("a"),np=r("TFPreTrainedModel"),rp=r(`. 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.)`),ip=h(),Ka=a("p"),lp=r("This model is also a "),es=a("a"),dp=r("tf.keras.Model"),cp=r(` 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.`),hp=h(),y($o.$$.fragment),pp=h(),Re=a("div"),y(ts.$$.fragment),mp=h(),qt=a("p"),fp=r("The "),Mn=a("a"),up=r("TFViTModel"),gp=r(" forward method, overrides the "),kr=a("code"),_p=r("__call__"),vp=r(" special method."),Tp=h(),y(Eo.$$.fragment),bp=h(),y(Vo.$$.fragment),Qi=h(),Xt=a("h2"),Fo=a("a"),xr=a("span"),y(os.$$.fragment),yp=h(),jr=a("span"),wp=r("TFViTForImageClassification"),Ki=h(),q=a("div"),y(as.$$.fragment),Mp=h(),Cr=a("p"),$p=r(`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.`),Ep=h(),y(Io.$$.fragment),Vp=h(),ss=a("p"),Fp=r("This model inherits from "),$n=a("a"),Ip=r("TFPreTrainedModel"),kp=r(`. 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.)`),xp=h(),ns=a("p"),jp=r("This model is also a "),rs=a("a"),Cp=r("tf.keras.Model"),Up=r(` 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.`),Jp=h(),y(ko.$$.fragment),Np=h(),Be=a("div"),y(is.$$.fragment),Wp=h(),Yt=a("p"),Zp=r("The "),En=a("a"),Pp=r("TFViTForImageClassification"),Ap=r(" forward method, overrides the "),Ur=a("code"),zp=r("__call__"),Rp=r(" special method."),Bp=h(),y(xo.$$.fragment),Gp=h(),y(jo.$$.fragment),el=h(),Ht=a("h2"),Co=a("a"),Jr=a("span"),y(ls.$$.fragment),Dp=h(),Nr=a("span"),Sp=r("FlaxVitModel"),tl=h(),X=a("div"),y(ds.$$.fragment),Lp=h(),Wr=a("p"),qp=r("The bare ViT Model transformer outputting raw hidden-states without any specific head on top."),Xp=h(),cs=a("p"),Yp=r("This model inherits from "),Vn=a("a"),Hp=r("FlaxPreTrainedModel"),Op=r(`. 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)`),Qp=h(),hs=a("p"),Kp=r("This model is also a Flax Linen "),ps=a("a"),em=r("flax.linen.Module"),tm=r(`
subclass. Use it as a regular Flax linen Module and refer to the Flax documentation for all matter related to
general usage and behavior.`),om=h(),Zr=a("p"),am=r("Finally, this model supports inherent JAX features such as:"),sm=h(),ht=a("ul"),Pr=a("li"),ms=a("a"),nm=r("Just-In-Time (JIT) compilation"),rm=h(),Ar=a("li"),fs=a("a"),im=r("Automatic Differentiation"),lm=h(),zr=a("li"),us=a("a"),dm=r("Vectorization"),cm=h(),Rr=a("li"),gs=a("a"),hm=r("Parallelization"),pm=h(),Ge=a("div"),y(_s.$$.fragment),mm=h(),Ot=a("p"),fm=r("The "),Br=a("code"),um=r("FlaxViTPreTrainedModel"),gm=r(" forward method, overrides the "),Gr=a("code"),_m=r("__call__"),vm=r(" special method."),Tm=h(),y(Uo.$$.fragment),bm=h(),y(Jo.$$.fragment),ol=h(),Qt=a("h2"),No=a("a"),Dr=a("span"),y(vs.$$.fragment),ym=h(),Sr=a("span"),wm=r("FlaxViTForImageClassification"),al=h(),Y=a("div"),y(Ts.$$.fragment),Mm=h(),Lr=a("p"),$m=r(`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.`),Em=h(),bs=a("p"),Vm=r("This model inherits from "),Fn=a("a"),Fm=r("FlaxPreTrainedModel"),Im=r(`. 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)`),km=h(),ys=a("p"),xm=r("This model is also a Flax Linen "),ws=a("a"),jm=r("flax.linen.Module"),Cm=r(`
subclass. Use it as a regular Flax linen Module and refer to the Flax documentation for all matter related to
general usage and behavior.`),Um=h(),qr=a("p"),Jm=r("Finally, this model supports inherent JAX features such as:"),Nm=h(),pt=a("ul"),Xr=a("li"),Ms=a("a"),Wm=r("Just-In-Time (JIT) compilation"),Zm=h(),Yr=a("li"),$s=a("a"),Pm=r("Automatic Differentiation"),Am=h(),Hr=a("li"),Es=a("a"),zm=r("Vectorization"),Rm=h(),Or=a("li"),Vs=a("a"),Bm=r("Parallelization"),Gm=h(),De=a("div"),y(Fs.$$.fragment),Dm=h(),Kt=a("p"),Sm=r("The "),Qr=a("code"),Lm=r("FlaxViTPreTrainedModel"),qm=r(" forward method, overrides the "),Kr=a("code"),Xm=r("__call__"),Ym=r(" special method."),Hm=h(),y(Wo.$$.fragment),Om=h(),y(Zo.$$.fragment),this.h()},l(o){const m=l_('[data-svelte="svelte-1phssyn"]',document.head);c=s(m,"META",{name:!0,content:!0}),m.forEach(t),T=p(o),g=s(o,"H1",{class:!0});var Is=n(g);_=s(Is,"A",{id:!0,class:!0,href:!0});var ei=n(_);v=s(ei,"SPAN",{});var ti=n(v);w(l.$$.fragment,ti),ti.forEach(t),ei.forEach(t),u=p(Is),F=s(Is,"SPAN",{});var oi=n(F);W=i(oi,"Vision Transformer (ViT)"),oi.forEach(t),Is.forEach(t),C=p(o),N=s(o,"H2",{class:!0});var ks=n(N);P=s(ks,"A",{id:!0,class:!0,href:!0});var ai=n(P);ne=s(ai,"SPAN",{});var si=n(ne);w(k.$$.fragment,si),si.forEach(t),ai.forEach(t),qe=p(ks),K=s(ks,"SPAN",{});var ni=n(K);Xe=i(ni,"Overview"),ni.forEach(t),ks.forEach(t),Ce=p(o),D=s(o,"P",{});var xs=n(D);Ye=i(xs,"The Vision Transformer (ViT) model was proposed in "),re=s(xs,"A",{href:!0,rel:!0});var ri=n(re);ie=i(ri,`An Image is Worth 16x16 Words: Transformers for Image Recognition
at Scale`),ri.forEach(t),He=i(xs,` 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\u2019s the first paper that successfully trains a Transformer encoder on ImageNet, attaining
very good results compared to familiar convolutional architectures.`),xs.forEach(t),Ue=p(o),O=s(o,"P",{});var ii=n(O);Oe=i(ii,"The abstract from the paper is the following:"),ii.forEach(t),Je=p(o),Q=s(o,"P",{});var li=n(Q);Fe=s(li,"EM",{});var di=n(Fe);Qe=i(di,`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.`),di.forEach(t),li.forEach(t),ve=p(o),J=s(o,"P",{});var ci=n(J);A=i(ci,"Tips:"),ci.forEach(t),Ne=p(o),U=s(o,"UL",{});var ae=n(U);le=s(ae,"LI",{});var js=n(le);Ke=i(js,"Demo notebooks regarding inference as well as fine-tuning ViT on custom data can be found "),L=s(js,"A",{href:!0,rel:!0});var hi=n(L);et=i(hi,"here"),hi.forEach(t),tt=i(js,"."),js.forEach(t),z=p(ae),Ie=s(ae,"LI",{});var pi=n(Ie);de=i(pi,`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.`),pi.forEach(t),ot=p(ae),ce=s(ae,"LI",{});var Cs=n(ce);he=i(Cs,`As the Vision Transformer expects each image to be of the same size (resolution), one can use
`),Te=s(Cs,"A",{href:!0});var mi=n(Te);at=i(mi,"ViTImageProcessor"),mi.forEach(t),ee=i(Cs," to resize (or rescale) and normalize images for the model."),Cs.forEach(t),st=p(ae),R=s(ae,"LI",{});var In=n(R);nt=i(In,`Both the patch resolution and image resolution used during pre-training or fine-tuning are reflected in the name of
each checkpoint. For example, `),pe=s(In,"CODE",{});var uf=n(pe);B=i(uf,"google/vit-base-patch16-224"),uf.forEach(t),rt=i(In,` refers to a base-sized architecture with patch
resolution of 16x16 and fine-tuning resolution of 224x224. All checkpoints can be found on the `),Z=s(In,"A",{href:!0,rel:!0});var gf=n(Z);it=i(gf,"hub"),gf.forEach(t),lt=i(In,"."),In.forEach(t),b=p(ae),x=s(ae,"LI",{});var kn=n(x);Tt=i(kn,"The available checkpoints are either (1) pre-trained on "),te=s(kn,"A",{href:!0,rel:!0});var _f=n(te);bt=i(_f,"ImageNet-21k"),_f.forEach(t),yt=i(kn,` (a collection of
14 million images and 21k classes) only, or (2) also fine-tuned on `),j=s(kn,"A",{href:!0,rel:!0});var vf=n(j);wt=i(vf,"ImageNet"),vf.forEach(t),Mt=i(kn,` (also referred to as ILSVRC 2012, a collection of 1.3 million
images and 1,000 classes).`),kn.forEach(t),$t=p(ae),me=s(ae,"LI",{});var xn=n(me);Et=i(xn,`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 `),G=s(xn,"A",{href:!0,rel:!0});var Tf=n(G);fe=i(Tf,"(Touvron et al., 2019)"),Tf.forEach(t),Vt=i(xn,", "),ke=s(xn,"A",{href:!0,rel:!0});var bf=n(ke);ue=i(bf,`(Kolesnikov
et al., 2020)`),bf.forEach(t),Ft=i(xn,`. 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.`),xn.forEach(t),It=p(ae),xe=s(ae,"LI",{});var yf=n(xe);kt=i(yf,`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.`),yf.forEach(t),ae.forEach(t),be=p(o),ye=s(o,"IMG",{src:!0,alt:!0,width:!0}),ui=p(o),Ko=s(o,"SMALL",{});var Qm=n(Ko);Jl=i(Qm,"ViT architecture. Taken from the "),Js=s(Qm,"A",{href:!0});var wf=n(Js);Nl=i(wf,"original paper."),wf.forEach(t),Qm.forEach(t),gi=p(o),Ns=s(o,"P",{});var Mf=n(Ns);Wl=i(Mf,"Following the original Vision Transformer, some follow-up works have been made:"),Mf.forEach(t),_i=p(o),We=s(o,"UL",{});var Po=n(We);Ln=s(Po,"LI",{});var $f=n(Ln);S=s($f,"P",{});var se=n(S);Ws=s(se,"A",{href:!0});var Ef=n(Ws);Zl=i(Ef,"DeiT"),Ef.forEach(t),Pl=i(se,` (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 `),Zs=s(se,"A",{href:!0});var Vf=n(Zs);Al=i(Vf,"ViTModel"),Vf.forEach(t),zl=i(se,` or
`),Ps=s(se,"A",{href:!0});var Ff=n(Ps);Rl=i(Ff,"ViTForImageClassification"),Ff.forEach(t),Bl=i(se,". There are 4 variants available (in 3 different sizes): "),qn=s(se,"EM",{});var If=n(qn);Gl=i(If,"facebook/deit-tiny-patch16-224"),If.forEach(t),Dl=i(se,`,
`),Xn=s(se,"EM",{});var kf=n(Xn);Sl=i(kf,"facebook/deit-small-patch16-224"),kf.forEach(t),Ll=i(se,", "),Yn=s(se,"EM",{});var xf=n(Yn);ql=i(xf,"facebook/deit-base-patch16-224"),xf.forEach(t),Xl=i(se," and "),Hn=s(se,"EM",{});var jf=n(Hn);Yl=i(jf,"facebook/deit-base-patch16-384"),jf.forEach(t),Hl=i(se,`. Note that one should
use `),As=s(se,"A",{href:!0});var Cf=n(As);Ol=i(Cf,"DeiTImageProcessor"),Cf.forEach(t),Ql=i(se," in order to prepare images for the model."),se.forEach(t),$f.forEach(t),Kl=p(Po),On=s(Po,"LI",{});var Uf=n(On);zs=s(Uf,"P",{});var Km=n(zs);Rs=s(Km,"A",{href:!0});var Jf=n(Rs);ed=i(Jf,"BEiT"),Jf.forEach(t),td=i(Km,` (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.`),Km.forEach(t),Uf.forEach(t),od=p(Po),Qn=s(Po,"LI",{});var Nf=n(Qn);ea=s(Nf,"P",{});var nl=n(ea);ad=i(nl,`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 `),ta=s(nl,"A",{href:!0,rel:!0});var Wf=n(ta);sd=i(Wf,"hub"),Wf.forEach(t),nd=i(nl,"."),nl.forEach(t),Nf.forEach(t),rd=p(Po),Kn=s(Po,"LI",{});var Zf=n(Kn);Bs=s(Zf,"P",{});var ef=n(Bs);Gs=s(ef,"A",{href:!0});var Pf=n(Gs);id=i(Pf,"MAE"),Pf.forEach(t),ld=i(ef,` (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.`),ef.forEach(t),Zf.forEach(t),Po.forEach(t),vi=p(o),mt=s(o,"P",{});var jn=n(mt);dd=i(jn,"This model was contributed by "),oa=s(jn,"A",{href:!0,rel:!0});var Af=n(oa);cd=i(Af,"nielsr"),Af.forEach(t),hd=i(jn,`. The original code (written in JAX) can be
found `),aa=s(jn,"A",{href:!0,rel:!0});var zf=n(aa);pd=i(zf,"here"),zf.forEach(t),md=i(jn,"."),jn.forEach(t),Ti=p(o),eo=s(o,"P",{});var rl=n(eo);fd=i(rl,"Note that we converted the weights from Ross Wightman\u2019s "),sa=s(rl,"A",{href:!0,rel:!0});var Rf=n(sa);ud=i(Rf,"timm library"),Rf.forEach(t),gd=i(rl,`, who already converted the weights from JAX to PyTorch. Credits
go to him!`),rl.forEach(t),bi=p(o),xt=s(o,"H2",{class:!0});var il=n(xt);to=s(il,"A",{id:!0,class:!0,href:!0});var Bf=n(to);er=s(Bf,"SPAN",{});var Gf=n(er);w(na.$$.fragment,Gf),Gf.forEach(t),Bf.forEach(t),_d=p(il),tr=s(il,"SPAN",{});var Df=n(tr);vd=i(Df,"Resources"),Df.forEach(t),il.forEach(t),yi=p(o),Ds=s(o,"P",{});var Sf=n(Ds);Td=i(Sf,"A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with ViT."),Sf.forEach(t),wi=p(o),w(ra.$$.fragment,o),Mi=p(o),Ze=s(o,"UL",{});var Ao=n(Ze);ft=s(Ao,"LI",{});var Us=n(ft);Ss=s(Us,"A",{href:!0});var Lf=n(Ss);bd=i(Lf,"ViTForImageClassification"),Lf.forEach(t),yd=i(Us," is supported by this "),ia=s(Us,"A",{href:!0,rel:!0});var qf=n(ia);wd=i(qf,"example script"),qf.forEach(t),Md=i(Us," and "),la=s(Us,"A",{href:!0,rel:!0});var Xf=n(la);$d=i(Xf,"notebook"),Xf.forEach(t),Ed=i(Us,"."),Us.forEach(t),Vd=p(Ao),jt=s(Ao,"LI",{});var Cn=n(jt);Fd=i(Cn,"A blog on fine-tuning "),Ls=s(Cn,"A",{href:!0});var Yf=n(Ls);Id=i(Yf,"ViTForImageClassification"),Yf.forEach(t),kd=i(Cn," on a custom dataset can be found "),da=s(Cn,"A",{href:!0,rel:!0});var Hf=n(da);xd=i(Hf,"here"),Hf.forEach(t),jd=i(Cn,"."),Cn.forEach(t),Cd=p(Ao),Ct=s(Ao,"LI",{});var Un=n(Ct);Ud=i(Un,"More demo notebooks to fine-tune "),qs=s(Un,"A",{href:!0});var Of=n(qs);Jd=i(Of,"ViTForImageClassification"),Of.forEach(t),Nd=i(Un," can be found "),ca=s(Un,"A",{href:!0,rel:!0});var Qf=n(ca);Wd=i(Qf,"here"),Qf.forEach(t),Zd=i(Un,"."),Un.forEach(t),Pd=p(Ao),or=s(Ao,"LI",{});var Kf=n(or);Xs=s(Kf,"A",{href:!0});var eu=n(Xs);Ad=i(eu,"Image classification task guide"),eu.forEach(t),Kf.forEach(t),Ao.forEach(t),$i=p(o),Ys=s(o,"P",{});var tu=n(Ys);zd=i(tu,"Besides that:"),tu.forEach(t),Ei=p(o),Hs=s(o,"UL",{});var ou=n(Hs);oo=s(ou,"LI",{});var fi=n(oo);Os=s(fi,"A",{href:!0});var au=n(Os);Rd=i(au,"ViTForMaskedImageModeling"),au.forEach(t),Bd=i(fi," is supported by this "),ha=s(fi,"A",{href:!0,rel:!0});var su=n(ha);Gd=i(su,"example script"),su.forEach(t),Dd=i(fi,"."),fi.forEach(t),ou.forEach(t),Vi=p(o),Qs=s(o,"P",{});var nu=n(Qs);Sd=i(nu,"If you\u2019re interested in submitting a resource to be included here, please feel free to open a Pull Request and we\u2019ll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource."),nu.forEach(t),Fi=p(o),Ut=s(o,"H2",{class:!0});var ll=n(Ut);ao=s(ll,"A",{id:!0,class:!0,href:!0});var ru=n(ao);ar=s(ru,"SPAN",{});var iu=n(ar);w(pa.$$.fragment,iu),iu.forEach(t),ru.forEach(t),Ld=p(ll),sr=s(ll,"SPAN",{});var lu=n(sr);qd=i(lu,"Resources"),lu.forEach(t),ll.forEach(t),Ii=p(o),Ks=s(o,"P",{});var du=n(Ks);Xd=i(du,"A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with ViT. If you\u2019re interested in submitting a resource to be included here, please feel free to open a Pull Request and we\u2019ll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource."),du.forEach(t),ki=p(o),ma=s(o,"P",{});var tf=n(ma);nr=s(tf,"CODE",{});var cu=n(nr);Yd=i(cu,"ViTForImageClassification"),cu.forEach(t),Hd=i(tf," is supported by:"),tf.forEach(t),xi=p(o),w(fa.$$.fragment,o),ji=p(o),we=s(o,"UL",{});var gt=n(we);en=s(gt,"LI",{});var of=n(en);Od=i(of,"A blog post on how to "),ua=s(of,"A",{href:!0,rel:!0});var hu=n(ua);Qd=i(hu,"Fine-Tune ViT for Image Classification with Hugging Face Transformers"),hu.forEach(t),of.forEach(t),Kd=p(gt),tn=s(gt,"LI",{});var af=n(tn);ec=i(af,"A blog post on "),so=s(af,"A",{href:!0,rel:!0});var sf=n(so);tc=i(sf,"Image Classification with Hugging Face Transformers and "),rr=s(sf,"CODE",{});var pu=n(rr);oc=i(pu,"Keras"),pu.forEach(t),sf.forEach(t),af.forEach(t),ac=p(gt),on=s(gt,"LI",{});var nf=n(on);sc=i(nf,"A notebook on "),ga=s(nf,"A",{href:!0,rel:!0});var mu=n(ga);nc=i(mu,"Fine-tuning for Image Classification with Hugging Face Transformers"),mu.forEach(t),nf.forEach(t),rc=p(gt),an=s(gt,"LI",{});var rf=n(an);ic=i(rf,"A notebook on how to "),_a=s(rf,"A",{href:!0,rel:!0});var fu=n(_a);lc=i(fu,"Fine-tune the Vision Transformer on CIFAR-10 with the Hugging Face Trainer"),fu.forEach(t),rf.forEach(t),dc=p(gt),sn=s(gt,"LI",{});var lf=n(sn);cc=i(lf,"A notebook on how to "),va=s(lf,"A",{href:!0,rel:!0});var uu=n(va);hc=i(uu,"Fine-tune the Vision Transformer on CIFAR-10 with PyTorch Lightning"),uu.forEach(t),lf.forEach(t),gt.forEach(t),Ci=p(o),nn=s(o,"P",{});var gu=n(nn);pc=i(gu,"\u2697\uFE0F Optimization"),gu.forEach(t),Ui=p(o),rn=s(o,"UL",{});var _u=n(rn);ln=s(_u,"LI",{});var df=n(ln);mc=i(df,"A blog post on how to "),Ta=s(df,"A",{href:!0,rel:!0});var vu=n(Ta);fc=i(vu,"Accelerate Vision Transformer (ViT) with Quantization using Optimum"),vu.forEach(t),df.forEach(t),_u.forEach(t),Ji=p(o),dn=s(o,"P",{});var Tu=n(dn);uc=i(Tu,"\u26A1\uFE0F Inference"),Tu.forEach(t),Ni=p(o),cn=s(o,"UL",{});var bu=n(cn);hn=s(bu,"LI",{});var cf=n(hn);gc=i(cf,"A notebook on "),ba=s(cf,"A",{href:!0,rel:!0});var yu=n(ba);_c=i(yu,"Quick demo: Vision Transformer (ViT) by Google Brain"),yu.forEach(t),cf.forEach(t),bu.forEach(t),Wi=p(o),pn=s(o,"P",{});var wu=n(pn);vc=i(wu,"\u{1F680} Deploy"),wu.forEach(t),Zi=p(o),ut=s(o,"UL",{});var Jn=n(ut);mn=s(Jn,"LI",{});var hf=n(mn);Tc=i(hf,"A blog post on "),ya=s(hf,"A",{href:!0,rel:!0});var Mu=n(ya);bc=i(Mu,"Deploying Tensorflow Vision Models in Hugging Face with TF Serving"),Mu.forEach(t),hf.forEach(t),yc=p(Jn),fn=s(Jn,"LI",{});var pf=n(fn);wc=i(pf,"A blog post on "),wa=s(pf,"A",{href:!0,rel:!0});var $u=n(wa);Mc=i($u,"Deploying Hugging Face ViT on Vertex AI"),$u.forEach(t),pf.forEach(t),$c=p(Jn),un=s(Jn,"LI",{});var mf=n(un);Ec=i(mf,"A blog post on "),Ma=s(mf,"A",{href:!0,rel:!0});var Eu=n(Ma);Vc=i(Eu,"Deploying Hugging Face ViT on Kubernetes with TF Serving"),Eu.forEach(t),mf.forEach(t),Jn.forEach(t),Pi=p(o),Jt=s(o,"H2",{class:!0});var dl=n(Jt);no=s(dl,"A",{id:!0,class:!0,href:!0});var Vu=n(no);ir=s(Vu,"SPAN",{});var Fu=n(ir);w($a.$$.fragment,Fu),Fu.forEach(t),Vu.forEach(t),Fc=p(dl),lr=s(dl,"SPAN",{});var Iu=n(lr);Ic=i(Iu,"ViTConfig"),Iu.forEach(t),dl.forEach(t),Ai=p(o),je=s(o,"DIV",{class:!0});var zo=n(je);w(Ea.$$.fragment,zo),kc=p(zo),Nt=s(zo,"P",{});var Nn=n(Nt);xc=i(Nn,"This is the configuration class to store the configuration of a "),gn=s(Nn,"A",{href:!0});var ku=n(gn);jc=i(ku,"ViTModel"),ku.forEach(t),Cc=i(Nn,`. 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
`),Va=s(Nn,"A",{href:!0,rel:!0});var xu=n(Va);Uc=i(xu,"google/vit-base-patch16-224"),xu.forEach(t),Jc=i(Nn," architecture."),Nn.forEach(t),Nc=p(zo),Wt=s(zo,"P",{});var Wn=n(Wt);Wc=i(Wn,"Configuration objects inherit from "),_n=s(Wn,"A",{href:!0});var ju=n(_n);Zc=i(ju,"PretrainedConfig"),ju.forEach(t),Pc=i(Wn,` and can be used to control the model outputs. Read the
documentation from `),vn=s(Wn,"A",{href:!0});var Cu=n(vn);Ac=i(Cu,"PretrainedConfig"),Cu.forEach(t),zc=i(Wn," for more information."),Wn.forEach(t),Rc=p(zo),w(ro.$$.fragment,zo),zo.forEach(t),zi=p(o),Zt=s(o,"H2",{class:!0});var cl=n(Zt);io=s(cl,"A",{id:!0,class:!0,href:!0});var Uu=n(io);dr=s(Uu,"SPAN",{});var Ju=n(dr);w(Fa.$$.fragment,Ju),Ju.forEach(t),Uu.forEach(t),Bc=p(cl),cr=s(cl,"SPAN",{});var Nu=n(cr);Gc=i(Nu,"ViTFeatureExtractor"),Nu.forEach(t),cl.forEach(t),Ri=p(o),Pt=s(o,"DIV",{class:!0});var hl=n(Pt);w(Ia.$$.fragment,hl),Dc=p(hl),lo=s(hl,"DIV",{class:!0});var pl=n(lo);w(ka.$$.fragment,pl),Sc=p(pl),hr=s(pl,"P",{});var Wu=n(hr);Lc=i(Wu,"Preprocess an image or a batch of images."),Wu.forEach(t),pl.forEach(t),hl.forEach(t),Bi=p(o),At=s(o,"H2",{class:!0});var ml=n(At);co=s(ml,"A",{id:!0,class:!0,href:!0});var Zu=n(co);pr=s(Zu,"SPAN",{});var Pu=n(pr);w(xa.$$.fragment,Pu),Pu.forEach(t),Zu.forEach(t),qc=p(ml),mr=s(ml,"SPAN",{});var Au=n(mr);Xc=i(Au,"ViTImageProcessor"),Au.forEach(t),ml.forEach(t),Gi=p(o),dt=s(o,"DIV",{class:!0});var Zn=n(dt);w(ja.$$.fragment,Zn),Yc=p(Zn),fr=s(Zn,"P",{});var zu=n(fr);Hc=i(zu,"Constructs a ViT image processor."),zu.forEach(t),Oc=p(Zn),ho=s(Zn,"DIV",{class:!0});var fl=n(ho);w(Ca.$$.fragment,fl),Qc=p(fl),ur=s(fl,"P",{});var Ru=n(ur);Kc=i(Ru,"Preprocess an image or batch of images."),Ru.forEach(t),fl.forEach(t),Zn.forEach(t),Di=p(o),zt=s(o,"H2",{class:!0});var ul=n(zt);po=s(ul,"A",{id:!0,class:!0,href:!0});var Bu=n(po);gr=s(Bu,"SPAN",{});var Gu=n(gr);w(Ua.$$.fragment,Gu),Gu.forEach(t),Bu.forEach(t),eh=p(ul),_r=s(ul,"SPAN",{});var Du=n(_r);th=i(Du,"ViTModel"),Du.forEach(t),ul.forEach(t),Si=p(o),ct=s(o,"DIV",{class:!0});var Pn=n(ct);w(Ja.$$.fragment,Pn),oh=p(Pn),Na=s(Pn,"P",{});var gl=n(Na);ah=i(gl,`The bare ViT Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),Wa=s(gl,"A",{href:!0,rel:!0});var Su=n(Wa);sh=i(Su,"torch.nn.Module"),Su.forEach(t),nh=i(gl,` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),gl.forEach(t),rh=p(Pn),Pe=s(Pn,"DIV",{class:!0});var Ro=n(Pe);w(Za.$$.fragment,Ro),ih=p(Ro),Rt=s(Ro,"P",{});var An=n(Rt);lh=i(An,"The "),Tn=s(An,"A",{href:!0});var Lu=n(Tn);dh=i(Lu,"ViTModel"),Lu.forEach(t),ch=i(An," forward method, overrides the "),vr=s(An,"CODE",{});var qu=n(vr);hh=i(qu,"__call__"),qu.forEach(t),ph=i(An," special method."),An.forEach(t),mh=p(Ro),w(mo.$$.fragment,Ro),fh=p(Ro),w(fo.$$.fragment,Ro),Ro.forEach(t),Pn.forEach(t),Li=p(o),Bt=s(o,"H2",{class:!0});var _l=n(Bt);uo=s(_l,"A",{id:!0,class:!0,href:!0});var Xu=n(uo);Tr=s(Xu,"SPAN",{});var Yu=n(Tr);w(Pa.$$.fragment,Yu),Yu.forEach(t),Xu.forEach(t),uh=p(_l),br=s(_l,"SPAN",{});var Hu=n(br);gh=i(Hu,"ViTForMaskedImageModeling"),Hu.forEach(t),_l.forEach(t),qi=p(o),ge=s(o,"DIV",{class:!0});var _t=n(ge);w(Aa.$$.fragment,_t),_h=p(_t),za=s(_t,"P",{});var vl=n(za);vh=i(vl,"ViT Model with a decoder on top for masked image modeling, as proposed in "),Ra=s(vl,"A",{href:!0,rel:!0});var Ou=n(Ra);Th=i(Ou,"SimMIM"),Ou.forEach(t),bh=i(vl,"."),vl.forEach(t),yh=p(_t),w(go.$$.fragment,_t),wh=p(_t),Ba=s(_t,"P",{});var Tl=n(Ba);Mh=i(Tl,"This model is a PyTorch "),Ga=s(Tl,"A",{href:!0,rel:!0});var Qu=n(Ga);$h=i(Qu,"torch.nn.Module"),Qu.forEach(t),Eh=i(Tl,` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Tl.forEach(t),Vh=p(_t),Ae=s(_t,"DIV",{class:!0});var Bo=n(Ae);w(Da.$$.fragment,Bo),Fh=p(Bo),Gt=s(Bo,"P",{});var zn=n(Gt);Ih=i(zn,"The "),bn=s(zn,"A",{href:!0});var Ku=n(bn);kh=i(Ku,"ViTForMaskedImageModeling"),Ku.forEach(t),xh=i(zn," forward method, overrides the "),yr=s(zn,"CODE",{});var eg=n(yr);jh=i(eg,"__call__"),eg.forEach(t),Ch=i(zn," special method."),zn.forEach(t),Uh=p(Bo),w(_o.$$.fragment,Bo),Jh=p(Bo),w(vo.$$.fragment,Bo),Bo.forEach(t),_t.forEach(t),Xi=p(o),Dt=s(o,"H2",{class:!0});var bl=n(Dt);To=s(bl,"A",{id:!0,class:!0,href:!0});var tg=n(To);wr=s(tg,"SPAN",{});var og=n(wr);w(Sa.$$.fragment,og),og.forEach(t),tg.forEach(t),Nh=p(bl),Mr=s(bl,"SPAN",{});var ag=n(Mr);Wh=i(ag,"ViTForImageClassification"),ag.forEach(t),bl.forEach(t),Yi=p(o),_e=s(o,"DIV",{class:!0});var vt=n(_e);w(La.$$.fragment,vt),Zh=p(vt),$r=s(vt,"P",{});var sg=n($r);Ph=i(sg,`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.`),sg.forEach(t),Ah=p(vt),w(bo.$$.fragment,vt),zh=p(vt),qa=s(vt,"P",{});var yl=n(qa);Rh=i(yl,"This model is a PyTorch "),Xa=s(yl,"A",{href:!0,rel:!0});var ng=n(Xa);Bh=i(ng,"torch.nn.Module"),ng.forEach(t),Gh=i(yl,` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),yl.forEach(t),Dh=p(vt),ze=s(vt,"DIV",{class:!0});var Go=n(ze);w(Ya.$$.fragment,Go),Sh=p(Go),St=s(Go,"P",{});var Rn=n(St);Lh=i(Rn,"The "),yn=s(Rn,"A",{href:!0});var rg=n(yn);qh=i(rg,"ViTForImageClassification"),rg.forEach(t),Xh=i(Rn," forward method, overrides the "),Er=s(Rn,"CODE",{});var ig=n(Er);Yh=i(ig,"__call__"),ig.forEach(t),Hh=i(Rn," special method."),Rn.forEach(t),Oh=p(Go),w(yo.$$.fragment,Go),Qh=p(Go),w(wo.$$.fragment,Go),Go.forEach(t),vt.forEach(t),Hi=p(o),Lt=s(o,"H2",{class:!0});var wl=n(Lt);Mo=s(wl,"A",{id:!0,class:!0,href:!0});var lg=n(Mo);Vr=s(lg,"SPAN",{});var dg=n(Vr);w(Ha.$$.fragment,dg),dg.forEach(t),lg.forEach(t),Kh=p(wl),Fr=s(wl,"SPAN",{});var cg=n(Fr);ep=i(cg,"TFViTModel"),cg.forEach(t),wl.forEach(t),Oi=p(o),oe=s(o,"DIV",{class:!0});var Se=n(oe);w(Oa.$$.fragment,Se),tp=p(Se),Ir=s(Se,"P",{});var hg=n(Ir);op=i(hg,"The bare ViT Model transformer outputting raw hidden-states without any specific head on top."),hg.forEach(t),ap=p(Se),Qa=s(Se,"P",{});var Ml=n(Qa);sp=i(Ml,"This model inherits from "),wn=s(Ml,"A",{href:!0});var pg=n(wn);np=i(pg,"TFPreTrainedModel"),pg.forEach(t),rp=i(Ml,`. 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.)`),Ml.forEach(t),ip=p(Se),Ka=s(Se,"P",{});var $l=n(Ka);lp=i($l,"This model is also a "),es=s($l,"A",{href:!0,rel:!0});var mg=n(es);dp=i(mg,"tf.keras.Model"),mg.forEach(t),cp=i($l,` 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.`),$l.forEach(t),hp=p(Se),w($o.$$.fragment,Se),pp=p(Se),Re=s(Se,"DIV",{class:!0});var Do=n(Re);w(ts.$$.fragment,Do),mp=p(Do),qt=s(Do,"P",{});var Bn=n(qt);fp=i(Bn,"The "),Mn=s(Bn,"A",{href:!0});var fg=n(Mn);up=i(fg,"TFViTModel"),fg.forEach(t),gp=i(Bn," forward method, overrides the "),kr=s(Bn,"CODE",{});var ug=n(kr);_p=i(ug,"__call__"),ug.forEach(t),vp=i(Bn," special method."),Bn.forEach(t),Tp=p(Do),w(Eo.$$.fragment,Do),bp=p(Do),w(Vo.$$.fragment,Do),Do.forEach(t),Se.forEach(t),Qi=p(o),Xt=s(o,"H2",{class:!0});var El=n(Xt);Fo=s(El,"A",{id:!0,class:!0,href:!0});var gg=n(Fo);xr=s(gg,"SPAN",{});var _g=n(xr);w(os.$$.fragment,_g),_g.forEach(t),gg.forEach(t),yp=p(El),jr=s(El,"SPAN",{});var vg=n(jr);wp=i(vg,"TFViTForImageClassification"),vg.forEach(t),El.forEach(t),Ki=p(o),q=s(o,"DIV",{class:!0});var Me=n(q);w(as.$$.fragment,Me),Mp=p(Me),Cr=s(Me,"P",{});var Tg=n(Cr);$p=i(Tg,`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.`),Tg.forEach(t),Ep=p(Me),w(Io.$$.fragment,Me),Vp=p(Me),ss=s(Me,"P",{});var Vl=n(ss);Fp=i(Vl,"This model inherits from "),$n=s(Vl,"A",{href:!0});var bg=n($n);Ip=i(bg,"TFPreTrainedModel"),bg.forEach(t),kp=i(Vl,`. 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.)`),Vl.forEach(t),xp=p(Me),ns=s(Me,"P",{});var Fl=n(ns);jp=i(Fl,"This model is also a "),rs=s(Fl,"A",{href:!0,rel:!0});var yg=n(rs);Cp=i(yg,"tf.keras.Model"),yg.forEach(t),Up=i(Fl,` 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.`),Fl.forEach(t),Jp=p(Me),w(ko.$$.fragment,Me),Np=p(Me),Be=s(Me,"DIV",{class:!0});var So=n(Be);w(is.$$.fragment,So),Wp=p(So),Yt=s(So,"P",{});var Gn=n(Yt);Zp=i(Gn,"The "),En=s(Gn,"A",{href:!0});var wg=n(En);Pp=i(wg,"TFViTForImageClassification"),wg.forEach(t),Ap=i(Gn," forward method, overrides the "),Ur=s(Gn,"CODE",{});var Mg=n(Ur);zp=i(Mg,"__call__"),Mg.forEach(t),Rp=i(Gn," special method."),Gn.forEach(t),Bp=p(So),w(xo.$$.fragment,So),Gp=p(So),w(jo.$$.fragment,So),So.forEach(t),Me.forEach(t),el=p(o),Ht=s(o,"H2",{class:!0});var Il=n(Ht);Co=s(Il,"A",{id:!0,class:!0,href:!0});var $g=n(Co);Jr=s($g,"SPAN",{});var Eg=n(Jr);w(ls.$$.fragment,Eg),Eg.forEach(t),$g.forEach(t),Dp=p(Il),Nr=s(Il,"SPAN",{});var Vg=n(Nr);Sp=i(Vg,"FlaxVitModel"),Vg.forEach(t),Il.forEach(t),tl=p(o),X=s(o,"DIV",{class:!0});var $e=n(X);w(ds.$$.fragment,$e),Lp=p($e),Wr=s($e,"P",{});var Fg=n(Wr);qp=i(Fg,"The bare ViT Model transformer outputting raw hidden-states without any specific head on top."),Fg.forEach(t),Xp=p($e),cs=s($e,"P",{});var kl=n(cs);Yp=i(kl,"This model inherits from "),Vn=s(kl,"A",{href:!0});var Ig=n(Vn);Hp=i(Ig,"FlaxPreTrainedModel"),Ig.forEach(t),Op=i(kl,`. 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)`),kl.forEach(t),Qp=p($e),hs=s($e,"P",{});var xl=n(hs);Kp=i(xl,"This model is also a Flax Linen "),ps=s(xl,"A",{href:!0,rel:!0});var kg=n(ps);em=i(kg,"flax.linen.Module"),kg.forEach(t),tm=i(xl,`
subclass. Use it as a regular Flax linen Module and refer to the Flax documentation for all matter related to
general usage and behavior.`),xl.forEach(t),om=p($e),Zr=s($e,"P",{});var xg=n(Zr);am=i(xg,"Finally, this model supports inherent JAX features such as:"),xg.forEach(t),sm=p($e),ht=s($e,"UL",{});var Lo=n(ht);Pr=s(Lo,"LI",{});var jg=n(Pr);ms=s(jg,"A",{href:!0,rel:!0});var Cg=n(ms);nm=i(Cg,"Just-In-Time (JIT) compilation"),Cg.forEach(t),jg.forEach(t),rm=p(Lo),Ar=s(Lo,"LI",{});var Ug=n(Ar);fs=s(Ug,"A",{href:!0,rel:!0});var Jg=n(fs);im=i(Jg,"Automatic Differentiation"),Jg.forEach(t),Ug.forEach(t),lm=p(Lo),zr=s(Lo,"LI",{});var Ng=n(zr);us=s(Ng,"A",{href:!0,rel:!0});var Wg=n(us);dm=i(Wg,"Vectorization"),Wg.forEach(t),Ng.forEach(t),cm=p(Lo),Rr=s(Lo,"LI",{});var Zg=n(Rr);gs=s(Zg,"A",{href:!0,rel:!0});var Pg=n(gs);hm=i(Pg,"Parallelization"),Pg.forEach(t),Zg.forEach(t),Lo.forEach(t),pm=p($e),Ge=s($e,"DIV",{class:!0});var qo=n(Ge);w(_s.$$.fragment,qo),mm=p(qo),Ot=s(qo,"P",{});var Dn=n(Ot);fm=i(Dn,"The "),Br=s(Dn,"CODE",{});var Ag=n(Br);um=i(Ag,"FlaxViTPreTrainedModel"),Ag.forEach(t),gm=i(Dn," forward method, overrides the "),Gr=s(Dn,"CODE",{});var zg=n(Gr);_m=i(zg,"__call__"),zg.forEach(t),vm=i(Dn," special method."),Dn.forEach(t),Tm=p(qo),w(Uo.$$.fragment,qo),bm=p(qo),w(Jo.$$.fragment,qo),qo.forEach(t),$e.forEach(t),ol=p(o),Qt=s(o,"H2",{class:!0});var jl=n(Qt);No=s(jl,"A",{id:!0,class:!0,href:!0});var Rg=n(No);Dr=s(Rg,"SPAN",{});var Bg=n(Dr);w(vs.$$.fragment,Bg),Bg.forEach(t),Rg.forEach(t),ym=p(jl),Sr=s(jl,"SPAN",{});var Gg=n(Sr);wm=i(Gg,"FlaxViTForImageClassification"),Gg.forEach(t),jl.forEach(t),al=p(o),Y=s(o,"DIV",{class:!0});var Ee=n(Y);w(Ts.$$.fragment,Ee),Mm=p(Ee),Lr=s(Ee,"P",{});var Dg=n(Lr);$m=i(Dg,`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.`),Dg.forEach(t),Em=p(Ee),bs=s(Ee,"P",{});var Cl=n(bs);Vm=i(Cl,"This model inherits from "),Fn=s(Cl,"A",{href:!0});var Sg=n(Fn);Fm=i(Sg,"FlaxPreTrainedModel"),Sg.forEach(t),Im=i(Cl,`. 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)`),Cl.forEach(t),km=p(Ee),ys=s(Ee,"P",{});var Ul=n(ys);xm=i(Ul,"This model is also a Flax Linen "),ws=s(Ul,"A",{href:!0,rel:!0});var Lg=n(ws);jm=i(Lg,"flax.linen.Module"),Lg.forEach(t),Cm=i(Ul,`
subclass. Use it as a regular Flax linen Module and refer to the Flax documentation for all matter related to
general usage and behavior.`),Ul.forEach(t),Um=p(Ee),qr=s(Ee,"P",{});var qg=n(qr);Jm=i(qg,"Finally, this model supports inherent JAX features such as:"),qg.forEach(t),Nm=p(Ee),pt=s(Ee,"UL",{});var Xo=n(pt);Xr=s(Xo,"LI",{});var Xg=n(Xr);Ms=s(Xg,"A",{href:!0,rel:!0});var Yg=n(Ms);Wm=i(Yg,"Just-In-Time (JIT) compilation"),Yg.forEach(t),Xg.forEach(t),Zm=p(Xo),Yr=s(Xo,"LI",{});var Hg=n(Yr);$s=s(Hg,"A",{href:!0,rel:!0});var Og=n($s);Pm=i(Og,"Automatic Differentiation"),Og.forEach(t),Hg.forEach(t),Am=p(Xo),Hr=s(Xo,"LI",{});var Qg=n(Hr);Es=s(Qg,"A",{href:!0,rel:!0});var Kg=n(Es);zm=i(Kg,"Vectorization"),Kg.forEach(t),Qg.forEach(t),Rm=p(Xo),Or=s(Xo,"LI",{});var e_=n(Or);Vs=s(e_,"A",{href:!0,rel:!0});var t_=n(Vs);Bm=i(t_,"Parallelization"),t_.forEach(t),e_.forEach(t),Xo.forEach(t),Gm=p(Ee),De=s(Ee,"DIV",{class:!0});var Yo=n(De);w(Fs.$$.fragment,Yo),Dm=p(Yo),Kt=s(Yo,"P",{});var Sn=n(Kt);Sm=i(Sn,"The "),Qr=s(Sn,"CODE",{});var o_=n(Qr);Lm=i(o_,"FlaxViTPreTrainedModel"),o_.forEach(t),qm=i(Sn," forward method, overrides the "),Kr=s(Sn,"CODE",{});var a_=n(Kr);Xm=i(a_,"__call__"),a_.forEach(t),Ym=i(Sn," special method."),Sn.forEach(t),Hm=p(Yo),w(Wo.$$.fragment,Yo),Om=p(Yo),w(Zo.$$.fragment,Yo),Yo.forEach(t),Ee.forEach(t),this.h()},h(){d(c,"name","hf:doc:metadata"),d(c,"content",JSON.stringify(C_)),d(_,"id","vision-transformer-vit"),d(_,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(_,"href","#vision-transformer-vit"),d(g,"class","relative group"),d(P,"id","overview"),d(P,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(P,"href","#overview"),d(N,"class","relative group"),d(re,"href","https://arxiv.org/abs/2010.11929"),d(re,"rel","nofollow"),d(L,"href","https://github.com/NielsRogge/Transformers-Tutorials/tree/master/VisionTransformer"),d(L,"rel","nofollow"),d(Te,"href","/docs/transformers/v4.33.0/en/model_doc/vit#transformers.ViTImageProcessor"),d(Z,"href","https://huggingface.co/models?search=vit"),d(Z,"rel","nofollow"),d(te,"href","http://www.image-net.org/"),d(te,"rel","nofollow"),d(j,"href","http://www.image-net.org/challenges/LSVRC/2012/"),d(j,"rel","nofollow"),d(G,"href","https://arxiv.org/abs/1906.06423"),d(G,"rel","nofollow"),d(ke,"href","https://arxiv.org/abs/1912.11370"),d(ke,"rel","nofollow"),d_(ye.src,ff="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/model_doc/vit_architecture.jpg")||d(ye,"src",ff),d(ye,"alt","drawing"),d(ye,"width","600"),d(Js,"href","https://arxiv.org/abs/2010.11929"),d(Ws,"href","deit"),d(Zs,"href","/docs/transformers/v4.33.0/en/model_doc/vit#transformers.ViTModel"),d(Ps,"href","/docs/transformers/v4.33.0/en/model_doc/vit#transformers.ViTForImageClassification"),d(As,"href","/docs/transformers/v4.33.0/en/model_doc/deit#transformers.DeiTImageProcessor"),d(Rs,"href","beit"),d(ta,"href","https://huggingface.co/models?other=dino"),d(ta,"rel","nofollow"),d(Gs,"href","vit_mae"),d(oa,"href","https://huggingface.co/nielsr"),d(oa,"rel","nofollow"),d(aa,"href","https://github.com/google-research/vision_transformer"),d(aa,"rel","nofollow"),d(sa,"href","https://github.com/rwightman/pytorch-image-models"),d(sa,"rel","nofollow"),d(to,"id","resources"),d(to,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(to,"href","#resources"),d(xt,"class","relative group"),d(Ss,"href","/docs/transformers/v4.33.0/en/model_doc/vit#transformers.ViTForImageClassification"),d(ia,"href","https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-classification"),d(ia,"rel","nofollow"),d(la,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/image_classification.ipynb"),d(la,"rel","nofollow"),d(Ls,"href","/docs/transformers/v4.33.0/en/model_doc/vit#transformers.ViTForImageClassification"),d(da,"href","https://huggingface.co/blog/fine-tune-vit"),d(da,"rel","nofollow"),d(qs,"href","/docs/transformers/v4.33.0/en/model_doc/vit#transformers.ViTForImageClassification"),d(ca,"href","https://github.com/NielsRogge/Transformers-Tutorials/tree/master/VisionTransformer"),d(ca,"rel","nofollow"),d(Xs,"href","../tasks/image_classification"),d(Os,"href","/docs/transformers/v4.33.0/en/model_doc/vit#transformers.ViTForMaskedImageModeling"),d(ha,"href","https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-pretraining"),d(ha,"rel","nofollow"),d(ao,"id","resources"),d(ao,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(ao,"href","#resources"),d(Ut,"class","relative group"),d(ua,"href","https://huggingface.co/blog/fine-tune-vit"),d(ua,"rel","nofollow"),d(so,"href","https://www.philschmid.de/image-classification-huggingface-transformers-keras"),d(so,"rel","nofollow"),d(ga,"href","https://github.com/huggingface/notebooks/blob/main/examples/image_classification.ipynb"),d(ga,"rel","nofollow"),d(_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"),d(_a,"rel","nofollow"),d(va,"href","https://github.com/NielsRogge/Transformers-Tutorials/blob/master/VisionTransformer/Fine_tuning_the_Vision_Transformer_on_CIFAR_10_with_PyTorch_Lightning.ipynb"),d(va,"rel","nofollow"),d(Ta,"href","https://www.philschmid.de/optimizing-vision-transformer"),d(Ta,"rel","nofollow"),d(ba,"href","https://github.com/NielsRogge/Transformers-Tutorials/blob/master/VisionTransformer/Quick_demo_of_HuggingFace_version_of_Vision_Transformer_inference.ipynb"),d(ba,"rel","nofollow"),d(ya,"href","https://huggingface.co/blog/tf-serving-vision"),d(ya,"rel","nofollow"),d(wa,"href","https://huggingface.co/blog/deploy-vertex-ai"),d(wa,"rel","nofollow"),d(Ma,"href","https://huggingface.co/blog/deploy-tfserving-kubernetes"),d(Ma,"rel","nofollow"),d(no,"id","transformers.ViTConfig"),d(no,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(no,"href","#transformers.ViTConfig"),d(Jt,"class","relative group"),d(gn,"href","/docs/transformers/v4.33.0/en/model_doc/vit#transformers.ViTModel"),d(Va,"href","https://huggingface.co/google/vit-base-patch16-224"),d(Va,"rel","nofollow"),d(_n,"href","/docs/transformers/v4.33.0/en/main_classes/configuration#transformers.PretrainedConfig"),d(vn,"href","/docs/transformers/v4.33.0/en/main_classes/configuration#transformers.PretrainedConfig"),d(je,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(io,"id","transformers.ViTFeatureExtractor"),d(io,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(io,"href","#transformers.ViTFeatureExtractor"),d(Zt,"class","relative group"),d(lo,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Pt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(co,"id","transformers.ViTImageProcessor"),d(co,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(co,"href","#transformers.ViTImageProcessor"),d(At,"class","relative group"),d(ho,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(dt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(po,"id","transformers.ViTModel"),d(po,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(po,"href","#transformers.ViTModel"),d(zt,"class","relative group"),d(Wa,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),d(Wa,"rel","nofollow"),d(Tn,"href","/docs/transformers/v4.33.0/en/model_doc/vit#transformers.ViTModel"),d(Pe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(ct,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(uo,"id","transformers.ViTForMaskedImageModeling"),d(uo,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(uo,"href","#transformers.ViTForMaskedImageModeling"),d(Bt,"class","relative group"),d(Ra,"href","https://arxiv.org/abs/2111.09886"),d(Ra,"rel","nofollow"),d(Ga,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),d(Ga,"rel","nofollow"),d(bn,"href","/docs/transformers/v4.33.0/en/model_doc/vit#transformers.ViTForMaskedImageModeling"),d(Ae,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(ge,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(To,"id","transformers.ViTForImageClassification"),d(To,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(To,"href","#transformers.ViTForImageClassification"),d(Dt,"class","relative group"),d(Xa,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),d(Xa,"rel","nofollow"),d(yn,"href","/docs/transformers/v4.33.0/en/model_doc/vit#transformers.ViTForImageClassification"),d(ze,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(_e,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Mo,"id","transformers.TFViTModel"),d(Mo,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(Mo,"href","#transformers.TFViTModel"),d(Lt,"class","relative group"),d(wn,"href","/docs/transformers/v4.33.0/en/main_classes/model#transformers.TFPreTrainedModel"),d(es,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),d(es,"rel","nofollow"),d(Mn,"href","/docs/transformers/v4.33.0/en/model_doc/vit#transformers.TFViTModel"),d(Re,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(oe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Fo,"id","transformers.TFViTForImageClassification"),d(Fo,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(Fo,"href","#transformers.TFViTForImageClassification"),d(Xt,"class","relative group"),d($n,"href","/docs/transformers/v4.33.0/en/main_classes/model#transformers.TFPreTrainedModel"),d(rs,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),d(rs,"rel","nofollow"),d(En,"href","/docs/transformers/v4.33.0/en/model_doc/vit#transformers.TFViTForImageClassification"),d(Be,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Co,"id","transformers.FlaxViTModel"),d(Co,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(Co,"href","#transformers.FlaxViTModel"),d(Ht,"class","relative group"),d(Vn,"href","/docs/transformers/v4.33.0/en/main_classes/model#transformers.FlaxPreTrainedModel"),d(ps,"href","https://flax.readthedocs.io/en/latest/flax.linen.html#module"),d(ps,"rel","nofollow"),d(ms,"href","https://jax.readthedocs.io/en/latest/jax.html#just-in-time-compilation-jit"),d(ms,"rel","nofollow"),d(fs,"href","https://jax.readthedocs.io/en/latest/jax.html#automatic-differentiation"),d(fs,"rel","nofollow"),d(us,"href","https://jax.readthedocs.io/en/latest/jax.html#vectorization-vmap"),d(us,"rel","nofollow"),d(gs,"href","https://jax.readthedocs.io/en/latest/jax.html#parallelization-pmap"),d(gs,"rel","nofollow"),d(Ge,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(X,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(No,"id","transformers.FlaxViTForImageClassification"),d(No,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(No,"href","#transformers.FlaxViTForImageClassification"),d(Qt,"class","relative group"),d(Fn,"href","/docs/transformers/v4.33.0/en/main_classes/model#transformers.FlaxPreTrainedModel"),d(ws,"href","https://flax.readthedocs.io/en/latest/flax.linen.html#module"),d(ws,"rel","nofollow"),d(Ms,"href","https://jax.readthedocs.io/en/latest/jax.html#just-in-time-compilation-jit"),d(Ms,"rel","nofollow"),d($s,"href","https://jax.readthedocs.io/en/latest/jax.html#automatic-differentiation"),d($s,"rel","nofollow"),d(Es,"href","https://jax.readthedocs.io/en/latest/jax.html#vectorization-vmap"),d(Es,"rel","nofollow"),d(Vs,"href","https://jax.readthedocs.io/en/latest/jax.html#parallelization-pmap"),d(Vs,"rel","nofollow"),d(De,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Y,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(o,m){e(document.head,c),f(o,T,m),f(o,g,m),e(g,_),e(_,v),M(l,v,null),e(g,u),e(g,F),e(F,W),f(o,C,m),f(o,N,m),e(N,P),e(P,ne),M(k,ne,null),e(N,qe),e(N,K),e(K,Xe),f(o,Ce,m),f(o,D,m),e(D,Ye),e(D,re),e(re,ie),e(D,He),f(o,Ue,m),f(o,O,m),e(O,Oe),f(o,Je,m),f(o,Q,m),e(Q,Fe),e(Fe,Qe),f(o,ve,m),f(o,J,m),e(J,A),f(o,Ne,m),f(o,U,m),e(U,le),e(le,Ke),e(le,L),e(L,et),e(le,tt),e(U,z),e(U,Ie),e(Ie,de),e(U,ot),e(U,ce),e(ce,he),e(ce,Te),e(Te,at),e(ce,ee),e(U,st),e(U,R),e(R,nt),e(R,pe),e(pe,B),e(R,rt),e(R,Z),e(Z,it),e(R,lt),e(U,b),e(U,x),e(x,Tt),e(x,te),e(te,bt),e(x,yt),e(x,j),e(j,wt),e(x,Mt),e(U,$t),e(U,me),e(me,Et),e(me,G),e(G,fe),e(me,Vt),e(me,ke),e(ke,ue),e(me,Ft),e(U,It),e(U,xe),e(xe,kt),f(o,be,m),f(o,ye,m),f(o,ui,m),f(o,Ko,m),e(Ko,Jl),e(Ko,Js),e(Js,Nl),f(o,gi,m),f(o,Ns,m),e(Ns,Wl),f(o,_i,m),f(o,We,m),e(We,Ln),e(Ln,S),e(S,Ws),e(Ws,Zl),e(S,Pl),e(S,Zs),e(Zs,Al),e(S,zl),e(S,Ps),e(Ps,Rl),e(S,Bl),e(S,qn),e(qn,Gl),e(S,Dl),e(S,Xn),e(Xn,Sl),e(S,Ll),e(S,Yn),e(Yn,ql),e(S,Xl),e(S,Hn),e(Hn,Yl),e(S,Hl),e(S,As),e(As,Ol),e(S,Ql),e(We,Kl),e(We,On),e(On,zs),e(zs,Rs),e(Rs,ed),e(zs,td),e(We,od),e(We,Qn),e(Qn,ea),e(ea,ad),e(ea,ta),e(ta,sd),e(ea,nd),e(We,rd),e(We,Kn),e(Kn,Bs),e(Bs,Gs),e(Gs,id),e(Bs,ld),f(o,vi,m),f(o,mt,m),e(mt,dd),e(mt,oa),e(oa,cd),e(mt,hd),e(mt,aa),e(aa,pd),e(mt,md),f(o,Ti,m),f(o,eo,m),e(eo,fd),e(eo,sa),e(sa,ud),e(eo,gd),f(o,bi,m),f(o,xt,m),e(xt,to),e(to,er),M(na,er,null),e(xt,_d),e(xt,tr),e(tr,vd),f(o,yi,m),f(o,Ds,m),e(Ds,Td),f(o,wi,m),M(ra,o,m),f(o,Mi,m),f(o,Ze,m),e(Ze,ft),e(ft,Ss),e(Ss,bd),e(ft,yd),e(ft,ia),e(ia,wd),e(ft,Md),e(ft,la),e(la,$d),e(ft,Ed),e(Ze,Vd),e(Ze,jt),e(jt,Fd),e(jt,Ls),e(Ls,Id),e(jt,kd),e(jt,da),e(da,xd),e(jt,jd),e(Ze,Cd),e(Ze,Ct),e(Ct,Ud),e(Ct,qs),e(qs,Jd),e(Ct,Nd),e(Ct,ca),e(ca,Wd),e(Ct,Zd),e(Ze,Pd),e(Ze,or),e(or,Xs),e(Xs,Ad),f(o,$i,m),f(o,Ys,m),e(Ys,zd),f(o,Ei,m),f(o,Hs,m),e(Hs,oo),e(oo,Os),e(Os,Rd),e(oo,Bd),e(oo,ha),e(ha,Gd),e(oo,Dd),f(o,Vi,m),f(o,Qs,m),e(Qs,Sd),f(o,Fi,m),f(o,Ut,m),e(Ut,ao),e(ao,ar),M(pa,ar,null),e(Ut,Ld),e(Ut,sr),e(sr,qd),f(o,Ii,m),f(o,Ks,m),e(Ks,Xd),f(o,ki,m),f(o,ma,m),e(ma,nr),e(nr,Yd),e(ma,Hd),f(o,xi,m),M(fa,o,m),f(o,ji,m),f(o,we,m),e(we,en),e(en,Od),e(en,ua),e(ua,Qd),e(we,Kd),e(we,tn),e(tn,ec),e(tn,so),e(so,tc),e(so,rr),e(rr,oc),e(we,ac),e(we,on),e(on,sc),e(on,ga),e(ga,nc),e(we,rc),e(we,an),e(an,ic),e(an,_a),e(_a,lc),e(we,dc),e(we,sn),e(sn,cc),e(sn,va),e(va,hc),f(o,Ci,m),f(o,nn,m),e(nn,pc),f(o,Ui,m),f(o,rn,m),e(rn,ln),e(ln,mc),e(ln,Ta),e(Ta,fc),f(o,Ji,m),f(o,dn,m),e(dn,uc),f(o,Ni,m),f(o,cn,m),e(cn,hn),e(hn,gc),e(hn,ba),e(ba,_c),f(o,Wi,m),f(o,pn,m),e(pn,vc),f(o,Zi,m),f(o,ut,m),e(ut,mn),e(mn,Tc),e(mn,ya),e(ya,bc),e(ut,yc),e(ut,fn),e(fn,wc),e(fn,wa),e(wa,Mc),e(ut,$c),e(ut,un),e(un,Ec),e(un,Ma),e(Ma,Vc),f(o,Pi,m),f(o,Jt,m),e(Jt,no),e(no,ir),M($a,ir,null),e(Jt,Fc),e(Jt,lr),e(lr,Ic),f(o,Ai,m),f(o,je,m),M(Ea,je,null),e(je,kc),e(je,Nt),e(Nt,xc),e(Nt,gn),e(gn,jc),e(Nt,Cc),e(Nt,Va),e(Va,Uc),e(Nt,Jc),e(je,Nc),e(je,Wt),e(Wt,Wc),e(Wt,_n),e(_n,Zc),e(Wt,Pc),e(Wt,vn),e(vn,Ac),e(Wt,zc),e(je,Rc),M(ro,je,null),f(o,zi,m),f(o,Zt,m),e(Zt,io),e(io,dr),M(Fa,dr,null),e(Zt,Bc),e(Zt,cr),e(cr,Gc),f(o,Ri,m),f(o,Pt,m),M(Ia,Pt,null),e(Pt,Dc),e(Pt,lo),M(ka,lo,null),e(lo,Sc),e(lo,hr),e(hr,Lc),f(o,Bi,m),f(o,At,m),e(At,co),e(co,pr),M(xa,pr,null),e(At,qc),e(At,mr),e(mr,Xc),f(o,Gi,m),f(o,dt,m),M(ja,dt,null),e(dt,Yc),e(dt,fr),e(fr,Hc),e(dt,Oc),e(dt,ho),M(Ca,ho,null),e(ho,Qc),e(ho,ur),e(ur,Kc),f(o,Di,m),f(o,zt,m),e(zt,po),e(po,gr),M(Ua,gr,null),e(zt,eh),e(zt,_r),e(_r,th),f(o,Si,m),f(o,ct,m),M(Ja,ct,null),e(ct,oh),e(ct,Na),e(Na,ah),e(Na,Wa),e(Wa,sh),e(Na,nh),e(ct,rh),e(ct,Pe),M(Za,Pe,null),e(Pe,ih),e(Pe,Rt),e(Rt,lh),e(Rt,Tn),e(Tn,dh),e(Rt,ch),e(Rt,vr),e(vr,hh),e(Rt,ph),e(Pe,mh),M(mo,Pe,null),e(Pe,fh),M(fo,Pe,null),f(o,Li,m),f(o,Bt,m),e(Bt,uo),e(uo,Tr),M(Pa,Tr,null),e(Bt,uh),e(Bt,br),e(br,gh),f(o,qi,m),f(o,ge,m),M(Aa,ge,null),e(ge,_h),e(ge,za),e(za,vh),e(za,Ra),e(Ra,Th),e(za,bh),e(ge,yh),M(go,ge,null),e(ge,wh),e(ge,Ba),e(Ba,Mh),e(Ba,Ga),e(Ga,$h),e(Ba,Eh),e(ge,Vh),e(ge,Ae),M(Da,Ae,null),e(Ae,Fh),e(Ae,Gt),e(Gt,Ih),e(Gt,bn),e(bn,kh),e(Gt,xh),e(Gt,yr),e(yr,jh),e(Gt,Ch),e(Ae,Uh),M(_o,Ae,null),e(Ae,Jh),M(vo,Ae,null),f(o,Xi,m),f(o,Dt,m),e(Dt,To),e(To,wr),M(Sa,wr,null),e(Dt,Nh),e(Dt,Mr),e(Mr,Wh),f(o,Yi,m),f(o,_e,m),M(La,_e,null),e(_e,Zh),e(_e,$r),e($r,Ph),e(_e,Ah),M(bo,_e,null),e(_e,zh),e(_e,qa),e(qa,Rh),e(qa,Xa),e(Xa,Bh),e(qa,Gh),e(_e,Dh),e(_e,ze),M(Ya,ze,null),e(ze,Sh),e(ze,St),e(St,Lh),e(St,yn),e(yn,qh),e(St,Xh),e(St,Er),e(Er,Yh),e(St,Hh),e(ze,Oh),M(yo,ze,null),e(ze,Qh),M(wo,ze,null),f(o,Hi,m),f(o,Lt,m),e(Lt,Mo),e(Mo,Vr),M(Ha,Vr,null),e(Lt,Kh),e(Lt,Fr),e(Fr,ep),f(o,Oi,m),f(o,oe,m),M(Oa,oe,null),e(oe,tp),e(oe,Ir),e(Ir,op),e(oe,ap),e(oe,Qa),e(Qa,sp),e(Qa,wn),e(wn,np),e(Qa,rp),e(oe,ip),e(oe,Ka),e(Ka,lp),e(Ka,es),e(es,dp),e(Ka,cp),e(oe,hp),M($o,oe,null),e(oe,pp),e(oe,Re),M(ts,Re,null),e(Re,mp),e(Re,qt),e(qt,fp),e(qt,Mn),e(Mn,up),e(qt,gp),e(qt,kr),e(kr,_p),e(qt,vp),e(Re,Tp),M(Eo,Re,null),e(Re,bp),M(Vo,Re,null),f(o,Qi,m),f(o,Xt,m),e(Xt,Fo),e(Fo,xr),M(os,xr,null),e(Xt,yp),e(Xt,jr),e(jr,wp),f(o,Ki,m),f(o,q,m),M(as,q,null),e(q,Mp),e(q,Cr),e(Cr,$p),e(q,Ep),M(Io,q,null),e(q,Vp),e(q,ss),e(ss,Fp),e(ss,$n),e($n,Ip),e(ss,kp),e(q,xp),e(q,ns),e(ns,jp),e(ns,rs),e(rs,Cp),e(ns,Up),e(q,Jp),M(ko,q,null),e(q,Np),e(q,Be),M(is,Be,null),e(Be,Wp),e(Be,Yt),e(Yt,Zp),e(Yt,En),e(En,Pp),e(Yt,Ap),e(Yt,Ur),e(Ur,zp),e(Yt,Rp),e(Be,Bp),M(xo,Be,null),e(Be,Gp),M(jo,Be,null),f(o,el,m),f(o,Ht,m),e(Ht,Co),e(Co,Jr),M(ls,Jr,null),e(Ht,Dp),e(Ht,Nr),e(Nr,Sp),f(o,tl,m),f(o,X,m),M(ds,X,null),e(X,Lp),e(X,Wr),e(Wr,qp),e(X,Xp),e(X,cs),e(cs,Yp),e(cs,Vn),e(Vn,Hp),e(cs,Op),e(X,Qp),e(X,hs),e(hs,Kp),e(hs,ps),e(ps,em),e(hs,tm),e(X,om),e(X,Zr),e(Zr,am),e(X,sm),e(X,ht),e(ht,Pr),e(Pr,ms),e(ms,nm),e(ht,rm),e(ht,Ar),e(Ar,fs),e(fs,im),e(ht,lm),e(ht,zr),e(zr,us),e(us,dm),e(ht,cm),e(ht,Rr),e(Rr,gs),e(gs,hm),e(X,pm),e(X,Ge),M(_s,Ge,null),e(Ge,mm),e(Ge,Ot),e(Ot,fm),e(Ot,Br),e(Br,um),e(Ot,gm),e(Ot,Gr),e(Gr,_m),e(Ot,vm),e(Ge,Tm),M(Uo,Ge,null),e(Ge,bm),M(Jo,Ge,null),f(o,ol,m),f(o,Qt,m),e(Qt,No),e(No,Dr),M(vs,Dr,null),e(Qt,ym),e(Qt,Sr),e(Sr,wm),f(o,al,m),f(o,Y,m),M(Ts,Y,null),e(Y,Mm),e(Y,Lr),e(Lr,$m),e(Y,Em),e(Y,bs),e(bs,Vm),e(bs,Fn),e(Fn,Fm),e(bs,Im),e(Y,km),e(Y,ys),e(ys,xm),e(ys,ws),e(ws,jm),e(ys,Cm),e(Y,Um),e(Y,qr),e(qr,Jm),e(Y,Nm),e(Y,pt),e(pt,Xr),e(Xr,Ms),e(Ms,Wm),e(pt,Zm),e(pt,Yr),e(Yr,$s),e($s,Pm),e(pt,Am),e(pt,Hr),e(Hr,Es),e(Es,zm),e(pt,Rm),e(pt,Or),e(Or,Vs),e(Vs,Bm),e(Y,Gm),e(Y,De),M(Fs,De,null),e(De,Dm),e(De,Kt),e(Kt,Sm),e(Kt,Qr),e(Qr,Lm),e(Kt,qm),e(Kt,Kr),e(Kr,Xm),e(Kt,Ym),e(De,Hm),M(Wo,De,null),e(De,Om),M(Zo,De,null),sl=!0},p(o,[m]){const Is={};m&2&&(Is.$$scope={dirty:m,ctx:o}),ro.$set(Is);const ei={};m&2&&(ei.$$scope={dirty:m,ctx:o}),mo.$set(ei);const ti={};m&2&&(ti.$$scope={dirty:m,ctx:o}),fo.$set(ti);const oi={};m&2&&(oi.$$scope={dirty:m,ctx:o}),go.$set(oi);const ks={};m&2&&(ks.$$scope={dirty:m,ctx:o}),_o.$set(ks);const ai={};m&2&&(ai.$$scope={dirty:m,ctx:o}),vo.$set(ai);const si={};m&2&&(si.$$scope={dirty:m,ctx:o}),bo.$set(si);const ni={};m&2&&(ni.$$scope={dirty:m,ctx:o}),yo.$set(ni);const xs={};m&2&&(xs.$$scope={dirty:m,ctx:o}),wo.$set(xs);const ri={};m&2&&(ri.$$scope={dirty:m,ctx:o}),$o.$set(ri);const ii={};m&2&&(ii.$$scope={dirty:m,ctx:o}),Eo.$set(ii);const li={};m&2&&(li.$$scope={dirty:m,ctx:o}),Vo.$set(li);const di={};m&2&&(di.$$scope={dirty:m,ctx:o}),Io.$set(di);const ci={};m&2&&(ci.$$scope={dirty:m,ctx:o}),ko.$set(ci);const ae={};m&2&&(ae.$$scope={dirty:m,ctx:o}),xo.$set(ae);const js={};m&2&&(js.$$scope={dirty:m,ctx:o}),jo.$set(js);const hi={};m&2&&(hi.$$scope={dirty:m,ctx:o}),Uo.$set(hi);const pi={};m&2&&(pi.$$scope={dirty:m,ctx:o}),Jo.$set(pi);const Cs={};m&2&&(Cs.$$scope={dirty:m,ctx:o}),Wo.$set(Cs);const mi={};m&2&&(mi.$$scope={dirty:m,ctx:o}),Zo.$set(mi)},i(o){sl||($(l.$$.fragment,o),$(k.$$.fragment,o),$(na.$$.fragment,o),$(ra.$$.fragment,o),$(pa.$$.fragment,o),$(fa.$$.fragment,o),$($a.$$.fragment,o),$(Ea.$$.fragment,o),$(ro.$$.fragment,o),$(Fa.$$.fragment,o),$(Ia.$$.fragment,o),$(ka.$$.fragment,o),$(xa.$$.fragment,o),$(ja.$$.fragment,o),$(Ca.$$.fragment,o),$(Ua.$$.fragment,o),$(Ja.$$.fragment,o),$(Za.$$.fragment,o),$(mo.$$.fragment,o),$(fo.$$.fragment,o),$(Pa.$$.fragment,o),$(Aa.$$.fragment,o),$(go.$$.fragment,o),$(Da.$$.fragment,o),$(_o.$$.fragment,o),$(vo.$$.fragment,o),$(Sa.$$.fragment,o),$(La.$$.fragment,o),$(bo.$$.fragment,o),$(Ya.$$.fragment,o),$(yo.$$.fragment,o),$(wo.$$.fragment,o),$(Ha.$$.fragment,o),$(Oa.$$.fragment,o),$($o.$$.fragment,o),$(ts.$$.fragment,o),$(Eo.$$.fragment,o),$(Vo.$$.fragment,o),$(os.$$.fragment,o),$(as.$$.fragment,o),$(Io.$$.fragment,o),$(ko.$$.fragment,o),$(is.$$.fragment,o),$(xo.$$.fragment,o),$(jo.$$.fragment,o),$(ls.$$.fragment,o),$(ds.$$.fragment,o),$(_s.$$.fragment,o),$(Uo.$$.fragment,o),$(Jo.$$.fragment,o),$(vs.$$.fragment,o),$(Ts.$$.fragment,o),$(Fs.$$.fragment,o),$(Wo.$$.fragment,o),$(Zo.$$.fragment,o),sl=!0)},o(o){E(l.$$.fragment,o),E(k.$$.fragment,o),E(na.$$.fragment,o),E(ra.$$.fragment,o),E(pa.$$.fragment,o),E(fa.$$.fragment,o),E($a.$$.fragment,o),E(Ea.$$.fragment,o),E(ro.$$.fragment,o),E(Fa.$$.fragment,o),E(Ia.$$.fragment,o),E(ka.$$.fragment,o),E(xa.$$.fragment,o),E(ja.$$.fragment,o),E(Ca.$$.fragment,o),E(Ua.$$.fragment,o),E(Ja.$$.fragment,o),E(Za.$$.fragment,o),E(mo.$$.fragment,o),E(fo.$$.fragment,o),E(Pa.$$.fragment,o),E(Aa.$$.fragment,o),E(go.$$.fragment,o),E(Da.$$.fragment,o),E(_o.$$.fragment,o),E(vo.$$.fragment,o),E(Sa.$$.fragment,o),E(La.$$.fragment,o),E(bo.$$.fragment,o),E(Ya.$$.fragment,o),E(yo.$$.fragment,o),E(wo.$$.fragment,o),E(Ha.$$.fragment,o),E(Oa.$$.fragment,o),E($o.$$.fragment,o),E(ts.$$.fragment,o),E(Eo.$$.fragment,o),E(Vo.$$.fragment,o),E(os.$$.fragment,o),E(as.$$.fragment,o),E(Io.$$.fragment,o),E(ko.$$.fragment,o),E(is.$$.fragment,o),E(xo.$$.fragment,o),E(jo.$$.fragment,o),E(ls.$$.fragment,o),E(ds.$$.fragment,o),E(_s.$$.fragment,o),E(Uo.$$.fragment,o),E(Jo.$$.fragment,o),E(vs.$$.fragment,o),E(Ts.$$.fragment,o),E(Fs.$$.fragment,o),E(Wo.$$.fragment,o),E(Zo.$$.fragment,o),sl=!1},d(o){t(c),o&&t(T),o&&t(g),V(l),o&&t(C),o&&t(N),V(k),o&&t(Ce),o&&t(D),o&&t(Ue),o&&t(O),o&&t(Je),o&&t(Q),o&&t(ve),o&&t(J),o&&t(Ne),o&&t(U),o&&t(be),o&&t(ye),o&&t(ui),o&&t(Ko),o&&t(gi),o&&t(Ns),o&&t(_i),o&&t(We),o&&t(vi),o&&t(mt),o&&t(Ti),o&&t(eo),o&&t(bi),o&&t(xt),V(na),o&&t(yi),o&&t(Ds),o&&t(wi),V(ra,o),o&&t(Mi),o&&t(Ze),o&&t($i),o&&t(Ys),o&&t(Ei),o&&t(Hs),o&&t(Vi),o&&t(Qs),o&&t(Fi),o&&t(Ut),V(pa),o&&t(Ii),o&&t(Ks),o&&t(ki),o&&t(ma),o&&t(xi),V(fa,o),o&&t(ji),o&&t(we),o&&t(Ci),o&&t(nn),o&&t(Ui),o&&t(rn),o&&t(Ji),o&&t(dn),o&&t(Ni),o&&t(cn),o&&t(Wi),o&&t(pn),o&&t(Zi),o&&t(ut),o&&t(Pi),o&&t(Jt),V($a),o&&t(Ai),o&&t(je),V(Ea),V(ro),o&&t(zi),o&&t(Zt),V(Fa),o&&t(Ri),o&&t(Pt),V(Ia),V(ka),o&&t(Bi),o&&t(At),V(xa),o&&t(Gi),o&&t(dt),V(ja),V(Ca),o&&t(Di),o&&t(zt),V(Ua),o&&t(Si),o&&t(ct),V(Ja),V(Za),V(mo),V(fo),o&&t(Li),o&&t(Bt),V(Pa),o&&t(qi),o&&t(ge),V(Aa),V(go),V(Da),V(_o),V(vo),o&&t(Xi),o&&t(Dt),V(Sa),o&&t(Yi),o&&t(_e),V(La),V(bo),V(Ya),V(yo),V(wo),o&&t(Hi),o&&t(Lt),V(Ha),o&&t(Oi),o&&t(oe),V(Oa),V($o),V(ts),V(Eo),V(Vo),o&&t(Qi),o&&t(Xt),V(os),o&&t(Ki),o&&t(q),V(as),V(Io),V(ko),V(is),V(xo),V(jo),o&&t(el),o&&t(Ht),V(ls),o&&t(tl),o&&t(X),V(ds),V(_s),V(Uo),V(Jo),o&&t(ol),o&&t(Qt),V(vs),o&&t(al),o&&t(Y),V(Ts),V(Fs),V(Wo),V(Zo)}}}const C_={local:"vision-transformer-vit",sections:[{local:"overview",title:"Overview"},{local:"resources",title:"Resources"},{local:"resources",title:"Resources"},{local:"transformers.ViTConfig",title:"ViTConfig"},{local:"transformers.ViTFeatureExtractor",title:"ViTFeatureExtractor"},{local:"transformers.ViTImageProcessor",title:"ViTImageProcessor"},{local:"transformers.ViTModel",title:"ViTModel"},{local:"transformers.ViTForMaskedImageModeling",title:"ViTForMaskedImageModeling"},{local:"transformers.ViTForImageClassification",title:"ViTForImageClassification"},{local:"transformers.TFViTModel",title:"TFViTModel"},{local:"transformers.TFViTForImageClassification",title:"TFViTForImageClassification"},{local:"transformers.FlaxViTModel",title:"FlaxVitModel"},{local:"transformers.FlaxViTForImageClassification",title:"FlaxViTForImageClassification"}],title:"Vision Transformer (ViT)"};function U_(I){return c_(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class R_ extends n_{constructor(c){super();r_(this,c,U_,j_,i_,{})}}export{R_ as default,C_ as metadata};
