import{S as Kv,i as ey,s as ty,e as a,k as h,w as y,t as s,M as oy,c as l,d as o,m as f,a as i,x as T,h as r,b as p,N as ny,G as e,g as b,y as w,q as M,o as $,B,v as sy,L as S}from"../../chunks/vendor-hf-doc-builder.js";import{T as G}from"../../chunks/Tip-hf-doc-builder.js";import{D as j}from"../../chunks/Docstring-hf-doc-builder.js";import{C as q}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as F}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as A}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function ry(x){let d,v,u,m,_;return m=new q({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEJsaXBDb25maWclMkMlMjBCbGlwTW9kZWwlMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwQmxpcENvbmZpZyUyMHdpdGglMjBTYWxlc2ZvcmNlJTJGYmxpcC12cWEtYmFzZSUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBCbGlwQ29uZmlnKCklMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwQmxpcFBNb2RlbCUyMCh3aXRoJTIwcmFuZG9tJTIwd2VpZ2h0cyklMjBmcm9tJTIwdGhlJTIwU2FsZXNmb3JjZSUyRmJsaXAtdnFhLWJhc2UlMjBzdHlsZSUyMGNvbmZpZ3VyYXRpb24lMEFtb2RlbCUyMCUzRCUyMEJsaXBNb2RlbChjb25maWd1cmF0aW9uKSUwQSUwQSUyMyUyMEFjY2Vzc2luZyUyMHRoZSUyMG1vZGVsJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBtb2RlbC5jb25maWclMEElMEElMjMlMjBXZSUyMGNhbiUyMGFsc28lMjBpbml0aWFsaXplJTIwYSUyMEJsaXBDb25maWclMjBmcm9tJTIwYSUyMEJsaXBUZXh0Q29uZmlnJTIwYW5kJTIwYSUyMEJsaXBWaXNpb25Db25maWclMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwQkxJUFRleHQlMjBhbmQlMjBCTElQVmlzaW9uJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ190ZXh0JTIwJTNEJTIwQmxpcFRleHRDb25maWcoKSUwQWNvbmZpZ192aXNpb24lMjAlM0QlMjBCbGlwVmlzaW9uQ29uZmlnKCklMEElMEFjb25maWclMjAlM0QlMjBCbGlwQ29uZmlnLmZyb21fdGV4dF92aXNpb25fY29uZmlncyhjb25maWdfdGV4dCUyQyUyMGNvbmZpZ192aXNpb24p",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> BlipConfig, BlipModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a BlipConfig with Salesforce/blip-vqa-base style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = BlipConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a BlipPModel (with random weights) from the Salesforce/blip-vqa-base style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = BlipModel(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

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># We can also initialize a BlipConfig from a BlipTextConfig and a BlipVisionConfig</span>

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a BLIPText and BLIPVision configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>config_text = BlipTextConfig()
<span class="hljs-meta">&gt;&gt;&gt; </span>config_vision = BlipVisionConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span>config = BlipConfig.from_text_vision_configs(config_text, config_vision)`}}),{c(){d=a("p"),v=s("Example:"),u=h(),y(m.$$.fragment)},l(n){d=l(n,"P",{});var c=i(d);v=r(c,"Example:"),c.forEach(o),u=f(n),T(m.$$.fragment,n)},m(n,c){b(n,d,c),e(d,v),b(n,u,c),w(m,n,c),_=!0},p:S,i(n){_||(M(m.$$.fragment,n),_=!0)},o(n){$(m.$$.fragment,n),_=!1},d(n){n&&o(d),n&&o(u),B(m,n)}}}function ay(x){let d,v,u,m,_;return m=new q({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEJsaXBUZXh0Q29uZmlnJTJDJTIwQmxpcFRleHRNb2RlbCUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBCbGlwVGV4dENvbmZpZyUyMHdpdGglMjBTYWxlc2ZvcmNlJTJGYmxpcC12cWEtYmFzZSUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBCbGlwVGV4dENvbmZpZygpJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMEJsaXBUZXh0TW9kZWwlMjAod2l0aCUyMHJhbmRvbSUyMHdlaWdodHMpJTIwZnJvbSUyMHRoZSUyMFNhbGVzZm9yY2UlMkZibGlwLXZxYS1iYXNlJTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBbW9kZWwlMjAlM0QlMjBCbGlwVGV4dE1vZGVsKGNvbmZpZ3VyYXRpb24pJTBBJTBBJTIzJTIwQWNjZXNzaW5nJTIwdGhlJTIwbW9kZWwlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyMG1vZGVsLmNvbmZpZw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> BlipTextConfig, BlipTextModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a BlipTextConfig with Salesforce/blip-vqa-base style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = BlipTextConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a BlipTextModel (with random weights) from the Salesforce/blip-vqa-base style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = BlipTextModel(configuration)

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

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a BlipVisionConfig with Salesforce/blip-vqa-base style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = BlipVisionConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a BlipVisionModel (with random weights) from the Salesforce/blip-vqa-base style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = BlipVisionModel(configuration)

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

<span class="hljs-meta">&gt;&gt;&gt; </span>model = BlipModel.from_pretrained(<span class="hljs-string">&quot;Salesforce/blip-image-captioning-base&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;Salesforce/blip-image-captioning-base&quot;</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>inputs = processor(
<span class="hljs-meta">... </span>    text=[<span class="hljs-string">&quot;a photo of a cat&quot;</span>, <span class="hljs-string">&quot;a photo of a dog&quot;</span>], images=image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>, padding=<span class="hljs-literal">True</span>
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>logits_per_image = outputs.logits_per_image  <span class="hljs-comment"># this is the image-text similarity score</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>probs = logits_per_image.softmax(dim=<span class="hljs-number">1</span>)  <span class="hljs-comment"># we can take the softmax to get the label probabilities</span>`}}),{c(){d=a("p"),v=s("Examples:"),u=h(),y(m.$$.fragment)},l(n){d=l(n,"P",{});var c=i(d);v=r(c,"Examples:"),c.forEach(o),u=f(n),T(m.$$.fragment,n)},m(n,c){b(n,d,c),e(d,v),b(n,u,c),w(m,n,c),_=!0},p:S,i(n){_||(M(m.$$.fragment,n),_=!0)},o(n){$(m.$$.fragment,n),_=!1},d(n){n&&o(d),n&&o(u),B(m,n)}}}function cy(x){let d,v,u,m,_;return{c(){d=a("p"),v=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=a("code"),m=s("Module"),_=s(`
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(n){d=l(n,"P",{});var c=i(d);v=r(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=l(c,"CODE",{});var J=i(u);m=r(J,"Module"),J.forEach(o),_=r(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(o)},m(n,c){b(n,d,c),e(d,v),e(d,u),e(u,m),e(d,_)},d(n){n&&o(d)}}}function py(x){let d,v,u,m,_;return m=new q({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Qcm9jZXNzb3IlMkMlMjBCbGlwTW9kZWwlMEElMEFtb2RlbCUyMCUzRCUyMEJsaXBNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyU2FsZXNmb3JjZSUyRmJsaXAtaW1hZ2UtY2FwdGlvbmluZy1iYXNlJTIyKSUwQXByb2Nlc3NvciUyMCUzRCUyMEF1dG9Qcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMlNhbGVzZm9yY2UlMkZibGlwLWltYWdlLWNhcHRpb25pbmctYmFzZSUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjBwcm9jZXNzb3IodGV4dCUzRCU1QiUyMmElMjBwaG90byUyMG9mJTIwYSUyMGNhdCUyMiUyQyUyMCUyMmElMjBwaG90byUyMG9mJTIwYSUyMGRvZyUyMiU1RCUyQyUyMHBhZGRpbmclM0RUcnVlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEF0ZXh0X2ZlYXR1cmVzJTIwJTNEJTIwbW9kZWwuZ2V0X3RleHRfZmVhdHVyZXMoKippbnB1dHMp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, BlipModel

<span class="hljs-meta">&gt;&gt;&gt; </span>model = BlipModel.from_pretrained(<span class="hljs-string">&quot;Salesforce/blip-image-captioning-base&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;Salesforce/blip-image-captioning-base&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(text=[<span class="hljs-string">&quot;a photo of a cat&quot;</span>, <span class="hljs-string">&quot;a photo of a dog&quot;</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>text_features = model.get_text_features(**inputs)`}}),{c(){d=a("p"),v=s("Examples:"),u=h(),y(m.$$.fragment)},l(n){d=l(n,"P",{});var c=i(d);v=r(c,"Examples:"),c.forEach(o),u=f(n),T(m.$$.fragment,n)},m(n,c){b(n,d,c),e(d,v),b(n,u,c),w(m,n,c),_=!0},p:S,i(n){_||(M(m.$$.fragment,n),_=!0)},o(n){$(m.$$.fragment,n),_=!1},d(n){n&&o(d),n&&o(u),B(m,n)}}}function my(x){let d,v,u,m,_;return{c(){d=a("p"),v=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=a("code"),m=s("Module"),_=s(`
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(n){d=l(n,"P",{});var c=i(d);v=r(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=l(c,"CODE",{});var J=i(u);m=r(J,"Module"),J.forEach(o),_=r(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(o)},m(n,c){b(n,d,c),e(d,v),e(d,u),e(u,m),e(d,_)},d(n){n&&o(d)}}}function hy(x){let d,v,u,m,_;return m=new q({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Byb2Nlc3NvciUyQyUyMEJsaXBNb2RlbCUwQSUwQW1vZGVsJTIwJTNEJTIwQmxpcE1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJTYWxlc2ZvcmNlJTJGYmxpcC1pbWFnZS1jYXB0aW9uaW5nLWJhc2UlMjIpJTBBcHJvY2Vzc29yJTIwJTNEJTIwQXV0b1Byb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyU2FsZXNmb3JjZSUyRmJsaXAtaW1hZ2UtY2FwdGlvbmluZy1iYXNlJTIyKSUwQSUwQXVybCUyMCUzRCUyMCUyMmh0dHAlM0ElMkYlMkZpbWFnZXMuY29jb2RhdGFzZXQub3JnJTJGdmFsMjAxNyUyRjAwMDAwMDAzOTc2OS5qcGclMjIlMEFpbWFnZSUyMCUzRCUyMEltYWdlLm9wZW4ocmVxdWVzdHMuZ2V0KHVybCUyQyUyMHN0cmVhbSUzRFRydWUpLnJhdyklMEElMEFpbnB1dHMlMjAlM0QlMjBwcm9jZXNzb3IoaW1hZ2VzJTNEaW1hZ2UlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQWltYWdlX2ZlYXR1cmVzJTIwJTNEJTIwbW9kZWwuZ2V0X2ltYWdlX2ZlYXR1cmVzKCoqaW5wdXRzKQ==",highlighted:`<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-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, BlipModel

<span class="hljs-meta">&gt;&gt;&gt; </span>model = BlipModel.from_pretrained(<span class="hljs-string">&quot;Salesforce/blip-image-captioning-base&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;Salesforce/blip-image-captioning-base&quot;</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>inputs = processor(images=image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>image_features = model.get_image_features(**inputs)`}}),{c(){d=a("p"),v=s("Examples:"),u=h(),y(m.$$.fragment)},l(n){d=l(n,"P",{});var c=i(d);v=r(c,"Examples:"),c.forEach(o),u=f(n),T(m.$$.fragment,n)},m(n,c){b(n,d,c),e(d,v),b(n,u,c),w(m,n,c),_=!0},p:S,i(n){_||(M(m.$$.fragment,n),_=!0)},o(n){$(m.$$.fragment,n),_=!1},d(n){n&&o(d),n&&o(u),B(m,n)}}}function fy(x){let d,v,u,m,_;return{c(){d=a("p"),v=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=a("code"),m=s("Module"),_=s(`
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(n){d=l(n,"P",{});var c=i(d);v=r(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=l(c,"CODE",{});var J=i(u);m=r(J,"Module"),J.forEach(o),_=r(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(o)},m(n,c){b(n,d,c),e(d,v),e(d,u),e(u,m),e(d,_)},d(n){n&&o(d)}}}function uy(x){let d,v,u,m,_;return{c(){d=a("p"),v=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=a("code"),m=s("Module"),_=s(`
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(n){d=l(n,"P",{});var c=i(d);v=r(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=l(c,"CODE",{});var J=i(u);m=r(J,"Module"),J.forEach(o),_=r(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(o)},m(n,c){b(n,d,c),e(d,v),e(d,u),e(u,m),e(d,_)},d(n){n&&o(d)}}}function gy(x){let d,v,u,m,_;return m=new q({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Byb2Nlc3NvciUyQyUyMEJsaXBGb3JDb25kaXRpb25hbEdlbmVyYXRpb24lMEElMEFwcm9jZXNzb3IlMjAlM0QlMjBBdXRvUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJTYWxlc2ZvcmNlJTJGYmxpcC1pbWFnZS1jYXB0aW9uaW5nLWJhc2UlMjIpJTBBbW9kZWwlMjAlM0QlMjBCbGlwRm9yQ29uZGl0aW9uYWxHZW5lcmF0aW9uLmZyb21fcHJldHJhaW5lZCglMjJTYWxlc2ZvcmNlJTJGYmxpcC1pbWFnZS1jYXB0aW9uaW5nLWJhc2UlMjIpJTBBJTBBdXJsJTIwJTNEJTIwJTIyaHR0cCUzQSUyRiUyRmltYWdlcy5jb2NvZGF0YXNldC5vcmclMkZ2YWwyMDE3JTJGMDAwMDAwMDM5NzY5LmpwZyUyMiUwQWltYWdlJTIwJTNEJTIwSW1hZ2Uub3BlbihyZXF1ZXN0cy5nZXQodXJsJTJDJTIwc3RyZWFtJTNEVHJ1ZSkucmF3KSUwQXRleHQlMjAlM0QlMjAlMjJBJTIwcGljdHVyZSUyMG9mJTIyJTBBJTBBaW5wdXRzJTIwJTNEJTIwcHJvY2Vzc29yKGltYWdlcyUzRGltYWdlJTJDJTIwdGV4dCUzRHRleHQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyk=",highlighted:`<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-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, BlipForConditionalGeneration

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;Salesforce/blip-image-captioning-base&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = BlipForConditionalGeneration.from_pretrained(<span class="hljs-string">&quot;Salesforce/blip-image-captioning-base&quot;</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;A picture of&quot;</span>

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

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)`}}),{c(){d=a("p"),v=s("Examples:"),u=h(),y(m.$$.fragment)},l(n){d=l(n,"P",{});var c=i(d);v=r(c,"Examples:"),c.forEach(o),u=f(n),T(m.$$.fragment,n)},m(n,c){b(n,d,c),e(d,v),b(n,u,c),w(m,n,c),_=!0},p:S,i(n){_||(M(m.$$.fragment,n),_=!0)},o(n){$(m.$$.fragment,n),_=!1},d(n){n&&o(d),n&&o(u),B(m,n)}}}function _y(x){let d,v,u,m,_;return{c(){d=a("p"),v=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=a("code"),m=s("Module"),_=s(`
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(n){d=l(n,"P",{});var c=i(d);v=r(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=l(c,"CODE",{});var J=i(u);m=r(J,"Module"),J.forEach(o),_=r(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(o)},m(n,c){b(n,d,c),e(d,v),e(d,u),e(u,m),e(d,_)},d(n){n&&o(d)}}}function by(x){let d,v,u,m,_;return m=new q({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Byb2Nlc3NvciUyQyUyMEJsaXBGb3JJbWFnZVRleHRSZXRyaWV2YWwlMEElMEFtb2RlbCUyMCUzRCUyMEJsaXBGb3JJbWFnZVRleHRSZXRyaWV2YWwuZnJvbV9wcmV0cmFpbmVkKCUyMlNhbGVzZm9yY2UlMkZibGlwLWl0bS1iYXNlLWNvY28lMjIpJTBBcHJvY2Vzc29yJTIwJTNEJTIwQXV0b1Byb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyU2FsZXNmb3JjZSUyRmJsaXAtaXRtLWJhc2UtY29jbyUyMiklMEElMEF1cmwlMjAlM0QlMjAlMjJodHRwJTNBJTJGJTJGaW1hZ2VzLmNvY29kYXRhc2V0Lm9yZyUyRnZhbDIwMTclMkYwMDAwMDAwMzk3NjkuanBnJTIyJTBBaW1hZ2UlMjAlM0QlMjBJbWFnZS5vcGVuKHJlcXVlc3RzLmdldCh1cmwlMkMlMjBzdHJlYW0lM0RUcnVlKS5yYXcpJTBBdGV4dCUyMCUzRCUyMCUyMmFuJTIwaW1hZ2UlMjBvZiUyMGElMjBjYXQlMjIlMEElMEFpbnB1dHMlMjAlM0QlMjBwcm9jZXNzb3IoaW1hZ2VzJTNEaW1hZ2UlMkMlMjB0ZXh0JTNEdGV4dCUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKQ==",highlighted:`<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-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, BlipForImageTextRetrieval

<span class="hljs-meta">&gt;&gt;&gt; </span>model = BlipForImageTextRetrieval.from_pretrained(<span class="hljs-string">&quot;Salesforce/blip-itm-base-coco&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;Salesforce/blip-itm-base-coco&quot;</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;an image of a cat&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(images=image, text=text, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)`}}),{c(){d=a("p"),v=s("Examples:"),u=h(),y(m.$$.fragment)},l(n){d=l(n,"P",{});var c=i(d);v=r(c,"Examples:"),c.forEach(o),u=f(n),T(m.$$.fragment,n)},m(n,c){b(n,d,c),e(d,v),b(n,u,c),w(m,n,c),_=!0},p:S,i(n){_||(M(m.$$.fragment,n),_=!0)},o(n){$(m.$$.fragment,n),_=!1},d(n){n&&o(d),n&&o(u),B(m,n)}}}function vy(x){let d,v,u,m,_;return{c(){d=a("p"),v=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=a("code"),m=s("Module"),_=s(`
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(n){d=l(n,"P",{});var c=i(d);v=r(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=l(c,"CODE",{});var J=i(u);m=r(J,"Module"),J.forEach(o),_=r(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(o)},m(n,c){b(n,d,c),e(d,v),e(d,u),e(u,m),e(d,_)},d(n){n&&o(d)}}}function yy(x){let d,v,u,m,_;return m=new q({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Byb2Nlc3NvciUyQyUyMEJsaXBGb3JRdWVzdGlvbkFuc3dlcmluZyUwQSUwQW1vZGVsJTIwJTNEJTIwQmxpcEZvclF1ZXN0aW9uQW5zd2VyaW5nLmZyb21fcHJldHJhaW5lZCglMjJTYWxlc2ZvcmNlJTJGYmxpcC12cWEtYmFzZSUyMiklMEFwcm9jZXNzb3IlMjAlM0QlMjBBdXRvUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJTYWxlc2ZvcmNlJTJGYmxpcC12cWEtYmFzZSUyMiklMEElMEF1cmwlMjAlM0QlMjAlMjJodHRwJTNBJTJGJTJGaW1hZ2VzLmNvY29kYXRhc2V0Lm9yZyUyRnZhbDIwMTclMkYwMDAwMDAwMzk3NjkuanBnJTIyJTBBaW1hZ2UlMjAlM0QlMjBJbWFnZS5vcGVuKHJlcXVlc3RzLmdldCh1cmwlMkMlMjBzdHJlYW0lM0RUcnVlKS5yYXcpJTBBJTBBJTIzJTIwdHJhaW5pbmclMEF0ZXh0JTIwJTNEJTIwJTIySG93JTIwbWFueSUyMGNhdHMlMjBhcmUlMjBpbiUyMHRoZSUyMHBpY3R1cmUlM0YlMjIlMEFsYWJlbCUyMCUzRCUyMCUyMjIlMjIlMEFpbnB1dHMlMjAlM0QlMjBwcm9jZXNzb3IoaW1hZ2VzJTNEaW1hZ2UlMkMlMjB0ZXh0JTNEdGV4dCUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBbGFiZWxzJTIwJTNEJTIwcHJvY2Vzc29yKHRleHQlM0RsYWJlbCUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpLmlucHV0X2lkcyUwQSUwQWlucHV0cyU1QiUyMmxhYmVscyUyMiU1RCUyMCUzRCUyMGxhYmVscyUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyklMEFsb3NzJTIwJTNEJTIwb3V0cHV0cy5sb3NzJTBBbG9zcy5iYWNrd2FyZCgpJTBBJTBBJTIzJTIwaW5mZXJlbmNlJTBBdGV4dCUyMCUzRCUyMCUyMkhvdyUyMG1hbnklMjBjYXRzJTIwYXJlJTIwaW4lMjB0aGUlMjBwaWN0dXJlJTNGJTIyJTBBaW5wdXRzJTIwJTNEJTIwcHJvY2Vzc29yKGltYWdlcyUzRGltYWdlJTJDJTIwdGV4dCUzRHRleHQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbC5nZW5lcmF0ZSgqKmlucHV0cyklMEFwcmludChwcm9jZXNzb3IuZGVjb2RlKG91dHB1dHMlNUIwJTVEJTJDJTIwc2tpcF9zcGVjaWFsX3Rva2VucyUzRFRydWUpKQ==",highlighted:`<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-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, BlipForQuestionAnswering

<span class="hljs-meta">&gt;&gt;&gt; </span>model = BlipForQuestionAnswering.from_pretrained(<span class="hljs-string">&quot;Salesforce/blip-vqa-base&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;Salesforce/blip-vqa-base&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000039769.jpg&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = Image.<span class="hljs-built_in">open</span>(requests.get(url, stream=<span class="hljs-literal">True</span>).raw)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># training</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>text = <span class="hljs-string">&quot;How many cats are in the picture?&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>label = <span class="hljs-string">&quot;2&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(images=image, text=text, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>labels = processor(text=label, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).input_ids

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs[<span class="hljs-string">&quot;labels&quot;</span>] = labels
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = outputs.loss
<span class="hljs-meta">&gt;&gt;&gt; </span>loss.backward()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># inference</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>text = <span class="hljs-string">&quot;How many cats are in the picture?&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(images=image, text=text, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model.generate(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(processor.decode(outputs[<span class="hljs-number">0</span>], skip_special_tokens=<span class="hljs-literal">True</span>))
<span class="hljs-number">2</span>`}}),{c(){d=a("p"),v=s("Examples:"),u=h(),y(m.$$.fragment)},l(n){d=l(n,"P",{});var c=i(d);v=r(c,"Examples:"),c.forEach(o),u=f(n),T(m.$$.fragment,n)},m(n,c){b(n,d,c),e(d,v),b(n,u,c),w(m,n,c),_=!0},p:S,i(n){_||(M(m.$$.fragment,n),_=!0)},o(n){$(m.$$.fragment,n),_=!1},d(n){n&&o(d),n&&o(u),B(m,n)}}}function Ty(x){let d,v,u,m,_;return{c(){d=a("p"),v=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=a("code"),m=s("Module"),_=s(`
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(n){d=l(n,"P",{});var c=i(d);v=r(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=l(c,"CODE",{});var J=i(u);m=r(J,"Module"),J.forEach(o),_=r(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(o)},m(n,c){b(n,d,c),e(d,v),e(d,u),e(u,m),e(d,_)},d(n){n&&o(d)}}}function wy(x){let d,v,u,m,_;return m=new q({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Byb2Nlc3NvciUyQyUyMFRGQmxpcE1vZGVsJTBBJTBBbW9kZWwlMjAlM0QlMjBURkJsaXBNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyU2FsZXNmb3JjZSUyRmJsaXAtaW1hZ2UtY2FwdGlvbmluZy1iYXNlJTIyKSUwQXByb2Nlc3NvciUyMCUzRCUyMEF1dG9Qcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMlNhbGVzZm9yY2UlMkZibGlwLWltYWdlLWNhcHRpb25pbmctYmFzZSUyMiklMEElMEF1cmwlMjAlM0QlMjAlMjJodHRwJTNBJTJGJTJGaW1hZ2VzLmNvY29kYXRhc2V0Lm9yZyUyRnZhbDIwMTclMkYwMDAwMDAwMzk3NjkuanBnJTIyJTBBaW1hZ2UlMjAlM0QlMjBJbWFnZS5vcGVuKHJlcXVlc3RzLmdldCh1cmwlMkMlMjBzdHJlYW0lM0RUcnVlKS5yYXcpJTBBJTBBaW5wdXRzJTIwJTNEJTIwcHJvY2Vzc29yKCUwQSUyMCUyMCUyMCUyMHRleHQlM0QlNUIlMjJhJTIwcGhvdG8lMjBvZiUyMGElMjBjYXQlMjIlMkMlMjAlMjJhJTIwcGhvdG8lMjBvZiUyMGElMjBkb2clMjIlNUQlMkMlMjBpbWFnZXMlM0RpbWFnZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIydGYlMjIlMkMlMjBwYWRkaW5nJTNEVHJ1ZSUwQSklMEElMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpJTBBbG9naXRzX3Blcl9pbWFnZSUyMCUzRCUyMG91dHB1dHMubG9naXRzX3Blcl9pbWFnZSUyMCUyMCUyMyUyMHRoaXMlMjBpcyUyMHRoZSUyMGltYWdlLXRleHQlMjBzaW1pbGFyaXR5JTIwc2NvcmUlMEFwcm9icyUyMCUzRCUyMHRmLm5uLnNvZnRtYXgobG9naXRzX3Blcl9pbWFnZSUyQyUyMGF4aXMlM0QxKSUyMCUyMCUyMyUyMHdlJTIwY2FuJTIwdGFrZSUyMHRoZSUyMHNvZnRtYXglMjB0byUyMGdldCUyMHRoZSUyMGxhYmVsJTIwcHJvYmFiaWxpdGllcw==",highlighted:`<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-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, TFBlipModel

<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFBlipModel.from_pretrained(<span class="hljs-string">&quot;Salesforce/blip-image-captioning-base&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;Salesforce/blip-image-captioning-base&quot;</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>inputs = processor(
<span class="hljs-meta">... </span>    text=[<span class="hljs-string">&quot;a photo of a cat&quot;</span>, <span class="hljs-string">&quot;a photo of a dog&quot;</span>], images=image, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>, padding=<span class="hljs-literal">True</span>
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>logits_per_image = outputs.logits_per_image  <span class="hljs-comment"># this is the image-text similarity score</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>probs = tf.nn.softmax(logits_per_image, axis=<span class="hljs-number">1</span>)  <span class="hljs-comment"># we can take the softmax to get the label probabilities</span>`}}),{c(){d=a("p"),v=s("Examples:"),u=h(),y(m.$$.fragment)},l(n){d=l(n,"P",{});var c=i(d);v=r(c,"Examples:"),c.forEach(o),u=f(n),T(m.$$.fragment,n)},m(n,c){b(n,d,c),e(d,v),b(n,u,c),w(m,n,c),_=!0},p:S,i(n){_||(M(m.$$.fragment,n),_=!0)},o(n){$(m.$$.fragment,n),_=!1},d(n){n&&o(d),n&&o(u),B(m,n)}}}function My(x){let d,v,u,m,_;return{c(){d=a("p"),v=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=a("code"),m=s("Module"),_=s(`
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(n){d=l(n,"P",{});var c=i(d);v=r(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=l(c,"CODE",{});var J=i(u);m=r(J,"Module"),J.forEach(o),_=r(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(o)},m(n,c){b(n,d,c),e(d,v),e(d,u),e(u,m),e(d,_)},d(n){n&&o(d)}}}function $y(x){let d,v,u,m,_;return m=new q({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Qcm9jZXNzb3IlMkMlMjBURkJsaXBNb2RlbCUwQSUwQW1vZGVsJTIwJTNEJTIwVEZCbGlwTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMlNhbGVzZm9yY2UlMkZibGlwLWltYWdlLWNhcHRpb25pbmctYmFzZSUyMiklMEFwcm9jZXNzb3IlMjAlM0QlMjBBdXRvUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJTYWxlc2ZvcmNlJTJGYmxpcC1pbWFnZS1jYXB0aW9uaW5nLWJhc2UlMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwcHJvY2Vzc29yKHRleHQlM0QlNUIlMjJhJTIwcGhvdG8lMjBvZiUyMGElMjBjYXQlMjIlMkMlMjAlMjJhJTIwcGhvdG8lMjBvZiUyMGElMjBkb2clMjIlNUQlMkMlMjBwYWRkaW5nJTNEVHJ1ZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIydGYlMjIpJTBBdGV4dF9mZWF0dXJlcyUyMCUzRCUyMG1vZGVsLmdldF90ZXh0X2ZlYXR1cmVzKCoqaW5wdXRzKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, TFBlipModel

<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFBlipModel.from_pretrained(<span class="hljs-string">&quot;Salesforce/blip-image-captioning-base&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;Salesforce/blip-image-captioning-base&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(text=[<span class="hljs-string">&quot;a photo of a cat&quot;</span>, <span class="hljs-string">&quot;a photo of a dog&quot;</span>], padding=<span class="hljs-literal">True</span>, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>text_features = model.get_text_features(**inputs)`}}),{c(){d=a("p"),v=s("Examples:"),u=h(),y(m.$$.fragment)},l(n){d=l(n,"P",{});var c=i(d);v=r(c,"Examples:"),c.forEach(o),u=f(n),T(m.$$.fragment,n)},m(n,c){b(n,d,c),e(d,v),b(n,u,c),w(m,n,c),_=!0},p:S,i(n){_||(M(m.$$.fragment,n),_=!0)},o(n){$(m.$$.fragment,n),_=!1},d(n){n&&o(d),n&&o(u),B(m,n)}}}function By(x){let d,v,u,m,_;return{c(){d=a("p"),v=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=a("code"),m=s("Module"),_=s(`
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(n){d=l(n,"P",{});var c=i(d);v=r(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=l(c,"CODE",{});var J=i(u);m=r(J,"Module"),J.forEach(o),_=r(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(o)},m(n,c){b(n,d,c),e(d,v),e(d,u),e(u,m),e(d,_)},d(n){n&&o(d)}}}function xy(x){let d,v,u,m,_;return m=new q({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Byb2Nlc3NvciUyQyUyMFRGQmxpcE1vZGVsJTBBJTBBbW9kZWwlMjAlM0QlMjBURkJsaXBNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyU2FsZXNmb3JjZSUyRmJsaXAtaW1hZ2UtY2FwdGlvbmluZy1iYXNlJTIyKSUwQXByb2Nlc3NvciUyMCUzRCUyMEF1dG9Qcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMlNhbGVzZm9yY2UlMkZibGlwLWltYWdlLWNhcHRpb25pbmctYmFzZSUyMiklMEElMEF1cmwlMjAlM0QlMjAlMjJodHRwJTNBJTJGJTJGaW1hZ2VzLmNvY29kYXRhc2V0Lm9yZyUyRnZhbDIwMTclMkYwMDAwMDAwMzk3NjkuanBnJTIyJTBBaW1hZ2UlMjAlM0QlMjBJbWFnZS5vcGVuKHJlcXVlc3RzLmdldCh1cmwlMkMlMjBzdHJlYW0lM0RUcnVlKS5yYXcpJTBBJTBBaW5wdXRzJTIwJTNEJTIwcHJvY2Vzc29yKGltYWdlcyUzRGltYWdlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJ0ZiUyMiklMEElMEFpbWFnZV9mZWF0dXJlcyUyMCUzRCUyMG1vZGVsLmdldF9pbWFnZV9mZWF0dXJlcygqKmlucHV0cyk=",highlighted:`<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-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, TFBlipModel

<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFBlipModel.from_pretrained(<span class="hljs-string">&quot;Salesforce/blip-image-captioning-base&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;Salesforce/blip-image-captioning-base&quot;</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>inputs = processor(images=image, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>image_features = model.get_image_features(**inputs)`}}),{c(){d=a("p"),v=s("Examples:"),u=h(),y(m.$$.fragment)},l(n){d=l(n,"P",{});var c=i(d);v=r(c,"Examples:"),c.forEach(o),u=f(n),T(m.$$.fragment,n)},m(n,c){b(n,d,c),e(d,v),b(n,u,c),w(m,n,c),_=!0},p:S,i(n){_||(M(m.$$.fragment,n),_=!0)},o(n){$(m.$$.fragment,n),_=!1},d(n){n&&o(d),n&&o(u),B(m,n)}}}function Jy(x){let d,v,u,m,_;return{c(){d=a("p"),v=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=a("code"),m=s("Module"),_=s(`
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(n){d=l(n,"P",{});var c=i(d);v=r(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=l(c,"CODE",{});var J=i(u);m=r(J,"Module"),J.forEach(o),_=r(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(o)},m(n,c){b(n,d,c),e(d,v),e(d,u),e(u,m),e(d,_)},d(n){n&&o(d)}}}function jy(x){let d,v,u,m,_;return{c(){d=a("p"),v=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=a("code"),m=s("Module"),_=s(`
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(n){d=l(n,"P",{});var c=i(d);v=r(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=l(c,"CODE",{});var J=i(u);m=r(J,"Module"),J.forEach(o),_=r(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(o)},m(n,c){b(n,d,c),e(d,v),e(d,u),e(u,m),e(d,_)},d(n){n&&o(d)}}}function Ey(x){let d,v,u,m,_;return{c(){d=a("p"),v=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=a("code"),m=s("Module"),_=s(`
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(n){d=l(n,"P",{});var c=i(d);v=r(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=l(c,"CODE",{});var J=i(u);m=r(J,"Module"),J.forEach(o),_=r(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(o)},m(n,c){b(n,d,c),e(d,v),e(d,u),e(u,m),e(d,_)},d(n){n&&o(d)}}}function Iy(x){let d,v,u,m,_;return m=new q({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Byb2Nlc3NvciUyQyUyMFRGQmxpcEZvckNvbmRpdGlvbmFsR2VuZXJhdGlvbiUwQSUwQXByb2Nlc3NvciUyMCUzRCUyMEF1dG9Qcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMlNhbGVzZm9yY2UlMkZibGlwLWltYWdlLWNhcHRpb25pbmctYmFzZSUyMiklMEFtb2RlbCUyMCUzRCUyMFRGQmxpcEZvckNvbmRpdGlvbmFsR2VuZXJhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyU2FsZXNmb3JjZSUyRmJsaXAtaW1hZ2UtY2FwdGlvbmluZy1iYXNlJTIyKSUwQSUwQXVybCUyMCUzRCUyMCUyMmh0dHAlM0ElMkYlMkZpbWFnZXMuY29jb2RhdGFzZXQub3JnJTJGdmFsMjAxNyUyRjAwMDAwMDAzOTc2OS5qcGclMjIlMEFpbWFnZSUyMCUzRCUyMEltYWdlLm9wZW4ocmVxdWVzdHMuZ2V0KHVybCUyQyUyMHN0cmVhbSUzRFRydWUpLnJhdyklMEF0ZXh0JTIwJTNEJTIwJTIyQSUyMHBpY3R1cmUlMjBvZiUyMiUwQSUwQWlucHV0cyUyMCUzRCUyMHByb2Nlc3NvcihpbWFnZXMlM0RpbWFnZSUyQyUyMHRleHQlM0R0ZXh0JTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJ0ZiUyMiklMEElMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMp",highlighted:`<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-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, TFBlipForConditionalGeneration

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;Salesforce/blip-image-captioning-base&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFBlipForConditionalGeneration.from_pretrained(<span class="hljs-string">&quot;Salesforce/blip-image-captioning-base&quot;</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;A picture of&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(images=image, text=text, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)`}}),{c(){d=a("p"),v=s("Examples:"),u=h(),y(m.$$.fragment)},l(n){d=l(n,"P",{});var c=i(d);v=r(c,"Examples:"),c.forEach(o),u=f(n),T(m.$$.fragment,n)},m(n,c){b(n,d,c),e(d,v),b(n,u,c),w(m,n,c),_=!0},p:S,i(n){_||(M(m.$$.fragment,n),_=!0)},o(n){$(m.$$.fragment,n),_=!1},d(n){n&&o(d),n&&o(u),B(m,n)}}}function Fy(x){let d,v,u,m,_;return{c(){d=a("p"),v=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=a("code"),m=s("Module"),_=s(`
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(n){d=l(n,"P",{});var c=i(d);v=r(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=l(c,"CODE",{});var J=i(u);m=r(J,"Module"),J.forEach(o),_=r(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(o)},m(n,c){b(n,d,c),e(d,v),e(d,u),e(u,m),e(d,_)},d(n){n&&o(d)}}}function ky(x){let d,v,u,m,_;return m=new q({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Byb2Nlc3NvciUyQyUyMFRGQmxpcEZvckltYWdlVGV4dFJldHJpZXZhbCUwQSUwQW1vZGVsJTIwJTNEJTIwVEZCbGlwRm9ySW1hZ2VUZXh0UmV0cmlldmFsLmZyb21fcHJldHJhaW5lZCglMjJTYWxlc2ZvcmNlJTJGYmxpcC1pdG0tYmFzZS1jb2NvJTIyKSUwQXByb2Nlc3NvciUyMCUzRCUyMEF1dG9Qcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMlNhbGVzZm9yY2UlMkZibGlwLWl0bS1iYXNlLWNvY28lMjIpJTBBJTBBdXJsJTIwJTNEJTIwJTIyaHR0cCUzQSUyRiUyRmltYWdlcy5jb2NvZGF0YXNldC5vcmclMkZ2YWwyMDE3JTJGMDAwMDAwMDM5NzY5LmpwZyUyMiUwQWltYWdlJTIwJTNEJTIwSW1hZ2Uub3BlbihyZXF1ZXN0cy5nZXQodXJsJTJDJTIwc3RyZWFtJTNEVHJ1ZSkucmF3KSUwQXRleHQlMjAlM0QlMjAlMjJhbiUyMGltYWdlJTIwb2YlMjBhJTIwY2F0JTIyJTBBJTBBaW5wdXRzJTIwJTNEJTIwcHJvY2Vzc29yKGltYWdlcyUzRGltYWdlJTJDJTIwdGV4dCUzRHRleHQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnRmJTIyKSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyk=",highlighted:`<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-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, TFBlipForImageTextRetrieval

<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFBlipForImageTextRetrieval.from_pretrained(<span class="hljs-string">&quot;Salesforce/blip-itm-base-coco&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;Salesforce/blip-itm-base-coco&quot;</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;an image of a cat&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(images=image, text=text, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)`}}),{c(){d=a("p"),v=s("Examples:"),u=h(),y(m.$$.fragment)},l(n){d=l(n,"P",{});var c=i(d);v=r(c,"Examples:"),c.forEach(o),u=f(n),T(m.$$.fragment,n)},m(n,c){b(n,d,c),e(d,v),b(n,u,c),w(m,n,c),_=!0},p:S,i(n){_||(M(m.$$.fragment,n),_=!0)},o(n){$(m.$$.fragment,n),_=!1},d(n){n&&o(d),n&&o(u),B(m,n)}}}function Uy(x){let d,v,u,m,_;return{c(){d=a("p"),v=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=a("code"),m=s("Module"),_=s(`
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(n){d=l(n,"P",{});var c=i(d);v=r(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=l(c,"CODE",{});var J=i(u);m=r(J,"Module"),J.forEach(o),_=r(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(o)},m(n,c){b(n,d,c),e(d,v),e(d,u),e(u,m),e(d,_)},d(n){n&&o(d)}}}function Cy(x){let d,v,u,m,_;return m=new q({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Byb2Nlc3NvciUyQyUyMFRGQmxpcEZvclF1ZXN0aW9uQW5zd2VyaW5nJTBBJTBBbW9kZWwlMjAlM0QlMjBURkJsaXBGb3JRdWVzdGlvbkFuc3dlcmluZy5mcm9tX3ByZXRyYWluZWQoJTIyU2FsZXNmb3JjZSUyRmJsaXAtdnFhLWJhc2UlMjIpJTBBcHJvY2Vzc29yJTIwJTNEJTIwQXV0b1Byb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyU2FsZXNmb3JjZSUyRmJsaXAtdnFhLWJhc2UlMjIpJTBBJTBBdXJsJTIwJTNEJTIwJTIyaHR0cCUzQSUyRiUyRmltYWdlcy5jb2NvZGF0YXNldC5vcmclMkZ2YWwyMDE3JTJGMDAwMDAwMDM5NzY5LmpwZyUyMiUwQWltYWdlJTIwJTNEJTIwSW1hZ2Uub3BlbihyZXF1ZXN0cy5nZXQodXJsJTJDJTIwc3RyZWFtJTNEVHJ1ZSkucmF3KSUwQSUwQSUyMyUyMHRyYWluaW5nJTBBdGV4dCUyMCUzRCUyMCUyMkhvdyUyMG1hbnklMjBjYXRzJTIwYXJlJTIwaW4lMjB0aGUlMjBwaWN0dXJlJTNGJTIyJTBBbGFiZWwlMjAlM0QlMjAlMjIyJTIyJTBBaW5wdXRzJTIwJTNEJTIwcHJvY2Vzc29yKGltYWdlcyUzRGltYWdlJTJDJTIwdGV4dCUzRHRleHQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnRmJTIyKSUwQWxhYmVscyUyMCUzRCUyMHByb2Nlc3Nvcih0ZXh0JTNEbGFiZWwlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnRmJTIyKS5pbnB1dF9pZHMlMEElMEFpbnB1dHMlNUIlMjJsYWJlbHMlMjIlNUQlMjAlM0QlMjBsYWJlbHMlMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpJTBBbG9zcyUyMCUzRCUyMG91dHB1dHMubG9zcyUwQSUwQSUyMyUyMGluZmVyZW5jZSUwQXRleHQlMjAlM0QlMjAlMjJIb3clMjBtYW55JTIwY2F0cyUyMGFyZSUyMGluJTIwdGhlJTIwcGljdHVyZSUzRiUyMiUwQWlucHV0cyUyMCUzRCUyMHByb2Nlc3NvcihpbWFnZXMlM0RpbWFnZSUyQyUyMHRleHQlM0R0ZXh0JTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJ0ZiUyMiklMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwuZ2VuZXJhdGUoKippbnB1dHMpJTBBcHJpbnQocHJvY2Vzc29yLmRlY29kZShvdXRwdXRzJTVCMCU1RCUyQyUyMHNraXBfc3BlY2lhbF90b2tlbnMlM0RUcnVlKSk=",highlighted:`<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-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, TFBlipForQuestionAnswering

<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFBlipForQuestionAnswering.from_pretrained(<span class="hljs-string">&quot;Salesforce/blip-vqa-base&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;Salesforce/blip-vqa-base&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000039769.jpg&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = Image.<span class="hljs-built_in">open</span>(requests.get(url, stream=<span class="hljs-literal">True</span>).raw)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># training</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>text = <span class="hljs-string">&quot;How many cats are in the picture?&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>label = <span class="hljs-string">&quot;2&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(images=image, text=text, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>labels = processor(text=label, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>).input_ids

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs[<span class="hljs-string">&quot;labels&quot;</span>] = labels
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = outputs.loss

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># inference</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>text = <span class="hljs-string">&quot;How many cats are in the picture?&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(images=image, text=text, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model.generate(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(processor.decode(outputs[<span class="hljs-number">0</span>], skip_special_tokens=<span class="hljs-literal">True</span>))
<span class="hljs-number">2</span>`}}),{c(){d=a("p"),v=s("Examples:"),u=h(),y(m.$$.fragment)},l(n){d=l(n,"P",{});var c=i(d);v=r(c,"Examples:"),c.forEach(o),u=f(n),T(m.$$.fragment,n)},m(n,c){b(n,d,c),e(d,v),b(n,u,c),w(m,n,c),_=!0},p:S,i(n){_||(M(m.$$.fragment,n),_=!0)},o(n){$(m.$$.fragment,n),_=!1},d(n){n&&o(d),n&&o(u),B(m,n)}}}function zy(x){let d,v,u,m,_,n,c,J,Nd,ni,Ce,wt,Lr,Zo,Pd,Dr,Zd,si,Mt,Vd,Vo,Rd,Gd,ri,Fs,Ad,ai,_e,Or,Sd,qd,Kr,Xd,Qd,ea,Hd,li,ks,Yd,ii,Us,ta,Ld,di,Cs,zs,l_,ci,be,Dd,Ro,Od,Kd,Go,ec,tc,pi,ze,$t,oa,Ao,oc,na,nc,mi,Ws,Ns,So,sc,rc,hi,We,Bt,sa,qo,ac,ra,lc,fi,U,Xo,ic,ve,Ps,dc,cc,Zs,pc,mc,Qo,hc,fc,uc,Ne,gc,Vs,_c,bc,Rs,vc,yc,Tc,xt,wc,Jt,Ho,Mc,Yo,$c,Gs,Bc,xc,ui,Pe,jt,aa,Lo,Jc,la,jc,gi,Q,Do,Ec,me,Ic,As,Fc,kc,ia,Uc,Cc,Oo,zc,Wc,Nc,Ze,Pc,Ss,Zc,Vc,qs,Rc,Gc,Ac,Et,_i,Ve,It,da,Ko,Sc,ca,qc,bi,H,en,Xc,Re,Qc,Xs,Hc,Yc,tn,Lc,Dc,Oc,Ge,Kc,Qs,ep,tp,Hs,op,np,sp,Ft,vi,Ae,kt,pa,on,rp,ma,ap,yi,C,nn,lp,ha,ip,dp,X,Ys,cp,pp,Ls,mp,hp,Ds,fp,up,fa,gp,_p,Os,bp,vp,yp,Ut,sn,Tp,rn,wp,Ks,Mp,$p,Bp,Ct,an,xp,ln,Jp,er,jp,Ep,Ti,Se,zt,ua,dn,Ip,ga,Fp,wi,he,cn,kp,_a,Up,Cp,Wt,pn,zp,ba,Wp,Mi,qe,Nt,va,mn,Np,ya,Pp,$i,k,hn,Zp,fn,Vp,tr,Rp,Gp,Ap,un,Sp,gn,qp,Xp,Qp,O,_n,Hp,Xe,Yp,or,Lp,Dp,Ta,Op,Kp,em,Pt,tm,Zt,om,K,bn,nm,Qe,sm,nr,rm,am,wa,lm,im,dm,Vt,cm,Rt,pm,ee,vn,mm,He,hm,sr,fm,um,Ma,gm,_m,bm,Gt,vm,At,Bi,Ye,St,$a,yn,ym,Ba,Tm,xi,fe,Tn,wm,Y,Mm,wn,$m,Bm,xa,xm,Jm,Ja,jm,Em,ja,Im,Fm,km,ye,Mn,Um,z,Cm,Ea,zm,Wm,Ia,Nm,Pm,Fa,Zm,Vm,ka,Rm,Gm,Ua,Am,Sm,qm,$n,Bn,Xm,Ca,Qm,Hm,Ym,E,Lm,za,Dm,Om,Wa,Km,eh,Na,th,oh,Pa,nh,sh,Za,rh,ah,Va,lh,ih,Ra,dh,ch,Ga,ph,mh,Aa,hh,fh,Sa,uh,gh,qa,_h,bh,Xa,vh,yh,Qa,Th,wh,Ji,Le,qt,Ha,xn,Mh,Ya,$h,ji,De,Jn,Bh,Te,jn,xh,Oe,Jh,rr,jh,Eh,La,Ih,Fh,kh,Xt,Ei,Ke,Qt,Da,En,Uh,Oa,Ch,Ii,W,In,zh,Fn,Wh,Ka,Nh,Ph,Zh,kn,Vh,ar,Rh,Gh,Ah,Un,Sh,Cn,qh,Xh,Qh,te,zn,Hh,et,Yh,lr,Lh,Dh,el,Oh,Kh,ef,Ht,tf,Yt,Fi,tt,Lt,tl,Wn,of,ol,nf,ki,N,Nn,sf,nl,rf,af,Pn,lf,ir,df,cf,pf,Zn,mf,Vn,hf,ff,uf,oe,Rn,gf,ot,_f,dr,bf,vf,sl,yf,Tf,wf,Dt,Mf,Ot,Ui,nt,Kt,rl,Gn,$f,al,Bf,Ci,P,An,xf,ll,Jf,jf,Sn,Ef,cr,If,Ff,kf,qn,Uf,Xn,Cf,zf,Wf,ne,Qn,Nf,st,Pf,pr,Zf,Vf,il,Rf,Gf,Af,eo,Sf,to,zi,rt,oo,dl,Hn,qf,cl,Xf,Wi,L,Yn,Qf,se,Ln,Hf,at,Yf,mr,Lf,Df,pl,Of,Kf,eu,no,tu,so,ou,re,Dn,nu,lt,su,hr,ru,au,ml,lu,iu,du,ro,cu,ao,pu,ae,On,mu,it,hu,fr,fu,uu,hl,gu,_u,bu,lo,vu,io,Ni,dt,co,fl,Kn,yu,ul,Tu,Pi,ue,es,wu,D,Mu,ts,$u,Bu,gl,xu,Ju,_l,ju,Eu,bl,Iu,Fu,ku,we,os,Uu,ct,Cu,ur,zu,Wu,vl,Nu,Pu,Zu,po,Zi,pt,mo,yl,ns,Vu,Tl,Ru,Vi,mt,ss,Gu,Me,rs,Au,ht,Su,gr,qu,Xu,wl,Qu,Hu,Yu,ho,Ri,ft,fo,Ml,as,Lu,$l,Du,Gi,Z,ls,Ou,is,Ku,Bl,eg,tg,og,ds,ng,_r,sg,rg,ag,cs,lg,ps,ig,dg,cg,le,ms,pg,ut,mg,br,hg,fg,xl,ug,gg,_g,uo,bg,go,Ai,gt,_o,Jl,hs,vg,jl,yg,Si,V,fs,Tg,El,wg,Mg,us,$g,vr,Bg,xg,Jg,gs,jg,_s,Eg,Ig,Fg,ie,bs,kg,_t,Ug,yr,Cg,zg,Il,Wg,Ng,Pg,bo,Zg,vo,qi,bt,yo,Fl,vs,Vg,kl,Rg,Xi,R,ys,Gg,Ul,Ag,Sg,Ts,qg,Tr,Xg,Qg,Hg,ws,Yg,Ms,Lg,Dg,Og,de,$s,Kg,vt,e_,wr,t_,o_,Cl,n_,s_,r_,To,a_,wo,Qi;return n=new F({}),Zo=new F({}),Ao=new F({}),qo=new F({}),Xo=new j({props:{name:"class transformers.BlipConfig",anchor:"transformers.BlipConfig",parameters:[{name:"text_config",val:" = None"},{name:"vision_config",val:" = None"},{name:"projection_dim",val:" = 512"},{name:"logit_scale_init_value",val:" = 2.6592"},{name:"image_text_hidden_size",val:" = 256"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.BlipConfig.text_config",description:`<strong>text_config</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
Dictionary of configuration options used to initialize <a href="/docs/transformers/v4.31.0/en/model_doc/blip#transformers.BlipTextConfig">BlipTextConfig</a>.`,name:"text_config"},{anchor:"transformers.BlipConfig.vision_config",description:`<strong>vision_config</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
Dictionary of configuration options used to initialize <a href="/docs/transformers/v4.31.0/en/model_doc/blip#transformers.BlipVisionConfig">BlipVisionConfig</a>.`,name:"vision_config"},{anchor:"transformers.BlipConfig.projection_dim",description:`<strong>projection_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
Dimentionality of text and vision projection layers.`,name:"projection_dim"},{anchor:"transformers.BlipConfig.logit_scale_init_value",description:`<strong>logit_scale_init_value</strong> (<code>float</code>, <em>optional</em>, defaults to 2.6592) &#x2014;
The inital value of the <em>logit_scale</em> paramter. Default is used as per the original BLIP implementation.`,name:"logit_scale_init_value"},{anchor:"transformers.BlipConfig.image_text_hidden_size",description:`<strong>image_text_hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 768) &#x2014;
Dimentionality of the hidden state of the image-text fusion layer.`,name:"image_text_hidden_size"},{anchor:"transformers.BlipConfig.kwargs",description:`<strong>kwargs</strong> (<em>optional</em>) &#x2014;
Dictionary of keyword arguments.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/blip/configuration_blip.py#L280"}}),xt=new A({props:{anchor:"transformers.BlipConfig.example",$$slots:{default:[ry]},$$scope:{ctx:x}}}),Ho=new j({props:{name:"from_text_vision_configs",anchor:"transformers.BlipConfig.from_text_vision_configs",parameters:[{name:"text_config",val:": BlipTextConfig"},{name:"vision_config",val:": BlipVisionConfig"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/blip/configuration_blip.py#L360",returnDescription:`
<p>An instance of a configuration object</p>
`,returnType:`
<p><a
  href="/docs/transformers/v4.31.0/en/model_doc/blip#transformers.BlipConfig"
>BlipConfig</a></p>
`}}),Lo=new F({}),Do=new j({props:{name:"class transformers.BlipTextConfig",anchor:"transformers.BlipTextConfig",parameters:[{name:"vocab_size",val:" = 30524"},{name:"hidden_size",val:" = 768"},{name:"encoder_hidden_size",val:" = 768"},{name:"intermediate_size",val:" = 3072"},{name:"projection_dim",val:" = 768"},{name:"num_hidden_layers",val:" = 12"},{name:"num_attention_heads",val:" = 8"},{name:"max_position_embeddings",val:" = 512"},{name:"hidden_act",val:" = 'gelu'"},{name:"layer_norm_eps",val:" = 1e-12"},{name:"hidden_dropout_prob",val:" = 0.0"},{name:"attention_probs_dropout_prob",val:" = 0.0"},{name:"initializer_range",val:" = 0.02"},{name:"bos_token_id",val:" = 30522"},{name:"eos_token_id",val:" = 2"},{name:"pad_token_id",val:" = 0"},{name:"sep_token_id",val:" = 102"},{name:"is_decoder",val:" = True"},{name:"use_cache",val:" = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.BlipTextConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 30522) &#x2014;
Vocabulary size of the <code>Blip</code> text model. Defines the number of different tokens that can be represented by
the <code>inputs_ids</code> passed when calling <a href="/docs/transformers/v4.31.0/en/model_doc/blip#transformers.BlipModel">BlipModel</a>.`,name:"vocab_size"},{anchor:"transformers.BlipTextConfig.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.BlipTextConfig.encoder_hidden_size",description:`<strong>encoder_hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 768) &#x2014;
Dimensionality of the encoder layers from the vision model.`,name:"encoder_hidden_size"},{anchor:"transformers.BlipTextConfig.intermediate_size",description:`<strong>intermediate_size</strong> (<code>int</code>, <em>optional</em>, defaults to 3072) &#x2014;
Dimensionality of the &#x201C;intermediate&#x201D; (i.e., feed-forward) layer in the Transformer encoder.`,name:"intermediate_size"},{anchor:"transformers.BlipTextConfig.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.BlipTextConfig.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 8) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"num_attention_heads"},{anchor:"transformers.BlipTextConfig.max_position_embeddings",description:`<strong>max_position_embeddings</strong> (<code>int</code>, <em>optional</em>, defaults to 77) &#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.BlipTextConfig.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code> or <code>function</code>, <em>optional</em>, defaults to <code>&quot;gelu&quot;</code>) &#x2014;
The non-linear activation function (function or string) in the encoder and pooler. If string, <code>&quot;gelu&quot;</code>,
<code>&quot;relu&quot;</code>, <code>&quot;selu&quot;</code> and <code>&quot;gelu_new&quot;</code> \`<code>&quot;gelu&quot;</code> are supported.`,name:"hidden_act"},{anchor:"transformers.BlipTextConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-12) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.BlipTextConfig.hidden_dropout_prob",description:`<strong>hidden_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.`,name:"hidden_dropout_prob"},{anchor:"transformers.BlipTextConfig.attention_dropout",description:`<strong>attention_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout ratio for the attention probabilities.`,name:"attention_dropout"},{anchor:"transformers.BlipTextConfig.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to 0.02) &#x2014;
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"initializer_range"},{anchor:"transformers.BlipTextConfig.bos_token_id",description:`<strong>bos_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 30522) &#x2014;
The id of the <code>beginning-of-sequence</code> token.`,name:"bos_token_id"},{anchor:"transformers.BlipTextConfig.eos_token_id",description:`<strong>eos_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 2) &#x2014;
The id of the <code>end-of-sequence</code> token.`,name:"eos_token_id"},{anchor:"transformers.BlipTextConfig.pad_token_id",description:`<strong>pad_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
The id of the <code>padding</code> token.`,name:"pad_token_id"},{anchor:"transformers.BlipTextConfig.sep_token_id",description:`<strong>sep_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 102) &#x2014;
The id of the <code>separator</code> token.`,name:"sep_token_id"},{anchor:"transformers.BlipTextConfig.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.`,name:"is_decoder"},{anchor:"transformers.BlipTextConfig.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).`,name:"use_cache"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/blip/configuration_blip.py#L47"}}),Et=new A({props:{anchor:"transformers.BlipTextConfig.example",$$slots:{default:[ay]},$$scope:{ctx:x}}}),Ko=new F({}),en=new j({props:{name:"class transformers.BlipVisionConfig",anchor:"transformers.BlipVisionConfig",parameters:[{name:"hidden_size",val:" = 768"},{name:"intermediate_size",val:" = 3072"},{name:"projection_dim",val:" = 512"},{name:"num_hidden_layers",val:" = 12"},{name:"num_attention_heads",val:" = 12"},{name:"image_size",val:" = 384"},{name:"patch_size",val:" = 16"},{name:"hidden_act",val:" = 'gelu'"},{name:"layer_norm_eps",val:" = 1e-05"},{name:"attention_dropout",val:" = 0.0"},{name:"initializer_range",val:" = 1e-10"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.BlipVisionConfig.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.BlipVisionConfig.intermediate_size",description:`<strong>intermediate_size</strong> (<code>int</code>, <em>optional</em>, defaults to 3072) &#x2014;
Dimensionality of the &#x201C;intermediate&#x201D; (i.e., feed-forward) layer in the Transformer encoder.`,name:"intermediate_size"},{anchor:"transformers.BlipVisionConfig.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.BlipVisionConfig.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.BlipVisionConfig.image_size",description:`<strong>image_size</strong> (<code>int</code>, <em>optional</em>, defaults to 224) &#x2014;
The size (resolution) of each image.`,name:"image_size"},{anchor:"transformers.BlipVisionConfig.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, <em>optional</em>, defaults to 32) &#x2014;
The size (resolution) of each patch.`,name:"patch_size"},{anchor:"transformers.BlipVisionConfig.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code> or <code>function</code>, <em>optional</em>, defaults to <code>&quot;gelu&quot;</code>) &#x2014;
The non-linear activation function (function or string) in the encoder and pooler. If string, <code>&quot;gelu&quot;</code>,
<code>&quot;relu&quot;</code>, <code>&quot;selu&quot;</code> and <code>&quot;gelu_new&quot;</code> \`<code>&quot;gelu&quot;</code> are supported.`,name:"hidden_act"},{anchor:"transformers.BlipVisionConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-5) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.BlipVisionConfig.attention_dropout",description:`<strong>attention_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout ratio for the attention probabilities.`,name:"attention_dropout"},{anchor:"transformers.BlipVisionConfig.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to 0.02) &#x2014;
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"initializer_range"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/blip/configuration_blip.py#L181"}}),Ft=new A({props:{anchor:"transformers.BlipVisionConfig.example",$$slots:{default:[ly]},$$scope:{ctx:x}}}),on=new F({}),nn=new j({props:{name:"class transformers.BlipProcessor",anchor:"transformers.BlipProcessor",parameters:[{name:"image_processor",val:""},{name:"tokenizer",val:""}],parametersDescription:[{anchor:"transformers.BlipProcessor.image_processor",description:`<strong>image_processor</strong> (<code>BlipImageProcessor</code>) &#x2014;
An instance of <a href="/docs/transformers/v4.31.0/en/model_doc/blip#transformers.BlipImageProcessor">BlipImageProcessor</a>. The image processor is a required input.`,name:"image_processor"},{anchor:"transformers.BlipProcessor.tokenizer",description:"<strong>tokenizer</strong> (<code>BertTokenizerFast</code>) &#x2014;\nAn instance of [&#x2018;BertTokenizerFast`]. The tokenizer is a required input.",name:"tokenizer"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/blip/processing_blip.py#L27"}}),sn=new j({props:{name:"batch_decode",anchor:"transformers.BlipProcessor.batch_decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/blip/processing_blip.py#L131"}}),an=new j({props:{name:"decode",anchor:"transformers.BlipProcessor.decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/blip/processing_blip.py#L138"}}),dn=new F({}),cn=new j({props:{name:"class transformers.BlipImageProcessor",anchor:"transformers.BlipImageProcessor",parameters:[{name:"do_resize",val:": bool = True"},{name:"size",val:": typing.Dict[str, int] = None"},{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_convert_rgb",val:": bool = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.BlipImageProcessor.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.BlipImageProcessor.size",description:`<strong>size</strong> (<code>dict</code>, <em>optional</em>, defaults to <code>{&quot;height&quot; -- 384, &quot;width&quot;: 384}</code>):
Size of the output image after resizing. Can be overridden by the <code>size</code> parameter in the <code>preprocess</code>
method.`,name:"size"},{anchor:"transformers.BlipImageProcessor.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.BlipImageProcessor.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Wwhether to rescale the image by the specified scale <code>rescale_factor</code>. Can be overridden by the
<code>do_rescale</code> parameter in the <code>preprocess</code> method.`,name:"do_rescale"},{anchor:"transformers.BlipImageProcessor.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.BlipImageProcessor.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.BlipImageProcessor.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.BlipImageProcessor.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.BlipImageProcessor.do_convert_rgb",description:`<strong>do_convert_rgb</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to convert the image to RGB.`,name:"do_convert_rgb"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/blip/image_processing_blip.py#L43"}}),pn=new j({props:{name:"preprocess",anchor:"transformers.BlipImageProcessor.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:"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:"return_tensors",val:": typing.Union[str, transformers.utils.generic.TensorType, NoneType] = None"},{name:"do_convert_rgb",val:": bool = None"},{name:"data_format",val:": ChannelDimension = <ChannelDimension.FIRST: 'channels_first'>"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.BlipImageProcessor.preprocess.images",description:`<strong>images</strong> (<code>ImageInput</code>) &#x2014;
Image to preprocess.`,name:"images"},{anchor:"transformers.BlipImageProcessor.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.BlipImageProcessor.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.BlipImageProcessor.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.BlipImageProcessor.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.BlipImageProcessor.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.BlipImageProcessor.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.BlipImageProcessor.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.BlipImageProcessor.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.BlipImageProcessor.preprocess.do_convert_rgb",description:`<strong>do_convert_rgb</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_convert_rgb</code>) &#x2014;
Whether to convert the image to RGB.`,name:"do_convert_rgb"},{anchor:"transformers.BlipImageProcessor.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.BlipImageProcessor.preprocess.data_format",description:`<strong>data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>, defaults to <code>ChannelDimension.FIRST</code>) &#x2014;
The channel dimension format for the output image. Can be one of:<ul>
<li><code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li>
<li><code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.</li>
</ul>`,name:"data_format"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/blip/image_processing_blip.py#L183"}}),mn=new F({}),hn=new j({props:{name:"class transformers.BlipModel",anchor:"transformers.BlipModel",parameters:[{name:"config",val:": BlipConfig"}],parametersDescription:[{anchor:"transformers.BlipModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.31.0/en/model_doc/blip#transformers.BlipConfig">BlipConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/blip/modeling_blip.py#L716"}}),_n=new j({props:{name:"forward",anchor:"transformers.BlipModel.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"pixel_values",val:": typing.Optional[torch.FloatTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"return_loss",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.BlipModel.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. Padding will be ignored by default should you provide
it.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.31.0/en/model_doc/auto#transformers.AutoProcessor">AutoProcessor</a>. See <code>BlipProcessor.__call__()</code> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.BlipModel.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</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>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.BlipModel.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.BlipModel.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. Padding will be ignored by default should you provide it. Pixel values can be obtained using
<a href="/docs/transformers/v4.31.0/en/model_doc/blip#transformers.BlipImageProcessor">BlipImageProcessor</a>. See <a href="/docs/transformers/v4.31.0/en/model_doc/perceiver#transformers.PerceiverFeatureExtractor.__call__">BlipImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.BlipModel.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"},{anchor:"transformers.BlipModel.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.BlipModel.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.BlipModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/blip/modeling_blip.py#L826",returnDescription:`
<p>A <code>transformers.models.blip.modeling_blip.BlipOutput</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 (<code>&lt;class 'transformers.models.blip.configuration_blip.BlipConfig'&gt;</code>) 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 Contrastive loss for image-text similarity.</li>
<li><strong>logits_per_image:(<code>torch.FloatTensor</code></strong> of shape <code>(image_batch_size, text_batch_size)</code>) \u2014 The scaled dot product scores between <code>image_embeds</code> and <code>text_embeds</code>. This represents the image-text
similarity scores.</li>
<li><strong>logits_per_text:(<code>torch.FloatTensor</code></strong> of shape <code>(text_batch_size, image_batch_size)</code>) \u2014 The scaled dot product scores between <code>text_embeds</code> and <code>image_embeds</code>. This represents the text-image
similarity scores.</li>
<li><strong>text_embeds(<code>torch.FloatTensor</code></strong> of shape <code>(batch_size, output_dim</code>) \u2014 The text embeddings obtained by applying the projection layer to the pooled output of <a
  href="/docs/transformers/v4.31.0/en/model_doc/blip#transformers.BlipTextModel"
>BlipTextModel</a>.</li>
<li><strong>image_embeds(<code>torch.FloatTensor</code></strong> of shape <code>(batch_size, output_dim</code>) \u2014 The image embeddings obtained by applying the projection layer to the pooled output of <a
  href="/docs/transformers/v4.31.0/en/model_doc/blip#transformers.BlipVisionModel"
>BlipVisionModel</a>.</li>
<li><strong>text_model_output(<code>BaseModelOutputWithPooling</code>):</strong>
The output of the <a
  href="/docs/transformers/v4.31.0/en/model_doc/blip#transformers.BlipTextModel"
>BlipTextModel</a>.</li>
<li><strong>vision_model_output(<code>BaseModelOutputWithPooling</code>):</strong>
The output of the <a
  href="/docs/transformers/v4.31.0/en/model_doc/blip#transformers.BlipVisionModel"
>BlipVisionModel</a>.</li>
</ul>
`,returnType:`
<p><code>transformers.models.blip.modeling_blip.BlipOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Pt=new G({props:{$$slots:{default:[iy]},$$scope:{ctx:x}}}),Zt=new A({props:{anchor:"transformers.BlipModel.forward.example",$$slots:{default:[dy]},$$scope:{ctx:x}}}),bn=new j({props:{name:"get_text_features",anchor:"transformers.BlipModel.get_text_features",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.BlipModel.get_text_features.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. Padding will be ignored by default should you provide
it.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.31.0/en/model_doc/auto#transformers.AutoProcessor">AutoProcessor</a>. See <code>BlipProcessor.__call__()</code> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.BlipModel.get_text_features.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</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>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.BlipModel.get_text_features.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.BlipModel.get_text_features.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.BlipModel.get_text_features.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.BlipModel.get_text_features.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/blip/modeling_blip.py#L751",returnDescription:`
<p>The text embeddings obtained by
applying the projection layer to the pooled output of <a
  href="/docs/transformers/v4.31.0/en/model_doc/blip#transformers.BlipTextModel"
>BlipTextModel</a>.</p>
`,returnType:`
<p>text_features (<code>torch.FloatTensor</code> of shape <code>(batch_size, output_dim</code>)</p>
`}}),Vt=new G({props:{$$slots:{default:[cy]},$$scope:{ctx:x}}}),Rt=new A({props:{anchor:"transformers.BlipModel.get_text_features.example",$$slots:{default:[py]},$$scope:{ctx:x}}}),vn=new j({props:{name:"get_image_features",anchor:"transformers.BlipModel.get_image_features",parameters:[{name:"pixel_values",val:": typing.Optional[torch.FloatTensor] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.BlipModel.get_image_features.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Padding will be ignored by default should you provide it. Pixel values can be obtained using
<a href="/docs/transformers/v4.31.0/en/model_doc/blip#transformers.BlipImageProcessor">BlipImageProcessor</a>. See <a href="/docs/transformers/v4.31.0/en/model_doc/perceiver#transformers.PerceiverFeatureExtractor.__call__">BlipImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.BlipModel.get_image_features.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.BlipModel.get_image_features.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.BlipModel.get_image_features.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/blip/modeling_blip.py#L789",returnDescription:`
<p>The image embeddings obtained by
applying the projection layer to the pooled output of <a
  href="/docs/transformers/v4.31.0/en/model_doc/blip#transformers.BlipVisionModel"
>BlipVisionModel</a>.</p>
`,returnType:`
<p>image_features (<code>torch.FloatTensor</code> of shape <code>(batch_size, output_dim</code>)</p>
`}}),Gt=new G({props:{$$slots:{default:[my]},$$scope:{ctx:x}}}),At=new A({props:{anchor:"transformers.BlipModel.get_image_features.example",$$slots:{default:[hy]},$$scope:{ctx:x}}}),yn=new F({}),Tn=new j({props:{name:"class transformers.BlipTextModel",anchor:"transformers.BlipTextModel",parameters:[{name:"config",val:""},{name:"add_pooling_layer",val:" = True"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/blip/modeling_blip_text.py#L572"}}),Mn=new j({props:{name:"forward",anchor:"transformers.BlipTextModel.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"encoder_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"encoder_hidden_states",val:": typing.Optional[torch.Tensor] = None"},{name:"encoder_attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"past_key_values",val:": typing.Optional[typing.List[torch.FloatTensor]] = None"},{name:"use_cache",val:": typing.Optional[bool] = 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:"is_decoder",val:": typing.Optional[bool] = False"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/blip/modeling_blip_text.py#L671"}}),xn=new F({}),Jn=new j({props:{name:"class transformers.BlipVisionModel",anchor:"transformers.BlipVisionModel",parameters:[{name:"config",val:": BlipVisionConfig"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/blip/modeling_blip.py#L649"}}),jn=new j({props:{name:"forward",anchor:"transformers.BlipVisionModel.forward",parameters:[{name:"pixel_values",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"}],parametersDescription:[{anchor:"transformers.BlipVisionModel.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. Padding will be ignored by default should you provide it. Pixel values can be obtained using
<a href="/docs/transformers/v4.31.0/en/model_doc/blip#transformers.BlipImageProcessor">BlipImageProcessor</a>. See <a href="/docs/transformers/v4.31.0/en/model_doc/perceiver#transformers.PerceiverFeatureExtractor.__call__">BlipImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.BlipVisionModel.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.BlipVisionModel.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.BlipVisionModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/blip/modeling_blip.py#L664",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<code>&lt;class 'transformers.models.blip.configuration_blip.BlipVisionConfig'&gt;</code>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) \u2014 Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>pooler_output</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, hidden_size)</code>) \u2014 Last layer hidden-state of the first token of the sequence (classification token) after further processing
through the layers used for the auxiliary pretraining task. E.g. for BERT-family of models, this returns
the classification token after processing through a linear layer and a tanh activation function. The linear
layer weights are trained from the next sentence prediction (classification) objective during pretraining.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Xt=new G({props:{$$slots:{default:[fy]},$$scope:{ctx:x}}}),En=new F({}),In=new j({props:{name:"class transformers.BlipForConditionalGeneration",anchor:"transformers.BlipForConditionalGeneration",parameters:[{name:"config",val:": BlipConfig"}],parametersDescription:[{anchor:"transformers.BlipForConditionalGeneration.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.31.0/en/model_doc/blip#transformers.BlipConfig">BlipConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/blip/modeling_blip.py#L929"}}),zn=new j({props:{name:"forward",anchor:"transformers.BlipForConditionalGeneration.forward",parameters:[{name:"pixel_values",val:": FloatTensor"},{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.LongTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.BlipForConditionalGeneration.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. Padding will be ignored by default should you provide it. Pixel values can be obtained using
<a href="/docs/transformers/v4.31.0/en/model_doc/blip#transformers.BlipImageProcessor">BlipImageProcessor</a>. See <a href="/docs/transformers/v4.31.0/en/model_doc/perceiver#transformers.PerceiverFeatureExtractor.__call__">BlipImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.BlipForConditionalGeneration.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.BlipForConditionalGeneration.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.BlipForConditionalGeneration.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/blip/modeling_blip.py#L950",returnDescription:`
<p>A <code>transformers.models.blip.modeling_blip.BlipForConditionalGenerationModelOutput</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 (<code>&lt;class 'transformers.models.blip.configuration_blip.BlipVisionConfig'&gt;</code>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code>, <em>optional</em>, returned when <code>labels</code> is provided, <code>torch.FloatTensor</code> of shape <code>(1,)</code>) \u2014 Languge modeling loss from the text decoder.</p>
</li>
<li>
<p><strong>decoder_logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.vocab_size)</code>, <em>optional</em>) \u2014 Prediction scores of the language modeling head of the text decoder model.</p>
</li>
<li>
<p><strong>image_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, output_dim)</code>, <em>optional</em>) \u2014 The image embeddings obtained after applying the Vision Transformer model to the input image.</p>
</li>
<li>
<p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) \u2014 Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>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) \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.blip.modeling_blip.BlipForConditionalGenerationModelOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ht=new G({props:{$$slots:{default:[uy]},$$scope:{ctx:x}}}),Yt=new A({props:{anchor:"transformers.BlipForConditionalGeneration.forward.example",$$slots:{default:[gy]},$$scope:{ctx:x}}}),Wn=new F({}),Nn=new j({props:{name:"class transformers.BlipForImageTextRetrieval",anchor:"transformers.BlipForImageTextRetrieval",parameters:[{name:"config",val:": BlipConfig"}],parametersDescription:[{anchor:"transformers.BlipForImageTextRetrieval.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.31.0/en/model_doc/blip#transformers.BlipConfig">BlipConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/blip/modeling_blip.py#L1323"}}),Rn=new j({props:{name:"forward",anchor:"transformers.BlipForImageTextRetrieval.forward",parameters:[{name:"input_ids",val:": LongTensor"},{name:"pixel_values",val:": FloatTensor"},{name:"use_itm_head",val:": typing.Optional[bool] = True"},{name:"attention_mask",val:": typing.Optional[torch.LongTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.BlipForImageTextRetrieval.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. Padding will be ignored by default should you provide it. Pixel values can be obtained using
<a href="/docs/transformers/v4.31.0/en/model_doc/blip#transformers.BlipImageProcessor">BlipImageProcessor</a>. See <a href="/docs/transformers/v4.31.0/en/model_doc/perceiver#transformers.PerceiverFeatureExtractor.__call__">BlipImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.BlipForImageTextRetrieval.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.BlipForImageTextRetrieval.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.BlipForImageTextRetrieval.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/blip/modeling_blip.py#L1359",returnDescription:`
<p>A <code>transformers.models.blip.modeling_blip.BlipTextVisionModelOutput</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 (<code>&lt;class 'transformers.models.blip.configuration_blip.BlipVisionConfig'&gt;</code>) 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 Languge modeling loss from the text decoder.</p>
</li>
<li>
<p><strong>image_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, output_dim)</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.</p>
</li>
<li>
<p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) \u2014 Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>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><code>transformers.models.blip.modeling_blip.BlipTextVisionModelOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Dt=new G({props:{$$slots:{default:[_y]},$$scope:{ctx:x}}}),Ot=new A({props:{anchor:"transformers.BlipForImageTextRetrieval.forward.example",$$slots:{default:[by]},$$scope:{ctx:x}}}),Gn=new F({}),An=new j({props:{name:"class transformers.BlipForQuestionAnswering",anchor:"transformers.BlipForQuestionAnswering",parameters:[{name:"config",val:": BlipConfig"}],parametersDescription:[{anchor:"transformers.BlipForQuestionAnswering.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.31.0/en/model_doc/blip#transformers.BlipConfig">BlipConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/blip/modeling_blip.py#L1101"}}),Qn=new j({props:{name:"forward",anchor:"transformers.BlipForQuestionAnswering.forward",parameters:[{name:"input_ids",val:": LongTensor"},{name:"pixel_values",val:": FloatTensor"},{name:"decoder_input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"decoder_attention_mask",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.LongTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.BlipForQuestionAnswering.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. Padding will be ignored by default should you provide it. Pixel values can be obtained using
<a href="/docs/transformers/v4.31.0/en/model_doc/blip#transformers.BlipImageProcessor">BlipImageProcessor</a>. See <a href="/docs/transformers/v4.31.0/en/model_doc/perceiver#transformers.PerceiverFeatureExtractor.__call__">BlipImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.BlipForQuestionAnswering.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.BlipForQuestionAnswering.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.BlipForQuestionAnswering.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/blip/modeling_blip.py#L1123",returnDescription:`
<p>A <code>transformers.models.blip.modeling_blip.BlipTextVisionModelOutput</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 (<code>&lt;class 'transformers.models.blip.configuration_blip.BlipVisionConfig'&gt;</code>) 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 Languge modeling loss from the text decoder.</p>
</li>
<li>
<p><strong>image_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, output_dim)</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.</p>
</li>
<li>
<p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) \u2014 Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>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><code>transformers.models.blip.modeling_blip.BlipTextVisionModelOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),eo=new G({props:{$$slots:{default:[vy]},$$scope:{ctx:x}}}),to=new A({props:{anchor:"transformers.BlipForQuestionAnswering.forward.example",$$slots:{default:[yy]},$$scope:{ctx:x}}}),Hn=new F({}),Yn=new j({props:{name:"class transformers.TFBlipModel",anchor:"transformers.TFBlipModel",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/blip/modeling_tf_blip.py#L843"}}),Ln=new j({props:{name:"call",anchor:"transformers.TFBlipModel.call",parameters:[{name:"input_ids",val:": tf.Tensor | None = None"},{name:"pixel_values",val:": tf.Tensor | None = None"},{name:"attention_mask",val:": tf.Tensor | None = None"},{name:"position_ids",val:": tf.Tensor | None = None"},{name:"return_loss",val:": Optional[bool] = None"},{name:"output_attentions",val:": Optional[bool] = None"},{name:"output_hidden_states",val:": Optional[bool] = None"},{name:"return_dict",val:": Optional[bool] = None"},{name:"training",val:": Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.TFBlipModel.call.input_ids",description:`<strong>input_ids</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide
it.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.31.0/en/model_doc/auto#transformers.AutoProcessor">AutoProcessor</a>. See <code>BlipProcessor.__call__()</code> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TFBlipModel.call.attention_mask",description:`<strong>attention_mask</strong> (<code>tf.Tensor</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>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TFBlipModel.call.position_ids",description:`<strong>position_ids</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.TFBlipModel.call.pixel_values",description:`<strong>pixel_values</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Padding will be ignored by default should you provide it. Pixel values can be obtained using
<a href="/docs/transformers/v4.31.0/en/model_doc/blip#transformers.BlipImageProcessor">BlipImageProcessor</a>. See <a href="/docs/transformers/v4.31.0/en/model_doc/perceiver#transformers.PerceiverFeatureExtractor.__call__">BlipImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.TFBlipModel.call.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"},{anchor:"transformers.TFBlipModel.call.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.TFBlipModel.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.TFBlipModel.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/blip/modeling_tf_blip.py#L861",returnDescription:`
<p>A <code>transformers.models.blip.modeling_tf_blip.TFBlipOutput</code> or a tuple of <code>tf.Tensor</code> (if
<code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various elements depending on the
configuration (<code>&lt;class 'transformers.models.blip.configuration_blip.BlipConfig'&gt;</code>) and inputs.</p>
<ul>
<li><strong>loss</strong> (<code>tf.Tensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>return_loss</code> is <code>True</code>) \u2014 Contrastive loss for image-text similarity.</li>
<li><strong>logits_per_image:(<code>tf.Tensor</code></strong> of shape <code>(image_batch_size, text_batch_size)</code>) \u2014 The scaled dot product scores between <code>image_embeds</code> and <code>text_embeds</code>. This represents the image-text
similarity scores.</li>
<li><strong>logits_per_text:(<code>tf.Tensor</code></strong> of shape <code>(text_batch_size, image_batch_size)</code>) \u2014 The scaled dot product scores between <code>text_embeds</code> and <code>image_embeds</code>. This represents the text-image
similarity scores.</li>
<li><strong>text_embeds(<code>tf.Tensor</code></strong> of shape <code>(batch_size, output_dim</code>) \u2014 The text embeddings obtained by applying the projection layer to the pooled output of <a
  href="/docs/transformers/v4.31.0/en/model_doc/blip#transformers.BlipTextModel"
>BlipTextModel</a>.</li>
<li><strong>image_embeds(<code>tf.Tensor</code></strong> of shape <code>(batch_size, output_dim</code>) \u2014 The image embeddings obtained by applying the projection layer to the pooled output of <a
  href="/docs/transformers/v4.31.0/en/model_doc/blip#transformers.BlipVisionModel"
>BlipVisionModel</a>.</li>
<li><strong>text_model_output(<code>BaseModelOutputWithPooling</code>):</strong>
The output of the <a
  href="/docs/transformers/v4.31.0/en/model_doc/blip#transformers.BlipTextModel"
>BlipTextModel</a>.</li>
<li><strong>vision_model_output(<code>BaseModelOutputWithPooling</code>):</strong>
The output of the <a
  href="/docs/transformers/v4.31.0/en/model_doc/blip#transformers.BlipVisionModel"
>BlipVisionModel</a>.</li>
</ul>
`,returnType:`
<p><code>transformers.models.blip.modeling_tf_blip.TFBlipOutput</code> or <code>tuple(tf.Tensor)</code></p>
`}}),no=new G({props:{$$slots:{default:[Ty]},$$scope:{ctx:x}}}),so=new A({props:{anchor:"transformers.TFBlipModel.call.example",$$slots:{default:[wy]},$$scope:{ctx:x}}}),Dn=new j({props:{name:"get_text_features",anchor:"transformers.TFBlipModel.get_text_features",parameters:[{name:"input_ids",val:": tf.Tensor | None = None"},{name:"attention_mask",val:": tf.Tensor | None = None"},{name:"position_ids",val:": tf.Tensor | None = None"},{name:"return_dict",val:": Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.TFBlipModel.get_text_features.input_ids",description:`<strong>input_ids</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide
it.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.31.0/en/model_doc/auto#transformers.AutoProcessor">AutoProcessor</a>. See <code>BlipProcessor.__call__()</code> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TFBlipModel.get_text_features.attention_mask",description:`<strong>attention_mask</strong> (<code>tf.Tensor</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>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TFBlipModel.get_text_features.position_ids",description:`<strong>position_ids</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.TFBlipModel.get_text_features.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.TFBlipModel.get_text_features.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.TFBlipModel.get_text_features.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/blip/modeling_tf_blip.py#L913",returnDescription:`
<p>The text embeddings obtained by applying
the projection layer to the pooled output of <a
  href="/docs/transformers/v4.31.0/en/model_doc/blip#transformers.TFBlipTextModel"
>TFBlipTextModel</a>.</p>
`,returnType:`
<p>text_features (<code>tf.Tensor</code> of shape <code>(batch_size, output_dim</code>)</p>
`}}),ro=new G({props:{$$slots:{default:[My]},$$scope:{ctx:x}}}),ao=new A({props:{anchor:"transformers.TFBlipModel.get_text_features.example",$$slots:{default:[$y]},$$scope:{ctx:x}}}),On=new j({props:{name:"get_image_features",anchor:"transformers.TFBlipModel.get_image_features",parameters:[{name:"pixel_values",val:": tf.Tensor | None = None"},{name:"return_dict",val:": Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.TFBlipModel.get_image_features.pixel_values",description:`<strong>pixel_values</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Padding will be ignored by default should you provide it. Pixel values can be obtained using
<a href="/docs/transformers/v4.31.0/en/model_doc/blip#transformers.BlipImageProcessor">BlipImageProcessor</a>. See <a href="/docs/transformers/v4.31.0/en/model_doc/perceiver#transformers.PerceiverFeatureExtractor.__call__">BlipImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.TFBlipModel.get_image_features.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.TFBlipModel.get_image_features.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.TFBlipModel.get_image_features.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/blip/modeling_tf_blip.py#L951",returnDescription:`
<p>The image embeddings obtained by applying
the projection layer to the pooled output of <a
  href="/docs/transformers/v4.31.0/en/model_doc/blip#transformers.TFBlipVisionModel"
>TFBlipVisionModel</a>.</p>
`,returnType:`
<p>image_features (<code>tf.Tensor</code> of shape <code>(batch_size, output_dim</code>)</p>
`}}),lo=new G({props:{$$slots:{default:[By]},$$scope:{ctx:x}}}),io=new A({props:{anchor:"transformers.TFBlipModel.get_image_features.example",$$slots:{default:[xy]},$$scope:{ctx:x}}}),Kn=new F({}),es=new j({props:{name:"class transformers.TFBlipTextModel",anchor:"transformers.TFBlipTextModel",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/blip/modeling_tf_blip_text.py#L579"}}),os=new j({props:{name:"call",anchor:"transformers.TFBlipTextModel.call",parameters:[{name:"input_ids",val:" = None"},{name:"attention_mask",val:" = None"},{name:"position_ids",val:" = None"},{name:"head_mask",val:" = None"},{name:"inputs_embeds",val:" = None"},{name:"encoder_embeds",val:" = None"},{name:"encoder_hidden_states",val:" = None"},{name:"encoder_attention_mask",val:" = None"},{name:"past_key_values",val:" = None"},{name:"use_cache",val:" = None"},{name:"output_attentions",val:" = None"},{name:"output_hidden_states",val:" = None"},{name:"return_dict",val:" = None"},{name:"is_decoder",val:" = False"},{name:"training",val:" = None"}],parametersDescription:[{anchor:"transformers.TFBlipTextModel.call.input_ids",description:`<strong>input_ids</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide
it.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.31.0/en/model_doc/auto#transformers.AutoProcessor">AutoProcessor</a>. See <code>BlipProcessor.__call__()</code> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TFBlipTextModel.call.attention_mask",description:`<strong>attention_mask</strong> (<code>tf.Tensor</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>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TFBlipTextModel.call.position_ids",description:`<strong>position_ids</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.TFBlipTextModel.call.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.TFBlipTextModel.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.TFBlipTextModel.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.TFBlipTextModel.call.encoder_hidden_states",description:`<strong>encoder_hidden_states</strong>  (<code>tf.Tensor</code>, <em>optional</em>) &#x2014;
Sequence of hidden-states at the output of the last layer of the encoder. Used in the cross-attention if
the model is configured as a decoder.`,name:"encoder_hidden_states"},{anchor:"transformers.TFBlipTextModel.call.encoder_attention_mask",description:`<strong>encoder_attention_mask</strong> (<code>tf.Tensor</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on the padding token indices of the encoder input. This mask is used in
the cross-attention if the model is configured as a decoder. 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>.</li>
</ul>`,name:"encoder_attention_mask"},{anchor:"transformers.TFBlipTextModel.call.past_key_values",description:`<strong>past_key_values</strong> (<code>tuple(tuple(tf.Tensor))</code>, <em>optional</em>) &#x2014;
Contains precomputed key and value hidden states of the attention blocks. Can be used to speed up decoding.
If <code>past_key_values</code> are used, the user can optionally input only the last <code>decoder_input_ids</code> (those that
don&#x2019;t have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all
<code>decoder_input_ids</code> of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.TFBlipTextModel.call.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see
<code>past_key_values</code>).`,name:"use_cache"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/blip/modeling_tf_blip_text.py#L667"}}),po=new G({props:{$$slots:{default:[Jy]},$$scope:{ctx:x}}}),ns=new F({}),ss=new j({props:{name:"class transformers.TFBlipVisionModel",anchor:"transformers.TFBlipVisionModel",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/blip/modeling_tf_blip.py#L639"}}),rs=new j({props:{name:"call",anchor:"transformers.TFBlipVisionModel.call",parameters:[{name:"pixel_values",val:": tf.Tensor | None = None"},{name:"output_attentions",val:": Optional[bool] = None"},{name:"output_hidden_states",val:": Optional[bool] = None"},{name:"return_dict",val:": Optional[bool] = None"},{name:"training",val:": Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.TFBlipVisionModel.call.pixel_values",description:`<strong>pixel_values</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Padding will be ignored by default should you provide it. Pixel values can be obtained using
<a href="/docs/transformers/v4.31.0/en/model_doc/blip#transformers.BlipImageProcessor">BlipImageProcessor</a>. See <a href="/docs/transformers/v4.31.0/en/model_doc/perceiver#transformers.PerceiverFeatureExtractor.__call__">BlipImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.TFBlipVisionModel.call.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.TFBlipVisionModel.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.TFBlipVisionModel.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/blip/modeling_tf_blip.py#L662",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.modeling_tf_outputs.TFBaseModelOutputWithPooling"
>transformers.modeling_tf_outputs.TFBaseModelOutputWithPooling</a> or a tuple of <code>tf.Tensor</code> (if
<code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various elements depending on the
configuration (<code>&lt;class 'transformers.models.blip.configuration_blip.BlipVisionConfig'&gt;</code>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) \u2014 Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>pooler_output</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, hidden_size)</code>) \u2014 Last layer hidden-state of the first token of the sequence (classification token) further processed by a
Linear layer and a Tanh activation function. The Linear layer weights are trained from the next sentence
prediction (classification) objective during pretraining.</p>
<p>This output is usually <em>not</em> a good summary of the semantic content of the input, you\u2019re often better with
averaging or pooling the sequence of hidden-states for the whole input sequence.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for the output of the embeddings + one for the output of each layer) of shape
<code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.modeling_tf_outputs.TFBaseModelOutputWithPooling"
>transformers.modeling_tf_outputs.TFBaseModelOutputWithPooling</a> or <code>tuple(tf.Tensor)</code></p>
`}}),ho=new G({props:{$$slots:{default:[jy]},$$scope:{ctx:x}}}),as=new F({}),ls=new j({props:{name:"class transformers.TFBlipForConditionalGeneration",anchor:"transformers.TFBlipForConditionalGeneration",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFBlipForConditionalGeneration.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.31.0/en/model_doc/blip#transformers.BlipConfig">BlipConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.31.0/en/main_classes/model#transformers.TFPreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/blip/modeling_tf_blip.py#L998"}}),ms=new j({props:{name:"call",anchor:"transformers.TFBlipForConditionalGeneration.call",parameters:[{name:"pixel_values",val:": tf.Tensor"},{name:"input_ids",val:": tf.Tensor | None = None"},{name:"attention_mask",val:": tf.Tensor | None = None"},{name:"output_attentions",val:": Optional[bool] = None"},{name:"output_hidden_states",val:": Optional[bool] = None"},{name:"labels",val:": tf.Tensor | None = None"},{name:"return_dict",val:": Optional[bool] = None"},{name:"training",val:": Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.TFBlipForConditionalGeneration.call.pixel_values",description:`<strong>pixel_values</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Padding will be ignored by default should you provide it. Pixel values can be obtained using
<a href="/docs/transformers/v4.31.0/en/model_doc/blip#transformers.BlipImageProcessor">BlipImageProcessor</a>. See <a href="/docs/transformers/v4.31.0/en/model_doc/perceiver#transformers.PerceiverFeatureExtractor.__call__">BlipImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.TFBlipForConditionalGeneration.call.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.TFBlipForConditionalGeneration.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.TFBlipForConditionalGeneration.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/blip/modeling_tf_blip.py#L1016",returnDescription:`
<p>A <code>transformers.models.blip.modeling_tf_blip.TFBlipForConditionalGenerationModelOutput</code> or a tuple of <code>tf.Tensor</code> (if
<code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various elements depending on the
configuration (<code>&lt;class 'transformers.models.blip.configuration_blip.BlipConfig'&gt;</code>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>tf.Tensor</code>, <em>optional</em>, returned when <code>labels</code> is provided, <code>tf.Tensor</code> of shape <code>(1,)</code>) \u2014 Languge modeling loss from the text decoder.</p>
</li>
<li>
<p><strong>decoder_logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, config.vocab_size)</code>, <em>optional</em>) \u2014 Prediction scores of the language modeling head of the text decoder model.</p>
</li>
<li>
<p><strong>image_embeds</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, output_dim)</code>, <em>optional</em>) \u2014 The image embeddings obtained after applying the Vision Transformer model to the input image.</p>
</li>
<li>
<p><strong>last_hidden_state</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) \u2014 Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for the output of the embeddings, if the model has an embedding layer, + one for
the output of each 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(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed) \u2014 Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.\`</p>
</li>
</ul>
`,returnType:`
<p><code>transformers.models.blip.modeling_tf_blip.TFBlipForConditionalGenerationModelOutput</code> or <code>tuple(tf.Tensor)</code></p>
`}}),uo=new G({props:{$$slots:{default:[Ey]},$$scope:{ctx:x}}}),go=new A({props:{anchor:"transformers.TFBlipForConditionalGeneration.call.example",$$slots:{default:[Iy]},$$scope:{ctx:x}}}),hs=new F({}),fs=new j({props:{name:"class transformers.TFBlipForImageTextRetrieval",anchor:"transformers.TFBlipForImageTextRetrieval",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFBlipForImageTextRetrieval.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.31.0/en/model_doc/blip#transformers.BlipConfig">BlipConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.31.0/en/main_classes/model#transformers.TFPreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/blip/modeling_tf_blip.py#L1411"}}),bs=new j({props:{name:"call",anchor:"transformers.TFBlipForImageTextRetrieval.call",parameters:[{name:"input_ids",val:": tf.Tensor"},{name:"pixel_values",val:": tf.Tensor | None = None"},{name:"use_itm_head",val:": Optional[bool] = True"},{name:"attention_mask",val:": tf.Tensor | None = None"},{name:"output_attentions",val:": Optional[bool] = None"},{name:"output_hidden_states",val:": Optional[bool] = None"},{name:"return_dict",val:": Optional[bool] = None"},{name:"training",val:": Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.TFBlipForImageTextRetrieval.call.pixel_values",description:`<strong>pixel_values</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Padding will be ignored by default should you provide it. Pixel values can be obtained using
<a href="/docs/transformers/v4.31.0/en/model_doc/blip#transformers.BlipImageProcessor">BlipImageProcessor</a>. See <a href="/docs/transformers/v4.31.0/en/model_doc/perceiver#transformers.PerceiverFeatureExtractor.__call__">BlipImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.TFBlipForImageTextRetrieval.call.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.TFBlipForImageTextRetrieval.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.TFBlipForImageTextRetrieval.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/blip/modeling_tf_blip.py#L1454",returnDescription:`
<p>A <code>transformers.models.blip.modeling_tf_blip.TFBlipImageTextMatchingModelOutput</code> or a tuple of <code>tf.Tensor</code> (if
<code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various elements depending on the
configuration (<code>&lt;class 'transformers.models.blip.configuration_blip.BlipVisionConfig'&gt;</code>) and inputs.</p>
<ul>
<li>
<p><strong>itm_score</strong> (<code>tf.Tensor</code>) \u2014 The image-text similarity scores.</p>
</li>
<li>
<p><strong>loss</strong> (<code>tf.Tensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) \u2014 Languge modeling loss from the text decoder.</p>
</li>
<li>
<p><strong>image_embeds</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, output_dim)</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.</p>
</li>
<li>
<p><strong>last_hidden_state</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) \u2014 Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for the output of the embeddings, if the model has an embedding layer, + one for
the output of each 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>vision_pooler_output</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, hidden_size)</code>, <em>optional</em>) \u2014 Last layer hidden-state of the vision of the vision-only branch of the model.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
<li>
<p><strong>question_embeds</strong> (<code>tf.Tensor</code>) \u2014 The question embeddings obtained by the text projection layer.</p>
</li>
</ul>
`,returnType:`
<p><code>transformers.models.blip.modeling_tf_blip.TFBlipImageTextMatchingModelOutput</code> or <code>tuple(tf.Tensor)</code></p>
`}}),bo=new G({props:{$$slots:{default:[Fy]},$$scope:{ctx:x}}}),vo=new A({props:{anchor:"transformers.TFBlipForImageTextRetrieval.call.example",$$slots:{default:[ky]},$$scope:{ctx:x}}}),vs=new F({}),ys=new j({props:{name:"class transformers.TFBlipForQuestionAnswering",anchor:"transformers.TFBlipForQuestionAnswering",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFBlipForQuestionAnswering.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.31.0/en/model_doc/blip#transformers.BlipConfig">BlipConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.31.0/en/main_classes/model#transformers.TFPreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/blip/modeling_tf_blip.py#L1170"}}),$s=new j({props:{name:"call",anchor:"transformers.TFBlipForQuestionAnswering.call",parameters:[{name:"input_ids",val:": tf.Tensor"},{name:"pixel_values",val:": tf.Tensor | None = None"},{name:"decoder_input_ids",val:": tf.Tensor | None = None"},{name:"decoder_attention_mask",val:": tf.Tensor | None = None"},{name:"attention_mask",val:": tf.Tensor | None = None"},{name:"output_attentions",val:": Optional[bool] = None"},{name:"output_hidden_states",val:": Optional[bool] = None"},{name:"labels",val:": tf.Tensor | None = None"},{name:"return_dict",val:": Optional[bool] = None"},{name:"training",val:": Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.TFBlipForQuestionAnswering.call.pixel_values",description:`<strong>pixel_values</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Padding will be ignored by default should you provide it. Pixel values can be obtained using
<a href="/docs/transformers/v4.31.0/en/model_doc/blip#transformers.BlipImageProcessor">BlipImageProcessor</a>. See <a href="/docs/transformers/v4.31.0/en/model_doc/perceiver#transformers.PerceiverFeatureExtractor.__call__">BlipImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.TFBlipForQuestionAnswering.call.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.TFBlipForQuestionAnswering.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.TFBlipForQuestionAnswering.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/blip/modeling_tf_blip.py#L1213",returnDescription:`
<p>A <code>transformers.models.blip.modeling_tf_blip.TFBlipTextVisionModelOutput</code> or a tuple of <code>tf.Tensor</code> (if
<code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various elements depending on the
configuration (<code>&lt;class 'transformers.models.blip.configuration_blip.BlipVisionConfig'&gt;</code>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>tf.Tensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) \u2014 Languge modeling loss from the text decoder.</p>
</li>
<li>
<p><strong>image_embeds</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, output_dim)</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.</p>
</li>
<li>
<p><strong>last_hidden_state</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) \u2014 Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for the output of the embeddings, if the model has an embedding layer, + one for
the output of each 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(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><code>transformers.models.blip.modeling_tf_blip.TFBlipTextVisionModelOutput</code> or <code>tuple(tf.Tensor)</code></p>
`}}),To=new G({props:{$$slots:{default:[Uy]},$$scope:{ctx:x}}}),wo=new A({props:{anchor:"transformers.TFBlipForQuestionAnswering.call.example",$$slots:{default:[Cy]},$$scope:{ctx:x}}}),{c(){d=a("meta"),v=h(),u=a("h1"),m=a("a"),_=a("span"),y(n.$$.fragment),c=h(),J=a("span"),Nd=s("BLIP"),ni=h(),Ce=a("h2"),wt=a("a"),Lr=a("span"),y(Zo.$$.fragment),Pd=h(),Dr=a("span"),Zd=s("Overview"),si=h(),Mt=a("p"),Vd=s("The BLIP model was proposed in "),Vo=a("a"),Rd=s("BLIP: Bootstrapping Language-Image Pre-training for Unified Vision-Language Understanding and Generation"),Gd=s(" by Junnan Li, Dongxu Li, Caiming Xiong, Steven Hoi."),ri=h(),Fs=a("p"),Ad=s("BLIP is a model that is able to perform various multi-modal tasks including"),ai=h(),_e=a("ul"),Or=a("li"),Sd=s("Visual Question Answering"),qd=h(),Kr=a("li"),Xd=s("Image-Text retrieval (Image-text matching)"),Qd=h(),ea=a("li"),Hd=s("Image Captioning"),li=h(),ks=a("p"),Yd=s("The abstract from the paper is the following:"),ii=h(),Us=a("p"),ta=a("em"),Ld=s(`Vision-Language Pre-training (VLP) has advanced the performance for many vision-language tasks.
However, most existing pre-trained models only excel in either understanding-based tasks or generation-based tasks. Furthermore, performance improvement has been largely achieved by scaling up the dataset with noisy image-text pairs collected from the web, which is a suboptimal source of supervision. In this paper, we propose BLIP, a new VLP framework which transfers flexibly to both vision-language understanding and generation tasks. BLIP effectively utilizes the noisy web data by bootstrapping the captions, where a captioner generates synthetic captions and a filter removes the noisy ones. We achieve state-of-the-art results on a wide range of vision-language tasks, such as image-text retrieval (+2.7% in average recall@1), image captioning (+2.8% in CIDEr), and VQA (+1.6% in VQA score). BLIP also demonstrates strong generalization ability when directly transferred to videolanguage tasks in a zero-shot manner. Code, models, and datasets are released.`),di=h(),Cs=a("p"),zs=a("img"),ci=h(),be=a("p"),Dd=s("This model was contributed by "),Ro=a("a"),Od=s("ybelkada"),Kd=s(`.
The original code can be found `),Go=a("a"),ec=s("here"),tc=s("."),pi=h(),ze=a("h2"),$t=a("a"),oa=a("span"),y(Ao.$$.fragment),oc=h(),na=a("span"),nc=s("Resources"),mi=h(),Ws=a("ul"),Ns=a("li"),So=a("a"),sc=s("Jupyter notebook"),rc=s(" on how to fine-tune BLIP for image captioning on a custom dataset"),hi=h(),We=a("h2"),Bt=a("a"),sa=a("span"),y(qo.$$.fragment),ac=h(),ra=a("span"),lc=s("BlipConfig"),fi=h(),U=a("div"),y(Xo.$$.fragment),ic=h(),ve=a("p"),Ps=a("a"),dc=s("BlipConfig"),cc=s(" is the configuration class to store the configuration of a "),Zs=a("a"),pc=s("BlipModel"),mc=s(`. It is used to instantiate
a BLIP model according to the specified arguments, defining the text model and vision model configs. Instantiating
a configuration with the defaults will yield a similar configuration to that of the BLIP-base
`),Qo=a("a"),hc=s("Salesforce/blip-vqa-base"),fc=s(" architecture."),uc=h(),Ne=a("p"),gc=s("Configuration objects inherit from "),Vs=a("a"),_c=s("PretrainedConfig"),bc=s(` and can be used to control the model outputs. Read the
documentation from `),Rs=a("a"),vc=s("PretrainedConfig"),yc=s(" for more information."),Tc=h(),y(xt.$$.fragment),wc=h(),Jt=a("div"),y(Ho.$$.fragment),Mc=h(),Yo=a("p"),$c=s("Instantiate a "),Gs=a("a"),Bc=s("BlipConfig"),xc=s(` (or a derived class) from blip text model configuration and blip vision model
configuration.`),ui=h(),Pe=a("h2"),jt=a("a"),aa=a("span"),y(Lo.$$.fragment),Jc=h(),la=a("span"),jc=s("BlipTextConfig"),gi=h(),Q=a("div"),y(Do.$$.fragment),Ec=h(),me=a("p"),Ic=s("This is the configuration class to store the configuration of a "),As=a("a"),Fc=s("BlipTextModel"),kc=s(`. It is used to instantiate a BLIP
text 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 `),ia=a("code"),Uc=s("BlipText"),Cc=s(" used by the "),Oo=a("a"),zc=s(`base
architectures`),Wc=s("."),Nc=h(),Ze=a("p"),Pc=s("Configuration objects inherit from "),Ss=a("a"),Zc=s("PretrainedConfig"),Vc=s(` and can be used to control the model outputs. Read the
documentation from `),qs=a("a"),Rc=s("PretrainedConfig"),Gc=s(" for more information."),Ac=h(),y(Et.$$.fragment),_i=h(),Ve=a("h2"),It=a("a"),da=a("span"),y(Ko.$$.fragment),Sc=h(),ca=a("span"),qc=s("BlipVisionConfig"),bi=h(),H=a("div"),y(en.$$.fragment),Xc=h(),Re=a("p"),Qc=s("This is the configuration class to store the configuration of a "),Xs=a("a"),Hc=s("BlipVisionModel"),Yc=s(`. It is used to instantiate a
BLIP vision model according to the specified arguments, defining the model architecture. Instantiating a
configuration defaults will yield a similar configuration to that of the Blip-base
`),tn=a("a"),Lc=s("Salesforce/blip-vqa-base"),Dc=s(" architecture."),Oc=h(),Ge=a("p"),Kc=s("Configuration objects inherit from "),Qs=a("a"),ep=s("PretrainedConfig"),tp=s(` and can be used to control the model outputs. Read the
documentation from `),Hs=a("a"),op=s("PretrainedConfig"),np=s(" for more information."),sp=h(),y(Ft.$$.fragment),vi=h(),Ae=a("h2"),kt=a("a"),pa=a("span"),y(on.$$.fragment),rp=h(),ma=a("span"),ap=s("BlipProcessor"),yi=h(),C=a("div"),y(nn.$$.fragment),lp=h(),ha=a("p"),ip=s("Constructs a BLIP processor which wraps a BERT tokenizer and BLIP image processor into a single processor."),dp=h(),X=a("p"),Ys=a("a"),cp=s("BlipProcessor"),pp=s(" offers all the functionalities of "),Ls=a("a"),mp=s("BlipImageProcessor"),hp=s(" and "),Ds=a("a"),fp=s("BertTokenizerFast"),up=s(`. See the
docstring of `),fa=a("code"),gp=s("__call__()"),_p=s(" and "),Os=a("a"),bp=s("decode()"),vp=s(" for more information."),yp=h(),Ut=a("div"),y(sn.$$.fragment),Tp=h(),rn=a("p"),wp=s("This method forwards all its arguments to BertTokenizerFast\u2019s "),Ks=a("a"),Mp=s("batch_decode()"),$p=s(`. Please
refer to the docstring of this method for more information.`),Bp=h(),Ct=a("div"),y(an.$$.fragment),xp=h(),ln=a("p"),Jp=s("This method forwards all its arguments to BertTokenizerFast\u2019s "),er=a("a"),jp=s("decode()"),Ep=s(`. Please refer to
the docstring of this method for more information.`),Ti=h(),Se=a("h2"),zt=a("a"),ua=a("span"),y(dn.$$.fragment),Ip=h(),ga=a("span"),Fp=s("BlipImageProcessor"),wi=h(),he=a("div"),y(cn.$$.fragment),kp=h(),_a=a("p"),Up=s("Constructs a BLIP image processor."),Cp=h(),Wt=a("div"),y(pn.$$.fragment),zp=h(),ba=a("p"),Wp=s("Preprocess an image or batch of images."),Mi=h(),qe=a("h2"),Nt=a("a"),va=a("span"),y(mn.$$.fragment),Np=h(),ya=a("span"),Pp=s("BlipModel"),$i=h(),k=a("div"),y(hn.$$.fragment),Zp=h(),fn=a("p"),Vp=s("This model inherits from "),tr=a("a"),Rp=s("PreTrainedModel"),Gp=s(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Ap=h(),un=a("p"),Sp=s("This model is also a PyTorch "),gn=a("a"),qp=s("torch.nn.Module"),Xp=s(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Qp=h(),O=a("div"),y(_n.$$.fragment),Hp=h(),Xe=a("p"),Yp=s("The "),or=a("a"),Lp=s("BlipModel"),Dp=s(" forward method, overrides the "),Ta=a("code"),Op=s("__call__"),Kp=s(" special method."),em=h(),y(Pt.$$.fragment),tm=h(),y(Zt.$$.fragment),om=h(),K=a("div"),y(bn.$$.fragment),nm=h(),Qe=a("p"),sm=s("The "),nr=a("a"),rm=s("BlipModel"),am=s(" forward method, overrides the "),wa=a("code"),lm=s("__call__"),im=s(" special method."),dm=h(),y(Vt.$$.fragment),cm=h(),y(Rt.$$.fragment),pm=h(),ee=a("div"),y(vn.$$.fragment),mm=h(),He=a("p"),hm=s("The "),sr=a("a"),fm=s("BlipModel"),um=s(" forward method, overrides the "),Ma=a("code"),gm=s("__call__"),_m=s(" special method."),bm=h(),y(Gt.$$.fragment),vm=h(),y(At.$$.fragment),Bi=h(),Ye=a("h2"),St=a("a"),$a=a("span"),y(yn.$$.fragment),ym=h(),Ba=a("span"),Tm=s("BlipTextModel"),xi=h(),fe=a("div"),y(Tn.$$.fragment),wm=h(),Y=a("p"),Mm=s(`The model can behave as an encoder (with only self-attention) as well as a decoder, in which case a layer of
cross-attention is added between the self-attention layers, following the architecture described in `),wn=a("a"),$m=s(`Attention is
all you need`),Bm=s(` by Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit,
Llion Jones, Aidan N. Gomez, Lukasz Kaiser and Illia Polosukhin. argument and `),xa=a("code"),xm=s("is_decoder"),Jm=s(" set to "),Ja=a("code"),jm=s("True"),Em=s(`; an
`),ja=a("code"),Im=s("encoder_hidden_states"),Fm=s(" is then expected as an input to the forward pass."),km=h(),ye=a("div"),y(Mn.$$.fragment),Um=h(),z=a("p"),Cm=s("encoder_hidden_states  ("),Ea=a("code"),zm=s("torch.FloatTensor"),Wm=s(", "),Ia=a("em"),Nm=s("optional"),Pm=s(`):
Sequence of hidden-states at the output of the last layer of the encoder. Used in the cross-attention if
the model is configured as a decoder.
encoder_attention_mask (`),Fa=a("code"),Zm=s("torch.FloatTensor"),Vm=s(", "),ka=a("em"),Rm=s("optional"),Gm=s(`):
Mask to avoid performing attention on the padding token indices of the encoder input. This mask is used in
the cross-attention if the model is configured as a decoder. Mask values selected in `),Ua=a("code"),Am=s("[0, 1]"),Sm=s(":"),qm=h(),$n=a("ul"),Bn=a("li"),Xm=s("1 for tokens that are "),Ca=a("strong"),Qm=s("not masked"),Hm=s(","),Ym=h(),E=a("li"),Lm=s("0 for tokens that are "),za=a("strong"),Dm=s("masked"),Om=s(`.
past_key_values (`),Wa=a("code"),Km=s("tuple(tuple(torch.FloatTensor))"),eh=s(", "),Na=a("em"),th=s("optional"),oh=s(`):
Contains precomputed key and value hidden states of the attention blocks. Can be used to speed up decoding.
If `),Pa=a("code"),nh=s("past_key_values"),sh=s(" are used, the user can optionally input only the last "),Za=a("code"),rh=s("decoder_input_ids"),ah=s(` (those that
don\u2019t have their past key value states given to this model) of shape `),Va=a("code"),lh=s("(batch_size, 1)"),ih=s(` instead of all
`),Ra=a("code"),dh=s("decoder_input_ids"),ch=s(" of shape "),Ga=a("code"),ph=s("(batch_size, sequence_length)"),mh=s(`.
use_cache (`),Aa=a("code"),hh=s("bool"),fh=s(", "),Sa=a("em"),uh=s("optional"),gh=s(`):
If set to `),qa=a("code"),_h=s("True"),bh=s(", "),Xa=a("code"),vh=s("past_key_values"),yh=s(` key value states are returned and can be used to speed up decoding (see
`),Qa=a("code"),Th=s("past_key_values"),wh=s(")."),Ji=h(),Le=a("h2"),qt=a("a"),Ha=a("span"),y(xn.$$.fragment),Mh=h(),Ya=a("span"),$h=s("BlipVisionModel"),ji=h(),De=a("div"),y(Jn.$$.fragment),Bh=h(),Te=a("div"),y(jn.$$.fragment),xh=h(),Oe=a("p"),Jh=s("The "),rr=a("a"),jh=s("BlipVisionModel"),Eh=s(" forward method, overrides the "),La=a("code"),Ih=s("__call__"),Fh=s(" special method."),kh=h(),y(Xt.$$.fragment),Ei=h(),Ke=a("h2"),Qt=a("a"),Da=a("span"),y(En.$$.fragment),Uh=h(),Oa=a("span"),Ch=s("BlipForConditionalGeneration"),Ii=h(),W=a("div"),y(In.$$.fragment),zh=h(),Fn=a("p"),Wh=s(`BLIP Model for image captioning. The model consists of a vision encoder and a text decoder. One can optionally pass
`),Ka=a("code"),Nh=s("input_ids"),Ph=s(` to the model, which serve as a text prompt, to make the text decoder continue the prompt. Otherwise,
the decoder starts generating text from the [BOS] (beginning-of-sequence) token. will start generating the caption
from the text input. If no text input is provided, the decoder will start with the [BOS] token only.`),Zh=h(),kn=a("p"),Vh=s("This model inherits from "),ar=a("a"),Rh=s("PreTrainedModel"),Gh=s(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Ah=h(),Un=a("p"),Sh=s("This model is also a PyTorch "),Cn=a("a"),qh=s("torch.nn.Module"),Xh=s(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Qh=h(),te=a("div"),y(zn.$$.fragment),Hh=h(),et=a("p"),Yh=s("The "),lr=a("a"),Lh=s("BlipForConditionalGeneration"),Dh=s(" forward method, overrides the "),el=a("code"),Oh=s("__call__"),Kh=s(" special method."),ef=h(),y(Ht.$$.fragment),tf=h(),y(Yt.$$.fragment),Fi=h(),tt=a("h2"),Lt=a("a"),tl=a("span"),y(Wn.$$.fragment),of=h(),ol=a("span"),nf=s("BlipForImageTextRetrieval"),ki=h(),N=a("div"),y(Nn.$$.fragment),sf=h(),nl=a("p"),rf=s(`BLIP Model with a vision and text projector, and a classification head on top. The model is used in the context of
image-text retrieval. Given an image and a text, the model returns the probability of the text being relevant to
the image.`),af=h(),Pn=a("p"),lf=s("This model inherits from "),ir=a("a"),df=s("PreTrainedModel"),cf=s(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),pf=h(),Zn=a("p"),mf=s("This model is also a PyTorch "),Vn=a("a"),hf=s("torch.nn.Module"),ff=s(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),uf=h(),oe=a("div"),y(Rn.$$.fragment),gf=h(),ot=a("p"),_f=s("The "),dr=a("a"),bf=s("BlipForImageTextRetrieval"),vf=s(" forward method, overrides the "),sl=a("code"),yf=s("__call__"),Tf=s(" special method."),wf=h(),y(Dt.$$.fragment),Mf=h(),y(Ot.$$.fragment),Ui=h(),nt=a("h2"),Kt=a("a"),rl=a("span"),y(Gn.$$.fragment),$f=h(),al=a("span"),Bf=s("BlipForQuestionAnswering"),Ci=h(),P=a("div"),y(An.$$.fragment),xf=h(),ll=a("p"),Jf=s(`BLIP Model for visual question answering. The model consists of a vision encoder, a text encoder as well as a text
decoder. The vision encoder will encode the input image, the text encoder will encode the input question together
with the encoding of the image, and the text decoder will output the answer to the question.`),jf=h(),Sn=a("p"),Ef=s("This model inherits from "),cr=a("a"),If=s("PreTrainedModel"),Ff=s(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),kf=h(),qn=a("p"),Uf=s("This model is also a PyTorch "),Xn=a("a"),Cf=s("torch.nn.Module"),zf=s(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Wf=h(),ne=a("div"),y(Qn.$$.fragment),Nf=h(),st=a("p"),Pf=s("The "),pr=a("a"),Zf=s("BlipForQuestionAnswering"),Vf=s(" forward method, overrides the "),il=a("code"),Rf=s("__call__"),Gf=s(" special method."),Af=h(),y(eo.$$.fragment),Sf=h(),y(to.$$.fragment),zi=h(),rt=a("h2"),oo=a("a"),dl=a("span"),y(Hn.$$.fragment),qf=h(),cl=a("span"),Xf=s("TFBlipModel"),Wi=h(),L=a("div"),y(Yn.$$.fragment),Qf=h(),se=a("div"),y(Ln.$$.fragment),Hf=h(),at=a("p"),Yf=s("The "),mr=a("a"),Lf=s("TFBlipModel"),Df=s(" forward method, overrides the "),pl=a("code"),Of=s("__call__"),Kf=s(" special method."),eu=h(),y(no.$$.fragment),tu=h(),y(so.$$.fragment),ou=h(),re=a("div"),y(Dn.$$.fragment),nu=h(),lt=a("p"),su=s("The "),hr=a("a"),ru=s("TFBlipModel"),au=s(" forward method, overrides the "),ml=a("code"),lu=s("__call__"),iu=s(" special method."),du=h(),y(ro.$$.fragment),cu=h(),y(ao.$$.fragment),pu=h(),ae=a("div"),y(On.$$.fragment),mu=h(),it=a("p"),hu=s("The "),fr=a("a"),fu=s("TFBlipModel"),uu=s(" forward method, overrides the "),hl=a("code"),gu=s("__call__"),_u=s(" special method."),bu=h(),y(lo.$$.fragment),vu=h(),y(io.$$.fragment),Ni=h(),dt=a("h2"),co=a("a"),fl=a("span"),y(Kn.$$.fragment),yu=h(),ul=a("span"),Tu=s("TFBlipTextModel"),Pi=h(),ue=a("div"),y(es.$$.fragment),wu=h(),D=a("p"),Mu=s(`The model can behave as an encoder (with only self-attention) as well as a decoder, in which case a layer of
cross-attention is added between the self-attention layers, following the architecture described in `),ts=a("a"),$u=s(`Attention is
all you need`),Bu=s(` by Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit,
Llion Jones, Aidan N. Gomez, Lukasz Kaiser and Illia Polosukhin. argument and `),gl=a("code"),xu=s("is_decoder"),Ju=s(" set to "),_l=a("code"),ju=s("True"),Eu=s(`; an
`),bl=a("code"),Iu=s("encoder_hidden_states"),Fu=s(" is then expected as an input to the forward pass."),ku=h(),we=a("div"),y(os.$$.fragment),Uu=h(),ct=a("p"),Cu=s("The "),ur=a("a"),zu=s("TFBlipTextModel"),Wu=s(" forward method, overrides the "),vl=a("code"),Nu=s("__call__"),Pu=s(" special method."),Zu=h(),y(po.$$.fragment),Zi=h(),pt=a("h2"),mo=a("a"),yl=a("span"),y(ns.$$.fragment),Vu=h(),Tl=a("span"),Ru=s("TFBlipVisionModel"),Vi=h(),mt=a("div"),y(ss.$$.fragment),Gu=h(),Me=a("div"),y(rs.$$.fragment),Au=h(),ht=a("p"),Su=s("The "),gr=a("a"),qu=s("TFBlipVisionModel"),Xu=s(" forward method, overrides the "),wl=a("code"),Qu=s("__call__"),Hu=s(" special method."),Yu=h(),y(ho.$$.fragment),Ri=h(),ft=a("h2"),fo=a("a"),Ml=a("span"),y(as.$$.fragment),Lu=h(),$l=a("span"),Du=s("TFBlipForConditionalGeneration"),Gi=h(),Z=a("div"),y(ls.$$.fragment),Ou=h(),is=a("p"),Ku=s(`BLIP Model for image captioning. The model consists of a vision encoder and a text decoder. One can optionally pass
`),Bl=a("code"),eg=s("input_ids"),tg=s(` to the model, which serve as a text prompt, to make the text decoder continue the prompt. Otherwise,
the decoder starts generating text from the [BOS] (beginning-of-sequence) token. will start generating the caption
from the text input. If no text input is provided, the decoder will start with the [BOS] token only.`),og=h(),ds=a("p"),ng=s("This model inherits from "),_r=a("a"),sg=s("TFPreTrainedModel"),rg=s(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),ag=h(),cs=a("p"),lg=s("This model is also a "),ps=a("a"),ig=s("tf.keras.Model"),dg=s(` subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`),cg=h(),le=a("div"),y(ms.$$.fragment),pg=h(),ut=a("p"),mg=s("The "),br=a("a"),hg=s("TFBlipForConditionalGeneration"),fg=s(" forward method, overrides the "),xl=a("code"),ug=s("__call__"),gg=s(" special method."),_g=h(),y(uo.$$.fragment),bg=h(),y(go.$$.fragment),Ai=h(),gt=a("h2"),_o=a("a"),Jl=a("span"),y(hs.$$.fragment),vg=h(),jl=a("span"),yg=s("TFBlipForImageTextRetrieval"),Si=h(),V=a("div"),y(fs.$$.fragment),Tg=h(),El=a("p"),wg=s(`BLIP Model with a vision and text projector, and a classification head on top. The model is used in the context of
image-text retrieval. Given an image and a text, the model returns the probability of the text being relevant to
the image.`),Mg=h(),us=a("p"),$g=s("This model inherits from "),vr=a("a"),Bg=s("TFPreTrainedModel"),xg=s(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Jg=h(),gs=a("p"),jg=s("This model is also a "),_s=a("a"),Eg=s("tf.keras.Model"),Ig=s(` subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`),Fg=h(),ie=a("div"),y(bs.$$.fragment),kg=h(),_t=a("p"),Ug=s("The "),yr=a("a"),Cg=s("TFBlipForImageTextRetrieval"),zg=s(" forward method, overrides the "),Il=a("code"),Wg=s("__call__"),Ng=s(" special method."),Pg=h(),y(bo.$$.fragment),Zg=h(),y(vo.$$.fragment),qi=h(),bt=a("h2"),yo=a("a"),Fl=a("span"),y(vs.$$.fragment),Vg=h(),kl=a("span"),Rg=s("TFBlipForQuestionAnswering"),Xi=h(),R=a("div"),y(ys.$$.fragment),Gg=h(),Ul=a("p"),Ag=s(`BLIP Model for visual question answering. The model consists of a vision encoder, a text encoder as well as a text
decoder. The vision encoder will encode the input image, the text encoder will encode the input question together
with the encoding of the image, and the text decoder will output the answer to the question.`),Sg=h(),Ts=a("p"),qg=s("This model inherits from "),Tr=a("a"),Xg=s("TFPreTrainedModel"),Qg=s(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Hg=h(),ws=a("p"),Yg=s("This model is also a "),Ms=a("a"),Lg=s("tf.keras.Model"),Dg=s(` subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`),Og=h(),de=a("div"),y($s.$$.fragment),Kg=h(),vt=a("p"),e_=s("The "),wr=a("a"),t_=s("TFBlipForQuestionAnswering"),o_=s(" forward method, overrides the "),Cl=a("code"),n_=s("__call__"),s_=s(" special method."),r_=h(),y(To.$$.fragment),a_=h(),y(wo.$$.fragment),this.h()},l(t){const g=oy('[data-svelte="svelte-1phssyn"]',document.head);d=l(g,"META",{name:!0,content:!0}),g.forEach(o),v=f(t),u=l(t,"H1",{class:!0});var Bs=i(u);m=l(Bs,"A",{id:!0,class:!0,href:!0});var zl=i(m);_=l(zl,"SPAN",{});var Wl=i(_);T(n.$$.fragment,Wl),Wl.forEach(o),zl.forEach(o),c=f(Bs),J=l(Bs,"SPAN",{});var Nl=i(J);Nd=r(Nl,"BLIP"),Nl.forEach(o),Bs.forEach(o),ni=f(t),Ce=l(t,"H2",{class:!0});var xs=i(Ce);wt=l(xs,"A",{id:!0,class:!0,href:!0});var Pl=i(wt);Lr=l(Pl,"SPAN",{});var Zl=i(Lr);T(Zo.$$.fragment,Zl),Zl.forEach(o),Pl.forEach(o),Pd=f(xs),Dr=l(xs,"SPAN",{});var Vl=i(Dr);Zd=r(Vl,"Overview"),Vl.forEach(o),xs.forEach(o),si=f(t),Mt=l(t,"P",{});var Js=i(Mt);Vd=r(Js,"The BLIP model was proposed in "),Vo=l(Js,"A",{href:!0,rel:!0});var Rl=i(Vo);Rd=r(Rl,"BLIP: Bootstrapping Language-Image Pre-training for Unified Vision-Language Understanding and Generation"),Rl.forEach(o),Gd=r(Js," by Junnan Li, Dongxu Li, Caiming Xiong, Steven Hoi."),Js.forEach(o),ri=f(t),Fs=l(t,"P",{});var Gl=i(Fs);Ad=r(Gl,"BLIP is a model that is able to perform various multi-modal tasks including"),Gl.forEach(o),ai=f(t),_e=l(t,"UL",{});var yt=i(_e);Or=l(yt,"LI",{});var Al=i(Or);Sd=r(Al,"Visual Question Answering"),Al.forEach(o),qd=f(yt),Kr=l(yt,"LI",{});var Sl=i(Kr);Xd=r(Sl,"Image-Text retrieval (Image-text matching)"),Sl.forEach(o),Qd=f(yt),ea=l(yt,"LI",{});var ql=i(ea);Hd=r(ql,"Image Captioning"),ql.forEach(o),yt.forEach(o),li=f(t),ks=l(t,"P",{});var Xl=i(ks);Yd=r(Xl,"The abstract from the paper is the following:"),Xl.forEach(o),ii=f(t),Us=l(t,"P",{});var Ql=i(Us);ta=l(Ql,"EM",{});var Hl=i(ta);Ld=r(Hl,`Vision-Language Pre-training (VLP) has advanced the performance for many vision-language tasks.
However, most existing pre-trained models only excel in either understanding-based tasks or generation-based tasks. Furthermore, performance improvement has been largely achieved by scaling up the dataset with noisy image-text pairs collected from the web, which is a suboptimal source of supervision. In this paper, we propose BLIP, a new VLP framework which transfers flexibly to both vision-language understanding and generation tasks. BLIP effectively utilizes the noisy web data by bootstrapping the captions, where a captioner generates synthetic captions and a filter removes the noisy ones. We achieve state-of-the-art results on a wide range of vision-language tasks, such as image-text retrieval (+2.7% in average recall@1), image captioning (+2.8% in CIDEr), and VQA (+1.6% in VQA score). BLIP also demonstrates strong generalization ability when directly transferred to videolanguage tasks in a zero-shot manner. Code, models, and datasets are released.`),Hl.forEach(o),Ql.forEach(o),di=f(t),Cs=l(t,"P",{});var Yl=i(Cs);zs=l(Yl,"IMG",{src:!0,alt:!0}),Yl.forEach(o),ci=f(t),be=l(t,"P",{});var Tt=i(be);Dd=r(Tt,"This model was contributed by "),Ro=l(Tt,"A",{href:!0,rel:!0});var Ll=i(Ro);Od=r(Ll,"ybelkada"),Ll.forEach(o),Kd=r(Tt,`.
The original code can be found `),Go=l(Tt,"A",{href:!0,rel:!0});var Dl=i(Go);ec=r(Dl,"here"),Dl.forEach(o),tc=r(Tt,"."),Tt.forEach(o),pi=f(t),ze=l(t,"H2",{class:!0});var js=i(ze);$t=l(js,"A",{id:!0,class:!0,href:!0});var Ol=i($t);oa=l(Ol,"SPAN",{});var Kl=i(oa);T(Ao.$$.fragment,Kl),Kl.forEach(o),Ol.forEach(o),oc=f(js),na=l(js,"SPAN",{});var ei=i(na);nc=r(ei,"Resources"),ei.forEach(o),js.forEach(o),mi=f(t),Ws=l(t,"UL",{});var ti=i(Ws);Ns=l(ti,"LI",{});var Mr=i(Ns);So=l(Mr,"A",{href:!0,rel:!0});var oi=i(So);sc=r(oi,"Jupyter notebook"),oi.forEach(o),rc=r(Mr," on how to fine-tune BLIP for image captioning on a custom dataset"),Mr.forEach(o),ti.forEach(o),hi=f(t),We=l(t,"H2",{class:!0});var Es=i(We);Bt=l(Es,"A",{id:!0,class:!0,href:!0});var i_=i(Bt);sa=l(i_,"SPAN",{});var d_=i(sa);T(qo.$$.fragment,d_),d_.forEach(o),i_.forEach(o),ac=f(Es),ra=l(Es,"SPAN",{});var c_=i(ra);lc=r(c_,"BlipConfig"),c_.forEach(o),Es.forEach(o),fi=f(t),U=l(t,"DIV",{class:!0});var $e=i(U);T(Xo.$$.fragment,$e),ic=f($e),ve=l($e,"P",{});var Is=i(ve);Ps=l(Is,"A",{href:!0});var p_=i(Ps);dc=r(p_,"BlipConfig"),p_.forEach(o),cc=r(Is," is the configuration class to store the configuration of a "),Zs=l(Is,"A",{href:!0});var m_=i(Zs);pc=r(m_,"BlipModel"),m_.forEach(o),mc=r(Is,`. It is used to instantiate
a BLIP model according to the specified arguments, defining the text model and vision model configs. Instantiating
a configuration with the defaults will yield a similar configuration to that of the BLIP-base
`),Qo=l(Is,"A",{href:!0,rel:!0});var h_=i(Qo);hc=r(h_,"Salesforce/blip-vqa-base"),h_.forEach(o),fc=r(Is," architecture."),Is.forEach(o),uc=f($e),Ne=l($e,"P",{});var $r=i(Ne);gc=r($r,"Configuration objects inherit from "),Vs=l($r,"A",{href:!0});var f_=i(Vs);_c=r(f_,"PretrainedConfig"),f_.forEach(o),bc=r($r,` and can be used to control the model outputs. Read the
documentation from `),Rs=l($r,"A",{href:!0});var u_=i(Rs);vc=r(u_,"PretrainedConfig"),u_.forEach(o),yc=r($r," for more information."),$r.forEach(o),Tc=f($e),T(xt.$$.fragment,$e),wc=f($e),Jt=l($e,"DIV",{class:!0});var Hi=i(Jt);T(Ho.$$.fragment,Hi),Mc=f(Hi),Yo=l(Hi,"P",{});var Yi=i(Yo);$c=r(Yi,"Instantiate a "),Gs=l(Yi,"A",{href:!0});var g_=i(Gs);Bc=r(g_,"BlipConfig"),g_.forEach(o),xc=r(Yi,` (or a derived class) from blip text model configuration and blip vision model
configuration.`),Yi.forEach(o),Hi.forEach(o),$e.forEach(o),ui=f(t),Pe=l(t,"H2",{class:!0});var Li=i(Pe);jt=l(Li,"A",{id:!0,class:!0,href:!0});var __=i(jt);aa=l(__,"SPAN",{});var b_=i(aa);T(Lo.$$.fragment,b_),b_.forEach(o),__.forEach(o),Jc=f(Li),la=l(Li,"SPAN",{});var v_=i(la);jc=r(v_,"BlipTextConfig"),v_.forEach(o),Li.forEach(o),gi=f(t),Q=l(t,"DIV",{class:!0});var Mo=i(Q);T(Do.$$.fragment,Mo),Ec=f(Mo),me=l(Mo,"P",{});var $o=i(me);Ic=r($o,"This is the configuration class to store the configuration of a "),As=l($o,"A",{href:!0});var y_=i(As);Fc=r(y_,"BlipTextModel"),y_.forEach(o),kc=r($o,`. It is used to instantiate a BLIP
text 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 `),ia=l($o,"CODE",{});var T_=i(ia);Uc=r(T_,"BlipText"),T_.forEach(o),Cc=r($o," used by the "),Oo=l($o,"A",{href:!0,rel:!0});var w_=i(Oo);zc=r(w_,`base
architectures`),w_.forEach(o),Wc=r($o,"."),$o.forEach(o),Nc=f(Mo),Ze=l(Mo,"P",{});var Br=i(Ze);Pc=r(Br,"Configuration objects inherit from "),Ss=l(Br,"A",{href:!0});var M_=i(Ss);Zc=r(M_,"PretrainedConfig"),M_.forEach(o),Vc=r(Br,` and can be used to control the model outputs. Read the
documentation from `),qs=l(Br,"A",{href:!0});var $_=i(qs);Rc=r($_,"PretrainedConfig"),$_.forEach(o),Gc=r(Br," for more information."),Br.forEach(o),Ac=f(Mo),T(Et.$$.fragment,Mo),Mo.forEach(o),_i=f(t),Ve=l(t,"H2",{class:!0});var Di=i(Ve);It=l(Di,"A",{id:!0,class:!0,href:!0});var B_=i(It);da=l(B_,"SPAN",{});var x_=i(da);T(Ko.$$.fragment,x_),x_.forEach(o),B_.forEach(o),Sc=f(Di),ca=l(Di,"SPAN",{});var J_=i(ca);qc=r(J_,"BlipVisionConfig"),J_.forEach(o),Di.forEach(o),bi=f(t),H=l(t,"DIV",{class:!0});var Bo=i(H);T(en.$$.fragment,Bo),Xc=f(Bo),Re=l(Bo,"P",{});var xr=i(Re);Qc=r(xr,"This is the configuration class to store the configuration of a "),Xs=l(xr,"A",{href:!0});var j_=i(Xs);Hc=r(j_,"BlipVisionModel"),j_.forEach(o),Yc=r(xr,`. It is used to instantiate a
BLIP vision model according to the specified arguments, defining the model architecture. Instantiating a
configuration defaults will yield a similar configuration to that of the Blip-base
`),tn=l(xr,"A",{href:!0,rel:!0});var E_=i(tn);Lc=r(E_,"Salesforce/blip-vqa-base"),E_.forEach(o),Dc=r(xr," architecture."),xr.forEach(o),Oc=f(Bo),Ge=l(Bo,"P",{});var Jr=i(Ge);Kc=r(Jr,"Configuration objects inherit from "),Qs=l(Jr,"A",{href:!0});var I_=i(Qs);ep=r(I_,"PretrainedConfig"),I_.forEach(o),tp=r(Jr,` and can be used to control the model outputs. Read the
documentation from `),Hs=l(Jr,"A",{href:!0});var F_=i(Hs);op=r(F_,"PretrainedConfig"),F_.forEach(o),np=r(Jr," for more information."),Jr.forEach(o),sp=f(Bo),T(Ft.$$.fragment,Bo),Bo.forEach(o),vi=f(t),Ae=l(t,"H2",{class:!0});var Oi=i(Ae);kt=l(Oi,"A",{id:!0,class:!0,href:!0});var k_=i(kt);pa=l(k_,"SPAN",{});var U_=i(pa);T(on.$$.fragment,U_),U_.forEach(o),k_.forEach(o),rp=f(Oi),ma=l(Oi,"SPAN",{});var C_=i(ma);ap=r(C_,"BlipProcessor"),C_.forEach(o),Oi.forEach(o),yi=f(t),C=l(t,"DIV",{class:!0});var Be=i(C);T(nn.$$.fragment,Be),lp=f(Be),ha=l(Be,"P",{});var z_=i(ha);ip=r(z_,"Constructs a BLIP processor which wraps a BERT tokenizer and BLIP image processor into a single processor."),z_.forEach(o),dp=f(Be),X=l(Be,"P",{});var ge=i(X);Ys=l(ge,"A",{href:!0});var W_=i(Ys);cp=r(W_,"BlipProcessor"),W_.forEach(o),pp=r(ge," offers all the functionalities of "),Ls=l(ge,"A",{href:!0});var N_=i(Ls);mp=r(N_,"BlipImageProcessor"),N_.forEach(o),hp=r(ge," and "),Ds=l(ge,"A",{href:!0});var P_=i(Ds);fp=r(P_,"BertTokenizerFast"),P_.forEach(o),up=r(ge,`. See the
docstring of `),fa=l(ge,"CODE",{});var Z_=i(fa);gp=r(Z_,"__call__()"),Z_.forEach(o),_p=r(ge," and "),Os=l(ge,"A",{href:!0});var V_=i(Os);bp=r(V_,"decode()"),V_.forEach(o),vp=r(ge," for more information."),ge.forEach(o),yp=f(Be),Ut=l(Be,"DIV",{class:!0});var Ki=i(Ut);T(sn.$$.fragment,Ki),Tp=f(Ki),rn=l(Ki,"P",{});var ed=i(rn);wp=r(ed,"This method forwards all its arguments to BertTokenizerFast\u2019s "),Ks=l(ed,"A",{href:!0});var R_=i(Ks);Mp=r(R_,"batch_decode()"),R_.forEach(o),$p=r(ed,`. Please
refer to the docstring of this method for more information.`),ed.forEach(o),Ki.forEach(o),Bp=f(Be),Ct=l(Be,"DIV",{class:!0});var td=i(Ct);T(an.$$.fragment,td),xp=f(td),ln=l(td,"P",{});var od=i(ln);Jp=r(od,"This method forwards all its arguments to BertTokenizerFast\u2019s "),er=l(od,"A",{href:!0});var G_=i(er);jp=r(G_,"decode()"),G_.forEach(o),Ep=r(od,`. Please refer to
the docstring of this method for more information.`),od.forEach(o),td.forEach(o),Be.forEach(o),Ti=f(t),Se=l(t,"H2",{class:!0});var nd=i(Se);zt=l(nd,"A",{id:!0,class:!0,href:!0});var A_=i(zt);ua=l(A_,"SPAN",{});var S_=i(ua);T(dn.$$.fragment,S_),S_.forEach(o),A_.forEach(o),Ip=f(nd),ga=l(nd,"SPAN",{});var q_=i(ga);Fp=r(q_,"BlipImageProcessor"),q_.forEach(o),nd.forEach(o),wi=f(t),he=l(t,"DIV",{class:!0});var jr=i(he);T(cn.$$.fragment,jr),kp=f(jr),_a=l(jr,"P",{});var X_=i(_a);Up=r(X_,"Constructs a BLIP image processor."),X_.forEach(o),Cp=f(jr),Wt=l(jr,"DIV",{class:!0});var sd=i(Wt);T(pn.$$.fragment,sd),zp=f(sd),ba=l(sd,"P",{});var Q_=i(ba);Wp=r(Q_,"Preprocess an image or batch of images."),Q_.forEach(o),sd.forEach(o),jr.forEach(o),Mi=f(t),qe=l(t,"H2",{class:!0});var rd=i(qe);Nt=l(rd,"A",{id:!0,class:!0,href:!0});var H_=i(Nt);va=l(H_,"SPAN",{});var Y_=i(va);T(mn.$$.fragment,Y_),Y_.forEach(o),H_.forEach(o),Np=f(rd),ya=l(rd,"SPAN",{});var L_=i(ya);Pp=r(L_,"BlipModel"),L_.forEach(o),rd.forEach(o),$i=f(t),k=l(t,"DIV",{class:!0});var ce=i(k);T(hn.$$.fragment,ce),Zp=f(ce),fn=l(ce,"P",{});var ad=i(fn);Vp=r(ad,"This model inherits from "),tr=l(ad,"A",{href:!0});var D_=i(tr);Rp=r(D_,"PreTrainedModel"),D_.forEach(o),Gp=r(ad,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),ad.forEach(o),Ap=f(ce),un=l(ce,"P",{});var ld=i(un);Sp=r(ld,"This model is also a PyTorch "),gn=l(ld,"A",{href:!0,rel:!0});var O_=i(gn);qp=r(O_,"torch.nn.Module"),O_.forEach(o),Xp=r(ld,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),ld.forEach(o),Qp=f(ce),O=l(ce,"DIV",{class:!0});var xo=i(O);T(_n.$$.fragment,xo),Hp=f(xo),Xe=l(xo,"P",{});var Er=i(Xe);Yp=r(Er,"The "),or=l(Er,"A",{href:!0});var K_=i(or);Lp=r(K_,"BlipModel"),K_.forEach(o),Dp=r(Er," forward method, overrides the "),Ta=l(Er,"CODE",{});var eb=i(Ta);Op=r(eb,"__call__"),eb.forEach(o),Kp=r(Er," special method."),Er.forEach(o),em=f(xo),T(Pt.$$.fragment,xo),tm=f(xo),T(Zt.$$.fragment,xo),xo.forEach(o),om=f(ce),K=l(ce,"DIV",{class:!0});var Jo=i(K);T(bn.$$.fragment,Jo),nm=f(Jo),Qe=l(Jo,"P",{});var Ir=i(Qe);sm=r(Ir,"The "),nr=l(Ir,"A",{href:!0});var tb=i(nr);rm=r(tb,"BlipModel"),tb.forEach(o),am=r(Ir," forward method, overrides the "),wa=l(Ir,"CODE",{});var ob=i(wa);lm=r(ob,"__call__"),ob.forEach(o),im=r(Ir," special method."),Ir.forEach(o),dm=f(Jo),T(Vt.$$.fragment,Jo),cm=f(Jo),T(Rt.$$.fragment,Jo),Jo.forEach(o),pm=f(ce),ee=l(ce,"DIV",{class:!0});var jo=i(ee);T(vn.$$.fragment,jo),mm=f(jo),He=l(jo,"P",{});var Fr=i(He);hm=r(Fr,"The "),sr=l(Fr,"A",{href:!0});var nb=i(sr);fm=r(nb,"BlipModel"),nb.forEach(o),um=r(Fr," forward method, overrides the "),Ma=l(Fr,"CODE",{});var sb=i(Ma);gm=r(sb,"__call__"),sb.forEach(o),_m=r(Fr," special method."),Fr.forEach(o),bm=f(jo),T(Gt.$$.fragment,jo),vm=f(jo),T(At.$$.fragment,jo),jo.forEach(o),ce.forEach(o),Bi=f(t),Ye=l(t,"H2",{class:!0});var id=i(Ye);St=l(id,"A",{id:!0,class:!0,href:!0});var rb=i(St);$a=l(rb,"SPAN",{});var ab=i($a);T(yn.$$.fragment,ab),ab.forEach(o),rb.forEach(o),ym=f(id),Ba=l(id,"SPAN",{});var lb=i(Ba);Tm=r(lb,"BlipTextModel"),lb.forEach(o),id.forEach(o),xi=f(t),fe=l(t,"DIV",{class:!0});var kr=i(fe);T(Tn.$$.fragment,kr),wm=f(kr),Y=l(kr,"P",{});var xe=i(Y);Mm=r(xe,`The model can behave as an encoder (with only self-attention) as well as a decoder, in which case a layer of
cross-attention is added between the self-attention layers, following the architecture described in `),wn=l(xe,"A",{href:!0,rel:!0});var ib=i(wn);$m=r(ib,`Attention is
all you need`),ib.forEach(o),Bm=r(xe,` by Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit,
Llion Jones, Aidan N. Gomez, Lukasz Kaiser and Illia Polosukhin. argument and `),xa=l(xe,"CODE",{});var db=i(xa);xm=r(db,"is_decoder"),db.forEach(o),Jm=r(xe," set to "),Ja=l(xe,"CODE",{});var cb=i(Ja);jm=r(cb,"True"),cb.forEach(o),Em=r(xe,`; an
`),ja=l(xe,"CODE",{});var pb=i(ja);Im=r(pb,"encoder_hidden_states"),pb.forEach(o),Fm=r(xe," is then expected as an input to the forward pass."),xe.forEach(o),km=f(kr),ye=l(kr,"DIV",{class:!0});var Ur=i(ye);T(Mn.$$.fragment,Ur),Um=f(Ur),z=l(Ur,"P",{});var pe=i(z);Cm=r(pe,"encoder_hidden_states  ("),Ea=l(pe,"CODE",{});var mb=i(Ea);zm=r(mb,"torch.FloatTensor"),mb.forEach(o),Wm=r(pe,", "),Ia=l(pe,"EM",{});var hb=i(Ia);Nm=r(hb,"optional"),hb.forEach(o),Pm=r(pe,`):
Sequence of hidden-states at the output of the last layer of the encoder. Used in the cross-attention if
the model is configured as a decoder.
encoder_attention_mask (`),Fa=l(pe,"CODE",{});var fb=i(Fa);Zm=r(fb,"torch.FloatTensor"),fb.forEach(o),Vm=r(pe,", "),ka=l(pe,"EM",{});var ub=i(ka);Rm=r(ub,"optional"),ub.forEach(o),Gm=r(pe,`):
Mask to avoid performing attention on the padding token indices of the encoder input. This mask is used in
the cross-attention if the model is configured as a decoder. Mask values selected in `),Ua=l(pe,"CODE",{});var gb=i(Ua);Am=r(gb,"[0, 1]"),gb.forEach(o),Sm=r(pe,":"),pe.forEach(o),qm=f(Ur),$n=l(Ur,"UL",{});var dd=i($n);Bn=l(dd,"LI",{});var cd=i(Bn);Xm=r(cd,"1 for tokens that are "),Ca=l(cd,"STRONG",{});var _b=i(Ca);Qm=r(_b,"not masked"),_b.forEach(o),Hm=r(cd,","),cd.forEach(o),Ym=f(dd),E=l(dd,"LI",{});var I=i(E);Lm=r(I,"0 for tokens that are "),za=l(I,"STRONG",{});var bb=i(za);Dm=r(bb,"masked"),bb.forEach(o),Om=r(I,`.
past_key_values (`),Wa=l(I,"CODE",{});var vb=i(Wa);Km=r(vb,"tuple(tuple(torch.FloatTensor))"),vb.forEach(o),eh=r(I,", "),Na=l(I,"EM",{});var yb=i(Na);th=r(yb,"optional"),yb.forEach(o),oh=r(I,`):
Contains precomputed key and value hidden states of the attention blocks. Can be used to speed up decoding.
If `),Pa=l(I,"CODE",{});var Tb=i(Pa);nh=r(Tb,"past_key_values"),Tb.forEach(o),sh=r(I," are used, the user can optionally input only the last "),Za=l(I,"CODE",{});var wb=i(Za);rh=r(wb,"decoder_input_ids"),wb.forEach(o),ah=r(I,` (those that
don\u2019t have their past key value states given to this model) of shape `),Va=l(I,"CODE",{});var Mb=i(Va);lh=r(Mb,"(batch_size, 1)"),Mb.forEach(o),ih=r(I,` instead of all
`),Ra=l(I,"CODE",{});var $b=i(Ra);dh=r($b,"decoder_input_ids"),$b.forEach(o),ch=r(I," of shape "),Ga=l(I,"CODE",{});var Bb=i(Ga);ph=r(Bb,"(batch_size, sequence_length)"),Bb.forEach(o),mh=r(I,`.
use_cache (`),Aa=l(I,"CODE",{});var xb=i(Aa);hh=r(xb,"bool"),xb.forEach(o),fh=r(I,", "),Sa=l(I,"EM",{});var Jb=i(Sa);uh=r(Jb,"optional"),Jb.forEach(o),gh=r(I,`):
If set to `),qa=l(I,"CODE",{});var jb=i(qa);_h=r(jb,"True"),jb.forEach(o),bh=r(I,", "),Xa=l(I,"CODE",{});var Eb=i(Xa);vh=r(Eb,"past_key_values"),Eb.forEach(o),yh=r(I,` key value states are returned and can be used to speed up decoding (see
`),Qa=l(I,"CODE",{});var Ib=i(Qa);Th=r(Ib,"past_key_values"),Ib.forEach(o),wh=r(I,")."),I.forEach(o),dd.forEach(o),Ur.forEach(o),kr.forEach(o),Ji=f(t),Le=l(t,"H2",{class:!0});var pd=i(Le);qt=l(pd,"A",{id:!0,class:!0,href:!0});var Fb=i(qt);Ha=l(Fb,"SPAN",{});var kb=i(Ha);T(xn.$$.fragment,kb),kb.forEach(o),Fb.forEach(o),Mh=f(pd),Ya=l(pd,"SPAN",{});var Ub=i(Ya);$h=r(Ub,"BlipVisionModel"),Ub.forEach(o),pd.forEach(o),ji=f(t),De=l(t,"DIV",{class:!0});var md=i(De);T(Jn.$$.fragment,md),Bh=f(md),Te=l(md,"DIV",{class:!0});var Cr=i(Te);T(jn.$$.fragment,Cr),xh=f(Cr),Oe=l(Cr,"P",{});var zr=i(Oe);Jh=r(zr,"The "),rr=l(zr,"A",{href:!0});var Cb=i(rr);jh=r(Cb,"BlipVisionModel"),Cb.forEach(o),Eh=r(zr," forward method, overrides the "),La=l(zr,"CODE",{});var zb=i(La);Ih=r(zb,"__call__"),zb.forEach(o),Fh=r(zr," special method."),zr.forEach(o),kh=f(Cr),T(Xt.$$.fragment,Cr),Cr.forEach(o),md.forEach(o),Ei=f(t),Ke=l(t,"H2",{class:!0});var hd=i(Ke);Qt=l(hd,"A",{id:!0,class:!0,href:!0});var Wb=i(Qt);Da=l(Wb,"SPAN",{});var Nb=i(Da);T(En.$$.fragment,Nb),Nb.forEach(o),Wb.forEach(o),Uh=f(hd),Oa=l(hd,"SPAN",{});var Pb=i(Oa);Ch=r(Pb,"BlipForConditionalGeneration"),Pb.forEach(o),hd.forEach(o),Ii=f(t),W=l(t,"DIV",{class:!0});var Je=i(W);T(In.$$.fragment,Je),zh=f(Je),Fn=l(Je,"P",{});var fd=i(Fn);Wh=r(fd,`BLIP Model for image captioning. The model consists of a vision encoder and a text decoder. One can optionally pass
`),Ka=l(fd,"CODE",{});var Zb=i(Ka);Nh=r(Zb,"input_ids"),Zb.forEach(o),Ph=r(fd,` to the model, which serve as a text prompt, to make the text decoder continue the prompt. Otherwise,
the decoder starts generating text from the [BOS] (beginning-of-sequence) token. will start generating the caption
from the text input. If no text input is provided, the decoder will start with the [BOS] token only.`),fd.forEach(o),Zh=f(Je),kn=l(Je,"P",{});var ud=i(kn);Vh=r(ud,"This model inherits from "),ar=l(ud,"A",{href:!0});var Vb=i(ar);Rh=r(Vb,"PreTrainedModel"),Vb.forEach(o),Gh=r(ud,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),ud.forEach(o),Ah=f(Je),Un=l(Je,"P",{});var gd=i(Un);Sh=r(gd,"This model is also a PyTorch "),Cn=l(gd,"A",{href:!0,rel:!0});var Rb=i(Cn);qh=r(Rb,"torch.nn.Module"),Rb.forEach(o),Xh=r(gd,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),gd.forEach(o),Qh=f(Je),te=l(Je,"DIV",{class:!0});var Eo=i(te);T(zn.$$.fragment,Eo),Hh=f(Eo),et=l(Eo,"P",{});var Wr=i(et);Yh=r(Wr,"The "),lr=l(Wr,"A",{href:!0});var Gb=i(lr);Lh=r(Gb,"BlipForConditionalGeneration"),Gb.forEach(o),Dh=r(Wr," forward method, overrides the "),el=l(Wr,"CODE",{});var Ab=i(el);Oh=r(Ab,"__call__"),Ab.forEach(o),Kh=r(Wr," special method."),Wr.forEach(o),ef=f(Eo),T(Ht.$$.fragment,Eo),tf=f(Eo),T(Yt.$$.fragment,Eo),Eo.forEach(o),Je.forEach(o),Fi=f(t),tt=l(t,"H2",{class:!0});var _d=i(tt);Lt=l(_d,"A",{id:!0,class:!0,href:!0});var Sb=i(Lt);tl=l(Sb,"SPAN",{});var qb=i(tl);T(Wn.$$.fragment,qb),qb.forEach(o),Sb.forEach(o),of=f(_d),ol=l(_d,"SPAN",{});var Xb=i(ol);nf=r(Xb,"BlipForImageTextRetrieval"),Xb.forEach(o),_d.forEach(o),ki=f(t),N=l(t,"DIV",{class:!0});var je=i(N);T(Nn.$$.fragment,je),sf=f(je),nl=l(je,"P",{});var Qb=i(nl);rf=r(Qb,`BLIP Model with a vision and text projector, and a classification head on top. The model is used in the context of
image-text retrieval. Given an image and a text, the model returns the probability of the text being relevant to
the image.`),Qb.forEach(o),af=f(je),Pn=l(je,"P",{});var bd=i(Pn);lf=r(bd,"This model inherits from "),ir=l(bd,"A",{href:!0});var Hb=i(ir);df=r(Hb,"PreTrainedModel"),Hb.forEach(o),cf=r(bd,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),bd.forEach(o),pf=f(je),Zn=l(je,"P",{});var vd=i(Zn);mf=r(vd,"This model is also a PyTorch "),Vn=l(vd,"A",{href:!0,rel:!0});var Yb=i(Vn);hf=r(Yb,"torch.nn.Module"),Yb.forEach(o),ff=r(vd,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),vd.forEach(o),uf=f(je),oe=l(je,"DIV",{class:!0});var Io=i(oe);T(Rn.$$.fragment,Io),gf=f(Io),ot=l(Io,"P",{});var Nr=i(ot);_f=r(Nr,"The "),dr=l(Nr,"A",{href:!0});var Lb=i(dr);bf=r(Lb,"BlipForImageTextRetrieval"),Lb.forEach(o),vf=r(Nr," forward method, overrides the "),sl=l(Nr,"CODE",{});var Db=i(sl);yf=r(Db,"__call__"),Db.forEach(o),Tf=r(Nr," special method."),Nr.forEach(o),wf=f(Io),T(Dt.$$.fragment,Io),Mf=f(Io),T(Ot.$$.fragment,Io),Io.forEach(o),je.forEach(o),Ui=f(t),nt=l(t,"H2",{class:!0});var yd=i(nt);Kt=l(yd,"A",{id:!0,class:!0,href:!0});var Ob=i(Kt);rl=l(Ob,"SPAN",{});var Kb=i(rl);T(Gn.$$.fragment,Kb),Kb.forEach(o),Ob.forEach(o),$f=f(yd),al=l(yd,"SPAN",{});var ev=i(al);Bf=r(ev,"BlipForQuestionAnswering"),ev.forEach(o),yd.forEach(o),Ci=f(t),P=l(t,"DIV",{class:!0});var Ee=i(P);T(An.$$.fragment,Ee),xf=f(Ee),ll=l(Ee,"P",{});var tv=i(ll);Jf=r(tv,`BLIP Model for visual question answering. The model consists of a vision encoder, a text encoder as well as a text
decoder. The vision encoder will encode the input image, the text encoder will encode the input question together
with the encoding of the image, and the text decoder will output the answer to the question.`),tv.forEach(o),jf=f(Ee),Sn=l(Ee,"P",{});var Td=i(Sn);Ef=r(Td,"This model inherits from "),cr=l(Td,"A",{href:!0});var ov=i(cr);If=r(ov,"PreTrainedModel"),ov.forEach(o),Ff=r(Td,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Td.forEach(o),kf=f(Ee),qn=l(Ee,"P",{});var wd=i(qn);Uf=r(wd,"This model is also a PyTorch "),Xn=l(wd,"A",{href:!0,rel:!0});var nv=i(Xn);Cf=r(nv,"torch.nn.Module"),nv.forEach(o),zf=r(wd,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),wd.forEach(o),Wf=f(Ee),ne=l(Ee,"DIV",{class:!0});var Fo=i(ne);T(Qn.$$.fragment,Fo),Nf=f(Fo),st=l(Fo,"P",{});var Pr=i(st);Pf=r(Pr,"The "),pr=l(Pr,"A",{href:!0});var sv=i(pr);Zf=r(sv,"BlipForQuestionAnswering"),sv.forEach(o),Vf=r(Pr," forward method, overrides the "),il=l(Pr,"CODE",{});var rv=i(il);Rf=r(rv,"__call__"),rv.forEach(o),Gf=r(Pr," special method."),Pr.forEach(o),Af=f(Fo),T(eo.$$.fragment,Fo),Sf=f(Fo),T(to.$$.fragment,Fo),Fo.forEach(o),Ee.forEach(o),zi=f(t),rt=l(t,"H2",{class:!0});var Md=i(rt);oo=l(Md,"A",{id:!0,class:!0,href:!0});var av=i(oo);dl=l(av,"SPAN",{});var lv=i(dl);T(Hn.$$.fragment,lv),lv.forEach(o),av.forEach(o),qf=f(Md),cl=l(Md,"SPAN",{});var iv=i(cl);Xf=r(iv,"TFBlipModel"),iv.forEach(o),Md.forEach(o),Wi=f(t),L=l(t,"DIV",{class:!0});var ko=i(L);T(Yn.$$.fragment,ko),Qf=f(ko),se=l(ko,"DIV",{class:!0});var Uo=i(se);T(Ln.$$.fragment,Uo),Hf=f(Uo),at=l(Uo,"P",{});var Zr=i(at);Yf=r(Zr,"The "),mr=l(Zr,"A",{href:!0});var dv=i(mr);Lf=r(dv,"TFBlipModel"),dv.forEach(o),Df=r(Zr," forward method, overrides the "),pl=l(Zr,"CODE",{});var cv=i(pl);Of=r(cv,"__call__"),cv.forEach(o),Kf=r(Zr," special method."),Zr.forEach(o),eu=f(Uo),T(no.$$.fragment,Uo),tu=f(Uo),T(so.$$.fragment,Uo),Uo.forEach(o),ou=f(ko),re=l(ko,"DIV",{class:!0});var Co=i(re);T(Dn.$$.fragment,Co),nu=f(Co),lt=l(Co,"P",{});var Vr=i(lt);su=r(Vr,"The "),hr=l(Vr,"A",{href:!0});var pv=i(hr);ru=r(pv,"TFBlipModel"),pv.forEach(o),au=r(Vr," forward method, overrides the "),ml=l(Vr,"CODE",{});var mv=i(ml);lu=r(mv,"__call__"),mv.forEach(o),iu=r(Vr," special method."),Vr.forEach(o),du=f(Co),T(ro.$$.fragment,Co),cu=f(Co),T(ao.$$.fragment,Co),Co.forEach(o),pu=f(ko),ae=l(ko,"DIV",{class:!0});var zo=i(ae);T(On.$$.fragment,zo),mu=f(zo),it=l(zo,"P",{});var Rr=i(it);hu=r(Rr,"The "),fr=l(Rr,"A",{href:!0});var hv=i(fr);fu=r(hv,"TFBlipModel"),hv.forEach(o),uu=r(Rr," forward method, overrides the "),hl=l(Rr,"CODE",{});var fv=i(hl);gu=r(fv,"__call__"),fv.forEach(o),_u=r(Rr," special method."),Rr.forEach(o),bu=f(zo),T(lo.$$.fragment,zo),vu=f(zo),T(io.$$.fragment,zo),zo.forEach(o),ko.forEach(o),Ni=f(t),dt=l(t,"H2",{class:!0});var $d=i(dt);co=l($d,"A",{id:!0,class:!0,href:!0});var uv=i(co);fl=l(uv,"SPAN",{});var gv=i(fl);T(Kn.$$.fragment,gv),gv.forEach(o),uv.forEach(o),yu=f($d),ul=l($d,"SPAN",{});var _v=i(ul);Tu=r(_v,"TFBlipTextModel"),_v.forEach(o),$d.forEach(o),Pi=f(t),ue=l(t,"DIV",{class:!0});var Gr=i(ue);T(es.$$.fragment,Gr),wu=f(Gr),D=l(Gr,"P",{});var Ie=i(D);Mu=r(Ie,`The model can behave as an encoder (with only self-attention) as well as a decoder, in which case a layer of
cross-attention is added between the self-attention layers, following the architecture described in `),ts=l(Ie,"A",{href:!0,rel:!0});var bv=i(ts);$u=r(bv,`Attention is
all you need`),bv.forEach(o),Bu=r(Ie,` by Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit,
Llion Jones, Aidan N. Gomez, Lukasz Kaiser and Illia Polosukhin. argument and `),gl=l(Ie,"CODE",{});var vv=i(gl);xu=r(vv,"is_decoder"),vv.forEach(o),Ju=r(Ie," set to "),_l=l(Ie,"CODE",{});var yv=i(_l);ju=r(yv,"True"),yv.forEach(o),Eu=r(Ie,`; an
`),bl=l(Ie,"CODE",{});var Tv=i(bl);Iu=r(Tv,"encoder_hidden_states"),Tv.forEach(o),Fu=r(Ie," is then expected as an input to the forward pass."),Ie.forEach(o),ku=f(Gr),we=l(Gr,"DIV",{class:!0});var Ar=i(we);T(os.$$.fragment,Ar),Uu=f(Ar),ct=l(Ar,"P",{});var Sr=i(ct);Cu=r(Sr,"The "),ur=l(Sr,"A",{href:!0});var wv=i(ur);zu=r(wv,"TFBlipTextModel"),wv.forEach(o),Wu=r(Sr," forward method, overrides the "),vl=l(Sr,"CODE",{});var Mv=i(vl);Nu=r(Mv,"__call__"),Mv.forEach(o),Pu=r(Sr," special method."),Sr.forEach(o),Zu=f(Ar),T(po.$$.fragment,Ar),Ar.forEach(o),Gr.forEach(o),Zi=f(t),pt=l(t,"H2",{class:!0});var Bd=i(pt);mo=l(Bd,"A",{id:!0,class:!0,href:!0});var $v=i(mo);yl=l($v,"SPAN",{});var Bv=i(yl);T(ns.$$.fragment,Bv),Bv.forEach(o),$v.forEach(o),Vu=f(Bd),Tl=l(Bd,"SPAN",{});var xv=i(Tl);Ru=r(xv,"TFBlipVisionModel"),xv.forEach(o),Bd.forEach(o),Vi=f(t),mt=l(t,"DIV",{class:!0});var xd=i(mt);T(ss.$$.fragment,xd),Gu=f(xd),Me=l(xd,"DIV",{class:!0});var qr=i(Me);T(rs.$$.fragment,qr),Au=f(qr),ht=l(qr,"P",{});var Xr=i(ht);Su=r(Xr,"The "),gr=l(Xr,"A",{href:!0});var Jv=i(gr);qu=r(Jv,"TFBlipVisionModel"),Jv.forEach(o),Xu=r(Xr," forward method, overrides the "),wl=l(Xr,"CODE",{});var jv=i(wl);Qu=r(jv,"__call__"),jv.forEach(o),Hu=r(Xr," special method."),Xr.forEach(o),Yu=f(qr),T(ho.$$.fragment,qr),qr.forEach(o),xd.forEach(o),Ri=f(t),ft=l(t,"H2",{class:!0});var Jd=i(ft);fo=l(Jd,"A",{id:!0,class:!0,href:!0});var Ev=i(fo);Ml=l(Ev,"SPAN",{});var Iv=i(Ml);T(as.$$.fragment,Iv),Iv.forEach(o),Ev.forEach(o),Lu=f(Jd),$l=l(Jd,"SPAN",{});var Fv=i($l);Du=r(Fv,"TFBlipForConditionalGeneration"),Fv.forEach(o),Jd.forEach(o),Gi=f(t),Z=l(t,"DIV",{class:!0});var Fe=i(Z);T(ls.$$.fragment,Fe),Ou=f(Fe),is=l(Fe,"P",{});var jd=i(is);Ku=r(jd,`BLIP Model for image captioning. The model consists of a vision encoder and a text decoder. One can optionally pass
`),Bl=l(jd,"CODE",{});var kv=i(Bl);eg=r(kv,"input_ids"),kv.forEach(o),tg=r(jd,` to the model, which serve as a text prompt, to make the text decoder continue the prompt. Otherwise,
the decoder starts generating text from the [BOS] (beginning-of-sequence) token. will start generating the caption
from the text input. If no text input is provided, the decoder will start with the [BOS] token only.`),jd.forEach(o),og=f(Fe),ds=l(Fe,"P",{});var Ed=i(ds);ng=r(Ed,"This model inherits from "),_r=l(Ed,"A",{href:!0});var Uv=i(_r);sg=r(Uv,"TFPreTrainedModel"),Uv.forEach(o),rg=r(Ed,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Ed.forEach(o),ag=f(Fe),cs=l(Fe,"P",{});var Id=i(cs);lg=r(Id,"This model is also a "),ps=l(Id,"A",{href:!0,rel:!0});var Cv=i(ps);ig=r(Cv,"tf.keras.Model"),Cv.forEach(o),dg=r(Id,` subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`),Id.forEach(o),cg=f(Fe),le=l(Fe,"DIV",{class:!0});var Wo=i(le);T(ms.$$.fragment,Wo),pg=f(Wo),ut=l(Wo,"P",{});var Qr=i(ut);mg=r(Qr,"The "),br=l(Qr,"A",{href:!0});var zv=i(br);hg=r(zv,"TFBlipForConditionalGeneration"),zv.forEach(o),fg=r(Qr," forward method, overrides the "),xl=l(Qr,"CODE",{});var Wv=i(xl);ug=r(Wv,"__call__"),Wv.forEach(o),gg=r(Qr," special method."),Qr.forEach(o),_g=f(Wo),T(uo.$$.fragment,Wo),bg=f(Wo),T(go.$$.fragment,Wo),Wo.forEach(o),Fe.forEach(o),Ai=f(t),gt=l(t,"H2",{class:!0});var Fd=i(gt);_o=l(Fd,"A",{id:!0,class:!0,href:!0});var Nv=i(_o);Jl=l(Nv,"SPAN",{});var Pv=i(Jl);T(hs.$$.fragment,Pv),Pv.forEach(o),Nv.forEach(o),vg=f(Fd),jl=l(Fd,"SPAN",{});var Zv=i(jl);yg=r(Zv,"TFBlipForImageTextRetrieval"),Zv.forEach(o),Fd.forEach(o),Si=f(t),V=l(t,"DIV",{class:!0});var ke=i(V);T(fs.$$.fragment,ke),Tg=f(ke),El=l(ke,"P",{});var Vv=i(El);wg=r(Vv,`BLIP Model with a vision and text projector, and a classification head on top. The model is used in the context of
image-text retrieval. Given an image and a text, the model returns the probability of the text being relevant to
the image.`),Vv.forEach(o),Mg=f(ke),us=l(ke,"P",{});var kd=i(us);$g=r(kd,"This model inherits from "),vr=l(kd,"A",{href:!0});var Rv=i(vr);Bg=r(Rv,"TFPreTrainedModel"),Rv.forEach(o),xg=r(kd,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),kd.forEach(o),Jg=f(ke),gs=l(ke,"P",{});var Ud=i(gs);jg=r(Ud,"This model is also a "),_s=l(Ud,"A",{href:!0,rel:!0});var Gv=i(_s);Eg=r(Gv,"tf.keras.Model"),Gv.forEach(o),Ig=r(Ud,` subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`),Ud.forEach(o),Fg=f(ke),ie=l(ke,"DIV",{class:!0});var No=i(ie);T(bs.$$.fragment,No),kg=f(No),_t=l(No,"P",{});var Hr=i(_t);Ug=r(Hr,"The "),yr=l(Hr,"A",{href:!0});var Av=i(yr);Cg=r(Av,"TFBlipForImageTextRetrieval"),Av.forEach(o),zg=r(Hr," forward method, overrides the "),Il=l(Hr,"CODE",{});var Sv=i(Il);Wg=r(Sv,"__call__"),Sv.forEach(o),Ng=r(Hr," special method."),Hr.forEach(o),Pg=f(No),T(bo.$$.fragment,No),Zg=f(No),T(vo.$$.fragment,No),No.forEach(o),ke.forEach(o),qi=f(t),bt=l(t,"H2",{class:!0});var Cd=i(bt);yo=l(Cd,"A",{id:!0,class:!0,href:!0});var qv=i(yo);Fl=l(qv,"SPAN",{});var Xv=i(Fl);T(vs.$$.fragment,Xv),Xv.forEach(o),qv.forEach(o),Vg=f(Cd),kl=l(Cd,"SPAN",{});var Qv=i(kl);Rg=r(Qv,"TFBlipForQuestionAnswering"),Qv.forEach(o),Cd.forEach(o),Xi=f(t),R=l(t,"DIV",{class:!0});var Ue=i(R);T(ys.$$.fragment,Ue),Gg=f(Ue),Ul=l(Ue,"P",{});var Hv=i(Ul);Ag=r(Hv,`BLIP Model for visual question answering. The model consists of a vision encoder, a text encoder as well as a text
decoder. The vision encoder will encode the input image, the text encoder will encode the input question together
with the encoding of the image, and the text decoder will output the answer to the question.`),Hv.forEach(o),Sg=f(Ue),Ts=l(Ue,"P",{});var zd=i(Ts);qg=r(zd,"This model inherits from "),Tr=l(zd,"A",{href:!0});var Yv=i(Tr);Xg=r(Yv,"TFPreTrainedModel"),Yv.forEach(o),Qg=r(zd,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),zd.forEach(o),Hg=f(Ue),ws=l(Ue,"P",{});var Wd=i(ws);Yg=r(Wd,"This model is also a "),Ms=l(Wd,"A",{href:!0,rel:!0});var Lv=i(Ms);Lg=r(Lv,"tf.keras.Model"),Lv.forEach(o),Dg=r(Wd,` subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`),Wd.forEach(o),Og=f(Ue),de=l(Ue,"DIV",{class:!0});var Po=i(de);T($s.$$.fragment,Po),Kg=f(Po),vt=l(Po,"P",{});var Yr=i(vt);e_=r(Yr,"The "),wr=l(Yr,"A",{href:!0});var Dv=i(wr);t_=r(Dv,"TFBlipForQuestionAnswering"),Dv.forEach(o),o_=r(Yr," forward method, overrides the "),Cl=l(Yr,"CODE",{});var Ov=i(Cl);n_=r(Ov,"__call__"),Ov.forEach(o),s_=r(Yr," special method."),Yr.forEach(o),r_=f(Po),T(To.$$.fragment,Po),a_=f(Po),T(wo.$$.fragment,Po),Po.forEach(o),Ue.forEach(o),this.h()},h(){p(d,"name","hf:doc:metadata"),p(d,"content",JSON.stringify(Wy)),p(m,"id","blip"),p(m,"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"),p(m,"href","#blip"),p(u,"class","relative group"),p(wt,"id","overview"),p(wt,"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"),p(wt,"href","#overview"),p(Ce,"class","relative group"),p(Vo,"href","https://arxiv.org/abs/2201.12086"),p(Vo,"rel","nofollow"),ny(zs.src,l_="https://s3.amazonaws.com/moonup/production/uploads/1670928184033-62441d1d9fdefb55a0b7d12c.gif")||p(zs,"src",l_),p(zs,"alt","BLIP.gif"),p(Ro,"href","https://huggingface.co/ybelkada"),p(Ro,"rel","nofollow"),p(Go,"href","https://github.com/salesforce/BLIP"),p(Go,"rel","nofollow"),p($t,"id","resources"),p($t,"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"),p($t,"href","#resources"),p(ze,"class","relative group"),p(So,"href","https://github.com/huggingface/notebooks/blob/main/examples/image_captioning_blip.ipynb"),p(So,"rel","nofollow"),p(Bt,"id","transformers.BlipConfig"),p(Bt,"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"),p(Bt,"href","#transformers.BlipConfig"),p(We,"class","relative group"),p(Ps,"href","/docs/transformers/v4.31.0/en/model_doc/blip#transformers.BlipConfig"),p(Zs,"href","/docs/transformers/v4.31.0/en/model_doc/blip#transformers.BlipModel"),p(Qo,"href","https://huggingface.co/Salesforce/blip-vqa-base"),p(Qo,"rel","nofollow"),p(Vs,"href","/docs/transformers/v4.31.0/en/main_classes/configuration#transformers.PretrainedConfig"),p(Rs,"href","/docs/transformers/v4.31.0/en/main_classes/configuration#transformers.PretrainedConfig"),p(Gs,"href","/docs/transformers/v4.31.0/en/model_doc/blip#transformers.BlipConfig"),p(Jt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(jt,"id","transformers.BlipTextConfig"),p(jt,"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"),p(jt,"href","#transformers.BlipTextConfig"),p(Pe,"class","relative group"),p(As,"href","/docs/transformers/v4.31.0/en/model_doc/blip#transformers.BlipTextModel"),p(Oo,"href","https://huggingface.co/Salesforce/blip-vqa-base"),p(Oo,"rel","nofollow"),p(Ss,"href","/docs/transformers/v4.31.0/en/main_classes/configuration#transformers.PretrainedConfig"),p(qs,"href","/docs/transformers/v4.31.0/en/main_classes/configuration#transformers.PretrainedConfig"),p(Q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(It,"id","transformers.BlipVisionConfig"),p(It,"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"),p(It,"href","#transformers.BlipVisionConfig"),p(Ve,"class","relative group"),p(Xs,"href","/docs/transformers/v4.31.0/en/model_doc/blip#transformers.BlipVisionModel"),p(tn,"href","https://huggingface.co/Salesforce/blip-vqa-base"),p(tn,"rel","nofollow"),p(Qs,"href","/docs/transformers/v4.31.0/en/main_classes/configuration#transformers.PretrainedConfig"),p(Hs,"href","/docs/transformers/v4.31.0/en/main_classes/configuration#transformers.PretrainedConfig"),p(H,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(kt,"id","transformers.BlipProcessor"),p(kt,"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"),p(kt,"href","#transformers.BlipProcessor"),p(Ae,"class","relative group"),p(Ys,"href","/docs/transformers/v4.31.0/en/model_doc/blip#transformers.BlipProcessor"),p(Ls,"href","/docs/transformers/v4.31.0/en/model_doc/blip#transformers.BlipImageProcessor"),p(Ds,"href","/docs/transformers/v4.31.0/en/model_doc/bert#transformers.BertTokenizerFast"),p(Os,"href","/docs/transformers/v4.31.0/en/model_doc/blip#transformers.BlipProcessor.decode"),p(Ks,"href","/docs/transformers/v4.31.0/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.batch_decode"),p(Ut,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(er,"href","/docs/transformers/v4.31.0/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.decode"),p(Ct,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(zt,"id","transformers.BlipImageProcessor"),p(zt,"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"),p(zt,"href","#transformers.BlipImageProcessor"),p(Se,"class","relative group"),p(Wt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(he,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Nt,"id","transformers.BlipModel"),p(Nt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(Nt,"href","#transformers.BlipModel"),p(qe,"class","relative group"),p(tr,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel"),p(gn,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),p(gn,"rel","nofollow"),p(or,"href","/docs/transformers/v4.31.0/en/model_doc/blip#transformers.BlipModel"),p(O,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(nr,"href","/docs/transformers/v4.31.0/en/model_doc/blip#transformers.BlipModel"),p(K,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(sr,"href","/docs/transformers/v4.31.0/en/model_doc/blip#transformers.BlipModel"),p(ee,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(St,"id","transformers.BlipTextModel"),p(St,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(St,"href","#transformers.BlipTextModel"),p(Ye,"class","relative group"),p(wn,"href","https://arxiv.org/abs/1706.03762"),p(wn,"rel","nofollow"),p(ye,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(fe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(qt,"id","transformers.BlipVisionModel"),p(qt,"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"),p(qt,"href","#transformers.BlipVisionModel"),p(Le,"class","relative group"),p(rr,"href","/docs/transformers/v4.31.0/en/model_doc/blip#transformers.BlipVisionModel"),p(Te,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(De,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Qt,"id","transformers.BlipForConditionalGeneration"),p(Qt,"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"),p(Qt,"href","#transformers.BlipForConditionalGeneration"),p(Ke,"class","relative group"),p(ar,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel"),p(Cn,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),p(Cn,"rel","nofollow"),p(lr,"href","/docs/transformers/v4.31.0/en/model_doc/blip#transformers.BlipForConditionalGeneration"),p(te,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Lt,"id","transformers.BlipForImageTextRetrieval"),p(Lt,"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"),p(Lt,"href","#transformers.BlipForImageTextRetrieval"),p(tt,"class","relative group"),p(ir,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel"),p(Vn,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),p(Vn,"rel","nofollow"),p(dr,"href","/docs/transformers/v4.31.0/en/model_doc/blip#transformers.BlipForImageTextRetrieval"),p(oe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Kt,"id","transformers.BlipForQuestionAnswering"),p(Kt,"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"),p(Kt,"href","#transformers.BlipForQuestionAnswering"),p(nt,"class","relative group"),p(cr,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel"),p(Xn,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),p(Xn,"rel","nofollow"),p(pr,"href","/docs/transformers/v4.31.0/en/model_doc/blip#transformers.BlipForQuestionAnswering"),p(ne,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(oo,"id","transformers.TFBlipModel"),p(oo,"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"),p(oo,"href","#transformers.TFBlipModel"),p(rt,"class","relative group"),p(mr,"href","/docs/transformers/v4.31.0/en/model_doc/blip#transformers.TFBlipModel"),p(se,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(hr,"href","/docs/transformers/v4.31.0/en/model_doc/blip#transformers.TFBlipModel"),p(re,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(fr,"href","/docs/transformers/v4.31.0/en/model_doc/blip#transformers.TFBlipModel"),p(ae,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(co,"id","transformers.TFBlipTextModel"),p(co,"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"),p(co,"href","#transformers.TFBlipTextModel"),p(dt,"class","relative group"),p(ts,"href","https://arxiv.org/abs/1706.03762"),p(ts,"rel","nofollow"),p(ur,"href","/docs/transformers/v4.31.0/en/model_doc/blip#transformers.TFBlipTextModel"),p(we,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(ue,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(mo,"id","transformers.TFBlipVisionModel"),p(mo,"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"),p(mo,"href","#transformers.TFBlipVisionModel"),p(pt,"class","relative group"),p(gr,"href","/docs/transformers/v4.31.0/en/model_doc/blip#transformers.TFBlipVisionModel"),p(Me,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(mt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(fo,"id","transformers.TFBlipForConditionalGeneration"),p(fo,"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"),p(fo,"href","#transformers.TFBlipForConditionalGeneration"),p(ft,"class","relative group"),p(_r,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.TFPreTrainedModel"),p(ps,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),p(ps,"rel","nofollow"),p(br,"href","/docs/transformers/v4.31.0/en/model_doc/blip#transformers.TFBlipForConditionalGeneration"),p(le,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(_o,"id","transformers.TFBlipForImageTextRetrieval"),p(_o,"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"),p(_o,"href","#transformers.TFBlipForImageTextRetrieval"),p(gt,"class","relative group"),p(vr,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.TFPreTrainedModel"),p(_s,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),p(_s,"rel","nofollow"),p(yr,"href","/docs/transformers/v4.31.0/en/model_doc/blip#transformers.TFBlipForImageTextRetrieval"),p(ie,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(yo,"id","transformers.TFBlipForQuestionAnswering"),p(yo,"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"),p(yo,"href","#transformers.TFBlipForQuestionAnswering"),p(bt,"class","relative group"),p(Tr,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.TFPreTrainedModel"),p(Ms,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),p(Ms,"rel","nofollow"),p(wr,"href","/docs/transformers/v4.31.0/en/model_doc/blip#transformers.TFBlipForQuestionAnswering"),p(de,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(R,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(t,g){e(document.head,d),b(t,v,g),b(t,u,g),e(u,m),e(m,_),w(n,_,null),e(u,c),e(u,J),e(J,Nd),b(t,ni,g),b(t,Ce,g),e(Ce,wt),e(wt,Lr),w(Zo,Lr,null),e(Ce,Pd),e(Ce,Dr),e(Dr,Zd),b(t,si,g),b(t,Mt,g),e(Mt,Vd),e(Mt,Vo),e(Vo,Rd),e(Mt,Gd),b(t,ri,g),b(t,Fs,g),e(Fs,Ad),b(t,ai,g),b(t,_e,g),e(_e,Or),e(Or,Sd),e(_e,qd),e(_e,Kr),e(Kr,Xd),e(_e,Qd),e(_e,ea),e(ea,Hd),b(t,li,g),b(t,ks,g),e(ks,Yd),b(t,ii,g),b(t,Us,g),e(Us,ta),e(ta,Ld),b(t,di,g),b(t,Cs,g),e(Cs,zs),b(t,ci,g),b(t,be,g),e(be,Dd),e(be,Ro),e(Ro,Od),e(be,Kd),e(be,Go),e(Go,ec),e(be,tc),b(t,pi,g),b(t,ze,g),e(ze,$t),e($t,oa),w(Ao,oa,null),e(ze,oc),e(ze,na),e(na,nc),b(t,mi,g),b(t,Ws,g),e(Ws,Ns),e(Ns,So),e(So,sc),e(Ns,rc),b(t,hi,g),b(t,We,g),e(We,Bt),e(Bt,sa),w(qo,sa,null),e(We,ac),e(We,ra),e(ra,lc),b(t,fi,g),b(t,U,g),w(Xo,U,null),e(U,ic),e(U,ve),e(ve,Ps),e(Ps,dc),e(ve,cc),e(ve,Zs),e(Zs,pc),e(ve,mc),e(ve,Qo),e(Qo,hc),e(ve,fc),e(U,uc),e(U,Ne),e(Ne,gc),e(Ne,Vs),e(Vs,_c),e(Ne,bc),e(Ne,Rs),e(Rs,vc),e(Ne,yc),e(U,Tc),w(xt,U,null),e(U,wc),e(U,Jt),w(Ho,Jt,null),e(Jt,Mc),e(Jt,Yo),e(Yo,$c),e(Yo,Gs),e(Gs,Bc),e(Yo,xc),b(t,ui,g),b(t,Pe,g),e(Pe,jt),e(jt,aa),w(Lo,aa,null),e(Pe,Jc),e(Pe,la),e(la,jc),b(t,gi,g),b(t,Q,g),w(Do,Q,null),e(Q,Ec),e(Q,me),e(me,Ic),e(me,As),e(As,Fc),e(me,kc),e(me,ia),e(ia,Uc),e(me,Cc),e(me,Oo),e(Oo,zc),e(me,Wc),e(Q,Nc),e(Q,Ze),e(Ze,Pc),e(Ze,Ss),e(Ss,Zc),e(Ze,Vc),e(Ze,qs),e(qs,Rc),e(Ze,Gc),e(Q,Ac),w(Et,Q,null),b(t,_i,g),b(t,Ve,g),e(Ve,It),e(It,da),w(Ko,da,null),e(Ve,Sc),e(Ve,ca),e(ca,qc),b(t,bi,g),b(t,H,g),w(en,H,null),e(H,Xc),e(H,Re),e(Re,Qc),e(Re,Xs),e(Xs,Hc),e(Re,Yc),e(Re,tn),e(tn,Lc),e(Re,Dc),e(H,Oc),e(H,Ge),e(Ge,Kc),e(Ge,Qs),e(Qs,ep),e(Ge,tp),e(Ge,Hs),e(Hs,op),e(Ge,np),e(H,sp),w(Ft,H,null),b(t,vi,g),b(t,Ae,g),e(Ae,kt),e(kt,pa),w(on,pa,null),e(Ae,rp),e(Ae,ma),e(ma,ap),b(t,yi,g),b(t,C,g),w(nn,C,null),e(C,lp),e(C,ha),e(ha,ip),e(C,dp),e(C,X),e(X,Ys),e(Ys,cp),e(X,pp),e(X,Ls),e(Ls,mp),e(X,hp),e(X,Ds),e(Ds,fp),e(X,up),e(X,fa),e(fa,gp),e(X,_p),e(X,Os),e(Os,bp),e(X,vp),e(C,yp),e(C,Ut),w(sn,Ut,null),e(Ut,Tp),e(Ut,rn),e(rn,wp),e(rn,Ks),e(Ks,Mp),e(rn,$p),e(C,Bp),e(C,Ct),w(an,Ct,null),e(Ct,xp),e(Ct,ln),e(ln,Jp),e(ln,er),e(er,jp),e(ln,Ep),b(t,Ti,g),b(t,Se,g),e(Se,zt),e(zt,ua),w(dn,ua,null),e(Se,Ip),e(Se,ga),e(ga,Fp),b(t,wi,g),b(t,he,g),w(cn,he,null),e(he,kp),e(he,_a),e(_a,Up),e(he,Cp),e(he,Wt),w(pn,Wt,null),e(Wt,zp),e(Wt,ba),e(ba,Wp),b(t,Mi,g),b(t,qe,g),e(qe,Nt),e(Nt,va),w(mn,va,null),e(qe,Np),e(qe,ya),e(ya,Pp),b(t,$i,g),b(t,k,g),w(hn,k,null),e(k,Zp),e(k,fn),e(fn,Vp),e(fn,tr),e(tr,Rp),e(fn,Gp),e(k,Ap),e(k,un),e(un,Sp),e(un,gn),e(gn,qp),e(un,Xp),e(k,Qp),e(k,O),w(_n,O,null),e(O,Hp),e(O,Xe),e(Xe,Yp),e(Xe,or),e(or,Lp),e(Xe,Dp),e(Xe,Ta),e(Ta,Op),e(Xe,Kp),e(O,em),w(Pt,O,null),e(O,tm),w(Zt,O,null),e(k,om),e(k,K),w(bn,K,null),e(K,nm),e(K,Qe),e(Qe,sm),e(Qe,nr),e(nr,rm),e(Qe,am),e(Qe,wa),e(wa,lm),e(Qe,im),e(K,dm),w(Vt,K,null),e(K,cm),w(Rt,K,null),e(k,pm),e(k,ee),w(vn,ee,null),e(ee,mm),e(ee,He),e(He,hm),e(He,sr),e(sr,fm),e(He,um),e(He,Ma),e(Ma,gm),e(He,_m),e(ee,bm),w(Gt,ee,null),e(ee,vm),w(At,ee,null),b(t,Bi,g),b(t,Ye,g),e(Ye,St),e(St,$a),w(yn,$a,null),e(Ye,ym),e(Ye,Ba),e(Ba,Tm),b(t,xi,g),b(t,fe,g),w(Tn,fe,null),e(fe,wm),e(fe,Y),e(Y,Mm),e(Y,wn),e(wn,$m),e(Y,Bm),e(Y,xa),e(xa,xm),e(Y,Jm),e(Y,Ja),e(Ja,jm),e(Y,Em),e(Y,ja),e(ja,Im),e(Y,Fm),e(fe,km),e(fe,ye),w(Mn,ye,null),e(ye,Um),e(ye,z),e(z,Cm),e(z,Ea),e(Ea,zm),e(z,Wm),e(z,Ia),e(Ia,Nm),e(z,Pm),e(z,Fa),e(Fa,Zm),e(z,Vm),e(z,ka),e(ka,Rm),e(z,Gm),e(z,Ua),e(Ua,Am),e(z,Sm),e(ye,qm),e(ye,$n),e($n,Bn),e(Bn,Xm),e(Bn,Ca),e(Ca,Qm),e(Bn,Hm),e($n,Ym),e($n,E),e(E,Lm),e(E,za),e(za,Dm),e(E,Om),e(E,Wa),e(Wa,Km),e(E,eh),e(E,Na),e(Na,th),e(E,oh),e(E,Pa),e(Pa,nh),e(E,sh),e(E,Za),e(Za,rh),e(E,ah),e(E,Va),e(Va,lh),e(E,ih),e(E,Ra),e(Ra,dh),e(E,ch),e(E,Ga),e(Ga,ph),e(E,mh),e(E,Aa),e(Aa,hh),e(E,fh),e(E,Sa),e(Sa,uh),e(E,gh),e(E,qa),e(qa,_h),e(E,bh),e(E,Xa),e(Xa,vh),e(E,yh),e(E,Qa),e(Qa,Th),e(E,wh),b(t,Ji,g),b(t,Le,g),e(Le,qt),e(qt,Ha),w(xn,Ha,null),e(Le,Mh),e(Le,Ya),e(Ya,$h),b(t,ji,g),b(t,De,g),w(Jn,De,null),e(De,Bh),e(De,Te),w(jn,Te,null),e(Te,xh),e(Te,Oe),e(Oe,Jh),e(Oe,rr),e(rr,jh),e(Oe,Eh),e(Oe,La),e(La,Ih),e(Oe,Fh),e(Te,kh),w(Xt,Te,null),b(t,Ei,g),b(t,Ke,g),e(Ke,Qt),e(Qt,Da),w(En,Da,null),e(Ke,Uh),e(Ke,Oa),e(Oa,Ch),b(t,Ii,g),b(t,W,g),w(In,W,null),e(W,zh),e(W,Fn),e(Fn,Wh),e(Fn,Ka),e(Ka,Nh),e(Fn,Ph),e(W,Zh),e(W,kn),e(kn,Vh),e(kn,ar),e(ar,Rh),e(kn,Gh),e(W,Ah),e(W,Un),e(Un,Sh),e(Un,Cn),e(Cn,qh),e(Un,Xh),e(W,Qh),e(W,te),w(zn,te,null),e(te,Hh),e(te,et),e(et,Yh),e(et,lr),e(lr,Lh),e(et,Dh),e(et,el),e(el,Oh),e(et,Kh),e(te,ef),w(Ht,te,null),e(te,tf),w(Yt,te,null),b(t,Fi,g),b(t,tt,g),e(tt,Lt),e(Lt,tl),w(Wn,tl,null),e(tt,of),e(tt,ol),e(ol,nf),b(t,ki,g),b(t,N,g),w(Nn,N,null),e(N,sf),e(N,nl),e(nl,rf),e(N,af),e(N,Pn),e(Pn,lf),e(Pn,ir),e(ir,df),e(Pn,cf),e(N,pf),e(N,Zn),e(Zn,mf),e(Zn,Vn),e(Vn,hf),e(Zn,ff),e(N,uf),e(N,oe),w(Rn,oe,null),e(oe,gf),e(oe,ot),e(ot,_f),e(ot,dr),e(dr,bf),e(ot,vf),e(ot,sl),e(sl,yf),e(ot,Tf),e(oe,wf),w(Dt,oe,null),e(oe,Mf),w(Ot,oe,null),b(t,Ui,g),b(t,nt,g),e(nt,Kt),e(Kt,rl),w(Gn,rl,null),e(nt,$f),e(nt,al),e(al,Bf),b(t,Ci,g),b(t,P,g),w(An,P,null),e(P,xf),e(P,ll),e(ll,Jf),e(P,jf),e(P,Sn),e(Sn,Ef),e(Sn,cr),e(cr,If),e(Sn,Ff),e(P,kf),e(P,qn),e(qn,Uf),e(qn,Xn),e(Xn,Cf),e(qn,zf),e(P,Wf),e(P,ne),w(Qn,ne,null),e(ne,Nf),e(ne,st),e(st,Pf),e(st,pr),e(pr,Zf),e(st,Vf),e(st,il),e(il,Rf),e(st,Gf),e(ne,Af),w(eo,ne,null),e(ne,Sf),w(to,ne,null),b(t,zi,g),b(t,rt,g),e(rt,oo),e(oo,dl),w(Hn,dl,null),e(rt,qf),e(rt,cl),e(cl,Xf),b(t,Wi,g),b(t,L,g),w(Yn,L,null),e(L,Qf),e(L,se),w(Ln,se,null),e(se,Hf),e(se,at),e(at,Yf),e(at,mr),e(mr,Lf),e(at,Df),e(at,pl),e(pl,Of),e(at,Kf),e(se,eu),w(no,se,null),e(se,tu),w(so,se,null),e(L,ou),e(L,re),w(Dn,re,null),e(re,nu),e(re,lt),e(lt,su),e(lt,hr),e(hr,ru),e(lt,au),e(lt,ml),e(ml,lu),e(lt,iu),e(re,du),w(ro,re,null),e(re,cu),w(ao,re,null),e(L,pu),e(L,ae),w(On,ae,null),e(ae,mu),e(ae,it),e(it,hu),e(it,fr),e(fr,fu),e(it,uu),e(it,hl),e(hl,gu),e(it,_u),e(ae,bu),w(lo,ae,null),e(ae,vu),w(io,ae,null),b(t,Ni,g),b(t,dt,g),e(dt,co),e(co,fl),w(Kn,fl,null),e(dt,yu),e(dt,ul),e(ul,Tu),b(t,Pi,g),b(t,ue,g),w(es,ue,null),e(ue,wu),e(ue,D),e(D,Mu),e(D,ts),e(ts,$u),e(D,Bu),e(D,gl),e(gl,xu),e(D,Ju),e(D,_l),e(_l,ju),e(D,Eu),e(D,bl),e(bl,Iu),e(D,Fu),e(ue,ku),e(ue,we),w(os,we,null),e(we,Uu),e(we,ct),e(ct,Cu),e(ct,ur),e(ur,zu),e(ct,Wu),e(ct,vl),e(vl,Nu),e(ct,Pu),e(we,Zu),w(po,we,null),b(t,Zi,g),b(t,pt,g),e(pt,mo),e(mo,yl),w(ns,yl,null),e(pt,Vu),e(pt,Tl),e(Tl,Ru),b(t,Vi,g),b(t,mt,g),w(ss,mt,null),e(mt,Gu),e(mt,Me),w(rs,Me,null),e(Me,Au),e(Me,ht),e(ht,Su),e(ht,gr),e(gr,qu),e(ht,Xu),e(ht,wl),e(wl,Qu),e(ht,Hu),e(Me,Yu),w(ho,Me,null),b(t,Ri,g),b(t,ft,g),e(ft,fo),e(fo,Ml),w(as,Ml,null),e(ft,Lu),e(ft,$l),e($l,Du),b(t,Gi,g),b(t,Z,g),w(ls,Z,null),e(Z,Ou),e(Z,is),e(is,Ku),e(is,Bl),e(Bl,eg),e(is,tg),e(Z,og),e(Z,ds),e(ds,ng),e(ds,_r),e(_r,sg),e(ds,rg),e(Z,ag),e(Z,cs),e(cs,lg),e(cs,ps),e(ps,ig),e(cs,dg),e(Z,cg),e(Z,le),w(ms,le,null),e(le,pg),e(le,ut),e(ut,mg),e(ut,br),e(br,hg),e(ut,fg),e(ut,xl),e(xl,ug),e(ut,gg),e(le,_g),w(uo,le,null),e(le,bg),w(go,le,null),b(t,Ai,g),b(t,gt,g),e(gt,_o),e(_o,Jl),w(hs,Jl,null),e(gt,vg),e(gt,jl),e(jl,yg),b(t,Si,g),b(t,V,g),w(fs,V,null),e(V,Tg),e(V,El),e(El,wg),e(V,Mg),e(V,us),e(us,$g),e(us,vr),e(vr,Bg),e(us,xg),e(V,Jg),e(V,gs),e(gs,jg),e(gs,_s),e(_s,Eg),e(gs,Ig),e(V,Fg),e(V,ie),w(bs,ie,null),e(ie,kg),e(ie,_t),e(_t,Ug),e(_t,yr),e(yr,Cg),e(_t,zg),e(_t,Il),e(Il,Wg),e(_t,Ng),e(ie,Pg),w(bo,ie,null),e(ie,Zg),w(vo,ie,null),b(t,qi,g),b(t,bt,g),e(bt,yo),e(yo,Fl),w(vs,Fl,null),e(bt,Vg),e(bt,kl),e(kl,Rg),b(t,Xi,g),b(t,R,g),w(ys,R,null),e(R,Gg),e(R,Ul),e(Ul,Ag),e(R,Sg),e(R,Ts),e(Ts,qg),e(Ts,Tr),e(Tr,Xg),e(Ts,Qg),e(R,Hg),e(R,ws),e(ws,Yg),e(ws,Ms),e(Ms,Lg),e(ws,Dg),e(R,Og),e(R,de),w($s,de,null),e(de,Kg),e(de,vt),e(vt,e_),e(vt,wr),e(wr,t_),e(vt,o_),e(vt,Cl),e(Cl,n_),e(vt,s_),e(de,r_),w(To,de,null),e(de,a_),w(wo,de,null),Qi=!0},p(t,[g]){const Bs={};g&2&&(Bs.$$scope={dirty:g,ctx:t}),xt.$set(Bs);const zl={};g&2&&(zl.$$scope={dirty:g,ctx:t}),Et.$set(zl);const Wl={};g&2&&(Wl.$$scope={dirty:g,ctx:t}),Ft.$set(Wl);const Nl={};g&2&&(Nl.$$scope={dirty:g,ctx:t}),Pt.$set(Nl);const xs={};g&2&&(xs.$$scope={dirty:g,ctx:t}),Zt.$set(xs);const Pl={};g&2&&(Pl.$$scope={dirty:g,ctx:t}),Vt.$set(Pl);const Zl={};g&2&&(Zl.$$scope={dirty:g,ctx:t}),Rt.$set(Zl);const Vl={};g&2&&(Vl.$$scope={dirty:g,ctx:t}),Gt.$set(Vl);const Js={};g&2&&(Js.$$scope={dirty:g,ctx:t}),At.$set(Js);const Rl={};g&2&&(Rl.$$scope={dirty:g,ctx:t}),Xt.$set(Rl);const Gl={};g&2&&(Gl.$$scope={dirty:g,ctx:t}),Ht.$set(Gl);const yt={};g&2&&(yt.$$scope={dirty:g,ctx:t}),Yt.$set(yt);const Al={};g&2&&(Al.$$scope={dirty:g,ctx:t}),Dt.$set(Al);const Sl={};g&2&&(Sl.$$scope={dirty:g,ctx:t}),Ot.$set(Sl);const ql={};g&2&&(ql.$$scope={dirty:g,ctx:t}),eo.$set(ql);const Xl={};g&2&&(Xl.$$scope={dirty:g,ctx:t}),to.$set(Xl);const Ql={};g&2&&(Ql.$$scope={dirty:g,ctx:t}),no.$set(Ql);const Hl={};g&2&&(Hl.$$scope={dirty:g,ctx:t}),so.$set(Hl);const Yl={};g&2&&(Yl.$$scope={dirty:g,ctx:t}),ro.$set(Yl);const Tt={};g&2&&(Tt.$$scope={dirty:g,ctx:t}),ao.$set(Tt);const Ll={};g&2&&(Ll.$$scope={dirty:g,ctx:t}),lo.$set(Ll);const Dl={};g&2&&(Dl.$$scope={dirty:g,ctx:t}),io.$set(Dl);const js={};g&2&&(js.$$scope={dirty:g,ctx:t}),po.$set(js);const Ol={};g&2&&(Ol.$$scope={dirty:g,ctx:t}),ho.$set(Ol);const Kl={};g&2&&(Kl.$$scope={dirty:g,ctx:t}),uo.$set(Kl);const ei={};g&2&&(ei.$$scope={dirty:g,ctx:t}),go.$set(ei);const ti={};g&2&&(ti.$$scope={dirty:g,ctx:t}),bo.$set(ti);const Mr={};g&2&&(Mr.$$scope={dirty:g,ctx:t}),vo.$set(Mr);const oi={};g&2&&(oi.$$scope={dirty:g,ctx:t}),To.$set(oi);const Es={};g&2&&(Es.$$scope={dirty:g,ctx:t}),wo.$set(Es)},i(t){Qi||(M(n.$$.fragment,t),M(Zo.$$.fragment,t),M(Ao.$$.fragment,t),M(qo.$$.fragment,t),M(Xo.$$.fragment,t),M(xt.$$.fragment,t),M(Ho.$$.fragment,t),M(Lo.$$.fragment,t),M(Do.$$.fragment,t),M(Et.$$.fragment,t),M(Ko.$$.fragment,t),M(en.$$.fragment,t),M(Ft.$$.fragment,t),M(on.$$.fragment,t),M(nn.$$.fragment,t),M(sn.$$.fragment,t),M(an.$$.fragment,t),M(dn.$$.fragment,t),M(cn.$$.fragment,t),M(pn.$$.fragment,t),M(mn.$$.fragment,t),M(hn.$$.fragment,t),M(_n.$$.fragment,t),M(Pt.$$.fragment,t),M(Zt.$$.fragment,t),M(bn.$$.fragment,t),M(Vt.$$.fragment,t),M(Rt.$$.fragment,t),M(vn.$$.fragment,t),M(Gt.$$.fragment,t),M(At.$$.fragment,t),M(yn.$$.fragment,t),M(Tn.$$.fragment,t),M(Mn.$$.fragment,t),M(xn.$$.fragment,t),M(Jn.$$.fragment,t),M(jn.$$.fragment,t),M(Xt.$$.fragment,t),M(En.$$.fragment,t),M(In.$$.fragment,t),M(zn.$$.fragment,t),M(Ht.$$.fragment,t),M(Yt.$$.fragment,t),M(Wn.$$.fragment,t),M(Nn.$$.fragment,t),M(Rn.$$.fragment,t),M(Dt.$$.fragment,t),M(Ot.$$.fragment,t),M(Gn.$$.fragment,t),M(An.$$.fragment,t),M(Qn.$$.fragment,t),M(eo.$$.fragment,t),M(to.$$.fragment,t),M(Hn.$$.fragment,t),M(Yn.$$.fragment,t),M(Ln.$$.fragment,t),M(no.$$.fragment,t),M(so.$$.fragment,t),M(Dn.$$.fragment,t),M(ro.$$.fragment,t),M(ao.$$.fragment,t),M(On.$$.fragment,t),M(lo.$$.fragment,t),M(io.$$.fragment,t),M(Kn.$$.fragment,t),M(es.$$.fragment,t),M(os.$$.fragment,t),M(po.$$.fragment,t),M(ns.$$.fragment,t),M(ss.$$.fragment,t),M(rs.$$.fragment,t),M(ho.$$.fragment,t),M(as.$$.fragment,t),M(ls.$$.fragment,t),M(ms.$$.fragment,t),M(uo.$$.fragment,t),M(go.$$.fragment,t),M(hs.$$.fragment,t),M(fs.$$.fragment,t),M(bs.$$.fragment,t),M(bo.$$.fragment,t),M(vo.$$.fragment,t),M(vs.$$.fragment,t),M(ys.$$.fragment,t),M($s.$$.fragment,t),M(To.$$.fragment,t),M(wo.$$.fragment,t),Qi=!0)},o(t){$(n.$$.fragment,t),$(Zo.$$.fragment,t),$(Ao.$$.fragment,t),$(qo.$$.fragment,t),$(Xo.$$.fragment,t),$(xt.$$.fragment,t),$(Ho.$$.fragment,t),$(Lo.$$.fragment,t),$(Do.$$.fragment,t),$(Et.$$.fragment,t),$(Ko.$$.fragment,t),$(en.$$.fragment,t),$(Ft.$$.fragment,t),$(on.$$.fragment,t),$(nn.$$.fragment,t),$(sn.$$.fragment,t),$(an.$$.fragment,t),$(dn.$$.fragment,t),$(cn.$$.fragment,t),$(pn.$$.fragment,t),$(mn.$$.fragment,t),$(hn.$$.fragment,t),$(_n.$$.fragment,t),$(Pt.$$.fragment,t),$(Zt.$$.fragment,t),$(bn.$$.fragment,t),$(Vt.$$.fragment,t),$(Rt.$$.fragment,t),$(vn.$$.fragment,t),$(Gt.$$.fragment,t),$(At.$$.fragment,t),$(yn.$$.fragment,t),$(Tn.$$.fragment,t),$(Mn.$$.fragment,t),$(xn.$$.fragment,t),$(Jn.$$.fragment,t),$(jn.$$.fragment,t),$(Xt.$$.fragment,t),$(En.$$.fragment,t),$(In.$$.fragment,t),$(zn.$$.fragment,t),$(Ht.$$.fragment,t),$(Yt.$$.fragment,t),$(Wn.$$.fragment,t),$(Nn.$$.fragment,t),$(Rn.$$.fragment,t),$(Dt.$$.fragment,t),$(Ot.$$.fragment,t),$(Gn.$$.fragment,t),$(An.$$.fragment,t),$(Qn.$$.fragment,t),$(eo.$$.fragment,t),$(to.$$.fragment,t),$(Hn.$$.fragment,t),$(Yn.$$.fragment,t),$(Ln.$$.fragment,t),$(no.$$.fragment,t),$(so.$$.fragment,t),$(Dn.$$.fragment,t),$(ro.$$.fragment,t),$(ao.$$.fragment,t),$(On.$$.fragment,t),$(lo.$$.fragment,t),$(io.$$.fragment,t),$(Kn.$$.fragment,t),$(es.$$.fragment,t),$(os.$$.fragment,t),$(po.$$.fragment,t),$(ns.$$.fragment,t),$(ss.$$.fragment,t),$(rs.$$.fragment,t),$(ho.$$.fragment,t),$(as.$$.fragment,t),$(ls.$$.fragment,t),$(ms.$$.fragment,t),$(uo.$$.fragment,t),$(go.$$.fragment,t),$(hs.$$.fragment,t),$(fs.$$.fragment,t),$(bs.$$.fragment,t),$(bo.$$.fragment,t),$(vo.$$.fragment,t),$(vs.$$.fragment,t),$(ys.$$.fragment,t),$($s.$$.fragment,t),$(To.$$.fragment,t),$(wo.$$.fragment,t),Qi=!1},d(t){o(d),t&&o(v),t&&o(u),B(n),t&&o(ni),t&&o(Ce),B(Zo),t&&o(si),t&&o(Mt),t&&o(ri),t&&o(Fs),t&&o(ai),t&&o(_e),t&&o(li),t&&o(ks),t&&o(ii),t&&o(Us),t&&o(di),t&&o(Cs),t&&o(ci),t&&o(be),t&&o(pi),t&&o(ze),B(Ao),t&&o(mi),t&&o(Ws),t&&o(hi),t&&o(We),B(qo),t&&o(fi),t&&o(U),B(Xo),B(xt),B(Ho),t&&o(ui),t&&o(Pe),B(Lo),t&&o(gi),t&&o(Q),B(Do),B(Et),t&&o(_i),t&&o(Ve),B(Ko),t&&o(bi),t&&o(H),B(en),B(Ft),t&&o(vi),t&&o(Ae),B(on),t&&o(yi),t&&o(C),B(nn),B(sn),B(an),t&&o(Ti),t&&o(Se),B(dn),t&&o(wi),t&&o(he),B(cn),B(pn),t&&o(Mi),t&&o(qe),B(mn),t&&o($i),t&&o(k),B(hn),B(_n),B(Pt),B(Zt),B(bn),B(Vt),B(Rt),B(vn),B(Gt),B(At),t&&o(Bi),t&&o(Ye),B(yn),t&&o(xi),t&&o(fe),B(Tn),B(Mn),t&&o(Ji),t&&o(Le),B(xn),t&&o(ji),t&&o(De),B(Jn),B(jn),B(Xt),t&&o(Ei),t&&o(Ke),B(En),t&&o(Ii),t&&o(W),B(In),B(zn),B(Ht),B(Yt),t&&o(Fi),t&&o(tt),B(Wn),t&&o(ki),t&&o(N),B(Nn),B(Rn),B(Dt),B(Ot),t&&o(Ui),t&&o(nt),B(Gn),t&&o(Ci),t&&o(P),B(An),B(Qn),B(eo),B(to),t&&o(zi),t&&o(rt),B(Hn),t&&o(Wi),t&&o(L),B(Yn),B(Ln),B(no),B(so),B(Dn),B(ro),B(ao),B(On),B(lo),B(io),t&&o(Ni),t&&o(dt),B(Kn),t&&o(Pi),t&&o(ue),B(es),B(os),B(po),t&&o(Zi),t&&o(pt),B(ns),t&&o(Vi),t&&o(mt),B(ss),B(rs),B(ho),t&&o(Ri),t&&o(ft),B(as),t&&o(Gi),t&&o(Z),B(ls),B(ms),B(uo),B(go),t&&o(Ai),t&&o(gt),B(hs),t&&o(Si),t&&o(V),B(fs),B(bs),B(bo),B(vo),t&&o(qi),t&&o(bt),B(vs),t&&o(Xi),t&&o(R),B(ys),B($s),B(To),B(wo)}}}const Wy={local:"blip",sections:[{local:"overview",title:"Overview"},{local:"resources",title:"Resources"},{local:"transformers.BlipConfig",title:"BlipConfig"},{local:"transformers.BlipTextConfig",title:"BlipTextConfig"},{local:"transformers.BlipVisionConfig",title:"BlipVisionConfig"},{local:"transformers.BlipProcessor",title:"BlipProcessor"},{local:"transformers.BlipImageProcessor",title:"BlipImageProcessor"},{local:"transformers.BlipModel",title:"BlipModel"},{local:"transformers.BlipTextModel",title:"BlipTextModel"},{local:"transformers.BlipVisionModel",title:"BlipVisionModel"},{local:"transformers.BlipForConditionalGeneration",title:"BlipForConditionalGeneration"},{local:"transformers.BlipForImageTextRetrieval",title:"BlipForImageTextRetrieval"},{local:"transformers.BlipForQuestionAnswering",title:"BlipForQuestionAnswering"},{local:"transformers.TFBlipModel",title:"TFBlipModel"},{local:"transformers.TFBlipTextModel",title:"TFBlipTextModel"},{local:"transformers.TFBlipVisionModel",title:"TFBlipVisionModel"},{local:"transformers.TFBlipForConditionalGeneration",title:"TFBlipForConditionalGeneration"},{local:"transformers.TFBlipForImageTextRetrieval",title:"TFBlipForImageTextRetrieval"},{local:"transformers.TFBlipForQuestionAnswering",title:"TFBlipForQuestionAnswering"}],title:"BLIP"};function Ny(x){return sy(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Sy extends Kv{constructor(d){super();ey(this,d,Ny,zy,ty,{})}}export{Sy as default,Wy as metadata};
