import{S as dh,i as ch,s as ph,e as a,k as h,w as b,t as i,M as hh,c as r,d as o,m,a as n,x as w,h as l,b as c,G as e,g as _,y as $,q as y,o as k,B as D,v as mh,L as Ae}from"../../chunks/vendor-hf-doc-builder.js";import{T as re}from"../../chunks/Tip-hf-doc-builder.js";import{D as x}from"../../chunks/Docstring-hf-doc-builder.js";import{C as ze}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as z}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Ce}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";import{P as fh}from"../../chunks/PipelineTag-hf-doc-builder.js";function gh(I){let d,v,g,f,T;return{c(){d=a("p"),v=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=r(s,"P",{});var p=n(d);v=l(p,`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=r(p,"A",{href:!0,rel:!0});var F=n(g);f=l(F,"Github Issue"),F.forEach(o),T=l(p,"."),p.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,p){_(s,d,p),e(d,v),e(d,g),e(g,f),e(d,T)},d(s){s&&o(d)}}}function uh(I){let d,v,g,f,T;return f=new ze({props:{code:`from transformers import DeiTConfig, DeiTModel

# Initializing a DeiT deit-base-distilled-patch16-224 style configuration
configuration = DeiTConfig()

# Initializing a model (with random weights) from the deit-base-distilled-patch16-224 style configuration
model = DeiTModel(configuration)

# Accessing the model configuration
configuration = model.config`,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"),v=i("Example:"),g=h(),b(f.$$.fragment)},l(s){d=r(s,"P",{});var p=n(d);v=l(p,"Example:"),p.forEach(o),g=m(s),w(f.$$.fragment,s)},m(s,p){_(s,d,p),e(d,v),_(s,g,p),$(f,s,p),T=!0},p:Ae,i(s){T||(y(f.$$.fragment,s),T=!0)},o(s){k(f.$$.fragment,s),T=!1},d(s){s&&o(d),s&&o(g),D(f,s)}}}function _h(I){let d,v,g,f,T;return{c(){d=a("p"),v=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=r(s,"P",{});var p=n(d);v=l(p,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=r(p,"CODE",{});var F=n(g);f=l(F,"Module"),F.forEach(o),T=l(p,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),p.forEach(o)},m(s,p){_(s,d,p),e(d,v),e(d,g),e(g,f),e(d,T)},d(s){s&&o(d)}}}function Th(I){let d,v,g,f,T;return f=new ze({props:{code:`from transformers import AutoImageProcessor, DeiTModel
import torch
from datasets import load_dataset

dataset = load_dataset("huggingface/cats-image")
image = dataset["test"]["image"][0]

image_processor = AutoImageProcessor.from_pretrained("facebook/deit-base-distilled-patch16-224")
model = DeiTModel.from_pretrained("facebook/deit-base-distilled-patch16-224")

inputs = image_processor(image, return_tensors="pt")

with torch.no_grad():
    outputs = model(**inputs)

last_hidden_states = outputs.last_hidden_state
list(last_hidden_states.shape)`,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"),v=i("Example:"),g=h(),b(f.$$.fragment)},l(s){d=r(s,"P",{});var p=n(d);v=l(p,"Example:"),p.forEach(o),g=m(s),w(f.$$.fragment,s)},m(s,p){_(s,d,p),e(d,v),_(s,g,p),$(f,s,p),T=!0},p:Ae,i(s){T||(y(f.$$.fragment,s),T=!0)},o(s){k(f.$$.fragment,s),T=!1},d(s){s&&o(d),s&&o(g),D(f,s)}}}function vh(I){let d,v,g,f,T;return{c(){d=a("p"),v=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=r(s,"P",{});var p=n(d);v=l(p,"Note that we provide a script to pre-train this model on custom data in our "),g=r(p,"A",{href:!0,rel:!0});var F=n(g);f=l(F,`examples
directory`),F.forEach(o),T=l(p,"."),p.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,p){_(s,d,p),e(d,v),e(d,g),e(g,f),e(d,T)},d(s){s&&o(d)}}}function bh(I){let d,v,g,f,T;return{c(){d=a("p"),v=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=r(s,"P",{});var p=n(d);v=l(p,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=r(p,"CODE",{});var F=n(g);f=l(F,"Module"),F.forEach(o),T=l(p,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),p.forEach(o)},m(s,p){_(s,d,p),e(d,v),e(d,g),e(g,f),e(d,T)},d(s){s&&o(d)}}}function wh(I){let d,v,g,f,T;return f=new ze({props:{code:`from transformers import AutoImageProcessor, DeiTForMaskedImageModeling
import torch
from PIL import Image
import requests

url = "http://images.cocodataset.org/val2017/000000039769.jpg"
image = Image.open(requests.get(url, stream=True).raw)

image_processor = AutoImageProcessor.from_pretrained("facebook/deit-base-distilled-patch16-224")
model = DeiTForMaskedImageModeling.from_pretrained("facebook/deit-base-distilled-patch16-224")

