import{S as dm,i as cm,s as hm,e as a,k as m,w as y,t as i,M as mm,c as n,d as o,m as p,a as r,x as v,h as l,b as c,G as e,g as _,y as w,q as M,o as $,B as I,v as pm,L as Ze}from"../../chunks/vendor-hf-doc-builder.js";import{T as ne}from"../../chunks/Tip-hf-doc-builder.js";import{D as j}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 Ce}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";import{P as fm}from"../../chunks/PipelineTag-hf-doc-builder.js";function gm(k){let d,b,g,f,T;return{c(){d=a("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 `),g=a("a"),f=i("Github Issue"),T=i("."),this.h()},l(s){d=n(s,"P",{});var h=r(d);b=l(h,`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 `),g=n(h,"A",{href:!0,rel:!0});var F=r(g);f=l(F,"Github Issue"),F.forEach(o),T=l(h,"."),h.forEach(o),this.h()},h(){c(g,"href","https://github.com/huggingface/transformers/issues/new?assignees=&labels=&template=bug-report.md&title"),c(g,"rel","nofollow")},m(s,h){_(s,d,h),e(d,b),e(d,g),e(g,f),e(d,T)},d(s){s&&o(d)}}}function um(k){let d,b,g,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=a("p"),b=i("Example:"),g=m(),y(f.$$.fragment)},l(s){d=n(s,"P",{});var h=r(d);b=l(h,"Example:"),h.forEach(o),g=p(s),v(f.$$.fragment,s)},m(s,h){_(s,d,h),e(d,b),_(s,g,h),w(f,s,h),T=!0},p:Ze,i(s){T||(M(f.$$.fragment,s),T=!0)},o(s){$(f.$$.fragment,s),T=!1},d(s){s&&o(d),s&&o(g),I(f,s)}}}function _m(k){let d,b,g,f,T;return{c(){d=a("p"),b=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=a("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(s){d=n(s,"P",{});var h=r(d);b=l(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=n(h,"CODE",{});var F=r(g);f=l(F,"Module"),F.forEach(o),T=l(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(o)},m(s,h){_(s,d,h),e(d,b),e(d,g),e(g,f),e(d,T)},d(s){s&&o(d)}}}function Tm(k){let d,b,g,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=a("p"),b=i("Example:"),g=m(),y(f.$$.fragment)},l(s){d=n(s,"P",{});var h=r(d);b=l(h,"Example:"),h.forEach(o),g=p(s),v(f.$$.fragment,s)},m(s,h){_(s,d,h),e(d,b),_(s,g,h),w(f,s,h),T=!0},p:Ze,i(s){T||(M(f.$$.fragment,s),T=!0)},o(s){$(f.$$.fragment,s),T=!1},d(s){s&&o(d),s&&o(g),I(f,s)}}}function bm(k){let d,b,g,f,T;return{c(){d=a("p"),b=i("Note that we provide a script to pre-train this model on custom data in our "),g=a("a"),f=i(`examples
directory`),T=i("."),this.h()},l(s){d=n(s,"P",{});var h=r(d);b=l(h,"Note that we provide a script to pre-train this model on custom data in our "),g=n(h,"A",{href:!0,rel:!0});var F=r(g);f=l(F,`examples
directory`),F.forEach(o),T=l(h,"."),h.forEach(o),this.h()},h(){c(g,"href","https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-pretraining"),c(g,"rel","nofollow")},m(s,h){_(s,d,h),e(d,b),e(d,g),e(g,f),e(d,T)},d(s){s&&o(d)}}}function ym(k){let d,b,g,f,T;return{c(){d=a("p"),b=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=a("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(s){d=n(s,"P",{});var h=r(d);b=l(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=n(h,"CODE",{});var F=r(g);f=l(F,"Module"),F.forEach(o),T=l(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(o)},m(s,h){_(s,d,h),e(d,b),e(d,g),e(g,f),e(d,T)},d(s){s&&o(d)}}}function vm(k){let d,b,g,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=a("p"),b=i("Examples:"),g=m(),y(f.$$.fragment)},l(s){d=n(s,"P",{});var h=r(d);b=l(h,"Examples:"),h.forEach(o),g=p(s),v(f.$$.fragment,s)},m(s,h){_(s,d,h),e(d,b),_(s,g,h),w(f,s,h),T=!0},p:Ze,i(s){T||(M(f.$$.fragment,s),T=!0)},o(s){$(f.$$.fragment,s),T=!1},d(s){s&&o(d),s&&o(g),I(f,s)}}}function wm(k){let d,b,g,f,T;return{c(){d=a("p"),b=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=a("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(s){d=n(s,"P",{});var h=r(d);b=l(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=n(h,"CODE",{});var F=r(g);f=l(F,"Module"),F.forEach(o),T=l(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(o)},m(s,h){_(s,d,h),e(d,b),e(d,g),e(g,f),e(d,T)},d(s){s&&o(d)}}}function Mm(k){let d,b,g,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=a("p"),b=i("Examples:"),g=m(),y(f.$$.fragment)},l(s){d=n(s,"P",{});var h=r(d);b=l(h,"Examples:"),h.forEach(o),g=p(s),v(f.$$.fragment,s)},m(s,h){_(s,d,h),e(d,b),_(s,g,h),w(f,s,h),T=!0},p:Ze,i(s){T||(M(f.$$.fragment,s),T=!0)},o(s){$(f.$$.fragment,s),T=!1},d(s){s&&o(d),s&&o(g),I(f,s)}}}function $m(k){let d,b,g,f,T;return{c(){d=a("p"),b=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=a("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(s){d=n(s,"P",{});var h=r(d);b=l(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=n(h,"CODE",{});var F=r(g);f=l(F,"Module"),F.forEach(o),T=l(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(o)},m(s,h){_(s,d,h),e(d,b),e(d,g),e(g,f),e(d,T)},d(s){s&&o(d)}}}function Im(k){let d,b,g,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=a("p"),b=i("Example:"),g=m(),y(f.$$.fragment)},l(s){d=n(s,"P",{});var h=r(d);b=l(h,"Example:"),h.forEach(o),g=p(s),v(f.$$.fragment,s)},m(s,h){_(s,d,h),e(d,b),_(s,g,h),w(f,s,h),T=!0},p:Ze,i(s){T||(M(f.$$.fragment,s),T=!0)},o(s){$(f.$$.fragment,s),T=!1},d(s){s&&o(d),s&&o(g),I(f,s)}}}function km(k){let d,b,g,f,T;return{c(){d=a("p"),b=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=a("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(s){d=n(s,"P",{});var h=r(d);b=l(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=n(h,"CODE",{});var F=r(g);f=l(F,"Module"),F.forEach(o),T=l(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(o)},m(s,h){_(s,d,h),e(d,b),e(d,g),e(g,f),e(d,T)},d(s){s&&o(d)}}}function Fm(k){let d,b,g,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=a("p"),b=i("Example:"),g=m(),y(f.$$.fragment)},l(s){d=n(s,"P",{});var h=r(d);b=l(h,"Example:"),h.forEach(o),g=p(s),v(f.$$.fragment,s)},m(s,h){_(s,d,h),e(d,b),_(s,g,h),w(f,s,h),T=!0},p:Ze,i(s){T||(M(f.$$.fragment,s),T=!0)},o(s){$(f.$$.fragment,s),T=!1},d(s){s&&o(d),s&&o(g),I(f,s)}}}function jm(k){let d,b,g,f,T;return{c(){d=a("p"),b=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=a("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(s){d=n(s,"P",{});var h=r(d);b=l(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=n(h,"CODE",{});var F=r(g);f=l(F,"Module"),F.forEach(o),T=l(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(o)},m(s,h){_(s,d,h),e(d,b),e(d,g),e(g,f),e(d,T)},d(s){s&&o(d)}}}function Dm(k){let d,b,g,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=a("p"),b=i("Examples:"),g=m(),y(f.$$.fragment)},l(s){d=n(s,"P",{});var h=r(d);b=l(h,"Examples:"),h.forEach(o),g=p(s),v(f.$$.fragment,s)},m(s,h){_(s,d,h),e(d,b),_(s,g,h),w(f,s,h),T=!0},p:Ze,i(s){T||(M(f.$$.fragment,s),T=!0)},o(s){$(f.$$.fragment,s),T=!1},d(s){s&&o(d),s&&o(g),I(f,s)}}}function Wm(k){let d,b,g,f,T;return{c(){d=a("p"),b=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=a("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(s){d=n(s,"P",{});var h=r(d);b=l(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=n(h,"CODE",{});var F=r(g);f=l(F,"Module"),F.forEach(o),T=l(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(o)},m(s,h){_(s,d,h),e(d,b),e(d,g),e(g,f),e(d,T)},d(s){s&&o(d)}}}function Jm(k){let d,b,g,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=a("p"),b=i("Examples:"),g=m(),y(f.$$.fragment)},l(s){d=n(s,"P",{});var h=r(d);b=l(h,"Examples:"),h.forEach(o),g=p(s),v(f.$$.fragment,s)},m(s,h){_(s,d,h),e(d,b),_(s,g,h),w(f,s,h),T=!0},p:Ze,i(s){T||(M(f.$$.fragment,s),T=!0)},o(s){$(f.$$.fragment,s),T=!1},d(s){s&&o(d),s&&o(g),I(f,s)}}}function Em(k){let d,b,g,f,T;return{c(){d=a("p"),b=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=a("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(s){d=n(s,"P",{});var h=r(d);b=l(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=n(h,"CODE",{});var F=r(g);f=l(F,"Module"),F.forEach(o),T=l(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(o)},m(s,h){_(s,d,h),e(d,b),e(d,g),e(g,f),e(d,T)},d(s){s&&o(d)}}}function Cm(k){let d,b,g,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=a("p"),b=i("Example:"),g=m(),y(f.$$.fragment)},l(s){d=n(s,"P",{});var h=r(d);b=l(h,"Example:"),h.forEach(o),g=p(s),v(f.$$.fragment,s)},m(s,h){_(s,d,h),e(d,b),_(s,g,h),w(f,s,h),T=!0},p:Ze,i(s){T||(M(f.$$.fragment,s),T=!0)},o(s){$(f.$$.fragment,s),T=!1},d(s){s&&o(d),s&&o(g),I(f,s)}}}function Zm(k){let d,b,g,f,T,s,h,F,Kn,Xa,Ne,Ya,re,xe,Ws,Dt,er,Js,tr,Aa,R,or,Wt,sr,ar,Ro,nr,rr,Jt,ir,lr,Sa,Bo,dr,qa,Vo,Es,cr,Qa,Po,hr,La,Z,Cs,mr,pr,ie,fr,Xo,gr,ur,Yo,_r,Tr,br,Zs,yr,vr,Us,wr,Mr,D,$r,Ao,Ir,kr,So,Fr,jr,Ns,Dr,Wr,xs,Jr,Er,zs,Cr,Zr,Gs,Ur,Nr,qo,xr,zr,Ha,oe,Gr,Et,Rr,Br,Ct,Vr,Pr,Oa,le,ze,Rs,Zt,Xr,Bs,Yr,Ka,Qo,Ar,en,Ut,tn,Ge,se,Lo,Sr,qr,Nt,Qr,Lr,xt,Hr,Or,Kr,Ho,ei,Oo,ti,on,Ko,oi,sn,es,Re,ts,si,ai,zt,ni,ri,an,os,ii,nn,de,Be,Vs,Gt,li,Ps,di,rn,N,Rt,ci,ce,hi,ss,mi,pi,Bt,fi,gi,ui,he,_i,as,Ti,bi,ns,yi,vi,wi,Ve,ln,me,Pe,Xs,Vt,Mi,Ys,$i,dn,pe,Pt,Ii,Xe,Xt,ki,As,Fi,cn,fe,Ye,Ss,Yt,ji,qs,Di,hn,H,At,Wi,Qs,Ji,Ei,Ae,St,Ci,Ls,Zi,mn,ge,Se,Hs,qt,Ui,Os,Ni,pn,O,Qt,xi,Lt,zi,Ht,Gi,Ri,Bi,B,Ot,Vi,ue,Pi,rs,Xi,Yi,Ks,Ai,Si,qi,qe,Qi,Qe,fn,_e,Le,ea,Kt,Li,ta,Hi,gn,C,eo,Oi,to,Ki,oo,el,tl,ol,He,sl,so,al,ao,nl,rl,il,V,no,ll,Te,dl,is,cl,hl,oa,ml,pl,fl,Oe,gl,Ke,un,be,et,sa,ro,ul,aa,_l,_n,x,io,Tl,na,bl,yl,lo,vl,co,wl,Ml,$l,P,ho,Il,ye,kl,ls,Fl,jl,ra,Dl,Wl,Jl,tt,El,ot,Tn,ve,st,ia,mo,Cl,la,Zl,bn,W,po,Ul,da,Nl,xl,ca,zl,Gl,ha,Rl,Bl,fo,Vl,go,Pl,Xl,Yl,X,uo,Al,we,Sl,ds,ql,Ql,ma,Ll,Hl,Ol,at,Kl,nt,yn,Me,rt,pa,_o,ed,fa,td,vn,K,To,od,bo,sd,yo,ad,nd,rd,Y,vo,id,$e,ld,cs,dd,cd,ga,hd,md,pd,it,fd,lt,wn,Ie,dt,ua,wo,gd,_a,ud,Mn,ee,Mo,_d,ke,Td,$o,bd,yd,Io,vd,wd,Md,A,ko,$d,Fe,Id,hs,kd,Fd,Ta,jd,Dd,Wd,ct,Jd,ht,$n,je,mt,ba,Fo,Ed,ya,Cd,In,z,jo,Zd,va,Ud,Nd,Do,xd,Wo,zd,Gd,Rd,S,Jo,Bd,De,Vd,ms,Pd,Xd,wa,Yd,Ad,Sd,pt,qd,ft,kn,We,gt,Ma,Eo,Qd,$a,Ld,Fn,J,Co,Hd,Ia,Od,Kd,ka,ec,tc,Fa,oc,sc,Zo,ac,Uo,nc,rc,ic,q,No,lc,Je,dc,ps,cc,hc,ja,mc,pc,fc,ut,gc,_t,jn;return s=new U({}),Ne=new ne({props:{$$slots:{default:[gm]},$$scope:{ctx:k}}}),Dt=new U({}),Zt=new U({}),Ut=new fm({props:{pipeline:"image-classification"}}),Gt=new U({}),Rt=new j({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/v4.31.0/src/transformers/models/deit/configuration_deit.py#L37"}}),Ve=new Ce({props:{anchor:"transformers.DeiTConfig.example",$$slots:{default:[um]},$$scope:{ctx:k}}}),Vt=new U({}),Pt=new j({props:{name:"class transformers.DeiTFeatureExtractor",anchor:"transformers.DeiTFeatureExtractor",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/deit/feature_extraction_deit.py#L26"}}),Xt=new j({props:{name:"__call__",anchor:"transformers.DeiTFeatureExtractor.__call__",parameters:[{name:"images",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/image_processing_utils.py#L492"}}),Yt=new U({}),At=new j({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/v4.31.0/src/transformers/models/deit/image_processing_deit.py#L43"}}),St=new j({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[str, transformers.utils.generic.TensorType, NoneType] = None"},{name:"data_format",val:": ChannelDimension = <ChannelDimension.FIRST: 'channels_first'>"},{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"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/deit/image_processing_deit.py#L205"}}),qt=new U({}),Qt=new j({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/v4.31.0/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/v4.31.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/deit/modeling_deit.py#L461"}}),Ot=new j({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/v4.31.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/v4.31.0/en/model_doc/perceiver#transformers.PerceiverFeatureExtractor.__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/v4.31.0/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/v4.31.0/src/transformers/models/deit/modeling_deit.py#L486",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.31.0/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/v4.31.0/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:[_m]},$$scope:{ctx:k}}}),Qe=new Ce({props:{anchor:"transformers.DeiTModel.forward.example",$$slots:{default:[Tm]},$$scope:{ctx:k}}}),Kt=new U({}),eo=new j({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/v4.31.0/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/v4.31.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/deit/modeling_deit.py#L581"}}),He=new ne({props:{$$slots:{default:[bm]},$$scope:{ctx:k}}}),no=new j({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/v4.31.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/v4.31.0/en/model_doc/perceiver#transformers.PerceiverFeatureExtractor.__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/v4.31.0/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/v4.31.0/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/v4.31.0/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:[ym]},$$scope:{ctx:k}}}),Ke=new Ce({props:{anchor:"transformers.DeiTForMaskedImageModeling.forward.example",$$slots:{default:[vm]},$$scope:{ctx:k}}}),ro=new U({}),io=new j({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/v4.31.0/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/v4.31.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/deit/modeling_deit.py#L693"}}),ho=new j({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/v4.31.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/v4.31.0/en/model_doc/perceiver#transformers.PerceiverFeatureExtractor.__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/v4.31.0/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/v4.31.0/src/transformers/models/deit/modeling_deit.py#L706",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.modeling_outputs.ImageClassifierOutput"
>transformers.modeling_outputs.ImageClassifierOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.31.0/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/v4.31.0/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:[wm]},$$scope:{ctx:k}}}),ot=new Ce({props:{anchor:"transformers.DeiTForImageClassification.forward.example",$$slots:{default:[Mm]},$$scope:{ctx:k}}}),mo=new U({}),po=new j({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/v4.31.0/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/v4.31.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/deit/modeling_deit.py#L843"}}),uo=new j({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/v4.31.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/v4.31.0/en/model_doc/perceiver#transformers.PerceiverFeatureExtractor.__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/v4.31.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/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/v4.31.0/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>
`}}),at=new ne({props:{$$slots:{default:[$m]},$$scope:{ctx:k}}}),nt=new Ce({props:{anchor:"transformers.DeiTForImageClassificationWithTeacher.forward.example",$$slots:{default:[Im]},$$scope:{ctx:k}}}),_o=new U({}),To=new j({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/v4.31.0/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/v4.31.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/deit/modeling_tf_deit.py#L610"}}),vo=new j({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/v4.31.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/v4.31.0/en/model_doc/perceiver#transformers.PerceiverFeatureExtractor.__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/v4.31.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/deit/modeling_tf_deit.py#L620",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.modeling_tf_outputs.TFBaseModelOutputWithPooling"
>transformers.modeling_tf_outputs.TFBaseModelOutputWithPooling</a> or a tuple of <code>tf.Tensor</code> (if
<code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various elements depending on the
configuration (<a
  href="/docs/transformers/v4.31.0/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/v4.31.0/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:[km]},$$scope:{ctx:k}}}),lt=new Ce({props:{anchor:"transformers.TFDeiTModel.call.example",$$slots:{default:[Fm]},$$scope:{ctx:k}}}),wo=new U({}),Mo=new j({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/v4.31.0/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/v4.31.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/deit/modeling_tf_deit.py#L718"}}),ko=new j({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/v4.31.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/v4.31.0/en/model_doc/perceiver#transformers.PerceiverFeatureExtractor.__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/v4.31.0/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/v4.31.0/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/v4.31.0/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:[jm]},$$scope:{ctx:k}}}),ht=new Ce({props:{anchor:"transformers.TFDeiTForMaskedImageModeling.call.example",$$slots:{default:[Dm]},$$scope:{ctx:k}}}),Fo=new U({}),jo=new j({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/v4.31.0/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/v4.31.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/deit/modeling_tf_deit.py#L833"}}),Jo=new j({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/v4.31.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/v4.31.0/en/model_doc/perceiver#transformers.PerceiverFeatureExtractor.__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/v4.31.0/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/v4.31.0/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/v4.31.0/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:[Wm]},$$scope:{ctx:k}}}),ft=new Ce({props:{anchor:"transformers.TFDeiTForImageClassification.call.example",$$slots:{default:[Jm]},$$scope:{ctx:k}}}),Eo=new U({}),Co=new j({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/v4.31.0/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/v4.31.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/deit/modeling_tf_deit.py#L935"}}),No=new j({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/v4.31.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/v4.31.0/en/model_doc/perceiver#transformers.PerceiverFeatureExtractor.__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/v4.31.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/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/v4.31.0/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>
`}}),ut=new ne({props:{$$slots:{default:[Em]},$$scope:{ctx:k}}}),_t=new Ce({props:{anchor:"transformers.TFDeiTForImageClassificationWithTeacher.call.example",$$slots:{default:[Cm]},$$scope:{ctx:k}}}),{c(){d=a("meta"),b=m(),g=a("h1"),f=a("a"),T=a("span"),y(s.$$.fragment),h=m(),F=a("span"),Kn=i("DeiT"),Xa=m(),y(Ne.$$.fragment),Ya=m(),re=a("h2"),xe=a("a"),Ws=a("span"),y(Dt.$$.fragment),er=m(),Js=a("span"),tr=i("Overview"),Aa=m(),R=a("p"),or=i("The DeiT model was proposed in "),Wt=a("a"),sr=i("Training data-efficient image transformers & distillation through attention"),ar=i(` by Hugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa, Alexandre
Sablayrolles, Herv\xE9 J\xE9gou. The `),Ro=a("a"),nr=i("Vision Transformer (ViT)"),rr=i(" introduced in "),Jt=a("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.`),Sa=m(),Bo=a("p"),dr=i("The abstract from the paper is the following:"),qa=m(),Vo=a("p"),Es=a("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.`),Qa=m(),Po=a("p"),hr=i("Tips:"),La=m(),Z=a("ul"),Cs=a("li"),mr=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=m(),ie=a("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=a("a"),gr=i("DeiTForImageClassification"),ur=i(` and (2) corresponds to
`),Yo=a("a"),_r=i("DeiTForImageClassificationWithTeacher"),Tr=i("."),br=m(),Zs=a("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.`),vr=m(),Us=a("li"),wr=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=m(),D=a("li"),$r=i(`The authors of DeiT also released more efficiently trained ViT models, which you can directly plug into
`),Ao=a("a"),Ir=i("ViTModel"),kr=i(" or "),So=a("a"),Fr=i("ViTForImageClassification"),jr=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):
`),Ns=a("em"),Dr=i("facebook/deit-tiny-patch16-224"),Wr=i(", "),xs=a("em"),Jr=i("facebook/deit-small-patch16-224"),Er=i(", "),zs=a("em"),Cr=i("facebook/deit-base-patch16-224"),Zr=i(` and
`),Gs=a("em"),Ur=i("facebook/deit-base-patch16-384"),Nr=i(". Note that one should use "),qo=a("a"),xr=i("DeiTImageProcessor"),zr=i(` in order to
prepare images for the model.`),Ha=m(),oe=a("p"),Gr=i("This model was contributed by "),Et=a("a"),Rr=i("nielsr"),Br=i(". The TensorFlow version of this model was added by "),Ct=a("a"),Vr=i("amyeroberts"),Pr=i("."),Oa=m(),le=a("h2"),ze=a("a"),Rs=a("span"),y(Zt.$$.fragment),Xr=m(),Bs=a("span"),Yr=i("Resources"),Ka=m(),Qo=a("p"),Ar=i("A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with DeiT."),en=m(),y(Ut.$$.fragment),tn=m(),Ge=a("ul"),se=a("li"),Lo=a("a"),Sr=i("DeiTForImageClassification"),qr=i(" is supported by this "),Nt=a("a"),Qr=i("example script"),Lr=i(" and "),xt=a("a"),Hr=i("notebook"),Or=i("."),Kr=m(),Ho=a("li"),ei=i("See also: "),Oo=a("a"),ti=i("Image classification task guide"),on=m(),Ko=a("p"),oi=i("Besides that:"),sn=m(),es=a("ul"),Re=a("li"),ts=a("a"),si=i("DeiTForMaskedImageModeling"),ai=i(" is supported by this "),zt=a("a"),ni=i("example script"),ri=i("."),an=m(),os=a("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=m(),de=a("h2"),Be=a("a"),Vs=a("span"),y(Gt.$$.fragment),li=m(),Ps=a("span"),di=i("DeiTConfig"),rn=m(),N=a("div"),y(Rt.$$.fragment),ci=m(),ce=a("p"),hi=i("This is the configuration class to store the configuration of a "),ss=a("a"),mi=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=a("a"),fi=i("facebook/deit-base-distilled-patch16-224"),gi=i(`
architecture.`),ui=m(),he=a("p"),_i=i("Configuration objects inherit from "),as=a("a"),Ti=i("PretrainedConfig"),bi=i(` and can be used to control the model outputs. Read the
documentation from `),ns=a("a"),yi=i("PretrainedConfig"),vi=i(" for more information."),wi=m(),y(Ve.$$.fragment),ln=m(),me=a("h2"),Pe=a("a"),Xs=a("span"),y(Vt.$$.fragment),Mi=m(),Ys=a("span"),$i=i("DeiTFeatureExtractor"),dn=m(),pe=a("div"),y(Pt.$$.fragment),Ii=m(),Xe=a("div"),y(Xt.$$.fragment),ki=m(),As=a("p"),Fi=i("Preprocess an image or a batch of images."),cn=m(),fe=a("h2"),Ye=a("a"),Ss=a("span"),y(Yt.$$.fragment),ji=m(),qs=a("span"),Di=i("DeiTImageProcessor"),hn=m(),H=a("div"),y(At.$$.fragment),Wi=m(),Qs=a("p"),Ji=i("Constructs a DeiT image processor."),Ei=m(),Ae=a("div"),y(St.$$.fragment),Ci=m(),Ls=a("p"),Zi=i("Preprocess an image or batch of images."),mn=m(),ge=a("h2"),Se=a("a"),Hs=a("span"),y(qt.$$.fragment),Ui=m(),Os=a("span"),Ni=i("DeiTModel"),pn=m(),O=a("div"),y(Qt.$$.fragment),xi=m(),Lt=a("p"),zi=i(`The bare DeiT Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),Ht=a("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=m(),B=a("div"),y(Ot.$$.fragment),Vi=m(),ue=a("p"),Pi=i("The "),rs=a("a"),Xi=i("DeiTModel"),Yi=i(" forward method, overrides the "),Ks=a("code"),Ai=i("__call__"),Si=i(" special method."),qi=m(),y(qe.$$.fragment),Qi=m(),y(Qe.$$.fragment),fn=m(),_e=a("h2"),Le=a("a"),ea=a("span"),y(Kt.$$.fragment),Li=m(),ta=a("span"),Hi=i("DeiTForMaskedImageModeling"),gn=m(),C=a("div"),y(eo.$$.fragment),Oi=m(),to=a("p"),Ki=i("DeiT Model with a decoder on top for masked image modeling, as proposed in "),oo=a("a"),el=i("SimMIM"),tl=i("."),ol=m(),y(He.$$.fragment),sl=m(),so=a("p"),al=i("This model is a PyTorch "),ao=a("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=m(),V=a("div"),y(no.$$.fragment),ll=m(),Te=a("p"),dl=i("The "),is=a("a"),cl=i("DeiTForMaskedImageModeling"),hl=i(" forward method, overrides the "),oa=a("code"),ml=i("__call__"),pl=i(" special method."),fl=m(),y(Oe.$$.fragment),gl=m(),y(Ke.$$.fragment),un=m(),be=a("h2"),et=a("a"),sa=a("span"),y(ro.$$.fragment),ul=m(),aa=a("span"),_l=i("DeiTForImageClassification"),_n=m(),x=a("div"),y(io.$$.fragment),Tl=m(),na=a("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=m(),lo=a("p"),vl=i("This model is a PyTorch "),co=a("a"),wl=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=m(),P=a("div"),y(ho.$$.fragment),Il=m(),ye=a("p"),kl=i("The "),ls=a("a"),Fl=i("DeiTForImageClassification"),jl=i(" forward method, overrides the "),ra=a("code"),Dl=i("__call__"),Wl=i(" special method."),Jl=m(),y(tt.$$.fragment),El=m(),y(ot.$$.fragment),Tn=m(),ve=a("h2"),st=a("a"),ia=a("span"),y(mo.$$.fragment),Cl=m(),la=a("span"),Zl=i("DeiTForImageClassificationWithTeacher"),bn=m(),W=a("div"),y(po.$$.fragment),Ul=m(),da=a("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=m(),ca=a("p"),zl=i(".. warning::"),Gl=m(),ha=a("p"),Rl=i(`This model supports inference-only. Fine-tuning with distillation (i.e. with a teacher) is not yet
supported.`),Bl=m(),fo=a("p"),Vl=i("This model is a PyTorch "),go=a("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=m(),X=a("div"),y(uo.$$.fragment),Al=m(),we=a("p"),Sl=i("The "),ds=a("a"),ql=i("DeiTForImageClassificationWithTeacher"),Ql=i(" forward method, overrides the "),ma=a("code"),Ll=i("__call__"),Hl=i(" special method."),Ol=m(),y(at.$$.fragment),Kl=m(),y(nt.$$.fragment),yn=m(),Me=a("h2"),rt=a("a"),pa=a("span"),y(_o.$$.fragment),ed=m(),fa=a("span"),td=i("TFDeiTModel"),vn=m(),K=a("div"),y(To.$$.fragment),od=m(),bo=a("p"),sd=i(`The bare DeiT Model transformer outputting raw hidden-states without any specific head on top.
This model is a TensorFlow
`),yo=a("a"),ad=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=m(),Y=a("div"),y(vo.$$.fragment),id=m(),$e=a("p"),ld=i("The "),cs=a("a"),dd=i("TFDeiTModel"),cd=i(" forward method, overrides the "),ga=a("code"),hd=i("__call__"),md=i(" special method."),pd=m(),y(it.$$.fragment),fd=m(),y(lt.$$.fragment),wn=m(),Ie=a("h2"),dt=a("a"),ua=a("span"),y(wo.$$.fragment),gd=m(),_a=a("span"),ud=i("TFDeiTForMaskedImageModeling"),Mn=m(),ee=a("div"),y(Mo.$$.fragment),_d=m(),ke=a("p"),Td=i("DeiT Model with a decoder on top for masked image modeling, as proposed in "),$o=a("a"),bd=i("SimMIM"),yd=i(`.
This model is a TensorFlow
`),Io=a("a"),vd=i("tf.keras.layers.Layer"),wd=i(`. Use it as a regular
TensorFlow Module and refer to the TensorFlow documentation for all matter related to general usage and behavior.`),Md=m(),A=a("div"),y(ko.$$.fragment),$d=m(),Fe=a("p"),Id=i("The "),hs=a("a"),kd=i("TFDeiTForMaskedImageModeling"),Fd=i(" forward method, overrides the "),Ta=a("code"),jd=i("__call__"),Dd=i(" special method."),Wd=m(),y(ct.$$.fragment),Jd=m(),y(ht.$$.fragment),$n=m(),je=a("h2"),mt=a("a"),ba=a("span"),y(Fo.$$.fragment),Ed=m(),ya=a("span"),Cd=i("TFDeiTForImageClassification"),In=m(),z=a("div"),y(jo.$$.fragment),Zd=m(),va=a("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=m(),Do=a("p"),xd=i(`This model is a TensorFlow
`),Wo=a("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=m(),S=a("div"),y(Jo.$$.fragment),Bd=m(),De=a("p"),Vd=i("The "),ms=a("a"),Pd=i("TFDeiTForImageClassification"),Xd=i(" forward method, overrides the "),wa=a("code"),Yd=i("__call__"),Ad=i(" special method."),Sd=m(),y(pt.$$.fragment),qd=m(),y(ft.$$.fragment),kn=m(),We=a("h2"),gt=a("a"),Ma=a("span"),y(Eo.$$.fragment),Qd=m(),$a=a("span"),Ld=i("TFDeiTForImageClassificationWithTeacher"),Fn=m(),J=a("div"),y(Co.$$.fragment),Hd=m(),Ia=a("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=m(),ka=a("p"),ec=i(".. warning::"),tc=m(),Fa=a("p"),oc=i(`This model supports inference-only. Fine-tuning with distillation (i.e. with a teacher) is not yet
supported.`),sc=m(),Zo=a("p"),ac=i(`This model is a TensorFlow
`),Uo=a("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=m(),q=a("div"),y(No.$$.fragment),lc=m(),Je=a("p"),dc=i("The "),ps=a("a"),cc=i("TFDeiTForImageClassificationWithTeacher"),hc=i(" forward method, overrides the "),ja=a("code"),mc=i("__call__"),pc=i(" special method."),fc=m(),y(ut.$$.fragment),gc=m(),y(_t.$$.fragment),this.h()},l(t){const u=mm('[data-svelte="svelte-1phssyn"]',document.head);d=n(u,"META",{name:!0,content:!0}),u.forEach(o),b=p(t),g=n(t,"H1",{class:!0});var xo=r(g);f=n(xo,"A",{id:!0,class:!0,href:!0});var Da=r(f);T=n(Da,"SPAN",{});var Wa=r(T);v(s.$$.fragment,Wa),Wa.forEach(o),Da.forEach(o),h=p(xo),F=n(xo,"SPAN",{});var Ja=r(F);Kn=l(Ja,"DeiT"),Ja.forEach(o),xo.forEach(o),Xa=p(t),v(Ne.$$.fragment,t),Ya=p(t),re=n(t,"H2",{class:!0});var zo=r(re);xe=n(zo,"A",{id:!0,class:!0,href:!0});var Ea=r(xe);Ws=n(Ea,"SPAN",{});var Ca=r(Ws);v(Dt.$$.fragment,Ca),Ca.forEach(o),Ea.forEach(o),er=p(zo),Js=n(zo,"SPAN",{});var Za=r(Js);tr=l(Za,"Overview"),Za.forEach(o),zo.forEach(o),Aa=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 Ua=r(Wt);sr=l(Ua,"Training data-efficient image transformers & distillation through attention"),Ua.forEach(o),ar=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 Na=r(Ro);nr=l(Na,"Vision Transformer (ViT)"),Na.forEach(o),rr=l(te," introduced in "),Jt=n(te,"A",{href:!0,rel:!0});var xa=r(Jt);ir=l(xa,"Dosovitskiy et al., 2020"),xa.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),Sa=p(t),Bo=n(t,"P",{});var za=r(Bo);dr=l(za,"The abstract from the paper is the following:"),za.forEach(o),qa=p(t),Vo=n(t,"P",{});var Ga=r(Vo);Es=n(Ga,"EM",{});var Ra=r(Es);cr=l(Ra,`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.`),Ra.forEach(o),Ga.forEach(o),Qa=p(t),Po=n(t,"P",{});var Ba=r(Po);hr=l(Ba,"Tips:"),Ba.forEach(o),La=p(t),Z=n(t,"UL",{});var G=r(Z);Cs=n(G,"LI",{});var Va=r(Cs);mr=l(Va,`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.`),Va.forEach(o),pr=p(G),ie=n(G,"LI",{});var Ee=r(ie);fr=l(Ee,`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(Ee,"A",{href:!0});var _c=r(Xo);gr=l(_c,"DeiTForImageClassification"),_c.forEach(o),ur=l(Ee,` and (2) corresponds to
`),Yo=n(Ee,"A",{href:!0});var Tc=r(Yo);_r=l(Tc,"DeiTForImageClassificationWithTeacher"),Tc.forEach(o),Tr=l(Ee,"."),Ee.forEach(o),br=p(G),Zs=n(G,"LI",{});var bc=r(Zs);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),vr=p(G),Us=n(G,"LI",{});var yc=r(Us);wr=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),D=n(G,"LI",{});var E=r(D);$r=l(E,`The authors of DeiT also released more efficiently trained ViT models, which you can directly plug into
`),Ao=n(E,"A",{href:!0});var vc=r(Ao);Ir=l(vc,"ViTModel"),vc.forEach(o),kr=l(E," or "),So=n(E,"A",{href:!0});var wc=r(So);Fr=l(wc,"ViTForImageClassification"),wc.forEach(o),jr=l(E,`. 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):
`),Ns=n(E,"EM",{});var Mc=r(Ns);Dr=l(Mc,"facebook/deit-tiny-patch16-224"),Mc.forEach(o),Wr=l(E,", "),xs=n(E,"EM",{});var $c=r(xs);Jr=l($c,"facebook/deit-small-patch16-224"),$c.forEach(o),Er=l(E,", "),zs=n(E,"EM",{});var Ic=r(zs);Cr=l(Ic,"facebook/deit-base-patch16-224"),Ic.forEach(o),Zr=l(E,` and
`),Gs=n(E,"EM",{});var kc=r(Gs);Ur=l(kc,"facebook/deit-base-patch16-384"),kc.forEach(o),Nr=l(E,". Note that one should use "),qo=n(E,"A",{href:!0});var Fc=r(qo);xr=l(Fc,"DeiTImageProcessor"),Fc.forEach(o),zr=l(E,` in order to
prepare images for the model.`),E.forEach(o),G.forEach(o),Ha=p(t),oe=n(t,"P",{});var fs=r(oe);Gr=l(fs,"This model was contributed by "),Et=n(fs,"A",{href:!0,rel:!0});var jc=r(Et);Rr=l(jc,"nielsr"),jc.forEach(o),Br=l(fs,". The TensorFlow version of this model was added by "),Ct=n(fs,"A",{href:!0,rel:!0});var Dc=r(Ct);Vr=l(Dc,"amyeroberts"),Dc.forEach(o),Pr=l(fs,"."),fs.forEach(o),Oa=p(t),le=n(t,"H2",{class:!0});var Dn=r(le);ze=n(Dn,"A",{id:!0,class:!0,href:!0});var Wc=r(ze);Rs=n(Wc,"SPAN",{});var Jc=r(Rs);v(Zt.$$.fragment,Jc),Jc.forEach(o),Wc.forEach(o),Xr=p(Dn),Bs=n(Dn,"SPAN",{});var Ec=r(Bs);Yr=l(Ec,"Resources"),Ec.forEach(o),Dn.forEach(o),Ka=p(t),Qo=n(t,"P",{});var Cc=r(Qo);Ar=l(Cc,"A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with DeiT."),Cc.forEach(o),en=p(t),v(Ut.$$.fragment,t),tn=p(t),Ge=n(t,"UL",{});var Wn=r(Ge);se=n(Wn,"LI",{});var Go=r(se);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 uc=r(Ho);ei=l(uc,"See also: "),Oo=n(uc,"A",{href:!0});var xc=r(Oo);ti=l(xc,"Image classification task guide"),xc.forEach(o),uc.forEach(o),Wn.forEach(o),on=p(t),Ko=n(t,"P",{});var zc=r(Ko);oi=l(zc,"Besides that:"),zc.forEach(o),sn=p(t),es=n(t,"UL",{});var Gc=r(es);Re=n(Gc,"LI",{});var Pa=r(Re);ts=n(Pa,"A",{href:!0});var Rc=r(ts);si=l(Rc,"DeiTForMaskedImageModeling"),Rc.forEach(o),ai=l(Pa," is supported by this "),zt=n(Pa,"A",{href:!0,rel:!0});var Bc=r(zt);ni=l(Bc,"example script"),Bc.forEach(o),ri=l(Pa,"."),Pa.forEach(o),Gc.forEach(o),an=p(t),os=n(t,"P",{});var Vc=r(os);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);Vs=n(Pc,"SPAN",{});var Xc=r(Vs);v(Gt.$$.fragment,Xc),Xc.forEach(o),Pc.forEach(o),li=p(Jn),Ps=n(Jn,"SPAN",{});var Yc=r(Ps);di=l(Yc,"DeiTConfig"),Yc.forEach(o),Jn.forEach(o),rn=p(t),N=n(t,"DIV",{class:!0});var Tt=r(N);v(Rt.$$.fragment,Tt),ci=p(Tt),ce=n(Tt,"P",{});var gs=r(ce);hi=l(gs,"This is the configuration class to store the configuration of a "),ss=n(gs,"A",{href:!0});var Ac=r(ss);mi=l(Ac,"DeiTModel"),Ac.forEach(o),pi=l(gs,`. 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(gs,"A",{href:!0,rel:!0});var Sc=r(Bt);fi=l(Sc,"facebook/deit-base-distilled-patch16-224"),Sc.forEach(o),gi=l(gs,`
architecture.`),gs.forEach(o),ui=p(Tt),he=n(Tt,"P",{});var us=r(he);_i=l(us,"Configuration objects inherit from "),as=n(us,"A",{href:!0});var qc=r(as);Ti=l(qc,"PretrainedConfig"),qc.forEach(o),bi=l(us,` and can be used to control the model outputs. Read the
documentation from `),ns=n(us,"A",{href:!0});var Qc=r(ns);yi=l(Qc,"PretrainedConfig"),Qc.forEach(o),vi=l(us," for more information."),us.forEach(o),wi=p(Tt),v(Ve.$$.fragment,Tt),Tt.forEach(o),ln=p(t),me=n(t,"H2",{class:!0});var En=r(me);Pe=n(En,"A",{id:!0,class:!0,href:!0});var Lc=r(Pe);Xs=n(Lc,"SPAN",{});var Hc=r(Xs);v(Vt.$$.fragment,Hc),Hc.forEach(o),Lc.forEach(o),Mi=p(En),Ys=n(En,"SPAN",{});var Oc=r(Ys);$i=l(Oc,"DeiTFeatureExtractor"),Oc.forEach(o),En.forEach(o),dn=p(t),pe=n(t,"DIV",{class:!0});var Cn=r(pe);v(Pt.$$.fragment,Cn),Ii=p(Cn),Xe=n(Cn,"DIV",{class:!0});var Zn=r(Xe);v(Xt.$$.fragment,Zn),ki=p(Zn),As=n(Zn,"P",{});var Kc=r(As);Fi=l(Kc,"Preprocess an image or a batch of images."),Kc.forEach(o),Zn.forEach(o),Cn.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 eh=r(Ye);Ss=n(eh,"SPAN",{});var th=r(Ss);v(Yt.$$.fragment,th),th.forEach(o),eh.forEach(o),ji=p(Un),qs=n(Un,"SPAN",{});var oh=r(qs);Di=l(oh,"DeiTImageProcessor"),oh.forEach(o),Un.forEach(o),hn=p(t),H=n(t,"DIV",{class:!0});var _s=r(H);v(At.$$.fragment,_s),Wi=p(_s),Qs=n(_s,"P",{});var sh=r(Qs);Ji=l(sh,"Constructs a DeiT image processor."),sh.forEach(o),Ei=p(_s),Ae=n(_s,"DIV",{class:!0});var Nn=r(Ae);v(St.$$.fragment,Nn),Ci=p(Nn),Ls=n(Nn,"P",{});var ah=r(Ls);Zi=l(ah,"Preprocess an image or batch of images."),ah.forEach(o),Nn.forEach(o),_s.forEach(o),mn=p(t),ge=n(t,"H2",{class:!0});var xn=r(ge);Se=n(xn,"A",{id:!0,class:!0,href:!0});var nh=r(Se);Hs=n(nh,"SPAN",{});var rh=r(Hs);v(qt.$$.fragment,rh),rh.forEach(o),nh.forEach(o),Ui=p(xn),Os=n(xn,"SPAN",{});var ih=r(Os);Ni=l(ih,"DeiTModel"),ih.forEach(o),xn.forEach(o),pn=p(t),O=n(t,"DIV",{class:!0});var Ts=r(O);v(Qt.$$.fragment,Ts),xi=p(Ts),Lt=n(Ts,"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 lh=r(Ht);Gi=l(lh,"torch.nn.Module"),lh.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(Ts),B=n(Ts,"DIV",{class:!0});var bt=r(B);v(Ot.$$.fragment,bt),Vi=p(bt),ue=n(bt,"P",{});var bs=r(ue);Pi=l(bs,"The "),rs=n(bs,"A",{href:!0});var dh=r(rs);Xi=l(dh,"DeiTModel"),dh.forEach(o),Yi=l(bs," forward method, overrides the "),Ks=n(bs,"CODE",{});var ch=r(Ks);Ai=l(ch,"__call__"),ch.forEach(o),Si=l(bs," special method."),bs.forEach(o),qi=p(bt),v(qe.$$.fragment,bt),Qi=p(bt),v(Qe.$$.fragment,bt),bt.forEach(o),Ts.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 hh=r(Le);ea=n(hh,"SPAN",{});var mh=r(ea);v(Kt.$$.fragment,mh),mh.forEach(o),hh.forEach(o),Li=p(Gn),ta=n(Gn,"SPAN",{});var ph=r(ta);Hi=l(ph,"DeiTForMaskedImageModeling"),ph.forEach(o),Gn.forEach(o),gn=p(t),C=n(t,"DIV",{class:!0});var ae=r(C);v(eo.$$.fragment,ae),Oi=p(ae),to=n(ae,"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 fh=r(oo);el=l(fh,"SimMIM"),fh.forEach(o),tl=l(Rn,"."),Rn.forEach(o),ol=p(ae),v(He.$$.fragment,ae),sl=p(ae),so=n(ae,"P",{});var Bn=r(so);al=l(Bn,"This model is a PyTorch "),ao=n(Bn,"A",{href:!0,rel:!0});var gh=r(ao);nl=l(gh,"torch.nn.Module"),gh.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(ae),V=n(ae,"DIV",{class:!0});var yt=r(V);v(no.$$.fragment,yt),ll=p(yt),Te=n(yt,"P",{});var ys=r(Te);dl=l(ys,"The "),is=n(ys,"A",{href:!0});var uh=r(is);cl=l(uh,"DeiTForMaskedImageModeling"),uh.forEach(o),hl=l(ys," forward method, overrides the "),oa=n(ys,"CODE",{});var _h=r(oa);ml=l(_h,"__call__"),_h.forEach(o),pl=l(ys," special method."),ys.forEach(o),fl=p(yt),v(Oe.$$.fragment,yt),gl=p(yt),v(Ke.$$.fragment,yt),yt.forEach(o),ae.forEach(o),un=p(t),be=n(t,"H2",{class:!0});var Vn=r(be);et=n(Vn,"A",{id:!0,class:!0,href:!0});var Th=r(et);sa=n(Th,"SPAN",{});var bh=r(sa);v(ro.$$.fragment,bh),bh.forEach(o),Th.forEach(o),ul=p(Vn),aa=n(Vn,"SPAN",{});var yh=r(aa);_l=l(yh,"DeiTForImageClassification"),yh.forEach(o),Vn.forEach(o),_n=p(t),x=n(t,"DIV",{class:!0});var vt=r(x);v(io.$$.fragment,vt),Tl=p(vt),na=n(vt,"P",{});var vh=r(na);bl=l(vh,`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.`),vh.forEach(o),yl=p(vt),lo=n(vt,"P",{});var Pn=r(lo);vl=l(Pn,"This model is a PyTorch "),co=n(Pn,"A",{href:!0,rel:!0});var wh=r(co);wl=l(wh,"torch.nn.Module"),wh.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(vt),P=n(vt,"DIV",{class:!0});var wt=r(P);v(ho.$$.fragment,wt),Il=p(wt),ye=n(wt,"P",{});var vs=r(ye);kl=l(vs,"The "),ls=n(vs,"A",{href:!0});var Mh=r(ls);Fl=l(Mh,"DeiTForImageClassification"),Mh.forEach(o),jl=l(vs," forward method, overrides the "),ra=n(vs,"CODE",{});var $h=r(ra);Dl=l($h,"__call__"),$h.forEach(o),Wl=l(vs," special method."),vs.forEach(o),Jl=p(wt),v(tt.$$.fragment,wt),El=p(wt),v(ot.$$.fragment,wt),wt.forEach(o),vt.forEach(o),Tn=p(t),ve=n(t,"H2",{class:!0});var Xn=r(ve);st=n(Xn,"A",{id:!0,class:!0,href:!0});var Ih=r(st);ia=n(Ih,"SPAN",{});var kh=r(ia);v(mo.$$.fragment,kh),kh.forEach(o),Ih.forEach(o),Cl=p(Xn),la=n(Xn,"SPAN",{});var Fh=r(la);Zl=l(Fh,"DeiTForImageClassificationWithTeacher"),Fh.forEach(o),Xn.forEach(o),bn=p(t),W=n(t,"DIV",{class:!0});var Q=r(W);v(po.$$.fragment,Q),Ul=p(Q),da=n(Q,"P",{});var jh=r(da);Nl=l(jh,`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.`),jh.forEach(o),xl=p(Q),ca=n(Q,"P",{});var Dh=r(ca);zl=l(Dh,".. warning::"),Dh.forEach(o),Gl=p(Q),ha=n(Q,"P",{});var Wh=r(ha);Rl=l(Wh,`This model supports inference-only. Fine-tuning with distillation (i.e. with a teacher) is not yet
supported.`),Wh.forEach(o),Bl=p(Q),fo=n(Q,"P",{});var Yn=r(fo);Vl=l(Yn,"This model is a PyTorch "),go=n(Yn,"A",{href:!0,rel:!0});var Jh=r(go);Pl=l(Jh,"torch.nn.Module"),Jh.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);v(uo.$$.fragment,Mt),Al=p(Mt),we=n(Mt,"P",{});var ws=r(we);Sl=l(ws,"The "),ds=n(ws,"A",{href:!0});var Eh=r(ds);ql=l(Eh,"DeiTForImageClassificationWithTeacher"),Eh.forEach(o),Ql=l(ws," forward method, overrides the "),ma=n(ws,"CODE",{});var Ch=r(ma);Ll=l(Ch,"__call__"),Ch.forEach(o),Hl=l(ws," special method."),ws.forEach(o),Ol=p(Mt),v(at.$$.fragment,Mt),Kl=p(Mt),v(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 Zh=r(rt);pa=n(Zh,"SPAN",{});var Uh=r(pa);v(_o.$$.fragment,Uh),Uh.forEach(o),Zh.forEach(o),ed=p(An),fa=n(An,"SPAN",{});var Nh=r(fa);td=l(Nh,"TFDeiTModel"),Nh.forEach(o),An.forEach(o),vn=p(t),K=n(t,"DIV",{class:!0});var Ms=r(K);v(To.$$.fragment,Ms),od=p(Ms),bo=n(Ms,"P",{});var Sn=r(bo);sd=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 xh=r(yo);ad=l(xh,"tf.keras.layers.Layer"),xh.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(Ms),Y=n(Ms,"DIV",{class:!0});var $t=r(Y);v(vo.$$.fragment,$t),id=p($t),$e=n($t,"P",{});var $s=r($e);ld=l($s,"The "),cs=n($s,"A",{href:!0});var zh=r(cs);dd=l(zh,"TFDeiTModel"),zh.forEach(o),cd=l($s," forward method, overrides the "),ga=n($s,"CODE",{});var Gh=r(ga);hd=l(Gh,"__call__"),Gh.forEach(o),md=l($s," special method."),$s.forEach(o),pd=p($t),v(it.$$.fragment,$t),fd=p($t),v(lt.$$.fragment,$t),$t.forEach(o),Ms.forEach(o),wn=p(t),Ie=n(t,"H2",{class:!0});var qn=r(Ie);dt=n(qn,"A",{id:!0,class:!0,href:!0});var Rh=r(dt);ua=n(Rh,"SPAN",{});var Bh=r(ua);v(wo.$$.fragment,Bh),Bh.forEach(o),Rh.forEach(o),gd=p(qn),_a=n(qn,"SPAN",{});var Vh=r(_a);ud=l(Vh,"TFDeiTForMaskedImageModeling"),Vh.forEach(o),qn.forEach(o),Mn=p(t),ee=n(t,"DIV",{class:!0});var Is=r(ee);v(Mo.$$.fragment,Is),_d=p(Is),ke=n(Is,"P",{});var ks=r(ke);Td=l(ks,"DeiT Model with a decoder on top for masked image modeling, as proposed in "),$o=n(ks,"A",{href:!0,rel:!0});var Ph=r($o);bd=l(Ph,"SimMIM"),Ph.forEach(o),yd=l(ks,`.
This model is a TensorFlow
`),Io=n(ks,"A",{href:!0,rel:!0});var Xh=r(Io);vd=l(Xh,"tf.keras.layers.Layer"),Xh.forEach(o),wd=l(ks,`. Use it as a regular
TensorFlow Module and refer to the TensorFlow documentation for all matter related to general usage and behavior.`),ks.forEach(o),Md=p(Is),A=n(Is,"DIV",{class:!0});var It=r(A);v(ko.$$.fragment,It),$d=p(It),Fe=n(It,"P",{});var Fs=r(Fe);Id=l(Fs,"The "),hs=n(Fs,"A",{href:!0});var Yh=r(hs);kd=l(Yh,"TFDeiTForMaskedImageModeling"),Yh.forEach(o),Fd=l(Fs," forward method, overrides the "),Ta=n(Fs,"CODE",{});var Ah=r(Ta);jd=l(Ah,"__call__"),Ah.forEach(o),Dd=l(Fs," special method."),Fs.forEach(o),Wd=p(It),v(ct.$$.fragment,It),Jd=p(It),v(ht.$$.fragment,It),It.forEach(o),Is.forEach(o),$n=p(t),je=n(t,"H2",{class:!0});var Qn=r(je);mt=n(Qn,"A",{id:!0,class:!0,href:!0});var Sh=r(mt);ba=n(Sh,"SPAN",{});var qh=r(ba);v(Fo.$$.fragment,qh),qh.forEach(o),Sh.forEach(o),Ed=p(Qn),ya=n(Qn,"SPAN",{});var Qh=r(ya);Cd=l(Qh,"TFDeiTForImageClassification"),Qh.forEach(o),Qn.forEach(o),In=p(t),z=n(t,"DIV",{class:!0});var kt=r(z);v(jo.$$.fragment,kt),Zd=p(kt),va=n(kt,"P",{});var Lh=r(va);Ud=l(Lh,`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.`),Lh.forEach(o),Nd=p(kt),Do=n(kt,"P",{});var Ln=r(Do);xd=l(Ln,`This model is a TensorFlow
`),Wo=n(Ln,"A",{href:!0,rel:!0});var Hh=r(Wo);zd=l(Hh,"tf.keras.layers.Layer"),Hh.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);v(Jo.$$.fragment,Ft),Bd=p(Ft),De=n(Ft,"P",{});var js=r(De);Vd=l(js,"The "),ms=n(js,"A",{href:!0});var Oh=r(ms);Pd=l(Oh,"TFDeiTForImageClassification"),Oh.forEach(o),Xd=l(js," forward method, overrides the "),wa=n(js,"CODE",{});var Kh=r(wa);Yd=l(Kh,"__call__"),Kh.forEach(o),Ad=l(js," special method."),js.forEach(o),Sd=p(Ft),v(pt.$$.fragment,Ft),qd=p(Ft),v(ft.$$.fragment,Ft),Ft.forEach(o),kt.forEach(o),kn=p(t),We=n(t,"H2",{class:!0});var Hn=r(We);gt=n(Hn,"A",{id:!0,class:!0,href:!0});var em=r(gt);Ma=n(em,"SPAN",{});var tm=r(Ma);v(Eo.$$.fragment,tm),tm.forEach(o),em.forEach(o),Qd=p(Hn),$a=n(Hn,"SPAN",{});var om=r($a);Ld=l(om,"TFDeiTForImageClassificationWithTeacher"),om.forEach(o),Hn.forEach(o),Fn=p(t),J=n(t,"DIV",{class:!0});var L=r(J);v(Co.$$.fragment,L),Hd=p(L),Ia=n(L,"P",{});var sm=r(Ia);Od=l(sm,`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.`),sm.forEach(o),Kd=p(L),ka=n(L,"P",{});var am=r(ka);ec=l(am,".. warning::"),am.forEach(o),tc=p(L),Fa=n(L,"P",{});var nm=r(Fa);oc=l(nm,`This model supports inference-only. Fine-tuning with distillation (i.e. with a teacher) is not yet
supported.`),nm.forEach(o),sc=p(L),Zo=n(L,"P",{});var On=r(Zo);ac=l(On,`This model is a TensorFlow
`),Uo=n(On,"A",{href:!0,rel:!0});var rm=r(Uo);nc=l(rm,"tf.keras.layers.Layer"),rm.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 jt=r(q);v(No.$$.fragment,jt),lc=p(jt),Je=n(jt,"P",{});var Ds=r(Je);dc=l(Ds,"The "),ps=n(Ds,"A",{href:!0});var im=r(ps);cc=l(im,"TFDeiTForImageClassificationWithTeacher"),im.forEach(o),hc=l(Ds," forward method, overrides the "),ja=n(Ds,"CODE",{});var lm=r(ja);mc=l(lm,"__call__"),lm.forEach(o),pc=l(Ds," special method."),Ds.forEach(o),fc=p(jt),v(ut.$$.fragment,jt),gc=p(jt),v(_t.$$.fragment,jt),jt.forEach(o),L.forEach(o),this.h()},h(){c(d,"name","hf:doc:metadata"),c(d,"content",JSON.stringify(Um)),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(g,"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/v4.31.0/en/model_doc/deit#transformers.DeiTForImageClassification"),c(Yo,"href","/docs/transformers/v4.31.0/en/model_doc/deit#transformers.DeiTForImageClassificationWithTeacher"),c(Ao,"href","/docs/transformers/v4.31.0/en/model_doc/vit#transformers.ViTModel"),c(So,"href","/docs/transformers/v4.31.0/en/model_doc/vit#transformers.ViTForImageClassification"),c(qo,"href","/docs/transformers/v4.31.0/en/model_doc/deit#transformers.DeiTImageProcessor"),c(Et,"href","https://huggingface.co/nielsr"),c(Et,"rel","nofollow"),c(Ct,"href","https://huggingface.co/amyeroberts"),c(Ct,"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/v4.31.0/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(ts,"href","/docs/transformers/v4.31.0/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(ss,"href","/docs/transformers/v4.31.0/en/model_doc/deit#transformers.DeiTModel"),c(Bt,"href","https://huggingface.co/facebook/deit-base-distilled-patch16-224"),c(Bt,"rel","nofollow"),c(as,"href","/docs/transformers/v4.31.0/en/main_classes/configuration#transformers.PretrainedConfig"),c(ns,"href","/docs/transformers/v4.31.0/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(me,"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(ge,"class","relative group"),c(Ht,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(Ht,"rel","nofollow"),c(rs,"href","/docs/transformers/v4.31.0/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(ao,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(ao,"rel","nofollow"),c(is,"href","/docs/transformers/v4.31.0/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(C,"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(ls,"href","/docs/transformers/v4.31.0/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(st,"id","transformers.DeiTForImageClassificationWithTeacher"),c(st,"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(st,"href","#transformers.DeiTForImageClassificationWithTeacher"),c(ve,"class","relative group"),c(go,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(go,"rel","nofollow"),c(ds,"href","/docs/transformers/v4.31.0/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(cs,"href","/docs/transformers/v4.31.0/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(hs,"href","/docs/transformers/v4.31.0/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(mt,"id","transformers.TFDeiTForImageClassification"),c(mt,"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(mt,"href","#transformers.TFDeiTForImageClassification"),c(je,"class","relative group"),c(Wo,"href","https://www.tensorflow.org/api_docs/python/tf/keras/layers/Layer"),c(Wo,"rel","nofollow"),c(ms,"href","/docs/transformers/v4.31.0/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(gt,"id","transformers.TFDeiTForImageClassificationWithTeacher"),c(gt,"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(gt,"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(ps,"href","/docs/transformers/v4.31.0/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,u){e(document.head,d),_(t,b,u),_(t,g,u),e(g,f),e(f,T),w(s,T,null),e(g,h),e(g,F),e(F,Kn),_(t,Xa,u),w(Ne,t,u),_(t,Ya,u),_(t,re,u),e(re,xe),e(xe,Ws),w(Dt,Ws,null),e(re,er),e(re,Js),e(Js,tr),_(t,Aa,u),_(t,R,u),e(R,or),e(R,Wt),e(Wt,sr),e(R,ar),e(R,Ro),e(Ro,nr),e(R,rr),e(R,Jt),e(Jt,ir),e(R,lr),_(t,Sa,u),_(t,Bo,u),e(Bo,dr),_(t,qa,u),_(t,Vo,u),e(Vo,Es),e(Es,cr),_(t,Qa,u),_(t,Po,u),e(Po,hr),_(t,La,u),_(t,Z,u),e(Z,Cs),e(Cs,mr),e(Z,pr),e(Z,ie),e(ie,fr),e(ie,Xo),e(Xo,gr),e(ie,ur),e(ie,Yo),e(Yo,_r),e(ie,Tr),e(Z,br),e(Z,Zs),e(Zs,yr),e(Z,vr),e(Z,Us),e(Us,wr),e(Z,Mr),e(Z,D),e(D,$r),e(D,Ao),e(Ao,Ir),e(D,kr),e(D,So),e(So,Fr),e(D,jr),e(D,Ns),e(Ns,Dr),e(D,Wr),e(D,xs),e(xs,Jr),e(D,Er),e(D,zs),e(zs,Cr),e(D,Zr),e(D,Gs),e(Gs,Ur),e(D,Nr),e(D,qo),e(qo,xr),e(D,zr),_(t,Ha,u),_(t,oe,u),e(oe,Gr),e(oe,Et),e(Et,Rr),e(oe,Br),e(oe,Ct),e(Ct,Vr),e(oe,Pr),_(t,Oa,u),_(t,le,u),e(le,ze),e(ze,Rs),w(Zt,Rs,null),e(le,Xr),e(le,Bs),e(Bs,Yr),_(t,Ka,u),_(t,Qo,u),e(Qo,Ar),_(t,en,u),w(Ut,t,u),_(t,tn,u),_(t,Ge,u),e(Ge,se),e(se,Lo),e(Lo,Sr),e(se,qr),e(se,Nt),e(Nt,Qr),e(se,Lr),e(se,xt),e(xt,Hr),e(se,Or),e(Ge,Kr),e(Ge,Ho),e(Ho,ei),e(Ho,Oo),e(Oo,ti),_(t,on,u),_(t,Ko,u),e(Ko,oi),_(t,sn,u),_(t,es,u),e(es,Re),e(Re,ts),e(ts,si),e(Re,ai),e(Re,zt),e(zt,ni),e(Re,ri),_(t,an,u),_(t,os,u),e(os,ii),_(t,nn,u),_(t,de,u),e(de,Be),e(Be,Vs),w(Gt,Vs,null),e(de,li),e(de,Ps),e(Ps,di),_(t,rn,u),_(t,N,u),w(Rt,N,null),e(N,ci),e(N,ce),e(ce,hi),e(ce,ss),e(ss,mi),e(ce,pi),e(ce,Bt),e(Bt,fi),e(ce,gi),e(N,ui),e(N,he),e(he,_i),e(he,as),e(as,Ti),e(he,bi),e(he,ns),e(ns,yi),e(he,vi),e(N,wi),w(Ve,N,null),_(t,ln,u),_(t,me,u),e(me,Pe),e(Pe,Xs),w(Vt,Xs,null),e(me,Mi),e(me,Ys),e(Ys,$i),_(t,dn,u),_(t,pe,u),w(Pt,pe,null),e(pe,Ii),e(pe,Xe),w(Xt,Xe,null),e(Xe,ki),e(Xe,As),e(As,Fi),_(t,cn,u),_(t,fe,u),e(fe,Ye),e(Ye,Ss),w(Yt,Ss,null),e(fe,ji),e(fe,qs),e(qs,Di),_(t,hn,u),_(t,H,u),w(At,H,null),e(H,Wi),e(H,Qs),e(Qs,Ji),e(H,Ei),e(H,Ae),w(St,Ae,null),e(Ae,Ci),e(Ae,Ls),e(Ls,Zi),_(t,mn,u),_(t,ge,u),e(ge,Se),e(Se,Hs),w(qt,Hs,null),e(ge,Ui),e(ge,Os),e(Os,Ni),_(t,pn,u),_(t,O,u),w(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),w(Ot,B,null),e(B,Vi),e(B,ue),e(ue,Pi),e(ue,rs),e(rs,Xi),e(ue,Yi),e(ue,Ks),e(Ks,Ai),e(ue,Si),e(B,qi),w(qe,B,null),e(B,Qi),w(Qe,B,null),_(t,fn,u),_(t,_e,u),e(_e,Le),e(Le,ea),w(Kt,ea,null),e(_e,Li),e(_e,ta),e(ta,Hi),_(t,gn,u),_(t,C,u),w(eo,C,null),e(C,Oi),e(C,to),e(to,Ki),e(to,oo),e(oo,el),e(to,tl),e(C,ol),w(He,C,null),e(C,sl),e(C,so),e(so,al),e(so,ao),e(ao,nl),e(so,rl),e(C,il),e(C,V),w(no,V,null),e(V,ll),e(V,Te),e(Te,dl),e(Te,is),e(is,cl),e(Te,hl),e(Te,oa),e(oa,ml),e(Te,pl),e(V,fl),w(Oe,V,null),e(V,gl),w(Ke,V,null),_(t,un,u),_(t,be,u),e(be,et),e(et,sa),w(ro,sa,null),e(be,ul),e(be,aa),e(aa,_l),_(t,_n,u),_(t,x,u),w(io,x,null),e(x,Tl),e(x,na),e(na,bl),e(x,yl),e(x,lo),e(lo,vl),e(lo,co),e(co,wl),e(lo,Ml),e(x,$l),e(x,P),w(ho,P,null),e(P,Il),e(P,ye),e(ye,kl),e(ye,ls),e(ls,Fl),e(ye,jl),e(ye,ra),e(ra,Dl),e(ye,Wl),e(P,Jl),w(tt,P,null),e(P,El),w(ot,P,null),_(t,Tn,u),_(t,ve,u),e(ve,st),e(st,ia),w(mo,ia,null),e(ve,Cl),e(ve,la),e(la,Zl),_(t,bn,u),_(t,W,u),w(po,W,null),e(W,Ul),e(W,da),e(da,Nl),e(W,xl),e(W,ca),e(ca,zl),e(W,Gl),e(W,ha),e(ha,Rl),e(W,Bl),e(W,fo),e(fo,Vl),e(fo,go),e(go,Pl),e(fo,Xl),e(W,Yl),e(W,X),w(uo,X,null),e(X,Al),e(X,we),e(we,Sl),e(we,ds),e(ds,ql),e(we,Ql),e(we,ma),e(ma,Ll),e(we,Hl),e(X,Ol),w(at,X,null),e(X,Kl),w(nt,X,null),_(t,yn,u),_(t,Me,u),e(Me,rt),e(rt,pa),w(_o,pa,null),e(Me,ed),e(Me,fa),e(fa,td),_(t,vn,u),_(t,K,u),w(To,K,null),e(K,od),e(K,bo),e(bo,sd),e(bo,yo),e(yo,ad),e(bo,nd),e(K,rd),e(K,Y),w(vo,Y,null),e(Y,id),e(Y,$e),e($e,ld),e($e,cs),e(cs,dd),e($e,cd),e($e,ga),e(ga,hd),e($e,md),e(Y,pd),w(it,Y,null),e(Y,fd),w(lt,Y,null),_(t,wn,u),_(t,Ie,u),e(Ie,dt),e(dt,ua),w(wo,ua,null),e(Ie,gd),e(Ie,_a),e(_a,ud),_(t,Mn,u),_(t,ee,u),w(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,vd),e(ke,wd),e(ee,Md),e(ee,A),w(ko,A,null),e(A,$d),e(A,Fe),e(Fe,Id),e(Fe,hs),e(hs,kd),e(Fe,Fd),e(Fe,Ta),e(Ta,jd),e(Fe,Dd),e(A,Wd),w(ct,A,null),e(A,Jd),w(ht,A,null),_(t,$n,u),_(t,je,u),e(je,mt),e(mt,ba),w(Fo,ba,null),e(je,Ed),e(je,ya),e(ya,Cd),_(t,In,u),_(t,z,u),w(jo,z,null),e(z,Zd),e(z,va),e(va,Ud),e(z,Nd),e(z,Do),e(Do,xd),e(Do,Wo),e(Wo,zd),e(Do,Gd),e(z,Rd),e(z,S),w(Jo,S,null),e(S,Bd),e(S,De),e(De,Vd),e(De,ms),e(ms,Pd),e(De,Xd),e(De,wa),e(wa,Yd),e(De,Ad),e(S,Sd),w(pt,S,null),e(S,qd),w(ft,S,null),_(t,kn,u),_(t,We,u),e(We,gt),e(gt,Ma),w(Eo,Ma,null),e(We,Qd),e(We,$a),e($a,Ld),_(t,Fn,u),_(t,J,u),w(Co,J,null),e(J,Hd),e(J,Ia),e(Ia,Od),e(J,Kd),e(J,ka),e(ka,ec),e(J,tc),e(J,Fa),e(Fa,oc),e(J,sc),e(J,Zo),e(Zo,ac),e(Zo,Uo),e(Uo,nc),e(Zo,rc),e(J,ic),e(J,q),w(No,q,null),e(q,lc),e(q,Je),e(Je,dc),e(Je,ps),e(ps,cc),e(Je,hc),e(Je,ja),e(ja,mc),e(Je,pc),e(q,fc),w(ut,q,null),e(q,gc),w(_t,q,null),jn=!0},p(t,[u]){const xo={};u&2&&(xo.$$scope={dirty:u,ctx:t}),Ne.$set(xo);const Da={};u&2&&(Da.$$scope={dirty:u,ctx:t}),Ve.$set(Da);const Wa={};u&2&&(Wa.$$scope={dirty:u,ctx:t}),qe.$set(Wa);const Ja={};u&2&&(Ja.$$scope={dirty:u,ctx:t}),Qe.$set(Ja);const zo={};u&2&&(zo.$$scope={dirty:u,ctx:t}),He.$set(zo);const Ea={};u&2&&(Ea.$$scope={dirty:u,ctx:t}),Oe.$set(Ea);const Ca={};u&2&&(Ca.$$scope={dirty:u,ctx:t}),Ke.$set(Ca);const Za={};u&2&&(Za.$$scope={dirty:u,ctx:t}),tt.$set(Za);const te={};u&2&&(te.$$scope={dirty:u,ctx:t}),ot.$set(te);const Ua={};u&2&&(Ua.$$scope={dirty:u,ctx:t}),at.$set(Ua);const Na={};u&2&&(Na.$$scope={dirty:u,ctx:t}),nt.$set(Na);const xa={};u&2&&(xa.$$scope={dirty:u,ctx:t}),it.$set(xa);const za={};u&2&&(za.$$scope={dirty:u,ctx:t}),lt.$set(za);const Ga={};u&2&&(Ga.$$scope={dirty:u,ctx:t}),ct.$set(Ga);const Ra={};u&2&&(Ra.$$scope={dirty:u,ctx:t}),ht.$set(Ra);const Ba={};u&2&&(Ba.$$scope={dirty:u,ctx:t}),pt.$set(Ba);const G={};u&2&&(G.$$scope={dirty:u,ctx:t}),ft.$set(G);const Va={};u&2&&(Va.$$scope={dirty:u,ctx:t}),ut.$set(Va);const Ee={};u&2&&(Ee.$$scope={dirty:u,ctx:t}),_t.$set(Ee)},i(t){jn||(M(s.$$.fragment,t),M(Ne.$$.fragment,t),M(Dt.$$.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(ho.$$.fragment,t),M(tt.$$.fragment,t),M(ot.$$.fragment,t),M(mo.$$.fragment,t),M(po.$$.fragment,t),M(uo.$$.fragment,t),M(at.$$.fragment,t),M(nt.$$.fragment,t),M(_o.$$.fragment,t),M(To.$$.fragment,t),M(vo.$$.fragment,t),M(it.$$.fragment,t),M(lt.$$.fragment,t),M(wo.$$.fragment,t),M(Mo.$$.fragment,t),M(ko.$$.fragment,t),M(ct.$$.fragment,t),M(ht.$$.fragment,t),M(Fo.$$.fragment,t),M(jo.$$.fragment,t),M(Jo.$$.fragment,t),M(pt.$$.fragment,t),M(ft.$$.fragment,t),M(Eo.$$.fragment,t),M(Co.$$.fragment,t),M(No.$$.fragment,t),M(ut.$$.fragment,t),M(_t.$$.fragment,t),jn=!0)},o(t){$(s.$$.fragment,t),$(Ne.$$.fragment,t),$(Dt.$$.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),$(ho.$$.fragment,t),$(tt.$$.fragment,t),$(ot.$$.fragment,t),$(mo.$$.fragment,t),$(po.$$.fragment,t),$(uo.$$.fragment,t),$(at.$$.fragment,t),$(nt.$$.fragment,t),$(_o.$$.fragment,t),$(To.$$.fragment,t),$(vo.$$.fragment,t),$(it.$$.fragment,t),$(lt.$$.fragment,t),$(wo.$$.fragment,t),$(Mo.$$.fragment,t),$(ko.$$.fragment,t),$(ct.$$.fragment,t),$(ht.$$.fragment,t),$(Fo.$$.fragment,t),$(jo.$$.fragment,t),$(Jo.$$.fragment,t),$(pt.$$.fragment,t),$(ft.$$.fragment,t),$(Eo.$$.fragment,t),$(Co.$$.fragment,t),$(No.$$.fragment,t),$(ut.$$.fragment,t),$(_t.$$.fragment,t),jn=!1},d(t){o(d),t&&o(b),t&&o(g),I(s),t&&o(Xa),I(Ne,t),t&&o(Ya),t&&o(re),I(Dt),t&&o(Aa),t&&o(R),t&&o(Sa),t&&o(Bo),t&&o(qa),t&&o(Vo),t&&o(Qa),t&&o(Po),t&&o(La),t&&o(Z),t&&o(Ha),t&&o(oe),t&&o(Oa),t&&o(le),I(Zt),t&&o(Ka),t&&o(Qo),t&&o(en),I(Ut,t),t&&o(tn),t&&o(Ge),t&&o(on),t&&o(Ko),t&&o(sn),t&&o(es),t&&o(an),t&&o(os),t&&o(nn),t&&o(de),I(Gt),t&&o(rn),t&&o(N),I(Rt),I(Ve),t&&o(ln),t&&o(me),I(Vt),t&&o(dn),t&&o(pe),I(Pt),I(Xt),t&&o(cn),t&&o(fe),I(Yt),t&&o(hn),t&&o(H),I(At),I(St),t&&o(mn),t&&o(ge),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(gn),t&&o(C),I(eo),I(He),I(no),I(Oe),I(Ke),t&&o(un),t&&o(be),I(ro),t&&o(_n),t&&o(x),I(io),I(ho),I(tt),I(ot),t&&o(Tn),t&&o(ve),I(mo),t&&o(bn),t&&o(W),I(po),I(uo),I(at),I(nt),t&&o(yn),t&&o(Me),I(_o),t&&o(vn),t&&o(K),I(To),I(vo),I(it),I(lt),t&&o(wn),t&&o(Ie),I(wo),t&&o(Mn),t&&o(ee),I(Mo),I(ko),I(ct),I(ht),t&&o($n),t&&o(je),I(Fo),t&&o(In),t&&o(z),I(jo),I(Jo),I(pt),I(ft),t&&o(kn),t&&o(We),I(Eo),t&&o(Fn),t&&o(J),I(Co),I(No),I(ut),I(_t)}}}const Um={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 Nm(k){return pm(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Xm extends dm{constructor(d){super();cm(this,d,Nm,Zm,hm,{})}}export{Xm as default,Um as metadata};
