import{S as Zd,i as ec,s as tc,e as n,k as m,w as T,t as a,M as oc,c as s,d as o,m as p,a as r,x as k,h as i,b as c,N as nc,G as e,g,y,q as w,o as x,B as $,v as sc,L as qo}from"../../chunks/vendor-hf-doc-builder.js";import{T as Lo}from"../../chunks/Tip-hf-doc-builder.js";import{D as P}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Oo}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as R}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Co}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function rc(V){let d,b,_,u,v;return u=new Oo({props:{code:`from transformers import ViLTModel, ViLTConfig

# Initializing a ViLT dandelin/vilt-b32-mlm style configuration
configuration = ViLTConfig()

# Initializing a model from the dandelin/vilt-b32-mlm style configuration
model = ViLTModel(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> ViLTModel, ViLTConfig

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a ViLT dandelin/vilt-b32-mlm style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = ViLTConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model from the dandelin/vilt-b32-mlm style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ViLTModel(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=n("p"),b=a("Example:"),_=m(),T(u.$$.fragment)},l(l){d=s(l,"P",{});var f=r(d);b=i(f,"Example:"),f.forEach(o),_=p(l),k(u.$$.fragment,l)},m(l,f){g(l,d,f),e(d,b),g(l,_,f),y(u,l,f),v=!0},p:qo,i(l){v||(w(u.$$.fragment,l),v=!0)},o(l){x(u.$$.fragment,l),v=!1},d(l){l&&o(d),l&&o(_),$(u,l)}}}function ac(V){let d,b,_,u,v;return{c(){d=n("p"),b=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=n("code"),u=a("Module"),v=a(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){d=s(l,"P",{});var f=r(d);b=i(f,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=s(f,"CODE",{});var F=r(_);u=i(F,"Module"),F.forEach(o),v=i(f,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),f.forEach(o)},m(l,f){g(l,d,f),e(d,b),e(d,_),e(_,u),e(d,v)},d(l){l&&o(d)}}}function ic(V){let d,b,_,u,v;return u=new Oo({props:{code:`from transformers import ViltProcessor, ViltModel
from PIL import Image
import requests

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

processor = ViltProcessor.from_pretrained("dandelin/vilt-b32-mlm")
model = ViltModel.from_pretrained("dandelin/vilt-b32-mlm")

inputs = processor(image, text, return_tensors="pt")
outputs = model(**inputs)
last_hidden_states = outputs.last_hidden_state`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> ViltProcessor, ViltModel
<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><span class="hljs-comment"># prepare image and text</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>text = <span class="hljs-string">&quot;hello world&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = ViltProcessor.from_pretrained(<span class="hljs-string">&quot;dandelin/vilt-b32-mlm&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ViltModel.from_pretrained(<span class="hljs-string">&quot;dandelin/vilt-b32-mlm&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(image, text, 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>last_hidden_states = outputs.last_hidden_state`}}),{c(){d=n("p"),b=a("Examples:"),_=m(),T(u.$$.fragment)},l(l){d=s(l,"P",{});var f=r(d);b=i(f,"Examples:"),f.forEach(o),_=p(l),k(u.$$.fragment,l)},m(l,f){g(l,d,f),e(d,b),g(l,_,f),y(u,l,f),v=!0},p:qo,i(l){v||(w(u.$$.fragment,l),v=!0)},o(l){x(u.$$.fragment,l),v=!1},d(l){l&&o(d),l&&o(_),$(u,l)}}}function lc(V){let d,b,_,u,v;return{c(){d=n("p"),b=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=n("code"),u=a("Module"),v=a(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){d=s(l,"P",{});var f=r(d);b=i(f,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=s(f,"CODE",{});var F=r(_);u=i(F,"Module"),F.forEach(o),v=i(f,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),f.forEach(o)},m(l,f){g(l,d,f),e(d,b),e(d,_),e(_,u),e(d,v)},d(l){l&&o(d)}}}function dc(V){let d,b,_,u,v;return u=new Oo({props:{code:`from transformers import ViltProcessor, ViltForMaskedLM
import requests
from PIL import Image
import re
import torch

url = "http://images.cocodataset.org/val2017/000000039769.jpg"
image = Image.open(requests.get(url, stream=True).raw)
text = "a bunch of [MASK] laying on a [MASK]."

processor = ViltProcessor.from_pretrained("dandelin/vilt-b32-mlm")
model = ViltForMaskedLM.from_pretrained("dandelin/vilt-b32-mlm")

# prepare inputs
encoding = processor(image, text, return_tensors="pt")

# forward pass
outputs = model(**encoding)

tl = len(re.findall("\\[MASK\\]", text))
inferred_token = [text]

# gradually fill in the MASK tokens, one by one
with torch.no_grad():
    for i in range(tl):
        encoded = processor.tokenizer(inferred_token)
        input_ids = torch.tensor(encoded.input_ids)
        encoded = encoded["input_ids"][0][1:-1]
        outputs = model(input_ids=input_ids, pixel_values=encoding.pixel_values)
        mlm_logits = outputs.logits[0]  # shape (seq_len, vocab_size)
        # only take into account text features (minus CLS and SEP token)
        mlm_logits = mlm_logits[1 : input_ids.shape[1] - 1, :]
        mlm_values, mlm_ids = mlm_logits.softmax(dim=-1).max(dim=-1)
        # only take into account text
        mlm_values[torch.tensor(encoded) != 103] = 0
        select = mlm_values.argmax().item()
        encoded[select] = mlm_ids[select].item()
        inferred_token = [processor.decode(encoded)]

selected_token = ""
encoded = processor.tokenizer(inferred_token)
output = processor.decode(encoded.input_ids[0], skip_special_tokens=True)
print(output)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> ViltProcessor, ViltForMaskedLM
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests
<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> re
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<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>text = <span class="hljs-string">&quot;a bunch of [MASK] laying on a [MASK].&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = ViltProcessor.from_pretrained(<span class="hljs-string">&quot;dandelin/vilt-b32-mlm&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ViltForMaskedLM.from_pretrained(<span class="hljs-string">&quot;dandelin/vilt-b32-mlm&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># prepare inputs</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>encoding = processor(image, text, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># forward pass</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**encoding)

<span class="hljs-meta">&gt;&gt;&gt; </span>tl = <span class="hljs-built_in">len</span>(re.findall(<span class="hljs-string">&quot;\\[MASK\\]&quot;</span>, text))
<span class="hljs-meta">&gt;&gt;&gt; </span>inferred_token = [text]

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># gradually fill in the MASK tokens, one by one</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> <span class="hljs-built_in">range</span>(tl):
<span class="hljs-meta">... </span>        encoded = processor.tokenizer(inferred_token)
<span class="hljs-meta">... </span>        input_ids = torch.tensor(encoded.input_ids)
<span class="hljs-meta">... </span>        encoded = encoded[<span class="hljs-string">&quot;input_ids&quot;</span>][<span class="hljs-number">0</span>][<span class="hljs-number">1</span>:-<span class="hljs-number">1</span>]
<span class="hljs-meta">... </span>        outputs = model(input_ids=input_ids, pixel_values=encoding.pixel_values)
<span class="hljs-meta">... </span>        mlm_logits = outputs.logits[<span class="hljs-number">0</span>]  <span class="hljs-comment"># shape (seq_len, vocab_size)</span>
<span class="hljs-meta">... </span>        <span class="hljs-comment"># only take into account text features (minus CLS and SEP token)</span>
<span class="hljs-meta">... </span>        mlm_logits = mlm_logits[<span class="hljs-number">1</span> : input_ids.shape[<span class="hljs-number">1</span>] - <span class="hljs-number">1</span>, :]
<span class="hljs-meta">... </span>        mlm_values, mlm_ids = mlm_logits.softmax(dim=-<span class="hljs-number">1</span>).<span class="hljs-built_in">max</span>(dim=-<span class="hljs-number">1</span>)
<span class="hljs-meta">... </span>        <span class="hljs-comment"># only take into account text</span>
<span class="hljs-meta">... </span>        mlm_values[torch.tensor(encoded) != <span class="hljs-number">103</span>] = <span class="hljs-number">0</span>
<span class="hljs-meta">... </span>        select = mlm_values.argmax().item()
<span class="hljs-meta">... </span>        encoded[select] = mlm_ids[select].item()
<span class="hljs-meta">... </span>        inferred_token = [processor.decode(encoded)]

<span class="hljs-meta">&gt;&gt;&gt; </span>selected_token = <span class="hljs-string">&quot;&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>encoded = processor.tokenizer(inferred_token)
<span class="hljs-meta">&gt;&gt;&gt; </span>output = processor.decode(encoded.input_ids[<span class="hljs-number">0</span>], skip_special_tokens=<span class="hljs-literal">True</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(output)
a bunch of cats laying on a couch.`}}),{c(){d=n("p"),b=a("Examples:"),_=m(),T(u.$$.fragment)},l(l){d=s(l,"P",{});var f=r(d);b=i(f,"Examples:"),f.forEach(o),_=p(l),k(u.$$.fragment,l)},m(l,f){g(l,d,f),e(d,b),g(l,_,f),y(u,l,f),v=!0},p:qo,i(l){v||(w(u.$$.fragment,l),v=!0)},o(l){x(u.$$.fragment,l),v=!1},d(l){l&&o(d),l&&o(_),$(u,l)}}}function cc(V){let d,b,_,u,v;return{c(){d=n("p"),b=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=n("code"),u=a("Module"),v=a(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){d=s(l,"P",{});var f=r(d);b=i(f,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=s(f,"CODE",{});var F=r(_);u=i(F,"Module"),F.forEach(o),v=i(f,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),f.forEach(o)},m(l,f){g(l,d,f),e(d,b),e(d,_),e(_,u),e(d,v)},d(l){l&&o(d)}}}function mc(V){let d,b,_,u,v;return u=new Oo({props:{code:`from transformers import ViltProcessor, ViltForQuestionAnswering
import requests
from PIL import Image

url = "http://images.cocodataset.org/val2017/000000039769.jpg"
image = Image.open(requests.get(url, stream=True).raw)
text = "How many cats are there?"

processor = ViltProcessor.from_pretrained("dandelin/vilt-b32-finetuned-vqa")
model = ViltForQuestionAnswering.from_pretrained("dandelin/vilt-b32-finetuned-vqa")

# prepare inputs
encoding = processor(image, text, return_tensors="pt")

# forward pass
outputs = model(**encoding)
logits = outputs.logits
idx = logits.argmax(-1).item()
print("Predicted answer:", model.config.id2label[idx])`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> ViltProcessor, ViltForQuestionAnswering
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests
<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>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>text = <span class="hljs-string">&quot;How many cats are there?&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = ViltProcessor.from_pretrained(<span class="hljs-string">&quot;dandelin/vilt-b32-finetuned-vqa&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ViltForQuestionAnswering.from_pretrained(<span class="hljs-string">&quot;dandelin/vilt-b32-finetuned-vqa&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># prepare inputs</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>encoding = processor(image, text, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># forward pass</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**encoding)
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = outputs.logits
<span class="hljs-meta">&gt;&gt;&gt; </span>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 answer:&quot;</span>, model.config.id2label[idx])
Predicted answer: <span class="hljs-number">2</span>`}}),{c(){d=n("p"),b=a("Examples:"),_=m(),T(u.$$.fragment)},l(l){d=s(l,"P",{});var f=r(d);b=i(f,"Examples:"),f.forEach(o),_=p(l),k(u.$$.fragment,l)},m(l,f){g(l,d,f),e(d,b),g(l,_,f),y(u,l,f),v=!0},p:qo,i(l){v||(w(u.$$.fragment,l),v=!0)},o(l){x(u.$$.fragment,l),v=!1},d(l){l&&o(d),l&&o(_),$(u,l)}}}function pc(V){let d,b,_,u,v;return{c(){d=n("p"),b=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=n("code"),u=a("Module"),v=a(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){d=s(l,"P",{});var f=r(d);b=i(f,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=s(f,"CODE",{});var F=r(_);u=i(F,"Module"),F.forEach(o),v=i(f,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),f.forEach(o)},m(l,f){g(l,d,f),e(d,b),e(d,_),e(_,u),e(d,v)},d(l){l&&o(d)}}}function hc(V){let d,b,_,u,v;return u=new Oo({props:{code:`from transformers import ViltProcessor, ViltForImagesAndTextClassification
import requests
from PIL import Image

image1 = Image.open(requests.get("https://lil.nlp.cornell.edu/nlvr/exs/ex0_0.jpg", stream=True).raw)
image2 = Image.open(requests.get("https://lil.nlp.cornell.edu/nlvr/exs/ex0_1.jpg", stream=True).raw)
text = "The left image contains twice the number of dogs as the right image."

processor = ViltProcessor.from_pretrained("dandelin/vilt-b32-finetuned-nlvr2")
model = ViltForImagesAndTextClassification.from_pretrained("dandelin/vilt-b32-finetuned-nlvr2")

# prepare inputs
encoding = processor([image1, image2], text, return_tensors="pt")

# forward pass
outputs = model(input_ids=encoding.input_ids, pixel_values=encoding.pixel_values.unsqueeze(0))
logits = outputs.logits
idx = logits.argmax(-1).item()
print("Predicted answer:", model.config.id2label[idx])`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> ViltProcessor, ViltForImagesAndTextClassification
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests
<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>image1 = Image.<span class="hljs-built_in">open</span>(requests.get(<span class="hljs-string">&quot;https://lil.nlp.cornell.edu/nlvr/exs/ex0_0.jpg&quot;</span>, stream=<span class="hljs-literal">True</span>).raw)
<span class="hljs-meta">&gt;&gt;&gt; </span>image2 = Image.<span class="hljs-built_in">open</span>(requests.get(<span class="hljs-string">&quot;https://lil.nlp.cornell.edu/nlvr/exs/ex0_1.jpg&quot;</span>, stream=<span class="hljs-literal">True</span>).raw)
<span class="hljs-meta">&gt;&gt;&gt; </span>text = <span class="hljs-string">&quot;The left image contains twice the number of dogs as the right image.&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = ViltProcessor.from_pretrained(<span class="hljs-string">&quot;dandelin/vilt-b32-finetuned-nlvr2&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ViltForImagesAndTextClassification.from_pretrained(<span class="hljs-string">&quot;dandelin/vilt-b32-finetuned-nlvr2&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># prepare inputs</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>encoding = processor([image1, image2], text, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># forward pass</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(input_ids=encoding.input_ids, pixel_values=encoding.pixel_values.unsqueeze(<span class="hljs-number">0</span>))
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = outputs.logits
<span class="hljs-meta">&gt;&gt;&gt; </span>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 answer:&quot;</span>, model.config.id2label[idx])
Predicted answer: <span class="hljs-literal">True</span>`}}),{c(){d=n("p"),b=a("Examples:"),_=m(),T(u.$$.fragment)},l(l){d=s(l,"P",{});var f=r(d);b=i(f,"Examples:"),f.forEach(o),_=p(l),k(u.$$.fragment,l)},m(l,f){g(l,d,f),e(d,b),g(l,_,f),y(u,l,f),v=!0},p:qo,i(l){v||(w(u.$$.fragment,l),v=!0)},o(l){x(u.$$.fragment,l),v=!1},d(l){l&&o(d),l&&o(_),$(u,l)}}}function fc(V){let d,b,_,u,v;return{c(){d=n("p"),b=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=n("code"),u=a("Module"),v=a(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){d=s(l,"P",{});var f=r(d);b=i(f,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=s(f,"CODE",{});var F=r(_);u=i(F,"Module"),F.forEach(o),v=i(f,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),f.forEach(o)},m(l,f){g(l,d,f),e(d,b),e(d,_),e(_,u),e(d,v)},d(l){l&&o(d)}}}function gc(V){let d,b,_,u,v;return u=new Oo({props:{code:`from transformers import ViltProcessor, ViltForImageAndTextRetrieval
import requests
from PIL import Image

url = "http://images.cocodataset.org/val2017/000000039769.jpg"
image = Image.open(requests.get(url, stream=True).raw)
texts = ["An image of two cats chilling on a couch", "A football player scoring a goal"]

processor = ViltProcessor.from_pretrained("dandelin/vilt-b32-finetuned-coco")
model = ViltForImageAndTextRetrieval.from_pretrained("dandelin/vilt-b32-finetuned-coco")

# forward pass
scores = dict()
for text in texts:
    # prepare inputs
    encoding = processor(image, text, return_tensors="pt")
    outputs = model(**encoding)
    scores[text] = outputs.logits[0, :].item()`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> ViltProcessor, ViltForImageAndTextRetrieval
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests
<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>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>texts = [<span class="hljs-string">&quot;An image of two cats chilling on a couch&quot;</span>, <span class="hljs-string">&quot;A football player scoring a goal&quot;</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = ViltProcessor.from_pretrained(<span class="hljs-string">&quot;dandelin/vilt-b32-finetuned-coco&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ViltForImageAndTextRetrieval.from_pretrained(<span class="hljs-string">&quot;dandelin/vilt-b32-finetuned-coco&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># forward pass</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>scores = <span class="hljs-built_in">dict</span>()
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> text <span class="hljs-keyword">in</span> texts:
<span class="hljs-meta">... </span>    <span class="hljs-comment"># prepare inputs</span>
<span class="hljs-meta">... </span>    encoding = processor(image, text, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">... </span>    outputs = model(**encoding)
<span class="hljs-meta">... </span>    scores[text] = outputs.logits[<span class="hljs-number">0</span>, :].item()`}}),{c(){d=n("p"),b=a("Examples:"),_=m(),T(u.$$.fragment)},l(l){d=s(l,"P",{});var f=r(d);b=i(f,"Examples:"),f.forEach(o),_=p(l),k(u.$$.fragment,l)},m(l,f){g(l,d,f),e(d,b),g(l,_,f),y(u,l,f),v=!0},p:qo,i(l){v||(w(u.$$.fragment,l),v=!0)},o(l){x(u.$$.fragment,l),v=!1},d(l){l&&o(d),l&&o(_),$(u,l)}}}function uc(V){let d,b,_,u,v;return{c(){d=n("p"),b=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=n("code"),u=a("Module"),v=a(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){d=s(l,"P",{});var f=r(d);b=i(f,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=s(f,"CODE",{});var F=r(_);u=i(F,"Module"),F.forEach(o),v=i(f,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),f.forEach(o)},m(l,f){g(l,d,f),e(d,b),e(d,_),e(_,u),e(d,v)},d(l){l&&o(d)}}}function _c(V){let d,b,_,u,v,l,f,F,Gs,Gn,Y,be,No,lt,Js,So,Ys,Jn,Te,Xs,dt,Zs,er,Yn,Zt,tr,Xn,eo,Do,or,Zn,to,nr,es,C,ct,sr,mt,rr,ar,ir,W,lr,Ro,dr,cr,Wo,mr,pr,oo,hr,fr,gr,X,ur,Bo,_r,vr,no,br,Tr,kr,Qo,yr,ts,ke,wl,os,ye,wr,so,xr,$r,ns,K,Vr,pt,Fr,Pr,ht,zr,Ir,ss,ro,Mr,rs,ao,Uo,jr,as,Z,we,Ho,ft,Ar,Ko,Er,is,I,gt,Lr,ee,Cr,Go,qr,Or,ut,Nr,Sr,Dr,te,Rr,io,Wr,Br,lo,Qr,Ur,Hr,xe,ls,oe,$e,Jo,_t,Kr,Yo,Gr,ds,ne,vt,Jr,Ve,bt,Yr,Xo,Xr,cs,se,Fe,Zo,Tt,Zr,en,ea,ms,B,kt,ta,tn,oa,na,Pe,yt,sa,on,ra,ps,re,ze,nn,wt,aa,sn,ia,hs,M,xt,la,rn,da,ca,z,co,ma,pa,mo,ha,fa,po,ga,ua,$t,an,_a,va,ba,ln,Ta,ka,ya,G,Vt,wa,ae,xa,Ie,$a,dn,Va,Fa,Pa,Me,za,cn,Ia,Ma,ja,Aa,mn,Ea,fs,ie,je,pn,Ft,La,hn,Ca,gs,Q,Pt,qa,zt,Oa,fn,Na,Sa,Da,q,It,Ra,le,Wa,ho,Ba,Qa,gn,Ua,Ha,Ka,Ae,Ga,Ee,us,de,Le,un,Mt,Ja,_n,Ya,_s,j,jt,Xa,vn,Za,ei,At,ti,bn,oi,ni,si,O,Et,ri,ce,ai,fo,ii,li,Tn,di,ci,mi,Ce,pi,qe,vs,me,Oe,kn,Lt,hi,yn,fi,bs,A,Ct,gi,wn,ui,_i,qt,vi,xn,bi,Ti,ki,N,Ot,yi,pe,wi,go,xi,$i,$n,Vi,Fi,Pi,Ne,zi,Se,Ts,he,De,Vn,Nt,Ii,Fn,Mi,ks,U,St,ji,Pn,Ai,Ei,S,Dt,Li,fe,Ci,uo,qi,Oi,zn,Ni,Si,Di,Re,Ri,We,ys,ge,Be,In,Rt,Wi,Mn,Bi,ws,E,Wt,Qi,jn,Ui,Hi,Bt,Ki,An,Gi,Ji,Yi,D,Qt,Xi,ue,Zi,_o,el,tl,En,ol,nl,sl,Qe,rl,Ue,xs,_e,He,Ln,Ut,al,Cn,il,$s,L,Ht,ll,qn,dl,cl,Kt,ml,On,pl,hl,fl,J,Gt,gl,ve,ul,vo,_l,vl,Nn,bl,Tl,kl,Ke,Vs;return l=new R({}),lt=new R({}),ft=new R({}),gt=new P({props:{name:"class transformers.ViltConfig",anchor:"transformers.ViltConfig",parameters:[{name:"vocab_size",val:" = 30522"},{name:"type_vocab_size",val:" = 2"},{name:"modality_type_vocab_size",val:" = 2"},{name:"max_position_embeddings",val:" = 40"},{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:" = 384"},{name:"patch_size",val:" = 32"},{name:"num_channels",val:" = 3"},{name:"qkv_bias",val:" = True"},{name:"max_image_length",val:" = -1"},{name:"tie_word_embeddings",val:" = False"},{name:"num_images",val:" = -1"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.ViltConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 30522) &#x2014;
Vocabulary size of the text part of the model. Defines the number of different tokens that can be
represented by the <code>inputs_ids</code> passed when calling <a href="/docs/transformers/v4.29.0/en/model_doc/vilt#transformers.ViltModel">ViltModel</a>.`,name:"vocab_size"},{anchor:"transformers.ViltConfig.type_vocab_size",description:`<strong>type_vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 2) &#x2014;
The vocabulary size of the <code>token_type_ids</code> passed when calling <a href="/docs/transformers/v4.29.0/en/model_doc/vilt#transformers.ViltModel">ViltModel</a>. This is used when encoding
text.`,name:"type_vocab_size"},{anchor:"transformers.ViltConfig.modality_type_vocab_size",description:`<strong>modality_type_vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 2) &#x2014;
The vocabulary size of the modalities passed when calling <a href="/docs/transformers/v4.29.0/en/model_doc/vilt#transformers.ViltModel">ViltModel</a>. This is used after concatening the
embeddings of the text and image modalities.`,name:"modality_type_vocab_size"},{anchor:"transformers.ViltConfig.max_position_embeddings",description:`<strong>max_position_embeddings</strong> (<code>int</code>, <em>optional</em>, defaults to 40) &#x2014;
The maximum sequence length that this model might ever be used with.`,name:"max_position_embeddings"},{anchor:"transformers.ViltConfig.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.ViltConfig.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.ViltConfig.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.ViltConfig.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.ViltConfig.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.ViltConfig.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.ViltConfig.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.ViltConfig.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.ViltConfig.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.ViltConfig.image_size",description:`<strong>image_size</strong> (<code>int</code>, <em>optional</em>, defaults to 384) &#x2014;
The size (resolution) of each image.`,name:"image_size"},{anchor:"transformers.ViltConfig.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, <em>optional</em>, defaults to 32) &#x2014;
The size (resolution) of each patch.`,name:"patch_size"},{anchor:"transformers.ViltConfig.num_channels",description:`<strong>num_channels</strong> (<code>int</code>, <em>optional</em>, defaults to 3) &#x2014;
The number of input channels.`,name:"num_channels"},{anchor:"transformers.ViltConfig.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.ViltConfig.max_image_length",description:`<strong>max_image_length</strong> (<code>int</code>, <em>optional</em>, defaults to -1) &#x2014;
The maximum number of patches to take as input for the Transformer encoder. If set to a positive integer,
the encoder will sample <code>max_image_length</code> patches at maximum. If set to -1, will not be taken into
account.`,name:"max_image_length"},{anchor:"transformers.ViltConfig.num_images",description:`<strong>num_images</strong> (<code>int</code>, <em>optional</em>, defaults to -1) &#x2014;
The number of images to use for natural language visual reasoning. If set to a positive integer, will be
used by <a href="/docs/transformers/v4.29.0/en/model_doc/vilt#transformers.ViltForImagesAndTextClassification">ViltForImagesAndTextClassification</a> for defining the classifier head.`,name:"num_images"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/vilt/configuration_vilt.py#L28"}}),xe=new Co({props:{anchor:"transformers.ViltConfig.example",$$slots:{default:[rc]},$$scope:{ctx:V}}}),_t=new R({}),vt=new P({props:{name:"class transformers.ViltFeatureExtractor",anchor:"transformers.ViltFeatureExtractor",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/vilt/feature_extraction_vilt.py#L26"}}),bt=new P({props:{name:"__call__",anchor:"transformers.ViltFeatureExtractor.__call__",parameters:[{name:"images",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/image_processing_utils.py#L462"}}),Tt=new R({}),kt=new P({props:{name:"class transformers.ViltImageProcessor",anchor:"transformers.ViltImageProcessor",parameters:[{name:"do_resize",val:": bool = True"},{name:"size",val:": typing.Dict[str, int] = None"},{name:"size_divisor",val:": int = 32"},{name:"resample",val:": Resampling = <Resampling.BICUBIC: 3>"},{name:"do_rescale",val:": bool = True"},{name:"rescale_factor",val:": typing.Union[int, float] = 0.00392156862745098"},{name:"do_normalize",val:": bool = True"},{name:"image_mean",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"image_std",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"do_pad",val:": bool = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.ViltImageProcessor.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 the
<code>do_resize</code> parameter in the <code>preprocess</code> method.`,name:"do_resize"},{anchor:"transformers.ViltImageProcessor.size",description:`<strong>size</strong> (<code>Dict[str, int]</code> <em>optional</em>, defaults to <code>{&quot;shortest_edge&quot; -- 384}</code>):
Resize the shorter side of the input to <code>size[&quot;shortest_edge&quot;]</code>. The longer side will be limited to under
<code>int((1333 / 800) * size[&quot;shortest_edge&quot;])</code> while preserving the aspect ratio. Only has an effect if
<code>do_resize</code> is set to <code>True</code>. Can be overridden by the <code>size</code> parameter in the <code>preprocess</code> method.`,name:"size"},{anchor:"transformers.ViltImageProcessor.size_divisor",description:`<strong>size_divisor</strong> (<code>int</code>, <em>optional</em>, defaults to 32) &#x2014;
The size by which to make sure both the height and width can be divided. Only has an effect if <code>do_resize</code>
is set to <code>True</code>. Can be overridden by the <code>size_divisor</code> parameter in the <code>preprocess</code> method.`,name:"size_divisor"},{anchor:"transformers.ViltImageProcessor.resample",description:`<strong>resample</strong> (<code>PILImageResampling</code>, <em>optional</em>, defaults to <code>PILImageResampling.BICUBIC</code>) &#x2014;
Resampling filter to use if resizing the image. Only has an effect if <code>do_resize</code> is set to <code>True</code>. Can be
overridden by the <code>resample</code> parameter in the <code>preprocess</code> method.`,name:"resample"},{anchor:"transformers.ViltImageProcessor.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Wwhether 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.ViltImageProcessor.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. Only has an effect if <code>do_rescale</code> is set to <code>True</code>. Can be
overridden by the <code>rescale_factor</code> parameter in the <code>preprocess</code> method.`,name:"rescale_factor"},{anchor:"transformers.ViltImageProcessor.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. Can be overridden by the <code>do_normalize</code> parameter in the <code>preprocess</code> method.`,name:"do_normalize"},{anchor:"transformers.ViltImageProcessor.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. Can be
overridden by the <code>image_mean</code> parameter in the <code>preprocess</code> method.`,name:"image_mean"},{anchor:"transformers.ViltImageProcessor.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.
Can be overridden by the <code>image_std</code> parameter in the <code>preprocess</code> method.`,name:"image_std"},{anchor:"transformers.ViltImageProcessor.do_pad",description:`<strong>do_pad</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to pad the image to the <code>(max_height, max_width)</code> of the images in the batch. Can be overridden by
the <code>do_pad</code> parameter in the <code>preprocess</code> method.`,name:"do_pad"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/vilt/image_processing_vilt.py#L111"}}),yt=new P({props:{name:"preprocess",anchor:"transformers.ViltImageProcessor.preprocess",parameters:[{name:"images",val:": typing.Union[ForwardRef('PIL.Image.Image'), numpy.ndarray, ForwardRef('torch.Tensor'), typing.List[ForwardRef('PIL.Image.Image')], typing.List[numpy.ndarray], typing.List[ForwardRef('torch.Tensor')]]"},{name:"do_resize",val:": typing.Optional[bool] = None"},{name:"size",val:": typing.Union[typing.Dict[str, int], NoneType] = None"},{name:"size_divisor",val:": typing.Optional[int] = None"},{name:"resample",val:": Resampling = None"},{name:"do_rescale",val:": typing.Optional[bool] = None"},{name:"rescale_factor",val:": typing.Optional[float] = None"},{name:"do_normalize",val:": typing.Optional[bool] = None"},{name:"image_mean",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"image_std",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"do_pad",val:": typing.Optional[bool] = None"},{name:"return_tensors",val:": typing.Union[transformers.utils.generic.TensorType, str, NoneType] = None"},{name:"data_format",val:": ChannelDimension = <ChannelDimension.FIRST: 'channels_first'>"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.ViltImageProcessor.preprocess.images",description:`<strong>images</strong> (<code>ImageInput</code>) &#x2014;
Image to preprocess.`,name:"images"},{anchor:"transformers.ViltImageProcessor.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.ViltImageProcessor.preprocess.size",description:`<strong>size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>self.size</code>) &#x2014;
Controls the size of the image after <code>resize</code>. The shortest edge of the image is resized to
<code>size[&quot;shortest_edge&quot;]</code> whilst preserving the aspect ratio. If the longest edge of this resized image
is &gt; <code>int(size[&quot;shortest_edge&quot;] * (1333 / 800))</code>, then the image is resized again to make the longest
edge equal to <code>int(size[&quot;shortest_edge&quot;] * (1333 / 800))</code>.`,name:"size"},{anchor:"transformers.ViltImageProcessor.preprocess.size_divisor",description:`<strong>size_divisor</strong> (<code>int</code>, <em>optional</em>, defaults to <code>self.size_divisor</code>) &#x2014;
The image is resized to a size that is a multiple of this value.`,name:"size_divisor"},{anchor:"transformers.ViltImageProcessor.preprocess.resample",description:`<strong>resample</strong> (<code>PILImageResampling</code>, <em>optional</em>, defaults to <code>self.resample</code>) &#x2014;
Resampling 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.ViltImageProcessor.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.ViltImageProcessor.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.ViltImageProcessor.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.ViltImageProcessor.preprocess.image_mean",description:`<strong>image_mean</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>self.image_mean</code>) &#x2014;
Image mean to normalize the image by if <code>do_normalize</code> is set to <code>True</code>.`,name:"image_mean"},{anchor:"transformers.ViltImageProcessor.preprocess.image_std",description:`<strong>image_std</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>self.image_std</code>) &#x2014;
Image standard deviation to normalize the image by if <code>do_normalize</code> is set to <code>True</code>.`,name:"image_std"},{anchor:"transformers.ViltImageProcessor.preprocess.do_pad",description:`<strong>do_pad</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_pad</code>) &#x2014;
Whether to pad the image to the (max_height, max_width) in the batch. If <code>True</code>, a pixel mask is also
created and returned.`,name:"do_pad"},{anchor:"transformers.ViltImageProcessor.preprocess.return_tensors",description:`<strong>return_tensors</strong> (<code>str</code> or <code>TensorType</code>, <em>optional</em>) &#x2014;
The type of tensors to return. Can be one of:<ul>
<li>Unset: Return a list of <code>np.ndarray</code>.</li>
<li><code>TensorType.TENSORFLOW</code> or <code>&apos;tf&apos;</code>: Return a batch of type <code>tf.Tensor</code>.</li>
<li><code>TensorType.PYTORCH</code> or <code>&apos;pt&apos;</code>: Return a batch of type <code>torch.Tensor</code>.</li>
<li><code>TensorType.NUMPY</code> or <code>&apos;np&apos;</code>: Return a batch of type <code>np.ndarray</code>.</li>
<li><code>TensorType.JAX</code> or <code>&apos;jax&apos;</code>: Return a batch of type <code>jax.numpy.ndarray</code>.</li>
</ul>`,name:"return_tensors"},{anchor:"transformers.ViltImageProcessor.preprocess.data_format",description:`<strong>data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>, defaults to <code>ChannelDimension.FIRST</code>) &#x2014;
The channel dimension format for the output image. Can be one of:<ul>
<li><code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li>
<li><code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.</li>
</ul>`,name:"data_format"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/vilt/image_processing_vilt.py#L369"}}),wt=new R({}),xt=new P({props:{name:"class transformers.ViltProcessor",anchor:"transformers.ViltProcessor",parameters:[{name:"image_processor",val:" = None"},{name:"tokenizer",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.ViltProcessor.image_processor",description:`<strong>image_processor</strong> (<code>ViltImageProcessor</code>) &#x2014;
An instance of <a href="/docs/transformers/v4.29.0/en/model_doc/vilt#transformers.ViltImageProcessor">ViltImageProcessor</a>. The image processor is a required input.`,name:"image_processor"},{anchor:"transformers.ViltProcessor.tokenizer",description:"<strong>tokenizer</strong> (<code>BertTokenizerFast</code>) &#x2014;\nAn instance of [&#x2018;BertTokenizerFast`]. The tokenizer is a required input.",name:"tokenizer"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/vilt/processing_vilt.py#L27"}}),Vt=new P({props:{name:"__call__",anchor:"transformers.ViltProcessor.__call__",parameters:[{name:"images",val:""},{name:"text",val:": typing.Union[str, typing.List[str], typing.List[typing.List[str]]] = None"},{name:"add_special_tokens",val:": bool = True"},{name:"padding",val:": typing.Union[bool, str, transformers.utils.generic.PaddingStrategy] = False"},{name:"truncation",val:": typing.Union[bool, str, transformers.tokenization_utils_base.TruncationStrategy] = None"},{name:"max_length",val:": typing.Optional[int] = None"},{name:"stride",val:": int = 0"},{name:"pad_to_multiple_of",val:": typing.Optional[int] = None"},{name:"return_token_type_ids",val:": typing.Optional[bool] = None"},{name:"return_attention_mask",val:": typing.Optional[bool] = None"},{name:"return_overflowing_tokens",val:": bool = False"},{name:"return_special_tokens_mask",val:": bool = False"},{name:"return_offsets_mapping",val:": bool = False"},{name:"return_length",val:": bool = False"},{name:"verbose",val:": bool = True"},{name:"return_tensors",val:": typing.Union[transformers.utils.generic.TensorType, str, NoneType] = None"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/vilt/processing_vilt.py#L62"}}),Ft=new R({}),Pt=new P({props:{name:"class transformers.ViltModel",anchor:"transformers.ViltModel",parameters:[{name:"config",val:""},{name:"add_pooling_layer",val:" = True"}],parametersDescription:[{anchor:"transformers.ViltModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.29.0/en/model_doc/vilt#transformers.ViltConfig">ViltConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/vilt/modeling_vilt.py#L730"}}),It=new P({props:{name:"forward",anchor:"transformers.ViltModel.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"pixel_values",val:": typing.Optional[torch.FloatTensor] = None"},{name:"pixel_mask",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"image_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"image_token_type_idx",val:": typing.Optional[int] = 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.ViltModel.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>({0})</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. Indices can be obtained using <a href="/docs/transformers/v4.29.0/en/model_doc/bert#transformers.BertTokenizer">BertTokenizer</a>. See
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details. <a href="../glossary#input-ids">What are input
IDs?</a>`,name:"input_ids"},{anchor:"transformers.ViltModel.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>({0})</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.
<a href="../glossary#attention-mask">What are attention masks?</a></li>
</ul>`,name:"attention_mask"},{anchor:"transformers.ViltModel.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>({0})</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.
<a href="../glossary#token-type-ids">What are token type IDs?</a></li>
</ul>`,name:"token_type_ids"},{anchor:"transformers.ViltModel.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/v4.29.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/v4.29.0/en/model_doc/dpt#transformers.DPTFeatureExtractor.__call__">ViltImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.ViltModel.forward.pixel_mask",description:`<strong>pixel_mask</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, height, width)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding pixel values. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for pixels that are real (i.e. <strong>not masked</strong>),</li>
<li>0 for pixels that are padding (i.e. <strong>masked</strong>).
<code>What are attention masks? &lt;../glossary.html#attention-mask&gt;</code>__</li>
</ul>`,name:"pixel_mask"},{anchor:"transformers.ViltModel.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.ViltModel.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>({0}, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.ViltModel.forward.image_embeds",description:`<strong>image_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_patches, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>pixel_values</code>, you can choose to directly pass an embedded representation.
This is useful if you want more control over how to convert <code>pixel_values</code> into patch embeddings.`,name:"image_embeds"},{anchor:"transformers.ViltModel.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.ViltModel.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.ViltModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.29.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/vilt/modeling_vilt.py#L758",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.29.0/en/model_doc/vilt#transformers.ViltConfig"
>ViltConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) \u2014 Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>pooler_output</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, hidden_size)</code>) \u2014 Last layer hidden-state of the first token of the sequence (classification token) after further processing
through the layers used for the auxiliary pretraining task. E.g. for BERT-family of models, this returns
the classification token after processing through a linear layer and a tanh activation function. The linear
layer weights are trained from the next sentence prediction (classification) objective during pretraining.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.29.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ae=new Lo({props:{$$slots:{default:[ac]},$$scope:{ctx:V}}}),Ee=new Co({props:{anchor:"transformers.ViltModel.forward.example",$$slots:{default:[ic]},$$scope:{ctx:V}}}),Mt=new R({}),jt=new P({props:{name:"class transformers.ViltForMaskedLM",anchor:"transformers.ViltForMaskedLM",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.ViltForMaskedLM.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.29.0/en/model_doc/vilt#transformers.ViltConfig">ViltConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/vilt/modeling_vilt.py#L895"}}),Et=new P({props:{name:"forward",anchor:"transformers.ViltForMaskedLM.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"pixel_values",val:": typing.Optional[torch.FloatTensor] = None"},{name:"pixel_mask",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"image_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = 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.ViltForMaskedLM.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. Indices can be obtained using <a href="/docs/transformers/v4.29.0/en/model_doc/bert#transformers.BertTokenizer">BertTokenizer</a>. See
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details. <a href="../glossary#input-ids">What are input
IDs?</a>`,name:"input_ids"},{anchor:"transformers.ViltForMaskedLM.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.
<a href="../glossary#attention-mask">What are attention masks?</a></li>
</ul>`,name:"attention_mask"},{anchor:"transformers.ViltForMaskedLM.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.
<a href="../glossary#token-type-ids">What are token type IDs?</a></li>
</ul>`,name:"token_type_ids"},{anchor:"transformers.ViltForMaskedLM.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/v4.29.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/v4.29.0/en/model_doc/dpt#transformers.DPTFeatureExtractor.__call__">ViltImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.ViltForMaskedLM.forward.pixel_mask",description:`<strong>pixel_mask</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, height, width)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding pixel values. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for pixels that are real (i.e. <strong>not masked</strong>),</li>
<li>0 for pixels that are padding (i.e. <strong>masked</strong>).
<code>What are attention masks? &lt;../glossary.html#attention-mask&gt;</code>__</li>
</ul>`,name:"pixel_mask"},{anchor:"transformers.ViltForMaskedLM.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.ViltForMaskedLM.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.ViltForMaskedLM.forward.image_embeds",description:`<strong>image_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_patches, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>pixel_values</code>, you can choose to directly pass an embedded representation.
This is useful if you want more control over how to convert <code>pixel_values</code> into patch embeddings.`,name:"image_embeds"},{anchor:"transformers.ViltForMaskedLM.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.ViltForMaskedLM.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.ViltForMaskedLM.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.29.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.ViltForMaskedLM.forward.labels",description:`<strong>labels</strong> (<em>torch.LongTensor</em> of shape <em>(batch_size, sequence_length)</em>, <em>optional</em>) &#x2014;
Labels for computing the masked language modeling loss. Indices should be in <em>[-100, 0, &#x2026;,
config.vocab_size]</em> (see <em>input_ids</em> docstring) Tokens with indices set to <em>-100</em> are ignored (masked), the
loss is only computed for the tokens with labels in <em>[0, &#x2026;, config.vocab_size]</em>`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/vilt/modeling_vilt.py#L913",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.0/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.29.0/en/model_doc/vilt#transformers.ViltConfig"
>ViltConfig</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.29.0/en/main_classes/output#transformers.modeling_outputs.MaskedLMOutput"
>transformers.modeling_outputs.MaskedLMOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ce=new Lo({props:{$$slots:{default:[lc]},$$scope:{ctx:V}}}),qe=new Co({props:{anchor:"transformers.ViltForMaskedLM.forward.example",$$slots:{default:[dc]},$$scope:{ctx:V}}}),Lt=new R({}),Ct=new P({props:{name:"class transformers.ViltForQuestionAnswering",anchor:"transformers.ViltForQuestionAnswering",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.ViltForQuestionAnswering.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.29.0/en/model_doc/vilt#transformers.ViltConfig">ViltConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/vilt/modeling_vilt.py#L1071"}}),Ot=new P({props:{name:"forward",anchor:"transformers.ViltForQuestionAnswering.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"pixel_values",val:": typing.Optional[torch.FloatTensor] = None"},{name:"pixel_mask",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"image_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = 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.ViltForQuestionAnswering.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>({0})</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. Indices can be obtained using <a href="/docs/transformers/v4.29.0/en/model_doc/bert#transformers.BertTokenizer">BertTokenizer</a>. See
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details. <a href="../glossary#input-ids">What are input
IDs?</a>`,name:"input_ids"},{anchor:"transformers.ViltForQuestionAnswering.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>({0})</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.
<a href="../glossary#attention-mask">What are attention masks?</a></li>
</ul>`,name:"attention_mask"},{anchor:"transformers.ViltForQuestionAnswering.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>({0})</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.
<a href="../glossary#token-type-ids">What are token type IDs?</a></li>
</ul>`,name:"token_type_ids"},{anchor:"transformers.ViltForQuestionAnswering.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/v4.29.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/v4.29.0/en/model_doc/dpt#transformers.DPTFeatureExtractor.__call__">ViltImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.ViltForQuestionAnswering.forward.pixel_mask",description:`<strong>pixel_mask</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, height, width)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding pixel values. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for pixels that are real (i.e. <strong>not masked</strong>),</li>
<li>0 for pixels that are padding (i.e. <strong>masked</strong>).
<code>What are attention masks? &lt;../glossary.html#attention-mask&gt;</code>__</li>
</ul>`,name:"pixel_mask"},{anchor:"transformers.ViltForQuestionAnswering.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.ViltForQuestionAnswering.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>({0}, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.ViltForQuestionAnswering.forward.image_embeds",description:`<strong>image_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_patches, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>pixel_values</code>, you can choose to directly pass an embedded representation.
This is useful if you want more control over how to convert <code>pixel_values</code> into patch embeddings.`,name:"image_embeds"},{anchor:"transformers.ViltForQuestionAnswering.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.ViltForQuestionAnswering.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.ViltForQuestionAnswering.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.29.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.ViltForQuestionAnswering.forward.labels",description:`<strong>labels</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_labels)</code>, <em>optional</em>) &#x2014;
Labels for computing the visual question answering loss. This tensor must be either a one-hot encoding of
all answers that are applicable for a given example in the batch, or a soft encoding indicating which
answers are applicable, where 1.0 is the highest score.`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/vilt/modeling_vilt.py#L1089",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.0/en/main_classes/output#transformers.modeling_outputs.SequenceClassifierOutput"
>transformers.modeling_outputs.SequenceClassifierOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.29.0/en/model_doc/vilt#transformers.ViltConfig"
>ViltConfig</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 layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.29.0/en/main_classes/output#transformers.modeling_outputs.SequenceClassifierOutput"
>transformers.modeling_outputs.SequenceClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ne=new Lo({props:{$$slots:{default:[cc]},$$scope:{ctx:V}}}),Se=new Co({props:{anchor:"transformers.ViltForQuestionAnswering.forward.example",$$slots:{default:[mc]},$$scope:{ctx:V}}}),Nt=new R({}),St=new P({props:{name:"class transformers.ViltForImagesAndTextClassification",anchor:"transformers.ViltForImagesAndTextClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.ViltForImagesAndTextClassification.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>({0})</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. Indices can be obtained using <a href="/docs/transformers/v4.29.0/en/model_doc/bert#transformers.BertTokenizer">BertTokenizer</a>. See
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details. <a href="../glossary#input-ids">What are input
IDs?</a>`,name:"input_ids"},{anchor:"transformers.ViltForImagesAndTextClassification.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>({0})</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.
<a href="../glossary#attention-mask">What are attention masks?</a></li>
</ul>`,name:"attention_mask"},{anchor:"transformers.ViltForImagesAndTextClassification.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>({0})</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.
<a href="../glossary#token-type-ids">What are token type IDs?</a></li>
</ul>`,name:"token_type_ids"},{anchor:"transformers.ViltForImagesAndTextClassification.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_images, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/v4.29.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/v4.29.0/en/model_doc/dpt#transformers.DPTFeatureExtractor.__call__">ViltImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.ViltForImagesAndTextClassification.pixel_mask",description:`<strong>pixel_mask</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, num_images, height, width)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding pixel values. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for pixels that are real (i.e. <strong>not masked</strong>),</li>
<li>0 for pixels that are padding (i.e. <strong>masked</strong>).
<code>What are attention masks? &lt;../glossary.html#attention-mask&gt;</code>__</li>
</ul>`,name:"pixel_mask"},{anchor:"transformers.ViltForImagesAndTextClassification.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.ViltForImagesAndTextClassification.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>({0}, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.ViltForImagesAndTextClassification.image_embeds",description:`<strong>image_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_images, num_patches, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>pixel_values</code>, you can choose to directly pass an embedded representation.
This is useful if you want more control over how to convert <code>pixel_values</code> into patch embeddings.`,name:"image_embeds"},{anchor:"transformers.ViltForImagesAndTextClassification.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.ViltForImagesAndTextClassification.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.ViltForImagesAndTextClassification.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.29.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/vilt/modeling_vilt.py#L1285"}}),Dt=new P({props:{name:"forward",anchor:"transformers.ViltForImagesAndTextClassification.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"pixel_values",val:": typing.Optional[torch.FloatTensor] = None"},{name:"pixel_mask",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"image_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = 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.ViltForImagesAndTextClassification.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>({0})</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. Indices can be obtained using <a href="/docs/transformers/v4.29.0/en/model_doc/bert#transformers.BertTokenizer">BertTokenizer</a>. See
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details. <a href="../glossary#input-ids">What are input
IDs?</a>`,name:"input_ids"},{anchor:"transformers.ViltForImagesAndTextClassification.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>({0})</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.
<a href="../glossary#attention-mask">What are attention masks?</a></li>
</ul>`,name:"attention_mask"},{anchor:"transformers.ViltForImagesAndTextClassification.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>({0})</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.
<a href="../glossary#token-type-ids">What are token type IDs?</a></li>
</ul>`,name:"token_type_ids"},{anchor:"transformers.ViltForImagesAndTextClassification.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/v4.29.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/v4.29.0/en/model_doc/dpt#transformers.DPTFeatureExtractor.__call__">ViltImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.ViltForImagesAndTextClassification.forward.pixel_mask",description:`<strong>pixel_mask</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, height, width)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding pixel values. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for pixels that are real (i.e. <strong>not masked</strong>),</li>
<li>0 for pixels that are padding (i.e. <strong>masked</strong>).
<code>What are attention masks? &lt;../glossary.html#attention-mask&gt;</code>__</li>
</ul>`,name:"pixel_mask"},{anchor:"transformers.ViltForImagesAndTextClassification.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.ViltForImagesAndTextClassification.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>({0}, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.ViltForImagesAndTextClassification.forward.image_embeds",description:`<strong>image_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_patches, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>pixel_values</code>, you can choose to directly pass an embedded representation.
This is useful if you want more control over how to convert <code>pixel_values</code> into patch embeddings.`,name:"image_embeds"},{anchor:"transformers.ViltForImagesAndTextClassification.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.ViltForImagesAndTextClassification.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.ViltForImagesAndTextClassification.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.29.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.ViltForImagesAndTextClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Binary classification labels.`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/vilt/modeling_vilt.py#L1304",returnDescription:`
<p>A <code>transformers.models.vilt.modeling_vilt.ViltForImagesAndTextClassificationOutput</code> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.29.0/en/model_doc/vilt#transformers.ViltConfig"
>ViltConfig</a>) and inputs.</p>
<ul>
<li><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.</li>
<li><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).</li>
<li><strong>hidden_states</strong> (<code>List[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 List of tuples of <code>torch.FloatTensor</code> (one for each image-text pair, each tuple containing 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>List[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 List of tuples of <code>torch.FloatTensor</code> (one for each image-text pair, each tuple containing the attention
weights 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.vilt.modeling_vilt.ViltForImagesAndTextClassificationOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Re=new Lo({props:{$$slots:{default:[pc]},$$scope:{ctx:V}}}),We=new Co({props:{anchor:"transformers.ViltForImagesAndTextClassification.forward.example",$$slots:{default:[hc]},$$scope:{ctx:V}}}),Rt=new R({}),Wt=new P({props:{name:"class transformers.ViltForImageAndTextRetrieval",anchor:"transformers.ViltForImageAndTextRetrieval",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.ViltForImageAndTextRetrieval.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.29.0/en/model_doc/vilt#transformers.ViltConfig">ViltConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/vilt/modeling_vilt.py#L1184"}}),Qt=new P({props:{name:"forward",anchor:"transformers.ViltForImageAndTextRetrieval.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"pixel_values",val:": typing.Optional[torch.FloatTensor] = None"},{name:"pixel_mask",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"image_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = 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.ViltForImageAndTextRetrieval.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>({0})</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. Indices can be obtained using <a href="/docs/transformers/v4.29.0/en/model_doc/bert#transformers.BertTokenizer">BertTokenizer</a>. See
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details. <a href="../glossary#input-ids">What are input
IDs?</a>`,name:"input_ids"},{anchor:"transformers.ViltForImageAndTextRetrieval.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>({0})</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.
<a href="../glossary#attention-mask">What are attention masks?</a></li>
</ul>`,name:"attention_mask"},{anchor:"transformers.ViltForImageAndTextRetrieval.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>({0})</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.
<a href="../glossary#token-type-ids">What are token type IDs?</a></li>
</ul>`,name:"token_type_ids"},{anchor:"transformers.ViltForImageAndTextRetrieval.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/v4.29.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/v4.29.0/en/model_doc/dpt#transformers.DPTFeatureExtractor.__call__">ViltImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.ViltForImageAndTextRetrieval.forward.pixel_mask",description:`<strong>pixel_mask</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, height, width)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding pixel values. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for pixels that are real (i.e. <strong>not masked</strong>),</li>
<li>0 for pixels that are padding (i.e. <strong>masked</strong>).
<code>What are attention masks? &lt;../glossary.html#attention-mask&gt;</code>__</li>
</ul>`,name:"pixel_mask"},{anchor:"transformers.ViltForImageAndTextRetrieval.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.ViltForImageAndTextRetrieval.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>({0}, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.ViltForImageAndTextRetrieval.forward.image_embeds",description:`<strong>image_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_patches, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>pixel_values</code>, you can choose to directly pass an embedded representation.
This is useful if you want more control over how to convert <code>pixel_values</code> into patch embeddings.`,name:"image_embeds"},{anchor:"transformers.ViltForImageAndTextRetrieval.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.ViltForImageAndTextRetrieval.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.ViltForImageAndTextRetrieval.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.29.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.ViltForImageAndTextRetrieval.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels are currently not supported.`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/vilt/modeling_vilt.py#L1196",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.0/en/main_classes/output#transformers.modeling_outputs.SequenceClassifierOutput"
>transformers.modeling_outputs.SequenceClassifierOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.29.0/en/model_doc/vilt#transformers.ViltConfig"
>ViltConfig</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 layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.29.0/en/main_classes/output#transformers.modeling_outputs.SequenceClassifierOutput"
>transformers.modeling_outputs.SequenceClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Qe=new Lo({props:{$$slots:{default:[fc]},$$scope:{ctx:V}}}),Ue=new Co({props:{anchor:"transformers.ViltForImageAndTextRetrieval.forward.example",$$slots:{default:[gc]},$$scope:{ctx:V}}}),Ut=new R({}),Ht=new P({props:{name:"class transformers.ViltForTokenClassification",anchor:"transformers.ViltForTokenClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.ViltForTokenClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.29.0/en/model_doc/vilt#transformers.ViltConfig">ViltConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/vilt/modeling_vilt.py#L1427"}}),Gt=new P({props:{name:"forward",anchor:"transformers.ViltForTokenClassification.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"pixel_values",val:": typing.Optional[torch.FloatTensor] = None"},{name:"pixel_mask",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"image_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = 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.ViltForTokenClassification.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>({0})</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. Indices can be obtained using <a href="/docs/transformers/v4.29.0/en/model_doc/bert#transformers.BertTokenizer">BertTokenizer</a>. See
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details. <a href="../glossary#input-ids">What are input
IDs?</a>`,name:"input_ids"},{anchor:"transformers.ViltForTokenClassification.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>({0})</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.
<a href="../glossary#attention-mask">What are attention masks?</a></li>
</ul>`,name:"attention_mask"},{anchor:"transformers.ViltForTokenClassification.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>({0})</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.
<a href="../glossary#token-type-ids">What are token type IDs?</a></li>
</ul>`,name:"token_type_ids"},{anchor:"transformers.ViltForTokenClassification.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/v4.29.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/v4.29.0/en/model_doc/dpt#transformers.DPTFeatureExtractor.__call__">ViltImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.ViltForTokenClassification.forward.pixel_mask",description:`<strong>pixel_mask</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, height, width)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding pixel values. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for pixels that are real (i.e. <strong>not masked</strong>),</li>
<li>0 for pixels that are padding (i.e. <strong>masked</strong>).
<code>What are attention masks? &lt;../glossary.html#attention-mask&gt;</code>__</li>
</ul>`,name:"pixel_mask"},{anchor:"transformers.ViltForTokenClassification.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.ViltForTokenClassification.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>({0}, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.ViltForTokenClassification.forward.image_embeds",description:`<strong>image_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_patches, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>pixel_values</code>, you can choose to directly pass an embedded representation.
This is useful if you want more control over how to convert <code>pixel_values</code> into patch embeddings.`,name:"image_embeds"},{anchor:"transformers.ViltForTokenClassification.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.ViltForTokenClassification.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.ViltForTokenClassification.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.29.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.ViltForTokenClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, text_sequence_length)</code>, <em>optional</em>) &#x2014;
Labels for computing the token classification loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>.`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/vilt/modeling_vilt.py#L1442",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.0/en/main_classes/output#transformers.modeling_outputs.TokenClassifierOutput"
>transformers.modeling_outputs.TokenClassifierOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.29.0/en/model_doc/vilt#transformers.ViltConfig"
>ViltConfig</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 loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.num_labels)</code>) \u2014 Classification 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 layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.29.0/en/main_classes/output#transformers.modeling_outputs.TokenClassifierOutput"
>transformers.modeling_outputs.TokenClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ke=new Lo({props:{$$slots:{default:[uc]},$$scope:{ctx:V}}}),{c(){d=n("meta"),b=m(),_=n("h1"),u=n("a"),v=n("span"),T(l.$$.fragment),f=m(),F=n("span"),Gs=a("ViLT"),Gn=m(),Y=n("h2"),be=n("a"),No=n("span"),T(lt.$$.fragment),Js=m(),So=n("span"),Ys=a("Overview"),Jn=m(),Te=n("p"),Xs=a("The ViLT model was proposed in "),dt=n("a"),Zs=a("ViLT: Vision-and-Language Transformer Without Convolution or Region Supervision"),er=a(`
by Wonjae Kim, Bokyung Son, Ildoo Kim. ViLT incorporates text embeddings into a Vision Transformer (ViT), allowing it to have a minimal design
for Vision-and-Language Pre-training (VLP).`),Yn=m(),Zt=n("p"),tr=a("The abstract from the paper is the following:"),Xn=m(),eo=n("p"),Do=n("em"),or=a(`Vision-and-Language Pre-training (VLP) has improved performance on various joint vision-and-language downstream tasks.
Current approaches to VLP heavily rely on image feature extraction processes, most of which involve region supervision
(e.g., object detection) and the convolutional architecture (e.g., ResNet). Although disregarded in the literature, we
find it problematic in terms of both (1) efficiency/speed, that simply extracting input features requires much more
computation than the multimodal interaction steps; and (2) expressive power, as it is upper bounded to the expressive
power of the visual embedder and its predefined visual vocabulary. In this paper, we present a minimal VLP model,
Vision-and-Language Transformer (ViLT), monolithic in the sense that the processing of visual inputs is drastically
simplified to just the same convolution-free manner that we process textual inputs. We show that ViLT is up to tens of
times faster than previous VLP models, yet with competitive or better downstream task performance.`),Zn=m(),to=n("p"),nr=a("Tips:"),es=m(),C=n("ul"),ct=n("li"),sr=a("The quickest way to get started with ViLT is by checking the "),mt=n("a"),rr=a("example notebooks"),ar=a(`
(which showcase both inference and fine-tuning on custom data).`),ir=m(),W=n("li"),lr=a("ViLT is a model that takes both "),Ro=n("code"),dr=a("pixel_values"),cr=a(" and "),Wo=n("code"),mr=a("input_ids"),pr=a(" as input. One can use "),oo=n("a"),hr=a("ViltProcessor"),fr=a(` to prepare data for the model.
This processor wraps a feature extractor (for the image modality) and a tokenizer (for the language modality) into one.`),gr=m(),X=n("li"),ur=a(`ViLT is trained with images of various sizes: the authors resize the shorter edge of input images to 384 and limit the longer edge to
under 640 while preserving the aspect ratio. To make batching of images possible, the authors use a `),Bo=n("code"),_r=a("pixel_mask"),vr=a(` that indicates
which pixel values are real and which are padding. `),no=n("a"),br=a("ViltProcessor"),Tr=a(" automatically creates this for you."),kr=m(),Qo=n("li"),yr=a(`The design of ViLT is very similar to that of a standard Vision Transformer (ViT). The only difference is that the model includes
additional embedding layers for the language modality.`),ts=m(),ke=n("img"),os=m(),ye=n("small"),wr=a("ViLT architecture. Taken from the "),so=n("a"),xr=a("original paper"),$r=a("."),ns=m(),K=n("p"),Vr=a("This model was contributed by "),pt=n("a"),Fr=a("nielsr"),Pr=a(". The original code can be found "),ht=n("a"),zr=a("here"),Ir=a("."),ss=m(),ro=n("p"),Mr=a("Tips:"),rs=m(),ao=n("ul"),Uo=n("li"),jr=a("The PyTorch version of this model is only available in torch 1.10 and higher."),as=m(),Z=n("h2"),we=n("a"),Ho=n("span"),T(ft.$$.fragment),Ar=m(),Ko=n("span"),Er=a("ViltConfig"),is=m(),I=n("div"),T(gt.$$.fragment),Lr=m(),ee=n("p"),Cr=a("This is the configuration class to store the configuration of a "),Go=n("code"),qr=a("ViLTModel"),Or=a(`. It is used to instantiate an ViLT
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 ViLT
`),ut=n("a"),Nr=a("dandelin/vilt-b32-mlm"),Sr=a(" architecture."),Dr=m(),te=n("p"),Rr=a("Configuration objects inherit from "),io=n("a"),Wr=a("PretrainedConfig"),Br=a(` and can be used to control the model outputs. Read the
documentation from `),lo=n("a"),Qr=a("PretrainedConfig"),Ur=a(" for more information."),Hr=m(),T(xe.$$.fragment),ls=m(),oe=n("h2"),$e=n("a"),Jo=n("span"),T(_t.$$.fragment),Kr=m(),Yo=n("span"),Gr=a("ViltFeatureExtractor"),ds=m(),ne=n("div"),T(vt.$$.fragment),Jr=m(),Ve=n("div"),T(bt.$$.fragment),Yr=m(),Xo=n("p"),Xr=a("Preprocess an image or a batch of images."),cs=m(),se=n("h2"),Fe=n("a"),Zo=n("span"),T(Tt.$$.fragment),Zr=m(),en=n("span"),ea=a("ViltImageProcessor"),ms=m(),B=n("div"),T(kt.$$.fragment),ta=m(),tn=n("p"),oa=a("Constructs a ViLT image processor."),na=m(),Pe=n("div"),T(yt.$$.fragment),sa=m(),on=n("p"),ra=a("Preprocess an image or batch of images."),ps=m(),re=n("h2"),ze=n("a"),nn=n("span"),T(wt.$$.fragment),aa=m(),sn=n("span"),ia=a("ViltProcessor"),hs=m(),M=n("div"),T(xt.$$.fragment),la=m(),rn=n("p"),da=a("Constructs a ViLT processor which wraps a BERT tokenizer and ViLT image processor into a single processor."),ca=m(),z=n("p"),co=n("a"),ma=a("ViltProcessor"),pa=a(" offers all the functionalities of "),mo=n("a"),ha=a("ViltImageProcessor"),fa=a(" and "),po=n("a"),ga=a("BertTokenizerFast"),ua=a(`. See the
docstring of `),$t=n("a"),an=n("strong"),_a=a("call"),va=a("()"),ba=a(" and "),ln=n("code"),Ta=a("decode()"),ka=a(" for more information."),ya=m(),G=n("div"),T(Vt.$$.fragment),wa=m(),ae=n("p"),xa=a("This method uses "),Ie=n("a"),$a=a("ViltImageProcessor."),dn=n("strong"),Va=a("call"),Fa=a("()"),Pa=a(` method to prepare image(s) for the model, and
`),Me=n("a"),za=a("BertTokenizerFast."),cn=n("strong"),Ia=a("call"),Ma=a("()"),ja=a(" to prepare text for the model."),Aa=m(),mn=n("p"),Ea=a("Please refer to the docstring of the above two methods for more information."),fs=m(),ie=n("h2"),je=n("a"),pn=n("span"),T(Ft.$$.fragment),La=m(),hn=n("span"),Ca=a("ViltModel"),gs=m(),Q=n("div"),T(Pt.$$.fragment),qa=m(),zt=n("p"),Oa=a(`The bare ViLT Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),fn=n("code"),Na=a("torch.nn.Module <https://pytorch.org/docs/stable/nn.html#torch.nn.Module>"),Sa=a(`_ subclass. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Da=m(),q=n("div"),T(It.$$.fragment),Ra=m(),le=n("p"),Wa=a("The "),ho=n("a"),Ba=a("ViltModel"),Qa=a(" forward method, overrides the "),gn=n("code"),Ua=a("__call__"),Ha=a(" special method."),Ka=m(),T(Ae.$$.fragment),Ga=m(),T(Ee.$$.fragment),us=m(),de=n("h2"),Le=n("a"),un=n("span"),T(Mt.$$.fragment),Ja=m(),_n=n("span"),Ya=a("ViltForMaskedLM"),_s=m(),j=n("div"),T(jt.$$.fragment),Xa=m(),vn=n("p"),Za=a("ViLT Model with a language modeling head on top as done during pretraining."),ei=m(),At=n("p"),ti=a("This model is a PyTorch "),bn=n("code"),oi=a("torch.nn.Module <https://pytorch.org/docs/stable/nn.html#torch.nn.Module>"),ni=a(`_ subclass. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),si=m(),O=n("div"),T(Et.$$.fragment),ri=m(),ce=n("p"),ai=a("The "),fo=n("a"),ii=a("ViltForMaskedLM"),li=a(" forward method, overrides the "),Tn=n("code"),di=a("__call__"),ci=a(" special method."),mi=m(),T(Ce.$$.fragment),pi=m(),T(qe.$$.fragment),vs=m(),me=n("h2"),Oe=n("a"),kn=n("span"),T(Lt.$$.fragment),hi=m(),yn=n("span"),fi=a("ViltForQuestionAnswering"),bs=m(),A=n("div"),T(Ct.$$.fragment),gi=m(),wn=n("p"),ui=a(`Vilt Model transformer with a classifier head on top (a linear layer on top of the final hidden state of the [CLS]
token) for visual question answering, e.g. for VQAv2.`),_i=m(),qt=n("p"),vi=a("This model is a PyTorch "),xn=n("code"),bi=a("torch.nn.Module <https://pytorch.org/docs/stable/nn.html#torch.nn.Module>"),Ti=a(`_ subclass. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),ki=m(),N=n("div"),T(Ot.$$.fragment),yi=m(),pe=n("p"),wi=a("The "),go=n("a"),xi=a("ViltForQuestionAnswering"),$i=a(" forward method, overrides the "),$n=n("code"),Vi=a("__call__"),Fi=a(" special method."),Pi=m(),T(Ne.$$.fragment),zi=m(),T(Se.$$.fragment),Ts=m(),he=n("h2"),De=n("a"),Vn=n("span"),T(Nt.$$.fragment),Ii=m(),Fn=n("span"),Mi=a("ViltForImagesAndTextClassification"),ks=m(),U=n("div"),T(St.$$.fragment),ji=m(),Pn=n("p"),Ai=a("Vilt Model transformer with a classifier head on top for natural language visual reasoning, e.g. NLVR2."),Ei=m(),S=n("div"),T(Dt.$$.fragment),Li=m(),fe=n("p"),Ci=a("The "),uo=n("a"),qi=a("ViltForImagesAndTextClassification"),Oi=a(" forward method, overrides the "),zn=n("code"),Ni=a("__call__"),Si=a(" special method."),Di=m(),T(Re.$$.fragment),Ri=m(),T(We.$$.fragment),ys=m(),ge=n("h2"),Be=n("a"),In=n("span"),T(Rt.$$.fragment),Wi=m(),Mn=n("span"),Bi=a("ViltForImageAndTextRetrieval"),ws=m(),E=n("div"),T(Wt.$$.fragment),Qi=m(),jn=n("p"),Ui=a(`Vilt Model transformer with a classifier head on top (a linear layer on top of the final hidden state of the [CLS]
token) for image-to-text or text-to-image retrieval, e.g. MSCOCO and F30K.`),Hi=m(),Bt=n("p"),Ki=a("This model is a PyTorch "),An=n("code"),Gi=a("torch.nn.Module <https://pytorch.org/docs/stable/nn.html#torch.nn.Module>"),Ji=a(`_ subclass. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Yi=m(),D=n("div"),T(Qt.$$.fragment),Xi=m(),ue=n("p"),Zi=a("The "),_o=n("a"),el=a("ViltForImageAndTextRetrieval"),tl=a(" forward method, overrides the "),En=n("code"),ol=a("__call__"),nl=a(" special method."),sl=m(),T(Qe.$$.fragment),rl=m(),T(Ue.$$.fragment),xs=m(),_e=n("h2"),He=n("a"),Ln=n("span"),T(Ut.$$.fragment),al=m(),Cn=n("span"),il=a("ViltForTokenClassification"),$s=m(),L=n("div"),T(Ht.$$.fragment),ll=m(),qn=n("p"),dl=a(`ViLT Model with a token classification head on top (a linear layer on top of the final hidden-states of the text
tokens) e.g. for Named-Entity-Recognition (NER) tasks.`),cl=m(),Kt=n("p"),ml=a("This model is a PyTorch "),On=n("code"),pl=a("torch.nn.Module <https://pytorch.org/docs/stable/nn.html#torch.nn.Module>"),hl=a(`_ subclass. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),fl=m(),J=n("div"),T(Gt.$$.fragment),gl=m(),ve=n("p"),ul=a("The "),vo=n("a"),_l=a("ViltForTokenClassification"),vl=a(" forward method, overrides the "),Nn=n("code"),bl=a("__call__"),Tl=a(" special method."),kl=m(),T(Ke.$$.fragment),this.h()},l(t){const h=oc('[data-svelte="svelte-1phssyn"]',document.head);d=s(h,"META",{name:!0,content:!0}),h.forEach(o),b=p(t),_=s(t,"H1",{class:!0});var Jt=r(_);u=s(Jt,"A",{id:!0,class:!0,href:!0});var Sn=r(u);v=s(Sn,"SPAN",{});var Dn=r(v);k(l.$$.fragment,Dn),Dn.forEach(o),Sn.forEach(o),f=p(Jt),F=s(Jt,"SPAN",{});var Rn=r(F);Gs=i(Rn,"ViLT"),Rn.forEach(o),Jt.forEach(o),Gn=p(t),Y=s(t,"H2",{class:!0});var Yt=r(Y);be=s(Yt,"A",{id:!0,class:!0,href:!0});var Wn=r(be);No=s(Wn,"SPAN",{});var Bn=r(No);k(lt.$$.fragment,Bn),Bn.forEach(o),Wn.forEach(o),Js=p(Yt),So=s(Yt,"SPAN",{});var Qn=r(So);Ys=i(Qn,"Overview"),Qn.forEach(o),Yt.forEach(o),Jn=p(t),Te=s(t,"P",{});var Xt=r(Te);Xs=i(Xt,"The ViLT model was proposed in "),dt=s(Xt,"A",{href:!0,rel:!0});var Un=r(dt);Zs=i(Un,"ViLT: Vision-and-Language Transformer Without Convolution or Region Supervision"),Un.forEach(o),er=i(Xt,`
by Wonjae Kim, Bokyung Son, Ildoo Kim. ViLT incorporates text embeddings into a Vision Transformer (ViT), allowing it to have a minimal design
for Vision-and-Language Pre-training (VLP).`),Xt.forEach(o),Yn=p(t),Zt=s(t,"P",{});var Hn=r(Zt);tr=i(Hn,"The abstract from the paper is the following:"),Hn.forEach(o),Xn=p(t),eo=s(t,"P",{});var Kn=r(eo);Do=s(Kn,"EM",{});var xl=r(Do);or=i(xl,`Vision-and-Language Pre-training (VLP) has improved performance on various joint vision-and-language downstream tasks.
Current approaches to VLP heavily rely on image feature extraction processes, most of which involve region supervision
(e.g., object detection) and the convolutional architecture (e.g., ResNet). Although disregarded in the literature, we
find it problematic in terms of both (1) efficiency/speed, that simply extracting input features requires much more
computation than the multimodal interaction steps; and (2) expressive power, as it is upper bounded to the expressive
power of the visual embedder and its predefined visual vocabulary. In this paper, we present a minimal VLP model,
Vision-and-Language Transformer (ViLT), monolithic in the sense that the processing of visual inputs is drastically
simplified to just the same convolution-free manner that we process textual inputs. We show that ViLT is up to tens of
times faster than previous VLP models, yet with competitive or better downstream task performance.`),xl.forEach(o),Kn.forEach(o),Zn=p(t),to=s(t,"P",{});var $l=r(to);nr=i($l,"Tips:"),$l.forEach(o),es=p(t),C=s(t,"UL",{});var Ge=r(C);ct=s(Ge,"LI",{});var Fs=r(ct);sr=i(Fs,"The quickest way to get started with ViLT is by checking the "),mt=s(Fs,"A",{href:!0,rel:!0});var Vl=r(mt);rr=i(Vl,"example notebooks"),Vl.forEach(o),ar=i(Fs,`
(which showcase both inference and fine-tuning on custom data).`),Fs.forEach(o),ir=p(Ge),W=s(Ge,"LI",{});var Je=r(W);lr=i(Je,"ViLT is a model that takes both "),Ro=s(Je,"CODE",{});var Fl=r(Ro);dr=i(Fl,"pixel_values"),Fl.forEach(o),cr=i(Je," and "),Wo=s(Je,"CODE",{});var Pl=r(Wo);mr=i(Pl,"input_ids"),Pl.forEach(o),pr=i(Je," as input. One can use "),oo=s(Je,"A",{href:!0});var zl=r(oo);hr=i(zl,"ViltProcessor"),zl.forEach(o),fr=i(Je,` to prepare data for the model.
This processor wraps a feature extractor (for the image modality) and a tokenizer (for the language modality) into one.`),Je.forEach(o),gr=p(Ge),X=s(Ge,"LI",{});var bo=r(X);ur=i(bo,`ViLT is trained with images of various sizes: the authors resize the shorter edge of input images to 384 and limit the longer edge to
under 640 while preserving the aspect ratio. To make batching of images possible, the authors use a `),Bo=s(bo,"CODE",{});var Il=r(Bo);_r=i(Il,"pixel_mask"),Il.forEach(o),vr=i(bo,` that indicates
which pixel values are real and which are padding. `),no=s(bo,"A",{href:!0});var Ml=r(no);br=i(Ml,"ViltProcessor"),Ml.forEach(o),Tr=i(bo," automatically creates this for you."),bo.forEach(o),kr=p(Ge),Qo=s(Ge,"LI",{});var jl=r(Qo);yr=i(jl,`The design of ViLT is very similar to that of a standard Vision Transformer (ViT). The only difference is that the model includes
additional embedding layers for the language modality.`),jl.forEach(o),Ge.forEach(o),ts=p(t),ke=s(t,"IMG",{src:!0,alt:!0,width:!0}),os=p(t),ye=s(t,"SMALL",{});var Ps=r(ye);wr=i(Ps,"ViLT architecture. Taken from the "),so=s(Ps,"A",{href:!0});var Al=r(so);xr=i(Al,"original paper"),Al.forEach(o),$r=i(Ps,"."),Ps.forEach(o),ns=p(t),K=s(t,"P",{});var To=r(K);Vr=i(To,"This model was contributed by "),pt=s(To,"A",{href:!0,rel:!0});var El=r(pt);Fr=i(El,"nielsr"),El.forEach(o),Pr=i(To,". The original code can be found "),ht=s(To,"A",{href:!0,rel:!0});var Ll=r(ht);zr=i(Ll,"here"),Ll.forEach(o),Ir=i(To,"."),To.forEach(o),ss=p(t),ro=s(t,"P",{});var Cl=r(ro);Mr=i(Cl,"Tips:"),Cl.forEach(o),rs=p(t),ao=s(t,"UL",{});var ql=r(ao);Uo=s(ql,"LI",{});var Ol=r(Uo);jr=i(Ol,"The PyTorch version of this model is only available in torch 1.10 and higher."),Ol.forEach(o),ql.forEach(o),as=p(t),Z=s(t,"H2",{class:!0});var zs=r(Z);we=s(zs,"A",{id:!0,class:!0,href:!0});var Nl=r(we);Ho=s(Nl,"SPAN",{});var Sl=r(Ho);k(ft.$$.fragment,Sl),Sl.forEach(o),Nl.forEach(o),Ar=p(zs),Ko=s(zs,"SPAN",{});var Dl=r(Ko);Er=i(Dl,"ViltConfig"),Dl.forEach(o),zs.forEach(o),is=p(t),I=s(t,"DIV",{class:!0});var Ye=r(I);k(gt.$$.fragment,Ye),Lr=p(Ye),ee=s(Ye,"P",{});var ko=r(ee);Cr=i(ko,"This is the configuration class to store the configuration of a "),Go=s(ko,"CODE",{});var Rl=r(Go);qr=i(Rl,"ViLTModel"),Rl.forEach(o),Or=i(ko,`. It is used to instantiate an ViLT
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 ViLT
`),ut=s(ko,"A",{href:!0,rel:!0});var Wl=r(ut);Nr=i(Wl,"dandelin/vilt-b32-mlm"),Wl.forEach(o),Sr=i(ko," architecture."),ko.forEach(o),Dr=p(Ye),te=s(Ye,"P",{});var yo=r(te);Rr=i(yo,"Configuration objects inherit from "),io=s(yo,"A",{href:!0});var Bl=r(io);Wr=i(Bl,"PretrainedConfig"),Bl.forEach(o),Br=i(yo,` and can be used to control the model outputs. Read the
documentation from `),lo=s(yo,"A",{href:!0});var Ql=r(lo);Qr=i(Ql,"PretrainedConfig"),Ql.forEach(o),Ur=i(yo," for more information."),yo.forEach(o),Hr=p(Ye),k(xe.$$.fragment,Ye),Ye.forEach(o),ls=p(t),oe=s(t,"H2",{class:!0});var Is=r(oe);$e=s(Is,"A",{id:!0,class:!0,href:!0});var Ul=r($e);Jo=s(Ul,"SPAN",{});var Hl=r(Jo);k(_t.$$.fragment,Hl),Hl.forEach(o),Ul.forEach(o),Kr=p(Is),Yo=s(Is,"SPAN",{});var Kl=r(Yo);Gr=i(Kl,"ViltFeatureExtractor"),Kl.forEach(o),Is.forEach(o),ds=p(t),ne=s(t,"DIV",{class:!0});var Ms=r(ne);k(vt.$$.fragment,Ms),Jr=p(Ms),Ve=s(Ms,"DIV",{class:!0});var js=r(Ve);k(bt.$$.fragment,js),Yr=p(js),Xo=s(js,"P",{});var Gl=r(Xo);Xr=i(Gl,"Preprocess an image or a batch of images."),Gl.forEach(o),js.forEach(o),Ms.forEach(o),cs=p(t),se=s(t,"H2",{class:!0});var As=r(se);Fe=s(As,"A",{id:!0,class:!0,href:!0});var Jl=r(Fe);Zo=s(Jl,"SPAN",{});var Yl=r(Zo);k(Tt.$$.fragment,Yl),Yl.forEach(o),Jl.forEach(o),Zr=p(As),en=s(As,"SPAN",{});var Xl=r(en);ea=i(Xl,"ViltImageProcessor"),Xl.forEach(o),As.forEach(o),ms=p(t),B=s(t,"DIV",{class:!0});var wo=r(B);k(kt.$$.fragment,wo),ta=p(wo),tn=s(wo,"P",{});var Zl=r(tn);oa=i(Zl,"Constructs a ViLT image processor."),Zl.forEach(o),na=p(wo),Pe=s(wo,"DIV",{class:!0});var Es=r(Pe);k(yt.$$.fragment,Es),sa=p(Es),on=s(Es,"P",{});var ed=r(on);ra=i(ed,"Preprocess an image or batch of images."),ed.forEach(o),Es.forEach(o),wo.forEach(o),ps=p(t),re=s(t,"H2",{class:!0});var Ls=r(re);ze=s(Ls,"A",{id:!0,class:!0,href:!0});var td=r(ze);nn=s(td,"SPAN",{});var od=r(nn);k(wt.$$.fragment,od),od.forEach(o),td.forEach(o),aa=p(Ls),sn=s(Ls,"SPAN",{});var nd=r(sn);ia=i(nd,"ViltProcessor"),nd.forEach(o),Ls.forEach(o),hs=p(t),M=s(t,"DIV",{class:!0});var Xe=r(M);k(xt.$$.fragment,Xe),la=p(Xe),rn=s(Xe,"P",{});var sd=r(rn);da=i(sd,"Constructs a ViLT processor which wraps a BERT tokenizer and ViLT image processor into a single processor."),sd.forEach(o),ca=p(Xe),z=s(Xe,"P",{});var H=r(z);co=s(H,"A",{href:!0});var rd=r(co);ma=i(rd,"ViltProcessor"),rd.forEach(o),pa=i(H," offers all the functionalities of "),mo=s(H,"A",{href:!0});var ad=r(mo);ha=i(ad,"ViltImageProcessor"),ad.forEach(o),fa=i(H," and "),po=s(H,"A",{href:!0});var id=r(po);ga=i(id,"BertTokenizerFast"),id.forEach(o),ua=i(H,`. See the
docstring of `),$t=s(H,"A",{href:!0});var yl=r($t);an=s(yl,"STRONG",{});var ld=r(an);_a=i(ld,"call"),ld.forEach(o),va=i(yl,"()"),yl.forEach(o),ba=i(H," and "),ln=s(H,"CODE",{});var dd=r(ln);Ta=i(dd,"decode()"),dd.forEach(o),ka=i(H," for more information."),H.forEach(o),ya=p(Xe),G=s(Xe,"DIV",{class:!0});var xo=r(G);k(Vt.$$.fragment,xo),wa=p(xo),ae=s(xo,"P",{});var $o=r(ae);xa=i($o,"This method uses "),Ie=s($o,"A",{href:!0});var Cs=r(Ie);$a=i(Cs,"ViltImageProcessor."),dn=s(Cs,"STRONG",{});var cd=r(dn);Va=i(cd,"call"),cd.forEach(o),Fa=i(Cs,"()"),Cs.forEach(o),Pa=i($o,` method to prepare image(s) for the model, and
`),Me=s($o,"A",{href:!0});var qs=r(Me);za=i(qs,"BertTokenizerFast."),cn=s(qs,"STRONG",{});var md=r(cn);Ia=i(md,"call"),md.forEach(o),Ma=i(qs,"()"),qs.forEach(o),ja=i($o," to prepare text for the model."),$o.forEach(o),Aa=p(xo),mn=s(xo,"P",{});var pd=r(mn);Ea=i(pd,"Please refer to the docstring of the above two methods for more information."),pd.forEach(o),xo.forEach(o),Xe.forEach(o),fs=p(t),ie=s(t,"H2",{class:!0});var Os=r(ie);je=s(Os,"A",{id:!0,class:!0,href:!0});var hd=r(je);pn=s(hd,"SPAN",{});var fd=r(pn);k(Ft.$$.fragment,fd),fd.forEach(o),hd.forEach(o),La=p(Os),hn=s(Os,"SPAN",{});var gd=r(hn);Ca=i(gd,"ViltModel"),gd.forEach(o),Os.forEach(o),gs=p(t),Q=s(t,"DIV",{class:!0});var Vo=r(Q);k(Pt.$$.fragment,Vo),qa=p(Vo),zt=s(Vo,"P",{});var Ns=r(zt);Oa=i(Ns,`The bare ViLT Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),fn=s(Ns,"CODE",{});var ud=r(fn);Na=i(ud,"torch.nn.Module <https://pytorch.org/docs/stable/nn.html#torch.nn.Module>"),ud.forEach(o),Sa=i(Ns,`_ subclass. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Ns.forEach(o),Da=p(Vo),q=s(Vo,"DIV",{class:!0});var Ze=r(q);k(It.$$.fragment,Ze),Ra=p(Ze),le=s(Ze,"P",{});var Fo=r(le);Wa=i(Fo,"The "),ho=s(Fo,"A",{href:!0});var _d=r(ho);Ba=i(_d,"ViltModel"),_d.forEach(o),Qa=i(Fo," forward method, overrides the "),gn=s(Fo,"CODE",{});var vd=r(gn);Ua=i(vd,"__call__"),vd.forEach(o),Ha=i(Fo," special method."),Fo.forEach(o),Ka=p(Ze),k(Ae.$$.fragment,Ze),Ga=p(Ze),k(Ee.$$.fragment,Ze),Ze.forEach(o),Vo.forEach(o),us=p(t),de=s(t,"H2",{class:!0});var Ss=r(de);Le=s(Ss,"A",{id:!0,class:!0,href:!0});var bd=r(Le);un=s(bd,"SPAN",{});var Td=r(un);k(Mt.$$.fragment,Td),Td.forEach(o),bd.forEach(o),Ja=p(Ss),_n=s(Ss,"SPAN",{});var kd=r(_n);Ya=i(kd,"ViltForMaskedLM"),kd.forEach(o),Ss.forEach(o),_s=p(t),j=s(t,"DIV",{class:!0});var et=r(j);k(jt.$$.fragment,et),Xa=p(et),vn=s(et,"P",{});var yd=r(vn);Za=i(yd,"ViLT Model with a language modeling head on top as done during pretraining."),yd.forEach(o),ei=p(et),At=s(et,"P",{});var Ds=r(At);ti=i(Ds,"This model is a PyTorch "),bn=s(Ds,"CODE",{});var wd=r(bn);oi=i(wd,"torch.nn.Module <https://pytorch.org/docs/stable/nn.html#torch.nn.Module>"),wd.forEach(o),ni=i(Ds,`_ subclass. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Ds.forEach(o),si=p(et),O=s(et,"DIV",{class:!0});var tt=r(O);k(Et.$$.fragment,tt),ri=p(tt),ce=s(tt,"P",{});var Po=r(ce);ai=i(Po,"The "),fo=s(Po,"A",{href:!0});var xd=r(fo);ii=i(xd,"ViltForMaskedLM"),xd.forEach(o),li=i(Po," forward method, overrides the "),Tn=s(Po,"CODE",{});var $d=r(Tn);di=i($d,"__call__"),$d.forEach(o),ci=i(Po," special method."),Po.forEach(o),mi=p(tt),k(Ce.$$.fragment,tt),pi=p(tt),k(qe.$$.fragment,tt),tt.forEach(o),et.forEach(o),vs=p(t),me=s(t,"H2",{class:!0});var Rs=r(me);Oe=s(Rs,"A",{id:!0,class:!0,href:!0});var Vd=r(Oe);kn=s(Vd,"SPAN",{});var Fd=r(kn);k(Lt.$$.fragment,Fd),Fd.forEach(o),Vd.forEach(o),hi=p(Rs),yn=s(Rs,"SPAN",{});var Pd=r(yn);fi=i(Pd,"ViltForQuestionAnswering"),Pd.forEach(o),Rs.forEach(o),bs=p(t),A=s(t,"DIV",{class:!0});var ot=r(A);k(Ct.$$.fragment,ot),gi=p(ot),wn=s(ot,"P",{});var zd=r(wn);ui=i(zd,`Vilt Model transformer with a classifier head on top (a linear layer on top of the final hidden state of the [CLS]
token) for visual question answering, e.g. for VQAv2.`),zd.forEach(o),_i=p(ot),qt=s(ot,"P",{});var Ws=r(qt);vi=i(Ws,"This model is a PyTorch "),xn=s(Ws,"CODE",{});var Id=r(xn);bi=i(Id,"torch.nn.Module <https://pytorch.org/docs/stable/nn.html#torch.nn.Module>"),Id.forEach(o),Ti=i(Ws,`_ subclass. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Ws.forEach(o),ki=p(ot),N=s(ot,"DIV",{class:!0});var nt=r(N);k(Ot.$$.fragment,nt),yi=p(nt),pe=s(nt,"P",{});var zo=r(pe);wi=i(zo,"The "),go=s(zo,"A",{href:!0});var Md=r(go);xi=i(Md,"ViltForQuestionAnswering"),Md.forEach(o),$i=i(zo," forward method, overrides the "),$n=s(zo,"CODE",{});var jd=r($n);Vi=i(jd,"__call__"),jd.forEach(o),Fi=i(zo," special method."),zo.forEach(o),Pi=p(nt),k(Ne.$$.fragment,nt),zi=p(nt),k(Se.$$.fragment,nt),nt.forEach(o),ot.forEach(o),Ts=p(t),he=s(t,"H2",{class:!0});var Bs=r(he);De=s(Bs,"A",{id:!0,class:!0,href:!0});var Ad=r(De);Vn=s(Ad,"SPAN",{});var Ed=r(Vn);k(Nt.$$.fragment,Ed),Ed.forEach(o),Ad.forEach(o),Ii=p(Bs),Fn=s(Bs,"SPAN",{});var Ld=r(Fn);Mi=i(Ld,"ViltForImagesAndTextClassification"),Ld.forEach(o),Bs.forEach(o),ks=p(t),U=s(t,"DIV",{class:!0});var Io=r(U);k(St.$$.fragment,Io),ji=p(Io),Pn=s(Io,"P",{});var Cd=r(Pn);Ai=i(Cd,"Vilt Model transformer with a classifier head on top for natural language visual reasoning, e.g. NLVR2."),Cd.forEach(o),Ei=p(Io),S=s(Io,"DIV",{class:!0});var st=r(S);k(Dt.$$.fragment,st),Li=p(st),fe=s(st,"P",{});var Mo=r(fe);Ci=i(Mo,"The "),uo=s(Mo,"A",{href:!0});var qd=r(uo);qi=i(qd,"ViltForImagesAndTextClassification"),qd.forEach(o),Oi=i(Mo," forward method, overrides the "),zn=s(Mo,"CODE",{});var Od=r(zn);Ni=i(Od,"__call__"),Od.forEach(o),Si=i(Mo," special method."),Mo.forEach(o),Di=p(st),k(Re.$$.fragment,st),Ri=p(st),k(We.$$.fragment,st),st.forEach(o),Io.forEach(o),ys=p(t),ge=s(t,"H2",{class:!0});var Qs=r(ge);Be=s(Qs,"A",{id:!0,class:!0,href:!0});var Nd=r(Be);In=s(Nd,"SPAN",{});var Sd=r(In);k(Rt.$$.fragment,Sd),Sd.forEach(o),Nd.forEach(o),Wi=p(Qs),Mn=s(Qs,"SPAN",{});var Dd=r(Mn);Bi=i(Dd,"ViltForImageAndTextRetrieval"),Dd.forEach(o),Qs.forEach(o),ws=p(t),E=s(t,"DIV",{class:!0});var rt=r(E);k(Wt.$$.fragment,rt),Qi=p(rt),jn=s(rt,"P",{});var Rd=r(jn);Ui=i(Rd,`Vilt Model transformer with a classifier head on top (a linear layer on top of the final hidden state of the [CLS]
token) for image-to-text or text-to-image retrieval, e.g. MSCOCO and F30K.`),Rd.forEach(o),Hi=p(rt),Bt=s(rt,"P",{});var Us=r(Bt);Ki=i(Us,"This model is a PyTorch "),An=s(Us,"CODE",{});var Wd=r(An);Gi=i(Wd,"torch.nn.Module <https://pytorch.org/docs/stable/nn.html#torch.nn.Module>"),Wd.forEach(o),Ji=i(Us,`_ subclass. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Us.forEach(o),Yi=p(rt),D=s(rt,"DIV",{class:!0});var at=r(D);k(Qt.$$.fragment,at),Xi=p(at),ue=s(at,"P",{});var jo=r(ue);Zi=i(jo,"The "),_o=s(jo,"A",{href:!0});var Bd=r(_o);el=i(Bd,"ViltForImageAndTextRetrieval"),Bd.forEach(o),tl=i(jo," forward method, overrides the "),En=s(jo,"CODE",{});var Qd=r(En);ol=i(Qd,"__call__"),Qd.forEach(o),nl=i(jo," special method."),jo.forEach(o),sl=p(at),k(Qe.$$.fragment,at),rl=p(at),k(Ue.$$.fragment,at),at.forEach(o),rt.forEach(o),xs=p(t),_e=s(t,"H2",{class:!0});var Hs=r(_e);He=s(Hs,"A",{id:!0,class:!0,href:!0});var Ud=r(He);Ln=s(Ud,"SPAN",{});var Hd=r(Ln);k(Ut.$$.fragment,Hd),Hd.forEach(o),Ud.forEach(o),al=p(Hs),Cn=s(Hs,"SPAN",{});var Kd=r(Cn);il=i(Kd,"ViltForTokenClassification"),Kd.forEach(o),Hs.forEach(o),$s=p(t),L=s(t,"DIV",{class:!0});var it=r(L);k(Ht.$$.fragment,it),ll=p(it),qn=s(it,"P",{});var Gd=r(qn);dl=i(Gd,`ViLT Model with a token classification head on top (a linear layer on top of the final hidden-states of the text
tokens) e.g. for Named-Entity-Recognition (NER) tasks.`),Gd.forEach(o),cl=p(it),Kt=s(it,"P",{});var Ks=r(Kt);ml=i(Ks,"This model is a PyTorch "),On=s(Ks,"CODE",{});var Jd=r(On);pl=i(Jd,"torch.nn.Module <https://pytorch.org/docs/stable/nn.html#torch.nn.Module>"),Jd.forEach(o),hl=i(Ks,`_ subclass. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Ks.forEach(o),fl=p(it),J=s(it,"DIV",{class:!0});var Ao=r(J);k(Gt.$$.fragment,Ao),gl=p(Ao),ve=s(Ao,"P",{});var Eo=r(ve);ul=i(Eo,"The "),vo=s(Eo,"A",{href:!0});var Yd=r(vo);_l=i(Yd,"ViltForTokenClassification"),Yd.forEach(o),vl=i(Eo," forward method, overrides the "),Nn=s(Eo,"CODE",{});var Xd=r(Nn);bl=i(Xd,"__call__"),Xd.forEach(o),Tl=i(Eo," special method."),Eo.forEach(o),kl=p(Ao),k(Ke.$$.fragment,Ao),Ao.forEach(o),it.forEach(o),this.h()},h(){c(d,"name","hf:doc:metadata"),c(d,"content",JSON.stringify(vc)),c(u,"id","vilt"),c(u,"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(u,"href","#vilt"),c(_,"class","relative group"),c(be,"id","overview"),c(be,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(be,"href","#overview"),c(Y,"class","relative group"),c(dt,"href","https://arxiv.org/abs/2102.03334"),c(dt,"rel","nofollow"),c(mt,"href","https://github.com/NielsRogge/Transformers-Tutorials/tree/master/ViLT"),c(mt,"rel","nofollow"),c(oo,"href","/docs/transformers/v4.29.0/en/model_doc/vilt#transformers.ViltProcessor"),c(no,"href","/docs/transformers/v4.29.0/en/model_doc/vilt#transformers.ViltProcessor"),nc(ke.src,wl="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/vilt_architecture.jpg")||c(ke,"src",wl),c(ke,"alt","drawing"),c(ke,"width","600"),c(so,"href","https://arxiv.org/abs/2102.03334"),c(pt,"href","https://huggingface.co/nielsr"),c(pt,"rel","nofollow"),c(ht,"href","https://github.com/dandelin/ViLT"),c(ht,"rel","nofollow"),c(we,"id","transformers.ViltConfig"),c(we,"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(we,"href","#transformers.ViltConfig"),c(Z,"class","relative group"),c(ut,"href","https://huggingface.co/dandelin/vilt-b32-mlm"),c(ut,"rel","nofollow"),c(io,"href","/docs/transformers/v4.29.0/en/main_classes/configuration#transformers.PretrainedConfig"),c(lo,"href","/docs/transformers/v4.29.0/en/main_classes/configuration#transformers.PretrainedConfig"),c(I,"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,"id","transformers.ViltFeatureExtractor"),c($e,"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($e,"href","#transformers.ViltFeatureExtractor"),c(oe,"class","relative group"),c(Ve,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(ne,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Fe,"id","transformers.ViltImageProcessor"),c(Fe,"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(Fe,"href","#transformers.ViltImageProcessor"),c(se,"class","relative group"),c(Pe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(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(ze,"id","transformers.ViltProcessor"),c(ze,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(ze,"href","#transformers.ViltProcessor"),c(re,"class","relative group"),c(co,"href","/docs/transformers/v4.29.0/en/model_doc/vilt#transformers.ViltProcessor"),c(mo,"href","/docs/transformers/v4.29.0/en/model_doc/vilt#transformers.ViltImageProcessor"),c(po,"href","/docs/transformers/v4.29.0/en/model_doc/bert#transformers.BertTokenizerFast"),c($t,"href","/docs/transformers/v4.29.0/en/model_doc/vilt#transformers.ViltProcessor.__call__"),c(Ie,"href","/docs/transformers/v4.29.0/en/model_doc/dpt#transformers.DPTFeatureExtractor.__call__"),c(Me,"href","/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__"),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(M,"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.ViltModel"),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.ViltModel"),c(ie,"class","relative group"),c(ho,"href","/docs/transformers/v4.29.0/en/model_doc/vilt#transformers.ViltModel"),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(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(Le,"id","transformers.ViltForMaskedLM"),c(Le,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(Le,"href","#transformers.ViltForMaskedLM"),c(de,"class","relative group"),c(fo,"href","/docs/transformers/v4.29.0/en/model_doc/vilt#transformers.ViltForMaskedLM"),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(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(Oe,"id","transformers.ViltForQuestionAnswering"),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","#transformers.ViltForQuestionAnswering"),c(me,"class","relative group"),c(go,"href","/docs/transformers/v4.29.0/en/model_doc/vilt#transformers.ViltForQuestionAnswering"),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(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(De,"id","transformers.ViltForImagesAndTextClassification"),c(De,"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(De,"href","#transformers.ViltForImagesAndTextClassification"),c(he,"class","relative group"),c(uo,"href","/docs/transformers/v4.29.0/en/model_doc/vilt#transformers.ViltForImagesAndTextClassification"),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(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(Be,"id","transformers.ViltForImageAndTextRetrieval"),c(Be,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(Be,"href","#transformers.ViltForImageAndTextRetrieval"),c(ge,"class","relative group"),c(_o,"href","/docs/transformers/v4.29.0/en/model_doc/vilt#transformers.ViltForImageAndTextRetrieval"),c(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(E,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(He,"id","transformers.ViltForTokenClassification"),c(He,"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(He,"href","#transformers.ViltForTokenClassification"),c(_e,"class","relative group"),c(vo,"href","/docs/transformers/v4.29.0/en/model_doc/vilt#transformers.ViltForTokenClassification"),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(L,"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,h){e(document.head,d),g(t,b,h),g(t,_,h),e(_,u),e(u,v),y(l,v,null),e(_,f),e(_,F),e(F,Gs),g(t,Gn,h),g(t,Y,h),e(Y,be),e(be,No),y(lt,No,null),e(Y,Js),e(Y,So),e(So,Ys),g(t,Jn,h),g(t,Te,h),e(Te,Xs),e(Te,dt),e(dt,Zs),e(Te,er),g(t,Yn,h),g(t,Zt,h),e(Zt,tr),g(t,Xn,h),g(t,eo,h),e(eo,Do),e(Do,or),g(t,Zn,h),g(t,to,h),e(to,nr),g(t,es,h),g(t,C,h),e(C,ct),e(ct,sr),e(ct,mt),e(mt,rr),e(ct,ar),e(C,ir),e(C,W),e(W,lr),e(W,Ro),e(Ro,dr),e(W,cr),e(W,Wo),e(Wo,mr),e(W,pr),e(W,oo),e(oo,hr),e(W,fr),e(C,gr),e(C,X),e(X,ur),e(X,Bo),e(Bo,_r),e(X,vr),e(X,no),e(no,br),e(X,Tr),e(C,kr),e(C,Qo),e(Qo,yr),g(t,ts,h),g(t,ke,h),g(t,os,h),g(t,ye,h),e(ye,wr),e(ye,so),e(so,xr),e(ye,$r),g(t,ns,h),g(t,K,h),e(K,Vr),e(K,pt),e(pt,Fr),e(K,Pr),e(K,ht),e(ht,zr),e(K,Ir),g(t,ss,h),g(t,ro,h),e(ro,Mr),g(t,rs,h),g(t,ao,h),e(ao,Uo),e(Uo,jr),g(t,as,h),g(t,Z,h),e(Z,we),e(we,Ho),y(ft,Ho,null),e(Z,Ar),e(Z,Ko),e(Ko,Er),g(t,is,h),g(t,I,h),y(gt,I,null),e(I,Lr),e(I,ee),e(ee,Cr),e(ee,Go),e(Go,qr),e(ee,Or),e(ee,ut),e(ut,Nr),e(ee,Sr),e(I,Dr),e(I,te),e(te,Rr),e(te,io),e(io,Wr),e(te,Br),e(te,lo),e(lo,Qr),e(te,Ur),e(I,Hr),y(xe,I,null),g(t,ls,h),g(t,oe,h),e(oe,$e),e($e,Jo),y(_t,Jo,null),e(oe,Kr),e(oe,Yo),e(Yo,Gr),g(t,ds,h),g(t,ne,h),y(vt,ne,null),e(ne,Jr),e(ne,Ve),y(bt,Ve,null),e(Ve,Yr),e(Ve,Xo),e(Xo,Xr),g(t,cs,h),g(t,se,h),e(se,Fe),e(Fe,Zo),y(Tt,Zo,null),e(se,Zr),e(se,en),e(en,ea),g(t,ms,h),g(t,B,h),y(kt,B,null),e(B,ta),e(B,tn),e(tn,oa),e(B,na),e(B,Pe),y(yt,Pe,null),e(Pe,sa),e(Pe,on),e(on,ra),g(t,ps,h),g(t,re,h),e(re,ze),e(ze,nn),y(wt,nn,null),e(re,aa),e(re,sn),e(sn,ia),g(t,hs,h),g(t,M,h),y(xt,M,null),e(M,la),e(M,rn),e(rn,da),e(M,ca),e(M,z),e(z,co),e(co,ma),e(z,pa),e(z,mo),e(mo,ha),e(z,fa),e(z,po),e(po,ga),e(z,ua),e(z,$t),e($t,an),e(an,_a),e($t,va),e(z,ba),e(z,ln),e(ln,Ta),e(z,ka),e(M,ya),e(M,G),y(Vt,G,null),e(G,wa),e(G,ae),e(ae,xa),e(ae,Ie),e(Ie,$a),e(Ie,dn),e(dn,Va),e(Ie,Fa),e(ae,Pa),e(ae,Me),e(Me,za),e(Me,cn),e(cn,Ia),e(Me,Ma),e(ae,ja),e(G,Aa),e(G,mn),e(mn,Ea),g(t,fs,h),g(t,ie,h),e(ie,je),e(je,pn),y(Ft,pn,null),e(ie,La),e(ie,hn),e(hn,Ca),g(t,gs,h),g(t,Q,h),y(Pt,Q,null),e(Q,qa),e(Q,zt),e(zt,Oa),e(zt,fn),e(fn,Na),e(zt,Sa),e(Q,Da),e(Q,q),y(It,q,null),e(q,Ra),e(q,le),e(le,Wa),e(le,ho),e(ho,Ba),e(le,Qa),e(le,gn),e(gn,Ua),e(le,Ha),e(q,Ka),y(Ae,q,null),e(q,Ga),y(Ee,q,null),g(t,us,h),g(t,de,h),e(de,Le),e(Le,un),y(Mt,un,null),e(de,Ja),e(de,_n),e(_n,Ya),g(t,_s,h),g(t,j,h),y(jt,j,null),e(j,Xa),e(j,vn),e(vn,Za),e(j,ei),e(j,At),e(At,ti),e(At,bn),e(bn,oi),e(At,ni),e(j,si),e(j,O),y(Et,O,null),e(O,ri),e(O,ce),e(ce,ai),e(ce,fo),e(fo,ii),e(ce,li),e(ce,Tn),e(Tn,di),e(ce,ci),e(O,mi),y(Ce,O,null),e(O,pi),y(qe,O,null),g(t,vs,h),g(t,me,h),e(me,Oe),e(Oe,kn),y(Lt,kn,null),e(me,hi),e(me,yn),e(yn,fi),g(t,bs,h),g(t,A,h),y(Ct,A,null),e(A,gi),e(A,wn),e(wn,ui),e(A,_i),e(A,qt),e(qt,vi),e(qt,xn),e(xn,bi),e(qt,Ti),e(A,ki),e(A,N),y(Ot,N,null),e(N,yi),e(N,pe),e(pe,wi),e(pe,go),e(go,xi),e(pe,$i),e(pe,$n),e($n,Vi),e(pe,Fi),e(N,Pi),y(Ne,N,null),e(N,zi),y(Se,N,null),g(t,Ts,h),g(t,he,h),e(he,De),e(De,Vn),y(Nt,Vn,null),e(he,Ii),e(he,Fn),e(Fn,Mi),g(t,ks,h),g(t,U,h),y(St,U,null),e(U,ji),e(U,Pn),e(Pn,Ai),e(U,Ei),e(U,S),y(Dt,S,null),e(S,Li),e(S,fe),e(fe,Ci),e(fe,uo),e(uo,qi),e(fe,Oi),e(fe,zn),e(zn,Ni),e(fe,Si),e(S,Di),y(Re,S,null),e(S,Ri),y(We,S,null),g(t,ys,h),g(t,ge,h),e(ge,Be),e(Be,In),y(Rt,In,null),e(ge,Wi),e(ge,Mn),e(Mn,Bi),g(t,ws,h),g(t,E,h),y(Wt,E,null),e(E,Qi),e(E,jn),e(jn,Ui),e(E,Hi),e(E,Bt),e(Bt,Ki),e(Bt,An),e(An,Gi),e(Bt,Ji),e(E,Yi),e(E,D),y(Qt,D,null),e(D,Xi),e(D,ue),e(ue,Zi),e(ue,_o),e(_o,el),e(ue,tl),e(ue,En),e(En,ol),e(ue,nl),e(D,sl),y(Qe,D,null),e(D,rl),y(Ue,D,null),g(t,xs,h),g(t,_e,h),e(_e,He),e(He,Ln),y(Ut,Ln,null),e(_e,al),e(_e,Cn),e(Cn,il),g(t,$s,h),g(t,L,h),y(Ht,L,null),e(L,ll),e(L,qn),e(qn,dl),e(L,cl),e(L,Kt),e(Kt,ml),e(Kt,On),e(On,pl),e(Kt,hl),e(L,fl),e(L,J),y(Gt,J,null),e(J,gl),e(J,ve),e(ve,ul),e(ve,vo),e(vo,_l),e(ve,vl),e(ve,Nn),e(Nn,bl),e(ve,Tl),e(J,kl),y(Ke,J,null),Vs=!0},p(t,[h]){const Jt={};h&2&&(Jt.$$scope={dirty:h,ctx:t}),xe.$set(Jt);const Sn={};h&2&&(Sn.$$scope={dirty:h,ctx:t}),Ae.$set(Sn);const Dn={};h&2&&(Dn.$$scope={dirty:h,ctx:t}),Ee.$set(Dn);const Rn={};h&2&&(Rn.$$scope={dirty:h,ctx:t}),Ce.$set(Rn);const Yt={};h&2&&(Yt.$$scope={dirty:h,ctx:t}),qe.$set(Yt);const Wn={};h&2&&(Wn.$$scope={dirty:h,ctx:t}),Ne.$set(Wn);const Bn={};h&2&&(Bn.$$scope={dirty:h,ctx:t}),Se.$set(Bn);const Qn={};h&2&&(Qn.$$scope={dirty:h,ctx:t}),Re.$set(Qn);const Xt={};h&2&&(Xt.$$scope={dirty:h,ctx:t}),We.$set(Xt);const Un={};h&2&&(Un.$$scope={dirty:h,ctx:t}),Qe.$set(Un);const Hn={};h&2&&(Hn.$$scope={dirty:h,ctx:t}),Ue.$set(Hn);const Kn={};h&2&&(Kn.$$scope={dirty:h,ctx:t}),Ke.$set(Kn)},i(t){Vs||(w(l.$$.fragment,t),w(lt.$$.fragment,t),w(ft.$$.fragment,t),w(gt.$$.fragment,t),w(xe.$$.fragment,t),w(_t.$$.fragment,t),w(vt.$$.fragment,t),w(bt.$$.fragment,t),w(Tt.$$.fragment,t),w(kt.$$.fragment,t),w(yt.$$.fragment,t),w(wt.$$.fragment,t),w(xt.$$.fragment,t),w(Vt.$$.fragment,t),w(Ft.$$.fragment,t),w(Pt.$$.fragment,t),w(It.$$.fragment,t),w(Ae.$$.fragment,t),w(Ee.$$.fragment,t),w(Mt.$$.fragment,t),w(jt.$$.fragment,t),w(Et.$$.fragment,t),w(Ce.$$.fragment,t),w(qe.$$.fragment,t),w(Lt.$$.fragment,t),w(Ct.$$.fragment,t),w(Ot.$$.fragment,t),w(Ne.$$.fragment,t),w(Se.$$.fragment,t),w(Nt.$$.fragment,t),w(St.$$.fragment,t),w(Dt.$$.fragment,t),w(Re.$$.fragment,t),w(We.$$.fragment,t),w(Rt.$$.fragment,t),w(Wt.$$.fragment,t),w(Qt.$$.fragment,t),w(Qe.$$.fragment,t),w(Ue.$$.fragment,t),w(Ut.$$.fragment,t),w(Ht.$$.fragment,t),w(Gt.$$.fragment,t),w(Ke.$$.fragment,t),Vs=!0)},o(t){x(l.$$.fragment,t),x(lt.$$.fragment,t),x(ft.$$.fragment,t),x(gt.$$.fragment,t),x(xe.$$.fragment,t),x(_t.$$.fragment,t),x(vt.$$.fragment,t),x(bt.$$.fragment,t),x(Tt.$$.fragment,t),x(kt.$$.fragment,t),x(yt.$$.fragment,t),x(wt.$$.fragment,t),x(xt.$$.fragment,t),x(Vt.$$.fragment,t),x(Ft.$$.fragment,t),x(Pt.$$.fragment,t),x(It.$$.fragment,t),x(Ae.$$.fragment,t),x(Ee.$$.fragment,t),x(Mt.$$.fragment,t),x(jt.$$.fragment,t),x(Et.$$.fragment,t),x(Ce.$$.fragment,t),x(qe.$$.fragment,t),x(Lt.$$.fragment,t),x(Ct.$$.fragment,t),x(Ot.$$.fragment,t),x(Ne.$$.fragment,t),x(Se.$$.fragment,t),x(Nt.$$.fragment,t),x(St.$$.fragment,t),x(Dt.$$.fragment,t),x(Re.$$.fragment,t),x(We.$$.fragment,t),x(Rt.$$.fragment,t),x(Wt.$$.fragment,t),x(Qt.$$.fragment,t),x(Qe.$$.fragment,t),x(Ue.$$.fragment,t),x(Ut.$$.fragment,t),x(Ht.$$.fragment,t),x(Gt.$$.fragment,t),x(Ke.$$.fragment,t),Vs=!1},d(t){o(d),t&&o(b),t&&o(_),$(l),t&&o(Gn),t&&o(Y),$(lt),t&&o(Jn),t&&o(Te),t&&o(Yn),t&&o(Zt),t&&o(Xn),t&&o(eo),t&&o(Zn),t&&o(to),t&&o(es),t&&o(C),t&&o(ts),t&&o(ke),t&&o(os),t&&o(ye),t&&o(ns),t&&o(K),t&&o(ss),t&&o(ro),t&&o(rs),t&&o(ao),t&&o(as),t&&o(Z),$(ft),t&&o(is),t&&o(I),$(gt),$(xe),t&&o(ls),t&&o(oe),$(_t),t&&o(ds),t&&o(ne),$(vt),$(bt),t&&o(cs),t&&o(se),$(Tt),t&&o(ms),t&&o(B),$(kt),$(yt),t&&o(ps),t&&o(re),$(wt),t&&o(hs),t&&o(M),$(xt),$(Vt),t&&o(fs),t&&o(ie),$(Ft),t&&o(gs),t&&o(Q),$(Pt),$(It),$(Ae),$(Ee),t&&o(us),t&&o(de),$(Mt),t&&o(_s),t&&o(j),$(jt),$(Et),$(Ce),$(qe),t&&o(vs),t&&o(me),$(Lt),t&&o(bs),t&&o(A),$(Ct),$(Ot),$(Ne),$(Se),t&&o(Ts),t&&o(he),$(Nt),t&&o(ks),t&&o(U),$(St),$(Dt),$(Re),$(We),t&&o(ys),t&&o(ge),$(Rt),t&&o(ws),t&&o(E),$(Wt),$(Qt),$(Qe),$(Ue),t&&o(xs),t&&o(_e),$(Ut),t&&o($s),t&&o(L),$(Ht),$(Gt),$(Ke)}}}const vc={local:"vilt",sections:[{local:"overview",title:"Overview"},{local:"transformers.ViltConfig",title:"ViltConfig"},{local:"transformers.ViltFeatureExtractor",title:"ViltFeatureExtractor"},{local:"transformers.ViltImageProcessor",title:"ViltImageProcessor"},{local:"transformers.ViltProcessor",title:"ViltProcessor"},{local:"transformers.ViltModel",title:"ViltModel"},{local:"transformers.ViltForMaskedLM",title:"ViltForMaskedLM"},{local:"transformers.ViltForQuestionAnswering",title:"ViltForQuestionAnswering"},{local:"transformers.ViltForImagesAndTextClassification",title:"ViltForImagesAndTextClassification"},{local:"transformers.ViltForImageAndTextRetrieval",title:"ViltForImageAndTextRetrieval"},{local:"transformers.ViltForTokenClassification",title:"ViltForTokenClassification"}],title:"ViLT"};function bc(V){return sc(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Vc extends Zd{constructor(d){super();ec(this,d,bc,_c,tc,{})}}export{Vc as default,vc as metadata};