num_patches = (model.config.image_size // model.config.patch_size) ** 2
pixel_values = image_processor(images=image, return_tensors="pt").pixel_values
# create random boolean mask of shape (batch_size, num_patches)
bool_masked_pos = torch.randint(low=0, high=2, size=(1, num_patches)).bool()

outputs = model(pixel_values, bool_masked_pos=bool_masked_pos)
loss, reconstructed_pixel_values = outputs.loss, outputs.reconstruction
list(reconstructed_pixel_values.shape)`,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"),v=i("Examples:"),g=h(),b(f.$$.fragment)},l(s){d=r(s,"P",{});var p=n(d);v=l(p,"Examples:"),p.forEach(o),g=m(s),w(f.$$.fragment,s)},m(s,p){_(s,d,p),e(d,v),_(s,g,p),$(f,s,p),T=!0},p:Ae,i(s){T||(y(f.$$.fragment,s),T=!0)},o(s){k(f.$$.fragment,s),T=!1},d(s){s&&o(d),s&&o(g),D(f,s)}}}function $h(I){let d,v,g,f,T;return{c(){d=a("p"),v=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=r(s,"P",{});var p=n(d);v=l(p,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=r(p,"CODE",{});var F=n(g);f=l(F,"Module"),F.forEach(o),T=l(p,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),p.forEach(o)},m(s,p){_(s,d,p),e(d,v),e(d,g),e(g,f),e(d,T)},d(s){s&&o(d)}}}function yh(I){let d,v,g,f,T;return f=new ze({props:{code:`from transformers import AutoImageProcessor, DeiTForImageClassification
import torch
from PIL import Image
import requests

torch.manual_seed(3)
url = "http://images.cocodataset.org/val2017/000000039769.jpg"
image = Image.open(requests.get(url, stream=True).raw)

# note: we are loading a DeiTForImageClassificationWithTeacher from the hub here,
# so the head will be randomly initialized, hence the predictions will be random
image_processor = AutoImageProcessor.from_pretrained("facebook/deit-base-distilled-patch16-224")
model = DeiTForImageClassification.from_pretrained("facebook/deit-base-distilled-patch16-224")

inputs = image_processor(images=image, return_tensors="pt")
outputs = model(**inputs)
logits = outputs.logits
# model predicts one of the 1000 ImageNet classes
predicted_class_idx = logits.argmax(-1).item()
print("Predicted class:", model.config.id2label[predicted_class_idx])`,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"),v=i("Examples:"),g=h(),b(f.$$.fragment)},l(s){d=r(s,"P",{});var p=n(d);v=l(p,"Examples:"),p.forEach(o),g=m(s),w(f.$$.fragment,s)},m(s,p){_(s,d,p),e(d,v),_(s,g,p),$(f,s,p),T=!0},p:Ae,i(s){T||(y(f.$$.fragment,s),T=!0)},o(s){k(f.$$.fragment,s),T=!1},d(s){s&&o(d),s&&o(g),D(f,s)}}}function kh(I){let d,v,g,f,T;return{c(){d=a("p"),v=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=r(s,"P",{});var p=n(d);v=l(p,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=r(p,"CODE",{});var F=n(g);f=l(F,"Module"),F.forEach(o),T=l(p,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),p.forEach(o)},m(s,p){_(s,d,p),e(d,v),e(d,g),e(g,f),e(d,T)},d(s){s&&o(d)}}}function Dh(I){let d,v,g,f,T;return f=new ze({props:{code:`from transformers import AutoImageProcessor, DeiTForImageClassificationWithTeacher
import torch
from datasets import load_dataset

dataset = load_dataset("huggingface/cats-image")
image = dataset["test"]["image"][0]

image_processor = AutoImageProcessor.from_pretrained("facebook/deit-base-distilled-patch16-224")
model = DeiTForImageClassificationWithTeacher.from_pretrained("facebook/deit-base-distilled-patch16-224")

inputs = image_processor(image, return_tensors="pt")

with torch.no_grad():
    logits = model(**inputs).logits

# model predicts one of the 1000 ImageNet classes
predicted_label = logits.argmax(-1).item()
print(model.config.id2label[predicted_label])`,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"),v=i("Example:"),g=h(),b(f.$$.fragment)},l(s){d=r(s,"P",{});var p=n(d);v=l(p,"Example:"),p.forEach(o),g=m(s),w(f.$$.fragment,s)},m(s,p){_(s,d,p),e(d,v),_(s,g,p),$(f,s,p),T=!0},p:Ae,i(s){T||(y(f.$$.fragment,s),T=!0)},o(s){k(f.$$.fragment,s),T=!1},d(s){s&&o(d),s&&o(g),D(f,s)}}}function Ih(I){let d,v,g,f,T;return{c(){d=a("p"),v=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=r(s,"P",{});var p=n(d);v=l(p,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=r(p,"CODE",{});var F=n(g);f=l(F,"Module"),F.forEach(o),T=l(p,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),p.forEach(o)},m(s,p){_(s,d,p),e(d,v),e(d,g),e(g,f),e(d,T)},d(s){s&&o(d)}}}function Fh(I){let d,v,g,f,T;return f=new ze({props:{code:`from transformers import AutoImageProcessor, TFDeiTModel
from datasets import load_dataset

dataset = load_dataset("huggingface/cats-image")
image = dataset["test"]["image"][0]

image_processor = AutoImageProcessor.from_pretrained("facebook/deit-base-distilled-patch16-224")
model = TFDeiTModel.from_pretrained("facebook/deit-base-distilled-patch16-224")

inputs = image_processor(image, return_tensors="tf")
outputs = model(**inputs)

last_hidden_states = outputs.last_hidden_state
list(last_hidden_states.shape)`,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"),v=i("Example:"),g=h(),b(f.$$.fragment)},l(s){d=r(s,"P",{});var p=n(d);v=l(p,"Example:"),p.forEach(o),g=m(s),w(f.$$.fragment,s)},m(s,p){_(s,d,p),e(d,v),_(s,g,p),$(f,s,p),T=!0},p:Ae,i(s){T||(y(f.$$.fragment,s),T=!0)},o(s){k(f.$$.fragment,s),T=!1},d(s){s&&o(d),s&&o(g),D(f,s)}}}function xh(I){let d,v,g,f,T;return{c(){d=a("p"),v=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=r(s,"P",{});var p=n(d);v=l(p,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=r(p,"CODE",{});var F=n(g);f=l(F,"Module"),F.forEach(o),T=l(p,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),p.forEach(o)},m(s,p){_(s,d,p),e(d,v),e(d,g),e(g,f),e(d,T)},d(s){s&&o(d)}}}function Mh(I){let d,v,g,f,T;return f=new ze({props:{code:`from transformers import AutoImageProcessor, TFDeiTForMaskedImageModeling
import tensorflow as tf
from PIL import Image
import requests

url = "http://images.cocodataset.org/val2017/000000039769.jpg"
image = Image.open(requests.get(url, stream=True).raw)

image_processor = AutoImageProcessor.from_pretrained("facebook/deit-base-distilled-patch16-224")
model = TFDeiTForMaskedImageModeling.from_pretrained("facebook/deit-base-distilled-patch16-224")

num_patches = (model.config.image_size // model.config.patch_size) ** 2
pixel_values = image_processor(images=image, return_tensors="tf").pixel_values
# create random boolean mask of shape (batch_size, num_patches)
bool_masked_pos = tf.cast(tf.random.uniform((1, num_patches), minval=0, maxval=2, dtype=tf.int32), tf.bool)

outputs = model(pixel_values, bool_masked_pos=bool_masked_pos)
loss, reconstructed_pixel_values = outputs.loss, outputs.reconstruction
list(reconstructed_pixel_values.shape)`,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"),v=i("Examples:"),g=h(),b(f.$$.fragment)},l(s){d=r(s,"P",{});var p=n(d);v=l(p,"Examples:"),p.forEach(o),g=m(s),w(f.$$.fragment,s)},m(s,p){_(s,d,p),e(d,v),_(s,g,p),$(f,s,p),T=!0},p:Ae,i(s){T||(y(f.$$.fragment,s),T=!0)},o(s){k(f.$$.fragment,s),T=!1},d(s){s&&o(d),s&&o(g),D(f,s)}}}function jh(I){let d,v,g,f,T;return{c(){d=a("p"),v=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=r(s,"P",{});var p=n(d);v=l(p,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=r(p,"CODE",{});var F=n(g);f=l(F,"Module"),F.forEach(o),T=l(p,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),p.forEach(o)},m(s,p){_(s,d,p),e(d,v),e(d,g),e(g,f),e(d,T)},d(s){s&&o(d)}}}function Ph(I){let d,v,g,f,T;return f=new ze({props:{code:`from transformers import AutoImageProcessor, TFDeiTForImageClassification
import tensorflow as tf
from PIL import Image
import requests

tf.keras.utils.set_random_seed(3)
url = "http://images.cocodataset.org/val2017/000000039769.jpg"
image = Image.open(requests.get(url, stream=True).raw)

# note: we are loading a TFDeiTForImageClassificationWithTeacher from the hub here,
# so the head will be randomly initialized, hence the predictions will be random
image_processor = AutoImageProcessor.from_pretrained("facebook/deit-base-distilled-patch16-224")
model = TFDeiTForImageClassification.from_pretrained("facebook/deit-base-distilled-patch16-224")

inputs = image_processor(images=image, return_tensors="tf")
outputs = model(**inputs)
logits = outputs.logits
# model predicts one of the 1000 ImageNet classes
predicted_class_idx = tf.math.argmax(logits, axis=-1)[0]
print("Predicted class:", model.config.id2label[int(predicted_class_idx)])`,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"),v=i("Examples:"),g=h(),b(f.$$.fragment)},l(s){d=r(s,"P",{});var p=n(d);v=l(p,"Examples:"),p.forEach(o),g=m(s),w(f.$$.fragment,s)},m(s,p){_(s,d,p),e(d,v),_(s,g,p),$(f,s,p),T=!0},p:Ae,i(s){T||(y(f.$$.fragment,s),T=!0)},o(s){k(f.$$.fragment,s),T=!1},d(s){s&&o(d),s&&o(g),D(f,s)}}}function Eh(I){let d,v,g,f,T;return{c(){d=a("p"),v=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=r(s,"P",{});var p=n(d);v=l(p,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=r(p,"CODE",{});var F=n(g);f=l(F,"Module"),F.forEach(o),T=l(p,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),p.forEach(o)},m(s,p){_(s,d,p),e(d,v),e(d,g),e(g,f),e(d,T)},d(s){s&&o(d)}}}function Ch(I){let d,v,g,f,T;return f=new ze({props:{code:`from transformers import AutoImageProcessor, TFDeiTForImageClassificationWithTeacher
import tensorflow as tf
from datasets import load_dataset

dataset = load_dataset("huggingface/cats-image")
image = dataset["test"]["image"][0]

image_processor = AutoImageProcessor.from_pretrained("facebook/deit-base-distilled-patch16-224")
model = TFDeiTForImageClassificationWithTeacher.from_pretrained("facebook/deit-base-distilled-patch16-224")

inputs = image_processor(image, return_tensors="tf")
logits = model(**inputs).logits

# model predicts one of the 1000 ImageNet classes
predicted_label = int(tf.math.argmax(logits, axis=-1))
print(model.config.id2label[predicted_label])`,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"),v=i("Example:"),g=h(),b(f.$$.fragment)},l(s){d=r(s,"P",{});var p=n(d);v=l(p,"Example:"),p.forEach(o),g=m(s),w(f.$$.fragment,s)},m(s,p){_(s,d,p),e(d,v),_(s,g,p),$(f,s,p),T=!0},p:Ae,i(s){T||(y(f.$$.fragment,s),T=!0)},o(s){k(f.$$.fragment,s),T=!1},d(s){s&&o(d),s&&o(g),D(f,s)}}}function Ah(I){let d,v,g,f,T,s,p,F,Qr,Ha,qe,Ua,ne,Ne,js,Mt,Zr,Ps,en,Ba,L,tn,jt,on,sn,Lo,an,rn,Pt,nn,ln,Ja,So,dn,Ga,Ro,Es,cn,Ka,Vo,pn,Ya,A,Cs,hn,mn,ie,fn,Ho,gn,un,Uo,_n,Tn,vn,As,bn,wn,zs,$n,yn,M,kn,Bo,Dn,In,Jo,Fn,xn,qs,Mn,jn,Ns,Pn,En,Os,Cn,An,Ws,zn,qn,Go,Nn,On,Xa,oe,Wn,Et,Ln,Sn,Ct,Rn,Vn,Qa,le,Oe,Ls,At,Hn,Ss,Un,Za,Ko,Bn,er,zt,tr,We,se,Yo,Jn,Gn,qt,Kn,Yn,Nt,Xn,Qn,Zn,Xo,ei,Qo,ti,or,Zo,oi,sr,es,Le,ts,si,ai,Ot,ri,ni,ar,os,ii,rr,de,Se,Rs,Wt,li,Vs,di,nr,q,Lt,ci,ce,pi,ss,hi,mi,St,fi,gi,ui,pe,_i,as,Ti,vi,rs,bi,wi,$i,Re,ir,he,Ve,Hs,Rt,yi,Us,ki,lr,me,Vt,Di,He,Ht,Ii,Bs,Fi,dr,fe,Ue,Js,Ut,xi,Gs,Mi,cr,X,Bt,ji,Ks,Pi,Ei,Be,Jt,Ci,Ys,Ai,pr,ge,Je,Xs,Gt,zi,Qs,qi,hr,Q,Kt,Ni,Yt,Oi,Xt,Wi,Li,Si,S,Qt,Ri,ue,Vi,ns,Hi,Ui,Zs,Bi,Ji,Gi,Ge,Ki,Ke,mr,_e,Ye,ea,Zt,Yi,ta,Xi,fr,C,eo,Qi,to,Zi,oo,el,tl,ol,Xe,sl,so,al,ao,rl,nl,il,R,ro,ll,Te,dl,is,cl,pl,oa,hl,ml,fl,Qe,gl,Ze,gr,ve,et,sa,no,ul,aa,_l,ur,N,io,Tl,ra,vl,bl,lo,wl,co,$l,yl,kl,V,po,Dl,be,Il,ls,Fl,xl,na,Ml,jl,Pl,tt,El,ot,_r,we,st,ia,ho,Cl,la,Al,Tr,j,mo,zl,da,ql,Nl,ca,Ol,Wl,pa,Ll,Sl,fo,Rl,go,Vl,Hl,Ul,H,uo,Bl,$e,Jl,ds,Gl,Kl,ha,Yl,Xl,Ql,at,Zl,rt,vr,ye,nt,ma,_o,ed,fa,td,br,Z,To,od,vo,sd,bo,ad,rd,nd,U,wo,id,ke,ld,cs,dd,cd,ga,pd,hd,md,it,fd,lt,wr,De,dt,ua,$o,gd,_a,ud,$r,ee,yo,_d,Ie,Td,ko,vd,bd,Do,wd,$d,yd,B,Io,kd,Fe,Dd,ps,Id,Fd,Ta,xd,Md,jd,ct,Pd,pt,yr,xe,ht,va,Fo,Ed,ba,Cd,kr,O,xo,Ad,wa,zd,qd,Mo,Nd,jo,Od,Wd,Ld,J,Po,Sd,Me,Rd,hs,Vd,Hd,$a,Ud,Bd,Jd,mt,Gd,ft,Dr,je,gt,ya,Eo,Kd,ka,Yd,Ir,P,Co,Xd,Da,Qd,Zd,Ia,ec,tc,Fa,oc,sc,Ao,ac,zo,rc,nc,ic,G,qo,lc,Pe,dc,ms,cc,pc,xa,hc,mc,fc,ut,gc,_t,Fr;return s=new z({}),qe=new re({props:{$$slots:{default:[gh]},$$scope:{ctx:I}}}),Mt=new z({}),At=new z({}),zt=new fh({props:{pipeline:"image-classification"}}),Wt=new z({}),Lt=new x({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.29.0/src/transformers/models/deit/configuration_deit.py#L37"}}),Re=new Ce({props:{anchor:"transformers.DeiTConfig.example",$$slots:{default:[uh]},$$scope:{ctx:I}}}),Rt=new z({}),Vt=new x({props:{name:"class transformers.DeiTFeatureExtractor",anchor:"transformers.DeiTFeatureExtractor",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/deit/feature_extraction_deit.py#L26"}}),Ht=new x({props:{name:"__call__",anchor:"transformers.DeiTFeatureExtractor.__call__",parameters:[{name:"images",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/image_processing_utils.py#L462"}}),Ut=new z({}),Bt=new x({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.29.0/src/transformers/models/deit/image_processing_deit.py#L43"}}),Jt=new x({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.29.0/src/transformers/models/deit/image_processing_deit.py#L205"}}),Gt=new z({}),Kt=new x({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.29.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.29.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.29.0/src/transformers/models/deit/modeling_deit.py#L461"}}),Qt=new x({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.29.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/v4.29.0/en/model_doc/dpt#transformers.DPTFeatureExtractor.__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.29.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.29.0/src/transformers/models/deit/modeling_deit.py#L486",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.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.29.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.29.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ge=new re({props:{$$slots:{default:[_h]},$$scope:{ctx:I}}}),Ke=new Ce({props:{anchor:"transformers.DeiTModel.forward.example",$$slots:{default:[Th]},$$scope:{ctx:I}}}),Zt=new z({}),eo=new x({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.29.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.29.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.29.0/src/transformers/models/deit/modeling_deit.py#L581"}}),Xe=new re({props:{$$slots:{default:[vh]},$$scope:{ctx:I}}}),ro=new x({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.29.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/v4.29.0/en/model_doc/dpt#transformers.DPTFeatureExtractor.__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.29.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.29.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.29.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>
`}}),Qe=new re({props:{$$slots:{default:[bh]},$$scope:{ctx:I}}}),Ze=new Ce({props:{anchor:"transformers.DeiTForMaskedImageModeling.forward.example",$$slots:{default:[wh]},$$scope:{ctx:I}}}),no=new z({}),io=new x({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.29.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.29.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.29.0/src/transformers/models/deit/modeling_deit.py#L693"}}),po=new x({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.29.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/v4.29.0/en/model_doc/dpt#transformers.DPTFeatureExtractor.__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.29.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.29.0/src/transformers/models/deit/modeling_deit.py#L706",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.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.29.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.29.0/en/main_classes/output#transformers.modeling_outputs.ImageClassifierOutput"
>transformers.modeling_outputs.ImageClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),tt=new re({props:{$$slots:{default:[$h]},$$scope:{ctx:I}}}),ot=new Ce({props:{anchor:"transformers.DeiTForImageClassification.forward.example",$$slots:{default:[yh]},$$scope:{ctx:I}}}),ho=new z({}),mo=new x({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.29.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.29.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.29.0/src/transformers/models/deit/modeling_deit.py#L843"}}),uo=new x({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.29.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/v4.29.0/en/model_doc/dpt#transformers.DPTFeatureExtractor.__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.29.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.29.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.29.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 re({props:{$$slots:{default:[kh]},$$scope:{ctx:I}}}),rt=new Ce({props:{anchor:"transformers.DeiTForImageClassificationWithTeacher.forward.example",$$slots:{default:[Dh]},$$scope:{ctx:I}}}),_o=new z({}),To=new x({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.29.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.29.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.29.0/src/transformers/models/deit/modeling_tf_deit.py#L640"}}),wo=new x({props:{name:"call",anchor:"transformers.TFDeiTModel.call",parameters:[{name:"pixel_values",val:": typing.Optional[tensorflow.python.framework.ops.Tensor] = None"},{name:"bool_masked_pos",val:": typing.Optional[tensorflow.python.framework.ops.Tensor] = None"},{name:"head_mask",val:": typing.Optional[tensorflow.python.framework.ops.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"},{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.29.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/v4.29.0/en/model_doc/dpt#transformers.DPTFeatureExtractor.__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.29.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.29.0/src/transformers/models/deit/modeling_tf_deit.py#L650",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.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.29.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.29.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 re({props:{$$slots:{default:[Ih]},$$scope:{ctx:I}}}),lt=new Ce({props:{anchor:"transformers.TFDeiTModel.call.example",$$slots:{default:[Fh]},$$scope:{ctx:I}}}),$o=new z({}),yo=new x({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.29.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.29.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.29.0/src/transformers/models/deit/modeling_tf_deit.py#L759"}}),Io=new x({props:{name:"call",anchor:"transformers.TFDeiTForMaskedImageModeling.call",parameters:[{name:"pixel_values",val:": typing.Optional[tensorflow.python.framework.ops.Tensor] = None"},{name:"bool_masked_pos",val:": typing.Optional[tensorflow.python.framework.ops.Tensor] = None"},{name:"head_mask",val:": typing.Optional[tensorflow.python.framework.ops.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"},{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.29.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/v4.29.0/en/model_doc/dpt#transformers.DPTFeatureExtractor.__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.29.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.29.0/src/transformers/models/deit/modeling_tf_deit.py#L766",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.29.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 re({props:{$$slots:{default:[xh]},$$scope:{ctx:I}}}),pt=new Ce({props:{anchor:"transformers.TFDeiTForMaskedImageModeling.call.example",$$slots:{default:[Mh]},$$scope:{ctx:I}}}),Fo=new z({}),xo=new x({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.29.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.29.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.29.0/src/transformers/models/deit/modeling_tf_deit.py#L882"}}),Po=new x({props:{name:"call",anchor:"transformers.TFDeiTForImageClassification.call",parameters:[{name:"pixel_values",val:": typing.Optional[tensorflow.python.framework.ops.Tensor] = None"},{name:"head_mask",val:": typing.Optional[tensorflow.python.framework.ops.Tensor] = None"},{name:"labels",val:": typing.Optional[tensorflow.python.framework.ops.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"},{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.29.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/v4.29.0/en/model_doc/dpt#transformers.DPTFeatureExtractor.__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.29.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.29.0/src/transformers/models/deit/modeling_tf_deit.py#L896",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.29.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>
`}}),mt=new re({props:{$$slots:{default:[jh]},$$scope:{ctx:I}}}),ft=new Ce({props:{anchor:"transformers.TFDeiTForImageClassification.call.example",$$slots:{default:[Ph]},$$scope:{ctx:I}}}),Eo=new z({}),Co=new x({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.29.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.29.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.29.0/src/transformers/models/deit/modeling_tf_deit.py#L990"}}),qo=new x({props:{name:"call",anchor:"transformers.TFDeiTForImageClassificationWithTeacher.call",parameters:[{name:"pixel_values",val:": typing.Optional[tensorflow.python.framework.ops.Tensor] = None"},{name:"head_mask",val:": typing.Optional[tensorflow.python.framework.ops.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"},{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.29.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/v4.29.0/en/model_doc/dpt#transformers.DPTFeatureExtractor.__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.29.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.29.0/src/transformers/models/deit/modeling_tf_deit.py#L1009",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.29.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 re({props:{$$slots:{default:[Eh]},$$scope:{ctx:I}}}),_t=new Ce({props:{anchor:"transformers.TFDeiTForImageClassificationWithTeacher.call.example",$$slots:{default:[Ch]},$$scope:{ctx:I}}}),{c(){d=a("meta"),v=h(),g=a("h1"),f=a("a"),T=a("span"),b(s.$$.fragment),p=h(),F=a("span"),Qr=i("DeiT"),Ha=h(),b(qe.$$.fragment),Ua=h(),ne=a("h2"),Ne=a("a"),js=a("span"),b(Mt.$$.fragment),Zr=h(),Ps=a("span"),en=i("Overview"),Ba=h(),L=a("p"),tn=i("The DeiT model was proposed in "),jt=a("a"),on=i("Training data-efficient image transformers & distillation through attention"),sn=i(` by Hugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa, Alexandre
Sablayrolles, Herv\xE9 J\xE9gou. The `),Lo=a("a"),an=i("Vision Transformer (ViT)"),rn=i(" introduced in "),Pt=a("a"),nn=i("Dosovitskiy et al., 2020"),ln=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.`),Ja=h(),So=a("p"),dn=i("The abstract from the paper is the following:"),Ga=h(),Ro=a("p"),Es=a("em"),cn=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.`),Ka=h(),Vo=a("p"),pn=i("Tips:"),Ya=h(),A=a("ul"),Cs=a("li"),hn=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.`),mn=h(),ie=a("li"),fn=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
`),Ho=a("a"),gn=i("DeiTForImageClassification"),un=i(` and (2) corresponds to
`),Uo=a("a"),_n=i("DeiTForImageClassificationWithTeacher"),Tn=i("."),vn=h(),As=a("li"),bn=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.`),wn=h(),zs=a("li"),$n=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.`),yn=h(),M=a("li"),kn=i(`The authors of DeiT also released more efficiently trained ViT models, which you can directly plug into
`),Bo=a("a"),Dn=i("ViTModel"),In=i(" or "),Jo=a("a"),Fn=i("ViTForImageClassification"),xn=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):
`),qs=a("em"),Mn=i("facebook/deit-tiny-patch16-224"),jn=i(", "),Ns=a("em"),Pn=i("facebook/deit-small-patch16-224"),En=i(", "),Os=a("em"),Cn=i("facebook/deit-base-patch16-224"),An=i(` and
`),Ws=a("em"),zn=i("facebook/deit-base-patch16-384"),qn=i(". Note that one should use "),Go=a("a"),Nn=i("DeiTImageProcessor"),On=i(` in order to
prepare images for the model.`),Xa=h(),oe=a("p"),Wn=i("This model was contributed by "),Et=a("a"),Ln=i("nielsr"),Sn=i(". The TensorFlow version of this model was added by "),Ct=a("a"),Rn=i("amyeroberts"),Vn=i("."),Qa=h(),le=a("h2"),Oe=a("a"),Ls=a("span"),b(At.$$.fragment),Hn=h(),Ss=a("span"),Un=i("Resources"),Za=h(),Ko=a("p"),Bn=i("A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with DeiT."),er=h(),b(zt.$$.fragment),tr=h(),We=a("ul"),se=a("li"),Yo=a("a"),Jn=i("DeiTForImageClassification"),Gn=i(" is supported by this "),qt=a("a"),Kn=i("example script"),Yn=i(" and "),Nt=a("a"),Xn=i("notebook"),Qn=i("."),Zn=h(),Xo=a("li"),ei=i("See also: "),Qo=a("a"),ti=i("Image classification task guide"),or=h(),Zo=a("p"),oi=i("Besides that:"),sr=h(),es=a("ul"),Le=a("li"),ts=a("a"),si=i("DeiTForMaskedImageModeling"),ai=i(" is supported by this "),Ot=a("a"),ri=i("example script"),ni=i("."),ar=h(),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."),rr=h(),de=a("h2"),Se=a("a"),Rs=a("span"),b(Wt.$$.fragment),li=h(),Vs=a("span"),di=i("DeiTConfig"),nr=h(),q=a("div"),b(Lt.$$.fragment),ci=h(),ce=a("p"),pi=i("This is the configuration class to store the configuration of a "),ss=a("a"),hi=i("DeiTModel"),mi=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
`),St=a("a"),fi=i("facebook/deit-base-distilled-patch16-224"),gi=i(`
architecture.`),ui=h(),pe=a("p"),_i=i("Configuration objects inherit from "),as=a("a"),Ti=i("PretrainedConfig"),vi=i(` and can be used to control the model outputs. Read the
documentation from `),rs=a("a"),bi=i("PretrainedConfig"),wi=i(" for more information."),$i=h(),b(Re.$$.fragment),ir=h(),he=a("h2"),Ve=a("a"),Hs=a("span"),b(Rt.$$.fragment),yi=h(),Us=a("span"),ki=i("DeiTFeatureExtractor"),lr=h(),me=a("div"),b(Vt.$$.fragment),Di=h(),He=a("div"),b(Ht.$$.fragment),Ii=h(),Bs=a("p"),Fi=i("Preprocess an image or a batch of images."),dr=h(),fe=a("h2"),Ue=a("a"),Js=a("span"),b(Ut.$$.fragment),xi=h(),Gs=a("span"),Mi=i("DeiTImageProcessor"),cr=h(),X=a("div"),b(Bt.$$.fragment),ji=h(),Ks=a("p"),Pi=i("Constructs a DeiT image processor."),Ei=h(),Be=a("div"),b(Jt.$$.fragment),Ci=h(),Ys=a("p"),Ai=i("Preprocess an image or batch of images."),pr=h(),ge=a("h2"),Je=a("a"),Xs=a("span"),b(Gt.$$.fragment),zi=h(),Qs=a("span"),qi=i("DeiTModel"),hr=h(),Q=a("div"),b(Kt.$$.fragment),Ni=h(),Yt=a("p"),Oi=i(`The bare DeiT Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),Xt=a("a"),Wi=i("torch.nn.Module"),Li=i(` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Si=h(),S=a("div"),b(Qt.$$.fragment),Ri=h(),ue=a("p"),Vi=i("The "),ns=a("a"),Hi=i("DeiTModel"),Ui=i(" forward method, overrides the "),Zs=a("code"),Bi=i("__call__"),Ji=i(" special method."),Gi=h(),b(Ge.$$.fragment),Ki=h(),b(Ke.$$.fragment),mr=h(),_e=a("h2"),Ye=a("a"),ea=a("span"),b(Zt.$$.fragment),Yi=h(),ta=a("span"),Xi=i("DeiTForMaskedImageModeling"),fr=h(),C=a("div"),b(eo.$$.fragment),Qi=h(),to=a("p"),Zi=i("DeiT Model with a decoder on top for masked image modeling, as proposed in "),oo=a("a"),el=i("SimMIM"),tl=i("."),ol=h(),b(Xe.$$.fragment),sl=h(),so=a("p"),al=i("This model is a PyTorch "),ao=a("a"),rl=i("torch.nn.Module"),nl=i(` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),il=h(),R=a("div"),b(ro.$$.fragment),ll=h(),Te=a("p"),dl=i("The "),is=a("a"),cl=i("DeiTForMaskedImageModeling"),pl=i(" forward method, overrides the "),oa=a("code"),hl=i("__call__"),ml=i(" special method."),fl=h(),b(Qe.$$.fragment),gl=h(),b(Ze.$$.fragment),gr=h(),ve=a("h2"),et=a("a"),sa=a("span"),b(no.$$.fragment),ul=h(),aa=a("span"),_l=i("DeiTForImageClassification"),ur=h(),N=a("div"),b(io.$$.fragment),Tl=h(),ra=a("p"),vl=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.`),bl=h(),lo=a("p"),wl=i("This model is a PyTorch "),co=a("a"),$l=i("torch.nn.Module"),yl=i(` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),kl=h(),V=a("div"),b(po.$$.fragment),Dl=h(),be=a("p"),Il=i("The "),ls=a("a"),Fl=i("DeiTForImageClassification"),xl=i(" forward method, overrides the "),na=a("code"),Ml=i("__call__"),jl=i(" special method."),Pl=h(),b(tt.$$.fragment),El=h(),b(ot.$$.fragment),_r=h(),we=a("h2"),st=a("a"),ia=a("span"),b(ho.$$.fragment),Cl=h(),la=a("span"),Al=i("DeiTForImageClassificationWithTeacher"),Tr=h(),j=a("div"),b(mo.$$.fragment),zl=h(),da=a("p"),ql=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.`),Nl=h(),ca=a("p"),Ol=i(".. warning::"),Wl=h(),pa=a("p"),Ll=i(`This model supports inference-only. Fine-tuning with distillation (i.e. with a teacher) is not yet
supported.`),Sl=h(),fo=a("p"),Rl=i("This model is a PyTorch "),go=a("a"),Vl=i("torch.nn.Module"),Hl=i(` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Ul=h(),H=a("div"),b(uo.$$.fragment),Bl=h(),$e=a("p"),Jl=i("The "),ds=a("a"),Gl=i("DeiTForImageClassificationWithTeacher"),Kl=i(" forward method, overrides the "),ha=a("code"),Yl=i("__call__"),Xl=i(" special method."),Ql=h(),b(at.$$.fragment),Zl=h(),b(rt.$$.fragment),vr=h(),ye=a("h2"),nt=a("a"),ma=a("span"),b(_o.$$.fragment),ed=h(),fa=a("span"),td=i("TFDeiTModel"),br=h(),Z=a("div"),b(To.$$.fragment),od=h(),vo=a("p"),sd=i(`The bare DeiT Model transformer outputting raw hidden-states without any specific head on top.
This model is a TensorFlow
`),bo=a("a"),ad=i("tf.keras.layers.Layer"),rd=i(`. Use it as a regular
TensorFlow Module and refer to the TensorFlow documentation for all matter related to general usage and behavior.`),nd=h(),U=a("div"),b(wo.$$.fragment),id=h(),ke=a("p"),ld=i("The "),cs=a("a"),dd=i("TFDeiTModel"),cd=i(" forward method, overrides the "),ga=a("code"),pd=i("__call__"),hd=i(" special method."),md=h(),b(it.$$.fragment),fd=h(),b(lt.$$.fragment),wr=h(),De=a("h2"),dt=a("a"),ua=a("span"),b($o.$$.fragment),gd=h(),_a=a("span"),ud=i("TFDeiTForMaskedImageModeling"),$r=h(),ee=a("div"),b(yo.$$.fragment),_d=h(),Ie=a("p"),Td=i("DeiT Model with a decoder on top for masked image modeling, as proposed in "),ko=a("a"),vd=i("SimMIM"),bd=i(`.
This model is a TensorFlow
`),Do=a("a"),wd=i("tf.keras.layers.Layer"),$d=i(`. Use it as a regular
TensorFlow Module and refer to the TensorFlow documentation for all matter related to general usage and behavior.`),yd=h(),B=a("div"),b(Io.$$.fragment),kd=h(),Fe=a("p"),Dd=i("The "),ps=a("a"),Id=i("TFDeiTForMaskedImageModeling"),Fd=i(" forward method, overrides the "),Ta=a("code"),xd=i("__call__"),Md=i(" special method."),jd=h(),b(ct.$$.fragment),Pd=h(),b(pt.$$.fragment),yr=h(),xe=a("h2"),ht=a("a"),va=a("span"),b(Fo.$$.fragment),Ed=h(),ba=a("span"),Cd=i("TFDeiTForImageClassification"),kr=h(),O=a("div"),b(xo.$$.fragment),Ad=h(),wa=a("p"),zd=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.`),qd=h(),Mo=a("p"),Nd=i(`This model is a TensorFlow
`),jo=a("a"),Od=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.`),Ld=h(),J=a("div"),b(Po.$$.fragment),Sd=h(),Me=a("p"),Rd=i("The "),hs=a("a"),Vd=i("TFDeiTForImageClassification"),Hd=i(" forward method, overrides the "),$a=a("code"),Ud=i("__call__"),Bd=i(" special method."),Jd=h(),b(mt.$$.fragment),Gd=h(),b(ft.$$.fragment),Dr=h(),je=a("h2"),gt=a("a"),ya=a("span"),b(Eo.$$.fragment),Kd=h(),ka=a("span"),Yd=i("TFDeiTForImageClassificationWithTeacher"),Ir=h(),P=a("div"),b(Co.$$.fragment),Xd=h(),Da=a("p"),Qd=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.`),Zd=h(),Ia=a("p"),ec=i(".. warning::"),tc=h(),Fa=a("p"),oc=i(`This model supports inference-only. Fine-tuning with distillation (i.e. with a teacher) is not yet
supported.`),sc=h(),Ao=a("p"),ac=i(`This model is a TensorFlow
`),zo=a("a"),rc=i("tf.keras.layers.Layer"),nc=i(`. Use it as a regular
TensorFlow Module and refer to the TensorFlow documentation for all matter related to general usage and behavior.`),ic=h(),G=a("div"),b(qo.$$.fragment),lc=h(),Pe=a("p"),dc=i("The "),ms=a("a"),cc=i("TFDeiTForImageClassificationWithTeacher"),pc=i(" forward method, overrides the "),xa=a("code"),hc=i("__call__"),mc=i(" special method."),fc=h(),b(ut.$$.fragment),gc=h(),b(_t.$$.fragment),this.h()},l(t){const u=hh('[data-svelte="svelte-1phssyn"]',document.head);d=r(u,"META",{name:!0,content:!0}),u.forEach(o),v=m(t),g=r(t,"H1",{class:!0});var No=n(g);f=r(No,"A",{id:!0,class:!0,href:!0});var Ma=n(f);T=r(Ma,"SPAN",{});var ja=n(T);w(s.$$.fragment,ja),ja.forEach(o),Ma.forEach(o),p=m(No),F=r(No,"SPAN",{});var Pa=n(F);Qr=l(Pa,"DeiT"),Pa.forEach(o),No.forEach(o),Ha=m(t),w(qe.$$.fragment,t),Ua=m(t),ne=r(t,"H2",{class:!0});var Oo=n(ne);Ne=r(Oo,"A",{id:!0,class:!0,href:!0});var Ea=n(Ne);js=r(Ea,"SPAN",{});var Ca=n(js);w(Mt.$$.fragment,Ca),Ca.forEach(o),Ea.forEach(o),Zr=m(Oo),Ps=r(Oo,"SPAN",{});var Aa=n(Ps);en=l(Aa,"Overview"),Aa.forEach(o),Oo.forEach(o),Ba=m(t),L=r(t,"P",{});var te=n(L);tn=l(te,"The DeiT model was proposed in "),jt=r(te,"A",{href:!0,rel:!0});var za=n(jt);on=l(za,"Training data-efficient image transformers & distillation through attention"),za.forEach(o),sn=l(te,` by Hugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa, Alexandre
Sablayrolles, Herv\xE9 J\xE9gou. The `),Lo=r(te,"A",{href:!0});var qa=n(Lo);an=l(qa,"Vision Transformer (ViT)"),qa.forEach(o),rn=l(te," introduced in "),Pt=r(te,"A",{href:!0,rel:!0});var Na=n(Pt);nn=l(Na,"Dosovitskiy et al., 2020"),Na.forEach(o),ln=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),Ja=m(t),So=r(t,"P",{});var Oa=n(So);dn=l(Oa,"The abstract from the paper is the following:"),Oa.forEach(o),Ga=m(t),Ro=r(t,"P",{});var Wa=n(Ro);Es=r(Wa,"EM",{});var La=n(Es);cn=l(La,`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.`),La.forEach(o),Wa.forEach(o),Ka=m(t),Vo=r(t,"P",{});var Sa=n(Vo);pn=l(Sa,"Tips:"),Sa.forEach(o),Ya=m(t),A=r(t,"UL",{});var W=n(A);Cs=r(W,"LI",{});var Ra=n(Cs);hn=l(Ra,`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.`),Ra.forEach(o),mn=m(W),ie=r(W,"LI",{});var Ee=n(ie);fn=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
`),Ho=r(Ee,"A",{href:!0});var _c=n(Ho);gn=l(_c,"DeiTForImageClassification"),_c.forEach(o),un=l(Ee,` and (2) corresponds to
`),Uo=r(Ee,"A",{href:!0});var Tc=n(Uo);_n=l(Tc,"DeiTForImageClassificationWithTeacher"),Tc.forEach(o),Tn=l(Ee,"."),Ee.forEach(o),vn=m(W),As=r(W,"LI",{});var vc=n(As);bn=l(vc,`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.`),vc.forEach(o),wn=m(W),zs=r(W,"LI",{});var bc=n(zs);$n=l(bc,`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.`),bc.forEach(o),yn=m(W),M=r(W,"LI",{});var E=n(M);kn=l(E,`The authors of DeiT also released more efficiently trained ViT models, which you can directly plug into
`),Bo=r(E,"A",{href:!0});var wc=n(Bo);Dn=l(wc,"ViTModel"),wc.forEach(o),In=l(E," or "),Jo=r(E,"A",{href:!0});var $c=n(Jo);Fn=l($c,"ViTForImageClassification"),$c.forEach(o),xn=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):
`),qs=r(E,"EM",{});var yc=n(qs);Mn=l(yc,"facebook/deit-tiny-patch16-224"),yc.forEach(o),jn=l(E,", "),Ns=r(E,"EM",{});var kc=n(Ns);Pn=l(kc,"facebook/deit-small-patch16-224"),kc.forEach(o),En=l(E,", "),Os=r(E,"EM",{});var Dc=n(Os);Cn=l(Dc,"facebook/deit-base-patch16-224"),Dc.forEach(o),An=l(E,` and
`),Ws=r(E,"EM",{});var Ic=n(Ws);zn=l(Ic,"facebook/deit-base-patch16-384"),Ic.forEach(o),qn=l(E,". Note that one should use "),Go=r(E,"A",{href:!0});var Fc=n(Go);Nn=l(Fc,"DeiTImageProcessor"),Fc.forEach(o),On=l(E,` in order to
prepare images for the model.`),E.forEach(o),W.forEach(o),Xa=m(t),oe=r(t,"P",{});var fs=n(oe);Wn=l(fs,"This model was contributed by "),Et=r(fs,"A",{href:!0,rel:!0});var xc=n(Et);Ln=l(xc,"nielsr"),xc.forEach(o),Sn=l(fs,". The TensorFlow version of this model was added by "),Ct=r(fs,"A",{href:!0,rel:!0});var Mc=n(Ct);Rn=l(Mc,"amyeroberts"),Mc.forEach(o),Vn=l(fs,"."),fs.forEach(o),Qa=m(t),le=r(t,"H2",{class:!0});var xr=n(le);Oe=r(xr,"A",{id:!0,class:!0,href:!0});var jc=n(Oe);Ls=r(jc,"SPAN",{});var Pc=n(Ls);w(At.$$.fragment,Pc),Pc.forEach(o),jc.forEach(o),Hn=m(xr),Ss=r(xr,"SPAN",{});var Ec=n(Ss);Un=l(Ec,"Resources"),Ec.forEach(o),xr.forEach(o),Za=m(t),Ko=r(t,"P",{});var Cc=n(Ko);Bn=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),er=m(t),w(zt.$$.fragment,t),tr=m(t),We=r(t,"UL",{});var Mr=n(We);se=r(Mr,"LI",{});var Wo=n(se);Yo=r(Wo,"A",{href:!0});var Ac=n(Yo);Jn=l(Ac,"DeiTForImageClassification"),Ac.forEach(o),Gn=l(Wo," is supported by this "),qt=r(Wo,"A",{href:!0,rel:!0});var zc=n(qt);Kn=l(zc,"example script"),zc.forEach(o),Yn=l(Wo," and "),Nt=r(Wo,"A",{href:!0,rel:!0});var qc=n(Nt);Xn=l(qc,"notebook"),qc.forEach(o),Qn=l(Wo,"."),Wo.forEach(o),Zn=m(Mr),Xo=r(Mr,"LI",{});var uc=n(Xo);ei=l(uc,"See also: "),Qo=r(uc,"A",{href:!0});var Nc=n(Qo);ti=l(Nc,"Image classification task guide"),Nc.forEach(o),uc.forEach(o),Mr.forEach(o),or=m(t),Zo=r(t,"P",{});var Oc=n(Zo);oi=l(Oc,"Besides that:"),Oc.forEach(o),sr=m(t),es=r(t,"UL",{});var Wc=n(es);Le=r(Wc,"LI",{});var Va=n(Le);ts=r(Va,"A",{href:!0});var Lc=n(ts);si=l(Lc,"DeiTForMaskedImageModeling"),Lc.forEach(o),ai=l(Va," is supported by this "),Ot=r(Va,"A",{href:!0,rel:!0});var Sc=n(Ot);ri=l(Sc,"example script"),Sc.forEach(o),ni=l(Va,"."),Va.forEach(o),Wc.forEach(o),ar=m(t),os=r(t,"P",{});var Rc=n(os);ii=l(Rc,"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."),Rc.forEach(o),rr=m(t),de=r(t,"H2",{class:!0});var jr=n(de);Se=r(jr,"A",{id:!0,class:!0,href:!0});var Vc=n(Se);Rs=r(Vc,"SPAN",{});var Hc=n(Rs);w(Wt.$$.fragment,Hc),Hc.forEach(o),Vc.forEach(o),li=m(jr),Vs=r(jr,"SPAN",{});var Uc=n(Vs);di=l(Uc,"DeiTConfig"),Uc.forEach(o),jr.forEach(o),nr=m(t),q=r(t,"DIV",{class:!0});var Tt=n(q);w(Lt.$$.fragment,Tt),ci=m(Tt),ce=r(Tt,"P",{});var gs=n(ce);pi=l(gs,"This is the configuration class to store the configuration of a "),ss=r(gs,"A",{href:!0});var Bc=n(ss);hi=l(Bc,"DeiTModel"),Bc.forEach(o),mi=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
`),St=r(gs,"A",{href:!0,rel:!0});var Jc=n(St);fi=l(Jc,"facebook/deit-base-distilled-patch16-224"),Jc.forEach(o),gi=l(gs,`
architecture.`),gs.forEach(o),ui=m(Tt),pe=r(Tt,"P",{});var us=n(pe);_i=l(us,"Configuration objects inherit from "),as=r(us,"A",{href:!0});var Gc=n(as);Ti=l(Gc,"PretrainedConfig"),Gc.forEach(o),vi=l(us,` and can be used to control the model outputs. Read the
documentation from `),rs=r(us,"A",{href:!0});var Kc=n(rs);bi=l(Kc,"PretrainedConfig"),Kc.forEach(o),wi=l(us," for more information."),us.forEach(o),$i=m(Tt),w(Re.$$.fragment,Tt),Tt.forEach(o),ir=m(t),he=r(t,"H2",{class:!0});var Pr=n(he);Ve=r(Pr,"A",{id:!0,class:!0,href:!0});var Yc=n(Ve);Hs=r(Yc,"SPAN",{});var Xc=n(Hs);w(Rt.$$.fragment,Xc),Xc.forEach(o),Yc.forEach(o),yi=m(Pr),Us=r(Pr,"SPAN",{});var Qc=n(Us);ki=l(Qc,"DeiTFeatureExtractor"),Qc.forEach(o),Pr.forEach(o),lr=m(t),me=r(t,"DIV",{class:!0});var Er=n(me);w(Vt.$$.fragment,Er),Di=m(Er),He=r(Er,"DIV",{class:!0});var Cr=n(He);w(Ht.$$.fragment,Cr),Ii=m(Cr),Bs=r(Cr,"P",{});var Zc=n(Bs);Fi=l(Zc,"Preprocess an image or a batch of images."),Zc.forEach(o),Cr.forEach(o),Er.forEach(o),dr=m(t),fe=r(t,"H2",{class:!0});var Ar=n(fe);Ue=r(Ar,"A",{id:!0,class:!0,href:!0});var ep=n(Ue);Js=r(ep,"SPAN",{});var tp=n(Js);w(Ut.$$.fragment,tp),tp.forEach(o),ep.forEach(o),xi=m(Ar),Gs=r(Ar,"SPAN",{});var op=n(Gs);Mi=l(op,"DeiTImageProcessor"),op.forEach(o),Ar.forEach(o),cr=m(t),X=r(t,"DIV",{class:!0});var _s=n(X);w(Bt.$$.fragment,_s),ji=m(_s),Ks=r(_s,"P",{});var sp=n(Ks);Pi=l(sp,"Constructs a DeiT image processor."),sp.forEach(o),Ei=m(_s),Be=r(_s,"DIV",{class:!0});var zr=n(Be);w(Jt.$$.fragment,zr),Ci=m(zr),Ys=r(zr,"P",{});var ap=n(Ys);Ai=l(ap,"Preprocess an image or batch of images."),ap.forEach(o),zr.forEach(o),_s.forEach(o),pr=m(t),ge=r(t,"H2",{class:!0});var qr=n(ge);Je=r(qr,"A",{id:!0,class:!0,href:!0});var rp=n(Je);Xs=r(rp,"SPAN",{});var np=n(Xs);w(Gt.$$.fragment,np),np.forEach(o),rp.forEach(o),zi=m(qr),Qs=r(qr,"SPAN",{});var ip=n(Qs);qi=l(ip,"DeiTModel"),ip.forEach(o),qr.forEach(o),hr=m(t),Q=r(t,"DIV",{class:!0});var Ts=n(Q);w(Kt.$$.fragment,Ts),Ni=m(Ts),Yt=r(Ts,"P",{});var Nr=n(Yt);Oi=l(Nr,`The bare DeiT Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),Xt=r(Nr,"A",{href:!0,rel:!0});var lp=n(Xt);Wi=l(lp,"torch.nn.Module"),lp.forEach(o),Li=l(Nr,` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Nr.forEach(o),Si=m(Ts),S=r(Ts,"DIV",{class:!0});var vt=n(S);w(Qt.$$.fragment,vt),Ri=m(vt),ue=r(vt,"P",{});var vs=n(ue);Vi=l(vs,"The "),ns=r(vs,"A",{href:!0});var dp=n(ns);Hi=l(dp,"DeiTModel"),dp.forEach(o),Ui=l(vs," forward method, overrides the "),Zs=r(vs,"CODE",{});var cp=n(Zs);Bi=l(cp,"__call__"),cp.forEach(o),Ji=l(vs," special method."),vs.forEach(o),Gi=m(vt),w(Ge.$$.fragment,vt),Ki=m(vt),w(Ke.$$.fragment,vt),vt.forEach(o),Ts.forEach(o),mr=m(t),_e=r(t,"H2",{class:!0});var Or=n(_e);Ye=r(Or,"A",{id:!0,class:!0,href:!0});var pp=n(Ye);ea=r(pp,"SPAN",{});var hp=n(ea);w(Zt.$$.fragment,hp),hp.forEach(o),pp.forEach(o),Yi=m(Or),ta=r(Or,"SPAN",{});var mp=n(ta);Xi=l(mp,"DeiTForMaskedImageModeling"),mp.forEach(o),Or.forEach(o),fr=m(t),C=r(t,"DIV",{class:!0});var ae=n(C);w(eo.$$.fragment,ae),Qi=m(ae),to=r(ae,"P",{});var Wr=n(to);Zi=l(Wr,"DeiT Model with a decoder on top for masked image modeling, as proposed in "),oo=r(Wr,"A",{href:!0,rel:!0});var fp=n(oo);el=l(fp,"SimMIM"),fp.forEach(o),tl=l(Wr,"."),Wr.forEach(o),ol=m(ae),w(Xe.$$.fragment,ae),sl=m(ae),so=r(ae,"P",{});var Lr=n(so);al=l(Lr,"This model is a PyTorch "),ao=r(Lr,"A",{href:!0,rel:!0});var gp=n(ao);rl=l(gp,"torch.nn.Module"),gp.forEach(o),nl=l(Lr,` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Lr.forEach(o),il=m(ae),R=r(ae,"DIV",{class:!0});var bt=n(R);w(ro.$$.fragment,bt),ll=m(bt),Te=r(bt,"P",{});var bs=n(Te);dl=l(bs,"The "),is=r(bs,"A",{href:!0});var up=n(is);cl=l(up,"DeiTForMaskedImageModeling"),up.forEach(o),pl=l(bs," forward method, overrides the "),oa=r(bs,"CODE",{});var _p=n(oa);hl=l(_p,"__call__"),_p.forEach(o),ml=l(bs," special method."),bs.forEach(o),fl=m(bt),w(Qe.$$.fragment,bt),gl=m(bt),w(Ze.$$.fragment,bt),bt.forEach(o),ae.forEach(o),gr=m(t),ve=r(t,"H2",{class:!0});var Sr=n(ve);et=r(Sr,"A",{id:!0,class:!0,href:!0});var Tp=n(et);sa=r(Tp,"SPAN",{});var vp=n(sa);w(no.$$.fragment,vp),vp.forEach(o),Tp.forEach(o),ul=m(Sr),aa=r(Sr,"SPAN",{});var bp=n(aa);_l=l(bp,"DeiTForImageClassification"),bp.forEach(o),Sr.forEach(o),ur=m(t),N=r(t,"DIV",{class:!0});var wt=n(N);w(io.$$.fragment,wt),Tl=m(wt),ra=r(wt,"P",{});var wp=n(ra);vl=l(wp,`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.`),wp.forEach(o),bl=m(wt),lo=r(wt,"P",{});var Rr=n(lo);wl=l(Rr,"This model is a PyTorch "),co=r(Rr,"A",{href:!0,rel:!0});var $p=n(co);$l=l($p,"torch.nn.Module"),$p.forEach(o),yl=l(Rr,` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Rr.forEach(o),kl=m(wt),V=r(wt,"DIV",{class:!0});var $t=n(V);w(po.$$.fragment,$t),Dl=m($t),be=r($t,"P",{});var ws=n(be);Il=l(ws,"The "),ls=r(ws,"A",{href:!0});var yp=n(ls);Fl=l(yp,"DeiTForImageClassification"),yp.forEach(o),xl=l(ws," forward method, overrides the "),na=r(ws,"CODE",{});var kp=n(na);Ml=l(kp,"__call__"),kp.forEach(o),jl=l(ws," special method."),ws.forEach(o),Pl=m($t),w(tt.$$.fragment,$t),El=m($t),w(ot.$$.fragment,$t),$t.forEach(o),wt.forEach(o),_r=m(t),we=r(t,"H2",{class:!0});var Vr=n(we);st=r(Vr,"A",{id:!0,class:!0,href:!0});var Dp=n(st);ia=r(Dp,"SPAN",{});var Ip=n(ia);w(ho.$$.fragment,Ip),Ip.forEach(o),Dp.forEach(o),Cl=m(Vr),la=r(Vr,"SPAN",{});var Fp=n(la);Al=l(Fp,"DeiTForImageClassificationWithTeacher"),Fp.forEach(o),Vr.forEach(o),Tr=m(t),j=r(t,"DIV",{class:!0});var K=n(j);w(mo.$$.fragment,K),zl=m(K),da=r(K,"P",{});var xp=n(da);ql=l(xp,`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.`),xp.forEach(o),Nl=m(K),ca=r(K,"P",{});var Mp=n(ca);Ol=l(Mp,".. warning::"),Mp.forEach(o),Wl=m(K),pa=r(K,"P",{});var jp=n(pa);Ll=l(jp,`This model supports inference-only. Fine-tuning with distillation (i.e. with a teacher) is not yet
supported.`),jp.forEach(o),Sl=m(K),fo=r(K,"P",{});var Hr=n(fo);Rl=l(Hr,"This model is a PyTorch "),go=r(Hr,"A",{href:!0,rel:!0});var Pp=n(go);Vl=l(Pp,"torch.nn.Module"),Pp.forEach(o),Hl=l(Hr,` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Hr.forEach(o),Ul=m(K),H=r(K,"DIV",{class:!0});var yt=n(H);w(uo.$$.fragment,yt),Bl=m(yt),$e=r(yt,"P",{});var $s=n($e);Jl=l($s,"The "),ds=r($s,"A",{href:!0});var Ep=n(ds);Gl=l(Ep,"DeiTForImageClassificationWithTeacher"),Ep.forEach(o),Kl=l($s," forward method, overrides the "),ha=r($s,"CODE",{});var Cp=n(ha);Yl=l(Cp,"__call__"),Cp.forEach(o),Xl=l($s," special method."),$s.forEach(o),Ql=m(yt),w(at.$$.fragment,yt),Zl=m(yt),w(rt.$$.fragment,yt),yt.forEach(o),K.forEach(o),vr=m(t),ye=r(t,"H2",{class:!0});var Ur=n(ye);nt=r(Ur,"A",{id:!0,class:!0,href:!0});var Ap=n(nt);ma=r(Ap,"SPAN",{});var zp=n(ma);w(_o.$$.fragment,zp),zp.forEach(o),Ap.forEach(o),ed=m(Ur),fa=r(Ur,"SPAN",{});var qp=n(fa);td=l(qp,"TFDeiTModel"),qp.forEach(o),Ur.forEach(o),br=m(t),Z=r(t,"DIV",{class:!0});var ys=n(Z);w(To.$$.fragment,ys),od=m(ys),vo=r(ys,"P",{});var Br=n(vo);sd=l(Br,`The bare DeiT Model transformer outputting raw hidden-states without any specific head on top.
This model is a TensorFlow
`),bo=r(Br,"A",{href:!0,rel:!0});var Np=n(bo);ad=l(Np,"tf.keras.layers.Layer"),Np.forEach(o),rd=l(Br,`. Use it as a regular
TensorFlow Module and refer to the TensorFlow documentation for all matter related to general usage and behavior.`),Br.forEach(o),nd=m(ys),U=r(ys,"DIV",{class:!0});var kt=n(U);w(wo.$$.fragment,kt),id=m(kt),ke=r(kt,"P",{});var ks=n(ke);ld=l(ks,"The "),cs=r(ks,"A",{href:!0});var Op=n(cs);dd=l(Op,"TFDeiTModel"),Op.forEach(o),cd=l(ks," forward method, overrides the "),ga=r(ks,"CODE",{});var Wp=n(ga);pd=l(Wp,"__call__"),Wp.forEach(o),hd=l(ks," special method."),ks.forEach(o),md=m(kt),w(it.$$.fragment,kt),fd=m(kt),w(lt.$$.fragment,kt),kt.forEach(o),ys.forEach(o),wr=m(t),De=r(t,"H2",{class:!0});var Jr=n(De);dt=r(Jr,"A",{id:!0,class:!0,href:!0});var Lp=n(dt);ua=r(Lp,"SPAN",{});var Sp=n(ua);w($o.$$.fragment,Sp),Sp.forEach(o),Lp.forEach(o),gd=m(Jr),_a=r(Jr,"SPAN",{});var Rp=n(_a);ud=l(Rp,"TFDeiTForMaskedImageModeling"),Rp.forEach(o),Jr.forEach(o),$r=m(t),ee=r(t,"DIV",{class:!0});var Ds=n(ee);w(yo.$$.fragment,Ds),_d=m(Ds),Ie=r(Ds,"P",{});var Is=n(Ie);Td=l(Is,"DeiT Model with a decoder on top for masked image modeling, as proposed in "),ko=r(Is,"A",{href:!0,rel:!0});var Vp=n(ko);vd=l(Vp,"SimMIM"),Vp.forEach(o),bd=l(Is,`.
This model is a TensorFlow
`),Do=r(Is,"A",{href:!0,rel:!0});var Hp=n(Do);wd=l(Hp,"tf.keras.layers.Layer"),Hp.forEach(o),$d=l(Is,`. Use it as a regular
TensorFlow Module and refer to the TensorFlow documentation for all matter related to general usage and behavior.`),Is.forEach(o),yd=m(Ds),B=r(Ds,"DIV",{class:!0});var Dt=n(B);w(Io.$$.fragment,Dt),kd=m(Dt),Fe=r(Dt,"P",{});var Fs=n(Fe);Dd=l(Fs,"The "),ps=r(Fs,"A",{href:!0});var Up=n(ps);Id=l(Up,"TFDeiTForMaskedImageModeling"),Up.forEach(o),Fd=l(Fs," forward method, overrides the "),Ta=r(Fs,"CODE",{});var Bp=n(Ta);xd=l(Bp,"__call__"),Bp.forEach(o),Md=l(Fs," special method."),Fs.forEach(o),jd=m(Dt),w(ct.$$.fragment,Dt),Pd=m(Dt),w(pt.$$.fragment,Dt),Dt.forEach(o),Ds.forEach(o),yr=m(t),xe=r(t,"H2",{class:!0});var Gr=n(xe);ht=r(Gr,"A",{id:!0,class:!0,href:!0});var Jp=n(ht);va=r(Jp,"SPAN",{});var Gp=n(va);w(Fo.$$.fragment,Gp),Gp.forEach(o),Jp.forEach(o),Ed=m(Gr),ba=r(Gr,"SPAN",{});var Kp=n(ba);Cd=l(Kp,"TFDeiTForImageClassification"),Kp.forEach(o),Gr.forEach(o),kr=m(t),O=r(t,"DIV",{class:!0});var It=n(O);w(xo.$$.fragment,It),Ad=m(It),wa=r(It,"P",{});var Yp=n(wa);zd=l(Yp,`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.`),Yp.forEach(o),qd=m(It),Mo=r(It,"P",{});var Kr=n(Mo);Nd=l(Kr,`This model is a TensorFlow
`),jo=r(Kr,"A",{href:!0,rel:!0});var Xp=n(jo);Od=l(Xp,"tf.keras.layers.Layer"),Xp.forEach(o),Wd=l(Kr,`. Use it as a regular
TensorFlow Module and refer to the TensorFlow documentation for all matter related to general usage and behavior.`),Kr.forEach(o),Ld=m(It),J=r(It,"DIV",{class:!0});var Ft=n(J);w(Po.$$.fragment,Ft),Sd=m(Ft),Me=r(Ft,"P",{});var xs=n(Me);Rd=l(xs,"The "),hs=r(xs,"A",{href:!0});var Qp=n(hs);Vd=l(Qp,"TFDeiTForImageClassification"),Qp.forEach(o),Hd=l(xs," forward method, overrides the "),$a=r(xs,"CODE",{});var Zp=n($a);Ud=l(Zp,"__call__"),Zp.forEach(o),Bd=l(xs," special method."),xs.forEach(o),Jd=m(Ft),w(mt.$$.fragment,Ft),Gd=m(Ft),w(ft.$$.fragment,Ft),Ft.forEach(o),It.forEach(o),Dr=m(t),je=r(t,"H2",{class:!0});var Yr=n(je);gt=r(Yr,"A",{id:!0,class:!0,href:!0});var eh=n(gt);ya=r(eh,"SPAN",{});var th=n(ya);w(Eo.$$.fragment,th),th.forEach(o),eh.forEach(o),Kd=m(Yr),ka=r(Yr,"SPAN",{});var oh=n(ka);Yd=l(oh,"TFDeiTForImageClassificationWithTeacher"),oh.forEach(o),Yr.forEach(o),Ir=m(t),P=r(t,"DIV",{class:!0});var Y=n(P);w(Co.$$.fragment,Y),Xd=m(Y),Da=r(Y,"P",{});var sh=n(Da);Qd=l(sh,`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.`),sh.forEach(o),Zd=m(Y),Ia=r(Y,"P",{});var ah=n(Ia);ec=l(ah,".. warning::"),ah.forEach(o),tc=m(Y),Fa=r(Y,"P",{});var rh=n(Fa);oc=l(rh,`This model supports inference-only. Fine-tuning with distillation (i.e. with a teacher) is not yet
supported.`),rh.forEach(o),sc=m(Y),Ao=r(Y,"P",{});var Xr=n(Ao);ac=l(Xr,`This model is a TensorFlow
`),zo=r(Xr,"A",{href:!0,rel:!0});var nh=n(zo);rc=l(nh,"tf.keras.layers.Layer"),nh.forEach(o),nc=l(Xr,`. Use it as a regular
TensorFlow Module and refer to the TensorFlow documentation for all matter related to general usage and behavior.`),Xr.forEach(o),ic=m(Y),G=r(Y,"DIV",{class:!0});var xt=n(G);w(qo.$$.fragment,xt),lc=m(xt),Pe=r(xt,"P",{});var Ms=n(Pe);dc=l(Ms,"The "),ms=r(Ms,"A",{href:!0});var ih=n(ms);cc=l(ih,"TFDeiTForImageClassificationWithTeacher"),ih.forEach(o),pc=l(Ms," forward method, overrides the "),xa=r(Ms,"CODE",{});var lh=n(xa);hc=l(lh,"__call__"),lh.forEach(o),mc=l(Ms," special method."),Ms.forEach(o),fc=m(xt),w(ut.$$.fragment,xt),gc=m(xt),w(_t.$$.fragment,xt),xt.forEach(o),Y.forEach(o),this.h()},h(){c(d,"name","hf:doc:metadata"),c(d,"content",JSON.stringify(zh)),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(Ne,"id","overview"),c(Ne,"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(Ne,"href","#overview"),c(ne,"class","relative group"),c(jt,"href","https://arxiv.org/abs/2012.12877"),c(jt,"rel","nofollow"),c(Lo,"href","vit"),c(Pt,"href","https://arxiv.org/abs/2010.11929"),c(Pt,"rel","nofollow"),c(Ho,"href","/docs/transformers/v4.29.0/en/model_doc/deit#transformers.DeiTForImageClassification"),c(Uo,"href","/docs/transformers/v4.29.0/en/model_doc/deit#transformers.DeiTForImageClassificationWithTeacher"),c(Bo,"href","/docs/transformers/v4.29.0/en/model_doc/vit#transformers.ViTModel"),c(Jo,"href","/docs/transformers/v4.29.0/en/model_doc/vit#transformers.ViTForImageClassification"),c(Go,"href","/docs/transformers/v4.29.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(Oe,"id","resources"),c(Oe,"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(Oe,"href","#resources"),c(le,"class","relative group"),c(Yo,"href","/docs/transformers/v4.29.0/en/model_doc/deit#transformers.DeiTForImageClassification"),c(qt,"href","https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-classification"),c(qt,"rel","nofollow"),c(Nt,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/image_classification.ipynb"),c(Nt,"rel","nofollow"),c(Qo,"href","../tasks/image_classification"),c(ts,"href","/docs/transformers/v4.29.0/en/model_doc/deit#transformers.DeiTForMaskedImageModeling"),c(Ot,"href","https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-pretraining"),c(Ot,"rel","nofollow"),c(Se,"id","transformers.DeiTConfig"),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.DeiTConfig"),c(de,"class","relative group"),c(ss,"href","/docs/transformers/v4.29.0/en/model_doc/deit#transformers.DeiTModel"),c(St,"href","https://huggingface.co/facebook/deit-base-distilled-patch16-224"),c(St,"rel","nofollow"),c(as,"href","/docs/transformers/v4.29.0/en/main_classes/configuration#transformers.PretrainedConfig"),c(rs,"href","/docs/transformers/v4.29.0/en/main_classes/configuration#transformers.PretrainedConfig"),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(Ve,"id","transformers.DeiTFeatureExtractor"),c(Ve,"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(Ve,"href","#transformers.DeiTFeatureExtractor"),c(he,"class","relative group"),c(He,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(me,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Ue,"id","transformers.DeiTImageProcessor"),c(Ue,"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(Ue,"href","#transformers.DeiTImageProcessor"),c(fe,"class","relative group"),c(Be,"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(Je,"id","transformers.DeiTModel"),c(Je,"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(Je,"href","#transformers.DeiTModel"),c(ge,"class","relative group"),c(Xt,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(Xt,"rel","nofollow"),c(ns,"href","/docs/transformers/v4.29.0/en/model_doc/deit#transformers.DeiTModel"),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(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(Ye,"id","transformers.DeiTForMaskedImageModeling"),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.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.29.0/en/model_doc/deit#transformers.DeiTForMaskedImageModeling"),c(R,"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(ve,"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.29.0/en/model_doc/deit#transformers.DeiTForImageClassification"),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(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(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(we,"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.29.0/en/model_doc/deit#transformers.DeiTForImageClassificationWithTeacher"),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(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(nt,"id","transformers.TFDeiTModel"),c(nt,"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(nt,"href","#transformers.TFDeiTModel"),c(ye,"class","relative group"),c(bo,"href","https://www.tensorflow.org/api_docs/python/tf/keras/layers/Layer"),c(bo,"rel","nofollow"),c(cs,"href","/docs/transformers/v4.29.0/en/model_doc/deit#transformers.TFDeiTModel"),c(U,"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(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(De,"class","relative group"),c(ko,"href","https://arxiv.org/abs/2111.09886"),c(ko,"rel","nofollow"),c(Do,"href","https://www.tensorflow.org/api_docs/python/tf/keras/layers/Layer"),c(Do,"rel","nofollow"),c(ps,"href","/docs/transformers/v4.29.0/en/model_doc/deit#transformers.TFDeiTForMaskedImageModeling"),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(ee,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(ht,"id","transformers.TFDeiTForImageClassification"),c(ht,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(ht,"href","#transformers.TFDeiTForImageClassification"),c(xe,"class","relative group"),c(jo,"href","https://www.tensorflow.org/api_docs/python/tf/keras/layers/Layer"),c(jo,"rel","nofollow"),c(hs,"href","/docs/transformers/v4.29.0/en/model_doc/deit#transformers.TFDeiTForImageClassification"),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"),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(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(je,"class","relative group"),c(zo,"href","https://www.tensorflow.org/api_docs/python/tf/keras/layers/Layer"),c(zo,"rel","nofollow"),c(ms,"href","/docs/transformers/v4.29.0/en/model_doc/deit#transformers.TFDeiTForImageClassificationWithTeacher"),c(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),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")},m(t,u){e(document.head,d),_(t,v,u),_(t,g,u),e(g,f),e(f,T),$(s,T,null),e(g,p),e(g,F),e(F,Qr),_(t,Ha,u),$(qe,t,u),_(t,Ua,u),_(t,ne,u),e(ne,Ne),e(Ne,js),$(Mt,js,null),e(ne,Zr),e(ne,Ps),e(Ps,en),_(t,Ba,u),_(t,L,u),e(L,tn),e(L,jt),e(jt,on),e(L,sn),e(L,Lo),e(Lo,an),e(L,rn),e(L,Pt),e(Pt,nn),e(L,ln),_(t,Ja,u),_(t,So,u),e(So,dn),_(t,Ga,u),_(t,Ro,u),e(Ro,Es),e(Es,cn),_(t,Ka,u),_(t,Vo,u),e(Vo,pn),_(t,Ya,u),_(t,A,u),e(A,Cs),e(Cs,hn),e(A,mn),e(A,ie),e(ie,fn),e(ie,Ho),e(Ho,gn),e(ie,un),e(ie,Uo),e(Uo,_n),e(ie,Tn),e(A,vn),e(A,As),e(As,bn),e(A,wn),e(A,zs),e(zs,$n),e(A,yn),e(A,M),e(M,kn),e(M,Bo),e(Bo,Dn),e(M,In),e(M,Jo),e(Jo,Fn),e(M,xn),e(M,qs),e(qs,Mn),e(M,jn),e(M,Ns),e(Ns,Pn),e(M,En),e(M,Os),e(Os,Cn),e(M,An),e(M,Ws),e(Ws,zn),e(M,qn),e(M,Go),e(Go,Nn),e(M,On),_(t,Xa,u),_(t,oe,u),e(oe,Wn),e(oe,Et),e(Et,Ln),e(oe,Sn),e(oe,Ct),e(Ct,Rn),e(oe,Vn),_(t,Qa,u),_(t,le,u),e(le,Oe),e(Oe,Ls),$(At,Ls,null),e(le,Hn),e(le,Ss),e(Ss,Un),_(t,Za,u),_(t,Ko,u),e(Ko,Bn),_(t,er,u),$(zt,t,u),_(t,tr,u),_(t,We,u),e(We,se),e(se,Yo),e(Yo,Jn),e(se,Gn),e(se,qt),e(qt,Kn),e(se,Yn),e(se,Nt),e(Nt,Xn),e(se,Qn),e(We,Zn),e(We,Xo),e(Xo,ei),e(Xo,Qo),e(Qo,ti),_(t,or,u),_(t,Zo,u),e(Zo,oi),_(t,sr,u),_(t,es,u),e(es,Le),e(Le,ts),e(ts,si),e(Le,ai),e(Le,Ot),e(Ot,ri),e(Le,ni),_(t,ar,u),_(t,os,u),e(os,ii),_(t,rr,u),_(t,de,u),e(de,Se),e(Se,Rs),$(Wt,Rs,null),e(de,li),e(de,Vs),e(Vs,di),_(t,nr,u),_(t,q,u),$(Lt,q,null),e(q,ci),e(q,ce),e(ce,pi),e(ce,ss),e(ss,hi),e(ce,mi),e(ce,St),e(St,fi),e(ce,gi),e(q,ui),e(q,pe),e(pe,_i),e(pe,as),e(as,Ti),e(pe,vi),e(pe,rs),e(rs,bi),e(pe,wi),e(q,$i),$(Re,q,null),_(t,ir,u),_(t,he,u),e(he,Ve),e(Ve,Hs),$(Rt,Hs,null),e(he,yi),e(he,Us),e(Us,ki),_(t,lr,u),_(t,me,u),$(Vt,me,null),e(me,Di),e(me,He),$(Ht,He,null),e(He,Ii),e(He,Bs),e(Bs,Fi),_(t,dr,u),_(t,fe,u),e(fe,Ue),e(Ue,Js),$(Ut,Js,null),e(fe,xi),e(fe,Gs),e(Gs,Mi),_(t,cr,u),_(t,X,u),$(Bt,X,null),e(X,ji),e(X,Ks),e(Ks,Pi),e(X,Ei),e(X,Be),$(Jt,Be,null),e(Be,Ci),e(Be,Ys),e(Ys,Ai),_(t,pr,u),_(t,ge,u),e(ge,Je),e(Je,Xs),$(Gt,Xs,null),e(ge,zi),e(ge,Qs),e(Qs,qi),_(t,hr,u),_(t,Q,u),$(Kt,Q,null),e(Q,Ni),e(Q,Yt),e(Yt,Oi),e(Yt,Xt),e(Xt,Wi),e(Yt,Li),e(Q,Si),e(Q,S),$(Qt,S,null),e(S,Ri),e(S,ue),e(ue,Vi),e(ue,ns),e(ns,Hi),e(ue,Ui),e(ue,Zs),e(Zs,Bi),e(ue,Ji),e(S,Gi),$(Ge,S,null),e(S,Ki),$(Ke,S,null),_(t,mr,u),_(t,_e,u),e(_e,Ye),e(Ye,ea),$(Zt,ea,null),e(_e,Yi),e(_e,ta),e(ta,Xi),_(t,fr,u),_(t,C,u),$(eo,C,null),e(C,Qi),e(C,to),e(to,Zi),e(to,oo),e(oo,el),e(to,tl),e(C,ol),$(Xe,C,null),e(C,sl),e(C,so),e(so,al),e(so,ao),e(ao,rl),e(so,nl),e(C,il),e(C,R),$(ro,R,null),e(R,ll),e(R,Te),e(Te,dl),e(Te,is),e(is,cl),e(Te,pl),e(Te,oa),e(oa,hl),e(Te,ml),e(R,fl),$(Qe,R,null),e(R,gl),$(Ze,R,null),_(t,gr,u),_(t,ve,u),e(ve,et),e(et,sa),$(no,sa,null),e(ve,ul),e(ve,aa),e(aa,_l),_(t,ur,u),_(t,N,u),$(io,N,null),e(N,Tl),e(N,ra),e(ra,vl),e(N,bl),e(N,lo),e(lo,wl),e(lo,co),e(co,$l),e(lo,yl),e(N,kl),e(N,V),$(po,V,null),e(V,Dl),e(V,be),e(be,Il),e(be,ls),e(ls,Fl),e(be,xl),e(be,na),e(na,Ml),e(be,jl),e(V,Pl),$(tt,V,null),e(V,El),$(ot,V,null),_(t,_r,u),_(t,we,u),e(we,st),e(st,ia),$(ho,ia,null),e(we,Cl),e(we,la),e(la,Al),_(t,Tr,u),_(t,j,u),$(mo,j,null),e(j,zl),e(j,da),e(da,ql),e(j,Nl),e(j,ca),e(ca,Ol),e(j,Wl),e(j,pa),e(pa,Ll),e(j,Sl),e(j,fo),e(fo,Rl),e(fo,go),e(go,Vl),e(fo,Hl),e(j,Ul),e(j,H),$(uo,H,null),e(H,Bl),e(H,$e),e($e,Jl),e($e,ds),e(ds,Gl),e($e,Kl),e($e,ha),e(ha,Yl),e($e,Xl),e(H,Ql),$(at,H,null),e(H,Zl),$(rt,H,null),_(t,vr,u),_(t,ye,u),e(ye,nt),e(nt,ma),$(_o,ma,null),e(ye,ed),e(ye,fa),e(fa,td),_(t,br,u),_(t,Z,u),$(To,Z,null),e(Z,od),e(Z,vo),e(vo,sd),e(vo,bo),e(bo,ad),e(vo,rd),e(Z,nd),e(Z,U),$(wo,U,null),e(U,id),e(U,ke),e(ke,ld),e(ke,cs),e(cs,dd),e(ke,cd),e(ke,ga),e(ga,pd),e(ke,hd),e(U,md),$(it,U,null),e(U,fd),$(lt,U,null),_(t,wr,u),_(t,De,u),e(De,dt),e(dt,ua),$($o,ua,null),e(De,gd),e(De,_a),e(_a,ud),_(t,$r,u),_(t,ee,u),$(yo,ee,null),e(ee,_d),e(ee,Ie),e(Ie,Td),e(Ie,ko),e(ko,vd),e(Ie,bd),e(Ie,Do),e(Do,wd),e(Ie,$d),e(ee,yd),e(ee,B),$(Io,B,null),e(B,kd),e(B,Fe),e(Fe,Dd),e(Fe,ps),e(ps,Id),e(Fe,Fd),e(Fe,Ta),e(Ta,xd),e(Fe,Md),e(B,jd),$(ct,B,null),e(B,Pd),$(pt,B,null),_(t,yr,u),_(t,xe,u),e(xe,ht),e(ht,va),$(Fo,va,null),e(xe,Ed),e(xe,ba),e(ba,Cd),_(t,kr,u),_(t,O,u),$(xo,O,null),e(O,Ad),e(O,wa),e(wa,zd),e(O,qd),e(O,Mo),e(Mo,Nd),e(Mo,jo),e(jo,Od),e(Mo,Wd),e(O,Ld),e(O,J),$(Po,J,null),e(J,Sd),e(J,Me),e(Me,Rd),e(Me,hs),e(hs,Vd),e(Me,Hd),e(Me,$a),e($a,Ud),e(Me,Bd),e(J,Jd),$(mt,J,null),e(J,Gd),$(ft,J,null),_(t,Dr,u),_(t,je,u),e(je,gt),e(gt,ya),$(Eo,ya,null),e(je,Kd),e(je,ka),e(ka,Yd),_(t,Ir,u),_(t,P,u),$(Co,P,null),e(P,Xd),e(P,Da),e(Da,Qd),e(P,Zd),e(P,Ia),e(Ia,ec),e(P,tc),e(P,Fa),e(Fa,oc),e(P,sc),e(P,Ao),e(Ao,ac),e(Ao,zo),e(zo,rc),e(Ao,nc),e(P,ic),e(P,G),$(qo,G,null),e(G,lc),e(G,Pe),e(Pe,dc),e(Pe,ms),e(ms,cc),e(Pe,pc),e(Pe,xa),e(xa,hc),e(Pe,mc),e(G,fc),$(ut,G,null),e(G,gc),$(_t,G,null),Fr=!0},p(t,[u]){const No={};u&2&&(No.$$scope={dirty:u,ctx:t}),qe.$set(No);const Ma={};u&2&&(Ma.$$scope={dirty:u,ctx:t}),Re.$set(Ma);const ja={};u&2&&(ja.$$scope={dirty:u,ctx:t}),Ge.$set(ja);const Pa={};u&2&&(Pa.$$scope={dirty:u,ctx:t}),Ke.$set(Pa);const Oo={};u&2&&(Oo.$$scope={dirty:u,ctx:t}),Xe.$set(Oo);const Ea={};u&2&&(Ea.$$scope={dirty:u,ctx:t}),Qe.$set(Ea);const Ca={};u&2&&(Ca.$$scope={dirty:u,ctx:t}),Ze.$set(Ca);const Aa={};u&2&&(Aa.$$scope={dirty:u,ctx:t}),tt.$set(Aa);const te={};u&2&&(te.$$scope={dirty:u,ctx:t}),ot.$set(te);const za={};u&2&&(za.$$scope={dirty:u,ctx:t}),at.$set(za);const qa={};u&2&&(qa.$$scope={dirty:u,ctx:t}),rt.$set(qa);const Na={};u&2&&(Na.$$scope={dirty:u,ctx:t}),it.$set(Na);const Oa={};u&2&&(Oa.$$scope={dirty:u,ctx:t}),lt.$set(Oa);const Wa={};u&2&&(Wa.$$scope={dirty:u,ctx:t}),ct.$set(Wa);const La={};u&2&&(La.$$scope={dirty:u,ctx:t}),pt.$set(La);const Sa={};u&2&&(Sa.$$scope={dirty:u,ctx:t}),mt.$set(Sa);const W={};u&2&&(W.$$scope={dirty:u,ctx:t}),ft.$set(W);const Ra={};u&2&&(Ra.$$scope={dirty:u,ctx:t}),ut.$set(Ra);const Ee={};u&2&&(Ee.$$scope={dirty:u,ctx:t}),_t.$set(Ee)},i(t){Fr||(y(s.$$.fragment,t),y(qe.$$.fragment,t),y(Mt.$$.fragment,t),y(At.$$.fragment,t),y(zt.$$.fragment,t),y(Wt.$$.fragment,t),y(Lt.$$.fragment,t),y(Re.$$.fragment,t),y(Rt.$$.fragment,t),y(Vt.$$.fragment,t),y(Ht.$$.fragment,t),y(Ut.$$.fragment,t),y(Bt.$$.fragment,t),y(Jt.$$.fragment,t),y(Gt.$$.fragment,t),y(Kt.$$.fragment,t),y(Qt.$$.fragment,t),y(Ge.$$.fragment,t),y(Ke.$$.fragment,t),y(Zt.$$.fragment,t),y(eo.$$.fragment,t),y(Xe.$$.fragment,t),y(ro.$$.fragment,t),y(Qe.$$.fragment,t),y(Ze.$$.fragment,t),y(no.$$.fragment,t),y(io.$$.fragment,t),y(po.$$.fragment,t),y(tt.$$.fragment,t),y(ot.$$.fragment,t),y(ho.$$.fragment,t),y(mo.$$.fragment,t),y(uo.$$.fragment,t),y(at.$$.fragment,t),y(rt.$$.fragment,t),y(_o.$$.fragment,t),y(To.$$.fragment,t),y(wo.$$.fragment,t),y(it.$$.fragment,t),y(lt.$$.fragment,t),y($o.$$.fragment,t),y(yo.$$.fragment,t),y(Io.$$.fragment,t),y(ct.$$.fragment,t),y(pt.$$.fragment,t),y(Fo.$$.fragment,t),y(xo.$$.fragment,t),y(Po.$$.fragment,t),y(mt.$$.fragment,t),y(ft.$$.fragment,t),y(Eo.$$.fragment,t),y(Co.$$.fragment,t),y(qo.$$.fragment,t),y(ut.$$.fragment,t),y(_t.$$.fragment,t),Fr=!0)},o(t){k(s.$$.fragment,t),k(qe.$$.fragment,t),k(Mt.$$.fragment,t),k(At.$$.fragment,t),k(zt.$$.fragment,t),k(Wt.$$.fragment,t),k(Lt.$$.fragment,t),k(Re.$$.fragment,t),k(Rt.$$.fragment,t),k(Vt.$$.fragment,t),k(Ht.$$.fragment,t),k(Ut.$$.fragment,t),k(Bt.$$.fragment,t),k(Jt.$$.fragment,t),k(Gt.$$.fragment,t),k(Kt.$$.fragment,t),k(Qt.$$.fragment,t),k(Ge.$$.fragment,t),k(Ke.$$.fragment,t),k(Zt.$$.fragment,t),k(eo.$$.fragment,t),k(Xe.$$.fragment,t),k(ro.$$.fragment,t),k(Qe.$$.fragment,t),k(Ze.$$.fragment,t),k(no.$$.fragment,t),k(io.$$.fragment,t),k(po.$$.fragment,t),k(tt.$$.fragment,t),k(ot.$$.fragment,t),k(ho.$$.fragment,t),k(mo.$$.fragment,t),k(uo.$$.fragment,t),k(at.$$.fragment,t),k(rt.$$.fragment,t),k(_o.$$.fragment,t),k(To.$$.fragment,t),k(wo.$$.fragment,t),k(it.$$.fragment,t),k(lt.$$.fragment,t),k($o.$$.fragment,t),k(yo.$$.fragment,t),k(Io.$$.fragment,t),k(ct.$$.fragment,t),k(pt.$$.fragment,t),k(Fo.$$.fragment,t),k(xo.$$.fragment,t),k(Po.$$.fragment,t),k(mt.$$.fragment,t),k(ft.$$.fragment,t),k(Eo.$$.fragment,t),k(Co.$$.fragment,t),k(qo.$$.fragment,t),k(ut.$$.fragment,t),k(_t.$$.fragment,t),Fr=!1},d(t){o(d),t&&o(v),t&&o(g),D(s),t&&o(Ha),D(qe,t),t&&o(Ua),t&&o(ne),D(Mt),t&&o(Ba),t&&o(L),t&&o(Ja),t&&o(So),t&&o(Ga),t&&o(Ro),t&&o(Ka),t&&o(Vo),t&&o(Ya),t&&o(A),t&&o(Xa),t&&o(oe),t&&o(Qa),t&&o(le),D(At),t&&o(Za),t&&o(Ko),t&&o(er),D(zt,t),t&&o(tr),t&&o(We),t&&o(or),t&&o(Zo),t&&o(sr),t&&o(es),t&&o(ar),t&&o(os),t&&o(rr),t&&o(de),D(Wt),t&&o(nr),t&&o(q),D(Lt),D(Re),t&&o(ir),t&&o(he),D(Rt),t&&o(lr),t&&o(me),D(Vt),D(Ht),t&&o(dr),t&&o(fe),D(Ut),t&&o(cr),t&&o(X),D(Bt),D(Jt),t&&o(pr),t&&o(ge),D(Gt),t&&o(hr),t&&o(Q),D(Kt),D(Qt),D(Ge),D(Ke),t&&o(mr),t&&o(_e),D(Zt),t&&o(fr),t&&o(C),D(eo),D(Xe),D(ro),D(Qe),D(Ze),t&&o(gr),t&&o(ve),D(no),t&&o(ur),t&&o(N),D(io),D(po),D(tt),D(ot),t&&o(_r),t&&o(we),D(ho),t&&o(Tr),t&&o(j),D(mo),D(uo),D(at),D(rt),t&&o(vr),t&&o(ye),D(_o),t&&o(br),t&&o(Z),D(To),D(wo),D(it),D(lt),t&&o(wr),t&&o(De),D($o),t&&o($r),t&&o(ee),D(yo),D(Io),D(ct),D(pt),t&&o(yr),t&&o(xe),D(Fo),t&&o(kr),t&&o(O),D(xo),D(Po),D(mt),D(ft),t&&o(Dr),t&&o(je),D(Eo),t&&o(Ir),t&&o(P),D(Co),D(qo),D(ut),D(_t)}}}const zh={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 qh(I){return mh(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Hh extends dh{constructor(d){super();ch(this,d,qh,Ah,ph,{})}}export{Hh as default,zh as metadata};
