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