import{S as dh,i as ch,s as mh,e as s,k as h,w as y,t as i,M as hh,c as n,d as o,m as p,a as r,x as w,h as l,b as c,G as e,g as _,y as v,q as M,o as $,B as I,v as ph,L as Ze}from"../../chunks/vendor-hf-doc-builder.js";import{T as ne}from"../../chunks/Tip-hf-doc-builder.js";import{D}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Ue}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as U}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Ee}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";import{P as fh}from"../../chunks/PipelineTag-hf-doc-builder.js";function uh(k){let d,b,u,f,T;return{c(){d=s("p"),b=i(`This is a recently introduced model so the API hasn\u2019t been tested extensively. There may be some bugs or slight
breaking changes to fix it in the future. If you see something strange, file a `),u=s("a"),f=i("Github Issue"),T=i("."),this.h()},l(a){d=n(a,"P",{});var m=r(d);b=l(m,`This is a recently introduced model so the API hasn\u2019t been tested extensively. There may be some bugs or slight
breaking changes to fix it in the future. If you see something strange, file a `),u=n(m,"A",{href:!0,rel:!0});var F=r(u);f=l(F,"Github Issue"),F.forEach(o),T=l(m,"."),m.forEach(o),this.h()},h(){c(u,"href","https://github.com/huggingface/transformers/issues/new?assignees=&labels=&template=bug-report.md&title"),c(u,"rel","nofollow")},m(a,m){_(a,d,m),e(d,b),e(d,u),e(u,f),e(d,T)},d(a){a&&o(d)}}}function gh(k){let d,b,u,f,T;return f=new Ue({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMERlaVRDb25maWclMkMlMjBEZWlUTW9kZWwlMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwRGVpVCUyMGRlaXQtYmFzZS1kaXN0aWxsZWQtcGF0Y2gxNi0yMjQlMjBzdHlsZSUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwRGVpVENvbmZpZygpJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMG1vZGVsJTIwKHdpdGglMjByYW5kb20lMjB3ZWlnaHRzKSUyMGZyb20lMjB0aGUlMjBkZWl0LWJhc2UtZGlzdGlsbGVkLXBhdGNoMTYtMjI0JTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBbW9kZWwlMjAlM0QlMjBEZWlUTW9kZWwoY29uZmlndXJhdGlvbiklMEElMEElMjMlMjBBY2Nlc3NpbmclMjB0aGUlMjBtb2RlbCUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwbW9kZWwuY29uZmln",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DeiTConfig, DeiTModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a DeiT deit-base-distilled-patch16-224 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = DeiTConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model (with random weights) from the deit-base-distilled-patch16-224 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = DeiTModel(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(){d=s("p"),b=i("Example:"),u=h(),y(f.$$.fragment)},l(a){d=n(a,"P",{});var m=r(d);b=l(m,"Example:"),m.forEach(o),u=p(a),w(f.$$.fragment,a)},m(a,m){_(a,d,m),e(d,b),_(a,u,m),v(f,a,m),T=!0},p:Ze,i(a){T||(M(f.$$.fragment,a),T=!0)},o(a){$(f.$$.fragment,a),T=!1},d(a){a&&o(d),a&&o(u),I(f,a)}}}function _h(k){let d,b,u,f,T;return{c(){d=s("p"),b=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=s("code"),f=i("Module"),T=i(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(a){d=n(a,"P",{});var m=r(d);b=l(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=n(m,"CODE",{});var F=r(u);f=l(F,"Module"),F.forEach(o),T=l(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(o)},m(a,m){_(a,d,m),e(d,b),e(d,u),e(u,f),e(d,T)},d(a){a&&o(d)}}}function Th(k){let d,b,u,f,T;return f=new Ue({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyMERlaVRNb2RlbCUwQWltcG9ydCUyMHRvcmNoJTBBZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBJTBBZGF0YXNldCUyMCUzRCUyMGxvYWRfZGF0YXNldCglMjJodWdnaW5nZmFjZSUyRmNhdHMtaW1hZ2UlMjIpJTBBaW1hZ2UlMjAlM0QlMjBkYXRhc2V0JTVCJTIydGVzdCUyMiU1RCU1QiUyMmltYWdlJTIyJTVEJTVCMCU1RCUwQSUwQWltYWdlX3Byb2Nlc3NvciUyMCUzRCUyMEF1dG9JbWFnZVByb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyZmFjZWJvb2slMkZkZWl0LWJhc2UtZGlzdGlsbGVkLXBhdGNoMTYtMjI0JTIyKSUwQW1vZGVsJTIwJTNEJTIwRGVpVE1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJmYWNlYm9vayUyRmRlaXQtYmFzZS1kaXN0aWxsZWQtcGF0Y2gxNi0yMjQlMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwaW1hZ2VfcHJvY2Vzc29yKGltYWdlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEElMEF3aXRoJTIwdG9yY2gubm9fZ3JhZCgpJTNBJTBBJTIwJTIwJTIwJTIwb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKSUwQSUwQWxhc3RfaGlkZGVuX3N0YXRlcyUyMCUzRCUyMG91dHB1dHMubGFzdF9oaWRkZW5fc3RhdGUlMEFsaXN0KGxhc3RfaGlkZGVuX3N0YXRlcy5zaGFwZSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, DeiTModel
<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;facebook/deit-base-distilled-patch16-224&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = DeiTModel.from_pretrained(<span class="hljs-string">&quot;facebook/deit-base-distilled-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>    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">198</span>, <span class="hljs-number">768</span>]`}}),{c(){d=s("p"),b=i("Example:"),u=h(),y(f.$$.fragment)},l(a){d=n(a,"P",{});var m=r(d);b=l(m,"Example:"),m.forEach(o),u=p(a),w(f.$$.fragment,a)},m(a,m){_(a,d,m),e(d,b),_(a,u,m),v(f,a,m),T=!0},p:Ze,i(a){T||(M(f.$$.fragment,a),T=!0)},o(a){$(f.$$.fragment,a),T=!1},d(a){a&&o(d),a&&o(u),I(f,a)}}}function bh(k){let d,b,u,f,T;return{c(){d=s("p"),b=i("Note that we provide a script to pre-train this model on custom data in our "),u=s("a"),f=i(`examples
directory`),T=i("."),this.h()},l(a){d=n(a,"P",{});var m=r(d);b=l(m,"Note that we provide a script to pre-train this model on custom data in our "),u=n(m,"A",{href:!0,rel:!0});var F=r(u);f=l(F,`examples
directory`),F.forEach(o),T=l(m,"."),m.forEach(o),this.h()},h(){c(u,"href","https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-pretraining"),c(u,"rel","nofollow")},m(a,m){_(a,d,m),e(d,b),e(d,u),e(u,f),e(d,T)},d(a){a&&o(d)}}}function yh(k){let d,b,u,f,T;return{c(){d=s("p"),b=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=s("code"),f=i("Module"),T=i(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(a){d=n(a,"P",{});var m=r(d);b=l(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=n(m,"CODE",{});var F=r(u);f=l(F,"Module"),F.forEach(o),T=l(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(o)},m(a,m){_(a,d,m),e(d,b),e(d,u),e(u,f),e(d,T)},d(a){a&&o(d)}}}function wh(k){let d,b,u,f,T;return f=new Ue({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyMERlaVRGb3JNYXNrZWRJbWFnZU1vZGVsaW5nJTBBaW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEFpbXBvcnQlMjByZXF1ZXN0cyUwQSUwQXVybCUyMCUzRCUyMCUyMmh0dHAlM0ElMkYlMkZpbWFnZXMuY29jb2RhdGFzZXQub3JnJTJGdmFsMjAxNyUyRjAwMDAwMDAzOTc2OS5qcGclMjIlMEFpbWFnZSUyMCUzRCUyMEltYWdlLm9wZW4ocmVxdWVzdHMuZ2V0KHVybCUyQyUyMHN0cmVhbSUzRFRydWUpLnJhdyklMEElMEFpbWFnZV9wcm9jZXNzb3IlMjAlM0QlMjBBdXRvSW1hZ2VQcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMmZhY2Vib29rJTJGZGVpdC1iYXNlLWRpc3RpbGxlZC1wYXRjaDE2LTIyNCUyMiklMEFtb2RlbCUyMCUzRCUyMERlaVRGb3JNYXNrZWRJbWFnZU1vZGVsaW5nLmZyb21fcHJldHJhaW5lZCglMjJmYWNlYm9vayUyRmRlaXQtYmFzZS1kaXN0aWxsZWQtcGF0Y2gxNi0yMjQlMjIpJTBBJTBBbnVtX3BhdGNoZXMlMjAlM0QlMjAobW9kZWwuY29uZmlnLmltYWdlX3NpemUlMjAlMkYlMkYlMjBtb2RlbC5jb25maWcucGF0Y2hfc2l6ZSklMjAqKiUyMDIlMEFwaXhlbF92YWx1ZXMlMjAlM0QlMjBpbWFnZV9wcm9jZXNzb3IoaW1hZ2VzJTNEaW1hZ2UlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKS5waXhlbF92YWx1ZXMlMEElMjMlMjBjcmVhdGUlMjByYW5kb20lMjBib29sZWFuJTIwbWFzayUyMG9mJTIwc2hhcGUlMjAoYmF0Y2hfc2l6ZSUyQyUyMG51bV9wYXRjaGVzKSUwQWJvb2xfbWFza2VkX3BvcyUyMCUzRCUyMHRvcmNoLnJhbmRpbnQobG93JTNEMCUyQyUyMGhpZ2glM0QyJTJDJTIwc2l6ZSUzRCgxJTJDJTIwbnVtX3BhdGNoZXMpKS5ib29sKCklMEElMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwocGl4ZWxfdmFsdWVzJTJDJTIwYm9vbF9tYXNrZWRfcG9zJTNEYm9vbF9tYXNrZWRfcG9zKSUwQWxvc3MlMkMlMjByZWNvbnN0cnVjdGVkX3BpeGVsX3ZhbHVlcyUyMCUzRCUyMG91dHB1dHMubG9zcyUyQyUyMG91dHB1dHMucmVjb25zdHJ1Y3Rpb24lMEFsaXN0KHJlY29uc3RydWN0ZWRfcGl4ZWxfdmFsdWVzLnNoYXBlKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, DeiTForMaskedImageModeling
<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;facebook/deit-base-distilled-patch16-224&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = DeiTForMaskedImageModeling.from_pretrained(<span class="hljs-string">&quot;facebook/deit-base-distilled-patch16-224&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(){d=s("p"),b=i("Examples:"),u=h(),y(f.$$.fragment)},l(a){d=n(a,"P",{});var m=r(d);b=l(m,"Examples:"),m.forEach(o),u=p(a),w(f.$$.fragment,a)},m(a,m){_(a,d,m),e(d,b),_(a,u,m),v(f,a,m),T=!0},p:Ze,i(a){T||(M(f.$$.fragment,a),T=!0)},o(a){$(f.$$.fragment,a),T=!1},d(a){a&&o(d),a&&o(u),I(f,a)}}}function vh(k){let d,b,u,f,T;return{c(){d=s("p"),b=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=s("code"),f=i("Module"),T=i(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(a){d=n(a,"P",{});var m=r(d);b=l(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=n(m,"CODE",{});var F=r(u);f=l(F,"Module"),F.forEach(o),T=l(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(o)},m(a,m){_(a,d,m),e(d,b),e(d,u),e(u,f),e(d,T)},d(a){a&&o(d)}}}function Mh(k){let d,b,u,f,T;return f=new Ue({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyMERlaVRGb3JJbWFnZUNsYXNzaWZpY2F0aW9uJTBBaW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEFpbXBvcnQlMjByZXF1ZXN0cyUwQSUwQXRvcmNoLm1hbnVhbF9zZWVkKDMpJTBBdXJsJTIwJTNEJTIwJTIyaHR0cCUzQSUyRiUyRmltYWdlcy5jb2NvZGF0YXNldC5vcmclMkZ2YWwyMDE3JTJGMDAwMDAwMDM5NzY5LmpwZyUyMiUwQWltYWdlJTIwJTNEJTIwSW1hZ2Uub3BlbihyZXF1ZXN0cy5nZXQodXJsJTJDJTIwc3RyZWFtJTNEVHJ1ZSkucmF3KSUwQSUwQSUyMyUyMG5vdGUlM0ElMjB3ZSUyMGFyZSUyMGxvYWRpbmclMjBhJTIwRGVpVEZvckltYWdlQ2xhc3NpZmljYXRpb25XaXRoVGVhY2hlciUyMGZyb20lMjB0aGUlMjBodWIlMjBoZXJlJTJDJTBBJTIzJTIwc28lMjB0aGUlMjBoZWFkJTIwd2lsbCUyMGJlJTIwcmFuZG9tbHklMjBpbml0aWFsaXplZCUyQyUyMGhlbmNlJTIwdGhlJTIwcHJlZGljdGlvbnMlMjB3aWxsJTIwYmUlMjByYW5kb20lMEFpbWFnZV9wcm9jZXNzb3IlMjAlM0QlMjBBdXRvSW1hZ2VQcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMmZhY2Vib29rJTJGZGVpdC1iYXNlLWRpc3RpbGxlZC1wYXRjaDE2LTIyNCUyMiklMEFtb2RlbCUyMCUzRCUyMERlaVRGb3JJbWFnZUNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMjJmYWNlYm9vayUyRmRlaXQtYmFzZS1kaXN0aWxsZWQtcGF0Y2gxNi0yMjQlMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwaW1hZ2VfcHJvY2Vzc29yKGltYWdlcyUzRGltYWdlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpJTBBbG9naXRzJTIwJTNEJTIwb3V0cHV0cy5sb2dpdHMlMEElMjMlMjBtb2RlbCUyMHByZWRpY3RzJTIwb25lJTIwb2YlMjB0aGUlMjAxMDAwJTIwSW1hZ2VOZXQlMjBjbGFzc2VzJTBBcHJlZGljdGVkX2NsYXNzX2lkeCUyMCUzRCUyMGxvZ2l0cy5hcmdtYXgoLTEpLml0ZW0oKSUwQXByaW50KCUyMlByZWRpY3RlZCUyMGNsYXNzJTNBJTIyJTJDJTIwbW9kZWwuY29uZmlnLmlkMmxhYmVsJTVCcHJlZGljdGVkX2NsYXNzX2lkeCU1RCk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, DeiTForImageClassification
<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>torch.manual_seed(<span class="hljs-number">3</span>)
<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><span class="hljs-comment"># note: we are loading a DeiTForImageClassificationWithTeacher from the hub here,</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># so the head will be randomly initialized, hence the predictions will be random</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;facebook/deit-base-distilled-patch16-224&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = DeiTForImageClassification.from_pretrained(<span class="hljs-string">&quot;facebook/deit-base-distilled-patch16-224&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = image_processor(images=image, return_tensors=<span class="hljs-string">&quot;pt&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 = logits.argmax(-<span class="hljs-number">1</span>).item()
<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])
Predicted <span class="hljs-keyword">class</span>: magpie`}}),{c(){d=s("p"),b=i("Examples:"),u=h(),y(f.$$.fragment)},l(a){d=n(a,"P",{});var m=r(d);b=l(m,"Examples:"),m.forEach(o),u=p(a),w(f.$$.fragment,a)},m(a,m){_(a,d,m),e(d,b),_(a,u,m),v(f,a,m),T=!0},p:Ze,i(a){T||(M(f.$$.fragment,a),T=!0)},o(a){$(f.$$.fragment,a),T=!1},d(a){a&&o(d),a&&o(u),I(f,a)}}}function $h(k){let d,b,u,f,T;return{c(){d=s("p"),b=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=s("code"),f=i("Module"),T=i(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(a){d=n(a,"P",{});var m=r(d);b=l(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=n(m,"CODE",{});var F=r(u);f=l(F,"Module"),F.forEach(o),T=l(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(o)},m(a,m){_(a,d,m),e(d,b),e(d,u),e(u,f),e(d,T)},d(a){a&&o(d)}}}function Ih(k){let d,b,u,f,T;return f=new Ue({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyMERlaVRGb3JJbWFnZUNsYXNzaWZpY2F0aW9uV2l0aFRlYWNoZXIlMEFpbXBvcnQlMjB0b3JjaCUwQWZyb20lMjBkYXRhc2V0cyUyMGltcG9ydCUyMGxvYWRfZGF0YXNldCUwQSUwQWRhdGFzZXQlMjAlM0QlMjBsb2FkX2RhdGFzZXQoJTIyaHVnZ2luZ2ZhY2UlMkZjYXRzLWltYWdlJTIyKSUwQWltYWdlJTIwJTNEJTIwZGF0YXNldCU1QiUyMnRlc3QlMjIlNUQlNUIlMjJpbWFnZSUyMiU1RCU1QjAlNUQlMEElMEFpbWFnZV9wcm9jZXNzb3IlMjAlM0QlMjBBdXRvSW1hZ2VQcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMmZhY2Vib29rJTJGZGVpdC1iYXNlLWRpc3RpbGxlZC1wYXRjaDE2LTIyNCUyMiklMEFtb2RlbCUyMCUzRCUyMERlaVRGb3JJbWFnZUNsYXNzaWZpY2F0aW9uV2l0aFRlYWNoZXIuZnJvbV9wcmV0cmFpbmVkKCUyMmZhY2Vib29rJTJGZGVpdC1iYXNlLWRpc3RpbGxlZC1wYXRjaDE2LTIyNCUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjBpbWFnZV9wcm9jZXNzb3IoaW1hZ2UlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQXdpdGglMjB0b3JjaC5ub19ncmFkKCklM0ElMEElMjAlMjAlMjAlMjBsb2dpdHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cykubG9naXRzJTBBJTBBJTIzJTIwbW9kZWwlMjBwcmVkaWN0cyUyMG9uZSUyMG9mJTIwdGhlJTIwMTAwMCUyMEltYWdlTmV0JTIwY2xhc3NlcyUwQXByZWRpY3RlZF9sYWJlbCUyMCUzRCUyMGxvZ2l0cy5hcmdtYXgoLTEpLml0ZW0oKSUwQXByaW50KG1vZGVsLmNvbmZpZy5pZDJsYWJlbCU1QnByZWRpY3RlZF9sYWJlbCU1RCk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, DeiTForImageClassificationWithTeacher
<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;facebook/deit-base-distilled-patch16-224&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = DeiTForImageClassificationWithTeacher.from_pretrained(<span class="hljs-string">&quot;facebook/deit-base-distilled-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])
tabby, tabby cat`}}),{c(){d=s("p"),b=i("Example:"),u=h(),y(f.$$.fragment)},l(a){d=n(a,"P",{});var m=r(d);b=l(m,"Example:"),m.forEach(o),u=p(a),w(f.$$.fragment,a)},m(a,m){_(a,d,m),e(d,b),_(a,u,m),v(f,a,m),T=!0},p:Ze,i(a){T||(M(f.$$.fragment,a),T=!0)},o(a){$(f.$$.fragment,a),T=!1},d(a){a&&o(d),a&&o(u),I(f,a)}}}function kh(k){let d,b,u,f,T;return{c(){d=s("p"),b=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=s("code"),f=i("Module"),T=i(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(a){d=n(a,"P",{});var m=r(d);b=l(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=n(m,"CODE",{});var F=r(u);f=l(F,"Module"),F.forEach(o),T=l(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(o)},m(a,m){_(a,d,m),e(d,b),e(d,u),e(u,f),e(d,T)},d(a){a&&o(d)}}}function Fh(k){let d,b,u,f,T;return f=new Ue({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyMFRGRGVpVE1vZGVsJTBBZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBJTBBZGF0YXNldCUyMCUzRCUyMGxvYWRfZGF0YXNldCglMjJodWdnaW5nZmFjZSUyRmNhdHMtaW1hZ2UlMjIpJTBBaW1hZ2UlMjAlM0QlMjBkYXRhc2V0JTVCJTIydGVzdCUyMiU1RCU1QiUyMmltYWdlJTIyJTVEJTVCMCU1RCUwQSUwQWltYWdlX3Byb2Nlc3NvciUyMCUzRCUyMEF1dG9JbWFnZVByb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyZmFjZWJvb2slMkZkZWl0LWJhc2UtZGlzdGlsbGVkLXBhdGNoMTYtMjI0JTIyKSUwQW1vZGVsJTIwJTNEJTIwVEZEZWlUTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMmZhY2Vib29rJTJGZGVpdC1iYXNlLWRpc3RpbGxlZC1wYXRjaDE2LTIyNCUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjBpbWFnZV9wcm9jZXNzb3IoaW1hZ2UlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnRmJTIyKSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyklMEElMEFsYXN0X2hpZGRlbl9zdGF0ZXMlMjAlM0QlMjBvdXRwdXRzLmxhc3RfaGlkZGVuX3N0YXRlJTBBbGlzdChsYXN0X2hpZGRlbl9zdGF0ZXMuc2hhcGUp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, TFDeiTModel
<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;facebook/deit-base-distilled-patch16-224&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFDeiTModel.from_pretrained(<span class="hljs-string">&quot;facebook/deit-base-distilled-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>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">198</span>, <span class="hljs-number">768</span>]`}}),{c(){d=s("p"),b=i("Example:"),u=h(),y(f.$$.fragment)},l(a){d=n(a,"P",{});var m=r(d);b=l(m,"Example:"),m.forEach(o),u=p(a),w(f.$$.fragment,a)},m(a,m){_(a,d,m),e(d,b),_(a,u,m),v(f,a,m),T=!0},p:Ze,i(a){T||(M(f.$$.fragment,a),T=!0)},o(a){$(f.$$.fragment,a),T=!1},d(a){a&&o(d),a&&o(u),I(f,a)}}}function Dh(k){let d,b,u,f,T;return{c(){d=s("p"),b=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=s("code"),f=i("Module"),T=i(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(a){d=n(a,"P",{});var m=r(d);b=l(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=n(m,"CODE",{});var F=r(u);f=l(F,"Module"),F.forEach(o),T=l(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(o)},m(a,m){_(a,d,m),e(d,b),e(d,u),e(u,f),e(d,T)},d(a){a&&o(d)}}}function jh(k){let d,b,u,f,T;return f=new Ue({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyMFRGRGVpVEZvck1hc2tlZEltYWdlTW9kZWxpbmclMEFpbXBvcnQlMjB0ZW5zb3JmbG93JTIwYXMlMjB0ZiUwQWZyb20lMjBQSUwlMjBpbXBvcnQlMjBJbWFnZSUwQWltcG9ydCUyMHJlcXVlc3RzJTBBJTBBdXJsJTIwJTNEJTIwJTIyaHR0cCUzQSUyRiUyRmltYWdlcy5jb2NvZGF0YXNldC5vcmclMkZ2YWwyMDE3JTJGMDAwMDAwMDM5NzY5LmpwZyUyMiUwQWltYWdlJTIwJTNEJTIwSW1hZ2Uub3BlbihyZXF1ZXN0cy5nZXQodXJsJTJDJTIwc3RyZWFtJTNEVHJ1ZSkucmF3KSUwQSUwQWltYWdlX3Byb2Nlc3NvciUyMCUzRCUyMEF1dG9JbWFnZVByb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyZmFjZWJvb2slMkZkZWl0LWJhc2UtZGlzdGlsbGVkLXBhdGNoMTYtMjI0JTIyKSUwQW1vZGVsJTIwJTNEJTIwVEZEZWlURm9yTWFza2VkSW1hZ2VNb2RlbGluZy5mcm9tX3ByZXRyYWluZWQoJTIyZmFjZWJvb2slMkZkZWl0LWJhc2UtZGlzdGlsbGVkLXBhdGNoMTYtMjI0JTIyKSUwQSUwQW51bV9wYXRjaGVzJTIwJTNEJTIwKG1vZGVsLmNvbmZpZy5pbWFnZV9zaXplJTIwJTJGJTJGJTIwbW9kZWwuY29uZmlnLnBhdGNoX3NpemUpJTIwKiolMjAyJTBBcGl4ZWxfdmFsdWVzJTIwJTNEJTIwaW1hZ2VfcHJvY2Vzc29yKGltYWdlcyUzRGltYWdlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJ0ZiUyMikucGl4ZWxfdmFsdWVzJTBBJTIzJTIwY3JlYXRlJTIwcmFuZG9tJTIwYm9vbGVhbiUyMG1hc2slMjBvZiUyMHNoYXBlJTIwKGJhdGNoX3NpemUlMkMlMjBudW1fcGF0Y2hlcyklMEFib29sX21hc2tlZF9wb3MlMjAlM0QlMjB0Zi5jYXN0KHRmLnJhbmRvbS51bmlmb3JtKCgxJTJDJTIwbnVtX3BhdGNoZXMpJTJDJTIwbWludmFsJTNEMCUyQyUyMG1heHZhbCUzRDIlMkMlMjBkdHlwZSUzRHRmLmludDMyKSUyQyUyMHRmLmJvb2wpJTBBJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKHBpeGVsX3ZhbHVlcyUyQyUyMGJvb2xfbWFza2VkX3BvcyUzRGJvb2xfbWFza2VkX3BvcyklMEFsb3NzJTJDJTIwcmVjb25zdHJ1Y3RlZF9waXhlbF92YWx1ZXMlMjAlM0QlMjBvdXRwdXRzLmxvc3MlMkMlMjBvdXRwdXRzLnJlY29uc3RydWN0aW9uJTBBbGlzdChyZWNvbnN0cnVjdGVkX3BpeGVsX3ZhbHVlcy5zaGFwZSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, TFDeiTForMaskedImageModeling
<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> 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;facebook/deit-base-distilled-patch16-224&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFDeiTForMaskedImageModeling.from_pretrained(<span class="hljs-string">&quot;facebook/deit-base-distilled-patch16-224&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;tf&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 = tf.cast(tf.random.uniform((<span class="hljs-number">1</span>, num_patches), minval=<span class="hljs-number">0</span>, maxval=<span class="hljs-number">2</span>, dtype=tf.int32), tf.<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(){d=s("p"),b=i("Examples:"),u=h(),y(f.$$.fragment)},l(a){d=n(a,"P",{});var m=r(d);b=l(m,"Examples:"),m.forEach(o),u=p(a),w(f.$$.fragment,a)},m(a,m){_(a,d,m),e(d,b),_(a,u,m),v(f,a,m),T=!0},p:Ze,i(a){T||(M(f.$$.fragment,a),T=!0)},o(a){$(f.$$.fragment,a),T=!1},d(a){a&&o(d),a&&o(u),I(f,a)}}}function Wh(k){let d,b,u,f,T;return{c(){d=s("p"),b=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=s("code"),f=i("Module"),T=i(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(a){d=n(a,"P",{});var m=r(d);b=l(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=n(m,"CODE",{});var F=r(u);f=l(F,"Module"),F.forEach(o),T=l(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(o)},m(a,m){_(a,d,m),e(d,b),e(d,u),e(u,f),e(d,T)},d(a){a&&o(d)}}}function Jh(k){let d,b,u,f,T;return f=new Ue({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyMFRGRGVpVEZvckltYWdlQ2xhc3NpZmljYXRpb24lMEFpbXBvcnQlMjB0ZW5zb3JmbG93JTIwYXMlMjB0ZiUwQWZyb20lMjBQSUwlMjBpbXBvcnQlMjBJbWFnZSUwQWltcG9ydCUyMHJlcXVlc3RzJTBBJTBBdGYua2VyYXMudXRpbHMuc2V0X3JhbmRvbV9zZWVkKDMpJTBBdXJsJTIwJTNEJTIwJTIyaHR0cCUzQSUyRiUyRmltYWdlcy5jb2NvZGF0YXNldC5vcmclMkZ2YWwyMDE3JTJGMDAwMDAwMDM5NzY5LmpwZyUyMiUwQWltYWdlJTIwJTNEJTIwSW1hZ2Uub3BlbihyZXF1ZXN0cy5nZXQodXJsJTJDJTIwc3RyZWFtJTNEVHJ1ZSkucmF3KSUwQSUwQSUyMyUyMG5vdGUlM0ElMjB3ZSUyMGFyZSUyMGxvYWRpbmclMjBhJTIwVEZEZWlURm9ySW1hZ2VDbGFzc2lmaWNhdGlvbldpdGhUZWFjaGVyJTIwZnJvbSUyMHRoZSUyMGh1YiUyMGhlcmUlMkMlMEElMjMlMjBzbyUyMHRoZSUyMGhlYWQlMjB3aWxsJTIwYmUlMjByYW5kb21seSUyMGluaXRpYWxpemVkJTJDJTIwaGVuY2UlMjB0aGUlMjBwcmVkaWN0aW9ucyUyMHdpbGwlMjBiZSUyMHJhbmRvbSUwQWltYWdlX3Byb2Nlc3NvciUyMCUzRCUyMEF1dG9JbWFnZVByb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyZmFjZWJvb2slMkZkZWl0LWJhc2UtZGlzdGlsbGVkLXBhdGNoMTYtMjI0JTIyKSUwQW1vZGVsJTIwJTNEJTIwVEZEZWlURm9ySW1hZ2VDbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyZmFjZWJvb2slMkZkZWl0LWJhc2UtZGlzdGlsbGVkLXBhdGNoMTYtMjI0JTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMGltYWdlX3Byb2Nlc3NvcihpbWFnZXMlM0RpbWFnZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIydGYlMjIpJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKSUwQWxvZ2l0cyUyMCUzRCUyMG91dHB1dHMubG9naXRzJTBBJTIzJTIwbW9kZWwlMjBwcmVkaWN0cyUyMG9uZSUyMG9mJTIwdGhlJTIwMTAwMCUyMEltYWdlTmV0JTIwY2xhc3NlcyUwQXByZWRpY3RlZF9jbGFzc19pZHglMjAlM0QlMjB0Zi5tYXRoLmFyZ21heChsb2dpdHMlMkMlMjBheGlzJTNELTEpJTVCMCU1RCUwQXByaW50KCUyMlByZWRpY3RlZCUyMGNsYXNzJTNBJTIyJTJDJTIwbW9kZWwuY29uZmlnLmlkMmxhYmVsJTVCaW50KHByZWRpY3RlZF9jbGFzc19pZHgpJTVEKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, TFDeiTForImageClassification
<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> 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>tf.keras.utils.set_random_seed(<span class="hljs-number">3</span>)
<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><span class="hljs-comment"># note: we are loading a TFDeiTForImageClassificationWithTeacher from the hub here,</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># so the head will be randomly initialized, hence the predictions will be random</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;facebook/deit-base-distilled-patch16-224&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFDeiTForImageClassification.from_pretrained(<span class="hljs-string">&quot;facebook/deit-base-distilled-patch16-224&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = image_processor(images=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>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 = tf.math.argmax(logits, axis=-<span class="hljs-number">1</span>)[<span class="hljs-number">0</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[<span class="hljs-built_in">int</span>(predicted_class_idx)])
Predicted <span class="hljs-keyword">class</span>: little blue heron, Egretta caerulea`}}),{c(){d=s("p"),b=i("Examples:"),u=h(),y(f.$$.fragment)},l(a){d=n(a,"P",{});var m=r(d);b=l(m,"Examples:"),m.forEach(o),u=p(a),w(f.$$.fragment,a)},m(a,m){_(a,d,m),e(d,b),_(a,u,m),v(f,a,m),T=!0},p:Ze,i(a){T||(M(f.$$.fragment,a),T=!0)},o(a){$(f.$$.fragment,a),T=!1},d(a){a&&o(d),a&&o(u),I(f,a)}}}function Ch(k){let d,b,u,f,T;return{c(){d=s("p"),b=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=s("code"),f=i("Module"),T=i(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(a){d=n(a,"P",{});var m=r(d);b=l(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=n(m,"CODE",{});var F=r(u);f=l(F,"Module"),F.forEach(o),T=l(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(o)},m(a,m){_(a,d,m),e(d,b),e(d,u),e(u,f),e(d,T)},d(a){a&&o(d)}}}function Eh(k){let d,b,u,f,T;return f=new Ue({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyMFRGRGVpVEZvckltYWdlQ2xhc3NpZmljYXRpb25XaXRoVGVhY2hlciUwQWltcG9ydCUyMHRlbnNvcmZsb3clMjBhcyUyMHRmJTBBZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBJTBBZGF0YXNldCUyMCUzRCUyMGxvYWRfZGF0YXNldCglMjJodWdnaW5nZmFjZSUyRmNhdHMtaW1hZ2UlMjIpJTBBaW1hZ2UlMjAlM0QlMjBkYXRhc2V0JTVCJTIydGVzdCUyMiU1RCU1QiUyMmltYWdlJTIyJTVEJTVCMCU1RCUwQSUwQWltYWdlX3Byb2Nlc3NvciUyMCUzRCUyMEF1dG9JbWFnZVByb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyZmFjZWJvb2slMkZkZWl0LWJhc2UtZGlzdGlsbGVkLXBhdGNoMTYtMjI0JTIyKSUwQW1vZGVsJTIwJTNEJTIwVEZEZWlURm9ySW1hZ2VDbGFzc2lmaWNhdGlvbldpdGhUZWFjaGVyLmZyb21fcHJldHJhaW5lZCglMjJmYWNlYm9vayUyRmRlaXQtYmFzZS1kaXN0aWxsZWQtcGF0Y2gxNi0yMjQlMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwaW1hZ2VfcHJvY2Vzc29yKGltYWdlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJ0ZiUyMiklMEFsb2dpdHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cykubG9naXRzJTBBJTBBJTIzJTIwbW9kZWwlMjBwcmVkaWN0cyUyMG9uZSUyMG9mJTIwdGhlJTIwMTAwMCUyMEltYWdlTmV0JTIwY2xhc3NlcyUwQXByZWRpY3RlZF9sYWJlbCUyMCUzRCUyMGludCh0Zi5tYXRoLmFyZ21heChsb2dpdHMlMkMlMjBheGlzJTNELTEpKSUwQXByaW50KG1vZGVsLmNvbmZpZy5pZDJsYWJlbCU1QnByZWRpY3RlZF9sYWJlbCU1RCk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, TFDeiTForImageClassificationWithTeacher
<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;facebook/deit-base-distilled-patch16-224&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFDeiTForImageClassificationWithTeacher.from_pretrained(<span class="hljs-string">&quot;facebook/deit-base-distilled-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])
tabby, tabby cat`}}),{c(){d=s("p"),b=i("Example:"),u=h(),y(f.$$.fragment)},l(a){d=n(a,"P",{});var m=r(d);b=l(m,"Example:"),m.forEach(o),u=p(a),w(f.$$.fragment,a)},m(a,m){_(a,d,m),e(d,b),_(a,u,m),v(f,a,m),T=!0},p:Ze,i(a){T||(M(f.$$.fragment,a),T=!0)},o(a){$(f.$$.fragment,a),T=!1},d(a){a&&o(d),a&&o(u),I(f,a)}}}function Zh(k){let d,b,u,f,T,a,m,F,Kn,Xs,Ne,Ys,re,xe,Wa,jt,er,Ja,tr,As,R,or,Wt,ar,sr,Ro,nr,rr,Jt,ir,lr,Ss,Bo,dr,qs,Vo,Ca,cr,Qs,Po,mr,Ls,Z,Ea,hr,pr,ie,fr,Xo,ur,gr,Yo,_r,Tr,br,Za,yr,wr,Ua,vr,Mr,j,$r,Ao,Ir,kr,So,Fr,Dr,Na,jr,Wr,xa,Jr,Cr,za,Er,Zr,Ga,Ur,Nr,qo,xr,zr,Hs,oe,Gr,Ct,Rr,Br,Et,Vr,Pr,Os,le,ze,Ra,Zt,Xr,Ba,Yr,Ks,Qo,Ar,en,Ut,tn,Ge,ae,Lo,Sr,qr,Nt,Qr,Lr,xt,Hr,Or,Kr,Ho,ei,Oo,ti,on,Ko,oi,an,ea,Re,ta,ai,si,zt,ni,ri,sn,oa,ii,nn,de,Be,Va,Gt,li,Pa,di,rn,N,Rt,ci,ce,mi,aa,hi,pi,Bt,fi,ui,gi,me,_i,sa,Ti,bi,na,yi,wi,vi,Ve,ln,he,Pe,Xa,Vt,Mi,Ya,$i,dn,pe,Pt,Ii,Xe,Xt,ki,Aa,Fi,cn,fe,Ye,Sa,Yt,Di,qa,ji,mn,H,At,Wi,Qa,Ji,Ci,Ae,St,Ei,La,Zi,hn,ue,Se,Ha,qt,Ui,Oa,Ni,pn,O,Qt,xi,Lt,zi,Ht,Gi,Ri,Bi,B,Ot,Vi,ge,Pi,ra,Xi,Yi,Ka,Ai,Si,qi,qe,Qi,Qe,fn,_e,Le,es,Kt,Li,ts,Hi,un,E,eo,Oi,to,Ki,oo,el,tl,ol,He,al,ao,sl,so,nl,rl,il,V,no,ll,Te,dl,ia,cl,ml,os,hl,pl,fl,Oe,ul,Ke,gn,be,et,as,ro,gl,ss,_l,_n,x,io,Tl,ns,bl,yl,lo,wl,co,vl,Ml,$l,P,mo,Il,ye,kl,la,Fl,Dl,rs,jl,Wl,Jl,tt,Cl,ot,Tn,we,at,is,ho,El,ls,Zl,bn,W,po,Ul,ds,Nl,xl,cs,zl,Gl,ms,Rl,Bl,fo,Vl,uo,Pl,Xl,Yl,X,go,Al,ve,Sl,da,ql,Ql,hs,Ll,Hl,Ol,st,Kl,nt,yn,Me,rt,ps,_o,ed,fs,td,wn,K,To,od,bo,ad,yo,sd,nd,rd,Y,wo,id,$e,ld,ca,dd,cd,us,md,hd,pd,it,fd,lt,vn,Ie,dt,gs,vo,ud,_s,gd,Mn,ee,Mo,_d,ke,Td,$o,bd,yd,Io,wd,vd,Md,A,ko,$d,Fe,Id,ma,kd,Fd,Ts,Dd,jd,Wd,ct,Jd,mt,$n,De,ht,bs,Fo,Cd,ys,Ed,In,z,Do,Zd,ws,Ud,Nd,jo,xd,Wo,zd,Gd,Rd,S,Jo,Bd,je,Vd,ha,Pd,Xd,vs,Yd,Ad,Sd,pt,qd,ft,kn,We,ut,Ms,Co,Qd,$s,Ld,Fn,J,Eo,Hd,Is,Od,Kd,ks,ec,tc,Fs,oc,ac,Zo,sc,Uo,nc,rc,ic,q,No,lc,Je,dc,pa,cc,mc,Ds,hc,pc,fc,gt,uc,_t,Dn;return a=new U({}),Ne=new ne({props:{$$slots:{default:[uh]},$$scope:{ctx:k}}}),jt=new U({}),Zt=new U({}),Ut=new fh({props:{pipeline:"image-classification"}}),Gt=new U({}),Rt=new D({props:{name:"class transformers.DeiTConfig",anchor:"transformers.DeiTConfig",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.DeiTConfig.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.DeiTConfig.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.DeiTConfig.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.DeiTConfig.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.DeiTConfig.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.DeiTConfig.hidden_dropout_prob",description:`<strong>hidden_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout probabilitiy for all fully connected layers in the embeddings, encoder, and pooler.`,name:"hidden_dropout_prob"},{anchor:"transformers.DeiTConfig.attention_probs_dropout_prob",description:`<strong>attention_probs_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout ratio for the attention probabilities.`,name:"attention_probs_dropout_prob"},{anchor:"transformers.DeiTConfig.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.DeiTConfig.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.DeiTConfig.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.DeiTConfig.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.DeiTConfig.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.DeiTConfig.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.DeiTConfig.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/main/src/transformers/models/deit/configuration_deit.py#L37"}}),Ve=new Ee({props:{anchor:"transformers.DeiTConfig.example",$$slots:{default:[gh]},$$scope:{ctx:k}}}),Vt=new U({}),Pt=new D({props:{name:"class transformers.DeiTFeatureExtractor",anchor:"transformers.DeiTFeatureExtractor",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/deit/feature_extraction_deit.py#L26"}}),Xt=new D({props:{name:"__call__",anchor:"transformers.DeiTFeatureExtractor.__call__",parameters:[{name:"images",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/image_processing_utils.py#L544"}}),Yt=new U({}),At=new D({props:{name:"class transformers.DeiTImageProcessor",anchor:"transformers.DeiTImageProcessor",parameters:[{name:"do_resize",val:": bool = True"},{name:"size",val:": typing.Dict[str, int] = None"},{name:"resample",val:": Resampling = 3"},{name:"do_center_crop",val:": bool = True"},{name:"crop_size",val:": typing.Dict[str, int] = None"},{name:"rescale_factor",val:": typing.Union[int, float] = 0.00392156862745098"},{name:"do_rescale",val:": bool = True"},{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.DeiTImageProcessor.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to resize the image&#x2019;s (height, width) dimensions to the specified <code>size</code>. Can be overridden by
<code>do_resize</code> in <code>preprocess</code>.`,name:"do_resize"},{anchor:"transformers.DeiTImageProcessor.size",description:`<strong>size</strong> (<code>Dict[str, int]</code> <em>optional</em>, defaults to <code>{&quot;height&quot; -- 256, &quot;width&quot;: 256}</code>):
Size of the image after <code>resize</code>. Can be overridden by <code>size</code> in <code>preprocess</code>.`,name:"size"},{anchor:"transformers.DeiTImageProcessor.resample",description:`<strong>resample</strong> (<code>PILImageResampling</code> filter, <em>optional</em>, defaults to <code>PILImageResampling.BICUBIC</code>) &#x2014;
Resampling filter to use if resizing the image. Can be overridden by <code>resample</code> in <code>preprocess</code>.`,name:"resample"},{anchor:"transformers.DeiTImageProcessor.do_center_crop",description:`<strong>do_center_crop</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to center crop the image. If the input size is smaller than <code>crop_size</code> along any edge, the image
is padded with 0&#x2019;s and then center cropped. Can be overridden by <code>do_center_crop</code> in <code>preprocess</code>.`,name:"do_center_crop"},{anchor:"transformers.DeiTImageProcessor.crop_size",description:`<strong>crop_size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>{&quot;height&quot; -- 224, &quot;width&quot;: 224}</code>):
Desired output size when applying center-cropping. Can be overridden by <code>crop_size</code> in <code>preprocess</code>.`,name:"crop_size"},{anchor:"transformers.DeiTImageProcessor.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.DeiTImageProcessor.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.DeiTImageProcessor.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.DeiTImageProcessor.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.DeiTImageProcessor.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/main/src/transformers/models/deit/image_processing_deit.py#L44"}}),St=new D({props:{name:"preprocess",anchor:"transformers.DeiTImageProcessor.preprocess",parameters:[{name:"images",val:": typing.Union[ForwardRef('PIL.Image.Image'), numpy.ndarray, ForwardRef('torch.Tensor'), typing.List[ForwardRef('PIL.Image.Image')], typing.List[numpy.ndarray], typing.List[ForwardRef('torch.Tensor')]]"},{name:"do_resize",val:": bool = None"},{name:"size",val:": typing.Dict[str, int] = None"},{name:"resample",val:" = None"},{name:"do_center_crop",val:": bool = None"},{name:"crop_size",val:": typing.Dict[str, int] = None"},{name:"do_rescale",val:": bool = None"},{name:"rescale_factor",val:": float = None"},{name:"do_normalize",val:": bool = None"},{name:"image_mean",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"image_std",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"return_tensors",val:": typing.Union[transformers.utils.generic.TensorType, str, NoneType] = None"},{name:"data_format",val:": 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.DeiTImageProcessor.preprocess.images",description:`<strong>images</strong> (<code>ImageInput</code>) &#x2014;
Image to preprocess.`,name:"images"},{anchor:"transformers.DeiTImageProcessor.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.DeiTImageProcessor.preprocess.size",description:`<strong>size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>self.size</code>) &#x2014;
Size of the image after <code>resize</code>.`,name:"size"},{anchor:"transformers.DeiTImageProcessor.preprocess.resample",description:`<strong>resample</strong> (<code>PILImageResampling</code>, <em>optional</em>, defaults to <code>self.resample</code>) &#x2014;
PILImageResampling filter to use if resizing the image Only has an effect if <code>do_resize</code> is set to
<code>True</code>.`,name:"resample"},{anchor:"transformers.DeiTImageProcessor.preprocess.do_center_crop",description:`<strong>do_center_crop</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_center_crop</code>) &#x2014;
Whether to center crop the image.`,name:"do_center_crop"},{anchor:"transformers.DeiTImageProcessor.preprocess.crop_size",description:`<strong>crop_size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>self.crop_size</code>) &#x2014;
Size of the image after center crop. If one edge the image is smaller than <code>crop_size</code>, it will be
padded with zeros and then cropped`,name:"crop_size"},{anchor:"transformers.DeiTImageProcessor.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.DeiTImageProcessor.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.DeiTImageProcessor.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.DeiTImageProcessor.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.`,name:"image_mean"},{anchor:"transformers.DeiTImageProcessor.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.`,name:"image_std"},{anchor:"transformers.DeiTImageProcessor.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><code>None</code>: 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.DeiTImageProcessor.preprocess.data_format",description:`<strong>data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>, defaults to <code>ChannelDimension.FIRST</code>) &#x2014;
The channel dimension format for the output image. Can be one of:<ul>
<li><code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li>
<li><code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.</li>
</ul>`,name:"data_format"},{anchor:"transformers.DeiTImageProcessor.preprocess.input_data_format",description:`<strong>input_data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>) &#x2014;
The channel dimension format for the input image. If unset, the channel dimension format is inferred
from the input image. Can be one of:<ul>
<li><code>&quot;channels_first&quot;</code> or <code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li>
<li><code>&quot;channels_last&quot;</code> or <code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.</li>
<li><code>&quot;none&quot;</code> or <code>ChannelDimension.NONE</code>: image in (height, width) format.</li>
</ul>`,name:"input_data_format"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/deit/image_processing_deit.py#L160"}}),qt=new U({}),Qt=new D({props:{name:"class transformers.DeiTModel",anchor:"transformers.DeiTModel",parameters:[{name:"config",val:": DeiTConfig"},{name:"add_pooling_layer",val:": bool = True"},{name:"use_mask_token",val:": bool = False"}],parametersDescription:[{anchor:"transformers.DeiTModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/deit#transformers.DeiTConfig">DeiTConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/deit/modeling_deit.py#L461"}}),Ot=new D({props:{name:"forward",anchor:"transformers.DeiTModel.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:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.DeiTModel.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/main/en/model_doc/donut#transformers.DonutFeatureExtractor.__call__">DeiTImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.DeiTModel.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.DeiTModel.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.DeiTModel.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.DeiTModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.DeiTModel.forward.bool_masked_pos",description:`<strong>bool_masked_pos</strong> (<code>torch.BoolTensor</code> of shape <code>(batch_size, num_patches)</code>, <em>optional</em>) &#x2014;
Boolean masked positions. Indicates which patches are masked (1) and which aren&#x2019;t (0).`,name:"bool_masked_pos"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/deit/modeling_deit.py#L486",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/deit#transformers.DeiTConfig"
>DeiTConfig</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/main/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),qe=new ne({props:{$$slots:{default:[_h]},$$scope:{ctx:k}}}),Qe=new Ee({props:{anchor:"transformers.DeiTModel.forward.example",$$slots:{default:[Th]},$$scope:{ctx:k}}}),Kt=new U({}),eo=new D({props:{name:"class transformers.DeiTForMaskedImageModeling",anchor:"transformers.DeiTForMaskedImageModeling",parameters:[{name:"config",val:": DeiTConfig"}],parametersDescription:[{anchor:"transformers.DeiTForMaskedImageModeling.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/deit#transformers.DeiTConfig">DeiTConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/deit/modeling_deit.py#L581"}}),He=new ne({props:{$$slots:{default:[bh]},$$scope:{ctx:k}}}),no=new D({props:{name:"forward",anchor:"transformers.DeiTForMaskedImageModeling.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:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.DeiTForMaskedImageModeling.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/main/en/model_doc/donut#transformers.DonutFeatureExtractor.__call__">DeiTImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.DeiTForMaskedImageModeling.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.DeiTForMaskedImageModeling.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.DeiTForMaskedImageModeling.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.DeiTForMaskedImageModeling.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.DeiTForMaskedImageModeling.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/main/src/transformers/models/deit/modeling_deit.py#L599",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/main/en/model_doc/deit#transformers.DeiTConfig"
>DeiTConfig</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>
`}}),Oe=new ne({props:{$$slots:{default:[yh]},$$scope:{ctx:k}}}),Ke=new Ee({props:{anchor:"transformers.DeiTForMaskedImageModeling.forward.example",$$slots:{default:[wh]},$$scope:{ctx:k}}}),ro=new U({}),io=new D({props:{name:"class transformers.DeiTForImageClassification",anchor:"transformers.DeiTForImageClassification",parameters:[{name:"config",val:": DeiTConfig"}],parametersDescription:[{anchor:"transformers.DeiTForImageClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/deit#transformers.DeiTConfig">DeiTConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/deit/modeling_deit.py#L693"}}),mo=new D({props:{name:"forward",anchor:"transformers.DeiTForImageClassification.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:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.DeiTForImageClassification.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/main/en/model_doc/donut#transformers.DonutFeatureExtractor.__call__">DeiTImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.DeiTForImageClassification.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.DeiTForImageClassification.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.DeiTForImageClassification.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.DeiTForImageClassification.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.DeiTForImageClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the image classification/regression loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>. If <code>config.num_labels == 1</code> a regression loss is computed (Mean-Square loss), If
<code>config.num_labels &gt; 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/deit/modeling_deit.py#L706",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.ImageClassifierOutput"
>transformers.modeling_outputs.ImageClassifierOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/deit#transformers.DeiTConfig"
>DeiTConfig</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/main/en/main_classes/output#transformers.modeling_outputs.ImageClassifierOutput"
>transformers.modeling_outputs.ImageClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),tt=new ne({props:{$$slots:{default:[vh]},$$scope:{ctx:k}}}),ot=new Ee({props:{anchor:"transformers.DeiTForImageClassification.forward.example",$$slots:{default:[Mh]},$$scope:{ctx:k}}}),ho=new U({}),po=new D({props:{name:"class transformers.DeiTForImageClassificationWithTeacher",anchor:"transformers.DeiTForImageClassificationWithTeacher",parameters:[{name:"config",val:": DeiTConfig"}],parametersDescription:[{anchor:"transformers.DeiTForImageClassificationWithTeacher.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/deit#transformers.DeiTConfig">DeiTConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/deit/modeling_deit.py#L843"}}),go=new D({props:{name:"forward",anchor:"transformers.DeiTForImageClassificationWithTeacher.forward",parameters:[{name:"pixel_values",val:": typing.Optional[torch.Tensor] = 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:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.DeiTForImageClassificationWithTeacher.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/main/en/model_doc/donut#transformers.DonutFeatureExtractor.__call__">DeiTImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.DeiTForImageClassificationWithTeacher.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.DeiTForImageClassificationWithTeacher.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.DeiTForImageClassificationWithTeacher.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.DeiTForImageClassificationWithTeacher.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/deit/modeling_deit.py#L861",returnDescription:`
<p>A <code>transformers.models.deit.modeling_deit.DeiTForImageClassificationWithTeacherOutput</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/main/en/model_doc/deit#transformers.DeiTConfig"
>DeiTConfig</a>) and inputs.</p>
<ul>
<li><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.num_labels)</code>) \u2014 Prediction scores as the average of the cls_logits and distillation logits.</li>
<li><strong>cls_logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.num_labels)</code>) \u2014 Prediction scores of the classification head (i.e. the linear layer on top of the final hidden state of the
class token).</li>
<li><strong>distillation_logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.num_labels)</code>) \u2014 Prediction scores of the distillation head (i.e. the linear layer on top of the final hidden state of the
distillation token).</li>
<li><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings + one for the output of each layer) of
shape <code>(batch_size, sequence_length, hidden_size)</code>. Hidden-states of the model at the output of each layer
plus the initial embedding outputs.</li>
<li><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>. Attentions weights after the attention softmax, used to compute the weighted average in
the self-attention heads.</li>
</ul>
`,returnType:`
<p><code>transformers.models.deit.modeling_deit.DeiTForImageClassificationWithTeacherOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),st=new ne({props:{$$slots:{default:[$h]},$$scope:{ctx:k}}}),nt=new Ee({props:{anchor:"transformers.DeiTForImageClassificationWithTeacher.forward.example",$$slots:{default:[Ih]},$$scope:{ctx:k}}}),_o=new U({}),To=new D({props:{name:"class transformers.TFDeiTModel",anchor:"transformers.TFDeiTModel",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFDeiTModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/deit#transformers.DeiTConfig">DeiTConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/deit/modeling_tf_deit.py#L610"}}),wo=new D({props:{name:"call",anchor:"transformers.TFDeiTModel.call",parameters:[{name:"pixel_values",val:": tf.Tensor | None = None"},{name:"bool_masked_pos",val:": tf.Tensor | None = None"},{name:"head_mask",val:": tf.Tensor | None = None"},{name:"output_attentions",val:": Optional[bool] = None"},{name:"output_hidden_states",val:": Optional[bool] = None"},{name:"return_dict",val:": Optional[bool] = None"},{name:"training",val:": bool = False"}],parametersDescription:[{anchor:"transformers.TFDeiTModel.call.pixel_values",description:`<strong>pixel_values</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/main/en/model_doc/donut#transformers.DonutFeatureExtractor.__call__">DeiTImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.TFDeiTModel.call.head_mask",description:`<strong>head_mask</strong> (<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.TFDeiTModel.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.`,name:"output_attentions"},{anchor:"transformers.TFDeiTModel.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.`,name:"output_hidden_states"},{anchor:"transformers.TFDeiTModel.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/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/deit/modeling_tf_deit.py#L620",returnDescription:`
<p>A <a
  href="/docs/transformers/main/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/main/en/model_doc/deit#transformers.DeiTConfig"
>DeiTConfig</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/main/en/main_classes/output#transformers.modeling_tf_outputs.TFBaseModelOutputWithPooling"
>transformers.modeling_tf_outputs.TFBaseModelOutputWithPooling</a> or <code>tuple(tf.Tensor)</code></p>
`}}),it=new ne({props:{$$slots:{default:[kh]},$$scope:{ctx:k}}}),lt=new Ee({props:{anchor:"transformers.TFDeiTModel.call.example",$$slots:{default:[Fh]},$$scope:{ctx:k}}}),vo=new U({}),Mo=new D({props:{name:"class transformers.TFDeiTForMaskedImageModeling",anchor:"transformers.TFDeiTForMaskedImageModeling",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFDeiTForMaskedImageModeling.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/deit#transformers.DeiTConfig">DeiTConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/deit/modeling_tf_deit.py#L718"}}),ko=new D({props:{name:"call",anchor:"transformers.TFDeiTForMaskedImageModeling.call",parameters:[{name:"pixel_values",val:": tf.Tensor | None = None"},{name:"bool_masked_pos",val:": tf.Tensor | None = None"},{name:"head_mask",val:": tf.Tensor | None = None"},{name:"output_attentions",val:": Optional[bool] = None"},{name:"output_hidden_states",val:": Optional[bool] = None"},{name:"return_dict",val:": Optional[bool] = None"},{name:"training",val:": bool = False"}],parametersDescription:[{anchor:"transformers.TFDeiTForMaskedImageModeling.call.pixel_values",description:`<strong>pixel_values</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/main/en/model_doc/donut#transformers.DonutFeatureExtractor.__call__">DeiTImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.TFDeiTForMaskedImageModeling.call.head_mask",description:`<strong>head_mask</strong> (<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.TFDeiTForMaskedImageModeling.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.`,name:"output_attentions"},{anchor:"transformers.TFDeiTForMaskedImageModeling.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.`,name:"output_hidden_states"},{anchor:"transformers.TFDeiTForMaskedImageModeling.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/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.TFDeiTForMaskedImageModeling.call.bool_masked_pos",description:`<strong>bool_masked_pos</strong> (<code>tf.Tensor</code> of type bool and 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/main/src/transformers/models/deit/modeling_tf_deit.py#L725",returnDescription:`
<p>A <code>transformers.modeling_tf_outputs.TFMaskedImageModelingOutput</code> 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/main/en/model_doc/deit#transformers.DeiTConfig"
>DeiTConfig</a>) and inputs.</p>
<ul>
<li><strong>loss</strong> (<code>tf.Tensor</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>tf.Tensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) \u2014 Reconstructed / completed images.</li>
<li><strong>hidden_states</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when</li>
<li><strong><code>config.output_hidden_states=True</code>):</strong>
Tuple of <code>tf.Tensor</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(tf.Tensor)</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>tf.Tensor</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_tf_outputs.TFMaskedImageModelingOutput</code> or <code>tuple(tf.Tensor)</code></p>
`}}),ct=new ne({props:{$$slots:{default:[Dh]},$$scope:{ctx:k}}}),mt=new Ee({props:{anchor:"transformers.TFDeiTForMaskedImageModeling.call.example",$$slots:{default:[jh]},$$scope:{ctx:k}}}),Fo=new U({}),Do=new D({props:{name:"class transformers.TFDeiTForImageClassification",anchor:"transformers.TFDeiTForImageClassification",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFDeiTForImageClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/deit#transformers.DeiTConfig">DeiTConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/deit/modeling_tf_deit.py#L833"}}),Jo=new D({props:{name:"call",anchor:"transformers.TFDeiTForImageClassification.call",parameters:[{name:"pixel_values",val:": tf.Tensor | None = None"},{name:"head_mask",val:": tf.Tensor | None = None"},{name:"labels",val:": tf.Tensor | None = None"},{name:"output_attentions",val:": Optional[bool] = None"},{name:"output_hidden_states",val:": Optional[bool] = None"},{name:"return_dict",val:": Optional[bool] = None"},{name:"training",val:": bool = False"}],parametersDescription:[{anchor:"transformers.TFDeiTForImageClassification.call.pixel_values",description:`<strong>pixel_values</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/main/en/model_doc/donut#transformers.DonutFeatureExtractor.__call__">DeiTImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.TFDeiTForImageClassification.call.head_mask",description:`<strong>head_mask</strong> (<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.TFDeiTForImageClassification.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.`,name:"output_attentions"},{anchor:"transformers.TFDeiTForImageClassification.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.`,name:"output_hidden_states"},{anchor:"transformers.TFDeiTForImageClassification.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/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.TFDeiTForImageClassification.call.labels",description:`<strong>labels</strong> (<code>tf.Tensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the image classification/regression loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>. If <code>config.num_labels == 1</code> a regression loss is computed (Mean-Square loss), If
<code>config.num_labels &gt; 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/deit/modeling_tf_deit.py#L847",returnDescription:`
<p>A <code>transformers.modeling_tf_outputs.TFImageClassifierOutput</code> 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/main/en/model_doc/deit#transformers.DeiTConfig"
>DeiTConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>tf.Tensor</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>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, 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(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, 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><code>transformers.modeling_tf_outputs.TFImageClassifierOutput</code> or <code>tuple(tf.Tensor)</code></p>
`}}),pt=new ne({props:{$$slots:{default:[Wh]},$$scope:{ctx:k}}}),ft=new Ee({props:{anchor:"transformers.TFDeiTForImageClassification.call.example",$$slots:{default:[Jh]},$$scope:{ctx:k}}}),Co=new U({}),Eo=new D({props:{name:"class transformers.TFDeiTForImageClassificationWithTeacher",anchor:"transformers.TFDeiTForImageClassificationWithTeacher",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFDeiTForImageClassificationWithTeacher.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/deit#transformers.DeiTConfig">DeiTConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/deit/modeling_tf_deit.py#L935"}}),No=new D({props:{name:"call",anchor:"transformers.TFDeiTForImageClassificationWithTeacher.call",parameters:[{name:"pixel_values",val:": tf.Tensor | None = None"},{name:"head_mask",val:": tf.Tensor | None = None"},{name:"output_attentions",val:": Optional[bool] = None"},{name:"output_hidden_states",val:": Optional[bool] = None"},{name:"return_dict",val:": Optional[bool] = None"},{name:"training",val:": bool = False"}],parametersDescription:[{anchor:"transformers.TFDeiTForImageClassificationWithTeacher.call.pixel_values",description:`<strong>pixel_values</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/main/en/model_doc/donut#transformers.DonutFeatureExtractor.__call__">DeiTImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.TFDeiTForImageClassificationWithTeacher.call.head_mask",description:`<strong>head_mask</strong> (<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.TFDeiTForImageClassificationWithTeacher.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.`,name:"output_attentions"},{anchor:"transformers.TFDeiTForImageClassificationWithTeacher.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.`,name:"output_hidden_states"},{anchor:"transformers.TFDeiTForImageClassificationWithTeacher.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/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/deit/modeling_tf_deit.py#L954",returnDescription:`
<p>A <code>transformers.models.deit.modeling_tf_deit.TFDeiTForImageClassificationWithTeacherOutput</code> 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/main/en/model_doc/deit#transformers.DeiTConfig"
>DeiTConfig</a>) and inputs.</p>
<ul>
<li><strong>logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, config.num_labels)</code>) \u2014 Prediction scores as the average of the cls_logits and distillation logits.</li>
<li><strong>cls_logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, config.num_labels)</code>) \u2014 Prediction scores of the classification head (i.e. the linear layer on top of the final hidden state of the
class token).</li>
<li><strong>distillation_logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, config.num_labels)</code>) \u2014 Prediction scores of the distillation head (i.e. the linear layer on top of the final hidden state of the
distillation token).</li>
<li><strong>hidden_states</strong> (<code>tuple(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>. Hidden-states of the model at the output of each layer plus
the initial embedding outputs.</li>
<li><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>. Attentions weights after the attention softmax, used to compute the weighted average in
the self-attention heads.</li>
</ul>
`,returnType:`
<p><code>transformers.models.deit.modeling_tf_deit.TFDeiTForImageClassificationWithTeacherOutput</code> or <code>tuple(tf.Tensor)</code></p>
`}}),gt=new ne({props:{$$slots:{default:[Ch]},$$scope:{ctx:k}}}),_t=new Ee({props:{anchor:"transformers.TFDeiTForImageClassificationWithTeacher.call.example",$$slots:{default:[Eh]},$$scope:{ctx:k}}}),{c(){d=s("meta"),b=h(),u=s("h1"),f=s("a"),T=s("span"),y(a.$$.fragment),m=h(),F=s("span"),Kn=i("DeiT"),Xs=h(),y(Ne.$$.fragment),Ys=h(),re=s("h2"),xe=s("a"),Wa=s("span"),y(jt.$$.fragment),er=h(),Ja=s("span"),tr=i("Overview"),As=h(),R=s("p"),or=i("The DeiT model was proposed in "),Wt=s("a"),ar=i("Training data-efficient image transformers & distillation through attention"),sr=i(` by Hugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa, Alexandre
Sablayrolles, Herv\xE9 J\xE9gou. The `),Ro=s("a"),nr=i("Vision Transformer (ViT)"),rr=i(" introduced in "),Jt=s("a"),ir=i("Dosovitskiy et al., 2020"),lr=i(` has shown that one can match or even outperform existing convolutional neural
networks using a Transformer encoder (BERT-like). However, the ViT models introduced in that paper required training on
expensive infrastructure for multiple weeks, using external data. DeiT (data-efficient image transformers) are more
efficiently trained transformers for image classification, requiring far less data and far less computing resources
compared to the original ViT models.`),Ss=h(),Bo=s("p"),dr=i("The abstract from the paper is the following:"),qs=h(),Vo=s("p"),Ca=s("em"),cr=i(`Recently, neural networks purely based on attention were shown to address image understanding tasks such as image
classification. However, these visual transformers are pre-trained with hundreds of millions of images using an
expensive infrastructure, thereby limiting their adoption. In this work, we produce a competitive convolution-free
transformer by training on Imagenet only. We train them on a single computer in less than 3 days. Our reference vision
transformer (86M parameters) achieves top-1 accuracy of 83.1% (single-crop evaluation) on ImageNet with no external
data. More importantly, we introduce a teacher-student strategy specific to transformers. It relies on a distillation
token ensuring that the student learns from the teacher through attention. We show the interest of this token-based
distillation, especially when using a convnet as a teacher. This leads us to report results competitive with convnets
for both Imagenet (where we obtain up to 85.2% accuracy) and when transferring to other tasks. We share our code and
models.`),Qs=h(),Po=s("p"),mr=i("Tips:"),Ls=h(),Z=s("ul"),Ea=s("li"),hr=i(`Compared to ViT, DeiT models use a so-called distillation token to effectively learn from a teacher (which, in the
DeiT paper, is a ResNet like-model). The distillation token is learned through backpropagation, by interacting with
the class ([CLS]) and patch tokens through the self-attention layers.`),pr=h(),ie=s("li"),fr=i(`There are 2 ways to fine-tune distilled models, either (1) in a classic way, by only placing a prediction head on top
of the final hidden state of the class token and not using the distillation signal, or (2) by placing both a
prediction head on top of the class token and on top of the distillation token. In that case, the [CLS] prediction
head is trained using regular cross-entropy between the prediction of the head and the ground-truth label, while the
distillation prediction head is trained using hard distillation (cross-entropy between the prediction of the
distillation head and the label predicted by the teacher). At inference time, one takes the average prediction
between both heads as final prediction. (2) is also called \u201Cfine-tuning with distillation\u201D, because one relies on a
teacher that has already been fine-tuned on the downstream dataset. In terms of models, (1) corresponds to
`),Xo=s("a"),ur=i("DeiTForImageClassification"),gr=i(` and (2) corresponds to
`),Yo=s("a"),_r=i("DeiTForImageClassificationWithTeacher"),Tr=i("."),br=h(),Za=s("li"),yr=i(`Note that the authors also did try soft distillation for (2) (in which case the distillation prediction head is
trained using KL divergence to match the softmax output of the teacher), but hard distillation gave the best results.`),wr=h(),Ua=s("li"),vr=i(`All released checkpoints were pre-trained and fine-tuned on ImageNet-1k only. No external data was used. This is in
contrast with the original ViT model, which used external data like the JFT-300M dataset/Imagenet-21k for
pre-training.`),Mr=h(),j=s("li"),$r=i(`The authors of DeiT also released more efficiently trained ViT models, which you can directly plug into
`),Ao=s("a"),Ir=i("ViTModel"),kr=i(" or "),So=s("a"),Fr=i("ViTForImageClassification"),Dr=i(`. Techniques like data
augmentation, optimization, and regularization were used in order to simulate training on a much larger dataset
(while only using ImageNet-1k for pre-training). There are 4 variants available (in 3 different sizes):
`),Na=s("em"),jr=i("facebook/deit-tiny-patch16-224"),Wr=i(", "),xa=s("em"),Jr=i("facebook/deit-small-patch16-224"),Cr=i(", "),za=s("em"),Er=i("facebook/deit-base-patch16-224"),Zr=i(` and
`),Ga=s("em"),Ur=i("facebook/deit-base-patch16-384"),Nr=i(". Note that one should use "),qo=s("a"),xr=i("DeiTImageProcessor"),zr=i(` in order to
prepare images for the model.`),Hs=h(),oe=s("p"),Gr=i("This model was contributed by "),Ct=s("a"),Rr=i("nielsr"),Br=i(". The TensorFlow version of this model was added by "),Et=s("a"),Vr=i("amyeroberts"),Pr=i("."),Os=h(),le=s("h2"),ze=s("a"),Ra=s("span"),y(Zt.$$.fragment),Xr=h(),Ba=s("span"),Yr=i("Resources"),Ks=h(),Qo=s("p"),Ar=i("A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with DeiT."),en=h(),y(Ut.$$.fragment),tn=h(),Ge=s("ul"),ae=s("li"),Lo=s("a"),Sr=i("DeiTForImageClassification"),qr=i(" is supported by this "),Nt=s("a"),Qr=i("example script"),Lr=i(" and "),xt=s("a"),Hr=i("notebook"),Or=i("."),Kr=h(),Ho=s("li"),ei=i("See also: "),Oo=s("a"),ti=i("Image classification task guide"),on=h(),Ko=s("p"),oi=i("Besides that:"),an=h(),ea=s("ul"),Re=s("li"),ta=s("a"),ai=i("DeiTForMaskedImageModeling"),si=i(" is supported by this "),zt=s("a"),ni=i("example script"),ri=i("."),sn=h(),oa=s("p"),ii=i("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."),nn=h(),de=s("h2"),Be=s("a"),Va=s("span"),y(Gt.$$.fragment),li=h(),Pa=s("span"),di=i("DeiTConfig"),rn=h(),N=s("div"),y(Rt.$$.fragment),ci=h(),ce=s("p"),mi=i("This is the configuration class to store the configuration of a "),aa=s("a"),hi=i("DeiTModel"),pi=i(`. It is used to instantiate an DeiT
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 DeiT
`),Bt=s("a"),fi=i("facebook/deit-base-distilled-patch16-224"),ui=i(`
architecture.`),gi=h(),me=s("p"),_i=i("Configuration objects inherit from "),sa=s("a"),Ti=i("PretrainedConfig"),bi=i(` and can be used to control the model outputs. Read the
documentation from `),na=s("a"),yi=i("PretrainedConfig"),wi=i(" for more information."),vi=h(),y(Ve.$$.fragment),ln=h(),he=s("h2"),Pe=s("a"),Xa=s("span"),y(Vt.$$.fragment),Mi=h(),Ya=s("span"),$i=i("DeiTFeatureExtractor"),dn=h(),pe=s("div"),y(Pt.$$.fragment),Ii=h(),Xe=s("div"),y(Xt.$$.fragment),ki=h(),Aa=s("p"),Fi=i("Preprocess an image or a batch of images."),cn=h(),fe=s("h2"),Ye=s("a"),Sa=s("span"),y(Yt.$$.fragment),Di=h(),qa=s("span"),ji=i("DeiTImageProcessor"),mn=h(),H=s("div"),y(At.$$.fragment),Wi=h(),Qa=s("p"),Ji=i("Constructs a DeiT image processor."),Ci=h(),Ae=s("div"),y(St.$$.fragment),Ei=h(),La=s("p"),Zi=i("Preprocess an image or batch of images."),hn=h(),ue=s("h2"),Se=s("a"),Ha=s("span"),y(qt.$$.fragment),Ui=h(),Oa=s("span"),Ni=i("DeiTModel"),pn=h(),O=s("div"),y(Qt.$$.fragment),xi=h(),Lt=s("p"),zi=i(`The bare DeiT Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),Ht=s("a"),Gi=i("torch.nn.Module"),Ri=i(` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Bi=h(),B=s("div"),y(Ot.$$.fragment),Vi=h(),ge=s("p"),Pi=i("The "),ra=s("a"),Xi=i("DeiTModel"),Yi=i(" forward method, overrides the "),Ka=s("code"),Ai=i("__call__"),Si=i(" special method."),qi=h(),y(qe.$$.fragment),Qi=h(),y(Qe.$$.fragment),fn=h(),_e=s("h2"),Le=s("a"),es=s("span"),y(Kt.$$.fragment),Li=h(),ts=s("span"),Hi=i("DeiTForMaskedImageModeling"),un=h(),E=s("div"),y(eo.$$.fragment),Oi=h(),to=s("p"),Ki=i("DeiT Model with a decoder on top for masked image modeling, as proposed in "),oo=s("a"),el=i("SimMIM"),tl=i("."),ol=h(),y(He.$$.fragment),al=h(),ao=s("p"),sl=i("This model is a PyTorch "),so=s("a"),nl=i("torch.nn.Module"),rl=i(` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),il=h(),V=s("div"),y(no.$$.fragment),ll=h(),Te=s("p"),dl=i("The "),ia=s("a"),cl=i("DeiTForMaskedImageModeling"),ml=i(" forward method, overrides the "),os=s("code"),hl=i("__call__"),pl=i(" special method."),fl=h(),y(Oe.$$.fragment),ul=h(),y(Ke.$$.fragment),gn=h(),be=s("h2"),et=s("a"),as=s("span"),y(ro.$$.fragment),gl=h(),ss=s("span"),_l=i("DeiTForImageClassification"),_n=h(),x=s("div"),y(io.$$.fragment),Tl=h(),ns=s("p"),bl=i(`DeiT 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.`),yl=h(),lo=s("p"),wl=i("This model is a PyTorch "),co=s("a"),vl=i("torch.nn.Module"),Ml=i(` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),$l=h(),P=s("div"),y(mo.$$.fragment),Il=h(),ye=s("p"),kl=i("The "),la=s("a"),Fl=i("DeiTForImageClassification"),Dl=i(" forward method, overrides the "),rs=s("code"),jl=i("__call__"),Wl=i(" special method."),Jl=h(),y(tt.$$.fragment),Cl=h(),y(ot.$$.fragment),Tn=h(),we=s("h2"),at=s("a"),is=s("span"),y(ho.$$.fragment),El=h(),ls=s("span"),Zl=i("DeiTForImageClassificationWithTeacher"),bn=h(),W=s("div"),y(po.$$.fragment),Ul=h(),ds=s("p"),Nl=i(`DeiT Model transformer with image classification heads on top (a linear layer on top of the final hidden state of
the [CLS] token and a linear layer on top of the final hidden state of the distillation token) e.g. for ImageNet.`),xl=h(),cs=s("p"),zl=i(".. warning::"),Gl=h(),ms=s("p"),Rl=i(`This model supports inference-only. Fine-tuning with distillation (i.e. with a teacher) is not yet
supported.`),Bl=h(),fo=s("p"),Vl=i("This model is a PyTorch "),uo=s("a"),Pl=i("torch.nn.Module"),Xl=i(` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Yl=h(),X=s("div"),y(go.$$.fragment),Al=h(),ve=s("p"),Sl=i("The "),da=s("a"),ql=i("DeiTForImageClassificationWithTeacher"),Ql=i(" forward method, overrides the "),hs=s("code"),Ll=i("__call__"),Hl=i(" special method."),Ol=h(),y(st.$$.fragment),Kl=h(),y(nt.$$.fragment),yn=h(),Me=s("h2"),rt=s("a"),ps=s("span"),y(_o.$$.fragment),ed=h(),fs=s("span"),td=i("TFDeiTModel"),wn=h(),K=s("div"),y(To.$$.fragment),od=h(),bo=s("p"),ad=i(`The bare DeiT Model transformer outputting raw hidden-states without any specific head on top.
This model is a TensorFlow
`),yo=s("a"),sd=i("tf.keras.layers.Layer"),nd=i(`. Use it as a regular
TensorFlow Module and refer to the TensorFlow documentation for all matter related to general usage and behavior.`),rd=h(),Y=s("div"),y(wo.$$.fragment),id=h(),$e=s("p"),ld=i("The "),ca=s("a"),dd=i("TFDeiTModel"),cd=i(" forward method, overrides the "),us=s("code"),md=i("__call__"),hd=i(" special method."),pd=h(),y(it.$$.fragment),fd=h(),y(lt.$$.fragment),vn=h(),Ie=s("h2"),dt=s("a"),gs=s("span"),y(vo.$$.fragment),ud=h(),_s=s("span"),gd=i("TFDeiTForMaskedImageModeling"),Mn=h(),ee=s("div"),y(Mo.$$.fragment),_d=h(),ke=s("p"),Td=i("DeiT Model with a decoder on top for masked image modeling, as proposed in "),$o=s("a"),bd=i("SimMIM"),yd=i(`.
This model is a TensorFlow
`),Io=s("a"),wd=i("tf.keras.layers.Layer"),vd=i(`. Use it as a regular
TensorFlow Module and refer to the TensorFlow documentation for all matter related to general usage and behavior.`),Md=h(),A=s("div"),y(ko.$$.fragment),$d=h(),Fe=s("p"),Id=i("The "),ma=s("a"),kd=i("TFDeiTForMaskedImageModeling"),Fd=i(" forward method, overrides the "),Ts=s("code"),Dd=i("__call__"),jd=i(" special method."),Wd=h(),y(ct.$$.fragment),Jd=h(),y(mt.$$.fragment),$n=h(),De=s("h2"),ht=s("a"),bs=s("span"),y(Fo.$$.fragment),Cd=h(),ys=s("span"),Ed=i("TFDeiTForImageClassification"),In=h(),z=s("div"),y(Do.$$.fragment),Zd=h(),ws=s("p"),Ud=i(`DeiT 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.`),Nd=h(),jo=s("p"),xd=i(`This model is a TensorFlow
`),Wo=s("a"),zd=i("tf.keras.layers.Layer"),Gd=i(`. Use it as a regular
TensorFlow Module and refer to the TensorFlow documentation for all matter related to general usage and behavior.`),Rd=h(),S=s("div"),y(Jo.$$.fragment),Bd=h(),je=s("p"),Vd=i("The "),ha=s("a"),Pd=i("TFDeiTForImageClassification"),Xd=i(" forward method, overrides the "),vs=s("code"),Yd=i("__call__"),Ad=i(" special method."),Sd=h(),y(pt.$$.fragment),qd=h(),y(ft.$$.fragment),kn=h(),We=s("h2"),ut=s("a"),Ms=s("span"),y(Co.$$.fragment),Qd=h(),$s=s("span"),Ld=i("TFDeiTForImageClassificationWithTeacher"),Fn=h(),J=s("div"),y(Eo.$$.fragment),Hd=h(),Is=s("p"),Od=i(`DeiT Model transformer with image classification heads on top (a linear layer on top of the final hidden state of
the [CLS] token and a linear layer on top of the final hidden state of the distillation token) e.g. for ImageNet.`),Kd=h(),ks=s("p"),ec=i(".. warning::"),tc=h(),Fs=s("p"),oc=i(`This model supports inference-only. Fine-tuning with distillation (i.e. with a teacher) is not yet
supported.`),ac=h(),Zo=s("p"),sc=i(`This model is a TensorFlow
`),Uo=s("a"),nc=i("tf.keras.layers.Layer"),rc=i(`. Use it as a regular
TensorFlow Module and refer to the TensorFlow documentation for all matter related to general usage and behavior.`),ic=h(),q=s("div"),y(No.$$.fragment),lc=h(),Je=s("p"),dc=i("The "),pa=s("a"),cc=i("TFDeiTForImageClassificationWithTeacher"),mc=i(" forward method, overrides the "),Ds=s("code"),hc=i("__call__"),pc=i(" special method."),fc=h(),y(gt.$$.fragment),uc=h(),y(_t.$$.fragment),this.h()},l(t){const g=hh('[data-svelte="svelte-1phssyn"]',document.head);d=n(g,"META",{name:!0,content:!0}),g.forEach(o),b=p(t),u=n(t,"H1",{class:!0});var xo=r(u);f=n(xo,"A",{id:!0,class:!0,href:!0});var js=r(f);T=n(js,"SPAN",{});var Ws=r(T);w(a.$$.fragment,Ws),Ws.forEach(o),js.forEach(o),m=p(xo),F=n(xo,"SPAN",{});var Js=r(F);Kn=l(Js,"DeiT"),Js.forEach(o),xo.forEach(o),Xs=p(t),w(Ne.$$.fragment,t),Ys=p(t),re=n(t,"H2",{class:!0});var zo=r(re);xe=n(zo,"A",{id:!0,class:!0,href:!0});var Cs=r(xe);Wa=n(Cs,"SPAN",{});var Es=r(Wa);w(jt.$$.fragment,Es),Es.forEach(o),Cs.forEach(o),er=p(zo),Ja=n(zo,"SPAN",{});var Zs=r(Ja);tr=l(Zs,"Overview"),Zs.forEach(o),zo.forEach(o),As=p(t),R=n(t,"P",{});var te=r(R);or=l(te,"The DeiT model was proposed in "),Wt=n(te,"A",{href:!0,rel:!0});var Us=r(Wt);ar=l(Us,"Training data-efficient image transformers & distillation through attention"),Us.forEach(o),sr=l(te,` by Hugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa, Alexandre
Sablayrolles, Herv\xE9 J\xE9gou. The `),Ro=n(te,"A",{href:!0});var Ns=r(Ro);nr=l(Ns,"Vision Transformer (ViT)"),Ns.forEach(o),rr=l(te," introduced in "),Jt=n(te,"A",{href:!0,rel:!0});var xs=r(Jt);ir=l(xs,"Dosovitskiy et al., 2020"),xs.forEach(o),lr=l(te,` has shown that one can match or even outperform existing convolutional neural
networks using a Transformer encoder (BERT-like). However, the ViT models introduced in that paper required training on
expensive infrastructure for multiple weeks, using external data. DeiT (data-efficient image transformers) are more
efficiently trained transformers for image classification, requiring far less data and far less computing resources
compared to the original ViT models.`),te.forEach(o),Ss=p(t),Bo=n(t,"P",{});var zs=r(Bo);dr=l(zs,"The abstract from the paper is the following:"),zs.forEach(o),qs=p(t),Vo=n(t,"P",{});var Gs=r(Vo);Ca=n(Gs,"EM",{});var Rs=r(Ca);cr=l(Rs,`Recently, neural networks purely based on attention were shown to address image understanding tasks such as image
classification. However, these visual transformers are pre-trained with hundreds of millions of images using an
expensive infrastructure, thereby limiting their adoption. In this work, we produce a competitive convolution-free
transformer by training on Imagenet only. We train them on a single computer in less than 3 days. Our reference vision
transformer (86M parameters) achieves top-1 accuracy of 83.1% (single-crop evaluation) on ImageNet with no external
data. More importantly, we introduce a teacher-student strategy specific to transformers. It relies on a distillation
token ensuring that the student learns from the teacher through attention. We show the interest of this token-based
distillation, especially when using a convnet as a teacher. This leads us to report results competitive with convnets
for both Imagenet (where we obtain up to 85.2% accuracy) and when transferring to other tasks. We share our code and
models.`),Rs.forEach(o),Gs.forEach(o),Qs=p(t),Po=n(t,"P",{});var Bs=r(Po);mr=l(Bs,"Tips:"),Bs.forEach(o),Ls=p(t),Z=n(t,"UL",{});var G=r(Z);Ea=n(G,"LI",{});var Vs=r(Ea);hr=l(Vs,`Compared to ViT, DeiT models use a so-called distillation token to effectively learn from a teacher (which, in the
DeiT paper, is a ResNet like-model). The distillation token is learned through backpropagation, by interacting with
the class ([CLS]) and patch tokens through the self-attention layers.`),Vs.forEach(o),pr=p(G),ie=n(G,"LI",{});var Ce=r(ie);fr=l(Ce,`There are 2 ways to fine-tune distilled models, either (1) in a classic way, by only placing a prediction head on top
of the final hidden state of the class token and not using the distillation signal, or (2) by placing both a
prediction head on top of the class token and on top of the distillation token. In that case, the [CLS] prediction
head is trained using regular cross-entropy between the prediction of the head and the ground-truth label, while the
distillation prediction head is trained using hard distillation (cross-entropy between the prediction of the
distillation head and the label predicted by the teacher). At inference time, one takes the average prediction
between both heads as final prediction. (2) is also called \u201Cfine-tuning with distillation\u201D, because one relies on a
teacher that has already been fine-tuned on the downstream dataset. In terms of models, (1) corresponds to
`),Xo=n(Ce,"A",{href:!0});var _c=r(Xo);ur=l(_c,"DeiTForImageClassification"),_c.forEach(o),gr=l(Ce,` and (2) corresponds to
`),Yo=n(Ce,"A",{href:!0});var Tc=r(Yo);_r=l(Tc,"DeiTForImageClassificationWithTeacher"),Tc.forEach(o),Tr=l(Ce,"."),Ce.forEach(o),br=p(G),Za=n(G,"LI",{});var bc=r(Za);yr=l(bc,`Note that the authors also did try soft distillation for (2) (in which case the distillation prediction head is
trained using KL divergence to match the softmax output of the teacher), but hard distillation gave the best results.`),bc.forEach(o),wr=p(G),Ua=n(G,"LI",{});var yc=r(Ua);vr=l(yc,`All released checkpoints were pre-trained and fine-tuned on ImageNet-1k only. No external data was used. This is in
contrast with the original ViT model, which used external data like the JFT-300M dataset/Imagenet-21k for
pre-training.`),yc.forEach(o),Mr=p(G),j=n(G,"LI",{});var C=r(j);$r=l(C,`The authors of DeiT also released more efficiently trained ViT models, which you can directly plug into
`),Ao=n(C,"A",{href:!0});var wc=r(Ao);Ir=l(wc,"ViTModel"),wc.forEach(o),kr=l(C," or "),So=n(C,"A",{href:!0});var vc=r(So);Fr=l(vc,"ViTForImageClassification"),vc.forEach(o),Dr=l(C,`. Techniques like data
augmentation, optimization, and regularization were used in order to simulate training on a much larger dataset
(while only using ImageNet-1k for pre-training). There are 4 variants available (in 3 different sizes):
`),Na=n(C,"EM",{});var Mc=r(Na);jr=l(Mc,"facebook/deit-tiny-patch16-224"),Mc.forEach(o),Wr=l(C,", "),xa=n(C,"EM",{});var $c=r(xa);Jr=l($c,"facebook/deit-small-patch16-224"),$c.forEach(o),Cr=l(C,", "),za=n(C,"EM",{});var Ic=r(za);Er=l(Ic,"facebook/deit-base-patch16-224"),Ic.forEach(o),Zr=l(C,` and
`),Ga=n(C,"EM",{});var kc=r(Ga);Ur=l(kc,"facebook/deit-base-patch16-384"),kc.forEach(o),Nr=l(C,". Note that one should use "),qo=n(C,"A",{href:!0});var Fc=r(qo);xr=l(Fc,"DeiTImageProcessor"),Fc.forEach(o),zr=l(C,` in order to
prepare images for the model.`),C.forEach(o),G.forEach(o),Hs=p(t),oe=n(t,"P",{});var fa=r(oe);Gr=l(fa,"This model was contributed by "),Ct=n(fa,"A",{href:!0,rel:!0});var Dc=r(Ct);Rr=l(Dc,"nielsr"),Dc.forEach(o),Br=l(fa,". The TensorFlow version of this model was added by "),Et=n(fa,"A",{href:!0,rel:!0});var jc=r(Et);Vr=l(jc,"amyeroberts"),jc.forEach(o),Pr=l(fa,"."),fa.forEach(o),Os=p(t),le=n(t,"H2",{class:!0});var jn=r(le);ze=n(jn,"A",{id:!0,class:!0,href:!0});var Wc=r(ze);Ra=n(Wc,"SPAN",{});var Jc=r(Ra);w(Zt.$$.fragment,Jc),Jc.forEach(o),Wc.forEach(o),Xr=p(jn),Ba=n(jn,"SPAN",{});var Cc=r(Ba);Yr=l(Cc,"Resources"),Cc.forEach(o),jn.forEach(o),Ks=p(t),Qo=n(t,"P",{});var Ec=r(Qo);Ar=l(Ec,"A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with DeiT."),Ec.forEach(o),en=p(t),w(Ut.$$.fragment,t),tn=p(t),Ge=n(t,"UL",{});var Wn=r(Ge);ae=n(Wn,"LI",{});var Go=r(ae);Lo=n(Go,"A",{href:!0});var Zc=r(Lo);Sr=l(Zc,"DeiTForImageClassification"),Zc.forEach(o),qr=l(Go," is supported by this "),Nt=n(Go,"A",{href:!0,rel:!0});var Uc=r(Nt);Qr=l(Uc,"example script"),Uc.forEach(o),Lr=l(Go," and "),xt=n(Go,"A",{href:!0,rel:!0});var Nc=r(xt);Hr=l(Nc,"notebook"),Nc.forEach(o),Or=l(Go,"."),Go.forEach(o),Kr=p(Wn),Ho=n(Wn,"LI",{});var gc=r(Ho);ei=l(gc,"See also: "),Oo=n(gc,"A",{href:!0});var xc=r(Oo);ti=l(xc,"Image classification task guide"),xc.forEach(o),gc.forEach(o),Wn.forEach(o),on=p(t),Ko=n(t,"P",{});var zc=r(Ko);oi=l(zc,"Besides that:"),zc.forEach(o),an=p(t),ea=n(t,"UL",{});var Gc=r(ea);Re=n(Gc,"LI",{});var Ps=r(Re);ta=n(Ps,"A",{href:!0});var Rc=r(ta);ai=l(Rc,"DeiTForMaskedImageModeling"),Rc.forEach(o),si=l(Ps," is supported by this "),zt=n(Ps,"A",{href:!0,rel:!0});var Bc=r(zt);ni=l(Bc,"example script"),Bc.forEach(o),ri=l(Ps,"."),Ps.forEach(o),Gc.forEach(o),sn=p(t),oa=n(t,"P",{});var Vc=r(oa);ii=l(Vc,"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."),Vc.forEach(o),nn=p(t),de=n(t,"H2",{class:!0});var Jn=r(de);Be=n(Jn,"A",{id:!0,class:!0,href:!0});var Pc=r(Be);Va=n(Pc,"SPAN",{});var Xc=r(Va);w(Gt.$$.fragment,Xc),Xc.forEach(o),Pc.forEach(o),li=p(Jn),Pa=n(Jn,"SPAN",{});var Yc=r(Pa);di=l(Yc,"DeiTConfig"),Yc.forEach(o),Jn.forEach(o),rn=p(t),N=n(t,"DIV",{class:!0});var Tt=r(N);w(Rt.$$.fragment,Tt),ci=p(Tt),ce=n(Tt,"P",{});var ua=r(ce);mi=l(ua,"This is the configuration class to store the configuration of a "),aa=n(ua,"A",{href:!0});var Ac=r(aa);hi=l(Ac,"DeiTModel"),Ac.forEach(o),pi=l(ua,`. It is used to instantiate an DeiT
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 DeiT
`),Bt=n(ua,"A",{href:!0,rel:!0});var Sc=r(Bt);fi=l(Sc,"facebook/deit-base-distilled-patch16-224"),Sc.forEach(o),ui=l(ua,`
architecture.`),ua.forEach(o),gi=p(Tt),me=n(Tt,"P",{});var ga=r(me);_i=l(ga,"Configuration objects inherit from "),sa=n(ga,"A",{href:!0});var qc=r(sa);Ti=l(qc,"PretrainedConfig"),qc.forEach(o),bi=l(ga,` and can be used to control the model outputs. Read the
documentation from `),na=n(ga,"A",{href:!0});var Qc=r(na);yi=l(Qc,"PretrainedConfig"),Qc.forEach(o),wi=l(ga," for more information."),ga.forEach(o),vi=p(Tt),w(Ve.$$.fragment,Tt),Tt.forEach(o),ln=p(t),he=n(t,"H2",{class:!0});var Cn=r(he);Pe=n(Cn,"A",{id:!0,class:!0,href:!0});var Lc=r(Pe);Xa=n(Lc,"SPAN",{});var Hc=r(Xa);w(Vt.$$.fragment,Hc),Hc.forEach(o),Lc.forEach(o),Mi=p(Cn),Ya=n(Cn,"SPAN",{});var Oc=r(Ya);$i=l(Oc,"DeiTFeatureExtractor"),Oc.forEach(o),Cn.forEach(o),dn=p(t),pe=n(t,"DIV",{class:!0});var En=r(pe);w(Pt.$$.fragment,En),Ii=p(En),Xe=n(En,"DIV",{class:!0});var Zn=r(Xe);w(Xt.$$.fragment,Zn),ki=p(Zn),Aa=n(Zn,"P",{});var Kc=r(Aa);Fi=l(Kc,"Preprocess an image or a batch of images."),Kc.forEach(o),Zn.forEach(o),En.forEach(o),cn=p(t),fe=n(t,"H2",{class:!0});var Un=r(fe);Ye=n(Un,"A",{id:!0,class:!0,href:!0});var em=r(Ye);Sa=n(em,"SPAN",{});var tm=r(Sa);w(Yt.$$.fragment,tm),tm.forEach(o),em.forEach(o),Di=p(Un),qa=n(Un,"SPAN",{});var om=r(qa);ji=l(om,"DeiTImageProcessor"),om.forEach(o),Un.forEach(o),mn=p(t),H=n(t,"DIV",{class:!0});var _a=r(H);w(At.$$.fragment,_a),Wi=p(_a),Qa=n(_a,"P",{});var am=r(Qa);Ji=l(am,"Constructs a DeiT image processor."),am.forEach(o),Ci=p(_a),Ae=n(_a,"DIV",{class:!0});var Nn=r(Ae);w(St.$$.fragment,Nn),Ei=p(Nn),La=n(Nn,"P",{});var sm=r(La);Zi=l(sm,"Preprocess an image or batch of images."),sm.forEach(o),Nn.forEach(o),_a.forEach(o),hn=p(t),ue=n(t,"H2",{class:!0});var xn=r(ue);Se=n(xn,"A",{id:!0,class:!0,href:!0});var nm=r(Se);Ha=n(nm,"SPAN",{});var rm=r(Ha);w(qt.$$.fragment,rm),rm.forEach(o),nm.forEach(o),Ui=p(xn),Oa=n(xn,"SPAN",{});var im=r(Oa);Ni=l(im,"DeiTModel"),im.forEach(o),xn.forEach(o),pn=p(t),O=n(t,"DIV",{class:!0});var Ta=r(O);w(Qt.$$.fragment,Ta),xi=p(Ta),Lt=n(Ta,"P",{});var zn=r(Lt);zi=l(zn,`The bare DeiT Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),Ht=n(zn,"A",{href:!0,rel:!0});var lm=r(Ht);Gi=l(lm,"torch.nn.Module"),lm.forEach(o),Ri=l(zn,` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),zn.forEach(o),Bi=p(Ta),B=n(Ta,"DIV",{class:!0});var bt=r(B);w(Ot.$$.fragment,bt),Vi=p(bt),ge=n(bt,"P",{});var ba=r(ge);Pi=l(ba,"The "),ra=n(ba,"A",{href:!0});var dm=r(ra);Xi=l(dm,"DeiTModel"),dm.forEach(o),Yi=l(ba," forward method, overrides the "),Ka=n(ba,"CODE",{});var cm=r(Ka);Ai=l(cm,"__call__"),cm.forEach(o),Si=l(ba," special method."),ba.forEach(o),qi=p(bt),w(qe.$$.fragment,bt),Qi=p(bt),w(Qe.$$.fragment,bt),bt.forEach(o),Ta.forEach(o),fn=p(t),_e=n(t,"H2",{class:!0});var Gn=r(_e);Le=n(Gn,"A",{id:!0,class:!0,href:!0});var mm=r(Le);es=n(mm,"SPAN",{});var hm=r(es);w(Kt.$$.fragment,hm),hm.forEach(o),mm.forEach(o),Li=p(Gn),ts=n(Gn,"SPAN",{});var pm=r(ts);Hi=l(pm,"DeiTForMaskedImageModeling"),pm.forEach(o),Gn.forEach(o),un=p(t),E=n(t,"DIV",{class:!0});var se=r(E);w(eo.$$.fragment,se),Oi=p(se),to=n(se,"P",{});var Rn=r(to);Ki=l(Rn,"DeiT Model with a decoder on top for masked image modeling, as proposed in "),oo=n(Rn,"A",{href:!0,rel:!0});var fm=r(oo);el=l(fm,"SimMIM"),fm.forEach(o),tl=l(Rn,"."),Rn.forEach(o),ol=p(se),w(He.$$.fragment,se),al=p(se),ao=n(se,"P",{});var Bn=r(ao);sl=l(Bn,"This model is a PyTorch "),so=n(Bn,"A",{href:!0,rel:!0});var um=r(so);nl=l(um,"torch.nn.Module"),um.forEach(o),rl=l(Bn,` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Bn.forEach(o),il=p(se),V=n(se,"DIV",{class:!0});var yt=r(V);w(no.$$.fragment,yt),ll=p(yt),Te=n(yt,"P",{});var ya=r(Te);dl=l(ya,"The "),ia=n(ya,"A",{href:!0});var gm=r(ia);cl=l(gm,"DeiTForMaskedImageModeling"),gm.forEach(o),ml=l(ya," forward method, overrides the "),os=n(ya,"CODE",{});var _m=r(os);hl=l(_m,"__call__"),_m.forEach(o),pl=l(ya," special method."),ya.forEach(o),fl=p(yt),w(Oe.$$.fragment,yt),ul=p(yt),w(Ke.$$.fragment,yt),yt.forEach(o),se.forEach(o),gn=p(t),be=n(t,"H2",{class:!0});var Vn=r(be);et=n(Vn,"A",{id:!0,class:!0,href:!0});var Tm=r(et);as=n(Tm,"SPAN",{});var bm=r(as);w(ro.$$.fragment,bm),bm.forEach(o),Tm.forEach(o),gl=p(Vn),ss=n(Vn,"SPAN",{});var ym=r(ss);_l=l(ym,"DeiTForImageClassification"),ym.forEach(o),Vn.forEach(o),_n=p(t),x=n(t,"DIV",{class:!0});var wt=r(x);w(io.$$.fragment,wt),Tl=p(wt),ns=n(wt,"P",{});var wm=r(ns);bl=l(wm,`DeiT 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.`),wm.forEach(o),yl=p(wt),lo=n(wt,"P",{});var Pn=r(lo);wl=l(Pn,"This model is a PyTorch "),co=n(Pn,"A",{href:!0,rel:!0});var vm=r(co);vl=l(vm,"torch.nn.Module"),vm.forEach(o),Ml=l(Pn,` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Pn.forEach(o),$l=p(wt),P=n(wt,"DIV",{class:!0});var vt=r(P);w(mo.$$.fragment,vt),Il=p(vt),ye=n(vt,"P",{});var wa=r(ye);kl=l(wa,"The "),la=n(wa,"A",{href:!0});var Mm=r(la);Fl=l(Mm,"DeiTForImageClassification"),Mm.forEach(o),Dl=l(wa," forward method, overrides the "),rs=n(wa,"CODE",{});var $m=r(rs);jl=l($m,"__call__"),$m.forEach(o),Wl=l(wa," special method."),wa.forEach(o),Jl=p(vt),w(tt.$$.fragment,vt),Cl=p(vt),w(ot.$$.fragment,vt),vt.forEach(o),wt.forEach(o),Tn=p(t),we=n(t,"H2",{class:!0});var Xn=r(we);at=n(Xn,"A",{id:!0,class:!0,href:!0});var Im=r(at);is=n(Im,"SPAN",{});var km=r(is);w(ho.$$.fragment,km),km.forEach(o),Im.forEach(o),El=p(Xn),ls=n(Xn,"SPAN",{});var Fm=r(ls);Zl=l(Fm,"DeiTForImageClassificationWithTeacher"),Fm.forEach(o),Xn.forEach(o),bn=p(t),W=n(t,"DIV",{class:!0});var Q=r(W);w(po.$$.fragment,Q),Ul=p(Q),ds=n(Q,"P",{});var Dm=r(ds);Nl=l(Dm,`DeiT Model transformer with image classification heads on top (a linear layer on top of the final hidden state of
the [CLS] token and a linear layer on top of the final hidden state of the distillation token) e.g. for ImageNet.`),Dm.forEach(o),xl=p(Q),cs=n(Q,"P",{});var jm=r(cs);zl=l(jm,".. warning::"),jm.forEach(o),Gl=p(Q),ms=n(Q,"P",{});var Wm=r(ms);Rl=l(Wm,`This model supports inference-only. Fine-tuning with distillation (i.e. with a teacher) is not yet
supported.`),Wm.forEach(o),Bl=p(Q),fo=n(Q,"P",{});var Yn=r(fo);Vl=l(Yn,"This model is a PyTorch "),uo=n(Yn,"A",{href:!0,rel:!0});var Jm=r(uo);Pl=l(Jm,"torch.nn.Module"),Jm.forEach(o),Xl=l(Yn,` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Yn.forEach(o),Yl=p(Q),X=n(Q,"DIV",{class:!0});var Mt=r(X);w(go.$$.fragment,Mt),Al=p(Mt),ve=n(Mt,"P",{});var va=r(ve);Sl=l(va,"The "),da=n(va,"A",{href:!0});var Cm=r(da);ql=l(Cm,"DeiTForImageClassificationWithTeacher"),Cm.forEach(o),Ql=l(va," forward method, overrides the "),hs=n(va,"CODE",{});var Em=r(hs);Ll=l(Em,"__call__"),Em.forEach(o),Hl=l(va," special method."),va.forEach(o),Ol=p(Mt),w(st.$$.fragment,Mt),Kl=p(Mt),w(nt.$$.fragment,Mt),Mt.forEach(o),Q.forEach(o),yn=p(t),Me=n(t,"H2",{class:!0});var An=r(Me);rt=n(An,"A",{id:!0,class:!0,href:!0});var Zm=r(rt);ps=n(Zm,"SPAN",{});var Um=r(ps);w(_o.$$.fragment,Um),Um.forEach(o),Zm.forEach(o),ed=p(An),fs=n(An,"SPAN",{});var Nm=r(fs);td=l(Nm,"TFDeiTModel"),Nm.forEach(o),An.forEach(o),wn=p(t),K=n(t,"DIV",{class:!0});var Ma=r(K);w(To.$$.fragment,Ma),od=p(Ma),bo=n(Ma,"P",{});var Sn=r(bo);ad=l(Sn,`The bare DeiT Model transformer outputting raw hidden-states without any specific head on top.
This model is a TensorFlow
`),yo=n(Sn,"A",{href:!0,rel:!0});var xm=r(yo);sd=l(xm,"tf.keras.layers.Layer"),xm.forEach(o),nd=l(Sn,`. Use it as a regular
TensorFlow Module and refer to the TensorFlow documentation for all matter related to general usage and behavior.`),Sn.forEach(o),rd=p(Ma),Y=n(Ma,"DIV",{class:!0});var $t=r(Y);w(wo.$$.fragment,$t),id=p($t),$e=n($t,"P",{});var $a=r($e);ld=l($a,"The "),ca=n($a,"A",{href:!0});var zm=r(ca);dd=l(zm,"TFDeiTModel"),zm.forEach(o),cd=l($a," forward method, overrides the "),us=n($a,"CODE",{});var Gm=r(us);md=l(Gm,"__call__"),Gm.forEach(o),hd=l($a," special method."),$a.forEach(o),pd=p($t),w(it.$$.fragment,$t),fd=p($t),w(lt.$$.fragment,$t),$t.forEach(o),Ma.forEach(o),vn=p(t),Ie=n(t,"H2",{class:!0});var qn=r(Ie);dt=n(qn,"A",{id:!0,class:!0,href:!0});var Rm=r(dt);gs=n(Rm,"SPAN",{});var Bm=r(gs);w(vo.$$.fragment,Bm),Bm.forEach(o),Rm.forEach(o),ud=p(qn),_s=n(qn,"SPAN",{});var Vm=r(_s);gd=l(Vm,"TFDeiTForMaskedImageModeling"),Vm.forEach(o),qn.forEach(o),Mn=p(t),ee=n(t,"DIV",{class:!0});var Ia=r(ee);w(Mo.$$.fragment,Ia),_d=p(Ia),ke=n(Ia,"P",{});var ka=r(ke);Td=l(ka,"DeiT Model with a decoder on top for masked image modeling, as proposed in "),$o=n(ka,"A",{href:!0,rel:!0});var Pm=r($o);bd=l(Pm,"SimMIM"),Pm.forEach(o),yd=l(ka,`.
This model is a TensorFlow
`),Io=n(ka,"A",{href:!0,rel:!0});var Xm=r(Io);wd=l(Xm,"tf.keras.layers.Layer"),Xm.forEach(o),vd=l(ka,`. Use it as a regular
TensorFlow Module and refer to the TensorFlow documentation for all matter related to general usage and behavior.`),ka.forEach(o),Md=p(Ia),A=n(Ia,"DIV",{class:!0});var It=r(A);w(ko.$$.fragment,It),$d=p(It),Fe=n(It,"P",{});var Fa=r(Fe);Id=l(Fa,"The "),ma=n(Fa,"A",{href:!0});var Ym=r(ma);kd=l(Ym,"TFDeiTForMaskedImageModeling"),Ym.forEach(o),Fd=l(Fa," forward method, overrides the "),Ts=n(Fa,"CODE",{});var Am=r(Ts);Dd=l(Am,"__call__"),Am.forEach(o),jd=l(Fa," special method."),Fa.forEach(o),Wd=p(It),w(ct.$$.fragment,It),Jd=p(It),w(mt.$$.fragment,It),It.forEach(o),Ia.forEach(o),$n=p(t),De=n(t,"H2",{class:!0});var Qn=r(De);ht=n(Qn,"A",{id:!0,class:!0,href:!0});var Sm=r(ht);bs=n(Sm,"SPAN",{});var qm=r(bs);w(Fo.$$.fragment,qm),qm.forEach(o),Sm.forEach(o),Cd=p(Qn),ys=n(Qn,"SPAN",{});var Qm=r(ys);Ed=l(Qm,"TFDeiTForImageClassification"),Qm.forEach(o),Qn.forEach(o),In=p(t),z=n(t,"DIV",{class:!0});var kt=r(z);w(Do.$$.fragment,kt),Zd=p(kt),ws=n(kt,"P",{});var Lm=r(ws);Ud=l(Lm,`DeiT 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.`),Lm.forEach(o),Nd=p(kt),jo=n(kt,"P",{});var Ln=r(jo);xd=l(Ln,`This model is a TensorFlow
`),Wo=n(Ln,"A",{href:!0,rel:!0});var Hm=r(Wo);zd=l(Hm,"tf.keras.layers.Layer"),Hm.forEach(o),Gd=l(Ln,`. Use it as a regular
TensorFlow Module and refer to the TensorFlow documentation for all matter related to general usage and behavior.`),Ln.forEach(o),Rd=p(kt),S=n(kt,"DIV",{class:!0});var Ft=r(S);w(Jo.$$.fragment,Ft),Bd=p(Ft),je=n(Ft,"P",{});var Da=r(je);Vd=l(Da,"The "),ha=n(Da,"A",{href:!0});var Om=r(ha);Pd=l(Om,"TFDeiTForImageClassification"),Om.forEach(o),Xd=l(Da," forward method, overrides the "),vs=n(Da,"CODE",{});var Km=r(vs);Yd=l(Km,"__call__"),Km.forEach(o),Ad=l(Da," special method."),Da.forEach(o),Sd=p(Ft),w(pt.$$.fragment,Ft),qd=p(Ft),w(ft.$$.fragment,Ft),Ft.forEach(o),kt.forEach(o),kn=p(t),We=n(t,"H2",{class:!0});var Hn=r(We);ut=n(Hn,"A",{id:!0,class:!0,href:!0});var eh=r(ut);Ms=n(eh,"SPAN",{});var th=r(Ms);w(Co.$$.fragment,th),th.forEach(o),eh.forEach(o),Qd=p(Hn),$s=n(Hn,"SPAN",{});var oh=r($s);Ld=l(oh,"TFDeiTForImageClassificationWithTeacher"),oh.forEach(o),Hn.forEach(o),Fn=p(t),J=n(t,"DIV",{class:!0});var L=r(J);w(Eo.$$.fragment,L),Hd=p(L),Is=n(L,"P",{});var ah=r(Is);Od=l(ah,`DeiT Model transformer with image classification heads on top (a linear layer on top of the final hidden state of
the [CLS] token and a linear layer on top of the final hidden state of the distillation token) e.g. for ImageNet.`),ah.forEach(o),Kd=p(L),ks=n(L,"P",{});var sh=r(ks);ec=l(sh,".. warning::"),sh.forEach(o),tc=p(L),Fs=n(L,"P",{});var nh=r(Fs);oc=l(nh,`This model supports inference-only. Fine-tuning with distillation (i.e. with a teacher) is not yet
supported.`),nh.forEach(o),ac=p(L),Zo=n(L,"P",{});var On=r(Zo);sc=l(On,`This model is a TensorFlow
`),Uo=n(On,"A",{href:!0,rel:!0});var rh=r(Uo);nc=l(rh,"tf.keras.layers.Layer"),rh.forEach(o),rc=l(On,`. Use it as a regular
TensorFlow Module and refer to the TensorFlow documentation for all matter related to general usage and behavior.`),On.forEach(o),ic=p(L),q=n(L,"DIV",{class:!0});var Dt=r(q);w(No.$$.fragment,Dt),lc=p(Dt),Je=n(Dt,"P",{});var ja=r(Je);dc=l(ja,"The "),pa=n(ja,"A",{href:!0});var ih=r(pa);cc=l(ih,"TFDeiTForImageClassificationWithTeacher"),ih.forEach(o),mc=l(ja," forward method, overrides the "),Ds=n(ja,"CODE",{});var lh=r(Ds);hc=l(lh,"__call__"),lh.forEach(o),pc=l(ja," special method."),ja.forEach(o),fc=p(Dt),w(gt.$$.fragment,Dt),uc=p(Dt),w(_t.$$.fragment,Dt),Dt.forEach(o),L.forEach(o),this.h()},h(){c(d,"name","hf:doc:metadata"),c(d,"content",JSON.stringify(Uh)),c(f,"id","deit"),c(f,"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"),c(f,"href","#deit"),c(u,"class","relative group"),c(xe,"id","overview"),c(xe,"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"),c(xe,"href","#overview"),c(re,"class","relative group"),c(Wt,"href","https://arxiv.org/abs/2012.12877"),c(Wt,"rel","nofollow"),c(Ro,"href","vit"),c(Jt,"href","https://arxiv.org/abs/2010.11929"),c(Jt,"rel","nofollow"),c(Xo,"href","/docs/transformers/main/en/model_doc/deit#transformers.DeiTForImageClassification"),c(Yo,"href","/docs/transformers/main/en/model_doc/deit#transformers.DeiTForImageClassificationWithTeacher"),c(Ao,"href","/docs/transformers/main/en/model_doc/vit#transformers.ViTModel"),c(So,"href","/docs/transformers/main/en/model_doc/vit#transformers.ViTForImageClassification"),c(qo,"href","/docs/transformers/main/en/model_doc/deit#transformers.DeiTImageProcessor"),c(Ct,"href","https://huggingface.co/nielsr"),c(Ct,"rel","nofollow"),c(Et,"href","https://huggingface.co/amyeroberts"),c(Et,"rel","nofollow"),c(ze,"id","resources"),c(ze,"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"),c(ze,"href","#resources"),c(le,"class","relative group"),c(Lo,"href","/docs/transformers/main/en/model_doc/deit#transformers.DeiTForImageClassification"),c(Nt,"href","https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-classification"),c(Nt,"rel","nofollow"),c(xt,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/image_classification.ipynb"),c(xt,"rel","nofollow"),c(Oo,"href","../tasks/image_classification"),c(ta,"href","/docs/transformers/main/en/model_doc/deit#transformers.DeiTForMaskedImageModeling"),c(zt,"href","https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-pretraining"),c(zt,"rel","nofollow"),c(Be,"id","transformers.DeiTConfig"),c(Be,"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"),c(Be,"href","#transformers.DeiTConfig"),c(de,"class","relative group"),c(aa,"href","/docs/transformers/main/en/model_doc/deit#transformers.DeiTModel"),c(Bt,"href","https://huggingface.co/facebook/deit-base-distilled-patch16-224"),c(Bt,"rel","nofollow"),c(sa,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),c(na,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),c(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Pe,"id","transformers.DeiTFeatureExtractor"),c(Pe,"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"),c(Pe,"href","#transformers.DeiTFeatureExtractor"),c(he,"class","relative group"),c(Xe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(pe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Ye,"id","transformers.DeiTImageProcessor"),c(Ye,"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"),c(Ye,"href","#transformers.DeiTImageProcessor"),c(fe,"class","relative group"),c(Ae,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(H,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Se,"id","transformers.DeiTModel"),c(Se,"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"),c(Se,"href","#transformers.DeiTModel"),c(ue,"class","relative group"),c(Ht,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(Ht,"rel","nofollow"),c(ra,"href","/docs/transformers/main/en/model_doc/deit#transformers.DeiTModel"),c(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(O,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Le,"id","transformers.DeiTForMaskedImageModeling"),c(Le,"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"),c(Le,"href","#transformers.DeiTForMaskedImageModeling"),c(_e,"class","relative group"),c(oo,"href","https://arxiv.org/abs/2111.09886"),c(oo,"rel","nofollow"),c(so,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(so,"rel","nofollow"),c(ia,"href","/docs/transformers/main/en/model_doc/deit#transformers.DeiTForMaskedImageModeling"),c(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(E,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(et,"id","transformers.DeiTForImageClassification"),c(et,"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"),c(et,"href","#transformers.DeiTForImageClassification"),c(be,"class","relative group"),c(co,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(co,"rel","nofollow"),c(la,"href","/docs/transformers/main/en/model_doc/deit#transformers.DeiTForImageClassification"),c(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(at,"id","transformers.DeiTForImageClassificationWithTeacher"),c(at,"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"),c(at,"href","#transformers.DeiTForImageClassificationWithTeacher"),c(we,"class","relative group"),c(uo,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(uo,"rel","nofollow"),c(da,"href","/docs/transformers/main/en/model_doc/deit#transformers.DeiTForImageClassificationWithTeacher"),c(X,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(rt,"id","transformers.TFDeiTModel"),c(rt,"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"),c(rt,"href","#transformers.TFDeiTModel"),c(Me,"class","relative group"),c(yo,"href","https://www.tensorflow.org/api_docs/python/tf/keras/layers/Layer"),c(yo,"rel","nofollow"),c(ca,"href","/docs/transformers/main/en/model_doc/deit#transformers.TFDeiTModel"),c(Y,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(K,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(dt,"id","transformers.TFDeiTForMaskedImageModeling"),c(dt,"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"),c(dt,"href","#transformers.TFDeiTForMaskedImageModeling"),c(Ie,"class","relative group"),c($o,"href","https://arxiv.org/abs/2111.09886"),c($o,"rel","nofollow"),c(Io,"href","https://www.tensorflow.org/api_docs/python/tf/keras/layers/Layer"),c(Io,"rel","nofollow"),c(ma,"href","/docs/transformers/main/en/model_doc/deit#transformers.TFDeiTForMaskedImageModeling"),c(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(ee,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(ht,"id","transformers.TFDeiTForImageClassification"),c(ht,"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"),c(ht,"href","#transformers.TFDeiTForImageClassification"),c(De,"class","relative group"),c(Wo,"href","https://www.tensorflow.org/api_docs/python/tf/keras/layers/Layer"),c(Wo,"rel","nofollow"),c(ha,"href","/docs/transformers/main/en/model_doc/deit#transformers.TFDeiTForImageClassification"),c(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(ut,"id","transformers.TFDeiTForImageClassificationWithTeacher"),c(ut,"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"),c(ut,"href","#transformers.TFDeiTForImageClassificationWithTeacher"),c(We,"class","relative group"),c(Uo,"href","https://www.tensorflow.org/api_docs/python/tf/keras/layers/Layer"),c(Uo,"rel","nofollow"),c(pa,"href","/docs/transformers/main/en/model_doc/deit#transformers.TFDeiTForImageClassificationWithTeacher"),c(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(t,g){e(document.head,d),_(t,b,g),_(t,u,g),e(u,f),e(f,T),v(a,T,null),e(u,m),e(u,F),e(F,Kn),_(t,Xs,g),v(Ne,t,g),_(t,Ys,g),_(t,re,g),e(re,xe),e(xe,Wa),v(jt,Wa,null),e(re,er),e(re,Ja),e(Ja,tr),_(t,As,g),_(t,R,g),e(R,or),e(R,Wt),e(Wt,ar),e(R,sr),e(R,Ro),e(Ro,nr),e(R,rr),e(R,Jt),e(Jt,ir),e(R,lr),_(t,Ss,g),_(t,Bo,g),e(Bo,dr),_(t,qs,g),_(t,Vo,g),e(Vo,Ca),e(Ca,cr),_(t,Qs,g),_(t,Po,g),e(Po,mr),_(t,Ls,g),_(t,Z,g),e(Z,Ea),e(Ea,hr),e(Z,pr),e(Z,ie),e(ie,fr),e(ie,Xo),e(Xo,ur),e(ie,gr),e(ie,Yo),e(Yo,_r),e(ie,Tr),e(Z,br),e(Z,Za),e(Za,yr),e(Z,wr),e(Z,Ua),e(Ua,vr),e(Z,Mr),e(Z,j),e(j,$r),e(j,Ao),e(Ao,Ir),e(j,kr),e(j,So),e(So,Fr),e(j,Dr),e(j,Na),e(Na,jr),e(j,Wr),e(j,xa),e(xa,Jr),e(j,Cr),e(j,za),e(za,Er),e(j,Zr),e(j,Ga),e(Ga,Ur),e(j,Nr),e(j,qo),e(qo,xr),e(j,zr),_(t,Hs,g),_(t,oe,g),e(oe,Gr),e(oe,Ct),e(Ct,Rr),e(oe,Br),e(oe,Et),e(Et,Vr),e(oe,Pr),_(t,Os,g),_(t,le,g),e(le,ze),e(ze,Ra),v(Zt,Ra,null),e(le,Xr),e(le,Ba),e(Ba,Yr),_(t,Ks,g),_(t,Qo,g),e(Qo,Ar),_(t,en,g),v(Ut,t,g),_(t,tn,g),_(t,Ge,g),e(Ge,ae),e(ae,Lo),e(Lo,Sr),e(ae,qr),e(ae,Nt),e(Nt,Qr),e(ae,Lr),e(ae,xt),e(xt,Hr),e(ae,Or),e(Ge,Kr),e(Ge,Ho),e(Ho,ei),e(Ho,Oo),e(Oo,ti),_(t,on,g),_(t,Ko,g),e(Ko,oi),_(t,an,g),_(t,ea,g),e(ea,Re),e(Re,ta),e(ta,ai),e(Re,si),e(Re,zt),e(zt,ni),e(Re,ri),_(t,sn,g),_(t,oa,g),e(oa,ii),_(t,nn,g),_(t,de,g),e(de,Be),e(Be,Va),v(Gt,Va,null),e(de,li),e(de,Pa),e(Pa,di),_(t,rn,g),_(t,N,g),v(Rt,N,null),e(N,ci),e(N,ce),e(ce,mi),e(ce,aa),e(aa,hi),e(ce,pi),e(ce,Bt),e(Bt,fi),e(ce,ui),e(N,gi),e(N,me),e(me,_i),e(me,sa),e(sa,Ti),e(me,bi),e(me,na),e(na,yi),e(me,wi),e(N,vi),v(Ve,N,null),_(t,ln,g),_(t,he,g),e(he,Pe),e(Pe,Xa),v(Vt,Xa,null),e(he,Mi),e(he,Ya),e(Ya,$i),_(t,dn,g),_(t,pe,g),v(Pt,pe,null),e(pe,Ii),e(pe,Xe),v(Xt,Xe,null),e(Xe,ki),e(Xe,Aa),e(Aa,Fi),_(t,cn,g),_(t,fe,g),e(fe,Ye),e(Ye,Sa),v(Yt,Sa,null),e(fe,Di),e(fe,qa),e(qa,ji),_(t,mn,g),_(t,H,g),v(At,H,null),e(H,Wi),e(H,Qa),e(Qa,Ji),e(H,Ci),e(H,Ae),v(St,Ae,null),e(Ae,Ei),e(Ae,La),e(La,Zi),_(t,hn,g),_(t,ue,g),e(ue,Se),e(Se,Ha),v(qt,Ha,null),e(ue,Ui),e(ue,Oa),e(Oa,Ni),_(t,pn,g),_(t,O,g),v(Qt,O,null),e(O,xi),e(O,Lt),e(Lt,zi),e(Lt,Ht),e(Ht,Gi),e(Lt,Ri),e(O,Bi),e(O,B),v(Ot,B,null),e(B,Vi),e(B,ge),e(ge,Pi),e(ge,ra),e(ra,Xi),e(ge,Yi),e(ge,Ka),e(Ka,Ai),e(ge,Si),e(B,qi),v(qe,B,null),e(B,Qi),v(Qe,B,null),_(t,fn,g),_(t,_e,g),e(_e,Le),e(Le,es),v(Kt,es,null),e(_e,Li),e(_e,ts),e(ts,Hi),_(t,un,g),_(t,E,g),v(eo,E,null),e(E,Oi),e(E,to),e(to,Ki),e(to,oo),e(oo,el),e(to,tl),e(E,ol),v(He,E,null),e(E,al),e(E,ao),e(ao,sl),e(ao,so),e(so,nl),e(ao,rl),e(E,il),e(E,V),v(no,V,null),e(V,ll),e(V,Te),e(Te,dl),e(Te,ia),e(ia,cl),e(Te,ml),e(Te,os),e(os,hl),e(Te,pl),e(V,fl),v(Oe,V,null),e(V,ul),v(Ke,V,null),_(t,gn,g),_(t,be,g),e(be,et),e(et,as),v(ro,as,null),e(be,gl),e(be,ss),e(ss,_l),_(t,_n,g),_(t,x,g),v(io,x,null),e(x,Tl),e(x,ns),e(ns,bl),e(x,yl),e(x,lo),e(lo,wl),e(lo,co),e(co,vl),e(lo,Ml),e(x,$l),e(x,P),v(mo,P,null),e(P,Il),e(P,ye),e(ye,kl),e(ye,la),e(la,Fl),e(ye,Dl),e(ye,rs),e(rs,jl),e(ye,Wl),e(P,Jl),v(tt,P,null),e(P,Cl),v(ot,P,null),_(t,Tn,g),_(t,we,g),e(we,at),e(at,is),v(ho,is,null),e(we,El),e(we,ls),e(ls,Zl),_(t,bn,g),_(t,W,g),v(po,W,null),e(W,Ul),e(W,ds),e(ds,Nl),e(W,xl),e(W,cs),e(cs,zl),e(W,Gl),e(W,ms),e(ms,Rl),e(W,Bl),e(W,fo),e(fo,Vl),e(fo,uo),e(uo,Pl),e(fo,Xl),e(W,Yl),e(W,X),v(go,X,null),e(X,Al),e(X,ve),e(ve,Sl),e(ve,da),e(da,ql),e(ve,Ql),e(ve,hs),e(hs,Ll),e(ve,Hl),e(X,Ol),v(st,X,null),e(X,Kl),v(nt,X,null),_(t,yn,g),_(t,Me,g),e(Me,rt),e(rt,ps),v(_o,ps,null),e(Me,ed),e(Me,fs),e(fs,td),_(t,wn,g),_(t,K,g),v(To,K,null),e(K,od),e(K,bo),e(bo,ad),e(bo,yo),e(yo,sd),e(bo,nd),e(K,rd),e(K,Y),v(wo,Y,null),e(Y,id),e(Y,$e),e($e,ld),e($e,ca),e(ca,dd),e($e,cd),e($e,us),e(us,md),e($e,hd),e(Y,pd),v(it,Y,null),e(Y,fd),v(lt,Y,null),_(t,vn,g),_(t,Ie,g),e(Ie,dt),e(dt,gs),v(vo,gs,null),e(Ie,ud),e(Ie,_s),e(_s,gd),_(t,Mn,g),_(t,ee,g),v(Mo,ee,null),e(ee,_d),e(ee,ke),e(ke,Td),e(ke,$o),e($o,bd),e(ke,yd),e(ke,Io),e(Io,wd),e(ke,vd),e(ee,Md),e(ee,A),v(ko,A,null),e(A,$d),e(A,Fe),e(Fe,Id),e(Fe,ma),e(ma,kd),e(Fe,Fd),e(Fe,Ts),e(Ts,Dd),e(Fe,jd),e(A,Wd),v(ct,A,null),e(A,Jd),v(mt,A,null),_(t,$n,g),_(t,De,g),e(De,ht),e(ht,bs),v(Fo,bs,null),e(De,Cd),e(De,ys),e(ys,Ed),_(t,In,g),_(t,z,g),v(Do,z,null),e(z,Zd),e(z,ws),e(ws,Ud),e(z,Nd),e(z,jo),e(jo,xd),e(jo,Wo),e(Wo,zd),e(jo,Gd),e(z,Rd),e(z,S),v(Jo,S,null),e(S,Bd),e(S,je),e(je,Vd),e(je,ha),e(ha,Pd),e(je,Xd),e(je,vs),e(vs,Yd),e(je,Ad),e(S,Sd),v(pt,S,null),e(S,qd),v(ft,S,null),_(t,kn,g),_(t,We,g),e(We,ut),e(ut,Ms),v(Co,Ms,null),e(We,Qd),e(We,$s),e($s,Ld),_(t,Fn,g),_(t,J,g),v(Eo,J,null),e(J,Hd),e(J,Is),e(Is,Od),e(J,Kd),e(J,ks),e(ks,ec),e(J,tc),e(J,Fs),e(Fs,oc),e(J,ac),e(J,Zo),e(Zo,sc),e(Zo,Uo),e(Uo,nc),e(Zo,rc),e(J,ic),e(J,q),v(No,q,null),e(q,lc),e(q,Je),e(Je,dc),e(Je,pa),e(pa,cc),e(Je,mc),e(Je,Ds),e(Ds,hc),e(Je,pc),e(q,fc),v(gt,q,null),e(q,uc),v(_t,q,null),Dn=!0},p(t,[g]){const xo={};g&2&&(xo.$$scope={dirty:g,ctx:t}),Ne.$set(xo);const js={};g&2&&(js.$$scope={dirty:g,ctx:t}),Ve.$set(js);const Ws={};g&2&&(Ws.$$scope={dirty:g,ctx:t}),qe.$set(Ws);const Js={};g&2&&(Js.$$scope={dirty:g,ctx:t}),Qe.$set(Js);const zo={};g&2&&(zo.$$scope={dirty:g,ctx:t}),He.$set(zo);const Cs={};g&2&&(Cs.$$scope={dirty:g,ctx:t}),Oe.$set(Cs);const Es={};g&2&&(Es.$$scope={dirty:g,ctx:t}),Ke.$set(Es);const Zs={};g&2&&(Zs.$$scope={dirty:g,ctx:t}),tt.$set(Zs);const te={};g&2&&(te.$$scope={dirty:g,ctx:t}),ot.$set(te);const Us={};g&2&&(Us.$$scope={dirty:g,ctx:t}),st.$set(Us);const Ns={};g&2&&(Ns.$$scope={dirty:g,ctx:t}),nt.$set(Ns);const xs={};g&2&&(xs.$$scope={dirty:g,ctx:t}),it.$set(xs);const zs={};g&2&&(zs.$$scope={dirty:g,ctx:t}),lt.$set(zs);const Gs={};g&2&&(Gs.$$scope={dirty:g,ctx:t}),ct.$set(Gs);const Rs={};g&2&&(Rs.$$scope={dirty:g,ctx:t}),mt.$set(Rs);const Bs={};g&2&&(Bs.$$scope={dirty:g,ctx:t}),pt.$set(Bs);const G={};g&2&&(G.$$scope={dirty:g,ctx:t}),ft.$set(G);const Vs={};g&2&&(Vs.$$scope={dirty:g,ctx:t}),gt.$set(Vs);const Ce={};g&2&&(Ce.$$scope={dirty:g,ctx:t}),_t.$set(Ce)},i(t){Dn||(M(a.$$.fragment,t),M(Ne.$$.fragment,t),M(jt.$$.fragment,t),M(Zt.$$.fragment,t),M(Ut.$$.fragment,t),M(Gt.$$.fragment,t),M(Rt.$$.fragment,t),M(Ve.$$.fragment,t),M(Vt.$$.fragment,t),M(Pt.$$.fragment,t),M(Xt.$$.fragment,t),M(Yt.$$.fragment,t),M(At.$$.fragment,t),M(St.$$.fragment,t),M(qt.$$.fragment,t),M(Qt.$$.fragment,t),M(Ot.$$.fragment,t),M(qe.$$.fragment,t),M(Qe.$$.fragment,t),M(Kt.$$.fragment,t),M(eo.$$.fragment,t),M(He.$$.fragment,t),M(no.$$.fragment,t),M(Oe.$$.fragment,t),M(Ke.$$.fragment,t),M(ro.$$.fragment,t),M(io.$$.fragment,t),M(mo.$$.fragment,t),M(tt.$$.fragment,t),M(ot.$$.fragment,t),M(ho.$$.fragment,t),M(po.$$.fragment,t),M(go.$$.fragment,t),M(st.$$.fragment,t),M(nt.$$.fragment,t),M(_o.$$.fragment,t),M(To.$$.fragment,t),M(wo.$$.fragment,t),M(it.$$.fragment,t),M(lt.$$.fragment,t),M(vo.$$.fragment,t),M(Mo.$$.fragment,t),M(ko.$$.fragment,t),M(ct.$$.fragment,t),M(mt.$$.fragment,t),M(Fo.$$.fragment,t),M(Do.$$.fragment,t),M(Jo.$$.fragment,t),M(pt.$$.fragment,t),M(ft.$$.fragment,t),M(Co.$$.fragment,t),M(Eo.$$.fragment,t),M(No.$$.fragment,t),M(gt.$$.fragment,t),M(_t.$$.fragment,t),Dn=!0)},o(t){$(a.$$.fragment,t),$(Ne.$$.fragment,t),$(jt.$$.fragment,t),$(Zt.$$.fragment,t),$(Ut.$$.fragment,t),$(Gt.$$.fragment,t),$(Rt.$$.fragment,t),$(Ve.$$.fragment,t),$(Vt.$$.fragment,t),$(Pt.$$.fragment,t),$(Xt.$$.fragment,t),$(Yt.$$.fragment,t),$(At.$$.fragment,t),$(St.$$.fragment,t),$(qt.$$.fragment,t),$(Qt.$$.fragment,t),$(Ot.$$.fragment,t),$(qe.$$.fragment,t),$(Qe.$$.fragment,t),$(Kt.$$.fragment,t),$(eo.$$.fragment,t),$(He.$$.fragment,t),$(no.$$.fragment,t),$(Oe.$$.fragment,t),$(Ke.$$.fragment,t),$(ro.$$.fragment,t),$(io.$$.fragment,t),$(mo.$$.fragment,t),$(tt.$$.fragment,t),$(ot.$$.fragment,t),$(ho.$$.fragment,t),$(po.$$.fragment,t),$(go.$$.fragment,t),$(st.$$.fragment,t),$(nt.$$.fragment,t),$(_o.$$.fragment,t),$(To.$$.fragment,t),$(wo.$$.fragment,t),$(it.$$.fragment,t),$(lt.$$.fragment,t),$(vo.$$.fragment,t),$(Mo.$$.fragment,t),$(ko.$$.fragment,t),$(ct.$$.fragment,t),$(mt.$$.fragment,t),$(Fo.$$.fragment,t),$(Do.$$.fragment,t),$(Jo.$$.fragment,t),$(pt.$$.fragment,t),$(ft.$$.fragment,t),$(Co.$$.fragment,t),$(Eo.$$.fragment,t),$(No.$$.fragment,t),$(gt.$$.fragment,t),$(_t.$$.fragment,t),Dn=!1},d(t){o(d),t&&o(b),t&&o(u),I(a),t&&o(Xs),I(Ne,t),t&&o(Ys),t&&o(re),I(jt),t&&o(As),t&&o(R),t&&o(Ss),t&&o(Bo),t&&o(qs),t&&o(Vo),t&&o(Qs),t&&o(Po),t&&o(Ls),t&&o(Z),t&&o(Hs),t&&o(oe),t&&o(Os),t&&o(le),I(Zt),t&&o(Ks),t&&o(Qo),t&&o(en),I(Ut,t),t&&o(tn),t&&o(Ge),t&&o(on),t&&o(Ko),t&&o(an),t&&o(ea),t&&o(sn),t&&o(oa),t&&o(nn),t&&o(de),I(Gt),t&&o(rn),t&&o(N),I(Rt),I(Ve),t&&o(ln),t&&o(he),I(Vt),t&&o(dn),t&&o(pe),I(Pt),I(Xt),t&&o(cn),t&&o(fe),I(Yt),t&&o(mn),t&&o(H),I(At),I(St),t&&o(hn),t&&o(ue),I(qt),t&&o(pn),t&&o(O),I(Qt),I(Ot),I(qe),I(Qe),t&&o(fn),t&&o(_e),I(Kt),t&&o(un),t&&o(E),I(eo),I(He),I(no),I(Oe),I(Ke),t&&o(gn),t&&o(be),I(ro),t&&o(_n),t&&o(x),I(io),I(mo),I(tt),I(ot),t&&o(Tn),t&&o(we),I(ho),t&&o(bn),t&&o(W),I(po),I(go),I(st),I(nt),t&&o(yn),t&&o(Me),I(_o),t&&o(wn),t&&o(K),I(To),I(wo),I(it),I(lt),t&&o(vn),t&&o(Ie),I(vo),t&&o(Mn),t&&o(ee),I(Mo),I(ko),I(ct),I(mt),t&&o($n),t&&o(De),I(Fo),t&&o(In),t&&o(z),I(Do),I(Jo),I(pt),I(ft),t&&o(kn),t&&o(We),I(Co),t&&o(Fn),t&&o(J),I(Eo),I(No),I(gt),I(_t)}}}const Uh={local:"deit",sections:[{local:"overview",title:"Overview"},{local:"resources",title:"Resources"},{local:"transformers.DeiTConfig",title:"DeiTConfig"},{local:"transformers.DeiTFeatureExtractor",title:"DeiTFeatureExtractor"},{local:"transformers.DeiTImageProcessor",title:"DeiTImageProcessor"},{local:"transformers.DeiTModel",title:"DeiTModel"},{local:"transformers.DeiTForMaskedImageModeling",title:"DeiTForMaskedImageModeling"},{local:"transformers.DeiTForImageClassification",title:"DeiTForImageClassification"},{local:"transformers.DeiTForImageClassificationWithTeacher",title:"DeiTForImageClassificationWithTeacher"},{local:"transformers.TFDeiTModel",title:"TFDeiTModel"},{local:"transformers.TFDeiTForMaskedImageModeling",title:"TFDeiTForMaskedImageModeling"},{local:"transformers.TFDeiTForImageClassification",title:"TFDeiTForImageClassification"},{local:"transformers.TFDeiTForImageClassificationWithTeacher",title:"TFDeiTForImageClassificationWithTeacher"}],title:"DeiT"};function Nh(k){return ph(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Xh extends dh{constructor(d){super();ch(this,d,Nh,Zh,mh,{})}}export{Xh as default,Uh as metadata};
