import{S as _m,i as Tm,s as bm,e as s,k as c,w as T,t as r,M as ym,c as a,d as t,m,a as i,x as b,h as n,b as d,N as vm,G as e,g as h,y,q as v,o as M,B,v as Mm,L as wt}from"../../chunks/vendor-hf-doc-builder.js";import{T as bs}from"../../chunks/Tip-hf-doc-builder.js";import{D as $}from"../../chunks/Docstring-hf-doc-builder.js";import{C as ee}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as S}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as ut}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Bm(J){let g,k,w,f,_;return f=new ee({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEJyaWRnZVRvd2VyTW9kZWwlMkMlMjBCcmlkZ2VUb3dlckNvbmZpZyUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBCcmlkZ2VUb3dlciUyMEJyaWRnZVRvd2VyJTJGYnJpZGdldG93ZXItYmFzZSUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBCcmlkZ2VUb3dlckNvbmZpZygpJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMG1vZGVsJTIwZnJvbSUyMHRoZSUyMEJyaWRnZVRvd2VyJTJGYnJpZGdldG93ZXItYmFzZSUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQW1vZGVsJTIwJTNEJTIwQnJpZGdlVG93ZXJNb2RlbChjb25maWd1cmF0aW9uKSUwQSUwQSUyMyUyMEFjY2Vzc2luZyUyMHRoZSUyMG1vZGVsJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBtb2RlbC5jb25maWc=",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(){g=s("p"),k=r("Example:"),w=c(),T(f.$$.fragment)},l(l){g=a(l,"P",{});var u=i(g);k=n(u,"Example:"),u.forEach(t),w=m(l),b(f.$$.fragment,l)},m(l,u){h(l,g,u),e(g,k),h(l,w,u),y(f,l,u),_=!0},p:wt,i(l){_||(v(f.$$.fragment,l),_=!0)},o(l){M(f.$$.fragment,l),_=!1},d(l){l&&t(g),l&&t(w),B(f,l)}}}function km(J){let g,k,w,f,_;return f=new ee({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEJyaWRnZVRvd2VyVGV4dENvbmZpZyUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBCcmlkZ2VUb3dlciUyMEJyaWRnZVRvd2VyJTJGYnJpZGdldG93ZXItYmFzZSUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUyMGZvciUyMHRoZSUyMHRleHQlMjBtb2RlbCUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBCcmlkZ2VUb3dlclRleHRDb25maWcoKSUwQSUwQSUyMyUyMEFjY2Vzc2luZyUyMHRoZSUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9u",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(){g=s("p"),k=r("Example:"),w=c(),T(f.$$.fragment)},l(l){g=a(l,"P",{});var u=i(g);k=n(u,"Example:"),u.forEach(t),w=m(l),b(f.$$.fragment,l)},m(l,u){h(l,g,u),e(g,k),h(l,w,u),y(f,l,u),_=!0},p:wt,i(l){_||(v(f.$$.fragment,l),_=!0)},o(l){M(f.$$.fragment,l),_=!1},d(l){l&&t(g),l&&t(w),B(f,l)}}}function Jm(J){let g,k,w,f,_;return f=new ee({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEJyaWRnZVRvd2VyVmlzaW9uQ29uZmlnJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMEJyaWRnZVRvd2VyJTIwQnJpZGdlVG93ZXIlMkZicmlkZ2V0b3dlci1iYXNlJTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTIwZm9yJTIwdGhlJTIwdmlzaW9uJTIwbW9kZWwlMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwQnJpZGdlVG93ZXJWaXNpb25Db25maWcoKSUwQSUwQSUyMyUyMEFjY2Vzc2luZyUyMHRoZSUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9u",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(){g=s("p"),k=r("Example:"),w=c(),T(f.$$.fragment)},l(l){g=a(l,"P",{});var u=i(g);k=n(u,"Example:"),u.forEach(t),w=m(l),b(f.$$.fragment,l)},m(l,u){h(l,g,u),e(g,k),h(l,w,u),y(f,l,u),_=!0},p:wt,i(l){_||(v(f.$$.fragment,l),_=!0)},o(l){M(f.$$.fragment,l),_=!1},d(l){l&&t(g),l&&t(w),B(f,l)}}}function jm(J){let g,k,w,f,_;return{c(){g=s("p"),k=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),w=s("code"),f=r("Module"),_=r(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){g=a(l,"P",{});var u=i(g);k=n(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),w=a(u,"CODE",{});var j=i(w);f=n(j,"Module"),j.forEach(t),_=n(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(t)},m(l,u){h(l,g,u),e(g,k),e(g,w),e(w,f),e(g,_)},d(l){l&&t(g)}}}function xm(J){let g,k,w,f,_;return f=new ee({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEJyaWRnZVRvd2VyUHJvY2Vzc29yJTJDJTIwQnJpZGdlVG93ZXJNb2RlbCUwQWZyb20lMjBQSUwlMjBpbXBvcnQlMjBJbWFnZSUwQWltcG9ydCUyMHJlcXVlc3RzJTBBJTBBJTIzJTIwcHJlcGFyZSUyMGltYWdlJTIwYW5kJTIwdGV4dCUwQXVybCUyMCUzRCUyMCUyMmh0dHAlM0ElMkYlMkZpbWFnZXMuY29jb2RhdGFzZXQub3JnJTJGdmFsMjAxNyUyRjAwMDAwMDAzOTc2OS5qcGclMjIlMEFpbWFnZSUyMCUzRCUyMEltYWdlLm9wZW4ocmVxdWVzdHMuZ2V0KHVybCUyQyUyMHN0cmVhbSUzRFRydWUpLnJhdyklMEF0ZXh0JTIwJTNEJTIwJTIyaGVsbG8lMjB3b3JsZCUyMiUwQXByb2Nlc3NvciUyMCUzRCUyMEJyaWRnZVRvd2VyUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJCcmlkZ2VUb3dlciUyRmJyaWRnZXRvd2VyLWJhc2UlMjIpJTBBbW9kZWwlMjAlM0QlMjBCcmlkZ2VUb3dlck1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJCcmlkZ2VUb3dlciUyRmJyaWRnZXRvd2VyLWJhc2UlMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwcHJvY2Vzc29yKGltYWdlJTJDJTIwdGV4dCUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKSUwQW91dHB1dHMua2V5cygp",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(){g=s("p"),k=r("Examples:"),w=c(),T(f.$$.fragment)},l(l){g=a(l,"P",{});var u=i(g);k=n(u,"Examples:"),u.forEach(t),w=m(l),b(f.$$.fragment,l)},m(l,u){h(l,g,u),e(g,k),h(l,w,u),y(f,l,u),_=!0},p:wt,i(l){_||(v(f.$$.fragment,l),_=!0)},o(l){M(f.$$.fragment,l),_=!1},d(l){l&&t(g),l&&t(w),B(f,l)}}}function $m(J){let g,k,w,f,_;return{c(){g=s("p"),k=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),w=s("code"),f=r("Module"),_=r(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){g=a(l,"P",{});var u=i(g);k=n(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),w=a(u,"CODE",{});var j=i(w);f=n(j,"Module"),j.forEach(t),_=n(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(t)},m(l,u){h(l,g,u),e(g,k),e(g,w),e(w,f),e(g,_)},d(l){l&&t(g)}}}function Im(J){let g,k,w,f,_;return f=new ee({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEJyaWRnZVRvd2VyUHJvY2Vzc29yJTJDJTIwQnJpZGdlVG93ZXJGb3JDb250cmFzdGl2ZUxlYXJuaW5nJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQWltYWdlX3VybHMlMjAlM0QlMjAlNUIlMEElMjAlMjAlMjAlMjAlMjJodHRwcyUzQSUyRiUyRmZhcm00LnN0YXRpY2ZsaWNrci5jb20lMkYzMzk1JTJGMzQyODI3ODQxNV84MWMzZTI3ZjE1X3ouanBnJTIyJTJDJTBBJTIwJTIwJTIwJTIwJTIyaHR0cCUzQSUyRiUyRmltYWdlcy5jb2NvZGF0YXNldC5vcmclMkZ2YWwyMDE3JTJGMDAwMDAwMDM5NzY5LmpwZyUyMiUyQyUwQSU1RCUwQXRleHRzJTIwJTNEJTIwJTVCJTIydHdvJTIwZG9ncyUyMGluJTIwYSUyMGNhciUyMiUyQyUyMCUyMnR3byUyMGNhdHMlMjBzbGVlcGluZyUyMG9uJTIwYSUyMGNvdWNoJTIyJTVEJTBBaW1hZ2VzJTIwJTNEJTIwJTVCSW1hZ2Uub3BlbihyZXF1ZXN0cy5nZXQodXJsJTJDJTIwc3RyZWFtJTNEVHJ1ZSkucmF3KSUyMGZvciUyMHVybCUyMGluJTIwaW1hZ2VfdXJscyU1RCUwQSUwQXByb2Nlc3NvciUyMCUzRCUyMEJyaWRnZVRvd2VyUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJCcmlkZ2VUb3dlciUyRmJyaWRnZXRvd2VyLWxhcmdlLWl0bS1tbG0taXRjJTIyKSUwQW1vZGVsJTIwJTNEJTIwQnJpZGdlVG93ZXJGb3JDb250cmFzdGl2ZUxlYXJuaW5nLmZyb21fcHJldHJhaW5lZCglMjJCcmlkZ2VUb3dlciUyRmJyaWRnZXRvd2VyLWxhcmdlLWl0bS1tbG0taXRjJTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMHByb2Nlc3NvcihpbWFnZXMlMkMlMjB0ZXh0cyUyQyUyMHBhZGRpbmclM0RUcnVlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEFsb3NzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMlMkMlMjByZXR1cm5fbG9zcyUzRFRydWUpLmxvc3MlMEElMEFpbnB1dHMlMjAlM0QlMjBwcm9jZXNzb3IoaW1hZ2VzJTJDJTIwdGV4dHMlNUIlM0ElM0EtMSU1RCUyQyUyMHBhZGRpbmclM0RUcnVlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEFsb3NzX3N3YXBwZWQlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMHJldHVybl9sb3NzJTNEVHJ1ZSkubG9zcyUwQSUwQXByaW50KCUyMkxvc3MlMjIlMkMlMjByb3VuZChsb3NzLml0ZW0oKSUyQyUyMDQpKSUwQSUwQXByaW50KCUyMkxvc3MlMjB3aXRoJTIwc3dhcHBlZCUyMGltYWdlcyUyMiUyQyUyMHJvdW5kKGxvc3Nfc3dhcHBlZC5pdGVtKCklMkMlMjA0KSk=",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(){g=s("p"),k=r("Examples:"),w=c(),T(f.$$.fragment)},l(l){g=a(l,"P",{});var u=i(g);k=n(u,"Examples:"),u.forEach(t),w=m(l),b(f.$$.fragment,l)},m(l,u){h(l,g,u),e(g,k),h(l,w,u),y(f,l,u),_=!0},p:wt,i(l){_||(v(f.$$.fragment,l),_=!0)},o(l){M(f.$$.fragment,l),_=!1},d(l){l&&t(g),l&&t(w),B(f,l)}}}function Em(J){let g,k,w,f,_;return{c(){g=s("p"),k=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),w=s("code"),f=r("Module"),_=r(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){g=a(l,"P",{});var u=i(g);k=n(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),w=a(u,"CODE",{});var j=i(w);f=n(j,"Module"),j.forEach(t),_=n(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(t)},m(l,u){h(l,g,u),e(g,k),e(g,w),e(w,f),e(g,_)},d(l){l&&t(g)}}}function Um(J){let g,k,w,f,_;return f=new ee({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEJyaWRnZVRvd2VyUHJvY2Vzc29yJTJDJTIwQnJpZGdlVG93ZXJGb3JNYXNrZWRMTSUwQWZyb20lMjBQSUwlMjBpbXBvcnQlMjBJbWFnZSUwQWltcG9ydCUyMHJlcXVlc3RzJTBBJTBBdXJsJTIwJTNEJTIwJTIyaHR0cCUzQSUyRiUyRmltYWdlcy5jb2NvZGF0YXNldC5vcmclMkZ2YWwyMDE3JTJGMDAwMDAwMzYwOTQzLmpwZyUyMiUwQWltYWdlJTIwJTNEJTIwSW1hZ2Uub3BlbihyZXF1ZXN0cy5nZXQodXJsJTJDJTIwc3RyZWFtJTNEVHJ1ZSkucmF3KS5jb252ZXJ0KCUyMlJHQiUyMiklMEF0ZXh0JTIwJTNEJTIwJTIyYSUyMCUzQ21hc2slM0UlMjBsb29raW5nJTIwb3V0JTIwb2YlMjB0aGUlMjB3aW5kb3clMjIlMEElMEFwcm9jZXNzb3IlMjAlM0QlMjBCcmlkZ2VUb3dlclByb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyQnJpZGdlVG93ZXIlMkZicmlkZ2V0b3dlci1iYXNlLWl0bS1tbG0lMjIpJTBBbW9kZWwlMjAlM0QlMjBCcmlkZ2VUb3dlckZvck1hc2tlZExNLmZyb21fcHJldHJhaW5lZCglMjJCcmlkZ2VUb3dlciUyRmJyaWRnZXRvd2VyLWJhc2UtaXRtLW1sbSUyMiklMEElMEElMjMlMjBwcmVwYXJlJTIwaW5wdXRzJTBBZW5jb2RpbmclMjAlM0QlMjBwcm9jZXNzb3IoaW1hZ2UlMkMlMjB0ZXh0JTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEElMEElMjMlMjBmb3J3YXJkJTIwcGFzcyUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmVuY29kaW5nKSUwQSUwQXJlc3VsdHMlMjAlM0QlMjBwcm9jZXNzb3IuZGVjb2RlKG91dHB1dHMubG9naXRzLmFyZ21heChkaW0lM0QtMSkuc3F1ZWV6ZSgwKS50b2xpc3QoKSklMEElMEFwcmludChyZXN1bHRzKQ==",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(){g=s("p"),k=r("Examples:"),w=c(),T(f.$$.fragment)},l(l){g=a(l,"P",{});var u=i(g);k=n(u,"Examples:"),u.forEach(t),w=m(l),b(f.$$.fragment,l)},m(l,u){h(l,g,u),e(g,k),h(l,w,u),y(f,l,u),_=!0},p:wt,i(l){_||(v(f.$$.fragment,l),_=!0)},o(l){M(f.$$.fragment,l),_=!1},d(l){l&&t(g),l&&t(w),B(f,l)}}}function zm(J){let g,k,w,f,_;return{c(){g=s("p"),k=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),w=s("code"),f=r("Module"),_=r(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){g=a(l,"P",{});var u=i(g);k=n(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),w=a(u,"CODE",{});var j=i(w);f=n(j,"Module"),j.forEach(t),_=n(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(t)},m(l,u){h(l,g,u),e(g,k),e(g,w),e(w,f),e(g,_)},d(l){l&&t(g)}}}function Zm(J){let g,k,w,f,_;return f=new ee({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEJyaWRnZVRvd2VyUHJvY2Vzc29yJTJDJTIwQnJpZGdlVG93ZXJGb3JJbWFnZUFuZFRleHRSZXRyaWV2YWwlMEFpbXBvcnQlMjByZXF1ZXN0cyUwQWZyb20lMjBQSUwlMjBpbXBvcnQlMjBJbWFnZSUwQSUwQXVybCUyMCUzRCUyMCUyMmh0dHAlM0ElMkYlMkZpbWFnZXMuY29jb2RhdGFzZXQub3JnJTJGdmFsMjAxNyUyRjAwMDAwMDAzOTc2OS5qcGclMjIlMEFpbWFnZSUyMCUzRCUyMEltYWdlLm9wZW4ocmVxdWVzdHMuZ2V0KHVybCUyQyUyMHN0cmVhbSUzRFRydWUpLnJhdyklMEF0ZXh0cyUyMCUzRCUyMCU1QiUyMkFuJTIwaW1hZ2UlMjBvZiUyMHR3byUyMGNhdHMlMjBjaGlsbGluZyUyMG9uJTIwYSUyMGNvdWNoJTIyJTJDJTIwJTIyQSUyMGZvb3RiYWxsJTIwcGxheWVyJTIwc2NvcmluZyUyMGElMjBnb2FsJTIyJTVEJTBBJTBBcHJvY2Vzc29yJTIwJTNEJTIwQnJpZGdlVG93ZXJQcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMkJyaWRnZVRvd2VyJTJGYnJpZGdldG93ZXItYmFzZS1pdG0tbWxtJTIyKSUwQW1vZGVsJTIwJTNEJTIwQnJpZGdlVG93ZXJGb3JJbWFnZUFuZFRleHRSZXRyaWV2YWwuZnJvbV9wcmV0cmFpbmVkKCUyMkJyaWRnZVRvd2VyJTJGYnJpZGdldG93ZXItYmFzZS1pdG0tbWxtJTIyKSUwQSUwQSUyMyUyMGZvcndhcmQlMjBwYXNzJTBBc2NvcmVzJTIwJTNEJTIwZGljdCgpJTBBZm9yJTIwdGV4dCUyMGluJTIwdGV4dHMlM0ElMEElMjAlMjAlMjAlMjAlMjMlMjBwcmVwYXJlJTIwaW5wdXRzJTBBJTIwJTIwJTIwJTIwZW5jb2RpbmclMjAlM0QlMjBwcm9jZXNzb3IoaW1hZ2UlMkMlMjB0ZXh0JTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEElMjAlMjAlMjAlMjBvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKiplbmNvZGluZyklMEElMjAlMjAlMjAlMjBzY29yZXMlNUJ0ZXh0JTVEJTIwJTNEJTIwb3V0cHV0cy5sb2dpdHMlNUIwJTJDJTIwMSU1RC5pdGVtKCk=",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(){g=s("p"),k=r("Examples:"),w=c(),T(f.$$.fragment)},l(l){g=a(l,"P",{});var u=i(g);k=n(u,"Examples:"),u.forEach(t),w=m(l),b(f.$$.fragment,l)},m(l,u){h(l,g,u),e(g,k),h(l,w,u),y(f,l,u),_=!0},p:wt,i(l){_||(v(f.$$.fragment,l),_=!0)},o(l){M(f.$$.fragment,l),_=!1},d(l){l&&t(g),l&&t(w),B(f,l)}}}function Cm(J){let g,k,w,f,_,l,u,j,ys,hn,oe,ke,wr,ho,vs,_r,Ms,fn,Je,Bs,fo,ks,Js,un,je,js,uo,xs,$s,wn,_t,Is,_n,Tt,Tr,Es,Tn,xe,$d,bn,wo,Us,bt,zs,yn,te,$e,br,_o,Zs,yr,Cs,vn,yt,Rs,Mn,W,Fs,vt,Ws,Vs,Mt,Ns,Ps,Bt,As,Gs,Bn,H,Ls,kt,Ss,Xs,Jt,qs,Qs,kn,To,Jn,D,Hs,jt,Ds,Os,xt,Ys,Ks,jn,bo,xn,O,ea,$t,oa,ta,It,ra,na,$n,yo,In,I,sa,vo,aa,ia,Mo,la,da,Bo,ca,ma,ko,pa,ga,En,Et,ha,Un,V,Jo,fa,Ut,ua,wa,_a,re,Ta,jo,ba,ya,xo,va,Ma,Ba,$o,ka,Io,Ja,ja,xa,vr,$a,zn,ne,Ie,Mr,Eo,Ia,Br,Ea,Zn,x,Uo,Ua,se,za,zt,Za,Ca,zo,Ra,Fa,Wa,ae,Va,Zt,Na,Pa,Ct,Aa,Ga,La,Ee,Sa,Ue,Zo,Xa,ie,qa,Rt,Qa,Ha,Ft,Da,Oa,Ya,ze,Co,Ka,Ro,ei,Wt,oi,ti,Cn,le,Ze,kr,Fo,ri,Jr,ni,Rn,U,Wo,si,de,ai,Vt,ii,li,Vo,di,ci,mi,ce,pi,Nt,gi,hi,Pt,fi,ui,wi,Ce,Fn,me,Re,jr,No,_i,xr,Ti,Wn,z,Po,bi,pe,yi,At,vi,Mi,Ao,Bi,ki,Ji,ge,ji,Gt,xi,$i,Lt,Ii,Ei,Ui,Fe,Vn,he,We,$r,Go,zi,Ir,Zi,Nn,X,Lo,Ci,Er,Ri,Fi,Ve,So,Wi,Ur,Vi,Pn,fe,Ne,zr,Xo,Ni,Zr,Pi,An,Z,qo,Ai,Cr,Gi,Li,E,St,Si,Xi,Xt,qi,Qi,qt,Hi,Di,Qo,Rr,Oi,Yi,Ki,Fr,el,ol,tl,Y,Ho,rl,ue,nl,Pe,sl,Wr,al,il,ll,Ae,dl,Vr,cl,ml,pl,gl,Nr,hl,Gn,we,Ge,Pr,Do,fl,Ar,ul,Ln,q,Oo,wl,Yo,_l,Gr,Tl,bl,yl,N,Ko,vl,_e,Ml,Qt,Bl,kl,Lr,Jl,jl,xl,Le,$l,Se,Sn,Te,Xe,Sr,et,Il,Xr,El,Xn,C,ot,Ul,qr,zl,Zl,tt,Cl,Qr,Rl,Fl,Wl,P,rt,Vl,be,Nl,Ht,Pl,Al,Hr,Gl,Ll,Sl,qe,Xl,Qe,qn,ye,He,Dr,nt,ql,Or,Ql,Qn,R,st,Hl,Yr,Dl,Ol,at,Yl,Kr,Kl,ed,od,A,it,td,ve,rd,Dt,nd,sd,en,ad,id,ld,De,dd,Oe,Hn,Me,Ye,on,lt,cd,tn,md,Dn,F,dt,pd,rn,gd,hd,ct,fd,nn,ud,wd,_d,G,mt,Td,Be,bd,Ot,yd,vd,sn,Md,Bd,kd,Ke,Jd,eo,On;return l=new S({}),ho=new S({}),_o=new S({}),To=new ee({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEJyaWRnZVRvd2VyUHJvY2Vzc29yJTJDJTIwQnJpZGdlVG93ZXJGb3JDb250cmFzdGl2ZUxlYXJuaW5nJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEElMEF1cmwlMjAlM0QlMjAlMjJodHRwJTNBJTJGJTJGaW1hZ2VzLmNvY29kYXRhc2V0Lm9yZyUyRnZhbDIwMTclMkYwMDAwMDAwMzk3NjkuanBnJTIyJTBBaW1hZ2UlMjAlM0QlMjBJbWFnZS5vcGVuKHJlcXVlc3RzLmdldCh1cmwlMkMlMjBzdHJlYW0lM0RUcnVlKS5yYXcpJTBBdGV4dHMlMjAlM0QlMjAlNUIlMjJBbiUyMGltYWdlJTIwb2YlMjB0d28lMjBjYXRzJTIwY2hpbGxpbmclMjBvbiUyMGElMjBjb3VjaCUyMiUyQyUyMCUyMkElMjBmb290YmFsbCUyMHBsYXllciUyMHNjb3JpbmclMjBhJTIwZ29hbCUyMiU1RCUwQSUwQXByb2Nlc3NvciUyMCUzRCUyMEJyaWRnZVRvd2VyUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJCcmlkZ2VUb3dlciUyRmJyaWRnZXRvd2VyLWxhcmdlLWl0bS1tbG0taXRjJTIyKSUwQW1vZGVsJTIwJTNEJTIwQnJpZGdlVG93ZXJGb3JDb250cmFzdGl2ZUxlYXJuaW5nLmZyb21fcHJldHJhaW5lZCglMjJCcmlkZ2VUb3dlciUyRmJyaWRnZXRvd2VyLWxhcmdlLWl0bS1tbG0taXRjJTIyKSUwQSUwQSUyMyUyMGZvcndhcmQlMjBwYXNzJTBBc2NvcmVzJTIwJTNEJTIwZGljdCgpJTBBZm9yJTIwdGV4dCUyMGluJTIwdGV4dHMlM0ElMEElMjAlMjAlMjAlMjAlMjMlMjBwcmVwYXJlJTIwaW5wdXRzJTBBJTIwJTIwJTIwJTIwZW5jb2RpbmclMjAlM0QlMjBwcm9jZXNzb3IoaW1hZ2UlMkMlMjB0ZXh0JTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEElMjAlMjAlMjAlMjBvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKiplbmNvZGluZyklMEElMjAlMjAlMjAlMjBzY29yZXMlNUJ0ZXh0JTVEJTIwJTNEJTIwb3V0cHV0cw==",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`}}),bo=new ee({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEJyaWRnZVRvd2VyUHJvY2Vzc29yJTJDJTIwQnJpZGdlVG93ZXJGb3JJbWFnZUFuZFRleHRSZXRyaWV2YWwlMEFpbXBvcnQlMjByZXF1ZXN0cyUwQWZyb20lMjBQSUwlMjBpbXBvcnQlMjBJbWFnZSUwQSUwQXVybCUyMCUzRCUyMCUyMmh0dHAlM0ElMkYlMkZpbWFnZXMuY29jb2RhdGFzZXQub3JnJTJGdmFsMjAxNyUyRjAwMDAwMDAzOTc2OS5qcGclMjIlMEFpbWFnZSUyMCUzRCUyMEltYWdlLm9wZW4ocmVxdWVzdHMuZ2V0KHVybCUyQyUyMHN0cmVhbSUzRFRydWUpLnJhdyklMEF0ZXh0cyUyMCUzRCUyMCU1QiUyMkFuJTIwaW1hZ2UlMjBvZiUyMHR3byUyMGNhdHMlMjBjaGlsbGluZyUyMG9uJTIwYSUyMGNvdWNoJTIyJTJDJTIwJTIyQSUyMGZvb3RiYWxsJTIwcGxheWVyJTIwc2NvcmluZyUyMGElMjBnb2FsJTIyJTVEJTBBJTBBcHJvY2Vzc29yJTIwJTNEJTIwQnJpZGdlVG93ZXJQcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMkJyaWRnZVRvd2VyJTJGYnJpZGdldG93ZXItYmFzZS1pdG0tbWxtJTIyKSUwQW1vZGVsJTIwJTNEJTIwQnJpZGdlVG93ZXJGb3JJbWFnZUFuZFRleHRSZXRyaWV2YWwuZnJvbV9wcmV0cmFpbmVkKCUyMkJyaWRnZVRvd2VyJTJGYnJpZGdldG93ZXItYmFzZS1pdG0tbWxtJTIyKSUwQSUwQSUyMyUyMGZvcndhcmQlMjBwYXNzJTBBc2NvcmVzJTIwJTNEJTIwZGljdCgpJTBBZm9yJTIwdGV4dCUyMGluJTIwdGV4dHMlM0ElMEElMjAlMjAlMjAlMjAlMjMlMjBwcmVwYXJlJTIwaW5wdXRzJTBBJTIwJTIwJTIwJTIwZW5jb2RpbmclMjAlM0QlMjBwcm9jZXNzb3IoaW1hZ2UlMkMlMjB0ZXh0JTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEElMjAlMjAlMjAlMjBvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKiplbmNvZGluZyklMEElMjAlMjAlMjAlMjBzY29yZXMlNUJ0ZXh0JTVEJTIwJTNEJTIwb3V0cHV0cy5sb2dpdHMlNUIwJTJDJTIwMSU1RC5pdGVtKCk=",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()`}}),yo=new ee({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEJyaWRnZVRvd2VyUHJvY2Vzc29yJTJDJTIwQnJpZGdlVG93ZXJGb3JNYXNrZWRMTSUwQWZyb20lMjBQSUwlMjBpbXBvcnQlMjBJbWFnZSUwQWltcG9ydCUyMHJlcXVlc3RzJTBBJTBBdXJsJTIwJTNEJTIwJTIyaHR0cCUzQSUyRiUyRmltYWdlcy5jb2NvZGF0YXNldC5vcmclMkZ2YWwyMDE3JTJGMDAwMDAwMzYwOTQzLmpwZyUyMiUwQWltYWdlJTIwJTNEJTIwSW1hZ2Uub3BlbihyZXF1ZXN0cy5nZXQodXJsJTJDJTIwc3RyZWFtJTNEVHJ1ZSkucmF3KS5jb252ZXJ0KCUyMlJHQiUyMiklMEF0ZXh0JTIwJTNEJTIwJTIyYSUyMCUzQ21hc2slM0UlMjBsb29raW5nJTIwb3V0JTIwb2YlMjB0aGUlMjB3aW5kb3clMjIlMEElMEFwcm9jZXNzb3IlMjAlM0QlMjBCcmlkZ2VUb3dlclByb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyQnJpZGdlVG93ZXIlMkZicmlkZ2V0b3dlci1iYXNlLWl0bS1tbG0lMjIpJTBBbW9kZWwlMjAlM0QlMjBCcmlkZ2VUb3dlckZvck1hc2tlZExNLmZyb21fcHJldHJhaW5lZCglMjJCcmlkZ2VUb3dlciUyRmJyaWRnZXRvd2VyLWJhc2UtaXRtLW1sbSUyMiklMEElMEElMjMlMjBwcmVwYXJlJTIwaW5wdXRzJTBBZW5jb2RpbmclMjAlM0QlMjBwcm9jZXNzb3IoaW1hZ2UlMkMlMjB0ZXh0JTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEElMEElMjMlMjBmb3J3YXJkJTIwcGFzcyUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmVuY29kaW5nKSUwQSUwQXJlc3VsdHMlMjAlM0QlMjBwcm9jZXNzb3IuZGVjb2RlKG91dHB1dHMubG9naXRzLmFyZ21heChkaW0lM0QtMSkuc3F1ZWV6ZSgwKS50b2xpc3QoKSklMEElMEFwcmludChyZXN1bHRzKQ==",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.`}}),Eo=new S({}),Uo=new $({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.30.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.30.0/en/model_doc/bridgetower#transformers.BridgeTowerVisionConfig">BridgeTowerVisionConfig</a>.`,name:"vision_config"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/bridgetower/configuration_bridgetower.py#L250"}}),Ee=new ut({props:{anchor:"transformers.BridgeTowerConfig.example",$$slots:{default:[Bm]},$$scope:{ctx:J}}}),Zo=new $({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.30.0/src/transformers/models/bridgetower/configuration_bridgetower.py#L350"}}),Co=new $({props:{name:"to_dict",anchor:"transformers.BridgeTowerConfig.to_dict",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.30.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>
`}}),Fo=new S({}),Wo=new $({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.30.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.30.0/src/transformers/models/bridgetower/configuration_bridgetower.py#L121"}}),Ce=new ut({props:{anchor:"transformers.BridgeTowerTextConfig.example",$$slots:{default:[km]},$$scope:{ctx:J}}}),No=new S({}),Po=new $({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.30.0/src/transformers/models/bridgetower/configuration_bridgetower.py#L35"}}),Fe=new ut({props:{anchor:"transformers.BridgeTowerVisionConfig.example",$$slots:{default:[Jm]},$$scope:{ctx:J}}}),Go=new S({}),Lo=new $({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.30.0/src/transformers/models/bridgetower/image_processing_bridgetower.py#L114"}}),So=new $({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.30.0/src/transformers/models/bridgetower/image_processing_bridgetower.py#L391"}}),Xo=new S({}),qo=new $({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.30.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.30.0/src/transformers/models/bridgetower/processing_bridgetower.py#L26"}}),Ho=new $({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.30.0/src/transformers/models/bridgetower/processing_bridgetower.py#L48"}}),Do=new S({}),Oo=new $({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.30.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.30.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.30.0/src/transformers/models/bridgetower/modeling_bridgetower.py#L1211"}}),Ko=new $({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.30.0/en/model_doc/bert#transformers.BertTokenizer">BertTokenizer</a>. See
<a href="/docs/transformers/v4.30.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and <a href="/docs/transformers/v4.30.0/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.__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.30.0/en/model_doc/bridgetower#transformers.BridgeTowerImageProcessor">BridgeTowerImageProcessor</a>. See
<a href="/docs/transformers/v4.30.0/en/model_doc/layoutlmv2#transformers.LayoutLMv2FeatureExtractor.__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.30.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.30.0/src/transformers/models/bridgetower/modeling_bridgetower.py#L1268",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.30.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>
`}}),Le=new bs({props:{$$slots:{default:[jm]},$$scope:{ctx:J}}}),Se=new ut({props:{anchor:"transformers.BridgeTowerModel.forward.example",$$slots:{default:[xm]},$$scope:{ctx:J}}}),et=new S({}),ot=new $({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.30.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.30.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.30.0/src/transformers/models/bridgetower/modeling_bridgetower.py#L1768"}}),rt=new $({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.30.0/en/model_doc/bert#transformers.BertTokenizer">BertTokenizer</a>. See
<a href="/docs/transformers/v4.30.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and <a href="/docs/transformers/v4.30.0/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.__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.30.0/en/model_doc/bridgetower#transformers.BridgeTowerImageProcessor">BridgeTowerImageProcessor</a>. See
<a href="/docs/transformers/v4.30.0/en/model_doc/layoutlmv2#transformers.LayoutLMv2FeatureExtractor.__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.30.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.30.0/src/transformers/models/bridgetower/modeling_bridgetower.py#L1782",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.30.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>
`}}),qe=new bs({props:{$$slots:{default:[$m]},$$scope:{ctx:J}}}),Qe=new ut({props:{anchor:"transformers.BridgeTowerForContrastiveLearning.forward.example",$$slots:{default:[Im]},$$scope:{ctx:J}}}),nt=new S({}),st=new $({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.30.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.30.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.30.0/src/transformers/models/bridgetower/modeling_bridgetower.py#L1550"}}),it=new $({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.30.0/en/model_doc/bert#transformers.BertTokenizer">BertTokenizer</a>. See
<a href="/docs/transformers/v4.30.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and <a href="/docs/transformers/v4.30.0/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.__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.30.0/en/model_doc/bridgetower#transformers.BridgeTowerImageProcessor">BridgeTowerImageProcessor</a>. See
<a href="/docs/transformers/v4.30.0/en/model_doc/layoutlmv2#transformers.LayoutLMv2FeatureExtractor.__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.30.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.30.0/src/transformers/models/bridgetower/modeling_bridgetower.py#L1566",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.30.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.30.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.30.0/en/main_classes/output#transformers.modeling_outputs.MaskedLMOutput"
>transformers.modeling_outputs.MaskedLMOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),De=new bs({props:{$$slots:{default:[Em]},$$scope:{ctx:J}}}),Oe=new ut({props:{anchor:"transformers.BridgeTowerForMaskedLM.forward.example",$$slots:{default:[Um]},$$scope:{ctx:J}}}),lt=new S({}),dt=new $({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.30.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.30.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.30.0/src/transformers/models/bridgetower/modeling_bridgetower.py#L1657"}}),mt=new $({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.30.0/en/model_doc/bert#transformers.BertTokenizer">BertTokenizer</a>. See
<a href="/docs/transformers/v4.30.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and <a href="/docs/transformers/v4.30.0/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.__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.30.0/en/model_doc/bridgetower#transformers.BridgeTowerImageProcessor">BridgeTowerImageProcessor</a>. See
<a href="/docs/transformers/v4.30.0/en/model_doc/layoutlmv2#transformers.LayoutLMv2FeatureExtractor.__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.30.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.30.0/src/transformers/models/bridgetower/modeling_bridgetower.py#L1668",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.30.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.30.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.30.0/en/main_classes/output#transformers.modeling_outputs.SequenceClassifierOutput"
>transformers.modeling_outputs.SequenceClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ke=new bs({props:{$$slots:{default:[zm]},$$scope:{ctx:J}}}),eo=new ut({props:{anchor:"transformers.BridgeTowerForImageAndTextRetrieval.forward.example",$$slots:{default:[Zm]},$$scope:{ctx:J}}}),{c(){g=s("meta"),k=c(),w=s("h1"),f=s("a"),_=s("span"),T(l.$$.fragment),u=c(),j=s("span"),ys=r("BridgeTower"),hn=c(),oe=s("h2"),ke=s("a"),wr=s("span"),T(ho.$$.fragment),vs=c(),_r=s("span"),Ms=r("Overview"),fn=c(),Je=s("p"),Bs=r("The BridgeTower model was proposed in "),fo=s("a"),ks=r("BridgeTower: Building Bridges Between Encoders in Vision-Language Representative Learning"),Js=r(` 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.`),un=c(),je=s("p"),js=r("This paper has been accepted to the "),uo=s("a"),xs=r("AAAI\u201923"),$s=r(" conference."),wn=c(),_t=s("p"),Is=r("The abstract from the paper is the following:"),_n=c(),Tt=s("p"),Tr=s("em"),Es=r(`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.`),Tn=c(),xe=s("img"),bn=c(),wo=s("small"),Us=r("BridgeTower architecture. Taken from the "),bt=s("a"),zs=r("original paper."),yn=c(),te=s("h2"),$e=s("a"),br=s("span"),T(_o.$$.fragment),Zs=c(),yr=s("span"),Cs=r("Usage"),vn=c(),yt=s("p"),Rs=r(`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.`),Mn=c(),W=s("p"),Fs=r("The "),vt=s("a"),Ws=r("BridgeTowerProcessor"),Vs=r(" wraps "),Mt=s("a"),Ns=r("RobertaTokenizer"),Ps=r(" and "),Bt=s("a"),As=r("BridgeTowerImageProcessor"),Gs=r(` into a single instance to both
encode the text and prepare the images respectively.`),Bn=c(),H=s("p"),Ls=r("The following example shows how to run contrastive learning using "),kt=s("a"),Ss=r("BridgeTowerProcessor"),Xs=r(" and "),Jt=s("a"),qs=r("BridgeTowerForContrastiveLearning"),Qs=r("."),kn=c(),T(To.$$.fragment),Jn=c(),D=s("p"),Hs=r("The following example shows how to run image-text retrieval using "),jt=s("a"),Ds=r("BridgeTowerProcessor"),Os=r(" and "),xt=s("a"),Ys=r("BridgeTowerForImageAndTextRetrieval"),Ks=r("."),jn=c(),T(bo.$$.fragment),xn=c(),O=s("p"),ea=r("The following example shows how to run masked language modeling using "),$t=s("a"),oa=r("BridgeTowerProcessor"),ta=r(" and "),It=s("a"),ra=r("BridgeTowerForMaskedLM"),na=r("."),$n=c(),T(yo.$$.fragment),In=c(),I=s("p"),sa=r("This model was contributed by "),vo=s("a"),aa=r("Anahita Bhiwandiwalla"),ia=r(", "),Mo=s("a"),la=r("Tiep Le"),da=r(" and "),Bo=s("a"),ca=r("Shaoyen Tseng"),ma=r(". The original code can be found "),ko=s("a"),pa=r("here"),ga=r("."),En=c(),Et=s("p"),ha=r("Tips:"),Un=c(),V=s("ul"),Jo=s("li"),fa=r("This implementation of BridgeTower uses "),Ut=s("a"),ua=r("RobertaTokenizer"),wa=r(" to generate text embeddings and OpenAI\u2019s CLIP/ViT model to compute visual embeddings."),_a=c(),re=s("li"),Ta=r("Checkpoints for pre-trained "),jo=s("a"),ba=r("bridgeTower-base"),ya=r(" and "),xo=s("a"),va=r("bridgetower masked language modeling and image text matching"),Ma=r(" are released."),Ba=c(),$o=s("li"),ka=r("Please refer to "),Io=s("a"),Ja=r("Table 5"),ja=r(" for BridgeTower\u2019s performance on Image Retrieval and other down stream tasks."),xa=c(),vr=s("li"),$a=r("The PyTorch version of this model is only available in torch 1.10 and higher."),zn=c(),ne=s("h2"),Ie=s("a"),Mr=s("span"),T(Eo.$$.fragment),Ia=c(),Br=s("span"),Ea=r("BridgeTowerConfig"),Zn=c(),x=s("div"),T(Uo.$$.fragment),Ua=c(),se=s("p"),za=r("This is the configuration class to store the configuration of a "),zt=s("a"),Za=r("BridgeTowerModel"),Ca=r(`. 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
`),zo=s("a"),Ra=r("BridgeTower/bridgetower-base"),Fa=r(" architecture."),Wa=c(),ae=s("p"),Va=r("Configuration objects inherit from "),Zt=s("a"),Na=r("PretrainedConfig"),Pa=r(` and can be used to control the model outputs. Read the
documentation from `),Ct=s("a"),Aa=r("PretrainedConfig"),Ga=r(" for more information."),La=c(),T(Ee.$$.fragment),Sa=c(),Ue=s("div"),T(Zo.$$.fragment),Xa=c(),ie=s("p"),qa=r("Instantiate a "),Rt=s("a"),Qa=r("BridgeTowerConfig"),Ha=r(` (or a derived class) from BridgeTower text model configuration. Returns:
`),Ft=s("a"),Da=r("BridgeTowerConfig"),Oa=r(": An instance of a configuration object"),Ya=c(),ze=s("div"),T(Co.$$.fragment),Ka=c(),Ro=s("p"),ei=r("Serializes this instance to a Python dictionary. Override the default "),Wt=s("a"),oi=r("to_dict()"),ti=r("."),Cn=c(),le=s("h2"),Ze=s("a"),kr=s("span"),T(Fo.$$.fragment),ri=c(),Jr=s("span"),ni=r("BridgeTowerTextConfig"),Rn=c(),U=s("div"),T(Wo.$$.fragment),si=c(),de=s("p"),ai=r("This is the configuration class to store the text configuration of a "),Vt=s("a"),ii=r("BridgeTowerModel"),li=r(`. 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 `),Vo=s("a"),di=r("BridegTower/bridgetower-base"),ci=r(`
architecture.`),mi=c(),ce=s("p"),pi=r("Configuration objects inherit from "),Nt=s("a"),gi=r("PretrainedConfig"),hi=r(` and can be used to control the model outputs. Read the
documentation from `),Pt=s("a"),fi=r("PretrainedConfig"),ui=r(" for more information."),wi=c(),T(Ce.$$.fragment),Fn=c(),me=s("h2"),Re=s("a"),jr=s("span"),T(No.$$.fragment),_i=c(),xr=s("span"),Ti=r("BridgeTowerVisionConfig"),Wn=c(),z=s("div"),T(Po.$$.fragment),bi=c(),pe=s("p"),yi=r("This is the configuration class to store the vision configuration of a "),At=s("a"),vi=r("BridgeTowerModel"),Mi=r(`. Instantiating a
configuration with the defaults will yield a similar configuration to that of the bridgetower-base
`),Ao=s("a"),Bi=r("BridgeTower/bridgetower-base"),ki=r(" architecture."),Ji=c(),ge=s("p"),ji=r("Configuration objects inherit from "),Gt=s("a"),xi=r("PretrainedConfig"),$i=r(` and can be used to control the model outputs. Read the
documentation from `),Lt=s("a"),Ii=r("PretrainedConfig"),Ei=r(" for more information."),Ui=c(),T(Fe.$$.fragment),Vn=c(),he=s("h2"),We=s("a"),$r=s("span"),T(Go.$$.fragment),zi=c(),Ir=s("span"),Zi=r("BridgeTowerImageProcessor"),Nn=c(),X=s("div"),T(Lo.$$.fragment),Ci=c(),Er=s("p"),Ri=r("Constructs a BridgeTower image processor."),Fi=c(),Ve=s("div"),T(So.$$.fragment),Wi=c(),Ur=s("p"),Vi=r("Preprocess an image or batch of images."),Pn=c(),fe=s("h2"),Ne=s("a"),zr=s("span"),T(Xo.$$.fragment),Ni=c(),Zr=s("span"),Pi=r("BridgeTowerProcessor"),An=c(),Z=s("div"),T(qo.$$.fragment),Ai=c(),Cr=s("p"),Gi=r(`Constructs a BridgeTower processor which wraps a Roberta tokenizer and BridgeTower image processor into a single
processor.`),Li=c(),E=s("p"),St=s("a"),Si=r("BridgeTowerProcessor"),Xi=r(" offers all the functionalities of "),Xt=s("a"),qi=r("BridgeTowerImageProcessor"),Qi=r(` and
`),qt=s("a"),Hi=r("RobertaTokenizerFast"),Di=r(". See the docstring of "),Qo=s("a"),Rr=s("strong"),Oi=r("call"),Yi=r("()"),Ki=r(` and
`),Fr=s("code"),el=r("decode()"),ol=r(" for more information."),tl=c(),Y=s("div"),T(Ho.$$.fragment),rl=c(),ue=s("p"),nl=r("This method uses "),Pe=s("a"),sl=r("BridgeTowerImageProcessor."),Wr=s("strong"),al=r("call"),il=r("()"),ll=r(` method to prepare image(s) for the model, and
`),Ae=s("a"),dl=r("RobertaTokenizerFast."),Vr=s("strong"),cl=r("call"),ml=r("()"),pl=r(" to prepare text for the model."),gl=c(),Nr=s("p"),hl=r("Please refer to the docstring of the above two methods for more information."),Gn=c(),we=s("h2"),Ge=s("a"),Pr=s("span"),T(Do.$$.fragment),fl=c(),Ar=s("span"),ul=r("BridgeTowerModel"),Ln=c(),q=s("div"),T(Oo.$$.fragment),wl=c(),Yo=s("p"),_l=r(`The bare BridgeTower Model transformer outputting BridgeTowerModelOutput object without any specific head on top.
This model is a PyTorch `),Gr=s("code"),Tl=r("torch.nn.Module <https://pytorch.org/docs/stable/nn.html#torch.nn.Module>"),bl=r(`_ subclass. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),yl=c(),N=s("div"),T(Ko.$$.fragment),vl=c(),_e=s("p"),Ml=r("The "),Qt=s("a"),Bl=r("BridgeTowerModel"),kl=r(" forward method, overrides the "),Lr=s("code"),Jl=r("__call__"),jl=r(" special method."),xl=c(),T(Le.$$.fragment),$l=c(),T(Se.$$.fragment),Sn=c(),Te=s("h2"),Xe=s("a"),Sr=s("span"),T(et.$$.fragment),Il=c(),Xr=s("span"),El=r("BridgeTowerForContrastiveLearning"),Xn=c(),C=s("div"),T(ot.$$.fragment),Ul=c(),qr=s("p"),zl=r("BridgeTower Model with a image-text contrastive head on top computing image-text contrastive loss."),Zl=c(),tt=s("p"),Cl=r("This model is a PyTorch "),Qr=s("code"),Rl=r("torch.nn.Module <https://pytorch.org/docs/stable/nn.html#torch.nn.Module>"),Fl=r(`_ 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(),P=s("div"),T(rt.$$.fragment),Vl=c(),be=s("p"),Nl=r("The "),Ht=s("a"),Pl=r("BridgeTowerForContrastiveLearning"),Al=r(" forward method, overrides the "),Hr=s("code"),Gl=r("__call__"),Ll=r(" special method."),Sl=c(),T(qe.$$.fragment),Xl=c(),T(Qe.$$.fragment),qn=c(),ye=s("h2"),He=s("a"),Dr=s("span"),T(nt.$$.fragment),ql=c(),Or=s("span"),Ql=r("BridgeTowerForMaskedLM"),Qn=c(),R=s("div"),T(st.$$.fragment),Hl=c(),Yr=s("p"),Dl=r("BridgeTower Model with a language modeling head on top as done during pretraining."),Ol=c(),at=s("p"),Yl=r("This model is a PyTorch "),Kr=s("code"),Kl=r("torch.nn.Module <https://pytorch.org/docs/stable/nn.html#torch.nn.Module>"),ed=r(`_ 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(),A=s("div"),T(it.$$.fragment),td=c(),ve=s("p"),rd=r("The "),Dt=s("a"),nd=r("BridgeTowerForMaskedLM"),sd=r(" forward method, overrides the "),en=s("code"),ad=r("__call__"),id=r(" special method."),ld=c(),T(De.$$.fragment),dd=c(),T(Oe.$$.fragment),Hn=c(),Me=s("h2"),Ye=s("a"),on=s("span"),T(lt.$$.fragment),cd=c(),tn=s("span"),md=r("BridgeTowerForImageAndTextRetrieval"),Dn=c(),F=s("div"),T(dt.$$.fragment),pd=c(),rn=s("p"),gd=r(`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.`),hd=c(),ct=s("p"),fd=r("This model is a PyTorch "),nn=s("code"),ud=r("torch.nn.Module <https://pytorch.org/docs/stable/nn.html#torch.nn.Module>"),wd=r(`_ subclass. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),_d=c(),G=s("div"),T(mt.$$.fragment),Td=c(),Be=s("p"),bd=r("The "),Ot=s("a"),yd=r("BridgeTowerForImageAndTextRetrieval"),vd=r(" forward method, overrides the "),sn=s("code"),Md=r("__call__"),Bd=r(" special method."),kd=c(),T(Ke.$$.fragment),Jd=c(),T(eo.$$.fragment),this.h()},l(o){const p=ym('[data-svelte="svelte-1phssyn"]',document.head);g=a(p,"META",{name:!0,content:!0}),p.forEach(t),k=m(o),w=a(o,"H1",{class:!0});var pt=i(w);f=a(pt,"A",{id:!0,class:!0,href:!0});var an=i(f);_=a(an,"SPAN",{});var ln=i(_);b(l.$$.fragment,ln),ln.forEach(t),an.forEach(t),u=m(pt),j=a(pt,"SPAN",{});var dn=i(j);ys=n(dn,"BridgeTower"),dn.forEach(t),pt.forEach(t),hn=m(o),oe=a(o,"H2",{class:!0});var gt=i(oe);ke=a(gt,"A",{id:!0,class:!0,href:!0});var cn=i(ke);wr=a(cn,"SPAN",{});var mn=i(wr);b(ho.$$.fragment,mn),mn.forEach(t),cn.forEach(t),vs=m(gt),_r=a(gt,"SPAN",{});var pn=i(_r);Ms=n(pn,"Overview"),pn.forEach(t),gt.forEach(t),fn=m(o),Je=a(o,"P",{});var ht=i(Je);Bs=n(ht,"The BridgeTower model was proposed in "),fo=a(ht,"A",{href:!0,rel:!0});var gn=i(fo);ks=n(gn,"BridgeTower: Building Bridges Between Encoders in Vision-Language Representative Learning"),gn.forEach(t),Js=n(ht,` 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.`),ht.forEach(t),un=m(o),je=a(o,"P",{});var ft=i(je);js=n(ft,"This paper has been accepted to the "),uo=a(ft,"A",{href:!0,rel:!0});var Id=i(uo);xs=n(Id,"AAAI\u201923"),Id.forEach(t),$s=n(ft," conference."),ft.forEach(t),wn=m(o),_t=a(o,"P",{});var Ed=i(_t);Is=n(Ed,"The abstract from the paper is the following:"),Ed.forEach(t),_n=m(o),Tt=a(o,"P",{});var Ud=i(Tt);Tr=a(Ud,"EM",{});var zd=i(Tr);Es=n(zd,`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.`),zd.forEach(t),Ud.forEach(t),Tn=m(o),xe=a(o,"IMG",{src:!0,alt:!0,width:!0}),bn=m(o),wo=a(o,"SMALL",{});var jd=i(wo);Us=n(jd,"BridgeTower architecture. Taken from the "),bt=a(jd,"A",{href:!0});var Zd=i(bt);zs=n(Zd,"original paper."),Zd.forEach(t),jd.forEach(t),yn=m(o),te=a(o,"H2",{class:!0});var Yn=i(te);$e=a(Yn,"A",{id:!0,class:!0,href:!0});var Cd=i($e);br=a(Cd,"SPAN",{});var Rd=i(br);b(_o.$$.fragment,Rd),Rd.forEach(t),Cd.forEach(t),Zs=m(Yn),yr=a(Yn,"SPAN",{});var Fd=i(yr);Cs=n(Fd,"Usage"),Fd.forEach(t),Yn.forEach(t),vn=m(o),yt=a(o,"P",{});var Wd=i(yt);Rs=n(Wd,`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.`),Wd.forEach(t),Mn=m(o),W=a(o,"P",{});var oo=i(W);Fs=n(oo,"The "),vt=a(oo,"A",{href:!0});var Vd=i(vt);Ws=n(Vd,"BridgeTowerProcessor"),Vd.forEach(t),Vs=n(oo," wraps "),Mt=a(oo,"A",{href:!0});var Nd=i(Mt);Ns=n(Nd,"RobertaTokenizer"),Nd.forEach(t),Ps=n(oo," and "),Bt=a(oo,"A",{href:!0});var Pd=i(Bt);As=n(Pd,"BridgeTowerImageProcessor"),Pd.forEach(t),Gs=n(oo,` into a single instance to both
encode the text and prepare the images respectively.`),oo.forEach(t),Bn=m(o),H=a(o,"P",{});var Yt=i(H);Ls=n(Yt,"The following example shows how to run contrastive learning using "),kt=a(Yt,"A",{href:!0});var Ad=i(kt);Ss=n(Ad,"BridgeTowerProcessor"),Ad.forEach(t),Xs=n(Yt," and "),Jt=a(Yt,"A",{href:!0});var Gd=i(Jt);qs=n(Gd,"BridgeTowerForContrastiveLearning"),Gd.forEach(t),Qs=n(Yt,"."),Yt.forEach(t),kn=m(o),b(To.$$.fragment,o),Jn=m(o),D=a(o,"P",{});var Kt=i(D);Hs=n(Kt,"The following example shows how to run image-text retrieval using "),jt=a(Kt,"A",{href:!0});var Ld=i(jt);Ds=n(Ld,"BridgeTowerProcessor"),Ld.forEach(t),Os=n(Kt," and "),xt=a(Kt,"A",{href:!0});var Sd=i(xt);Ys=n(Sd,"BridgeTowerForImageAndTextRetrieval"),Sd.forEach(t),Ks=n(Kt,"."),Kt.forEach(t),jn=m(o),b(bo.$$.fragment,o),xn=m(o),O=a(o,"P",{});var er=i(O);ea=n(er,"The following example shows how to run masked language modeling using "),$t=a(er,"A",{href:!0});var Xd=i($t);oa=n(Xd,"BridgeTowerProcessor"),Xd.forEach(t),ta=n(er," and "),It=a(er,"A",{href:!0});var qd=i(It);ra=n(qd,"BridgeTowerForMaskedLM"),qd.forEach(t),na=n(er,"."),er.forEach(t),$n=m(o),b(yo.$$.fragment,o),In=m(o),I=a(o,"P",{});var K=i(I);sa=n(K,"This model was contributed by "),vo=a(K,"A",{href:!0,rel:!0});var Qd=i(vo);aa=n(Qd,"Anahita Bhiwandiwalla"),Qd.forEach(t),ia=n(K,", "),Mo=a(K,"A",{href:!0,rel:!0});var Hd=i(Mo);la=n(Hd,"Tiep Le"),Hd.forEach(t),da=n(K," and "),Bo=a(K,"A",{href:!0,rel:!0});var Dd=i(Bo);ca=n(Dd,"Shaoyen Tseng"),Dd.forEach(t),ma=n(K,". The original code can be found "),ko=a(K,"A",{href:!0,rel:!0});var Od=i(ko);pa=n(Od,"here"),Od.forEach(t),ga=n(K,"."),K.forEach(t),En=m(o),Et=a(o,"P",{});var Yd=i(Et);ha=n(Yd,"Tips:"),Yd.forEach(t),Un=m(o),V=a(o,"UL",{});var to=i(V);Jo=a(to,"LI",{});var Kn=i(Jo);fa=n(Kn,"This implementation of BridgeTower uses "),Ut=a(Kn,"A",{href:!0});var Kd=i(Ut);ua=n(Kd,"RobertaTokenizer"),Kd.forEach(t),wa=n(Kn," to generate text embeddings and OpenAI\u2019s CLIP/ViT model to compute visual embeddings."),Kn.forEach(t),_a=m(to),re=a(to,"LI",{});var or=i(re);Ta=n(or,"Checkpoints for pre-trained "),jo=a(or,"A",{href:!0,rel:!0});var ec=i(jo);ba=n(ec,"bridgeTower-base"),ec.forEach(t),ya=n(or," and "),xo=a(or,"A",{href:!0,rel:!0});var oc=i(xo);va=n(oc,"bridgetower masked language modeling and image text matching"),oc.forEach(t),Ma=n(or," are released."),or.forEach(t),Ba=m(to),$o=a(to,"LI",{});var es=i($o);ka=n(es,"Please refer to "),Io=a(es,"A",{href:!0,rel:!0});var tc=i(Io);Ja=n(tc,"Table 5"),tc.forEach(t),ja=n(es," for BridgeTower\u2019s performance on Image Retrieval and other down stream tasks."),es.forEach(t),xa=m(to),vr=a(to,"LI",{});var rc=i(vr);$a=n(rc,"The PyTorch version of this model is only available in torch 1.10 and higher."),rc.forEach(t),to.forEach(t),zn=m(o),ne=a(o,"H2",{class:!0});var os=i(ne);Ie=a(os,"A",{id:!0,class:!0,href:!0});var nc=i(Ie);Mr=a(nc,"SPAN",{});var sc=i(Mr);b(Eo.$$.fragment,sc),sc.forEach(t),nc.forEach(t),Ia=m(os),Br=a(os,"SPAN",{});var ac=i(Br);Ea=n(ac,"BridgeTowerConfig"),ac.forEach(t),os.forEach(t),Zn=m(o),x=a(o,"DIV",{class:!0});var L=i(x);b(Uo.$$.fragment,L),Ua=m(L),se=a(L,"P",{});var tr=i(se);za=n(tr,"This is the configuration class to store the configuration of a "),zt=a(tr,"A",{href:!0});var ic=i(zt);Za=n(ic,"BridgeTowerModel"),ic.forEach(t),Ca=n(tr,`. 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
`),zo=a(tr,"A",{href:!0,rel:!0});var lc=i(zo);Ra=n(lc,"BridgeTower/bridgetower-base"),lc.forEach(t),Fa=n(tr," architecture."),tr.forEach(t),Wa=m(L),ae=a(L,"P",{});var rr=i(ae);Va=n(rr,"Configuration objects inherit from "),Zt=a(rr,"A",{href:!0});var dc=i(Zt);Na=n(dc,"PretrainedConfig"),dc.forEach(t),Pa=n(rr,` and can be used to control the model outputs. Read the
documentation from `),Ct=a(rr,"A",{href:!0});var cc=i(Ct);Aa=n(cc,"PretrainedConfig"),cc.forEach(t),Ga=n(rr," for more information."),rr.forEach(t),La=m(L),b(Ee.$$.fragment,L),Sa=m(L),Ue=a(L,"DIV",{class:!0});var ts=i(Ue);b(Zo.$$.fragment,ts),Xa=m(ts),ie=a(ts,"P",{});var nr=i(ie);qa=n(nr,"Instantiate a "),Rt=a(nr,"A",{href:!0});var mc=i(Rt);Qa=n(mc,"BridgeTowerConfig"),mc.forEach(t),Ha=n(nr,` (or a derived class) from BridgeTower text model configuration. Returns:
`),Ft=a(nr,"A",{href:!0});var pc=i(Ft);Da=n(pc,"BridgeTowerConfig"),pc.forEach(t),Oa=n(nr,": An instance of a configuration object"),nr.forEach(t),ts.forEach(t),Ya=m(L),ze=a(L,"DIV",{class:!0});var rs=i(ze);b(Co.$$.fragment,rs),Ka=m(rs),Ro=a(rs,"P",{});var ns=i(Ro);ei=n(ns,"Serializes this instance to a Python dictionary. Override the default "),Wt=a(ns,"A",{href:!0});var gc=i(Wt);oi=n(gc,"to_dict()"),gc.forEach(t),ti=n(ns,"."),ns.forEach(t),rs.forEach(t),L.forEach(t),Cn=m(o),le=a(o,"H2",{class:!0});var ss=i(le);Ze=a(ss,"A",{id:!0,class:!0,href:!0});var hc=i(Ze);kr=a(hc,"SPAN",{});var fc=i(kr);b(Fo.$$.fragment,fc),fc.forEach(t),hc.forEach(t),ri=m(ss),Jr=a(ss,"SPAN",{});var uc=i(Jr);ni=n(uc,"BridgeTowerTextConfig"),uc.forEach(t),ss.forEach(t),Rn=m(o),U=a(o,"DIV",{class:!0});var ro=i(U);b(Wo.$$.fragment,ro),si=m(ro),de=a(ro,"P",{});var sr=i(de);ai=n(sr,"This is the configuration class to store the text configuration of a "),Vt=a(sr,"A",{href:!0});var wc=i(Vt);ii=n(wc,"BridgeTowerModel"),wc.forEach(t),li=n(sr,`. 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 `),Vo=a(sr,"A",{href:!0,rel:!0});var _c=i(Vo);di=n(_c,"BridegTower/bridgetower-base"),_c.forEach(t),ci=n(sr,`
architecture.`),sr.forEach(t),mi=m(ro),ce=a(ro,"P",{});var ar=i(ce);pi=n(ar,"Configuration objects inherit from "),Nt=a(ar,"A",{href:!0});var Tc=i(Nt);gi=n(Tc,"PretrainedConfig"),Tc.forEach(t),hi=n(ar,` and can be used to control the model outputs. Read the
documentation from `),Pt=a(ar,"A",{href:!0});var bc=i(Pt);fi=n(bc,"PretrainedConfig"),bc.forEach(t),ui=n(ar," for more information."),ar.forEach(t),wi=m(ro),b(Ce.$$.fragment,ro),ro.forEach(t),Fn=m(o),me=a(o,"H2",{class:!0});var as=i(me);Re=a(as,"A",{id:!0,class:!0,href:!0});var yc=i(Re);jr=a(yc,"SPAN",{});var vc=i(jr);b(No.$$.fragment,vc),vc.forEach(t),yc.forEach(t),_i=m(as),xr=a(as,"SPAN",{});var Mc=i(xr);Ti=n(Mc,"BridgeTowerVisionConfig"),Mc.forEach(t),as.forEach(t),Wn=m(o),z=a(o,"DIV",{class:!0});var no=i(z);b(Po.$$.fragment,no),bi=m(no),pe=a(no,"P",{});var ir=i(pe);yi=n(ir,"This is the configuration class to store the vision configuration of a "),At=a(ir,"A",{href:!0});var Bc=i(At);vi=n(Bc,"BridgeTowerModel"),Bc.forEach(t),Mi=n(ir,`. Instantiating a
configuration with the defaults will yield a similar configuration to that of the bridgetower-base
`),Ao=a(ir,"A",{href:!0,rel:!0});var kc=i(Ao);Bi=n(kc,"BridgeTower/bridgetower-base"),kc.forEach(t),ki=n(ir," architecture."),ir.forEach(t),Ji=m(no),ge=a(no,"P",{});var lr=i(ge);ji=n(lr,"Configuration objects inherit from "),Gt=a(lr,"A",{href:!0});var Jc=i(Gt);xi=n(Jc,"PretrainedConfig"),Jc.forEach(t),$i=n(lr,` and can be used to control the model outputs. Read the
documentation from `),Lt=a(lr,"A",{href:!0});var jc=i(Lt);Ii=n(jc,"PretrainedConfig"),jc.forEach(t),Ei=n(lr," for more information."),lr.forEach(t),Ui=m(no),b(Fe.$$.fragment,no),no.forEach(t),Vn=m(o),he=a(o,"H2",{class:!0});var is=i(he);We=a(is,"A",{id:!0,class:!0,href:!0});var xc=i(We);$r=a(xc,"SPAN",{});var $c=i($r);b(Go.$$.fragment,$c),$c.forEach(t),xc.forEach(t),zi=m(is),Ir=a(is,"SPAN",{});var Ic=i(Ir);Zi=n(Ic,"BridgeTowerImageProcessor"),Ic.forEach(t),is.forEach(t),Nn=m(o),X=a(o,"DIV",{class:!0});var dr=i(X);b(Lo.$$.fragment,dr),Ci=m(dr),Er=a(dr,"P",{});var Ec=i(Er);Ri=n(Ec,"Constructs a BridgeTower image processor."),Ec.forEach(t),Fi=m(dr),Ve=a(dr,"DIV",{class:!0});var ls=i(Ve);b(So.$$.fragment,ls),Wi=m(ls),Ur=a(ls,"P",{});var Uc=i(Ur);Vi=n(Uc,"Preprocess an image or batch of images."),Uc.forEach(t),ls.forEach(t),dr.forEach(t),Pn=m(o),fe=a(o,"H2",{class:!0});var ds=i(fe);Ne=a(ds,"A",{id:!0,class:!0,href:!0});var zc=i(Ne);zr=a(zc,"SPAN",{});var Zc=i(zr);b(Xo.$$.fragment,Zc),Zc.forEach(t),zc.forEach(t),Ni=m(ds),Zr=a(ds,"SPAN",{});var Cc=i(Zr);Pi=n(Cc,"BridgeTowerProcessor"),Cc.forEach(t),ds.forEach(t),An=m(o),Z=a(o,"DIV",{class:!0});var so=i(Z);b(qo.$$.fragment,so),Ai=m(so),Cr=a(so,"P",{});var Rc=i(Cr);Gi=n(Rc,`Constructs a BridgeTower processor which wraps a Roberta tokenizer and BridgeTower image processor into a single
processor.`),Rc.forEach(t),Li=m(so),E=a(so,"P",{});var Q=i(E);St=a(Q,"A",{href:!0});var Fc=i(St);Si=n(Fc,"BridgeTowerProcessor"),Fc.forEach(t),Xi=n(Q," offers all the functionalities of "),Xt=a(Q,"A",{href:!0});var Wc=i(Xt);qi=n(Wc,"BridgeTowerImageProcessor"),Wc.forEach(t),Qi=n(Q,` and
`),qt=a(Q,"A",{href:!0});var Vc=i(qt);Hi=n(Vc,"RobertaTokenizerFast"),Vc.forEach(t),Di=n(Q,". See the docstring of "),Qo=a(Q,"A",{href:!0});var xd=i(Qo);Rr=a(xd,"STRONG",{});var Nc=i(Rr);Oi=n(Nc,"call"),Nc.forEach(t),Yi=n(xd,"()"),xd.forEach(t),Ki=n(Q,` and
`),Fr=a(Q,"CODE",{});var Pc=i(Fr);el=n(Pc,"decode()"),Pc.forEach(t),ol=n(Q," for more information."),Q.forEach(t),tl=m(so),Y=a(so,"DIV",{class:!0});var cr=i(Y);b(Ho.$$.fragment,cr),rl=m(cr),ue=a(cr,"P",{});var mr=i(ue);nl=n(mr,"This method uses "),Pe=a(mr,"A",{href:!0});var cs=i(Pe);sl=n(cs,"BridgeTowerImageProcessor."),Wr=a(cs,"STRONG",{});var Ac=i(Wr);al=n(Ac,"call"),Ac.forEach(t),il=n(cs,"()"),cs.forEach(t),ll=n(mr,` method to prepare image(s) for the model, and
`),Ae=a(mr,"A",{href:!0});var ms=i(Ae);dl=n(ms,"RobertaTokenizerFast."),Vr=a(ms,"STRONG",{});var Gc=i(Vr);cl=n(Gc,"call"),Gc.forEach(t),ml=n(ms,"()"),ms.forEach(t),pl=n(mr," to prepare text for the model."),mr.forEach(t),gl=m(cr),Nr=a(cr,"P",{});var Lc=i(Nr);hl=n(Lc,"Please refer to the docstring of the above two methods for more information."),Lc.forEach(t),cr.forEach(t),so.forEach(t),Gn=m(o),we=a(o,"H2",{class:!0});var ps=i(we);Ge=a(ps,"A",{id:!0,class:!0,href:!0});var Sc=i(Ge);Pr=a(Sc,"SPAN",{});var Xc=i(Pr);b(Do.$$.fragment,Xc),Xc.forEach(t),Sc.forEach(t),fl=m(ps),Ar=a(ps,"SPAN",{});var qc=i(Ar);ul=n(qc,"BridgeTowerModel"),qc.forEach(t),ps.forEach(t),Ln=m(o),q=a(o,"DIV",{class:!0});var pr=i(q);b(Oo.$$.fragment,pr),wl=m(pr),Yo=a(pr,"P",{});var gs=i(Yo);_l=n(gs,`The bare BridgeTower Model transformer outputting BridgeTowerModelOutput object without any specific head on top.
This model is a PyTorch `),Gr=a(gs,"CODE",{});var Qc=i(Gr);Tl=n(Qc,"torch.nn.Module <https://pytorch.org/docs/stable/nn.html#torch.nn.Module>"),Qc.forEach(t),bl=n(gs,`_ subclass. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),gs.forEach(t),yl=m(pr),N=a(pr,"DIV",{class:!0});var ao=i(N);b(Ko.$$.fragment,ao),vl=m(ao),_e=a(ao,"P",{});var gr=i(_e);Ml=n(gr,"The "),Qt=a(gr,"A",{href:!0});var Hc=i(Qt);Bl=n(Hc,"BridgeTowerModel"),Hc.forEach(t),kl=n(gr," forward method, overrides the "),Lr=a(gr,"CODE",{});var Dc=i(Lr);Jl=n(Dc,"__call__"),Dc.forEach(t),jl=n(gr," special method."),gr.forEach(t),xl=m(ao),b(Le.$$.fragment,ao),$l=m(ao),b(Se.$$.fragment,ao),ao.forEach(t),pr.forEach(t),Sn=m(o),Te=a(o,"H2",{class:!0});var hs=i(Te);Xe=a(hs,"A",{id:!0,class:!0,href:!0});var Oc=i(Xe);Sr=a(Oc,"SPAN",{});var Yc=i(Sr);b(et.$$.fragment,Yc),Yc.forEach(t),Oc.forEach(t),Il=m(hs),Xr=a(hs,"SPAN",{});var Kc=i(Xr);El=n(Kc,"BridgeTowerForContrastiveLearning"),Kc.forEach(t),hs.forEach(t),Xn=m(o),C=a(o,"DIV",{class:!0});var io=i(C);b(ot.$$.fragment,io),Ul=m(io),qr=a(io,"P",{});var em=i(qr);zl=n(em,"BridgeTower Model with a image-text contrastive head on top computing image-text contrastive loss."),em.forEach(t),Zl=m(io),tt=a(io,"P",{});var fs=i(tt);Cl=n(fs,"This model is a PyTorch "),Qr=a(fs,"CODE",{});var om=i(Qr);Rl=n(om,"torch.nn.Module <https://pytorch.org/docs/stable/nn.html#torch.nn.Module>"),om.forEach(t),Fl=n(fs,`_ subclass. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),fs.forEach(t),Wl=m(io),P=a(io,"DIV",{class:!0});var lo=i(P);b(rt.$$.fragment,lo),Vl=m(lo),be=a(lo,"P",{});var hr=i(be);Nl=n(hr,"The "),Ht=a(hr,"A",{href:!0});var tm=i(Ht);Pl=n(tm,"BridgeTowerForContrastiveLearning"),tm.forEach(t),Al=n(hr," forward method, overrides the "),Hr=a(hr,"CODE",{});var rm=i(Hr);Gl=n(rm,"__call__"),rm.forEach(t),Ll=n(hr," special method."),hr.forEach(t),Sl=m(lo),b(qe.$$.fragment,lo),Xl=m(lo),b(Qe.$$.fragment,lo),lo.forEach(t),io.forEach(t),qn=m(o),ye=a(o,"H2",{class:!0});var us=i(ye);He=a(us,"A",{id:!0,class:!0,href:!0});var nm=i(He);Dr=a(nm,"SPAN",{});var sm=i(Dr);b(nt.$$.fragment,sm),sm.forEach(t),nm.forEach(t),ql=m(us),Or=a(us,"SPAN",{});var am=i(Or);Ql=n(am,"BridgeTowerForMaskedLM"),am.forEach(t),us.forEach(t),Qn=m(o),R=a(o,"DIV",{class:!0});var co=i(R);b(st.$$.fragment,co),Hl=m(co),Yr=a(co,"P",{});var im=i(Yr);Dl=n(im,"BridgeTower Model with a language modeling head on top as done during pretraining."),im.forEach(t),Ol=m(co),at=a(co,"P",{});var ws=i(at);Yl=n(ws,"This model is a PyTorch "),Kr=a(ws,"CODE",{});var lm=i(Kr);Kl=n(lm,"torch.nn.Module <https://pytorch.org/docs/stable/nn.html#torch.nn.Module>"),lm.forEach(t),ed=n(ws,`_ subclass. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),ws.forEach(t),od=m(co),A=a(co,"DIV",{class:!0});var mo=i(A);b(it.$$.fragment,mo),td=m(mo),ve=a(mo,"P",{});var fr=i(ve);rd=n(fr,"The "),Dt=a(fr,"A",{href:!0});var dm=i(Dt);nd=n(dm,"BridgeTowerForMaskedLM"),dm.forEach(t),sd=n(fr," forward method, overrides the "),en=a(fr,"CODE",{});var cm=i(en);ad=n(cm,"__call__"),cm.forEach(t),id=n(fr," special method."),fr.forEach(t),ld=m(mo),b(De.$$.fragment,mo),dd=m(mo),b(Oe.$$.fragment,mo),mo.forEach(t),co.forEach(t),Hn=m(o),Me=a(o,"H2",{class:!0});var _s=i(Me);Ye=a(_s,"A",{id:!0,class:!0,href:!0});var mm=i(Ye);on=a(mm,"SPAN",{});var pm=i(on);b(lt.$$.fragment,pm),pm.forEach(t),mm.forEach(t),cd=m(_s),tn=a(_s,"SPAN",{});var gm=i(tn);md=n(gm,"BridgeTowerForImageAndTextRetrieval"),gm.forEach(t),_s.forEach(t),Dn=m(o),F=a(o,"DIV",{class:!0});var po=i(F);b(dt.$$.fragment,po),pd=m(po),rn=a(po,"P",{});var hm=i(rn);gd=n(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(t),hd=m(po),ct=a(po,"P",{});var Ts=i(ct);fd=n(Ts,"This model is a PyTorch "),nn=a(Ts,"CODE",{});var fm=i(nn);ud=n(fm,"torch.nn.Module <https://pytorch.org/docs/stable/nn.html#torch.nn.Module>"),fm.forEach(t),wd=n(Ts,`_ subclass. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Ts.forEach(t),_d=m(po),G=a(po,"DIV",{class:!0});var go=i(G);b(mt.$$.fragment,go),Td=m(go),Be=a(go,"P",{});var ur=i(Be);bd=n(ur,"The "),Ot=a(ur,"A",{href:!0});var um=i(Ot);yd=n(um,"BridgeTowerForImageAndTextRetrieval"),um.forEach(t),vd=n(ur," forward method, overrides the "),sn=a(ur,"CODE",{});var wm=i(sn);Md=n(wm,"__call__"),wm.forEach(t),Bd=n(ur," special method."),ur.forEach(t),kd=m(go),b(Ke.$$.fragment,go),Jd=m(go),b(eo.$$.fragment,go),go.forEach(t),po.forEach(t),this.h()},h(){d(g,"name","hf:doc:metadata"),d(g,"content",JSON.stringify(Rm)),d(f,"id","bridgetower"),d(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"),d(f,"href","#bridgetower"),d(w,"class","relative group"),d(ke,"id","overview"),d(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"),d(ke,"href","#overview"),d(oe,"class","relative group"),d(fo,"href","https://arxiv.org/abs/2206.08657"),d(fo,"rel","nofollow"),d(uo,"href","https://aaai.org/Conferences/AAAI-23/"),d(uo,"rel","nofollow"),vm(xe.src,$d="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/model_doc/bridgetower_architecture%20.jpg")||d(xe,"src",$d),d(xe,"alt","drawing"),d(xe,"width","600"),d(bt,"href","https://arxiv.org/abs/2206.08657"),d($e,"id","usage"),d($e,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d($e,"href","#usage"),d(te,"class","relative group"),d(vt,"href","/docs/transformers/v4.30.0/en/model_doc/bridgetower#transformers.BridgeTowerProcessor"),d(Mt,"href","/docs/transformers/v4.30.0/en/model_doc/roberta#transformers.RobertaTokenizer"),d(Bt,"href","/docs/transformers/v4.30.0/en/model_doc/bridgetower#transformers.BridgeTowerImageProcessor"),d(kt,"href","/docs/transformers/v4.30.0/en/model_doc/bridgetower#transformers.BridgeTowerProcessor"),d(Jt,"href","/docs/transformers/v4.30.0/en/model_doc/bridgetower#transformers.BridgeTowerForContrastiveLearning"),d(jt,"href","/docs/transformers/v4.30.0/en/model_doc/bridgetower#transformers.BridgeTowerProcessor"),d(xt,"href","/docs/transformers/v4.30.0/en/model_doc/bridgetower#transformers.BridgeTowerForImageAndTextRetrieval"),d($t,"href","/docs/transformers/v4.30.0/en/model_doc/bridgetower#transformers.BridgeTowerProcessor"),d(It,"href","/docs/transformers/v4.30.0/en/model_doc/bridgetower#transformers.BridgeTowerForMaskedLM"),d(vo,"href","https://huggingface.co/anahita-b"),d(vo,"rel","nofollow"),d(Mo,"href","https://huggingface.co/Tile"),d(Mo,"rel","nofollow"),d(Bo,"href","https://huggingface.co/shaoyent"),d(Bo,"rel","nofollow"),d(ko,"href","https://github.com/microsoft/BridgeTower"),d(ko,"rel","nofollow"),d(Ut,"href","/docs/transformers/v4.30.0/en/model_doc/roberta#transformers.RobertaTokenizer"),d(jo,"href","https://huggingface.co/BridgeTower/bridgetower-base"),d(jo,"rel","nofollow"),d(xo,"href","https://huggingface.co/BridgeTower/bridgetower-base-itm-mlm"),d(xo,"rel","nofollow"),d(Io,"href","https://arxiv.org/pdf/2206.08657.pdf"),d(Io,"rel","nofollow"),d(Ie,"id","transformers.BridgeTowerConfig"),d(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"),d(Ie,"href","#transformers.BridgeTowerConfig"),d(ne,"class","relative group"),d(zt,"href","/docs/transformers/v4.30.0/en/model_doc/bridgetower#transformers.BridgeTowerModel"),d(zo,"href","https://huggingface.co/BridgeTower/bridgetower-base/"),d(zo,"rel","nofollow"),d(Zt,"href","/docs/transformers/v4.30.0/en/main_classes/configuration#transformers.PretrainedConfig"),d(Ct,"href","/docs/transformers/v4.30.0/en/main_classes/configuration#transformers.PretrainedConfig"),d(Rt,"href","/docs/transformers/v4.30.0/en/model_doc/bridgetower#transformers.BridgeTowerConfig"),d(Ft,"href","/docs/transformers/v4.30.0/en/model_doc/bridgetower#transformers.BridgeTowerConfig"),d(Ue,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Wt,"href","/docs/transformers/v4.30.0/en/main_classes/configuration#transformers.PretrainedConfig.to_dict"),d(ze,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Ze,"id","transformers.BridgeTowerTextConfig"),d(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"),d(Ze,"href","#transformers.BridgeTowerTextConfig"),d(le,"class","relative group"),d(Vt,"href","/docs/transformers/v4.30.0/en/model_doc/bridgetower#transformers.BridgeTowerModel"),d(Vo,"href","https://huggingface.co/BridgeTower/bridgetower-base/"),d(Vo,"rel","nofollow"),d(Nt,"href","/docs/transformers/v4.30.0/en/main_classes/configuration#transformers.PretrainedConfig"),d(Pt,"href","/docs/transformers/v4.30.0/en/main_classes/configuration#transformers.PretrainedConfig"),d(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Re,"id","transformers.BridgeTowerVisionConfig"),d(Re,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(Re,"href","#transformers.BridgeTowerVisionConfig"),d(me,"class","relative group"),d(At,"href","/docs/transformers/v4.30.0/en/model_doc/bridgetower#transformers.BridgeTowerModel"),d(Ao,"href","https://huggingface.co/BridgeTower/bridgetower-base/"),d(Ao,"rel","nofollow"),d(Gt,"href","/docs/transformers/v4.30.0/en/main_classes/configuration#transformers.PretrainedConfig"),d(Lt,"href","/docs/transformers/v4.30.0/en/main_classes/configuration#transformers.PretrainedConfig"),d(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(We,"id","transformers.BridgeTowerImageProcessor"),d(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"),d(We,"href","#transformers.BridgeTowerImageProcessor"),d(he,"class","relative group"),d(Ve,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(X,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Ne,"id","transformers.BridgeTowerProcessor"),d(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"),d(Ne,"href","#transformers.BridgeTowerProcessor"),d(fe,"class","relative group"),d(St,"href","/docs/transformers/v4.30.0/en/model_doc/bridgetower#transformers.BridgeTowerProcessor"),d(Xt,"href","/docs/transformers/v4.30.0/en/model_doc/bridgetower#transformers.BridgeTowerImageProcessor"),d(qt,"href","/docs/transformers/v4.30.0/en/model_doc/roberta#transformers.RobertaTokenizerFast"),d(Qo,"href","/docs/transformers/v4.30.0/en/model_doc/bridgetower#transformers.BridgeTowerProcessor.__call__"),d(Pe,"href","/docs/transformers/v4.30.0/en/model_doc/layoutlmv2#transformers.LayoutLMv2FeatureExtractor.__call__"),d(Ae,"href","/docs/transformers/v4.30.0/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.__call__"),d(Y,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Ge,"id","transformers.BridgeTowerModel"),d(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"),d(Ge,"href","#transformers.BridgeTowerModel"),d(we,"class","relative group"),d(Qt,"href","/docs/transformers/v4.30.0/en/model_doc/bridgetower#transformers.BridgeTowerModel"),d(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Xe,"id","transformers.BridgeTowerForContrastiveLearning"),d(Xe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(Xe,"href","#transformers.BridgeTowerForContrastiveLearning"),d(Te,"class","relative group"),d(Ht,"href","/docs/transformers/v4.30.0/en/model_doc/bridgetower#transformers.BridgeTowerForContrastiveLearning"),d(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(He,"id","transformers.BridgeTowerForMaskedLM"),d(He,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(He,"href","#transformers.BridgeTowerForMaskedLM"),d(ye,"class","relative group"),d(Dt,"href","/docs/transformers/v4.30.0/en/model_doc/bridgetower#transformers.BridgeTowerForMaskedLM"),d(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(R,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Ye,"id","transformers.BridgeTowerForImageAndTextRetrieval"),d(Ye,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(Ye,"href","#transformers.BridgeTowerForImageAndTextRetrieval"),d(Me,"class","relative group"),d(Ot,"href","/docs/transformers/v4.30.0/en/model_doc/bridgetower#transformers.BridgeTowerForImageAndTextRetrieval"),d(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(F,"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,p){e(document.head,g),h(o,k,p),h(o,w,p),e(w,f),e(f,_),y(l,_,null),e(w,u),e(w,j),e(j,ys),h(o,hn,p),h(o,oe,p),e(oe,ke),e(ke,wr),y(ho,wr,null),e(oe,vs),e(oe,_r),e(_r,Ms),h(o,fn,p),h(o,Je,p),e(Je,Bs),e(Je,fo),e(fo,ks),e(Je,Js),h(o,un,p),h(o,je,p),e(je,js),e(je,uo),e(uo,xs),e(je,$s),h(o,wn,p),h(o,_t,p),e(_t,Is),h(o,_n,p),h(o,Tt,p),e(Tt,Tr),e(Tr,Es),h(o,Tn,p),h(o,xe,p),h(o,bn,p),h(o,wo,p),e(wo,Us),e(wo,bt),e(bt,zs),h(o,yn,p),h(o,te,p),e(te,$e),e($e,br),y(_o,br,null),e(te,Zs),e(te,yr),e(yr,Cs),h(o,vn,p),h(o,yt,p),e(yt,Rs),h(o,Mn,p),h(o,W,p),e(W,Fs),e(W,vt),e(vt,Ws),e(W,Vs),e(W,Mt),e(Mt,Ns),e(W,Ps),e(W,Bt),e(Bt,As),e(W,Gs),h(o,Bn,p),h(o,H,p),e(H,Ls),e(H,kt),e(kt,Ss),e(H,Xs),e(H,Jt),e(Jt,qs),e(H,Qs),h(o,kn,p),y(To,o,p),h(o,Jn,p),h(o,D,p),e(D,Hs),e(D,jt),e(jt,Ds),e(D,Os),e(D,xt),e(xt,Ys),e(D,Ks),h(o,jn,p),y(bo,o,p),h(o,xn,p),h(o,O,p),e(O,ea),e(O,$t),e($t,oa),e(O,ta),e(O,It),e(It,ra),e(O,na),h(o,$n,p),y(yo,o,p),h(o,In,p),h(o,I,p),e(I,sa),e(I,vo),e(vo,aa),e(I,ia),e(I,Mo),e(Mo,la),e(I,da),e(I,Bo),e(Bo,ca),e(I,ma),e(I,ko),e(ko,pa),e(I,ga),h(o,En,p),h(o,Et,p),e(Et,ha),h(o,Un,p),h(o,V,p),e(V,Jo),e(Jo,fa),e(Jo,Ut),e(Ut,ua),e(Jo,wa),e(V,_a),e(V,re),e(re,Ta),e(re,jo),e(jo,ba),e(re,ya),e(re,xo),e(xo,va),e(re,Ma),e(V,Ba),e(V,$o),e($o,ka),e($o,Io),e(Io,Ja),e($o,ja),e(V,xa),e(V,vr),e(vr,$a),h(o,zn,p),h(o,ne,p),e(ne,Ie),e(Ie,Mr),y(Eo,Mr,null),e(ne,Ia),e(ne,Br),e(Br,Ea),h(o,Zn,p),h(o,x,p),y(Uo,x,null),e(x,Ua),e(x,se),e(se,za),e(se,zt),e(zt,Za),e(se,Ca),e(se,zo),e(zo,Ra),e(se,Fa),e(x,Wa),e(x,ae),e(ae,Va),e(ae,Zt),e(Zt,Na),e(ae,Pa),e(ae,Ct),e(Ct,Aa),e(ae,Ga),e(x,La),y(Ee,x,null),e(x,Sa),e(x,Ue),y(Zo,Ue,null),e(Ue,Xa),e(Ue,ie),e(ie,qa),e(ie,Rt),e(Rt,Qa),e(ie,Ha),e(ie,Ft),e(Ft,Da),e(ie,Oa),e(x,Ya),e(x,ze),y(Co,ze,null),e(ze,Ka),e(ze,Ro),e(Ro,ei),e(Ro,Wt),e(Wt,oi),e(Ro,ti),h(o,Cn,p),h(o,le,p),e(le,Ze),e(Ze,kr),y(Fo,kr,null),e(le,ri),e(le,Jr),e(Jr,ni),h(o,Rn,p),h(o,U,p),y(Wo,U,null),e(U,si),e(U,de),e(de,ai),e(de,Vt),e(Vt,ii),e(de,li),e(de,Vo),e(Vo,di),e(de,ci),e(U,mi),e(U,ce),e(ce,pi),e(ce,Nt),e(Nt,gi),e(ce,hi),e(ce,Pt),e(Pt,fi),e(ce,ui),e(U,wi),y(Ce,U,null),h(o,Fn,p),h(o,me,p),e(me,Re),e(Re,jr),y(No,jr,null),e(me,_i),e(me,xr),e(xr,Ti),h(o,Wn,p),h(o,z,p),y(Po,z,null),e(z,bi),e(z,pe),e(pe,yi),e(pe,At),e(At,vi),e(pe,Mi),e(pe,Ao),e(Ao,Bi),e(pe,ki),e(z,Ji),e(z,ge),e(ge,ji),e(ge,Gt),e(Gt,xi),e(ge,$i),e(ge,Lt),e(Lt,Ii),e(ge,Ei),e(z,Ui),y(Fe,z,null),h(o,Vn,p),h(o,he,p),e(he,We),e(We,$r),y(Go,$r,null),e(he,zi),e(he,Ir),e(Ir,Zi),h(o,Nn,p),h(o,X,p),y(Lo,X,null),e(X,Ci),e(X,Er),e(Er,Ri),e(X,Fi),e(X,Ve),y(So,Ve,null),e(Ve,Wi),e(Ve,Ur),e(Ur,Vi),h(o,Pn,p),h(o,fe,p),e(fe,Ne),e(Ne,zr),y(Xo,zr,null),e(fe,Ni),e(fe,Zr),e(Zr,Pi),h(o,An,p),h(o,Z,p),y(qo,Z,null),e(Z,Ai),e(Z,Cr),e(Cr,Gi),e(Z,Li),e(Z,E),e(E,St),e(St,Si),e(E,Xi),e(E,Xt),e(Xt,qi),e(E,Qi),e(E,qt),e(qt,Hi),e(E,Di),e(E,Qo),e(Qo,Rr),e(Rr,Oi),e(Qo,Yi),e(E,Ki),e(E,Fr),e(Fr,el),e(E,ol),e(Z,tl),e(Z,Y),y(Ho,Y,null),e(Y,rl),e(Y,ue),e(ue,nl),e(ue,Pe),e(Pe,sl),e(Pe,Wr),e(Wr,al),e(Pe,il),e(ue,ll),e(ue,Ae),e(Ae,dl),e(Ae,Vr),e(Vr,cl),e(Ae,ml),e(ue,pl),e(Y,gl),e(Y,Nr),e(Nr,hl),h(o,Gn,p),h(o,we,p),e(we,Ge),e(Ge,Pr),y(Do,Pr,null),e(we,fl),e(we,Ar),e(Ar,ul),h(o,Ln,p),h(o,q,p),y(Oo,q,null),e(q,wl),e(q,Yo),e(Yo,_l),e(Yo,Gr),e(Gr,Tl),e(Yo,bl),e(q,yl),e(q,N),y(Ko,N,null),e(N,vl),e(N,_e),e(_e,Ml),e(_e,Qt),e(Qt,Bl),e(_e,kl),e(_e,Lr),e(Lr,Jl),e(_e,jl),e(N,xl),y(Le,N,null),e(N,$l),y(Se,N,null),h(o,Sn,p),h(o,Te,p),e(Te,Xe),e(Xe,Sr),y(et,Sr,null),e(Te,Il),e(Te,Xr),e(Xr,El),h(o,Xn,p),h(o,C,p),y(ot,C,null),e(C,Ul),e(C,qr),e(qr,zl),e(C,Zl),e(C,tt),e(tt,Cl),e(tt,Qr),e(Qr,Rl),e(tt,Fl),e(C,Wl),e(C,P),y(rt,P,null),e(P,Vl),e(P,be),e(be,Nl),e(be,Ht),e(Ht,Pl),e(be,Al),e(be,Hr),e(Hr,Gl),e(be,Ll),e(P,Sl),y(qe,P,null),e(P,Xl),y(Qe,P,null),h(o,qn,p),h(o,ye,p),e(ye,He),e(He,Dr),y(nt,Dr,null),e(ye,ql),e(ye,Or),e(Or,Ql),h(o,Qn,p),h(o,R,p),y(st,R,null),e(R,Hl),e(R,Yr),e(Yr,Dl),e(R,Ol),e(R,at),e(at,Yl),e(at,Kr),e(Kr,Kl),e(at,ed),e(R,od),e(R,A),y(it,A,null),e(A,td),e(A,ve),e(ve,rd),e(ve,Dt),e(Dt,nd),e(ve,sd),e(ve,en),e(en,ad),e(ve,id),e(A,ld),y(De,A,null),e(A,dd),y(Oe,A,null),h(o,Hn,p),h(o,Me,p),e(Me,Ye),e(Ye,on),y(lt,on,null),e(Me,cd),e(Me,tn),e(tn,md),h(o,Dn,p),h(o,F,p),y(dt,F,null),e(F,pd),e(F,rn),e(rn,gd),e(F,hd),e(F,ct),e(ct,fd),e(ct,nn),e(nn,ud),e(ct,wd),e(F,_d),e(F,G),y(mt,G,null),e(G,Td),e(G,Be),e(Be,bd),e(Be,Ot),e(Ot,yd),e(Be,vd),e(Be,sn),e(sn,Md),e(Be,Bd),e(G,kd),y(Ke,G,null),e(G,Jd),y(eo,G,null),On=!0},p(o,[p]){const pt={};p&2&&(pt.$$scope={dirty:p,ctx:o}),Ee.$set(pt);const an={};p&2&&(an.$$scope={dirty:p,ctx:o}),Ce.$set(an);const ln={};p&2&&(ln.$$scope={dirty:p,ctx:o}),Fe.$set(ln);const dn={};p&2&&(dn.$$scope={dirty:p,ctx:o}),Le.$set(dn);const gt={};p&2&&(gt.$$scope={dirty:p,ctx:o}),Se.$set(gt);const cn={};p&2&&(cn.$$scope={dirty:p,ctx:o}),qe.$set(cn);const mn={};p&2&&(mn.$$scope={dirty:p,ctx:o}),Qe.$set(mn);const pn={};p&2&&(pn.$$scope={dirty:p,ctx:o}),De.$set(pn);const ht={};p&2&&(ht.$$scope={dirty:p,ctx:o}),Oe.$set(ht);const gn={};p&2&&(gn.$$scope={dirty:p,ctx:o}),Ke.$set(gn);const ft={};p&2&&(ft.$$scope={dirty:p,ctx:o}),eo.$set(ft)},i(o){On||(v(l.$$.fragment,o),v(ho.$$.fragment,o),v(_o.$$.fragment,o),v(To.$$.fragment,o),v(bo.$$.fragment,o),v(yo.$$.fragment,o),v(Eo.$$.fragment,o),v(Uo.$$.fragment,o),v(Ee.$$.fragment,o),v(Zo.$$.fragment,o),v(Co.$$.fragment,o),v(Fo.$$.fragment,o),v(Wo.$$.fragment,o),v(Ce.$$.fragment,o),v(No.$$.fragment,o),v(Po.$$.fragment,o),v(Fe.$$.fragment,o),v(Go.$$.fragment,o),v(Lo.$$.fragment,o),v(So.$$.fragment,o),v(Xo.$$.fragment,o),v(qo.$$.fragment,o),v(Ho.$$.fragment,o),v(Do.$$.fragment,o),v(Oo.$$.fragment,o),v(Ko.$$.fragment,o),v(Le.$$.fragment,o),v(Se.$$.fragment,o),v(et.$$.fragment,o),v(ot.$$.fragment,o),v(rt.$$.fragment,o),v(qe.$$.fragment,o),v(Qe.$$.fragment,o),v(nt.$$.fragment,o),v(st.$$.fragment,o),v(it.$$.fragment,o),v(De.$$.fragment,o),v(Oe.$$.fragment,o),v(lt.$$.fragment,o),v(dt.$$.fragment,o),v(mt.$$.fragment,o),v(Ke.$$.fragment,o),v(eo.$$.fragment,o),On=!0)},o(o){M(l.$$.fragment,o),M(ho.$$.fragment,o),M(_o.$$.fragment,o),M(To.$$.fragment,o),M(bo.$$.fragment,o),M(yo.$$.fragment,o),M(Eo.$$.fragment,o),M(Uo.$$.fragment,o),M(Ee.$$.fragment,o),M(Zo.$$.fragment,o),M(Co.$$.fragment,o),M(Fo.$$.fragment,o),M(Wo.$$.fragment,o),M(Ce.$$.fragment,o),M(No.$$.fragment,o),M(Po.$$.fragment,o),M(Fe.$$.fragment,o),M(Go.$$.fragment,o),M(Lo.$$.fragment,o),M(So.$$.fragment,o),M(Xo.$$.fragment,o),M(qo.$$.fragment,o),M(Ho.$$.fragment,o),M(Do.$$.fragment,o),M(Oo.$$.fragment,o),M(Ko.$$.fragment,o),M(Le.$$.fragment,o),M(Se.$$.fragment,o),M(et.$$.fragment,o),M(ot.$$.fragment,o),M(rt.$$.fragment,o),M(qe.$$.fragment,o),M(Qe.$$.fragment,o),M(nt.$$.fragment,o),M(st.$$.fragment,o),M(it.$$.fragment,o),M(De.$$.fragment,o),M(Oe.$$.fragment,o),M(lt.$$.fragment,o),M(dt.$$.fragment,o),M(mt.$$.fragment,o),M(Ke.$$.fragment,o),M(eo.$$.fragment,o),On=!1},d(o){t(g),o&&t(k),o&&t(w),B(l),o&&t(hn),o&&t(oe),B(ho),o&&t(fn),o&&t(Je),o&&t(un),o&&t(je),o&&t(wn),o&&t(_t),o&&t(_n),o&&t(Tt),o&&t(Tn),o&&t(xe),o&&t(bn),o&&t(wo),o&&t(yn),o&&t(te),B(_o),o&&t(vn),o&&t(yt),o&&t(Mn),o&&t(W),o&&t(Bn),o&&t(H),o&&t(kn),B(To,o),o&&t(Jn),o&&t(D),o&&t(jn),B(bo,o),o&&t(xn),o&&t(O),o&&t($n),B(yo,o),o&&t(In),o&&t(I),o&&t(En),o&&t(Et),o&&t(Un),o&&t(V),o&&t(zn),o&&t(ne),B(Eo),o&&t(Zn),o&&t(x),B(Uo),B(Ee),B(Zo),B(Co),o&&t(Cn),o&&t(le),B(Fo),o&&t(Rn),o&&t(U),B(Wo),B(Ce),o&&t(Fn),o&&t(me),B(No),o&&t(Wn),o&&t(z),B(Po),B(Fe),o&&t(Vn),o&&t(he),B(Go),o&&t(Nn),o&&t(X),B(Lo),B(So),o&&t(Pn),o&&t(fe),B(Xo),o&&t(An),o&&t(Z),B(qo),B(Ho),o&&t(Gn),o&&t(we),B(Do),o&&t(Ln),o&&t(q),B(Oo),B(Ko),B(Le),B(Se),o&&t(Sn),o&&t(Te),B(et),o&&t(Xn),o&&t(C),B(ot),B(rt),B(qe),B(Qe),o&&t(qn),o&&t(ye),B(nt),o&&t(Qn),o&&t(R),B(st),B(it),B(De),B(Oe),o&&t(Hn),o&&t(Me),B(lt),o&&t(Dn),o&&t(F),B(dt),B(mt),B(Ke),B(eo)}}}const Rm={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 Fm(J){return Mm(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Lm extends _m{constructor(g){super();Tm(this,g,Fm,Cm,bm,{})}}export{Lm as default,Rm as metadata};
