import{S as wm,i as Tm,s as vm,e as n,k as c,w as T,t,M as bm,c as a,d as r,m,a as i,x as v,h as s,b as l,N as ym,G as e,g as h,y as b,q as y,o as B,B as x,v as Bm,L as _r}from"../../chunks/vendor-hf-doc-builder.js";import{T as vn}from"../../chunks/Tip-hf-doc-builder.js";import{D as z}from"../../chunks/Docstring-hf-doc-builder.js";import{C as ee}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as U}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as ur}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function xm($){let p,k,_,f,w;return f=new ee({props:{code:`from transformers import BridgeTowerModel, BridgeTowerConfig

# Initializing a BridgeTower BridgeTower/bridgetower-base style configuration
configuration = BridgeTowerConfig()

# Initializing a model from the BridgeTower/bridgetower-base style configuration
model = BridgeTowerModel(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> BridgeTowerModel, BridgeTowerConfig

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a BridgeTower BridgeTower/bridgetower-base style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = BridgeTowerConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model from the BridgeTower/bridgetower-base style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = BridgeTowerModel(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(){p=n("p"),k=t("Example:"),_=c(),T(f.$$.fragment)},l(d){p=a(d,"P",{});var u=i(p);k=s(u,"Example:"),u.forEach(r),_=m(d),v(f.$$.fragment,d)},m(d,u){h(d,p,u),e(p,k),h(d,_,u),b(f,d,u),w=!0},p:_r,i(d){w||(y(f.$$.fragment,d),w=!0)},o(d){B(f.$$.fragment,d),w=!1},d(d){d&&r(p),d&&r(_),x(f,d)}}}function km($){let p,k,_,f,w;return f=new ee({props:{code:`from transformers import BridgeTowerTextConfig

# Initializing a BridgeTower BridgeTower/bridgetower-base style configuration for the text model
configuration = BridgeTowerTextConfig()

# Accessing the configuration
configuration`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> BridgeTowerTextConfig

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a BridgeTower BridgeTower/bridgetower-base style configuration for the text model</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = BridgeTowerTextConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Accessing the configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration`}}),{c(){p=n("p"),k=t("Example:"),_=c(),T(f.$$.fragment)},l(d){p=a(d,"P",{});var u=i(p);k=s(u,"Example:"),u.forEach(r),_=m(d),v(f.$$.fragment,d)},m(d,u){h(d,p,u),e(p,k),h(d,_,u),b(f,d,u),w=!0},p:_r,i(d){w||(y(f.$$.fragment,d),w=!0)},o(d){B(f.$$.fragment,d),w=!1},d(d){d&&r(p),d&&r(_),x(f,d)}}}function $m($){let p,k,_,f,w;return f=new ee({props:{code:`from transformers import BridgeTowerVisionConfig

# Initializing a BridgeTower BridgeTower/bridgetower-base style configuration for the vision model
configuration = BridgeTowerVisionConfig()

# Accessing the configuration
configuration`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> BridgeTowerVisionConfig

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a BridgeTower BridgeTower/bridgetower-base style configuration for the vision model</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = BridgeTowerVisionConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Accessing the configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration`}}),{c(){p=n("p"),k=t("Example:"),_=c(),T(f.$$.fragment)},l(d){p=a(d,"P",{});var u=i(p);k=s(u,"Example:"),u.forEach(r),_=m(d),v(f.$$.fragment,d)},m(d,u){h(d,p,u),e(p,k),h(d,_,u),b(f,d,u),w=!0},p:_r,i(d){w||(y(f.$$.fragment,d),w=!0)},o(d){B(f.$$.fragment,d),w=!1},d(d){d&&r(p),d&&r(_),x(f,d)}}}function jm($){let p,k,_,f,w;return{c(){p=n("p"),k=t("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=n("code"),f=t("Module"),w=t(`
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(d){p=a(d,"P",{});var u=i(p);k=s(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=a(u,"CODE",{});var j=i(_);f=s(j,"Module"),j.forEach(r),w=s(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(r)},m(d,u){h(d,p,u),e(p,k),e(p,_),e(_,f),e(p,w)},d(d){d&&r(p)}}}function Pm($){let p,k,_,f,w;return f=new ee({props:{code:`from transformers import BridgeTowerProcessor, BridgeTowerModel
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 = BridgeTowerProcessor.from_pretrained("BridgeTower/bridgetower-base")
model = BridgeTowerModel.from_pretrained("BridgeTower/bridgetower-base")

inputs = processor(image, text, return_tensors="pt")
outputs = model(**inputs)
outputs.keys()`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> BridgeTowerProcessor, BridgeTowerModel
<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 = BridgeTowerProcessor.from_pretrained(<span class="hljs-string">&quot;BridgeTower/bridgetower-base&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = BridgeTowerModel.from_pretrained(<span class="hljs-string">&quot;BridgeTower/bridgetower-base&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>outputs.keys()
odict_keys([<span class="hljs-string">&#x27;text_features&#x27;</span>, <span class="hljs-string">&#x27;image_features&#x27;</span>, <span class="hljs-string">&#x27;pooler_output&#x27;</span>])`}}),{c(){p=n("p"),k=t("Examples:"),_=c(),T(f.$$.fragment)},l(d){p=a(d,"P",{});var u=i(p);k=s(u,"Examples:"),u.forEach(r),_=m(d),v(f.$$.fragment,d)},m(d,u){h(d,p,u),e(p,k),h(d,_,u),b(f,d,u),w=!0},p:_r,i(d){w||(y(f.$$.fragment,d),w=!0)},o(d){B(f.$$.fragment,d),w=!1},d(d){d&&r(p),d&&r(_),x(f,d)}}}function zm($){let p,k,_,f,w;return{c(){p=n("p"),k=t("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=n("code"),f=t("Module"),w=t(`
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(d){p=a(d,"P",{});var u=i(p);k=s(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=a(u,"CODE",{});var j=i(_);f=s(j,"Module"),j.forEach(r),w=s(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(r)},m(d,u){h(d,p,u),e(p,k),e(p,_),e(_,f),e(p,w)},d(d){d&&r(p)}}}function Im($){let p,k,_,f,w;return f=new ee({props:{code:`from transformers import BridgeTowerProcessor, BridgeTowerForContrastiveLearning
import requests
from PIL import Image
import torch

image_urls = [
    "https://farm4.staticflickr.com/3395/3428278415_81c3e27f15_z.jpg",
    "http://images.cocodataset.org/val2017/000000039769.jpg",
]
texts = ["two dogs in a car", "two cats sleeping on a couch"]
images = [Image.open(requests.get(url, stream=True).raw) for url in image_urls]

processor = BridgeTowerProcessor.from_pretrained("BridgeTower/bridgetower-large-itm-mlm-itc")
model = BridgeTowerForContrastiveLearning.from_pretrained("BridgeTower/bridgetower-large-itm-mlm-itc")

inputs = processor(images, texts, padding=True, return_tensors="pt")
loss = model(**inputs, return_loss=True).loss

inputs = processor(images, texts[::-1], padding=True, return_tensors="pt")
loss_swapped = model(**inputs, return_loss=True).loss

print("Loss", round(loss.item(), 4))

print("Loss with swapped images", round(loss_swapped.item(), 4))`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> BridgeTowerProcessor, BridgeTowerForContrastiveLearning
<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> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>image_urls = [
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;https://farm4.staticflickr.com/3395/3428278415_81c3e27f15_z.jpg&quot;</span>,
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000039769.jpg&quot;</span>,
<span class="hljs-meta">... </span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>texts = [<span class="hljs-string">&quot;two dogs in a car&quot;</span>, <span class="hljs-string">&quot;two cats sleeping on a couch&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>images = [Image.<span class="hljs-built_in">open</span>(requests.get(url, stream=<span class="hljs-literal">True</span>).raw) <span class="hljs-keyword">for</span> url <span class="hljs-keyword">in</span> image_urls]

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = BridgeTowerProcessor.from_pretrained(<span class="hljs-string">&quot;BridgeTower/bridgetower-large-itm-mlm-itc&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = BridgeTowerForContrastiveLearning.from_pretrained(<span class="hljs-string">&quot;BridgeTower/bridgetower-large-itm-mlm-itc&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(images, texts, padding=<span class="hljs-literal">True</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = model(**inputs, return_loss=<span class="hljs-literal">True</span>).loss

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(images, texts[::-<span class="hljs-number">1</span>], padding=<span class="hljs-literal">True</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>loss_swapped = model(**inputs, return_loss=<span class="hljs-literal">True</span>).loss

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;Loss&quot;</span>, <span class="hljs-built_in">round</span>(loss.item(), <span class="hljs-number">4</span>))
Loss <span class="hljs-number">0.0019</span>

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;Loss with swapped images&quot;</span>, <span class="hljs-built_in">round</span>(loss_swapped.item(), <span class="hljs-number">4</span>))
Loss <span class="hljs-keyword">with</span> swapped images <span class="hljs-number">2.126</span>`}}),{c(){p=n("p"),k=t("Examples:"),_=c(),T(f.$$.fragment)},l(d){p=a(d,"P",{});var u=i(p);k=s(u,"Examples:"),u.forEach(r),_=m(d),v(f.$$.fragment,d)},m(d,u){h(d,p,u),e(p,k),h(d,_,u),b(f,d,u),w=!0},p:_r,i(d){w||(y(f.$$.fragment,d),w=!0)},o(d){B(f.$$.fragment,d),w=!1},d(d){d&&r(p),d&&r(_),x(f,d)}}}function Cm($){let p,k,_,f,w;return{c(){p=n("p"),k=t("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=n("code"),f=t("Module"),w=t(`
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(d){p=a(d,"P",{});var u=i(p);k=s(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=a(u,"CODE",{});var j=i(_);f=s(j,"Module"),j.forEach(r),w=s(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(r)},m(d,u){h(d,p,u),e(p,k),e(p,_),e(_,f),e(p,w)},d(d){d&&r(p)}}}function Em($){let p,k,_,f,w;return f=new ee({props:{code:`from transformers import BridgeTowerProcessor, BridgeTowerForMaskedLM
from PIL import Image
import requests

url = "http://images.cocodataset.org/val2017/000000360943.jpg"
image = Image.open(requests.get(url, stream=True).raw).convert("RGB")
text = "a <mask> looking out of the window"

processor = BridgeTowerProcessor.from_pretrained("BridgeTower/bridgetower-base-itm-mlm")
model = BridgeTowerForMaskedLM.from_pretrained("BridgeTower/bridgetower-base-itm-mlm")

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

# forward pass
outputs = model(**encoding)

results = processor.decode(outputs.logits.argmax(dim=-1).squeeze(0).tolist())

print(results)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> BridgeTowerProcessor, BridgeTowerForMaskedLM
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000360943.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).convert(<span class="hljs-string">&quot;RGB&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>text = <span class="hljs-string">&quot;a &lt;mask&gt; looking out of the window&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = BridgeTowerProcessor.from_pretrained(<span class="hljs-string">&quot;BridgeTower/bridgetower-base-itm-mlm&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = BridgeTowerForMaskedLM.from_pretrained(<span class="hljs-string">&quot;BridgeTower/bridgetower-base-itm-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>results = processor.decode(outputs.logits.argmax(dim=-<span class="hljs-number">1</span>).squeeze(<span class="hljs-number">0</span>).tolist())

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(results)
.a cat looking out of the window.`}}),{c(){p=n("p"),k=t("Examples:"),_=c(),T(f.$$.fragment)},l(d){p=a(d,"P",{});var u=i(p);k=s(u,"Examples:"),u.forEach(r),_=m(d),v(f.$$.fragment,d)},m(d,u){h(d,p,u),e(p,k),h(d,_,u),b(f,d,u),w=!0},p:_r,i(d){w||(y(f.$$.fragment,d),w=!0)},o(d){B(f.$$.fragment,d),w=!1},d(d){d&&r(p),d&&r(_),x(f,d)}}}function Fm($){let p,k,_,f,w;return{c(){p=n("p"),k=t("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=n("code"),f=t("Module"),w=t(`
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(d){p=a(d,"P",{});var u=i(p);k=s(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=a(u,"CODE",{});var j=i(_);f=s(j,"Module"),j.forEach(r),w=s(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(r)},m(d,u){h(d,p,u),e(p,k),e(p,_),e(_,f),e(p,w)},d(d){d&&r(p)}}}function Mm($){let p,k,_,f,w;return f=new ee({props:{code:`from transformers import BridgeTowerProcessor, BridgeTowerForImageAndTextRetrieval
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 = BridgeTowerProcessor.from_pretrained("BridgeTower/bridgetower-base-itm-mlm")
model = BridgeTowerForImageAndTextRetrieval.from_pretrained("BridgeTower/bridgetower-base-itm-mlm")

# 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, 1].item()`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> BridgeTowerProcessor, BridgeTowerForImageAndTextRetrieval
<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 = BridgeTowerProcessor.from_pretrained(<span class="hljs-string">&quot;BridgeTower/bridgetower-base-itm-mlm&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = BridgeTowerForImageAndTextRetrieval.from_pretrained(<span class="hljs-string">&quot;BridgeTower/bridgetower-base-itm-mlm&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>, <span class="hljs-number">1</span>].item()`}}),{c(){p=n("p"),k=t("Examples:"),_=c(),T(f.$$.fragment)},l(d){p=a(d,"P",{});var u=i(p);k=s(u,"Examples:"),u.forEach(r),_=m(d),v(f.$$.fragment,d)},m(d,u){h(d,p,u),e(p,k),h(d,_,u),b(f,d,u),w=!0},p:_r,i(d){w||(y(f.$$.fragment,d),w=!0)},o(d){B(f.$$.fragment,d),w=!1},d(d){d&&r(p),d&&r(_),x(f,d)}}}function qm($){let p,k,_,f,w,d,u,j,bn,ps,oe,ke,_t,ho,yn,wt,Bn,hs,$e,xn,fo,kn,$n,fs,je,jn,uo,Pn,zn,us,wr,In,_s,Tr,Tt,Cn,ws,Pe,zl,Ts,_o,En,vr,Fn,vs,re,ze,vt,wo,Mn,bt,qn,bs,br,Ln,ys,O,An,yr,On,Rn,Br,Nn,Dn,xr,Sn,Wn,Bs,J,Vn,kr,Un,Gn,$r,Hn,Xn,xs,To,ks,Q,Jn,jr,Qn,Yn,Pr,Kn,Zn,$s,vo,js,Y,ea,zr,oa,ra,Ir,ta,sa,Ps,bo,zs,I,na,yo,aa,ia,Bo,da,la,xo,ca,ma,ko,ga,pa,Is,Cr,ha,Cs,R,$o,fa,Er,ua,_a,wa,te,Ta,jo,va,ba,Po,ya,Ba,xa,zo,ka,Io,$a,ja,Pa,yt,za,Es,se,Ie,Bt,Co,Ia,xt,Ca,Fs,P,Eo,Ea,ne,Fa,Fr,Ma,qa,Fo,La,Aa,Oa,ae,Ra,Mr,Na,Da,qr,Sa,Wa,Va,Ce,Ua,Ee,Mo,Ga,ie,Ha,Lr,Xa,Ja,Ar,Qa,Ya,Ka,Fe,qo,Za,Lo,ei,Or,oi,ri,Ms,de,Me,kt,Ao,ti,$t,si,qs,E,Oo,ni,le,ai,Rr,ii,di,Ro,li,ci,mi,ce,gi,Nr,pi,hi,Dr,fi,ui,_i,qe,Ls,me,Le,jt,No,wi,Pt,Ti,As,F,Do,vi,ge,bi,Sr,yi,Bi,So,xi,ki,$i,pe,ji,Wr,Pi,zi,Vr,Ii,Ci,Ei,Ae,Os,he,Oe,zt,Wo,Fi,It,Mi,Rs,G,Vo,qi,Ct,Li,Ai,Re,Uo,Oi,Et,Ri,Ns,fe,Ne,Ft,Go,Ni,Mt,Di,Ds,M,Ho,Si,qt,Wi,Vi,C,Ur,Ui,Gi,Gr,Hi,Xi,Hr,Ji,Qi,Xo,Lt,Yi,Ki,Zi,At,ed,od,rd,K,Jo,td,ue,sd,De,nd,Ot,ad,id,dd,Se,ld,Rt,cd,md,gd,pd,Nt,hd,Ss,_e,We,Dt,Qo,fd,St,ud,Ws,H,Yo,_d,Ko,wd,Wt,Td,vd,bd,N,Zo,yd,we,Bd,Xr,xd,kd,Vt,$d,jd,Pd,Ve,zd,Ue,Vs,Te,Ge,Ut,er,Id,Gt,Cd,Us,q,or,Ed,Ht,Fd,Md,rr,qd,Xt,Ld,Ad,Od,D,tr,Rd,ve,Nd,Jr,Dd,Sd,Jt,Wd,Vd,Ud,He,Gd,Xe,Gs,be,Je,Qt,sr,Hd,Yt,Xd,Hs,L,nr,Jd,Kt,Qd,Yd,ar,Kd,Zt,Zd,el,ol,S,ir,rl,ye,tl,Qr,sl,nl,es,al,il,dl,Qe,ll,Ye,Xs,Be,Ke,os,dr,cl,rs,ml,Js,A,lr,gl,ts,pl,hl,cr,fl,ss,ul,_l,wl,W,mr,Tl,xe,vl,Yr,bl,yl,ns,Bl,xl,kl,Ze,$l,eo,Qs;return d=new U({}),ho=new U({}),wo=new U({}),To=new ee({props:{code:`from transformers import BridgeTowerProcessor, BridgeTowerForContrastiveLearning
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 = BridgeTowerProcessor.from_pretrained("BridgeTower/bridgetower-large-itm-mlm-itc")
model = BridgeTowerForContrastiveLearning.from_pretrained("BridgeTower/bridgetower-large-itm-mlm-itc")

# forward pass
scores = dict()
for text in texts:
    # prepare inputs
    encoding = processor(image, text, return_tensors="pt")
    outputs = model(**encoding)
    scores[text] = outputs`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> BridgeTowerProcessor, BridgeTowerForContrastiveLearning
<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 = BridgeTowerProcessor.from_pretrained(<span class="hljs-string">&quot;BridgeTower/bridgetower-large-itm-mlm-itc&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = BridgeTowerForContrastiveLearning.from_pretrained(<span class="hljs-string">&quot;BridgeTower/bridgetower-large-itm-mlm-itc&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`}}),vo=new ee({props:{code:`from transformers import BridgeTowerProcessor, BridgeTowerForImageAndTextRetrieval
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 = BridgeTowerProcessor.from_pretrained("BridgeTower/bridgetower-base-itm-mlm")
model = BridgeTowerForImageAndTextRetrieval.from_pretrained("BridgeTower/bridgetower-base-itm-mlm")

# 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, 1].item()`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> BridgeTowerProcessor, BridgeTowerForImageAndTextRetrieval
<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 = BridgeTowerProcessor.from_pretrained(<span class="hljs-string">&quot;BridgeTower/bridgetower-base-itm-mlm&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = BridgeTowerForImageAndTextRetrieval.from_pretrained(<span class="hljs-string">&quot;BridgeTower/bridgetower-base-itm-mlm&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>, <span class="hljs-number">1</span>].item()`}}),bo=new ee({props:{code:`from transformers import BridgeTowerProcessor, BridgeTowerForMaskedLM
from PIL import Image
import requests

url = "http://images.cocodataset.org/val2017/000000360943.jpg"
image = Image.open(requests.get(url, stream=True).raw).convert("RGB")
text = "a <mask> looking out of the window"

processor = BridgeTowerProcessor.from_pretrained("BridgeTower/bridgetower-base-itm-mlm")
model = BridgeTowerForMaskedLM.from_pretrained("BridgeTower/bridgetower-base-itm-mlm")

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

# forward pass
outputs = model(**encoding)

results = processor.decode(outputs.logits.argmax(dim=-1).squeeze(0).tolist())

print(results)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> BridgeTowerProcessor, BridgeTowerForMaskedLM
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000360943.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).convert(<span class="hljs-string">&quot;RGB&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>text = <span class="hljs-string">&quot;a &lt;mask&gt; looking out of the window&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = BridgeTowerProcessor.from_pretrained(<span class="hljs-string">&quot;BridgeTower/bridgetower-base-itm-mlm&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = BridgeTowerForMaskedLM.from_pretrained(<span class="hljs-string">&quot;BridgeTower/bridgetower-base-itm-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>results = processor.decode(outputs.logits.argmax(dim=-<span class="hljs-number">1</span>).squeeze(<span class="hljs-number">0</span>).tolist())

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(results)
.a cat looking out of the window.`}}),Co=new U({}),Eo=new z({props:{name:"class transformers.BridgeTowerConfig",anchor:"transformers.BridgeTowerConfig",parameters:[{name:"share_cross_modal_transformer_layers",val:" = True"},{name:"hidden_act",val:" = 'gelu'"},{name:"hidden_size",val:" = 768"},{name:"initializer_factor",val:" = 1"},{name:"layer_norm_eps",val:" = 1e-05"},{name:"share_link_tower_layers",val:" = False"},{name:"link_tower_type",val:" = 'add'"},{name:"num_attention_heads",val:" = 12"},{name:"num_hidden_layers",val:" = 6"},{name:"tie_word_embeddings",val:" = False"},{name:"init_layernorm_from_vision_encoder",val:" = False"},{name:"text_config",val:" = None"},{name:"vision_config",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.BridgeTowerConfig.share_cross_modal_transformer_layers",description:`<strong>share_cross_modal_transformer_layers</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether cross modal transformer layers are shared.`,name:"share_cross_modal_transformer_layers"},{anchor:"transformers.BridgeTowerConfig.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.`,name:"hidden_act"},{anchor:"transformers.BridgeTowerConfig.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.BridgeTowerConfig.initializer_factor",description:`<strong>initializer_factor</strong> (\`float&#x201C;, <em>optional</em>, defaults to 1) &#x2014;
A factor for initializing all weight matrices (should be kept to 1, used internally for initialization
testing).`,name:"initializer_factor"},{anchor:"transformers.BridgeTowerConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-05) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.BridgeTowerConfig.share_link_tower_layers",description:`<strong>share_link_tower_layers</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether the bride/link tower layers are shared.`,name:"share_link_tower_layers"},{anchor:"transformers.BridgeTowerConfig.link_tower_type",description:`<strong>link_tower_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;add&quot;</code>) &#x2014;
Type of the bridge/link layer.`,name:"link_tower_type"},{anchor:"transformers.BridgeTowerConfig.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.BridgeTowerConfig.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 6) &#x2014;
Number of hidden layers in the Transformer encoder.`,name:"num_hidden_layers"},{anchor:"transformers.BridgeTowerConfig.tie_word_embeddings",description:`<strong>tie_word_embeddings</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to tie input and output embeddings.`,name:"tie_word_embeddings"},{anchor:"transformers.BridgeTowerConfig.init_layernorm_from_vision_encoder",description:`<strong>init_layernorm_from_vision_encoder</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to init LayerNorm from the vision encoder.`,name:"init_layernorm_from_vision_encoder"},{anchor:"transformers.BridgeTowerConfig.text_config",description:`<strong>text_config</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
Dictionary of configuration options used to initialize <a href="/docs/transformers/v4.29.0/en/model_doc/bridgetower#transformers.BridgeTowerTextConfig">BridgeTowerTextConfig</a>.`,name:"text_config"},{anchor:"transformers.BridgeTowerConfig.vision_config",description:`<strong>vision_config</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
Dictionary of configuration options used to initialize <a href="/docs/transformers/v4.29.0/en/model_doc/bridgetower#transformers.BridgeTowerVisionConfig">BridgeTowerVisionConfig</a>.`,name:"vision_config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/bridgetower/configuration_bridgetower.py#L250"}}),Ce=new ur({props:{anchor:"transformers.BridgeTowerConfig.example",$$slots:{default:[xm]},$$scope:{ctx:$}}}),Mo=new z({props:{name:"from_text_vision_configs",anchor:"transformers.BridgeTowerConfig.from_text_vision_configs",parameters:[{name:"text_config",val:": BridgeTowerTextConfig"},{name:"vision_config",val:": BridgeTowerVisionConfig"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/bridgetower/configuration_bridgetower.py#L350"}}),qo=new z({props:{name:"to_dict",anchor:"transformers.BridgeTowerConfig.to_dict",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/bridgetower/configuration_bridgetower.py#L361",returnDescription:`
<p>Dictionary of all the attributes that make up this configuration instance,</p>
`,returnType:`
<p><code>Dict[str, any]</code></p>
`}}),Ao=new U({}),Oo=new z({props:{name:"class transformers.BridgeTowerTextConfig",anchor:"transformers.BridgeTowerTextConfig",parameters:[{name:"vocab_size",val:" = 50265"},{name:"hidden_size",val:" = 768"},{name:"num_hidden_layers",val:" = 12"},{name:"num_attention_heads",val:" = 12"},{name:"initializer_factor",val:" = 1"},{name:"intermediate_size",val:" = 3072"},{name:"hidden_act",val:" = 'gelu'"},{name:"hidden_dropout_prob",val:" = 0.1"},{name:"attention_probs_dropout_prob",val:" = 0.1"},{name:"max_position_embeddings",val:" = 514"},{name:"type_vocab_size",val:" = 1"},{name:"initializer_range",val:" = 0.02"},{name:"layer_norm_eps",val:" = 1e-05"},{name:"pad_token_id",val:" = 1"},{name:"bos_token_id",val:" = 0"},{name:"eos_token_id",val:" = 2"},{name:"position_embedding_type",val:" = 'absolute'"},{name:"use_cache",val:" = True"},{name:"classifier_dropout",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.BridgeTowerTextConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 50265) &#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/bridgetower#transformers.BridgeTowerModel">BridgeTowerModel</a>.`,name:"vocab_size"},{anchor:"transformers.BridgeTowerTextConfig.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.BridgeTowerTextConfig.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.BridgeTowerTextConfig.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.BridgeTowerTextConfig.intermediate_size",description:`<strong>intermediate_size</strong> (<code>int</code>, <em>optional</em>, defaults to 3072) &#x2014;
Dimensionality of the &#x201C;intermediate&#x201D; (often named feed-forward) layer in the Transformer encoder.`,name:"intermediate_size"},{anchor:"transformers.BridgeTowerTextConfig.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code> or <code>Callable</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;silu&quot;</code> and <code>&quot;gelu_new&quot;</code> are supported.`,name:"hidden_act"},{anchor:"transformers.BridgeTowerTextConfig.hidden_dropout_prob",description:`<strong>hidden_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.`,name:"hidden_dropout_prob"},{anchor:"transformers.BridgeTowerTextConfig.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.BridgeTowerTextConfig.max_position_embeddings",description:`<strong>max_position_embeddings</strong> (<code>int</code>, <em>optional</em>, defaults to 514) &#x2014;
The maximum sequence length that this model might ever be used with. Typically set this to something large
just in case (e.g., 512 or 1024 or 2048).`,name:"max_position_embeddings"},{anchor:"transformers.BridgeTowerTextConfig.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>.`,name:"type_vocab_size"},{anchor:"transformers.BridgeTowerTextConfig.initializer_factor",description:`<strong>initializer_factor</strong> (\`float&#x201C;, <em>optional</em>, defaults to 1) &#x2014;
A factor for initializing all weight matrices (should be kept to 1, used internally for initialization
testing).`,name:"initializer_factor"},{anchor:"transformers.BridgeTowerTextConfig.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.BridgeTowerTextConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-05) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.BridgeTowerTextConfig.position_embedding_type",description:`<strong>position_embedding_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;absolute&quot;</code>) &#x2014;
Type of position embedding. Choose one of <code>&quot;absolute&quot;</code>, <code>&quot;relative_key&quot;</code>, <code>&quot;relative_key_query&quot;</code>. For
positional embeddings use <code>&quot;absolute&quot;</code>. For more information on <code>&quot;relative_key&quot;</code>, please refer to
<a href="https://arxiv.org/abs/1803.02155" rel="nofollow">Self-Attention with Relative Position Representations (Shaw et al.)</a>.
For more information on <code>&quot;relative_key_query&quot;</code>, please refer to <em>Method 4</em> in <a href="https://arxiv.org/abs/2009.13658" rel="nofollow">Improve Transformer Models
with Better Relative Position Embeddings (Huang et al.)</a>.`,name:"position_embedding_type"},{anchor:"transformers.BridgeTowerTextConfig.is_decoder",description:`<strong>is_decoder</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether the model is used as a decoder or not. If <code>False</code>, the model is used as an encoder.`,name:"is_decoder"},{anchor:"transformers.BridgeTowerTextConfig.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not the model should return the last key/values attentions (not used by all models). Only
relevant if <code>config.is_decoder=True</code>.`,name:"use_cache"},{anchor:"transformers.BridgeTowerTextConfig.classifier_dropout",description:`<strong>classifier_dropout</strong> (<code>float</code>, <em>optional</em>) &#x2014;
The dropout ratio for the classification head.`,name:"classifier_dropout"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/bridgetower/configuration_bridgetower.py#L121"}}),qe=new ur({props:{anchor:"transformers.BridgeTowerTextConfig.example",$$slots:{default:[km]},$$scope:{ctx:$}}}),No=new U({}),Do=new z({props:{name:"class transformers.BridgeTowerVisionConfig",anchor:"transformers.BridgeTowerVisionConfig",parameters:[{name:"hidden_size",val:" = 768"},{name:"num_hidden_layers",val:" = 12"},{name:"num_channels",val:" = 3"},{name:"patch_size",val:" = 16"},{name:"image_size",val:" = 288"},{name:"initializer_factor",val:" = 1"},{name:"layer_norm_eps",val:" = 1e-05"},{name:"stop_gradient",val:" = False"},{name:"share_layernorm",val:" = True"},{name:"remove_last_layer",val:" = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.BridgeTowerVisionConfig.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.BridgeTowerVisionConfig.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of hidden layers in visual encoder model.`,name:"num_hidden_layers"},{anchor:"transformers.BridgeTowerVisionConfig.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, <em>optional</em>, defaults to 16) &#x2014;
The size (resolution) of each patch.`,name:"patch_size"},{anchor:"transformers.BridgeTowerVisionConfig.image_size",description:`<strong>image_size</strong> (<code>int</code>, <em>optional</em>, defaults to 288) &#x2014;
The size (resolution) of each image.`,name:"image_size"},{anchor:"transformers.BridgeTowerVisionConfig.initializer_factor",description:`<strong>initializer_factor</strong> (\`float&#x201C;, <em>optional</em>, defaults to 1) &#x2014;
A factor for initializing all weight matrices (should be kept to 1, used internally for initialization
testing).`,name:"initializer_factor"},{anchor:"transformers.BridgeTowerVisionConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-05) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.BridgeTowerVisionConfig.stop_gradient",description:`<strong>stop_gradient</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to stop gradient for training.`,name:"stop_gradient"},{anchor:"transformers.BridgeTowerVisionConfig.share_layernorm",description:`<strong>share_layernorm</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether LayerNorm layers are shared.`,name:"share_layernorm"},{anchor:"transformers.BridgeTowerVisionConfig.remove_last_layer",description:`<strong>remove_last_layer</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to remove the last layer from the vision encoder.`,name:"remove_last_layer"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/bridgetower/configuration_bridgetower.py#L35"}}),Ae=new ur({props:{anchor:"transformers.BridgeTowerVisionConfig.example",$$slots:{default:[$m]},$$scope:{ctx:$}}}),Wo=new U({}),Vo=new z({props:{name:"class transformers.BridgeTowerImageProcessor",anchor:"transformers.BridgeTowerImageProcessor",parameters:[{name:"do_resize",val:": bool = True"},{name:"size",val:": typing.Dict[str, int] = 288"},{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_center_crop",val:": bool = True"},{name:"do_pad",val:": bool = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.BridgeTowerImageProcessor.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.BridgeTowerImageProcessor.size",description:`<strong>size</strong> (<code>Dict[str, int]</code> <em>optional</em>, defaults to <code>288</code>) &#x2014;
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.BridgeTowerImageProcessor.size_divisor",description:`<strong>size_divisor</strong> (<code>int</code>, <em>optional</em>, defaults to <code>32</code>) &#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.BridgeTowerImageProcessor.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.BridgeTowerImageProcessor.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to rescale the image by the specified scale <code>rescale_factor</code>. Can be overridden by the <code>do_rescale</code>
parameter in the <code>preprocess</code> method.`,name:"do_rescale"},{anchor:"transformers.BridgeTowerImageProcessor.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.BridgeTowerImageProcessor.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.BridgeTowerImageProcessor.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.BridgeTowerImageProcessor.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.BridgeTowerImageProcessor.do_center_crop",description:`<strong>do_center_crop</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to center crop the image. Can be overridden by the <code>do_center_crop</code> parameter in the <code>preprocess</code>
method.`,name:"do_center_crop"},{anchor:"transformers.BridgeTowerImageProcessor.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/bridgetower/image_processing_bridgetower.py#L114"}}),Uo=new z({props:{name:"preprocess",anchor:"transformers.BridgeTowerImageProcessor.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:"do_center_crop",val:": typing.Optional[bool] = None"},{name:"return_tensors",val:": typing.Union[str, transformers.utils.generic.TensorType, NoneType] = None"},{name:"data_format",val:": ChannelDimension = <ChannelDimension.FIRST: 'channels_first'>"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.BridgeTowerImageProcessor.preprocess.images",description:`<strong>images</strong> (<code>ImageInput</code>) &#x2014;
Image to preprocess.`,name:"images"},{anchor:"transformers.BridgeTowerImageProcessor.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.BridgeTowerImageProcessor.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.BridgeTowerImageProcessor.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.BridgeTowerImageProcessor.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.BridgeTowerImageProcessor.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.BridgeTowerImageProcessor.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.BridgeTowerImageProcessor.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.BridgeTowerImageProcessor.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.BridgeTowerImageProcessor.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.BridgeTowerImageProcessor.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.BridgeTowerImageProcessor.preprocess.do_center_crop",description:`<strong>do_center_crop</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_center_crop</code>) &#x2014;
Whether to center crop the image. If the input size is smaller than <code>crop_size</code> along any edge, the
image is padded with 0&#x2019;s and then center cropped.`,name:"do_center_crop"},{anchor:"transformers.BridgeTowerImageProcessor.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.BridgeTowerImageProcessor.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/bridgetower/image_processing_bridgetower.py#L391"}}),Go=new U({}),Ho=new z({props:{name:"class transformers.BridgeTowerProcessor",anchor:"transformers.BridgeTowerProcessor",parameters:[{name:"image_processor",val:""},{name:"tokenizer",val:""}],parametersDescription:[{anchor:"transformers.BridgeTowerProcessor.image_processor",description:`<strong>image_processor</strong> (<code>BridgeTowerImageProcessor</code>) &#x2014;
An instance of <a href="/docs/transformers/v4.29.0/en/model_doc/bridgetower#transformers.BridgeTowerImageProcessor">BridgeTowerImageProcessor</a>. The image processor is a required input.`,name:"image_processor"},{anchor:"transformers.BridgeTowerProcessor.tokenizer",description:"<strong>tokenizer</strong> (<code>RobertaTokenizerFast</code>) &#x2014;\nAn instance of [&#x2018;RobertaTokenizerFast`]. The tokenizer is a required input.",name:"tokenizer"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/bridgetower/processing_bridgetower.py#L26"}}),Jo=new z({props:{name:"__call__",anchor:"transformers.BridgeTowerProcessor.__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[str, transformers.utils.generic.TensorType, NoneType] = None"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/bridgetower/processing_bridgetower.py#L48"}}),Qo=new U({}),Yo=new z({props:{name:"class transformers.BridgeTowerModel",anchor:"transformers.BridgeTowerModel",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.BridgeTowerModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.29.0/en/model_doc/bridgetower#transformers.BridgeTowerConfig">BridgeTowerConfig</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/bridgetower/modeling_bridgetower.py#L1210"}}),Zo=new z({props:{name:"forward",anchor:"transformers.BridgeTowerModel.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"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"}],parametersDescription:[{anchor:"transformers.BridgeTowerModel.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.BridgeTowerModel.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.BridgeTowerModel.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.BridgeTowerModel.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/bridgetower#transformers.BridgeTowerImageProcessor">BridgeTowerImageProcessor</a>. See
<a href="/docs/transformers/v4.29.0/en/model_doc/dpt#transformers.DPTFeatureExtractor.__call__">BridgeTowerImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.BridgeTowerModel.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.BridgeTowerModel.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.BridgeTowerModel.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.BridgeTowerModel.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.BridgeTowerModel.forward.image_token_type_idx",description:`<strong>image_token_type_idx</strong> (<code>int</code>, <em>optional</em>) &#x2014;</p>
<ul>
<li>The token type ids for images.</li>
</ul>`,name:"image_token_type_idx"},{anchor:"transformers.BridgeTowerModel.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.BridgeTowerModel.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.BridgeTowerModel.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.BridgeTowerModel.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, hidden states are returned as a list containing the hidden states of text, image, and
cross-modal components respectively. i.e. <code>(hidden_states_text, hidden_states_image, hidden_states_cross_modal)</code> where each element is a list of the hidden states of the corresponding
modality. <code>hidden_states_txt/img</code> are a list of tensors corresponding to unimodal hidden states and
<code>hidden_states_cross_modal</code> is a list of tuples containing <code>cross_modal_text_hidden_states</code> and
<code>cross_modal_image_hidden_states</code> of each brdige layer.`,name:"output_hidden_states"},{anchor:"transformers.BridgeTowerModel.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/bridgetower/modeling_bridgetower.py#L1267",returnDescription:`
<p>A <code>transformers.models.bridgetower.modeling_bridgetower.BridgeTowerModelOutput</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/bridgetower#transformers.BridgeTowerConfig"
>BridgeTowerConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>text_features</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, text_sequence_length, hidden_size)</code>) \u2014 Sequence of hidden-states at the text output of the last layer of the model.</p>
</li>
<li>
<p><strong>image_features</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, image_sequence_length, hidden_size)</code>) \u2014 Sequence of hidden-states at the image 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 x 2)</code>) \u2014 Concatenation of last layer hidden-state of the first token of the text and image sequence (classification
token), respectively, after further processing through layers used for auxiliary pretraining tasks.</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>. 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><code>transformers.models.bridgetower.modeling_bridgetower.BridgeTowerModelOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ve=new vn({props:{$$slots:{default:[jm]},$$scope:{ctx:$}}}),Ue=new ur({props:{anchor:"transformers.BridgeTowerModel.forward.example",$$slots:{default:[Pm]},$$scope:{ctx:$}}}),er=new U({}),or=new z({props:{name:"class transformers.BridgeTowerForContrastiveLearning",anchor:"transformers.BridgeTowerForContrastiveLearning",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.BridgeTowerForContrastiveLearning.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.29.0/en/model_doc/bridgetower#transformers.BridgeTowerConfig">BridgeTowerConfig</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/bridgetower/modeling_bridgetower.py#L1767"}}),tr=new z({props:{name:"forward",anchor:"transformers.BridgeTowerForContrastiveLearning.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:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = True"},{name:"return_dict",val:": typing.Optional[bool] = None"},{name:"return_loss",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.BridgeTowerForContrastiveLearning.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.BridgeTowerForContrastiveLearning.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.BridgeTowerForContrastiveLearning.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.BridgeTowerForContrastiveLearning.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/bridgetower#transformers.BridgeTowerImageProcessor">BridgeTowerImageProcessor</a>. See
<a href="/docs/transformers/v4.29.0/en/model_doc/dpt#transformers.DPTFeatureExtractor.__call__">BridgeTowerImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.BridgeTowerForContrastiveLearning.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.BridgeTowerForContrastiveLearning.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.BridgeTowerForContrastiveLearning.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.BridgeTowerForContrastiveLearning.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.BridgeTowerForContrastiveLearning.forward.image_token_type_idx",description:`<strong>image_token_type_idx</strong> (<code>int</code>, <em>optional</em>) &#x2014;</p>
<ul>
<li>The token type ids for images.</li>
</ul>`,name:"image_token_type_idx"},{anchor:"transformers.BridgeTowerForContrastiveLearning.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.BridgeTowerForContrastiveLearning.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.BridgeTowerForContrastiveLearning.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.BridgeTowerForContrastiveLearning.forward.return_loss",description:`<strong>return_loss</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the contrastive loss.`,name:"return_loss"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/bridgetower/modeling_bridgetower.py#L1781",returnDescription:`
<p>A <code>transformers.models.bridgetower.modeling_bridgetower.BridgeTowerContrastiveOutput</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/bridgetower#transformers.BridgeTowerConfig"
>BridgeTowerConfig</a>) and inputs.</p>
<ul>
<li><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>return_loss</code> is <code>True</code> \u2014 Image-text contrastive loss.</li>
<li><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).</li>
<li><strong>text_embeds</strong> (<code>torch.FloatTensor)</code>, <em>optional</em>, returned when model is initialized with <code>with_projection=True</code>) \u2014 The text embeddings obtained by applying the projection layer to the pooler_output.</li>
<li><strong>image_embeds</strong> (<code>torch.FloatTensor)</code>, <em>optional</em>, returned when model is initialized with <code>with_projection=True</code>) \u2014 The image embeddings obtained by applying the projection layer to the pooler_output.</li>
<li><strong>cross_embeds</strong>  (<code>torch.FloatTensor)</code>, <em>optional</em>, returned when model is initialized with <code>with_projection=True</code>) \u2014 The text-image cross-modal embeddings obtained by applying the projection layer to the pooler_output.</li>
<li><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
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 optional initial embedding outputs.</li>
<li><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</li>
</ul>
`,returnType:`
<p><code>transformers.models.bridgetower.modeling_bridgetower.BridgeTowerContrastiveOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),He=new vn({props:{$$slots:{default:[zm]},$$scope:{ctx:$}}}),Xe=new ur({props:{anchor:"transformers.BridgeTowerForContrastiveLearning.forward.example",$$slots:{default:[Im]},$$scope:{ctx:$}}}),sr=new U({}),nr=new z({props:{name:"class transformers.BridgeTowerForMaskedLM",anchor:"transformers.BridgeTowerForMaskedLM",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.BridgeTowerForMaskedLM.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.29.0/en/model_doc/bridgetower#transformers.BridgeTowerConfig">BridgeTowerConfig</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/bridgetower/modeling_bridgetower.py#L1549"}}),ir=new z({props:{name:"forward",anchor:"transformers.BridgeTowerForMaskedLM.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:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"}],parametersDescription:[{anchor:"transformers.BridgeTowerForMaskedLM.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.BridgeTowerForMaskedLM.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.BridgeTowerForMaskedLM.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.BridgeTowerForMaskedLM.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/bridgetower#transformers.BridgeTowerImageProcessor">BridgeTowerImageProcessor</a>. See
<a href="/docs/transformers/v4.29.0/en/model_doc/dpt#transformers.DPTFeatureExtractor.__call__">BridgeTowerImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.BridgeTowerForMaskedLM.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.BridgeTowerForMaskedLM.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.BridgeTowerForMaskedLM.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.BridgeTowerForMaskedLM.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.BridgeTowerForMaskedLM.forward.image_token_type_idx",description:`<strong>image_token_type_idx</strong> (<code>int</code>, <em>optional</em>) &#x2014;</p>
<ul>
<li>The token type ids for images.</li>
</ul>`,name:"image_token_type_idx"},{anchor:"transformers.BridgeTowerForMaskedLM.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.BridgeTowerForMaskedLM.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.BridgeTowerForMaskedLM.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.BridgeTowerForMaskedLM.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Labels for computing the masked language modeling loss. Indices should be in <code>[-100, 0, ..., config.vocab_size]</code> (see <code>input_ids</code> docstring) Tokens with indices set to <code>-100</code> are ignored (masked), the
loss is only computed for the tokens with labels in <code>[0, ..., config.vocab_size]</code>`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/bridgetower/modeling_bridgetower.py#L1565",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/bridgetower#transformers.BridgeTowerConfig"
>BridgeTowerConfig</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>
`}}),Qe=new vn({props:{$$slots:{default:[Cm]},$$scope:{ctx:$}}}),Ye=new ur({props:{anchor:"transformers.BridgeTowerForMaskedLM.forward.example",$$slots:{default:[Em]},$$scope:{ctx:$}}}),dr=new U({}),lr=new z({props:{name:"class transformers.BridgeTowerForImageAndTextRetrieval",anchor:"transformers.BridgeTowerForImageAndTextRetrieval",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.BridgeTowerForImageAndTextRetrieval.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.29.0/en/model_doc/bridgetower#transformers.BridgeTowerConfig">BridgeTowerConfig</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/bridgetower/modeling_bridgetower.py#L1656"}}),mr=new z({props:{name:"forward",anchor:"transformers.BridgeTowerForImageAndTextRetrieval.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:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"}],parametersDescription:[{anchor:"transformers.BridgeTowerForImageAndTextRetrieval.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.BridgeTowerForImageAndTextRetrieval.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.BridgeTowerForImageAndTextRetrieval.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.BridgeTowerForImageAndTextRetrieval.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/bridgetower#transformers.BridgeTowerImageProcessor">BridgeTowerImageProcessor</a>. See
<a href="/docs/transformers/v4.29.0/en/model_doc/dpt#transformers.DPTFeatureExtractor.__call__">BridgeTowerImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.BridgeTowerForImageAndTextRetrieval.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.BridgeTowerForImageAndTextRetrieval.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.BridgeTowerForImageAndTextRetrieval.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.BridgeTowerForImageAndTextRetrieval.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.BridgeTowerForImageAndTextRetrieval.forward.image_token_type_idx",description:`<strong>image_token_type_idx</strong> (<code>int</code>, <em>optional</em>) &#x2014;</p>
<ul>
<li>The token type ids for images.</li>
</ul>`,name:"image_token_type_idx"},{anchor:"transformers.BridgeTowerForImageAndTextRetrieval.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.BridgeTowerForImageAndTextRetrieval.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.BridgeTowerForImageAndTextRetrieval.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.BridgeTowerForImageAndTextRetrieval.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, 1)</code>, <em>optional</em>) &#x2014;
Labels for computing the image-text matching loss. 0 means the pairs don&#x2019;t match and 1 means they match.
The pairs with 0 will be skipped for calculation.`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/bridgetower/modeling_bridgetower.py#L1667",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/bridgetower#transformers.BridgeTowerConfig"
>BridgeTowerConfig</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>
`}}),Ze=new vn({props:{$$slots:{default:[Fm]},$$scope:{ctx:$}}}),eo=new ur({props:{anchor:"transformers.BridgeTowerForImageAndTextRetrieval.forward.example",$$slots:{default:[Mm]},$$scope:{ctx:$}}}),{c(){p=n("meta"),k=c(),_=n("h1"),f=n("a"),w=n("span"),T(d.$$.fragment),u=c(),j=n("span"),bn=t("BridgeTower"),ps=c(),oe=n("h2"),ke=n("a"),_t=n("span"),T(ho.$$.fragment),yn=c(),wt=n("span"),Bn=t("Overview"),hs=c(),$e=n("p"),xn=t("The BridgeTower model was proposed in "),fo=n("a"),kn=t("BridgeTower: Building Bridges Between Encoders in Vision-Language Representative Learning"),$n=t(` by Xiao Xu, Chenfei Wu, Shachar Rosenman, Vasudev Lal, Wanxiang Che, Nan Duan. The goal of this model is to build a
bridge between each uni-modal encoder and the cross-modal encoder to enable comprehensive and detailed interaction at each layer of the cross-modal encoder thus achieving remarkable performance on various downstream tasks with almost negligible additional performance and computational costs.`),fs=c(),je=n("p"),jn=t("This paper has been accepted to the "),uo=n("a"),Pn=t("AAAI\u201923"),zn=t(" conference."),us=c(),wr=n("p"),In=t("The abstract from the paper is the following:"),_s=c(),Tr=n("p"),Tt=n("em"),Cn=t(`Vision-Language (VL) models with the TWO-TOWER architecture have dominated visual-language representation learning in recent years.
Current VL models either use lightweight uni-modal encoders and learn to extract, align and fuse both modalities simultaneously in a deep cross-modal encoder, or feed the last-layer uni-modal representations from the deep pre-trained uni-modal encoders into the top cross-modal encoder.
Both approaches potentially restrict vision-language representation learning and limit model performance. In this paper, we propose BRIDGETOWER, which introduces multiple bridge layers that build a connection between the top layers of uni-modal encoders and each layer of the crossmodal encoder.
This enables effective bottom-up cross-modal alignment and fusion between visual and textual representations of different semantic levels of pre-trained uni-modal encoders in the cross-modal encoder. Pre-trained with only 4M images, BRIDGETOWER achieves state-of-the-art performance on various downstream vision-language tasks.
In particular, on the VQAv2 test-std set, BRIDGETOWER achieves an accuracy of 78.73%, outperforming the previous state-of-the-art model METER by 1.09% with the same pre-training data and almost negligible additional parameters and computational costs.
Notably, when further scaling the model, BRIDGETOWER achieves an accuracy of 81.15%, surpassing models that are pre-trained on orders-of-magnitude larger datasets.`),ws=c(),Pe=n("img"),Ts=c(),_o=n("small"),En=t("BridgeTower architecture. Taken from the "),vr=n("a"),Fn=t("original paper."),vs=c(),re=n("h2"),ze=n("a"),vt=n("span"),T(wo.$$.fragment),Mn=c(),bt=n("span"),qn=t("Usage"),bs=c(),br=n("p"),Ln=t(`BridgeTower consists of a visual encoder, a textual encoder and cross-modal encoder with multiple lightweight bridge layers.
The goal of this approach was to build a bridge between each uni-modal encoder and the cross-modal encoder to enable comprehensive and detailed interaction at each layer of the cross-modal encoder.
In principle, one can apply any visual, textual or cross-modal encoder in the proposed architecture.`),ys=c(),O=n("p"),An=t("The "),yr=n("a"),On=t("BridgeTowerProcessor"),Rn=t(" wraps "),Br=n("a"),Nn=t("RobertaTokenizer"),Dn=t(" and "),xr=n("a"),Sn=t("BridgeTowerImageProcessor"),Wn=t(` into a single instance to both
encode the text and prepare the images respectively.`),Bs=c(),J=n("p"),Vn=t("The following example shows how to run contrastive learning using "),kr=n("a"),Un=t("BridgeTowerProcessor"),Gn=t(" and "),$r=n("a"),Hn=t("BridgeTowerForContrastiveLearning"),Xn=t("."),xs=c(),T(To.$$.fragment),ks=c(),Q=n("p"),Jn=t("The following example shows how to run image-text retrieval using "),jr=n("a"),Qn=t("BridgeTowerProcessor"),Yn=t(" and "),Pr=n("a"),Kn=t("BridgeTowerForImageAndTextRetrieval"),Zn=t("."),$s=c(),T(vo.$$.fragment),js=c(),Y=n("p"),ea=t("The following example shows how to run masked language modeling using "),zr=n("a"),oa=t("BridgeTowerProcessor"),ra=t(" and "),Ir=n("a"),ta=t("BridgeTowerForMaskedLM"),sa=t("."),Ps=c(),T(bo.$$.fragment),zs=c(),I=n("p"),na=t("This model was contributed by "),yo=n("a"),aa=t("Anahita Bhiwandiwalla"),ia=t(", "),Bo=n("a"),da=t("Tiep Le"),la=t(" and "),xo=n("a"),ca=t("Shaoyen Tseng"),ma=t(". The original code can be found "),ko=n("a"),ga=t("here"),pa=t("."),Is=c(),Cr=n("p"),ha=t("Tips:"),Cs=c(),R=n("ul"),$o=n("li"),fa=t("This implementation of BridgeTower uses "),Er=n("a"),ua=t("RobertaTokenizer"),_a=t(" to generate text embeddings and OpenAI\u2019s CLIP/ViT model to compute visual embeddings."),wa=c(),te=n("li"),Ta=t("Checkpoints for pre-trained "),jo=n("a"),va=t("bridgeTower-base"),ba=t(" and "),Po=n("a"),ya=t("bridgetower masked language modeling and image text matching"),Ba=t(" are released."),xa=c(),zo=n("li"),ka=t("Please refer to "),Io=n("a"),$a=t("Table 5"),ja=t(" for BridgeTower\u2019s performance on Image Retrieval and other down stream tasks."),Pa=c(),yt=n("li"),za=t("The PyTorch version of this model is only available in torch 1.10 and higher."),Es=c(),se=n("h2"),Ie=n("a"),Bt=n("span"),T(Co.$$.fragment),Ia=c(),xt=n("span"),Ca=t("BridgeTowerConfig"),Fs=c(),P=n("div"),T(Eo.$$.fragment),Ea=c(),ne=n("p"),Fa=t("This is the configuration class to store the configuration of a "),Fr=n("a"),Ma=t("BridgeTowerModel"),qa=t(`. It is used to instantiate a
BridgeTower 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 bridgetower-base
`),Fo=n("a"),La=t("BridgeTower/bridgetower-base"),Aa=t(" architecture."),Oa=c(),ae=n("p"),Ra=t("Configuration objects inherit from "),Mr=n("a"),Na=t("PretrainedConfig"),Da=t(` and can be used to control the model outputs. Read the
documentation from `),qr=n("a"),Sa=t("PretrainedConfig"),Wa=t(" for more information."),Va=c(),T(Ce.$$.fragment),Ua=c(),Ee=n("div"),T(Mo.$$.fragment),Ga=c(),ie=n("p"),Ha=t("Instantiate a "),Lr=n("a"),Xa=t("BridgeTowerConfig"),Ja=t(` (or a derived class) from BridgeTower text model configuration. Returns:
`),Ar=n("a"),Qa=t("BridgeTowerConfig"),Ya=t(": An instance of a configuration object"),Ka=c(),Fe=n("div"),T(qo.$$.fragment),Za=c(),Lo=n("p"),ei=t("Serializes this instance to a Python dictionary. Override the default "),Or=n("a"),oi=t("to_dict()"),ri=t("."),Ms=c(),de=n("h2"),Me=n("a"),kt=n("span"),T(Ao.$$.fragment),ti=c(),$t=n("span"),si=t("BridgeTowerTextConfig"),qs=c(),E=n("div"),T(Oo.$$.fragment),ni=c(),le=n("p"),ai=t("This is the configuration class to store the text configuration of a "),Rr=n("a"),ii=t("BridgeTowerModel"),di=t(`. The default values here
are copied from RoBERTa. Instantiating a configuration with the defaults will yield a similar configuration to that
of the bridgetower-base `),Ro=n("a"),li=t("BridegTower/bridgetower-base"),ci=t(`
architecture.`),mi=c(),ce=n("p"),gi=t("Configuration objects inherit from "),Nr=n("a"),pi=t("PretrainedConfig"),hi=t(` and can be used to control the model outputs. Read the
documentation from `),Dr=n("a"),fi=t("PretrainedConfig"),ui=t(" for more information."),_i=c(),T(qe.$$.fragment),Ls=c(),me=n("h2"),Le=n("a"),jt=n("span"),T(No.$$.fragment),wi=c(),Pt=n("span"),Ti=t("BridgeTowerVisionConfig"),As=c(),F=n("div"),T(Do.$$.fragment),vi=c(),ge=n("p"),bi=t("This is the configuration class to store the vision configuration of a "),Sr=n("a"),yi=t("BridgeTowerModel"),Bi=t(`. Instantiating a
configuration with the defaults will yield a similar configuration to that of the bridgetower-base
`),So=n("a"),xi=t("BridgeTower/bridgetower-base"),ki=t(" architecture."),$i=c(),pe=n("p"),ji=t("Configuration objects inherit from "),Wr=n("a"),Pi=t("PretrainedConfig"),zi=t(` and can be used to control the model outputs. Read the
documentation from `),Vr=n("a"),Ii=t("PretrainedConfig"),Ci=t(" for more information."),Ei=c(),T(Ae.$$.fragment),Os=c(),he=n("h2"),Oe=n("a"),zt=n("span"),T(Wo.$$.fragment),Fi=c(),It=n("span"),Mi=t("BridgeTowerImageProcessor"),Rs=c(),G=n("div"),T(Vo.$$.fragment),qi=c(),Ct=n("p"),Li=t("Constructs a BridgeTower image processor."),Ai=c(),Re=n("div"),T(Uo.$$.fragment),Oi=c(),Et=n("p"),Ri=t("Preprocess an image or batch of images."),Ns=c(),fe=n("h2"),Ne=n("a"),Ft=n("span"),T(Go.$$.fragment),Ni=c(),Mt=n("span"),Di=t("BridgeTowerProcessor"),Ds=c(),M=n("div"),T(Ho.$$.fragment),Si=c(),qt=n("p"),Wi=t(`Constructs a BridgeTower processor which wraps a Roberta tokenizer and BridgeTower image processor into a single
processor.`),Vi=c(),C=n("p"),Ur=n("a"),Ui=t("BridgeTowerProcessor"),Gi=t(" offers all the functionalities of "),Gr=n("a"),Hi=t("BridgeTowerImageProcessor"),Xi=t(` and
`),Hr=n("a"),Ji=t("RobertaTokenizerFast"),Qi=t(". See the docstring of "),Xo=n("a"),Lt=n("strong"),Yi=t("call"),Ki=t("()"),Zi=t(` and
`),At=n("code"),ed=t("decode()"),od=t(" for more information."),rd=c(),K=n("div"),T(Jo.$$.fragment),td=c(),ue=n("p"),sd=t("This method uses "),De=n("a"),nd=t("BridgeTowerImageProcessor."),Ot=n("strong"),ad=t("call"),id=t("()"),dd=t(` method to prepare image(s) for the model, and
`),Se=n("a"),ld=t("RobertaTokenizerFast."),Rt=n("strong"),cd=t("call"),md=t("()"),gd=t(" to prepare text for the model."),pd=c(),Nt=n("p"),hd=t("Please refer to the docstring of the above two methods for more information."),Ss=c(),_e=n("h2"),We=n("a"),Dt=n("span"),T(Qo.$$.fragment),fd=c(),St=n("span"),ud=t("BridgeTowerModel"),Ws=c(),H=n("div"),T(Yo.$$.fragment),_d=c(),Ko=n("p"),wd=t(`The bare BridgeTower Model transformer outputting BridgeTowerModelOutput object without any specific head on top.
This model is a PyTorch `),Wt=n("code"),Td=t("torch.nn.Module <https://pytorch.org/docs/stable/nn.html#torch.nn.Module>"),vd=t(`_ subclass. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),bd=c(),N=n("div"),T(Zo.$$.fragment),yd=c(),we=n("p"),Bd=t("The "),Xr=n("a"),xd=t("BridgeTowerModel"),kd=t(" forward method, overrides the "),Vt=n("code"),$d=t("__call__"),jd=t(" special method."),Pd=c(),T(Ve.$$.fragment),zd=c(),T(Ue.$$.fragment),Vs=c(),Te=n("h2"),Ge=n("a"),Ut=n("span"),T(er.$$.fragment),Id=c(),Gt=n("span"),Cd=t("BridgeTowerForContrastiveLearning"),Us=c(),q=n("div"),T(or.$$.fragment),Ed=c(),Ht=n("p"),Fd=t("BridgeTower Model with a image-text contrastive head on top computing image-text contrastive loss."),Md=c(),rr=n("p"),qd=t("This model is a PyTorch "),Xt=n("code"),Ld=t("torch.nn.Module <https://pytorch.org/docs/stable/nn.html#torch.nn.Module>"),Ad=t(`_ subclass. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Od=c(),D=n("div"),T(tr.$$.fragment),Rd=c(),ve=n("p"),Nd=t("The "),Jr=n("a"),Dd=t("BridgeTowerForContrastiveLearning"),Sd=t(" forward method, overrides the "),Jt=n("code"),Wd=t("__call__"),Vd=t(" special method."),Ud=c(),T(He.$$.fragment),Gd=c(),T(Xe.$$.fragment),Gs=c(),be=n("h2"),Je=n("a"),Qt=n("span"),T(sr.$$.fragment),Hd=c(),Yt=n("span"),Xd=t("BridgeTowerForMaskedLM"),Hs=c(),L=n("div"),T(nr.$$.fragment),Jd=c(),Kt=n("p"),Qd=t("BridgeTower Model with a language modeling head on top as done during pretraining."),Yd=c(),ar=n("p"),Kd=t("This model is a PyTorch "),Zt=n("code"),Zd=t("torch.nn.Module <https://pytorch.org/docs/stable/nn.html#torch.nn.Module>"),el=t(`_ subclass. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),ol=c(),S=n("div"),T(ir.$$.fragment),rl=c(),ye=n("p"),tl=t("The "),Qr=n("a"),sl=t("BridgeTowerForMaskedLM"),nl=t(" forward method, overrides the "),es=n("code"),al=t("__call__"),il=t(" special method."),dl=c(),T(Qe.$$.fragment),ll=c(),T(Ye.$$.fragment),Xs=c(),Be=n("h2"),Ke=n("a"),os=n("span"),T(dr.$$.fragment),cl=c(),rs=n("span"),ml=t("BridgeTowerForImageAndTextRetrieval"),Js=c(),A=n("div"),T(lr.$$.fragment),gl=c(),ts=n("p"),pl=t(`BridgeTower 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 matching.`),hl=c(),cr=n("p"),fl=t("This model is a PyTorch "),ss=n("code"),ul=t("torch.nn.Module <https://pytorch.org/docs/stable/nn.html#torch.nn.Module>"),_l=t(`_ subclass. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),wl=c(),W=n("div"),T(mr.$$.fragment),Tl=c(),xe=n("p"),vl=t("The "),Yr=n("a"),bl=t("BridgeTowerForImageAndTextRetrieval"),yl=t(" forward method, overrides the "),ns=n("code"),Bl=t("__call__"),xl=t(" special method."),kl=c(),T(Ze.$$.fragment),$l=c(),T(eo.$$.fragment),this.h()},l(o){const g=bm('[data-svelte="svelte-1phssyn"]',document.head);p=a(g,"META",{name:!0,content:!0}),g.forEach(r),k=m(o),_=a(o,"H1",{class:!0});var gr=i(_);f=a(gr,"A",{id:!0,class:!0,href:!0});var as=i(f);w=a(as,"SPAN",{});var is=i(w);v(d.$$.fragment,is),is.forEach(r),as.forEach(r),u=m(gr),j=a(gr,"SPAN",{});var ds=i(j);bn=s(ds,"BridgeTower"),ds.forEach(r),gr.forEach(r),ps=m(o),oe=a(o,"H2",{class:!0});var pr=i(oe);ke=a(pr,"A",{id:!0,class:!0,href:!0});var ls=i(ke);_t=a(ls,"SPAN",{});var cs=i(_t);v(ho.$$.fragment,cs),cs.forEach(r),ls.forEach(r),yn=m(pr),wt=a(pr,"SPAN",{});var ms=i(wt);Bn=s(ms,"Overview"),ms.forEach(r),pr.forEach(r),hs=m(o),$e=a(o,"P",{});var hr=i($e);xn=s(hr,"The BridgeTower model was proposed in "),fo=a(hr,"A",{href:!0,rel:!0});var gs=i(fo);kn=s(gs,"BridgeTower: Building Bridges Between Encoders in Vision-Language Representative Learning"),gs.forEach(r),$n=s(hr,` by Xiao Xu, Chenfei Wu, Shachar Rosenman, Vasudev Lal, Wanxiang Che, Nan Duan. The goal of this model is to build a
bridge between each uni-modal encoder and the cross-modal encoder to enable comprehensive and detailed interaction at each layer of the cross-modal encoder thus achieving remarkable performance on various downstream tasks with almost negligible additional performance and computational costs.`),hr.forEach(r),fs=m(o),je=a(o,"P",{});var fr=i(je);jn=s(fr,"This paper has been accepted to the "),uo=a(fr,"A",{href:!0,rel:!0});var Il=i(uo);Pn=s(Il,"AAAI\u201923"),Il.forEach(r),zn=s(fr," conference."),fr.forEach(r),us=m(o),wr=a(o,"P",{});var Cl=i(wr);In=s(Cl,"The abstract from the paper is the following:"),Cl.forEach(r),_s=m(o),Tr=a(o,"P",{});var El=i(Tr);Tt=a(El,"EM",{});var Fl=i(Tt);Cn=s(Fl,`Vision-Language (VL) models with the TWO-TOWER architecture have dominated visual-language representation learning in recent years.
Current VL models either use lightweight uni-modal encoders and learn to extract, align and fuse both modalities simultaneously in a deep cross-modal encoder, or feed the last-layer uni-modal representations from the deep pre-trained uni-modal encoders into the top cross-modal encoder.
Both approaches potentially restrict vision-language representation learning and limit model performance. In this paper, we propose BRIDGETOWER, which introduces multiple bridge layers that build a connection between the top layers of uni-modal encoders and each layer of the crossmodal encoder.
This enables effective bottom-up cross-modal alignment and fusion between visual and textual representations of different semantic levels of pre-trained uni-modal encoders in the cross-modal encoder. Pre-trained with only 4M images, BRIDGETOWER achieves state-of-the-art performance on various downstream vision-language tasks.
In particular, on the VQAv2 test-std set, BRIDGETOWER achieves an accuracy of 78.73%, outperforming the previous state-of-the-art model METER by 1.09% with the same pre-training data and almost negligible additional parameters and computational costs.
Notably, when further scaling the model, BRIDGETOWER achieves an accuracy of 81.15%, surpassing models that are pre-trained on orders-of-magnitude larger datasets.`),Fl.forEach(r),El.forEach(r),ws=m(o),Pe=a(o,"IMG",{src:!0,alt:!0,width:!0}),Ts=m(o),_o=a(o,"SMALL",{});var jl=i(_o);En=s(jl,"BridgeTower architecture. Taken from the "),vr=a(jl,"A",{href:!0});var Ml=i(vr);Fn=s(Ml,"original paper."),Ml.forEach(r),jl.forEach(r),vs=m(o),re=a(o,"H2",{class:!0});var Ys=i(re);ze=a(Ys,"A",{id:!0,class:!0,href:!0});var ql=i(ze);vt=a(ql,"SPAN",{});var Ll=i(vt);v(wo.$$.fragment,Ll),Ll.forEach(r),ql.forEach(r),Mn=m(Ys),bt=a(Ys,"SPAN",{});var Al=i(bt);qn=s(Al,"Usage"),Al.forEach(r),Ys.forEach(r),bs=m(o),br=a(o,"P",{});var Ol=i(br);Ln=s(Ol,`BridgeTower consists of a visual encoder, a textual encoder and cross-modal encoder with multiple lightweight bridge layers.
The goal of this approach was to build a bridge between each uni-modal encoder and the cross-modal encoder to enable comprehensive and detailed interaction at each layer of the cross-modal encoder.
In principle, one can apply any visual, textual or cross-modal encoder in the proposed architecture.`),Ol.forEach(r),ys=m(o),O=a(o,"P",{});var oo=i(O);An=s(oo,"The "),yr=a(oo,"A",{href:!0});var Rl=i(yr);On=s(Rl,"BridgeTowerProcessor"),Rl.forEach(r),Rn=s(oo," wraps "),Br=a(oo,"A",{href:!0});var Nl=i(Br);Nn=s(Nl,"RobertaTokenizer"),Nl.forEach(r),Dn=s(oo," and "),xr=a(oo,"A",{href:!0});var Dl=i(xr);Sn=s(Dl,"BridgeTowerImageProcessor"),Dl.forEach(r),Wn=s(oo,` into a single instance to both
encode the text and prepare the images respectively.`),oo.forEach(r),Bs=m(o),J=a(o,"P",{});var Kr=i(J);Vn=s(Kr,"The following example shows how to run contrastive learning using "),kr=a(Kr,"A",{href:!0});var Sl=i(kr);Un=s(Sl,"BridgeTowerProcessor"),Sl.forEach(r),Gn=s(Kr," and "),$r=a(Kr,"A",{href:!0});var Wl=i($r);Hn=s(Wl,"BridgeTowerForContrastiveLearning"),Wl.forEach(r),Xn=s(Kr,"."),Kr.forEach(r),xs=m(o),v(To.$$.fragment,o),ks=m(o),Q=a(o,"P",{});var Zr=i(Q);Jn=s(Zr,"The following example shows how to run image-text retrieval using "),jr=a(Zr,"A",{href:!0});var Vl=i(jr);Qn=s(Vl,"BridgeTowerProcessor"),Vl.forEach(r),Yn=s(Zr," and "),Pr=a(Zr,"A",{href:!0});var Ul=i(Pr);Kn=s(Ul,"BridgeTowerForImageAndTextRetrieval"),Ul.forEach(r),Zn=s(Zr,"."),Zr.forEach(r),$s=m(o),v(vo.$$.fragment,o),js=m(o),Y=a(o,"P",{});var et=i(Y);ea=s(et,"The following example shows how to run masked language modeling using "),zr=a(et,"A",{href:!0});var Gl=i(zr);oa=s(Gl,"BridgeTowerProcessor"),Gl.forEach(r),ra=s(et," and "),Ir=a(et,"A",{href:!0});var Hl=i(Ir);ta=s(Hl,"BridgeTowerForMaskedLM"),Hl.forEach(r),sa=s(et,"."),et.forEach(r),Ps=m(o),v(bo.$$.fragment,o),zs=m(o),I=a(o,"P",{});var Z=i(I);na=s(Z,"This model was contributed by "),yo=a(Z,"A",{href:!0,rel:!0});var Xl=i(yo);aa=s(Xl,"Anahita Bhiwandiwalla"),Xl.forEach(r),ia=s(Z,", "),Bo=a(Z,"A",{href:!0,rel:!0});var Jl=i(Bo);da=s(Jl,"Tiep Le"),Jl.forEach(r),la=s(Z," and "),xo=a(Z,"A",{href:!0,rel:!0});var Ql=i(xo);ca=s(Ql,"Shaoyen Tseng"),Ql.forEach(r),ma=s(Z,". The original code can be found "),ko=a(Z,"A",{href:!0,rel:!0});var Yl=i(ko);ga=s(Yl,"here"),Yl.forEach(r),pa=s(Z,"."),Z.forEach(r),Is=m(o),Cr=a(o,"P",{});var Kl=i(Cr);ha=s(Kl,"Tips:"),Kl.forEach(r),Cs=m(o),R=a(o,"UL",{});var ro=i(R);$o=a(ro,"LI",{});var Ks=i($o);fa=s(Ks,"This implementation of BridgeTower uses "),Er=a(Ks,"A",{href:!0});var Zl=i(Er);ua=s(Zl,"RobertaTokenizer"),Zl.forEach(r),_a=s(Ks," to generate text embeddings and OpenAI\u2019s CLIP/ViT model to compute visual embeddings."),Ks.forEach(r),wa=m(ro),te=a(ro,"LI",{});var ot=i(te);Ta=s(ot,"Checkpoints for pre-trained "),jo=a(ot,"A",{href:!0,rel:!0});var ec=i(jo);va=s(ec,"bridgeTower-base"),ec.forEach(r),ba=s(ot," and "),Po=a(ot,"A",{href:!0,rel:!0});var oc=i(Po);ya=s(oc,"bridgetower masked language modeling and image text matching"),oc.forEach(r),Ba=s(ot," are released."),ot.forEach(r),xa=m(ro),zo=a(ro,"LI",{});var Zs=i(zo);ka=s(Zs,"Please refer to "),Io=a(Zs,"A",{href:!0,rel:!0});var rc=i(Io);$a=s(rc,"Table 5"),rc.forEach(r),ja=s(Zs," for BridgeTower\u2019s performance on Image Retrieval and other down stream tasks."),Zs.forEach(r),Pa=m(ro),yt=a(ro,"LI",{});var tc=i(yt);za=s(tc,"The PyTorch version of this model is only available in torch 1.10 and higher."),tc.forEach(r),ro.forEach(r),Es=m(o),se=a(o,"H2",{class:!0});var en=i(se);Ie=a(en,"A",{id:!0,class:!0,href:!0});var sc=i(Ie);Bt=a(sc,"SPAN",{});var nc=i(Bt);v(Co.$$.fragment,nc),nc.forEach(r),sc.forEach(r),Ia=m(en),xt=a(en,"SPAN",{});var ac=i(xt);Ca=s(ac,"BridgeTowerConfig"),ac.forEach(r),en.forEach(r),Fs=m(o),P=a(o,"DIV",{class:!0});var V=i(P);v(Eo.$$.fragment,V),Ea=m(V),ne=a(V,"P",{});var rt=i(ne);Fa=s(rt,"This is the configuration class to store the configuration of a "),Fr=a(rt,"A",{href:!0});var ic=i(Fr);Ma=s(ic,"BridgeTowerModel"),ic.forEach(r),qa=s(rt,`. It is used to instantiate a
BridgeTower 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 bridgetower-base
`),Fo=a(rt,"A",{href:!0,rel:!0});var dc=i(Fo);La=s(dc,"BridgeTower/bridgetower-base"),dc.forEach(r),Aa=s(rt," architecture."),rt.forEach(r),Oa=m(V),ae=a(V,"P",{});var tt=i(ae);Ra=s(tt,"Configuration objects inherit from "),Mr=a(tt,"A",{href:!0});var lc=i(Mr);Na=s(lc,"PretrainedConfig"),lc.forEach(r),Da=s(tt,` and can be used to control the model outputs. Read the
documentation from `),qr=a(tt,"A",{href:!0});var cc=i(qr);Sa=s(cc,"PretrainedConfig"),cc.forEach(r),Wa=s(tt," for more information."),tt.forEach(r),Va=m(V),v(Ce.$$.fragment,V),Ua=m(V),Ee=a(V,"DIV",{class:!0});var on=i(Ee);v(Mo.$$.fragment,on),Ga=m(on),ie=a(on,"P",{});var st=i(ie);Ha=s(st,"Instantiate a "),Lr=a(st,"A",{href:!0});var mc=i(Lr);Xa=s(mc,"BridgeTowerConfig"),mc.forEach(r),Ja=s(st,` (or a derived class) from BridgeTower text model configuration. Returns:
`),Ar=a(st,"A",{href:!0});var gc=i(Ar);Qa=s(gc,"BridgeTowerConfig"),gc.forEach(r),Ya=s(st,": An instance of a configuration object"),st.forEach(r),on.forEach(r),Ka=m(V),Fe=a(V,"DIV",{class:!0});var rn=i(Fe);v(qo.$$.fragment,rn),Za=m(rn),Lo=a(rn,"P",{});var tn=i(Lo);ei=s(tn,"Serializes this instance to a Python dictionary. Override the default "),Or=a(tn,"A",{href:!0});var pc=i(Or);oi=s(pc,"to_dict()"),pc.forEach(r),ri=s(tn,"."),tn.forEach(r),rn.forEach(r),V.forEach(r),Ms=m(o),de=a(o,"H2",{class:!0});var sn=i(de);Me=a(sn,"A",{id:!0,class:!0,href:!0});var hc=i(Me);kt=a(hc,"SPAN",{});var fc=i(kt);v(Ao.$$.fragment,fc),fc.forEach(r),hc.forEach(r),ti=m(sn),$t=a(sn,"SPAN",{});var uc=i($t);si=s(uc,"BridgeTowerTextConfig"),uc.forEach(r),sn.forEach(r),qs=m(o),E=a(o,"DIV",{class:!0});var to=i(E);v(Oo.$$.fragment,to),ni=m(to),le=a(to,"P",{});var nt=i(le);ai=s(nt,"This is the configuration class to store the text configuration of a "),Rr=a(nt,"A",{href:!0});var _c=i(Rr);ii=s(_c,"BridgeTowerModel"),_c.forEach(r),di=s(nt,`. The default values here
are copied from RoBERTa. Instantiating a configuration with the defaults will yield a similar configuration to that
of the bridgetower-base `),Ro=a(nt,"A",{href:!0,rel:!0});var wc=i(Ro);li=s(wc,"BridegTower/bridgetower-base"),wc.forEach(r),ci=s(nt,`
architecture.`),nt.forEach(r),mi=m(to),ce=a(to,"P",{});var at=i(ce);gi=s(at,"Configuration objects inherit from "),Nr=a(at,"A",{href:!0});var Tc=i(Nr);pi=s(Tc,"PretrainedConfig"),Tc.forEach(r),hi=s(at,` and can be used to control the model outputs. Read the
documentation from `),Dr=a(at,"A",{href:!0});var vc=i(Dr);fi=s(vc,"PretrainedConfig"),vc.forEach(r),ui=s(at," for more information."),at.forEach(r),_i=m(to),v(qe.$$.fragment,to),to.forEach(r),Ls=m(o),me=a(o,"H2",{class:!0});var nn=i(me);Le=a(nn,"A",{id:!0,class:!0,href:!0});var bc=i(Le);jt=a(bc,"SPAN",{});var yc=i(jt);v(No.$$.fragment,yc),yc.forEach(r),bc.forEach(r),wi=m(nn),Pt=a(nn,"SPAN",{});var Bc=i(Pt);Ti=s(Bc,"BridgeTowerVisionConfig"),Bc.forEach(r),nn.forEach(r),As=m(o),F=a(o,"DIV",{class:!0});var so=i(F);v(Do.$$.fragment,so),vi=m(so),ge=a(so,"P",{});var it=i(ge);bi=s(it,"This is the configuration class to store the vision configuration of a "),Sr=a(it,"A",{href:!0});var xc=i(Sr);yi=s(xc,"BridgeTowerModel"),xc.forEach(r),Bi=s(it,`. Instantiating a
configuration with the defaults will yield a similar configuration to that of the bridgetower-base
`),So=a(it,"A",{href:!0,rel:!0});var kc=i(So);xi=s(kc,"BridgeTower/bridgetower-base"),kc.forEach(r),ki=s(it," architecture."),it.forEach(r),$i=m(so),pe=a(so,"P",{});var dt=i(pe);ji=s(dt,"Configuration objects inherit from "),Wr=a(dt,"A",{href:!0});var $c=i(Wr);Pi=s($c,"PretrainedConfig"),$c.forEach(r),zi=s(dt,` and can be used to control the model outputs. Read the
documentation from `),Vr=a(dt,"A",{href:!0});var jc=i(Vr);Ii=s(jc,"PretrainedConfig"),jc.forEach(r),Ci=s(dt," for more information."),dt.forEach(r),Ei=m(so),v(Ae.$$.fragment,so),so.forEach(r),Os=m(o),he=a(o,"H2",{class:!0});var an=i(he);Oe=a(an,"A",{id:!0,class:!0,href:!0});var Pc=i(Oe);zt=a(Pc,"SPAN",{});var zc=i(zt);v(Wo.$$.fragment,zc),zc.forEach(r),Pc.forEach(r),Fi=m(an),It=a(an,"SPAN",{});var Ic=i(It);Mi=s(Ic,"BridgeTowerImageProcessor"),Ic.forEach(r),an.forEach(r),Rs=m(o),G=a(o,"DIV",{class:!0});var lt=i(G);v(Vo.$$.fragment,lt),qi=m(lt),Ct=a(lt,"P",{});var Cc=i(Ct);Li=s(Cc,"Constructs a BridgeTower image processor."),Cc.forEach(r),Ai=m(lt),Re=a(lt,"DIV",{class:!0});var dn=i(Re);v(Uo.$$.fragment,dn),Oi=m(dn),Et=a(dn,"P",{});var Ec=i(Et);Ri=s(Ec,"Preprocess an image or batch of images."),Ec.forEach(r),dn.forEach(r),lt.forEach(r),Ns=m(o),fe=a(o,"H2",{class:!0});var ln=i(fe);Ne=a(ln,"A",{id:!0,class:!0,href:!0});var Fc=i(Ne);Ft=a(Fc,"SPAN",{});var Mc=i(Ft);v(Go.$$.fragment,Mc),Mc.forEach(r),Fc.forEach(r),Ni=m(ln),Mt=a(ln,"SPAN",{});var qc=i(Mt);Di=s(qc,"BridgeTowerProcessor"),qc.forEach(r),ln.forEach(r),Ds=m(o),M=a(o,"DIV",{class:!0});var no=i(M);v(Ho.$$.fragment,no),Si=m(no),qt=a(no,"P",{});var Lc=i(qt);Wi=s(Lc,`Constructs a BridgeTower processor which wraps a Roberta tokenizer and BridgeTower image processor into a single
processor.`),Lc.forEach(r),Vi=m(no),C=a(no,"P",{});var X=i(C);Ur=a(X,"A",{href:!0});var Ac=i(Ur);Ui=s(Ac,"BridgeTowerProcessor"),Ac.forEach(r),Gi=s(X," offers all the functionalities of "),Gr=a(X,"A",{href:!0});var Oc=i(Gr);Hi=s(Oc,"BridgeTowerImageProcessor"),Oc.forEach(r),Xi=s(X,` and
`),Hr=a(X,"A",{href:!0});var Rc=i(Hr);Ji=s(Rc,"RobertaTokenizerFast"),Rc.forEach(r),Qi=s(X,". See the docstring of "),Xo=a(X,"A",{href:!0});var Pl=i(Xo);Lt=a(Pl,"STRONG",{});var Nc=i(Lt);Yi=s(Nc,"call"),Nc.forEach(r),Ki=s(Pl,"()"),Pl.forEach(r),Zi=s(X,` and
`),At=a(X,"CODE",{});var Dc=i(At);ed=s(Dc,"decode()"),Dc.forEach(r),od=s(X," for more information."),X.forEach(r),rd=m(no),K=a(no,"DIV",{class:!0});var ct=i(K);v(Jo.$$.fragment,ct),td=m(ct),ue=a(ct,"P",{});var mt=i(ue);sd=s(mt,"This method uses "),De=a(mt,"A",{href:!0});var cn=i(De);nd=s(cn,"BridgeTowerImageProcessor."),Ot=a(cn,"STRONG",{});var Sc=i(Ot);ad=s(Sc,"call"),Sc.forEach(r),id=s(cn,"()"),cn.forEach(r),dd=s(mt,` method to prepare image(s) for the model, and
`),Se=a(mt,"A",{href:!0});var mn=i(Se);ld=s(mn,"RobertaTokenizerFast."),Rt=a(mn,"STRONG",{});var Wc=i(Rt);cd=s(Wc,"call"),Wc.forEach(r),md=s(mn,"()"),mn.forEach(r),gd=s(mt," to prepare text for the model."),mt.forEach(r),pd=m(ct),Nt=a(ct,"P",{});var Vc=i(Nt);hd=s(Vc,"Please refer to the docstring of the above two methods for more information."),Vc.forEach(r),ct.forEach(r),no.forEach(r),Ss=m(o),_e=a(o,"H2",{class:!0});var gn=i(_e);We=a(gn,"A",{id:!0,class:!0,href:!0});var Uc=i(We);Dt=a(Uc,"SPAN",{});var Gc=i(Dt);v(Qo.$$.fragment,Gc),Gc.forEach(r),Uc.forEach(r),fd=m(gn),St=a(gn,"SPAN",{});var Hc=i(St);ud=s(Hc,"BridgeTowerModel"),Hc.forEach(r),gn.forEach(r),Ws=m(o),H=a(o,"DIV",{class:!0});var gt=i(H);v(Yo.$$.fragment,gt),_d=m(gt),Ko=a(gt,"P",{});var pn=i(Ko);wd=s(pn,`The bare BridgeTower Model transformer outputting BridgeTowerModelOutput object without any specific head on top.
This model is a PyTorch `),Wt=a(pn,"CODE",{});var Xc=i(Wt);Td=s(Xc,"torch.nn.Module <https://pytorch.org/docs/stable/nn.html#torch.nn.Module>"),Xc.forEach(r),vd=s(pn,`_ subclass. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),pn.forEach(r),bd=m(gt),N=a(gt,"DIV",{class:!0});var ao=i(N);v(Zo.$$.fragment,ao),yd=m(ao),we=a(ao,"P",{});var pt=i(we);Bd=s(pt,"The "),Xr=a(pt,"A",{href:!0});var Jc=i(Xr);xd=s(Jc,"BridgeTowerModel"),Jc.forEach(r),kd=s(pt," forward method, overrides the "),Vt=a(pt,"CODE",{});var Qc=i(Vt);$d=s(Qc,"__call__"),Qc.forEach(r),jd=s(pt," special method."),pt.forEach(r),Pd=m(ao),v(Ve.$$.fragment,ao),zd=m(ao),v(Ue.$$.fragment,ao),ao.forEach(r),gt.forEach(r),Vs=m(o),Te=a(o,"H2",{class:!0});var hn=i(Te);Ge=a(hn,"A",{id:!0,class:!0,href:!0});var Yc=i(Ge);Ut=a(Yc,"SPAN",{});var Kc=i(Ut);v(er.$$.fragment,Kc),Kc.forEach(r),Yc.forEach(r),Id=m(hn),Gt=a(hn,"SPAN",{});var Zc=i(Gt);Cd=s(Zc,"BridgeTowerForContrastiveLearning"),Zc.forEach(r),hn.forEach(r),Us=m(o),q=a(o,"DIV",{class:!0});var io=i(q);v(or.$$.fragment,io),Ed=m(io),Ht=a(io,"P",{});var em=i(Ht);Fd=s(em,"BridgeTower Model with a image-text contrastive head on top computing image-text contrastive loss."),em.forEach(r),Md=m(io),rr=a(io,"P",{});var fn=i(rr);qd=s(fn,"This model is a PyTorch "),Xt=a(fn,"CODE",{});var om=i(Xt);Ld=s(om,"torch.nn.Module <https://pytorch.org/docs/stable/nn.html#torch.nn.Module>"),om.forEach(r),Ad=s(fn,`_ subclass. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),fn.forEach(r),Od=m(io),D=a(io,"DIV",{class:!0});var lo=i(D);v(tr.$$.fragment,lo),Rd=m(lo),ve=a(lo,"P",{});var ht=i(ve);Nd=s(ht,"The "),Jr=a(ht,"A",{href:!0});var rm=i(Jr);Dd=s(rm,"BridgeTowerForContrastiveLearning"),rm.forEach(r),Sd=s(ht," forward method, overrides the "),Jt=a(ht,"CODE",{});var tm=i(Jt);Wd=s(tm,"__call__"),tm.forEach(r),Vd=s(ht," special method."),ht.forEach(r),Ud=m(lo),v(He.$$.fragment,lo),Gd=m(lo),v(Xe.$$.fragment,lo),lo.forEach(r),io.forEach(r),Gs=m(o),be=a(o,"H2",{class:!0});var un=i(be);Je=a(un,"A",{id:!0,class:!0,href:!0});var sm=i(Je);Qt=a(sm,"SPAN",{});var nm=i(Qt);v(sr.$$.fragment,nm),nm.forEach(r),sm.forEach(r),Hd=m(un),Yt=a(un,"SPAN",{});var am=i(Yt);Xd=s(am,"BridgeTowerForMaskedLM"),am.forEach(r),un.forEach(r),Hs=m(o),L=a(o,"DIV",{class:!0});var co=i(L);v(nr.$$.fragment,co),Jd=m(co),Kt=a(co,"P",{});var im=i(Kt);Qd=s(im,"BridgeTower Model with a language modeling head on top as done during pretraining."),im.forEach(r),Yd=m(co),ar=a(co,"P",{});var _n=i(ar);Kd=s(_n,"This model is a PyTorch "),Zt=a(_n,"CODE",{});var dm=i(Zt);Zd=s(dm,"torch.nn.Module <https://pytorch.org/docs/stable/nn.html#torch.nn.Module>"),dm.forEach(r),el=s(_n,`_ subclass. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),_n.forEach(r),ol=m(co),S=a(co,"DIV",{class:!0});var mo=i(S);v(ir.$$.fragment,mo),rl=m(mo),ye=a(mo,"P",{});var ft=i(ye);tl=s(ft,"The "),Qr=a(ft,"A",{href:!0});var lm=i(Qr);sl=s(lm,"BridgeTowerForMaskedLM"),lm.forEach(r),nl=s(ft," forward method, overrides the "),es=a(ft,"CODE",{});var cm=i(es);al=s(cm,"__call__"),cm.forEach(r),il=s(ft," special method."),ft.forEach(r),dl=m(mo),v(Qe.$$.fragment,mo),ll=m(mo),v(Ye.$$.fragment,mo),mo.forEach(r),co.forEach(r),Xs=m(o),Be=a(o,"H2",{class:!0});var wn=i(Be);Ke=a(wn,"A",{id:!0,class:!0,href:!0});var mm=i(Ke);os=a(mm,"SPAN",{});var gm=i(os);v(dr.$$.fragment,gm),gm.forEach(r),mm.forEach(r),cl=m(wn),rs=a(wn,"SPAN",{});var pm=i(rs);ml=s(pm,"BridgeTowerForImageAndTextRetrieval"),pm.forEach(r),wn.forEach(r),Js=m(o),A=a(o,"DIV",{class:!0});var go=i(A);v(lr.$$.fragment,go),gl=m(go),ts=a(go,"P",{});var hm=i(ts);pl=s(hm,`BridgeTower 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 matching.`),hm.forEach(r),hl=m(go),cr=a(go,"P",{});var Tn=i(cr);fl=s(Tn,"This model is a PyTorch "),ss=a(Tn,"CODE",{});var fm=i(ss);ul=s(fm,"torch.nn.Module <https://pytorch.org/docs/stable/nn.html#torch.nn.Module>"),fm.forEach(r),_l=s(Tn,`_ subclass. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Tn.forEach(r),wl=m(go),W=a(go,"DIV",{class:!0});var po=i(W);v(mr.$$.fragment,po),Tl=m(po),xe=a(po,"P",{});var ut=i(xe);vl=s(ut,"The "),Yr=a(ut,"A",{href:!0});var um=i(Yr);bl=s(um,"BridgeTowerForImageAndTextRetrieval"),um.forEach(r),yl=s(ut," forward method, overrides the "),ns=a(ut,"CODE",{});var _m=i(ns);Bl=s(_m,"__call__"),_m.forEach(r),xl=s(ut," special method."),ut.forEach(r),kl=m(po),v(Ze.$$.fragment,po),$l=m(po),v(eo.$$.fragment,po),po.forEach(r),go.forEach(r),this.h()},h(){l(p,"name","hf:doc:metadata"),l(p,"content",JSON.stringify(Lm)),l(f,"id","bridgetower"),l(f,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(f,"href","#bridgetower"),l(_,"class","relative group"),l(ke,"id","overview"),l(ke,"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"),l(ke,"href","#overview"),l(oe,"class","relative group"),l(fo,"href","https://arxiv.org/abs/2206.08657"),l(fo,"rel","nofollow"),l(uo,"href","https://aaai.org/Conferences/AAAI-23/"),l(uo,"rel","nofollow"),ym(Pe.src,zl="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/model_doc/bridgetower_architecture%20.jpg")||l(Pe,"src",zl),l(Pe,"alt","drawing"),l(Pe,"width","600"),l(vr,"href","https://arxiv.org/abs/2206.08657"),l(ze,"id","usage"),l(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"),l(ze,"href","#usage"),l(re,"class","relative group"),l(yr,"href","/docs/transformers/v4.29.0/en/model_doc/bridgetower#transformers.BridgeTowerProcessor"),l(Br,"href","/docs/transformers/v4.29.0/en/model_doc/roberta#transformers.RobertaTokenizer"),l(xr,"href","/docs/transformers/v4.29.0/en/model_doc/bridgetower#transformers.BridgeTowerImageProcessor"),l(kr,"href","/docs/transformers/v4.29.0/en/model_doc/bridgetower#transformers.BridgeTowerProcessor"),l($r,"href","/docs/transformers/v4.29.0/en/model_doc/bridgetower#transformers.BridgeTowerForContrastiveLearning"),l(jr,"href","/docs/transformers/v4.29.0/en/model_doc/bridgetower#transformers.BridgeTowerProcessor"),l(Pr,"href","/docs/transformers/v4.29.0/en/model_doc/bridgetower#transformers.BridgeTowerForImageAndTextRetrieval"),l(zr,"href","/docs/transformers/v4.29.0/en/model_doc/bridgetower#transformers.BridgeTowerProcessor"),l(Ir,"href","/docs/transformers/v4.29.0/en/model_doc/bridgetower#transformers.BridgeTowerForMaskedLM"),l(yo,"href","https://huggingface.co/anahita-b"),l(yo,"rel","nofollow"),l(Bo,"href","https://huggingface.co/Tile"),l(Bo,"rel","nofollow"),l(xo,"href","https://huggingface.co/shaoyent"),l(xo,"rel","nofollow"),l(ko,"href","https://github.com/microsoft/BridgeTower"),l(ko,"rel","nofollow"),l(Er,"href","/docs/transformers/v4.29.0/en/model_doc/roberta#transformers.RobertaTokenizer"),l(jo,"href","https://huggingface.co/BridgeTower/bridgetower-base"),l(jo,"rel","nofollow"),l(Po,"href","https://huggingface.co/BridgeTower/bridgetower-base-itm-mlm"),l(Po,"rel","nofollow"),l(Io,"href","https://arxiv.org/pdf/2206.08657.pdf"),l(Io,"rel","nofollow"),l(Ie,"id","transformers.BridgeTowerConfig"),l(Ie,"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"),l(Ie,"href","#transformers.BridgeTowerConfig"),l(se,"class","relative group"),l(Fr,"href","/docs/transformers/v4.29.0/en/model_doc/bridgetower#transformers.BridgeTowerModel"),l(Fo,"href","https://huggingface.co/BridgeTower/bridgetower-base/"),l(Fo,"rel","nofollow"),l(Mr,"href","/docs/transformers/v4.29.0/en/main_classes/configuration#transformers.PretrainedConfig"),l(qr,"href","/docs/transformers/v4.29.0/en/main_classes/configuration#transformers.PretrainedConfig"),l(Lr,"href","/docs/transformers/v4.29.0/en/model_doc/bridgetower#transformers.BridgeTowerConfig"),l(Ar,"href","/docs/transformers/v4.29.0/en/model_doc/bridgetower#transformers.BridgeTowerConfig"),l(Ee,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(Or,"href","/docs/transformers/v4.29.0/en/main_classes/configuration#transformers.PretrainedConfig.to_dict"),l(Fe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(Me,"id","transformers.BridgeTowerTextConfig"),l(Me,"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"),l(Me,"href","#transformers.BridgeTowerTextConfig"),l(de,"class","relative group"),l(Rr,"href","/docs/transformers/v4.29.0/en/model_doc/bridgetower#transformers.BridgeTowerModel"),l(Ro,"href","https://huggingface.co/BridgeTower/bridgetower-base/"),l(Ro,"rel","nofollow"),l(Nr,"href","/docs/transformers/v4.29.0/en/main_classes/configuration#transformers.PretrainedConfig"),l(Dr,"href","/docs/transformers/v4.29.0/en/main_classes/configuration#transformers.PretrainedConfig"),l(E,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(Le,"id","transformers.BridgeTowerVisionConfig"),l(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"),l(Le,"href","#transformers.BridgeTowerVisionConfig"),l(me,"class","relative group"),l(Sr,"href","/docs/transformers/v4.29.0/en/model_doc/bridgetower#transformers.BridgeTowerModel"),l(So,"href","https://huggingface.co/BridgeTower/bridgetower-base/"),l(So,"rel","nofollow"),l(Wr,"href","/docs/transformers/v4.29.0/en/main_classes/configuration#transformers.PretrainedConfig"),l(Vr,"href","/docs/transformers/v4.29.0/en/main_classes/configuration#transformers.PretrainedConfig"),l(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(Oe,"id","transformers.BridgeTowerImageProcessor"),l(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"),l(Oe,"href","#transformers.BridgeTowerImageProcessor"),l(he,"class","relative group"),l(Re,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(Ne,"id","transformers.BridgeTowerProcessor"),l(Ne,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(Ne,"href","#transformers.BridgeTowerProcessor"),l(fe,"class","relative group"),l(Ur,"href","/docs/transformers/v4.29.0/en/model_doc/bridgetower#transformers.BridgeTowerProcessor"),l(Gr,"href","/docs/transformers/v4.29.0/en/model_doc/bridgetower#transformers.BridgeTowerImageProcessor"),l(Hr,"href","/docs/transformers/v4.29.0/en/model_doc/roberta#transformers.RobertaTokenizerFast"),l(Xo,"href","/docs/transformers/v4.29.0/en/model_doc/bridgetower#transformers.BridgeTowerProcessor.__call__"),l(De,"href","/docs/transformers/v4.29.0/en/model_doc/dpt#transformers.DPTFeatureExtractor.__call__"),l(Se,"href","/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__"),l(K,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(M,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(We,"id","transformers.BridgeTowerModel"),l(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"),l(We,"href","#transformers.BridgeTowerModel"),l(_e,"class","relative group"),l(Xr,"href","/docs/transformers/v4.29.0/en/model_doc/bridgetower#transformers.BridgeTowerModel"),l(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(H,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(Ge,"id","transformers.BridgeTowerForContrastiveLearning"),l(Ge,"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"),l(Ge,"href","#transformers.BridgeTowerForContrastiveLearning"),l(Te,"class","relative group"),l(Jr,"href","/docs/transformers/v4.29.0/en/model_doc/bridgetower#transformers.BridgeTowerForContrastiveLearning"),l(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(Je,"id","transformers.BridgeTowerForMaskedLM"),l(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"),l(Je,"href","#transformers.BridgeTowerForMaskedLM"),l(be,"class","relative group"),l(Qr,"href","/docs/transformers/v4.29.0/en/model_doc/bridgetower#transformers.BridgeTowerForMaskedLM"),l(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(Ke,"id","transformers.BridgeTowerForImageAndTextRetrieval"),l(Ke,"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"),l(Ke,"href","#transformers.BridgeTowerForImageAndTextRetrieval"),l(Be,"class","relative group"),l(Yr,"href","/docs/transformers/v4.29.0/en/model_doc/bridgetower#transformers.BridgeTowerForImageAndTextRetrieval"),l(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(o,g){e(document.head,p),h(o,k,g),h(o,_,g),e(_,f),e(f,w),b(d,w,null),e(_,u),e(_,j),e(j,bn),h(o,ps,g),h(o,oe,g),e(oe,ke),e(ke,_t),b(ho,_t,null),e(oe,yn),e(oe,wt),e(wt,Bn),h(o,hs,g),h(o,$e,g),e($e,xn),e($e,fo),e(fo,kn),e($e,$n),h(o,fs,g),h(o,je,g),e(je,jn),e(je,uo),e(uo,Pn),e(je,zn),h(o,us,g),h(o,wr,g),e(wr,In),h(o,_s,g),h(o,Tr,g),e(Tr,Tt),e(Tt,Cn),h(o,ws,g),h(o,Pe,g),h(o,Ts,g),h(o,_o,g),e(_o,En),e(_o,vr),e(vr,Fn),h(o,vs,g),h(o,re,g),e(re,ze),e(ze,vt),b(wo,vt,null),e(re,Mn),e(re,bt),e(bt,qn),h(o,bs,g),h(o,br,g),e(br,Ln),h(o,ys,g),h(o,O,g),e(O,An),e(O,yr),e(yr,On),e(O,Rn),e(O,Br),e(Br,Nn),e(O,Dn),e(O,xr),e(xr,Sn),e(O,Wn),h(o,Bs,g),h(o,J,g),e(J,Vn),e(J,kr),e(kr,Un),e(J,Gn),e(J,$r),e($r,Hn),e(J,Xn),h(o,xs,g),b(To,o,g),h(o,ks,g),h(o,Q,g),e(Q,Jn),e(Q,jr),e(jr,Qn),e(Q,Yn),e(Q,Pr),e(Pr,Kn),e(Q,Zn),h(o,$s,g),b(vo,o,g),h(o,js,g),h(o,Y,g),e(Y,ea),e(Y,zr),e(zr,oa),e(Y,ra),e(Y,Ir),e(Ir,ta),e(Y,sa),h(o,Ps,g),b(bo,o,g),h(o,zs,g),h(o,I,g),e(I,na),e(I,yo),e(yo,aa),e(I,ia),e(I,Bo),e(Bo,da),e(I,la),e(I,xo),e(xo,ca),e(I,ma),e(I,ko),e(ko,ga),e(I,pa),h(o,Is,g),h(o,Cr,g),e(Cr,ha),h(o,Cs,g),h(o,R,g),e(R,$o),e($o,fa),e($o,Er),e(Er,ua),e($o,_a),e(R,wa),e(R,te),e(te,Ta),e(te,jo),e(jo,va),e(te,ba),e(te,Po),e(Po,ya),e(te,Ba),e(R,xa),e(R,zo),e(zo,ka),e(zo,Io),e(Io,$a),e(zo,ja),e(R,Pa),e(R,yt),e(yt,za),h(o,Es,g),h(o,se,g),e(se,Ie),e(Ie,Bt),b(Co,Bt,null),e(se,Ia),e(se,xt),e(xt,Ca),h(o,Fs,g),h(o,P,g),b(Eo,P,null),e(P,Ea),e(P,ne),e(ne,Fa),e(ne,Fr),e(Fr,Ma),e(ne,qa),e(ne,Fo),e(Fo,La),e(ne,Aa),e(P,Oa),e(P,ae),e(ae,Ra),e(ae,Mr),e(Mr,Na),e(ae,Da),e(ae,qr),e(qr,Sa),e(ae,Wa),e(P,Va),b(Ce,P,null),e(P,Ua),e(P,Ee),b(Mo,Ee,null),e(Ee,Ga),e(Ee,ie),e(ie,Ha),e(ie,Lr),e(Lr,Xa),e(ie,Ja),e(ie,Ar),e(Ar,Qa),e(ie,Ya),e(P,Ka),e(P,Fe),b(qo,Fe,null),e(Fe,Za),e(Fe,Lo),e(Lo,ei),e(Lo,Or),e(Or,oi),e(Lo,ri),h(o,Ms,g),h(o,de,g),e(de,Me),e(Me,kt),b(Ao,kt,null),e(de,ti),e(de,$t),e($t,si),h(o,qs,g),h(o,E,g),b(Oo,E,null),e(E,ni),e(E,le),e(le,ai),e(le,Rr),e(Rr,ii),e(le,di),e(le,Ro),e(Ro,li),e(le,ci),e(E,mi),e(E,ce),e(ce,gi),e(ce,Nr),e(Nr,pi),e(ce,hi),e(ce,Dr),e(Dr,fi),e(ce,ui),e(E,_i),b(qe,E,null),h(o,Ls,g),h(o,me,g),e(me,Le),e(Le,jt),b(No,jt,null),e(me,wi),e(me,Pt),e(Pt,Ti),h(o,As,g),h(o,F,g),b(Do,F,null),e(F,vi),e(F,ge),e(ge,bi),e(ge,Sr),e(Sr,yi),e(ge,Bi),e(ge,So),e(So,xi),e(ge,ki),e(F,$i),e(F,pe),e(pe,ji),e(pe,Wr),e(Wr,Pi),e(pe,zi),e(pe,Vr),e(Vr,Ii),e(pe,Ci),e(F,Ei),b(Ae,F,null),h(o,Os,g),h(o,he,g),e(he,Oe),e(Oe,zt),b(Wo,zt,null),e(he,Fi),e(he,It),e(It,Mi),h(o,Rs,g),h(o,G,g),b(Vo,G,null),e(G,qi),e(G,Ct),e(Ct,Li),e(G,Ai),e(G,Re),b(Uo,Re,null),e(Re,Oi),e(Re,Et),e(Et,Ri),h(o,Ns,g),h(o,fe,g),e(fe,Ne),e(Ne,Ft),b(Go,Ft,null),e(fe,Ni),e(fe,Mt),e(Mt,Di),h(o,Ds,g),h(o,M,g),b(Ho,M,null),e(M,Si),e(M,qt),e(qt,Wi),e(M,Vi),e(M,C),e(C,Ur),e(Ur,Ui),e(C,Gi),e(C,Gr),e(Gr,Hi),e(C,Xi),e(C,Hr),e(Hr,Ji),e(C,Qi),e(C,Xo),e(Xo,Lt),e(Lt,Yi),e(Xo,Ki),e(C,Zi),e(C,At),e(At,ed),e(C,od),e(M,rd),e(M,K),b(Jo,K,null),e(K,td),e(K,ue),e(ue,sd),e(ue,De),e(De,nd),e(De,Ot),e(Ot,ad),e(De,id),e(ue,dd),e(ue,Se),e(Se,ld),e(Se,Rt),e(Rt,cd),e(Se,md),e(ue,gd),e(K,pd),e(K,Nt),e(Nt,hd),h(o,Ss,g),h(o,_e,g),e(_e,We),e(We,Dt),b(Qo,Dt,null),e(_e,fd),e(_e,St),e(St,ud),h(o,Ws,g),h(o,H,g),b(Yo,H,null),e(H,_d),e(H,Ko),e(Ko,wd),e(Ko,Wt),e(Wt,Td),e(Ko,vd),e(H,bd),e(H,N),b(Zo,N,null),e(N,yd),e(N,we),e(we,Bd),e(we,Xr),e(Xr,xd),e(we,kd),e(we,Vt),e(Vt,$d),e(we,jd),e(N,Pd),b(Ve,N,null),e(N,zd),b(Ue,N,null),h(o,Vs,g),h(o,Te,g),e(Te,Ge),e(Ge,Ut),b(er,Ut,null),e(Te,Id),e(Te,Gt),e(Gt,Cd),h(o,Us,g),h(o,q,g),b(or,q,null),e(q,Ed),e(q,Ht),e(Ht,Fd),e(q,Md),e(q,rr),e(rr,qd),e(rr,Xt),e(Xt,Ld),e(rr,Ad),e(q,Od),e(q,D),b(tr,D,null),e(D,Rd),e(D,ve),e(ve,Nd),e(ve,Jr),e(Jr,Dd),e(ve,Sd),e(ve,Jt),e(Jt,Wd),e(ve,Vd),e(D,Ud),b(He,D,null),e(D,Gd),b(Xe,D,null),h(o,Gs,g),h(o,be,g),e(be,Je),e(Je,Qt),b(sr,Qt,null),e(be,Hd),e(be,Yt),e(Yt,Xd),h(o,Hs,g),h(o,L,g),b(nr,L,null),e(L,Jd),e(L,Kt),e(Kt,Qd),e(L,Yd),e(L,ar),e(ar,Kd),e(ar,Zt),e(Zt,Zd),e(ar,el),e(L,ol),e(L,S),b(ir,S,null),e(S,rl),e(S,ye),e(ye,tl),e(ye,Qr),e(Qr,sl),e(ye,nl),e(ye,es),e(es,al),e(ye,il),e(S,dl),b(Qe,S,null),e(S,ll),b(Ye,S,null),h(o,Xs,g),h(o,Be,g),e(Be,Ke),e(Ke,os),b(dr,os,null),e(Be,cl),e(Be,rs),e(rs,ml),h(o,Js,g),h(o,A,g),b(lr,A,null),e(A,gl),e(A,ts),e(ts,pl),e(A,hl),e(A,cr),e(cr,fl),e(cr,ss),e(ss,ul),e(cr,_l),e(A,wl),e(A,W),b(mr,W,null),e(W,Tl),e(W,xe),e(xe,vl),e(xe,Yr),e(Yr,bl),e(xe,yl),e(xe,ns),e(ns,Bl),e(xe,xl),e(W,kl),b(Ze,W,null),e(W,$l),b(eo,W,null),Qs=!0},p(o,[g]){const gr={};g&2&&(gr.$$scope={dirty:g,ctx:o}),Ce.$set(gr);const as={};g&2&&(as.$$scope={dirty:g,ctx:o}),qe.$set(as);const is={};g&2&&(is.$$scope={dirty:g,ctx:o}),Ae.$set(is);const ds={};g&2&&(ds.$$scope={dirty:g,ctx:o}),Ve.$set(ds);const pr={};g&2&&(pr.$$scope={dirty:g,ctx:o}),Ue.$set(pr);const ls={};g&2&&(ls.$$scope={dirty:g,ctx:o}),He.$set(ls);const cs={};g&2&&(cs.$$scope={dirty:g,ctx:o}),Xe.$set(cs);const ms={};g&2&&(ms.$$scope={dirty:g,ctx:o}),Qe.$set(ms);const hr={};g&2&&(hr.$$scope={dirty:g,ctx:o}),Ye.$set(hr);const gs={};g&2&&(gs.$$scope={dirty:g,ctx:o}),Ze.$set(gs);const fr={};g&2&&(fr.$$scope={dirty:g,ctx:o}),eo.$set(fr)},i(o){Qs||(y(d.$$.fragment,o),y(ho.$$.fragment,o),y(wo.$$.fragment,o),y(To.$$.fragment,o),y(vo.$$.fragment,o),y(bo.$$.fragment,o),y(Co.$$.fragment,o),y(Eo.$$.fragment,o),y(Ce.$$.fragment,o),y(Mo.$$.fragment,o),y(qo.$$.fragment,o),y(Ao.$$.fragment,o),y(Oo.$$.fragment,o),y(qe.$$.fragment,o),y(No.$$.fragment,o),y(Do.$$.fragment,o),y(Ae.$$.fragment,o),y(Wo.$$.fragment,o),y(Vo.$$.fragment,o),y(Uo.$$.fragment,o),y(Go.$$.fragment,o),y(Ho.$$.fragment,o),y(Jo.$$.fragment,o),y(Qo.$$.fragment,o),y(Yo.$$.fragment,o),y(Zo.$$.fragment,o),y(Ve.$$.fragment,o),y(Ue.$$.fragment,o),y(er.$$.fragment,o),y(or.$$.fragment,o),y(tr.$$.fragment,o),y(He.$$.fragment,o),y(Xe.$$.fragment,o),y(sr.$$.fragment,o),y(nr.$$.fragment,o),y(ir.$$.fragment,o),y(Qe.$$.fragment,o),y(Ye.$$.fragment,o),y(dr.$$.fragment,o),y(lr.$$.fragment,o),y(mr.$$.fragment,o),y(Ze.$$.fragment,o),y(eo.$$.fragment,o),Qs=!0)},o(o){B(d.$$.fragment,o),B(ho.$$.fragment,o),B(wo.$$.fragment,o),B(To.$$.fragment,o),B(vo.$$.fragment,o),B(bo.$$.fragment,o),B(Co.$$.fragment,o),B(Eo.$$.fragment,o),B(Ce.$$.fragment,o),B(Mo.$$.fragment,o),B(qo.$$.fragment,o),B(Ao.$$.fragment,o),B(Oo.$$.fragment,o),B(qe.$$.fragment,o),B(No.$$.fragment,o),B(Do.$$.fragment,o),B(Ae.$$.fragment,o),B(Wo.$$.fragment,o),B(Vo.$$.fragment,o),B(Uo.$$.fragment,o),B(Go.$$.fragment,o),B(Ho.$$.fragment,o),B(Jo.$$.fragment,o),B(Qo.$$.fragment,o),B(Yo.$$.fragment,o),B(Zo.$$.fragment,o),B(Ve.$$.fragment,o),B(Ue.$$.fragment,o),B(er.$$.fragment,o),B(or.$$.fragment,o),B(tr.$$.fragment,o),B(He.$$.fragment,o),B(Xe.$$.fragment,o),B(sr.$$.fragment,o),B(nr.$$.fragment,o),B(ir.$$.fragment,o),B(Qe.$$.fragment,o),B(Ye.$$.fragment,o),B(dr.$$.fragment,o),B(lr.$$.fragment,o),B(mr.$$.fragment,o),B(Ze.$$.fragment,o),B(eo.$$.fragment,o),Qs=!1},d(o){r(p),o&&r(k),o&&r(_),x(d),o&&r(ps),o&&r(oe),x(ho),o&&r(hs),o&&r($e),o&&r(fs),o&&r(je),o&&r(us),o&&r(wr),o&&r(_s),o&&r(Tr),o&&r(ws),o&&r(Pe),o&&r(Ts),o&&r(_o),o&&r(vs),o&&r(re),x(wo),o&&r(bs),o&&r(br),o&&r(ys),o&&r(O),o&&r(Bs),o&&r(J),o&&r(xs),x(To,o),o&&r(ks),o&&r(Q),o&&r($s),x(vo,o),o&&r(js),o&&r(Y),o&&r(Ps),x(bo,o),o&&r(zs),o&&r(I),o&&r(Is),o&&r(Cr),o&&r(Cs),o&&r(R),o&&r(Es),o&&r(se),x(Co),o&&r(Fs),o&&r(P),x(Eo),x(Ce),x(Mo),x(qo),o&&r(Ms),o&&r(de),x(Ao),o&&r(qs),o&&r(E),x(Oo),x(qe),o&&r(Ls),o&&r(me),x(No),o&&r(As),o&&r(F),x(Do),x(Ae),o&&r(Os),o&&r(he),x(Wo),o&&r(Rs),o&&r(G),x(Vo),x(Uo),o&&r(Ns),o&&r(fe),x(Go),o&&r(Ds),o&&r(M),x(Ho),x(Jo),o&&r(Ss),o&&r(_e),x(Qo),o&&r(Ws),o&&r(H),x(Yo),x(Zo),x(Ve),x(Ue),o&&r(Vs),o&&r(Te),x(er),o&&r(Us),o&&r(q),x(or),x(tr),x(He),x(Xe),o&&r(Gs),o&&r(be),x(sr),o&&r(Hs),o&&r(L),x(nr),x(ir),x(Qe),x(Ye),o&&r(Xs),o&&r(Be),x(dr),o&&r(Js),o&&r(A),x(lr),x(mr),x(Ze),x(eo)}}}const Lm={local:"bridgetower",sections:[{local:"overview",title:"Overview"},{local:"usage",title:"Usage"},{local:"transformers.BridgeTowerConfig",title:"BridgeTowerConfig"},{local:"transformers.BridgeTowerTextConfig",title:"BridgeTowerTextConfig"},{local:"transformers.BridgeTowerVisionConfig",title:"BridgeTowerVisionConfig"},{local:"transformers.BridgeTowerImageProcessor",title:"BridgeTowerImageProcessor"},{local:"transformers.BridgeTowerProcessor",title:"BridgeTowerProcessor"},{local:"transformers.BridgeTowerModel",title:"BridgeTowerModel"},{local:"transformers.BridgeTowerForContrastiveLearning",title:"BridgeTowerForContrastiveLearning"},{local:"transformers.BridgeTowerForMaskedLM",title:"BridgeTowerForMaskedLM"},{local:"transformers.BridgeTowerForImageAndTextRetrieval",title:"BridgeTowerForImageAndTextRetrieval"}],title:"BridgeTower"};function Am($){return Bm(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Vm extends wm{constructor(p){super();Tm(this,p,Am,qm,vm,{})}}export{Vm as default,Lm as metadata};
