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 M}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.logits
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.logits
<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 Mh(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 xh(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.logits
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.logits
<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 Eh(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 Ph(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,xt,Zr,Es,en,Ba,W,tn,jt,on,sn,Wo,an,rn,Et,nn,ln,Ja,So,dn,Ga,Vo,Ps,cn,Ka,Ro,pn,Ya,A,Cs,hn,mn,ie,fn,Ho,gn,un,Uo,_n,Tn,vn,As,bn,wn,zs,$n,yn,x,kn,Bo,Dn,In,Jo,Fn,Mn,qs,xn,jn,Ns,En,Pn,Os,Cn,An,Ls,zn,qn,Go,Nn,On,Xa,oe,Ln,Pt,Wn,Sn,Ct,Vn,Rn,Qa,le,Oe,Ws,At,Hn,Ss,Un,Za,Ko,Bn,er,zt,tr,Le,se,Yo,Jn,Gn,qt,Kn,Yn,Nt,Xn,Qn,Zn,Xo,ei,Qo,ti,or,Zo,oi,sr,es,We,ts,si,ai,Ot,ri,ni,ar,os,ii,rr,de,Se,Vs,Lt,li,Rs,di,nr,q,Wt,ci,ce,pi,ss,hi,mi,St,fi,gi,ui,pe,_i,as,Ti,vi,rs,bi,wi,$i,Ve,ir,he,Re,Hs,Vt,yi,Us,ki,lr,me,Rt,Di,He,Ht,Ii,Bs,Fi,dr,fe,Ue,Js,Ut,Mi,Gs,xi,cr,X,Bt,ji,Ks,Ei,Pi,Be,Jt,Ci,Ys,Ai,pr,ge,Je,Xs,Gt,zi,Qs,qi,hr,Q,Kt,Ni,Yt,Oi,Xt,Li,Wi,Si,S,Qt,Vi,ue,Ri,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,V,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,R,po,Dl,be,Il,ls,Fl,Ml,na,xl,jl,El,tt,Pl,ot,_r,we,st,ia,ho,Cl,la,Al,Tr,j,mo,zl,da,ql,Nl,ca,Ol,Ll,pa,Wl,Sl,fo,Vl,go,Rl,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,Md,xd,jd,ct,Ed,pt,yr,Me,ht,va,Fo,Pd,ba,Cd,kr,O,Mo,Ad,wa,zd,qd,xo,Nd,jo,Od,Ld,Wd,J,Eo,Sd,xe,Vd,hs,Rd,Hd,$a,Ud,Bd,Jd,mt,Gd,ft,Dr,je,gt,ya,Po,Kd,ka,Yd,Ir,E,Co,Xd,Da,Qd,Zd,Ia,ec,tc,Fa,oc,sc,Ao,ac,zo,rc,nc,ic,G,qo,lc,Ee,dc,ms,cc,pc,Ma,hc,mc,fc,ut,gc,_t,Fr;return s=new z({}),qe=new re({props:{$$slots:{default:[gh]},$$scope:{ctx:I}}}),xt=new z({}),At=new z({}),zt=new fh({props:{pipeline:"image-classification"}}),Lt=new z({}),Wt=new M({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.27.1/src/transformers/models/deit/configuration_deit.py#L37"}}),Ve=new Ce({props:{anchor:"transformers.DeiTConfig.example",$$slots:{default:[uh]},$$scope:{ctx:I}}}),Vt=new z({}),Rt=new M({props:{name:"class transformers.DeiTFeatureExtractor",anchor:"transformers.DeiTFeatureExtractor",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/deit/feature_extraction_deit.py#L26"}}),Ht=new M({props:{name:"__call__",anchor:"transformers.DeiTFeatureExtractor.__call__",parameters:[{name:"images",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/image_processing_utils.py#L456"}}),Ut=new z({}),Bt=new M({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.27.1/src/transformers/models/deit/image_processing_deit.py#L43"}}),Jt=new M({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.27.1/src/transformers/models/deit/image_processing_deit.py#L205"}}),Gt=new z({}),Kt=new M({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.27.1/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.27.1/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.27.1/src/transformers/models/deit/modeling_deit.py#L456"}}),Qt=new M({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.27.1/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/v4.27.1/en/model_doc/videomae#transformers.VideoMAEFeatureExtractor.__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.27.1/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.27.1/src/transformers/models/deit/modeling_deit.py#L481",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.27.1/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.27.1/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.27.1/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 M({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.27.1/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.27.1/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.27.1/src/transformers/models/deit/modeling_deit.py#L572"}}),Xe=new re({props:{$$slots:{default:[vh]},$$scope:{ctx:I}}}),ro=new M({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.27.1/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/v4.27.1/en/model_doc/videomae#transformers.VideoMAEFeatureExtractor.__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.27.1/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.27.1/src/transformers/models/deit/modeling_deit.py#L590",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.27.1/en/main_classes/output#transformers.modeling_outputs.MaskedLMOutput"
>transformers.modeling_outputs.MaskedLMOutput</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.27.1/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 Masked language modeling (MLM) loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.vocab_size)</code>) \u2014 Prediction scores of the language modeling head (scores for each vocabulary token 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 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.27.1/en/main_classes/output#transformers.modeling_outputs.MaskedLMOutput"
>transformers.modeling_outputs.MaskedLMOutput</a> 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 M({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.27.1/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.27.1/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.27.1/src/transformers/models/deit/modeling_deit.py#L684"}}),po=new M({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.27.1/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/v4.27.1/en/model_doc/videomae#transformers.VideoMAEFeatureExtractor.__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.27.1/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.27.1/src/transformers/models/deit/modeling_deit.py#L697",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.27.1/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.27.1/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.27.1/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 M({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.27.1/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.27.1/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.27.1/src/transformers/models/deit/modeling_deit.py#L833"}}),uo=new M({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.27.1/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/v4.27.1/en/model_doc/videomae#transformers.VideoMAEFeatureExtractor.__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.27.1/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.27.1/src/transformers/models/deit/modeling_deit.py#L851",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.27.1/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 M({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.27.1/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.27.1/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.27.1/src/transformers/models/deit/modeling_tf_deit.py#L640"}}),wo=new M({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.27.1/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/v4.27.1/en/model_doc/videomae#transformers.VideoMAEFeatureExtractor.__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.27.1/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.27.1/src/transformers/models/deit/modeling_tf_deit.py#L650",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.27.1/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.27.1/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.27.1/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 M({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.27.1/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.27.1/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.27.1/src/transformers/models/deit/modeling_tf_deit.py#L759"}}),Io=new M({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.27.1/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/v4.27.1/en/model_doc/videomae#transformers.VideoMAEFeatureExtractor.__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.27.1/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.27.1/src/transformers/models/deit/modeling_tf_deit.py#L766",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.27.1/en/main_classes/output#transformers.modeling_tf_outputs.TFMaskedLMOutput"
>transformers.modeling_tf_outputs.TFMaskedLMOutput</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.27.1/en/model_doc/deit#transformers.DeiTConfig"
>DeiTConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>tf.Tensor</code> of shape <code>(n,)</code>, <em>optional</em>, where n is the number of non-masked labels, returned when <code>labels</code> is provided) \u2014 Masked language modeling (MLM) loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, config.vocab_size)</code>) \u2014 Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for the output of the embeddings + one for the output of each layer) of shape
<code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.27.1/en/main_classes/output#transformers.modeling_tf_outputs.TFMaskedLMOutput"
>transformers.modeling_tf_outputs.TFMaskedLMOutput</a> or <code>tuple(tf.Tensor)</code></p>
`}}),ct=new re({props:{$$slots:{default:[Mh]},$$scope:{ctx:I}}}),pt=new Ce({props:{anchor:"transformers.TFDeiTForMaskedImageModeling.call.example",$$slots:{default:[xh]},$$scope:{ctx:I}}}),Fo=new z({}),Mo=new M({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.27.1/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.27.1/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.27.1/src/transformers/models/deit/modeling_tf_deit.py#L880"}}),Eo=new M({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.27.1/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/v4.27.1/en/model_doc/videomae#transformers.VideoMAEFeatureExtractor.__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.27.1/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.27.1/src/transformers/models/deit/modeling_tf_deit.py#L894",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.27.1/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:[Eh]},$$scope:{ctx:I}}}),Po=new z({}),Co=new M({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.27.1/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.27.1/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.27.1/src/transformers/models/deit/modeling_tf_deit.py#L988"}}),qo=new M({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.27.1/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/v4.27.1/en/model_doc/videomae#transformers.VideoMAEFeatureExtractor.__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.27.1/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.27.1/src/transformers/models/deit/modeling_tf_deit.py#L1007",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.27.1/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:[Ph]},$$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(xt.$$.fragment),Zr=h(),Es=a("span"),en=i("Overview"),Ba=h(),W=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 `),Wo=a("a"),an=i("Vision Transformer (ViT)"),rn=i(" introduced in "),Et=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(),Vo=a("p"),Ps=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(),Ro=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(),x=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"),Mn=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"),xn=i("facebook/deit-tiny-patch16-224"),jn=i(", "),Ns=a("em"),En=i("facebook/deit-small-patch16-224"),Pn=i(", "),Os=a("em"),Cn=i("facebook/deit-base-patch16-224"),An=i(` and
`),Ls=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"),Ln=i("This model was contributed by "),Pt=a("a"),Wn=i("nielsr"),Sn=i(". The TensorFlow version of this model was added by "),Ct=a("a"),Vn=i("amyeroberts"),Rn=i("."),Qa=h(),le=a("h2"),Oe=a("a"),Ws=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(),Le=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"),We=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"),Vs=a("span"),b(Lt.$$.fragment),li=h(),Rs=a("span"),di=i("DeiTConfig"),nr=h(),q=a("div"),b(Wt.$$.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(Ve.$$.fragment),ir=h(),he=a("h2"),Re=a("a"),Hs=a("span"),b(Vt.$$.fragment),yi=h(),Us=a("span"),ki=i("DeiTFeatureExtractor"),lr=h(),me=a("div"),b(Rt.$$.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),Mi=h(),Gs=a("span"),xi=i("DeiTImageProcessor"),cr=h(),X=a("div"),b(Bt.$$.fragment),ji=h(),Ks=a("p"),Ei=i("Constructs a DeiT image processor."),Pi=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"),Li=i("torch.nn.Module"),Wi=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),Vi=h(),ue=a("p"),Ri=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(),V=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(),R=a("div"),b(po.$$.fragment),Dl=h(),be=a("p"),Il=i("The "),ls=a("a"),Fl=i("DeiTForImageClassification"),Ml=i(" forward method, overrides the "),na=a("code"),xl=i("__call__"),jl=i(" special method."),El=h(),b(tt.$$.fragment),Pl=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::"),Ll=h(),pa=a("p"),Wl=i(`This model supports inference-only. Fine-tuning with distillation (i.e. with a teacher) is not yet
supported.`),Sl=h(),fo=a("p"),Vl=i("This model is a PyTorch "),go=a("a"),Rl=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"),Md=i("__call__"),xd=i(" special method."),jd=h(),b(ct.$$.fragment),Ed=h(),b(pt.$$.fragment),yr=h(),Me=a("h2"),ht=a("a"),va=a("span"),b(Fo.$$.fragment),Pd=h(),ba=a("span"),Cd=i("TFDeiTForImageClassification"),kr=h(),O=a("div"),b(Mo.$$.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(),xo=a("p"),Nd=i(`This model is a TensorFlow
`),jo=a("a"),Od=i("tf.keras.layers.Layer"),Ld=i(`. Use it as a regular
TensorFlow Module and refer to the TensorFlow documentation for all matter related to general usage and behavior.`),Wd=h(),J=a("div"),b(Eo.$$.fragment),Sd=h(),xe=a("p"),Vd=i("The "),hs=a("a"),Rd=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(Po.$$.fragment),Kd=h(),ka=a("span"),Yd=i("TFDeiTForImageClassificationWithTeacher"),Ir=h(),E=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(),Ee=a("p"),dc=i("The "),ms=a("a"),cc=i("TFDeiTForImageClassificationWithTeacher"),pc=i(" forward method, overrides the "),Ma=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 xa=n(f);T=r(xa,"SPAN",{});var ja=n(T);w(s.$$.fragment,ja),ja.forEach(o),xa.forEach(o),p=m(No),F=r(No,"SPAN",{});var Ea=n(F);Qr=l(Ea,"DeiT"),Ea.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 Pa=n(Ne);js=r(Pa,"SPAN",{});var Ca=n(js);w(xt.$$.fragment,Ca),Ca.forEach(o),Pa.forEach(o),Zr=m(Oo),Es=r(Oo,"SPAN",{});var Aa=n(Es);en=l(Aa,"Overview"),Aa.forEach(o),Oo.forEach(o),Ba=m(t),W=r(t,"P",{});var te=n(W);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 `),Wo=r(te,"A",{href:!0});var qa=n(Wo);an=l(qa,"Vision Transformer (ViT)"),qa.forEach(o),rn=l(te," introduced in "),Et=r(te,"A",{href:!0,rel:!0});var Na=n(Et);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),Vo=r(t,"P",{});var La=n(Vo);Ps=r(La,"EM",{});var Wa=n(Ps);cn=l(Wa,`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.`),Wa.forEach(o),La.forEach(o),Ka=m(t),Ro=r(t,"P",{});var Sa=n(Ro);pn=l(Sa,"Tips:"),Sa.forEach(o),Ya=m(t),A=r(t,"UL",{});var L=n(A);Cs=r(L,"LI",{});var Va=n(Cs);hn=l(Va,`Compared to ViT, DeiT models use a so-called distillation token to effectively learn from a teacher (which, in the
DeiT paper, is a ResNet like-model). The distillation token is learned through backpropagation, by interacting with
the class ([CLS]) and patch tokens through the self-attention layers.`),Va.forEach(o),mn=m(L),ie=r(L,"LI",{});var Pe=n(ie);fn=l(Pe,`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(Pe,"A",{href:!0});var _c=n(Ho);gn=l(_c,"DeiTForImageClassification"),_c.forEach(o),un=l(Pe,` and (2) corresponds to
`),Uo=r(Pe,"A",{href:!0});var Tc=n(Uo);_n=l(Tc,"DeiTForImageClassificationWithTeacher"),Tc.forEach(o),Tn=l(Pe,"."),Pe.forEach(o),vn=m(L),As=r(L,"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(L),zs=r(L,"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(L),x=r(L,"LI",{});var P=n(x);kn=l(P,`The authors of DeiT also released more efficiently trained ViT models, which you can directly plug into
`),Bo=r(P,"A",{href:!0});var wc=n(Bo);Dn=l(wc,"ViTModel"),wc.forEach(o),In=l(P," or "),Jo=r(P,"A",{href:!0});var $c=n(Jo);Fn=l($c,"ViTForImageClassification"),$c.forEach(o),Mn=l(P,`. 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(P,"EM",{});var yc=n(qs);xn=l(yc,"facebook/deit-tiny-patch16-224"),yc.forEach(o),jn=l(P,", "),Ns=r(P,"EM",{});var kc=n(Ns);En=l(kc,"facebook/deit-small-patch16-224"),kc.forEach(o),Pn=l(P,", "),Os=r(P,"EM",{});var Dc=n(Os);Cn=l(Dc,"facebook/deit-base-patch16-224"),Dc.forEach(o),An=l(P,` and
`),Ls=r(P,"EM",{});var Ic=n(Ls);zn=l(Ic,"facebook/deit-base-patch16-384"),Ic.forEach(o),qn=l(P,". Note that one should use "),Go=r(P,"A",{href:!0});var Fc=n(Go);Nn=l(Fc,"DeiTImageProcessor"),Fc.forEach(o),On=l(P,` in order to
prepare images for the model.`),P.forEach(o),L.forEach(o),Xa=m(t),oe=r(t,"P",{});var fs=n(oe);Ln=l(fs,"This model was contributed by "),Pt=r(fs,"A",{href:!0,rel:!0});var Mc=n(Pt);Wn=l(Mc,"nielsr"),Mc.forEach(o),Sn=l(fs,". The TensorFlow version of this model was added by "),Ct=r(fs,"A",{href:!0,rel:!0});var xc=n(Ct);Vn=l(xc,"amyeroberts"),xc.forEach(o),Rn=l(fs,"."),fs.forEach(o),Qa=m(t),le=r(t,"H2",{class:!0});var Mr=n(le);Oe=r(Mr,"A",{id:!0,class:!0,href:!0});var jc=n(Oe);Ws=r(jc,"SPAN",{});var Ec=n(Ws);w(At.$$.fragment,Ec),Ec.forEach(o),jc.forEach(o),Hn=m(Mr),Ss=r(Mr,"SPAN",{});var Pc=n(Ss);Un=l(Pc,"Resources"),Pc.forEach(o),Mr.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),Le=r(t,"UL",{});var xr=n(Le);se=r(xr,"LI",{});var Lo=n(se);Yo=r(Lo,"A",{href:!0});var Ac=n(Yo);Jn=l(Ac,"DeiTForImageClassification"),Ac.forEach(o),Gn=l(Lo," is supported by this "),qt=r(Lo,"A",{href:!0,rel:!0});var zc=n(qt);Kn=l(zc,"example script"),zc.forEach(o),Yn=l(Lo," and "),Nt=r(Lo,"A",{href:!0,rel:!0});var qc=n(Nt);Xn=l(qc,"notebook"),qc.forEach(o),Qn=l(Lo,"."),Lo.forEach(o),Zn=m(xr),Xo=r(xr,"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),xr.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 Lc=n(es);We=r(Lc,"LI",{});var Ra=n(We);ts=r(Ra,"A",{href:!0});var Wc=n(ts);si=l(Wc,"DeiTForMaskedImageModeling"),Wc.forEach(o),ai=l(Ra," is supported by this "),Ot=r(Ra,"A",{href:!0,rel:!0});var Sc=n(Ot);ri=l(Sc,"example script"),Sc.forEach(o),ni=l(Ra,"."),Ra.forEach(o),Lc.forEach(o),ar=m(t),os=r(t,"P",{});var Vc=n(os);ii=l(Vc,"If you\u2019re interested in submitting a resource to be included here, please feel free to open a Pull Request and we\u2019ll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource."),Vc.forEach(o),rr=m(t),de=r(t,"H2",{class:!0});var jr=n(de);Se=r(jr,"A",{id:!0,class:!0,href:!0});var Rc=n(Se);Vs=r(Rc,"SPAN",{});var Hc=n(Vs);w(Lt.$$.fragment,Hc),Hc.forEach(o),Rc.forEach(o),li=m(jr),Rs=r(jr,"SPAN",{});var Uc=n(Rs);di=l(Uc,"DeiTConfig"),Uc.forEach(o),jr.forEach(o),nr=m(t),q=r(t,"DIV",{class:!0});var Tt=n(q);w(Wt.$$.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(Ve.$$.fragment,Tt),Tt.forEach(o),ir=m(t),he=r(t,"H2",{class:!0});var Er=n(he);Re=r(Er,"A",{id:!0,class:!0,href:!0});var Yc=n(Re);Hs=r(Yc,"SPAN",{});var Xc=n(Hs);w(Vt.$$.fragment,Xc),Xc.forEach(o),Yc.forEach(o),yi=m(Er),Us=r(Er,"SPAN",{});var Qc=n(Us);ki=l(Qc,"DeiTFeatureExtractor"),Qc.forEach(o),Er.forEach(o),lr=m(t),me=r(t,"DIV",{class:!0});var Pr=n(me);w(Rt.$$.fragment,Pr),Di=m(Pr),He=r(Pr,"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),Pr.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),Mi=m(Ar),Gs=r(Ar,"SPAN",{});var op=n(Gs);xi=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);Ei=l(sp,"Constructs a DeiT image processor."),sp.forEach(o),Pi=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);Li=l(lp,"torch.nn.Module"),lp.forEach(o),Wi=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),Vi=m(vt),ue=r(vt,"P",{});var vs=n(ue);Ri=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 Lr=n(to);Zi=l(Lr,"DeiT Model with a decoder on top for masked image modeling, as proposed in "),oo=r(Lr,"A",{href:!0,rel:!0});var fp=n(oo);el=l(fp,"SimMIM"),fp.forEach(o),tl=l(Lr,"."),Lr.forEach(o),ol=m(ae),w(Xe.$$.fragment,ae),sl=m(ae),so=r(ae,"P",{});var Wr=n(so);al=l(Wr,"This model is a PyTorch "),ao=r(Wr,"A",{href:!0,rel:!0});var gp=n(ao);rl=l(gp,"torch.nn.Module"),gp.forEach(o),nl=l(Wr,` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Wr.forEach(o),il=m(ae),V=r(ae,"DIV",{class:!0});var bt=n(V);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 Vr=n(lo);wl=l(Vr,"This model is a PyTorch "),co=r(Vr,"A",{href:!0,rel:!0});var $p=n(co);$l=l($p,"torch.nn.Module"),$p.forEach(o),yl=l(Vr,` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Vr.forEach(o),kl=m(wt),R=r(wt,"DIV",{class:!0});var $t=n(R);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),Ml=l(ws," forward method, overrides the "),na=r(ws,"CODE",{});var kp=n(na);xl=l(kp,"__call__"),kp.forEach(o),jl=l(ws," special method."),ws.forEach(o),El=m($t),w(tt.$$.fragment,$t),Pl=m($t),w(ot.$$.fragment,$t),$t.forEach(o),wt.forEach(o),_r=m(t),we=r(t,"H2",{class:!0});var Rr=n(we);st=r(Rr,"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(Rr),la=r(Rr,"SPAN",{});var Fp=n(la);Al=l(Fp,"DeiTForImageClassificationWithTeacher"),Fp.forEach(o),Rr.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 Mp=n(da);ql=l(Mp,`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.`),Mp.forEach(o),Nl=m(K),ca=r(K,"P",{});var xp=n(ca);Ol=l(xp,".. warning::"),xp.forEach(o),Ll=m(K),pa=r(K,"P",{});var jp=n(pa);Wl=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);Vl=l(Hr,"This model is a PyTorch "),go=r(Hr,"A",{href:!0,rel:!0});var Ep=n(go);Rl=l(Ep,"torch.nn.Module"),Ep.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 Pp=n(ds);Gl=l(Pp,"DeiTForImageClassificationWithTeacher"),Pp.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 Lp=n(ga);pd=l(Lp,"__call__"),Lp.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 Wp=n(dt);ua=r(Wp,"SPAN",{});var Sp=n(ua);w($o.$$.fragment,Sp),Sp.forEach(o),Wp.forEach(o),gd=m(Jr),_a=r(Jr,"SPAN",{});var Vp=n(_a);ud=l(Vp,"TFDeiTForMaskedImageModeling"),Vp.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 Rp=n(ko);vd=l(Rp,"SimMIM"),Rp.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);Md=l(Bp,"__call__"),Bp.forEach(o),xd=l(Fs," special method."),Fs.forEach(o),jd=m(Dt),w(ct.$$.fragment,Dt),Ed=m(Dt),w(pt.$$.fragment,Dt),Dt.forEach(o),Ds.forEach(o),yr=m(t),Me=r(t,"H2",{class:!0});var Gr=n(Me);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),Pd=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(Mo.$$.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),xo=r(It,"P",{});var Kr=n(xo);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),Ld=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),Wd=m(It),J=r(It,"DIV",{class:!0});var Ft=n(J);w(Eo.$$.fragment,Ft),Sd=m(Ft),xe=r(Ft,"P",{});var Ms=n(xe);Vd=l(Ms,"The "),hs=r(Ms,"A",{href:!0});var Qp=n(hs);Rd=l(Qp,"TFDeiTForImageClassification"),Qp.forEach(o),Hd=l(Ms," forward method, overrides the "),$a=r(Ms,"CODE",{});var Zp=n($a);Ud=l(Zp,"__call__"),Zp.forEach(o),Bd=l(Ms," special method."),Ms.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(Po.$$.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),E=r(t,"DIV",{class:!0});var Y=n(E);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 Mt=n(G);w(qo.$$.fragment,Mt),lc=m(Mt),Ee=r(Mt,"P",{});var xs=n(Ee);dc=l(xs,"The "),ms=r(xs,"A",{href:!0});var ih=n(ms);cc=l(ih,"TFDeiTForImageClassificationWithTeacher"),ih.forEach(o),pc=l(xs," forward method, overrides the "),Ma=r(xs,"CODE",{});var lh=n(Ma);hc=l(lh,"__call__"),lh.forEach(o),mc=l(xs," special method."),xs.forEach(o),fc=m(Mt),w(ut.$$.fragment,Mt),gc=m(Mt),w(_t.$$.fragment,Mt),Mt.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(Wo,"href","vit"),c(Et,"href","https://arxiv.org/abs/2010.11929"),c(Et,"rel","nofollow"),c(Ho,"href","/docs/transformers/v4.27.1/en/model_doc/deit#transformers.DeiTForImageClassification"),c(Uo,"href","/docs/transformers/v4.27.1/en/model_doc/deit#transformers.DeiTForImageClassificationWithTeacher"),c(Bo,"href","/docs/transformers/v4.27.1/en/model_doc/vit#transformers.ViTModel"),c(Jo,"href","/docs/transformers/v4.27.1/en/model_doc/vit#transformers.ViTForImageClassification"),c(Go,"href","/docs/transformers/v4.27.1/en/model_doc/deit#transformers.DeiTImageProcessor"),c(Pt,"href","https://huggingface.co/nielsr"),c(Pt,"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.27.1/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.27.1/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.27.1/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.27.1/en/main_classes/configuration#transformers.PretrainedConfig"),c(rs,"href","/docs/transformers/v4.27.1/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(Re,"id","transformers.DeiTFeatureExtractor"),c(Re,"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(Re,"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.27.1/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.27.1/en/model_doc/deit#transformers.DeiTForMaskedImageModeling"),c(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(et,"id","transformers.DeiTForImageClassification"),c(et,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(et,"href","#transformers.DeiTForImageClassification"),c(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.27.1/en/model_doc/deit#transformers.DeiTForImageClassification"),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(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.27.1/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.27.1/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.27.1/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(Me,"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.27.1/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.27.1/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(E,"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),$(xt,js,null),e(ne,Zr),e(ne,Es),e(Es,en),_(t,Ba,u),_(t,W,u),e(W,tn),e(W,jt),e(jt,on),e(W,sn),e(W,Wo),e(Wo,an),e(W,rn),e(W,Et),e(Et,nn),e(W,ln),_(t,Ja,u),_(t,So,u),e(So,dn),_(t,Ga,u),_(t,Vo,u),e(Vo,Ps),e(Ps,cn),_(t,Ka,u),_(t,Ro,u),e(Ro,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,x),e(x,kn),e(x,Bo),e(Bo,Dn),e(x,In),e(x,Jo),e(Jo,Fn),e(x,Mn),e(x,qs),e(qs,xn),e(x,jn),e(x,Ns),e(Ns,En),e(x,Pn),e(x,Os),e(Os,Cn),e(x,An),e(x,Ls),e(Ls,zn),e(x,qn),e(x,Go),e(Go,Nn),e(x,On),_(t,Xa,u),_(t,oe,u),e(oe,Ln),e(oe,Pt),e(Pt,Wn),e(oe,Sn),e(oe,Ct),e(Ct,Vn),e(oe,Rn),_(t,Qa,u),_(t,le,u),e(le,Oe),e(Oe,Ws),$(At,Ws,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,Le,u),e(Le,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(Le,Zn),e(Le,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,We),e(We,ts),e(ts,si),e(We,ai),e(We,Ot),e(Ot,ri),e(We,ni),_(t,ar,u),_(t,os,u),e(os,ii),_(t,rr,u),_(t,de,u),e(de,Se),e(Se,Vs),$(Lt,Vs,null),e(de,li),e(de,Rs),e(Rs,di),_(t,nr,u),_(t,q,u),$(Wt,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),$(Ve,q,null),_(t,ir,u),_(t,he,u),e(he,Re),e(Re,Hs),$(Vt,Hs,null),e(he,yi),e(he,Us),e(Us,ki),_(t,lr,u),_(t,me,u),$(Rt,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,Mi),e(fe,Gs),e(Gs,xi),_(t,cr,u),_(t,X,u),$(Bt,X,null),e(X,ji),e(X,Ks),e(Ks,Ei),e(X,Pi),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,Li),e(Yt,Wi),e(Q,Si),e(Q,S),$(Qt,S,null),e(S,Vi),e(S,ue),e(ue,Ri),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,V),$(ro,V,null),e(V,ll),e(V,Te),e(Te,dl),e(Te,is),e(is,cl),e(Te,pl),e(Te,oa),e(oa,hl),e(Te,ml),e(V,fl),$(Qe,V,null),e(V,gl),$(Ze,V,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,R),$(po,R,null),e(R,Dl),e(R,be),e(be,Il),e(be,ls),e(ls,Fl),e(be,Ml),e(be,na),e(na,xl),e(be,jl),e(R,El),$(tt,R,null),e(R,Pl),$(ot,R,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,Ll),e(j,pa),e(pa,Wl),e(j,Sl),e(j,fo),e(fo,Vl),e(fo,go),e(go,Rl),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,Md),e(Fe,xd),e(B,jd),$(ct,B,null),e(B,Ed),$(pt,B,null),_(t,yr,u),_(t,Me,u),e(Me,ht),e(ht,va),$(Fo,va,null),e(Me,Pd),e(Me,ba),e(ba,Cd),_(t,kr,u),_(t,O,u),$(Mo,O,null),e(O,Ad),e(O,wa),e(wa,zd),e(O,qd),e(O,xo),e(xo,Nd),e(xo,jo),e(jo,Od),e(xo,Ld),e(O,Wd),e(O,J),$(Eo,J,null),e(J,Sd),e(J,xe),e(xe,Vd),e(xe,hs),e(hs,Rd),e(xe,Hd),e(xe,$a),e($a,Ud),e(xe,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),$(Po,ya,null),e(je,Kd),e(je,ka),e(ka,Yd),_(t,Ir,u),_(t,E,u),$(Co,E,null),e(E,Xd),e(E,Da),e(Da,Qd),e(E,Zd),e(E,Ia),e(Ia,ec),e(E,tc),e(E,Fa),e(Fa,oc),e(E,sc),e(E,Ao),e(Ao,ac),e(Ao,zo),e(zo,rc),e(Ao,nc),e(E,ic),e(E,G),$(qo,G,null),e(G,lc),e(G,Ee),e(Ee,dc),e(Ee,ms),e(ms,cc),e(Ee,pc),e(Ee,Ma),e(Ma,hc),e(Ee,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 xa={};u&2&&(xa.$$scope={dirty:u,ctx:t}),Ve.$set(xa);const ja={};u&2&&(ja.$$scope={dirty:u,ctx:t}),Ge.$set(ja);const Ea={};u&2&&(Ea.$$scope={dirty:u,ctx:t}),Ke.$set(Ea);const Oo={};u&2&&(Oo.$$scope={dirty:u,ctx:t}),Xe.$set(Oo);const Pa={};u&2&&(Pa.$$scope={dirty:u,ctx:t}),Qe.$set(Pa);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 La={};u&2&&(La.$$scope={dirty:u,ctx:t}),ct.$set(La);const Wa={};u&2&&(Wa.$$scope={dirty:u,ctx:t}),pt.$set(Wa);const Sa={};u&2&&(Sa.$$scope={dirty:u,ctx:t}),mt.$set(Sa);const L={};u&2&&(L.$$scope={dirty:u,ctx:t}),ft.$set(L);const Va={};u&2&&(Va.$$scope={dirty:u,ctx:t}),ut.$set(Va);const Pe={};u&2&&(Pe.$$scope={dirty:u,ctx:t}),_t.$set(Pe)},i(t){Fr||(y(s.$$.fragment,t),y(qe.$$.fragment,t),y(xt.$$.fragment,t),y(At.$$.fragment,t),y(zt.$$.fragment,t),y(Lt.$$.fragment,t),y(Wt.$$.fragment,t),y(Ve.$$.fragment,t),y(Vt.$$.fragment,t),y(Rt.$$.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(Mo.$$.fragment,t),y(Eo.$$.fragment,t),y(mt.$$.fragment,t),y(ft.$$.fragment,t),y(Po.$$.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(xt.$$.fragment,t),k(At.$$.fragment,t),k(zt.$$.fragment,t),k(Lt.$$.fragment,t),k(Wt.$$.fragment,t),k(Ve.$$.fragment,t),k(Vt.$$.fragment,t),k(Rt.$$.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(Mo.$$.fragment,t),k(Eo.$$.fragment,t),k(mt.$$.fragment,t),k(ft.$$.fragment,t),k(Po.$$.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(xt),t&&o(Ba),t&&o(W),t&&o(Ja),t&&o(So),t&&o(Ga),t&&o(Vo),t&&o(Ka),t&&o(Ro),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(Le),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(Lt),t&&o(nr),t&&o(q),D(Wt),D(Ve),t&&o(ir),t&&o(he),D(Vt),t&&o(lr),t&&o(me),D(Rt),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(Me),D(Fo),t&&o(kr),t&&o(O),D(Mo),D(Eo),D(mt),D(ft),t&&o(Dr),t&&o(je),D(Po),t&&o(Ir),t&&o(E),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};
