import{s as er,A as tr,o as nr,n as x}from"../chunks/scheduler.01eeda35.js";import{S as or,i as sr,g as c,s as r,r as u,A as ar,h as p,f as l,c as i,j as B,u as h,x as y,k as $,y as s,a as m,v as f,d as _,t as b,w as M}from"../chunks/index.6dd51b66.js";import{T as ge}from"../chunks/Tip.de9bae2b.js";import{D as J}from"../chunks/Docstring.cb556860.js";import{C as G}from"../chunks/CodeBlock.19ec9b8c.js";import{E as N}from"../chunks/ExampleCodeBlock.69db56ad.js";import{H as R,E as rr}from"../chunks/index.58fe8f9d.js";function ir(v){let t,g="Example:",o,d,T;return d=new G({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMCglMEElMjAlMjAlMjAlMjBCbGlwMlZpc2lvbkNvbmZpZyUyQyUwQSUyMCUyMCUyMCUyMEJsaXAyUUZvcm1lckNvbmZpZyUyQyUwQSUyMCUyMCUyMCUyME9QVENvbmZpZyUyQyUwQSUyMCUyMCUyMCUyMEJsaXAyQ29uZmlnJTJDJTBBJTIwJTIwJTIwJTIwQmxpcDJGb3JDb25kaXRpb25hbEdlbmVyYXRpb24lMkMlMEEpJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMEJsaXAyQ29uZmlnJTIwd2l0aCUyMFNhbGVzZm9yY2UlMkZibGlwMi1vcHQtMi43YiUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBCbGlwMkNvbmZpZygpJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMEJsaXAyRm9yQ29uZGl0aW9uYWxHZW5lcmF0aW9uJTIwKHdpdGglMjByYW5kb20lMjB3ZWlnaHRzKSUyMGZyb20lMjB0aGUlMjBTYWxlc2ZvcmNlJTJGYmxpcDItb3B0LTIuN2IlMjBzdHlsZSUyMGNvbmZpZ3VyYXRpb24lMEFtb2RlbCUyMCUzRCUyMEJsaXAyRm9yQ29uZGl0aW9uYWxHZW5lcmF0aW9uKGNvbmZpZ3VyYXRpb24pJTBBJTBBJTIzJTIwQWNjZXNzaW5nJTIwdGhlJTIwbW9kZWwlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyMG1vZGVsLmNvbmZpZyUwQSUwQSUyMyUyMFdlJTIwY2FuJTIwYWxzbyUyMGluaXRpYWxpemUlMjBhJTIwQmxpcDJDb25maWclMjBmcm9tJTIwYSUyMEJsaXAyVmlzaW9uQ29uZmlnJTJDJTIwQmxpcDJRRm9ybWVyQ29uZmlnJTIwYW5kJTIwYW55JTIwUHJldHJhaW5lZENvbmZpZyUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMEJMSVAtMiUyMHZpc2lvbiUyQyUyMEJMSVAtMiUyMFEtRm9ybWVyJTIwYW5kJTIwbGFuZ3VhZ2UlMjBtb2RlbCUyMGNvbmZpZ3VyYXRpb25zJTBBdmlzaW9uX2NvbmZpZyUyMCUzRCUyMEJsaXAyVmlzaW9uQ29uZmlnKCklMEFxZm9ybWVyX2NvbmZpZyUyMCUzRCUyMEJsaXAyUUZvcm1lckNvbmZpZygpJTBBdGV4dF9jb25maWclMjAlM0QlMjBPUFRDb25maWcoKSUwQSUwQWNvbmZpZyUyMCUzRCUyMEJsaXAyQ29uZmlnLmZyb21fdGV4dF92aXNpb25fY29uZmlncyh2aXNpb25fY29uZmlnJTJDJTIwcWZvcm1lcl9jb25maWclMkMlMjB0ZXh0X2NvbmZpZyk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> (
<span class="hljs-meta">... </span>    Blip2VisionConfig,
<span class="hljs-meta">... </span>    Blip2QFormerConfig,
<span class="hljs-meta">... </span>    OPTConfig,
<span class="hljs-meta">... </span>    Blip2Config,
<span class="hljs-meta">... </span>    Blip2ForConditionalGeneration,
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a Blip2Config with Salesforce/blip2-opt-2.7b style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = Blip2Config()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a Blip2ForConditionalGeneration (with random weights) from the Salesforce/blip2-opt-2.7b style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Blip2ForConditionalGeneration(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 Blip2Config from a Blip2VisionConfig, Blip2QFormerConfig and any PretrainedConfig</span>

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing BLIP-2 vision, BLIP-2 Q-Former and language model configurations</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>vision_config = Blip2VisionConfig()
<span class="hljs-meta">&gt;&gt;&gt; </span>qformer_config = Blip2QFormerConfig()
<span class="hljs-meta">&gt;&gt;&gt; </span>text_config = OPTConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span>config = Blip2Config.from_text_vision_configs(vision_config, qformer_config, text_config)`,wrap:!1}}),{c(){t=c("p"),t.textContent=g,o=r(),u(d.$$.fragment)},l(n){t=p(n,"P",{"data-svelte-h":!0}),y(t)!=="svelte-11lpom8"&&(t.textContent=g),o=i(n),h(d.$$.fragment,n)},m(n,w){m(n,t,w),m(n,o,w),f(d,n,w),T=!0},p:x,i(n){T||(_(d.$$.fragment,n),T=!0)},o(n){b(d.$$.fragment,n),T=!1},d(n){n&&(l(t),l(o)),M(d,n)}}}function lr(v){let t,g="Example:",o,d,T;return d=new G({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEJsaXAyVmlzaW9uQ29uZmlnJTJDJTIwQmxpcDJWaXNpb25Nb2RlbCUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBCbGlwMlZpc2lvbkNvbmZpZyUyMHdpdGglMjBTYWxlc2ZvcmNlJTJGYmxpcDItb3B0LTIuN2IlMjBzdHlsZSUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwQmxpcDJWaXNpb25Db25maWcoKSUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBCbGlwMlZpc2lvbk1vZGVsJTIwKHdpdGglMjByYW5kb20lMjB3ZWlnaHRzKSUyMGZyb20lMjB0aGUlMjBTYWxlc2ZvcmNlJTJGYmxpcDItb3B0LTIuN2IlMjBzdHlsZSUyMGNvbmZpZ3VyYXRpb24lMEFtb2RlbCUyMCUzRCUyMEJsaXAyVmlzaW9uTW9kZWwoY29uZmlndXJhdGlvbiklMEElMEElMjMlMjBBY2Nlc3NpbmclMjB0aGUlMjBtb2RlbCUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwbW9kZWwuY29uZmln",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Blip2VisionConfig, Blip2VisionModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a Blip2VisionConfig with Salesforce/blip2-opt-2.7b style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = Blip2VisionConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a Blip2VisionModel (with random weights) from the Salesforce/blip2-opt-2.7b style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Blip2VisionModel(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`,wrap:!1}}),{c(){t=c("p"),t.textContent=g,o=r(),u(d.$$.fragment)},l(n){t=p(n,"P",{"data-svelte-h":!0}),y(t)!=="svelte-11lpom8"&&(t.textContent=g),o=i(n),h(d.$$.fragment,n)},m(n,w){m(n,t,w),m(n,o,w),f(d,n,w),T=!0},p:x,i(n){T||(_(d.$$.fragment,n),T=!0)},o(n){b(d.$$.fragment,n),T=!1},d(n){n&&(l(t),l(o)),M(d,n)}}}function dr(v){let t,g="Examples:",o,d,T;return d=new G({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEJsaXAyUUZvcm1lckNvbmZpZyUyQyUyMEJsaXAyUUZvcm1lck1vZGVsJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMEJMSVAtMiUyMFNhbGVzZm9yY2UlMkZibGlwMi1vcHQtMi43YiUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBCbGlwMlFGb3JtZXJDb25maWcoKSUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBtb2RlbCUyMCh3aXRoJTIwcmFuZG9tJTIwd2VpZ2h0cyklMjBmcm9tJTIwdGhlJTIwU2FsZXNmb3JjZSUyRmJsaXAyLW9wdC0yLjdiJTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBbW9kZWwlMjAlM0QlMjBCbGlwMlFGb3JtZXJNb2RlbChjb25maWd1cmF0aW9uKSUwQSUyMyUyMEFjY2Vzc2luZyUyMHRoZSUyMG1vZGVsJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBtb2RlbC5jb25maWc=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Blip2QFormerConfig, Blip2QFormerModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a BLIP-2 Salesforce/blip2-opt-2.7b style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = Blip2QFormerConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model (with random weights) from the Salesforce/blip2-opt-2.7b style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Blip2QFormerModel(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`,wrap:!1}}),{c(){t=c("p"),t.textContent=g,o=r(),u(d.$$.fragment)},l(n){t=p(n,"P",{"data-svelte-h":!0}),y(t)!=="svelte-kvfsh7"&&(t.textContent=g),o=i(n),h(d.$$.fragment,n)},m(n,w){m(n,t,w),m(n,o,w),f(d,n,w),T=!0},p:x,i(n){T||(_(d.$$.fragment,n),T=!0)},o(n){b(d.$$.fragment,n),T=!1},d(n){n&&(l(t),l(o)),M(d,n)}}}function cr(v){let t,g=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){t=c("p"),t.innerHTML=g},l(o){t=p(o,"P",{"data-svelte-h":!0}),y(t)!=="svelte-fincs2"&&(t.innerHTML=g)},m(o,d){m(o,t,d)},p:x,d(o){o&&l(t)}}}function pr(v){let t,g=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){t=c("p"),t.innerHTML=g},l(o){t=p(o,"P",{"data-svelte-h":!0}),y(t)!=="svelte-fincs2"&&(t.innerHTML=g)},m(o,d){m(o,t,d)},p:x,d(o){o&&l(t)}}}function mr(v){let t,g="Examples:",o,d,T;return d=new G({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQmxpcDJQcm9jZXNzb3IlMkMlMjBCbGlwMk1vZGVsJTBBaW1wb3J0JTIwdG9yY2glMEElMEFkZXZpY2UlMjAlM0QlMjAlMjJjdWRhJTIyJTIwaWYlMjB0b3JjaC5jdWRhLmlzX2F2YWlsYWJsZSgpJTIwZWxzZSUyMCUyMmNwdSUyMiUwQSUwQXByb2Nlc3NvciUyMCUzRCUyMEJsaXAyUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJTYWxlc2ZvcmNlJTJGYmxpcDItb3B0LTIuN2IlMjIpJTBBbW9kZWwlMjAlM0QlMjBCbGlwMk1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJTYWxlc2ZvcmNlJTJGYmxpcDItb3B0LTIuN2IlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYpJTBBbW9kZWwudG8oZGV2aWNlKSUwQXVybCUyMCUzRCUyMCUyMmh0dHAlM0ElMkYlMkZpbWFnZXMuY29jb2RhdGFzZXQub3JnJTJGdmFsMjAxNyUyRjAwMDAwMDAzOTc2OS5qcGclMjIlMEFpbWFnZSUyMCUzRCUyMEltYWdlLm9wZW4ocmVxdWVzdHMuZ2V0KHVybCUyQyUyMHN0cmVhbSUzRFRydWUpLnJhdyklMEElMEFwcm9tcHQlMjAlM0QlMjAlMjJRdWVzdGlvbiUzQSUyMGhvdyUyMG1hbnklMjBjYXRzJTIwYXJlJTIwdGhlcmUlM0YlMjBBbnN3ZXIlM0ElMjIlMEFpbnB1dHMlMjAlM0QlMjBwcm9jZXNzb3IoaW1hZ2VzJTNEaW1hZ2UlMkMlMjB0ZXh0JTNEcHJvbXB0JTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMikudG8oZGV2aWNlJTJDJTIwdG9yY2guZmxvYXQxNiklMEElMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMp",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> Blip2Processor, Blip2Model
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>device = <span class="hljs-string">&quot;cuda&quot;</span> <span class="hljs-keyword">if</span> torch.cuda.is_available() <span class="hljs-keyword">else</span> <span class="hljs-string">&quot;cpu&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = Blip2Processor.from_pretrained(<span class="hljs-string">&quot;Salesforce/blip2-opt-2.7b&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Blip2Model.from_pretrained(<span class="hljs-string">&quot;Salesforce/blip2-opt-2.7b&quot;</span>, torch_dtype=torch.float16)
<span class="hljs-meta">&gt;&gt;&gt; </span>model.to(device)
<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>prompt = <span class="hljs-string">&quot;Question: how many cats are there? Answer:&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(images=image, text=prompt, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).to(device, torch.float16)

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)`,wrap:!1}}),{c(){t=c("p"),t.textContent=g,o=r(),u(d.$$.fragment)},l(n){t=p(n,"P",{"data-svelte-h":!0}),y(t)!=="svelte-kvfsh7"&&(t.textContent=g),o=i(n),h(d.$$.fragment,n)},m(n,w){m(n,t,w),m(n,o,w),f(d,n,w),T=!0},p:x,i(n){T||(_(d.$$.fragment,n),T=!0)},o(n){b(d.$$.fragment,n),T=!1},d(n){n&&(l(t),l(o)),M(d,n)}}}function gr(v){let t,g=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){t=c("p"),t.innerHTML=g},l(o){t=p(o,"P",{"data-svelte-h":!0}),y(t)!=="svelte-fincs2"&&(t.innerHTML=g)},m(o,d){m(o,t,d)},p:x,d(o){o&&l(t)}}}function ur(v){let t,g="Examples:",o,d,T;return d=new G({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUyQyUyMEJsaXAyTW9kZWwlMEElMEFtb2RlbCUyMCUzRCUyMEJsaXAyTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMlNhbGVzZm9yY2UlMkZibGlwMi1vcHQtMi43YiUyMiklMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJTYWxlc2ZvcmNlJTJGYmxpcDItb3B0LTIuN2IlMjIpJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCU1QiUyMmElMjBwaG90byUyMG9mJTIwYSUyMGNhdCUyMiU1RCUyQyUyMHBhZGRpbmclM0RUcnVlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEF0ZXh0X2ZlYXR1cmVzJTIwJTNEJTIwbW9kZWwuZ2V0X3RleHRfZmVhdHVyZXMoKippbnB1dHMp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, Blip2Model

<span class="hljs-meta">&gt;&gt;&gt; </span>model = Blip2Model.from_pretrained(<span class="hljs-string">&quot;Salesforce/blip2-opt-2.7b&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;Salesforce/blip2-opt-2.7b&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer([<span class="hljs-string">&quot;a photo of a cat&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)`,wrap:!1}}),{c(){t=c("p"),t.textContent=g,o=r(),u(d.$$.fragment)},l(n){t=p(n,"P",{"data-svelte-h":!0}),y(t)!=="svelte-kvfsh7"&&(t.textContent=g),o=i(n),h(d.$$.fragment,n)},m(n,w){m(n,t,w),m(n,o,w),f(d,n,w),T=!0},p:x,i(n){T||(_(d.$$.fragment,n),T=!0)},o(n){b(d.$$.fragment,n),T=!1},d(n){n&&(l(t),l(o)),M(d,n)}}}function hr(v){let t,g=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){t=c("p"),t.innerHTML=g},l(o){t=p(o,"P",{"data-svelte-h":!0}),y(t)!=="svelte-fincs2"&&(t.innerHTML=g)},m(o,d){m(o,t,d)},p:x,d(o){o&&l(t)}}}function fr(v){let t,g="Examples:",o,d,T;return d=new G({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEFpbXBvcnQlMjByZXF1ZXN0cyUwQWZyb20lMjB0cmFuc2Zvcm1lcnMlMjBpbXBvcnQlMjBBdXRvUHJvY2Vzc29yJTJDJTIwQmxpcDJNb2RlbCUwQSUwQW1vZGVsJTIwJTNEJTIwQmxpcDJNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyU2FsZXNmb3JjZSUyRmJsaXAyLW9wdC0yLjdiJTIyKSUwQSUwQXByb2Nlc3NvciUyMCUzRCUyMEF1dG9Qcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMlNhbGVzZm9yY2UlMkZibGlwMi1vcHQtMi43YiUyMiklMEF1cmwlMjAlM0QlMjAlMjJodHRwJTNBJTJGJTJGaW1hZ2VzLmNvY29kYXRhc2V0Lm9yZyUyRnZhbDIwMTclMkYwMDAwMDAwMzk3NjkuanBnJTIyJTBBaW1hZ2UlMjAlM0QlMjBJbWFnZS5vcGVuKHJlcXVlc3RzLmdldCh1cmwlMkMlMjBzdHJlYW0lM0RUcnVlKS5yYXcpJTBBaW5wdXRzJTIwJTNEJTIwcHJvY2Vzc29yKGltYWdlcyUzRGltYWdlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEFpbWFnZV9vdXRwdXRzJTIwJTNEJTIwbW9kZWwuZ2V0X2ltYWdlX2ZlYXR1cmVzKCoqaW5wdXRzKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<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, Blip2Model

<span class="hljs-meta">&gt;&gt;&gt; </span>model = Blip2Model.from_pretrained(<span class="hljs-string">&quot;Salesforce/blip2-opt-2.7b&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;Salesforce/blip2-opt-2.7b&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_outputs = model.get_image_features(**inputs)`,wrap:!1}}),{c(){t=c("p"),t.textContent=g,o=r(),u(d.$$.fragment)},l(n){t=p(n,"P",{"data-svelte-h":!0}),y(t)!=="svelte-kvfsh7"&&(t.textContent=g),o=i(n),h(d.$$.fragment,n)},m(n,w){m(n,t,w),m(n,o,w),f(d,n,w),T=!0},p:x,i(n){T||(_(d.$$.fragment,n),T=!0)},o(n){b(d.$$.fragment,n),T=!1},d(n){n&&(l(t),l(o)),M(d,n)}}}function _r(v){let t,g=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){t=c("p"),t.innerHTML=g},l(o){t=p(o,"P",{"data-svelte-h":!0}),y(t)!=="svelte-fincs2"&&(t.innerHTML=g)},m(o,d){m(o,t,d)},p:x,d(o){o&&l(t)}}}function br(v){let t,g="Examples:",o,d,T;return d=new G({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEFpbXBvcnQlMjByZXF1ZXN0cyUwQWZyb20lMjB0cmFuc2Zvcm1lcnMlMjBpbXBvcnQlMjBCbGlwMlByb2Nlc3NvciUyQyUyMEJsaXAyTW9kZWwlMEElMEFwcm9jZXNzb3IlMjAlM0QlMjBCbGlwMlByb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyU2FsZXNmb3JjZSUyRmJsaXAyLW9wdC0yLjdiJTIyKSUwQW1vZGVsJTIwJTNEJTIwQmxpcDJNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyU2FsZXNmb3JjZSUyRmJsaXAyLW9wdC0yLjdiJTIyKSUwQSUwQXVybCUyMCUzRCUyMCUyMmh0dHAlM0ElMkYlMkZpbWFnZXMuY29jb2RhdGFzZXQub3JnJTJGdmFsMjAxNyUyRjAwMDAwMDAzOTc2OS5qcGclMjIlMEFpbWFnZSUyMCUzRCUyMEltYWdlLm9wZW4ocmVxdWVzdHMuZ2V0KHVybCUyQyUyMHN0cmVhbSUzRFRydWUpLnJhdyklMEFpbnB1dHMlMjAlM0QlMjBwcm9jZXNzb3IoaW1hZ2VzJTNEaW1hZ2UlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQXFmb3JtZXJfb3V0cHV0cyUyMCUzRCUyMG1vZGVsLmdldF9xZm9ybWVyX2ZlYXR1cmVzKCoqaW5wdXRzKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<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> Blip2Processor, Blip2Model

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = Blip2Processor.from_pretrained(<span class="hljs-string">&quot;Salesforce/blip2-opt-2.7b&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Blip2Model.from_pretrained(<span class="hljs-string">&quot;Salesforce/blip2-opt-2.7b&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>qformer_outputs = model.get_qformer_features(**inputs)`,wrap:!1}}),{c(){t=c("p"),t.textContent=g,o=r(),u(d.$$.fragment)},l(n){t=p(n,"P",{"data-svelte-h":!0}),y(t)!=="svelte-kvfsh7"&&(t.textContent=g),o=i(n),h(d.$$.fragment,n)},m(n,w){m(n,t,w),m(n,o,w),f(d,n,w),T=!0},p:x,i(n){T||(_(d.$$.fragment,n),T=!0)},o(n){b(d.$$.fragment,n),T=!1},d(n){n&&(l(t),l(o)),M(d,n)}}}function Mr(v){let t,g="Note that Flan-T5 checkpoints cannot be cast to float16. They are pre-trained using bfloat16.";return{c(){t=c("p"),t.textContent=g},l(o){t=p(o,"P",{"data-svelte-h":!0}),y(t)!=="svelte-1cxmmi2"&&(t.textContent=g)},m(o,d){m(o,t,d)},p:x,d(o){o&&l(t)}}}function yr(v){let t,g=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){t=c("p"),t.innerHTML=g},l(o){t=p(o,"P",{"data-svelte-h":!0}),y(t)!=="svelte-fincs2"&&(t.innerHTML=g)},m(o,d){m(o,t,d)},p:x,d(o){o&&l(t)}}}function Tr(v){let t,g;return t=new G({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQmxpcDJQcm9jZXNzb3IlMkMlMjBCbGlwMkZvckNvbmRpdGlvbmFsR2VuZXJhdGlvbiUwQWltcG9ydCUyMHRvcmNoJTBBJTBBZGV2aWNlJTIwJTNEJTIwJTIyY3VkYSUyMiUyMGlmJTIwdG9yY2guY3VkYS5pc19hdmFpbGFibGUoKSUyMGVsc2UlMjAlMjJjcHUlMjIlMEElMEFwcm9jZXNzb3IlMjAlM0QlMjBCbGlwMlByb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyU2FsZXNmb3JjZSUyRmJsaXAyLW9wdC0yLjdiJTIyKSUwQW1vZGVsJTIwJTNEJTIwQmxpcDJGb3JDb25kaXRpb25hbEdlbmVyYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMlNhbGVzZm9yY2UlMkZibGlwMi1vcHQtMi43YiUyMiUyQyUyMGxvYWRfaW5fOGJpdCUzRFRydWUlMkMlMjBkZXZpY2VfbWFwJTNEJTdCJTIyJTIyJTNBJTIwMCU3RCUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUwQSklMjAlMjAlMjMlMjBkb2N0ZXN0JTNBJTIwJTJCSUdOT1JFX1JFU1VMVCUwQSUwQXVybCUyMCUzRCUyMCUyMmh0dHAlM0ElMkYlMkZpbWFnZXMuY29jb2RhdGFzZXQub3JnJTJGdmFsMjAxNyUyRjAwMDAwMDAzOTc2OS5qcGclMjIlMEFpbWFnZSUyMCUzRCUyMEltYWdlLm9wZW4ocmVxdWVzdHMuZ2V0KHVybCUyQyUyMHN0cmVhbSUzRFRydWUpLnJhdyk=",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> Blip2Processor, Blip2ForConditionalGeneration
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>device = <span class="hljs-string">&quot;cuda&quot;</span> <span class="hljs-keyword">if</span> torch.cuda.is_available() <span class="hljs-keyword">else</span> <span class="hljs-string">&quot;cpu&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = Blip2Processor.from_pretrained(<span class="hljs-string">&quot;Salesforce/blip2-opt-2.7b&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Blip2ForConditionalGeneration.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;Salesforce/blip2-opt-2.7b&quot;</span>, load_in_8bit=<span class="hljs-literal">True</span>, device_map={<span class="hljs-string">&quot;&quot;</span>: <span class="hljs-number">0</span>}, torch_dtype=torch.float16
<span class="hljs-meta">... </span>)  <span class="hljs-comment"># doctest: +IGNORE_RESULT</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)`,wrap:!1}}),{c(){u(t.$$.fragment)},l(o){h(t.$$.fragment,o)},m(o,d){f(t,o,d),g=!0},p:x,i(o){g||(_(t.$$.fragment,o),g=!0)},o(o){b(t.$$.fragment,o),g=!1},d(o){M(t,o)}}}function wr(v){let t,g="Image captioning (without providing a text prompt):",o,d,T;return d=new G({props:{code:"aW5wdXRzJTIwJTNEJTIwcHJvY2Vzc29yKGltYWdlcyUzRGltYWdlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMikudG8oZGV2aWNlJTJDJTIwdG9yY2guZmxvYXQxNiklMEElMEFnZW5lcmF0ZWRfaWRzJTIwJTNEJTIwbW9kZWwuZ2VuZXJhdGUoKippbnB1dHMpJTBBZ2VuZXJhdGVkX3RleHQlMjAlM0QlMjBwcm9jZXNzb3IuYmF0Y2hfZGVjb2RlKGdlbmVyYXRlZF9pZHMlMkMlMjBza2lwX3NwZWNpYWxfdG9rZW5zJTNEVHJ1ZSklNUIwJTVELnN0cmlwKCklMEFwcmludChnZW5lcmF0ZWRfdGV4dCk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(images=image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).to(device, torch.float16)

<span class="hljs-meta">&gt;&gt;&gt; </span>generated_ids = model.generate(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>generated_text = processor.batch_decode(generated_ids, skip_special_tokens=<span class="hljs-literal">True</span>)[<span class="hljs-number">0</span>].strip()
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(generated_text)
two cats laying on a couch`,wrap:!1}}),{c(){t=c("p"),t.textContent=g,o=r(),u(d.$$.fragment)},l(n){t=p(n,"P",{"data-svelte-h":!0}),y(t)!=="svelte-1xz2grm"&&(t.textContent=g),o=i(n),h(d.$$.fragment,n)},m(n,w){m(n,t,w),m(n,o,w),f(d,n,w),T=!0},p:x,i(n){T||(_(d.$$.fragment,n),T=!0)},o(n){b(d.$$.fragment,n),T=!1},d(n){n&&(l(t),l(o)),M(d,n)}}}function vr(v){let t,g="Visual question answering (prompt = question):",o,d,T;return d=new G({props:{code:"cHJvbXB0JTIwJTNEJTIwJTIyUXVlc3Rpb24lM0ElMjBob3clMjBtYW55JTIwY2F0cyUyMGFyZSUyMHRoZXJlJTNGJTIwQW5zd2VyJTNBJTIyJTBBaW5wdXRzJTIwJTNEJTIwcHJvY2Vzc29yKGltYWdlcyUzRGltYWdlJTJDJTIwdGV4dCUzRHByb21wdCUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpLnRvKGRldmljZSUzRCUyMmN1ZGElMjIlMkMlMjBkdHlwZSUzRHRvcmNoLmZsb2F0MTYpJTBBJTBBZ2VuZXJhdGVkX2lkcyUyMCUzRCUyMG1vZGVsLmdlbmVyYXRlKCoqaW5wdXRzKSUwQWdlbmVyYXRlZF90ZXh0JTIwJTNEJTIwcHJvY2Vzc29yLmJhdGNoX2RlY29kZShnZW5lcmF0ZWRfaWRzJTJDJTIwc2tpcF9zcGVjaWFsX3Rva2VucyUzRFRydWUpJTVCMCU1RC5zdHJpcCgpJTBBcHJpbnQoZ2VuZXJhdGVkX3RleHQp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;Question: how many cats are there? Answer:&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(images=image, text=prompt, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).to(device=<span class="hljs-string">&quot;cuda&quot;</span>, dtype=torch.float16)

<span class="hljs-meta">&gt;&gt;&gt; </span>generated_ids = model.generate(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>generated_text = processor.batch_decode(generated_ids, skip_special_tokens=<span class="hljs-literal">True</span>)[<span class="hljs-number">0</span>].strip()
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(generated_text)
two`,wrap:!1}}),{c(){t=c("p"),t.textContent=g,o=r(),u(d.$$.fragment)},l(n){t=p(n,"P",{"data-svelte-h":!0}),y(t)!=="svelte-dkukz2"&&(t.textContent=g),o=i(n),h(d.$$.fragment,n)},m(n,w){m(n,t,w),m(n,o,w),f(d,n,w),T=!0},p:x,i(n){T||(_(d.$$.fragment,n),T=!0)},o(n){b(d.$$.fragment,n),T=!1},d(n){n&&(l(t),l(o)),M(d,n)}}}function $r(v){let t,g;return t=new G({props:{code:"bW9kZWwlMjAlM0QlMjBCbGlwMkZvckNvbmRpdGlvbmFsR2VuZXJhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyU2FsZXNmb3JjZSUyRmJsaXAyLW9wdC0yLjdiJTIyJTJDJTIwbG9hZF9pbl84Yml0JTNEVHJ1ZSUyQyUyMGRldmljZV9tYXAlM0QlN0IlMjIlMjIlM0ElMjAwJTdEJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5iZmxvYXQxNiUwQSklMjAlMjAlMjMlMjBkb2N0ZXN0JTNBJTIwJTJCSUdOT1JFX1JFU1VMVCUwQSUwQWlucHV0cyUyMCUzRCUyMHByb2Nlc3NvcihpbWFnZXMlM0RpbWFnZSUyQyUyMHRleHQlM0Rwcm9tcHQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKS50byhkZXZpY2UlM0QlMjJjdWRhJTIyJTJDJTIwZHR5cGUlM0R0b3JjaC5iZmxvYXQxNiklMEElMEFnZW5lcmF0ZWRfaWRzJTIwJTNEJTIwbW9kZWwuZ2VuZXJhdGUoKippbnB1dHMpJTBBZ2VuZXJhdGVkX3RleHQlMjAlM0QlMjBwcm9jZXNzb3IuYmF0Y2hfZGVjb2RlKGdlbmVyYXRlZF9pZHMlMkMlMjBza2lwX3NwZWNpYWxfdG9rZW5zJTNEVHJ1ZSklNUIwJTVELnN0cmlwKCklMEFwcmludChnZW5lcmF0ZWRfdGV4dCk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>model = Blip2ForConditionalGeneration.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;Salesforce/blip2-opt-2.7b&quot;</span>, load_in_8bit=<span class="hljs-literal">True</span>, device_map={<span class="hljs-string">&quot;&quot;</span>: <span class="hljs-number">0</span>}, torch_dtype=torch.bfloat16
<span class="hljs-meta">... </span>)  <span class="hljs-comment"># doctest: +IGNORE_RESULT</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(images=image, text=prompt, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).to(device=<span class="hljs-string">&quot;cuda&quot;</span>, dtype=torch.bfloat16)

<span class="hljs-meta">&gt;&gt;&gt; </span>generated_ids = model.generate(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>generated_text = processor.batch_decode(generated_ids, skip_special_tokens=<span class="hljs-literal">True</span>)[<span class="hljs-number">0</span>].strip()
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(generated_text)
two`,wrap:!1}}),{c(){u(t.$$.fragment)},l(o){h(t.$$.fragment,o)},m(o,d){f(t,o,d),g=!0},p:x,i(o){g||(_(t.$$.fragment,o),g=!0)},o(o){b(t.$$.fragment,o),g=!1},d(o){M(t,o)}}}function Br(v){let t,g=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){t=c("p"),t.innerHTML=g},l(o){t=p(o,"P",{"data-svelte-h":!0}),y(t)!=="svelte-fincs2"&&(t.innerHTML=g)},m(o,d){m(o,t,d)},p:x,d(o){o&&l(t)}}}function Jr(v){let t,g="Examples:",o,d,T;return d=new G({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEFpbXBvcnQlMjByZXF1ZXN0cyUwQWZyb20lMjB0cmFuc2Zvcm1lcnMlMjBpbXBvcnQlMjBBdXRvUHJvY2Vzc29yJTJDJTIwQmxpcDJGb3JJbWFnZVRleHRSZXRyaWV2YWwlMEElMEFkZXZpY2UlMjAlM0QlMjAlMjJjdWRhJTIyJTIwaWYlMjB0b3JjaC5jdWRhLmlzX2F2YWlsYWJsZSgpJTIwZWxzZSUyMCUyMmNwdSUyMiUwQSUwQW1vZGVsJTIwJTNEJTIwQmxpcDJGb3JJbWFnZVRleHRSZXRyaWV2YWwuZnJvbV9wcmV0cmFpbmVkKCUyMlNhbGVzZm9yY2UlMkZibGlwMi1pdG0tdml0LWclMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYpJTBBcHJvY2Vzc29yJTIwJTNEJTIwQXV0b1Byb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyU2FsZXNmb3JjZSUyRmJsaXAyLWl0bS12aXQtZyUyMiklMEElMEFtb2RlbC50byhkZXZpY2UpJTBBdXJsJTIwJTNEJTIwJTIyaHR0cCUzQSUyRiUyRmltYWdlcy5jb2NvZGF0YXNldC5vcmclMkZ2YWwyMDE3JTJGMDAwMDAwMDM5NzY5LmpwZyUyMiUwQWltYWdlJTIwJTNEJTIwSW1hZ2Uub3BlbihyZXF1ZXN0cy5nZXQodXJsJTJDJTIwc3RyZWFtJTNEVHJ1ZSkucmF3KSUwQXRleHQlMjAlM0QlMjAlMjJ0d28lMjBjYXRzJTIwbGF5aW5nJTIwb24lMjBhJTIwcGluayUyMGJsYW5rZXQlMjIlMEElMEFpbnB1dHMlMjAlM0QlMjBwcm9jZXNzb3IoaW1hZ2VzJTNEaW1hZ2UlMkMlMjB0ZXh0JTNEdGV4dCUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpLnRvKGRldmljZSUyQyUyMHRvcmNoLmZsb2F0MTYpJTBBaXRtX291dCUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzJTJDJTIwdXNlX2ltYWdlX3RleHRfbWF0Y2hpbmdfaGVhZCUzRFRydWUpJTBBbG9naXRzX3Blcl9pbWFnZSUyMCUzRCUyMHRvcmNoLm5uLmZ1bmN0aW9uYWwuc29mdG1heChpdG1fb3V0LmxvZ2l0c19wZXJfaW1hZ2UlMkMlMjBkaW0lM0QxKSUwQXByb2JzJTIwJTNEJTIwbG9naXRzX3Blcl9pbWFnZS5zb2Z0bWF4KGRpbSUzRDEpJTIwJTIwJTIzJTIwd2UlMjBjYW4lMjB0YWtlJTIwdGhlJTIwc29mdG1heCUyMHRvJTIwZ2V0JTIwdGhlJTIwbGFiZWwlMjBwcm9iYWJpbGl0aWVzJTBBJTBBcHJpbnQoZiUyMiU3QnByb2JzJTVCMCU1RCU1QjAlNUQlM0EuMSUyNSU3RCUyMHRoYXQlMjBpbWFnZSUyMDAlMjBpcyUyMG5vdCUyMCclN0J0ZXh0JTdEJyUyMiklMEElMEFwcmludChmJTIyJTdCcHJvYnMlNUIwJTVEJTVCMSU1RCUzQS4xJTI1JTdEJTIwdGhhdCUyMGltYWdlJTIwMCUyMGlzJTIwJyU3QnRleHQlN0QnJTIyKSUwQSUwQXRleHRzJTIwJTNEJTIwJTVCJTIyYSUyMHBob3RvJTIwb2YlMjBhJTIwY2F0JTIyJTJDJTIwJTIyYSUyMHBob3RvJTIwb2YlMjBhJTIwZG9nJTIyJTVEJTBBJTBBaW5wdXRzJTIwJTNEJTIwcHJvY2Vzc29yKGltYWdlcyUzRGltYWdlJTJDJTIwdGV4dCUzRHRleHRzJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMikudG8oZGV2aWNlJTJDJTIwdG9yY2guZmxvYXQxNiklMEFpdGNfb3V0JTIwJTNEJTIwbW9kZWwoKippbnB1dHMlMkMlMjB1c2VfaW1hZ2VfdGV4dF9tYXRjaGluZ19oZWFkJTNERmFsc2UpJTBBbG9naXRzX3Blcl9pbWFnZSUyMCUzRCUyMGl0Y19vdXQubG9naXRzX3Blcl9pbWFnZSUyMCUyMCUyMyUyMHRoaXMlMjBpcyUyMHRoZSUyMGltYWdlLXRleHQlMjBzaW1pbGFyaXR5JTIwc2NvcmUlMEFwcm9icyUyMCUzRCUyMGxvZ2l0c19wZXJfaW1hZ2Uuc29mdG1heChkaW0lM0QxKSUyMCUyMCUyMyUyMHdlJTIwY2FuJTIwdGFrZSUyMHRoZSUyMHNvZnRtYXglMjB0byUyMGdldCUyMHRoZSUyMGxhYmVsJTIwcHJvYmFiaWxpdGllcyUwQSUwQXByaW50KGYlMjIlN0Jwcm9icyU1QjAlNUQlNUIwJTVEJTNBLjElMjUlN0QlMjB0aGF0JTIwaW1hZ2UlMjAwJTIwaXMlMjAnJTdCdGV4dHMlNUIwJTVEJTdEJyUyMiklMEElMEFwcmludChmJTIyJTdCcHJvYnMlNUIwJTVEJTVCMSU1RCUzQS4xJTI1JTdEJTIwdGhhdCUyMGltYWdlJTIwMCUyMGlzJTIwJyU3QnRleHRzJTVCMSU1RCU3RCclMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<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, Blip2ForImageTextRetrieval

<span class="hljs-meta">&gt;&gt;&gt; </span>device = <span class="hljs-string">&quot;cuda&quot;</span> <span class="hljs-keyword">if</span> torch.cuda.is_available() <span class="hljs-keyword">else</span> <span class="hljs-string">&quot;cpu&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>model = Blip2ForImageTextRetrieval.from_pretrained(<span class="hljs-string">&quot;Salesforce/blip2-itm-vit-g&quot;</span>, torch_dtype=torch.float16)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;Salesforce/blip2-itm-vit-g&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>model.to(device)
<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;two cats laying on a pink blanket&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>).to(device, torch.float16)
<span class="hljs-meta">&gt;&gt;&gt; </span>itm_out = model(**inputs, use_image_text_matching_head=<span class="hljs-literal">True</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>logits_per_image = torch.nn.functional.softmax(itm_out.logits_per_image, dim=<span class="hljs-number">1</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>

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;<span class="hljs-subst">{probs[<span class="hljs-number">0</span>][<span class="hljs-number">0</span>]:<span class="hljs-number">.1</span>%}</span> that image 0 is not &#x27;<span class="hljs-subst">{text}</span>&#x27;&quot;</span>)
<span class="hljs-number">26.9</span>% that image <span class="hljs-number">0</span> <span class="hljs-keyword">is</span> <span class="hljs-keyword">not</span> <span class="hljs-string">&#x27;two cats laying on a pink blanket&#x27;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;<span class="hljs-subst">{probs[<span class="hljs-number">0</span>][<span class="hljs-number">1</span>]:<span class="hljs-number">.1</span>%}</span> that image 0 is &#x27;<span class="hljs-subst">{text}</span>&#x27;&quot;</span>)
<span class="hljs-number">73.0</span>% that image <span class="hljs-number">0</span> <span class="hljs-keyword">is</span> <span class="hljs-string">&#x27;two cats laying on a pink blanket&#x27;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>texts = [<span class="hljs-string">&quot;a photo of a cat&quot;</span>, <span class="hljs-string">&quot;a photo of a dog&quot;</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(images=image, text=texts, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).to(device, torch.float16)
<span class="hljs-meta">&gt;&gt;&gt; </span>itc_out = model(**inputs, use_image_text_matching_head=<span class="hljs-literal">False</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>logits_per_image = itc_out.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>

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;<span class="hljs-subst">{probs[<span class="hljs-number">0</span>][<span class="hljs-number">0</span>]:<span class="hljs-number">.1</span>%}</span> that image 0 is &#x27;<span class="hljs-subst">{texts[<span class="hljs-number">0</span>]}</span>&#x27;&quot;</span>)
<span class="hljs-number">55.3</span>% that image <span class="hljs-number">0</span> <span class="hljs-keyword">is</span> <span class="hljs-string">&#x27;a photo of a cat&#x27;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;<span class="hljs-subst">{probs[<span class="hljs-number">0</span>][<span class="hljs-number">1</span>]:<span class="hljs-number">.1</span>%}</span> that image 0 is &#x27;<span class="hljs-subst">{texts[<span class="hljs-number">1</span>]}</span>&#x27;&quot;</span>)
<span class="hljs-number">44.7</span>% that image <span class="hljs-number">0</span> <span class="hljs-keyword">is</span> <span class="hljs-string">&#x27;a photo of a dog&#x27;</span>`,wrap:!1}}),{c(){t=c("p"),t.textContent=g,o=r(),u(d.$$.fragment)},l(n){t=p(n,"P",{"data-svelte-h":!0}),y(t)!=="svelte-kvfsh7"&&(t.textContent=g),o=i(n),h(d.$$.fragment,n)},m(n,w){m(n,t,w),m(n,o,w),f(d,n,w),T=!0},p:x,i(n){T||(_(d.$$.fragment,n),T=!0)},o(n){b(d.$$.fragment,n),T=!1},d(n){n&&(l(t),l(o)),M(d,n)}}}function jr(v){let t,g=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){t=c("p"),t.innerHTML=g},l(o){t=p(o,"P",{"data-svelte-h":!0}),y(t)!=="svelte-fincs2"&&(t.innerHTML=g)},m(o,d){m(o,t,d)},p:x,d(o){o&&l(t)}}}function xr(v){let t,g="Examples:",o,d,T;return d=new G({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Byb2Nlc3NvciUyQyUyMEJsaXAyVGV4dE1vZGVsV2l0aFByb2plY3Rpb24lMEElMEFkZXZpY2UlMjAlM0QlMjAlMjJjdWRhJTIyJTIwaWYlMjB0b3JjaC5jdWRhLmlzX2F2YWlsYWJsZSgpJTIwZWxzZSUyMCUyMmNwdSUyMiUwQSUwQW1vZGVsJTIwJTNEJTIwQmxpcDJUZXh0TW9kZWxXaXRoUHJvamVjdGlvbi5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyU2FsZXNmb3JjZSUyRmJsaXAyLWl0bS12aXQtZyUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUwQSklMEElMEFtb2RlbC50byhkZXZpY2UpJTBBcHJvY2Vzc29yJTIwJTNEJTIwQXV0b1Byb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyU2FsZXNmb3JjZSUyRmJsaXAyLWl0bS12aXQtZyUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjBwcm9jZXNzb3IodGV4dCUzRCU1QiUyMmElMjBwaG90byUyMG9mJTIwYSUyMGNhdCUyMiUyQyUyMCUyMmElMjBwaG90byUyMG9mJTIwYSUyMGRvZyUyMiU1RCUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpLnRvKGRldmljZSklMEElMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpJTBBdGV4dF9lbWJlZHMlMjAlM0QlMjBvdXRwdXRzLnRleHRfZW1iZWRzJTBBcHJpbnQodGV4dF9lbWJlZHMuc2hhcGUp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, Blip2TextModelWithProjection

<span class="hljs-meta">&gt;&gt;&gt; </span>device = <span class="hljs-string">&quot;cuda&quot;</span> <span class="hljs-keyword">if</span> torch.cuda.is_available() <span class="hljs-keyword">else</span> <span class="hljs-string">&quot;cpu&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>model = Blip2TextModelWithProjection.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;Salesforce/blip2-itm-vit-g&quot;</span>, torch_dtype=torch.float16
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>model.to(device)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;Salesforce/blip2-itm-vit-g&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>], return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).to(device)

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>text_embeds = outputs.text_embeds
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(text_embeds.shape)
torch.Size([<span class="hljs-number">2</span>, <span class="hljs-number">7</span>, <span class="hljs-number">256</span>])`,wrap:!1}}),{c(){t=c("p"),t.textContent=g,o=r(),u(d.$$.fragment)},l(n){t=p(n,"P",{"data-svelte-h":!0}),y(t)!=="svelte-kvfsh7"&&(t.textContent=g),o=i(n),h(d.$$.fragment,n)},m(n,w){m(n,t,w),m(n,o,w),f(d,n,w),T=!0},p:x,i(n){T||(_(d.$$.fragment,n),T=!0)},o(n){b(d.$$.fragment,n),T=!1},d(n){n&&(l(t),l(o)),M(d,n)}}}function kr(v){let t,g=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){t=c("p"),t.innerHTML=g},l(o){t=p(o,"P",{"data-svelte-h":!0}),y(t)!=="svelte-fincs2"&&(t.innerHTML=g)},m(o,d){m(o,t,d)},p:x,d(o){o&&l(t)}}}function Cr(v){let t,g="Examples:",o,d,T;return d=new G({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEFpbXBvcnQlMjByZXF1ZXN0cyUwQWZyb20lMjB0cmFuc2Zvcm1lcnMlMjBpbXBvcnQlMjBBdXRvUHJvY2Vzc29yJTJDJTIwQmxpcDJWaXNpb25Nb2RlbFdpdGhQcm9qZWN0aW9uJTBBJTBBZGV2aWNlJTIwJTNEJTIwJTIyY3VkYSUyMiUyMGlmJTIwdG9yY2guY3VkYS5pc19hdmFpbGFibGUoKSUyMGVsc2UlMjAlMjJjcHUlMjIlMEElMEFwcm9jZXNzb3IlMjAlM0QlMjBBdXRvUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJTYWxlc2ZvcmNlJTJGYmxpcDItaXRtLXZpdC1nJTIyKSUwQW1vZGVsJTIwJTNEJTIwQmxpcDJWaXNpb25Nb2RlbFdpdGhQcm9qZWN0aW9uLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJTYWxlc2ZvcmNlJTJGYmxpcDItaXRtLXZpdC1nJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTBBKSUwQW1vZGVsLnRvKGRldmljZSklMEF1cmwlMjAlM0QlMjAlMjJodHRwJTNBJTJGJTJGaW1hZ2VzLmNvY29kYXRhc2V0Lm9yZyUyRnZhbDIwMTclMkYwMDAwMDAwMzk3NjkuanBnJTIyJTBBaW1hZ2UlMjAlM0QlMjBJbWFnZS5vcGVuKHJlcXVlc3RzLmdldCh1cmwlMkMlMjBzdHJlYW0lM0RUcnVlKS5yYXcpJTBBJTBBaW5wdXRzJTIwJTNEJTIwcHJvY2Vzc29yKGltYWdlcyUzRGltYWdlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMikudG8oZGV2aWNlJTJDJTIwdG9yY2guZmxvYXQxNiklMEElMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpJTBBaW1hZ2VfZW1iZWRzJTIwJTNEJTIwb3V0cHV0cy5pbWFnZV9lbWJlZHMlMEFwcmludChpbWFnZV9lbWJlZHMuc2hhcGUp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<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, Blip2VisionModelWithProjection

<span class="hljs-meta">&gt;&gt;&gt; </span>device = <span class="hljs-string">&quot;cuda&quot;</span> <span class="hljs-keyword">if</span> torch.cuda.is_available() <span class="hljs-keyword">else</span> <span class="hljs-string">&quot;cpu&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;Salesforce/blip2-itm-vit-g&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Blip2VisionModelWithProjection.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;Salesforce/blip2-itm-vit-g&quot;</span>, torch_dtype=torch.float16
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model.to(device)
<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>).to(device, torch.float16)

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>image_embeds = outputs.image_embeds
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(image_embeds.shape)
torch.Size([<span class="hljs-number">1</span>, <span class="hljs-number">32</span>, <span class="hljs-number">256</span>])`,wrap:!1}}),{c(){t=c("p"),t.textContent=g,o=r(),u(d.$$.fragment)},l(n){t=p(n,"P",{"data-svelte-h":!0}),y(t)!=="svelte-kvfsh7"&&(t.textContent=g),o=i(n),h(d.$$.fragment,n)},m(n,w){m(n,t,w),m(n,o,w),f(d,n,w),T=!0},p:x,i(n){T||(_(d.$$.fragment,n),T=!0)},o(n){b(d.$$.fragment,n),T=!1},d(n){n&&(l(t),l(o)),M(d,n)}}}function Ir(v){let t,g,o,d,T,n,w,Ks='<img alt="PyTorch" src="https://img.shields.io/badge/PyTorch-DE3412?style=flat&amp;logo=pytorch&amp;logoColor=white"/>',Nn,Se,Gn,Ye,ea=`The BLIP-2 model was proposed in <a href="https://arxiv.org/abs/2301.12597" rel="nofollow">BLIP-2: Bootstrapping Language-Image Pre-training with Frozen Image Encoders and Large Language Models</a> by
Junnan Li, Dongxu Li, Silvio Savarese, Steven Hoi. BLIP-2 leverages frozen pre-trained image encoders and large language models (LLMs) by training a lightweight, 12-layer Transformer
encoder in between them, achieving state-of-the-art performance on various vision-language tasks. Most notably, BLIP-2 improves upon <a href="https://arxiv.org/abs/2204.14198" rel="nofollow">Flamingo</a>, an 80 billion parameter model, by 8.7%
on zero-shot VQAv2 with 54x fewer trainable parameters.`,qn,Ae,ta="The abstract from the paper is the following:",Xn,De,na="<em>The cost of vision-and-language pre-training has become increasingly prohibitive due to end-to-end training of large-scale models. This paper proposes BLIP-2, a generic and efficient pre-training strategy that bootstraps vision-language pre-training from off-the-shelf frozen pre-trained image encoders and frozen large language models. BLIP-2 bridges the modality gap with a lightweight Querying Transformer, which is pre-trained in two stages. The first stage bootstraps vision-language representation learning from a frozen image encoder. The second stage bootstraps vision-to-language generative learning from a frozen language model. BLIP-2 achieves state-of-the-art performance on various vision-language tasks, despite having significantly fewer trainable parameters than existing methods. For example, our model outperforms Flamingo80B by 8.7% on zero-shot VQAv2 with 54x fewer trainable parameters. We also demonstrate the model’s emerging capabilities of zero-shot image-to-text generation that can follow natural language instructions.</em>",Qn,be,oa,Ln,Oe,sa='BLIP-2 architecture. Taken from the <a href="https://arxiv.org/abs/2301.12597">original paper.</a>',En,Ke,aa=`This model was contributed by <a href="https://huggingface.co/nielsr" rel="nofollow">nielsr</a>.
The original code can be found <a href="https://github.com/salesforce/LAVIS/tree/5ee63d688ba4cebff63acee04adaef2dee9af207" rel="nofollow">here</a>.`,Hn,et,Sn,tt,ra='<li>BLIP-2 can be used for conditional text generation given an image and an optional text prompt. At inference time, it’s recommended to use the <code>generate</code> method.</li> <li>One can use <a href="/docs/transformers/main/en/model_doc/blip-2#transformers.Blip2Processor">Blip2Processor</a> to prepare images for the model, and decode the predicted tokens ID’s back to text.</li>',Yn,nt,ia=`<p>[!NOTE]
BLIP models after release v4.46 will raise warnings about adding <code>processor.num_query_tokens = {{num_query_tokens}}</code> and expand model embeddings layer to add special <code>&lt;image&gt;</code> token. It is strongly recommended to add the attributes to the processor if you own the model checkpoint, or open a PR if it is not owned by you. Adding these attributes means that BLIP will add the number of query tokens required per image and expand the text with as many <code>&lt;image&gt;</code> placeholders as there will be query tokens. Usually it is around 500 tokens per image, so make sure that the text is not truncated as otherwise there wil be failure when merging the embeddings.
The attributes can be obtained from model config, as <code>model.config.num_query_tokens</code> and model embeddings expansion can be done by following <a href="https://gist.github.com/zucchini-nlp/e9f20b054fa322f84ac9311d9ab67042" rel="nofollow">this link</a>.</p>`,An,ot,Dn,st,la="A list of official Hugging Face and community (indicated by 🌎) resources to help you get started with BLIP-2.",On,at,da='<li>Demo notebooks for BLIP-2 for image captioning, visual question answering (VQA) and chat-like conversations can be found <a href="https://github.com/NielsRogge/Transformers-Tutorials/tree/master/BLIP-2" rel="nofollow">here</a>.</li>',Kn,rt,ca="If you’re interested in submitting a resource to be included here, please feel free to open a Pull Request and we’ll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource.",eo,it,to,Z,lt,Jo,Yt,pa=`<a href="/docs/transformers/main/en/model_doc/blip-2#transformers.Blip2Config">Blip2Config</a> is the configuration class to store the configuration of a <a href="/docs/transformers/main/en/model_doc/blip-2#transformers.Blip2ForConditionalGeneration">Blip2ForConditionalGeneration</a>. It is
used to instantiate a BLIP-2 model according to the specified arguments, defining the vision model, Q-Former model
and language model configs. Instantiating a configuration with the defaults will yield a similar configuration to
that of the BLIP-2 <a href="https://huggingface.co/Salesforce/blip2-opt-2.7b" rel="nofollow">Salesforce/blip2-opt-2.7b</a> architecture.`,jo,At,ma=`Configuration objects inherit from <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> and can be used to control the model outputs. Read the
documentation from <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,xo,Me,ko,ye,dt,Co,Dt,ga=`Instantiate a <a href="/docs/transformers/main/en/model_doc/blip-2#transformers.Blip2Config">Blip2Config</a> (or a derived class) from a BLIP-2 vision model, Q-Former and language model
configurations.`,no,ct,oo,q,pt,Io,Ot,ua=`This is the configuration class to store the configuration of a <a href="/docs/transformers/main/en/model_doc/blip-2#transformers.Blip2VisionModel">Blip2VisionModel</a>. It is used to instantiate a
BLIP-2 vision encoder according to the specified arguments, defining the model architecture. Instantiating a
configuration defaults will yield a similar configuration to that of the BLIP-2
<a href="https://huggingface.co/Salesforce/blip2-opt-2.7b" rel="nofollow">Salesforce/blip2-opt-2.7b</a> architecture.`,Uo,Kt,ha=`Configuration objects inherit from <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> and can be used to control the model outputs. Read the
documentation from <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,Wo,Te,so,mt,ao,X,gt,Zo,en,fa=`This is the configuration class to store the configuration of a <a href="/docs/transformers/main/en/model_doc/blip-2#transformers.Blip2QFormerModel">Blip2QFormerModel</a>. It is used to instantiate a
BLIP-2 Querying Transformer (Q-Former) 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 BLIP-2
<a href="https://huggingface.co/Salesforce/blip2-opt-2.7b" rel="nofollow">Salesforce/blip2-opt-2.7b</a> architecture. Configuration objects
inherit from <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> and can be used to control the model outputs. Read the documentation from
<a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,zo,tn,_a='Note that <a href="/docs/transformers/main/en/model_doc/blip-2#transformers.Blip2QFormerModel">Blip2QFormerModel</a> is very similar to <a href="/docs/transformers/main/en/model_doc/bert#transformers.BertLMHeadModel">BertLMHeadModel</a> with interleaved cross-attention.',Fo,we,ro,ut,io,z,ht,Po,nn,ba="Constructs a BLIP-2 processor which wraps a BLIP image processor and an OPT/T5 tokenizer into a single processor.",Vo,on,Ma=`<a href="/docs/transformers/main/en/model_doc/blip#transformers.BlipProcessor">BlipProcessor</a> offers all the functionalities of <a href="/docs/transformers/main/en/model_doc/blip#transformers.BlipImageProcessor">BlipImageProcessor</a> and <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See the docstring
of <code>__call__()</code> and <a href="/docs/transformers/main/en/model_doc/blip#transformers.BlipProcessor.decode">decode()</a> for more information.`,Ro,ve,ft,No,sn,ya=`This method forwards all its arguments to PreTrainedTokenizer’s <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.batch_decode">batch_decode()</a>. Please
refer to the docstring of this method for more information.`,Go,$e,_t,qo,an,Ta=`This method forwards all its arguments to PreTrainedTokenizer’s <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.decode">decode()</a>. Please refer to
the docstring of this method for more information.`,lo,bt,co,ue,Mt,Xo,pe,yt,Qo,rn,wa='The <a href="/docs/transformers/main/en/model_doc/blip-2#transformers.Blip2VisionModel">Blip2VisionModel</a> forward method, overrides the <code>__call__</code> special method.',Lo,Be,po,Tt,mo,ne,wt,Eo,ln,va="Querying Transformer (Q-Former), used in BLIP-2.",Ho,me,vt,So,dn,$a=`encoder_hidden_states  (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <code>optional</code>):
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 (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <code>optional</code>):
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>:`,Yo,cn,Ba=`<li>1 for tokens that are <strong>not masked</strong>,</li> <li>0 for tokens that are <strong>masked</strong>.
past_key_values (<code>tuple(tuple(torch.FloatTensor))</code> of length <code>config.n_layers</code> with each tuple having 4 tensors of:
shape <code>(batch_size, num_heads, sequence_length - 1, embed_size_per_head)</code>): 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’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>.
use_cache (<code>bool</code>, <code>optional</code>):
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>).</li>`,go,$t,uo,C,Bt,Ao,pn,Ja=`BLIP-2 Model for generating text and image features. The model consists of a vision encoder, Querying Transformer
(Q-Former) and a language model.`,Do,mn,ja=`This model inherits from <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. 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.)`,Oo,gn,xa=`This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`,Ko,Y,Jt,es,un,ka='The <a href="/docs/transformers/main/en/model_doc/blip-2#transformers.Blip2Model">Blip2Model</a> forward method, overrides the <code>__call__</code> special method.',ts,Je,ns,je,os,A,jt,ss,hn,Ca='The <a href="/docs/transformers/main/en/model_doc/blip-2#transformers.Blip2Model">Blip2Model</a> forward method, overrides the <code>__call__</code> special method.',as,xe,rs,ke,is,D,xt,ls,fn,Ia='The <a href="/docs/transformers/main/en/model_doc/blip-2#transformers.Blip2Model">Blip2Model</a> forward method, overrides the <code>__call__</code> special method.',ds,Ce,cs,Ie,ps,O,kt,ms,_n,Ua='The <a href="/docs/transformers/main/en/model_doc/blip-2#transformers.Blip2Model">Blip2Model</a> forward method, overrides the <code>__call__</code> special method.',gs,Ue,us,We,ho,Ct,fo,I,It,hs,bn,Wa=`BLIP-2 Model for generating text given an image and an optional text prompt. The model consists of a vision
encoder, Querying Transformer (Q-Former) and a language model.`,fs,Mn,Za=`One can optionally pass <code>input_ids</code> to the model, which serve as a text prompt, to make the language model continue
the prompt. Otherwise, the language model starts generating text from the [BOS] (beginning-of-sequence) token.`,_s,Ze,bs,yn,za=`This model inherits from <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. 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.)`,Ms,Tn,Fa=`This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`,ys,j,Ut,Ts,wn,Pa='The <a href="/docs/transformers/main/en/model_doc/blip-2#transformers.Blip2ForConditionalGeneration">Blip2ForConditionalGeneration</a> forward method, overrides the <code>__call__</code> special method.',ws,ze,vs,vn,Va="Examples:",$s,$n,Ra="Prepare processor, model and image input",Bs,Fe,Js,Pe,js,Ve,xs,Bn,Na=`Note that int8 inference is also supported through <a href="https://github.com/TimDettmers/bitsandbytes" rel="nofollow">bitsandbytes</a>.
This greatly reduces the amount of memory used by the model while maintaining the same performance.`,ks,Re,Cs,Ne,Wt,Is,Jn,Ga="Overrides <code>generate</code> function to be able to use the model as a conditional generator.",_o,Zt,bo,F,zt,Us,jn,qa=`BLIP-2 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.`,Ws,xn,Xa=`This model inherits from <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. 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.)`,Zs,kn,Qa=`This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`,zs,K,Ft,Fs,Cn,La='The <a href="/docs/transformers/main/en/model_doc/blip-2#transformers.Blip2ForImageTextRetrieval">Blip2ForImageTextRetrieval</a> forward method, overrides the <code>__call__</code> special method.',Ps,Ge,Vs,qe,Mo,Pt,yo,P,Vt,Rs,In,Ea="BLIP-2 Text Model with a projection layer on top (a linear layer on top of the pooled output).",Ns,Un,Ha=`This model inherits from <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. 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.)`,Gs,Wn,Sa=`This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`,qs,ee,Rt,Xs,Zn,Ya='The <a href="/docs/transformers/main/en/model_doc/blip-2#transformers.Blip2TextModelWithProjection">Blip2TextModelWithProjection</a> forward method, overrides the <code>__call__</code> special method.',Qs,Xe,Ls,Qe,To,Nt,wo,V,Gt,Es,zn,Aa="BLIP-2 Vision Model with a projection layer on top (a linear layer on top of the pooled output).",Hs,Fn,Da=`This model inherits from <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. 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.)`,Ss,Pn,Oa=`This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`,Ys,te,qt,As,Vn,Ka='The <a href="/docs/transformers/main/en/model_doc/blip-2#transformers.Blip2VisionModelWithProjection">Blip2VisionModelWithProjection</a> forward method, overrides the <code>__call__</code> special method.',Ds,Le,Os,Ee,vo,Xt,$o,Rn,Bo;return T=new R({props:{title:"BLIP-2",local:"blip-2",headingTag:"h1"}}),Se=new R({props:{title:"Overview",local:"overview",headingTag:"h2"}}),et=new R({props:{title:"Usage tips",local:"usage-tips",headingTag:"h2"}}),ot=new R({props:{title:"Resources",local:"resources",headingTag:"h2"}}),it=new R({props:{title:"Blip2Config",local:"transformers.Blip2Config",headingTag:"h2"}}),lt=new J({props:{name:"class transformers.Blip2Config",anchor:"transformers.Blip2Config",parameters:[{name:"vision_config",val:" = None"},{name:"qformer_config",val:" = None"},{name:"text_config",val:" = None"},{name:"num_query_tokens",val:" = 32"},{name:"image_text_hidden_size",val:" = 256"},{name:"image_token_index",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Blip2Config.vision_config",description:`<strong>vision_config</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
Dictionary of configuration options used to initialize <a href="/docs/transformers/main/en/model_doc/blip-2#transformers.Blip2VisionConfig">Blip2VisionConfig</a>.`,name:"vision_config"},{anchor:"transformers.Blip2Config.qformer_config",description:`<strong>qformer_config</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
Dictionary of configuration options used to initialize <a href="/docs/transformers/main/en/model_doc/blip-2#transformers.Blip2QFormerConfig">Blip2QFormerConfig</a>.`,name:"qformer_config"},{anchor:"transformers.Blip2Config.text_config",description:`<strong>text_config</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
Dictionary of configuration options used to initialize any <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a>.`,name:"text_config"},{anchor:"transformers.Blip2Config.num_query_tokens",description:`<strong>num_query_tokens</strong> (<code>int</code>, <em>optional</em>, defaults to 32) &#x2014;
The number of query tokens passed through the Transformer.`,name:"num_query_tokens"},{anchor:"transformers.Blip2Config.image_text_hidden_size",description:`<strong>image_text_hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 256) &#x2014;
Dimentionality of the hidden state of the image-text fusion layer.`,name:"image_text_hidden_size"},{anchor:"transformers.Blip2Config.image_token_index",description:`<strong>image_token_index</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Token index of special image token.`,name:"image_token_index"},{anchor:"transformers.Blip2Config.kwargs",description:`<strong>kwargs</strong> (<em>optional</em>) &#x2014;
Dictionary of keyword arguments.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/blip_2/configuration_blip_2.py#L216"}}),Me=new N({props:{anchor:"transformers.Blip2Config.example",$$slots:{default:[ir]},$$scope:{ctx:v}}}),dt=new J({props:{name:"from_vision_qformer_text_configs",anchor:"transformers.Blip2Config.from_vision_qformer_text_configs",parameters:[{name:"vision_config",val:": Blip2VisionConfig"},{name:"qformer_config",val:": Blip2QFormerConfig"},{name:"text_config",val:": typing.Optional[transformers.configuration_utils.PretrainedConfig] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Blip2Config.from_vision_qformer_text_configs.vision_config",description:`<strong>vision_config</strong> (<code>dict</code>) &#x2014;
Dictionary of configuration options used to initialize <a href="/docs/transformers/main/en/model_doc/blip-2#transformers.Blip2VisionConfig">Blip2VisionConfig</a>.`,name:"vision_config"},{anchor:"transformers.Blip2Config.from_vision_qformer_text_configs.qformer_config",description:`<strong>qformer_config</strong> (<code>dict</code>) &#x2014;
Dictionary of configuration options used to initialize <a href="/docs/transformers/main/en/model_doc/blip-2#transformers.Blip2QFormerConfig">Blip2QFormerConfig</a>.`,name:"qformer_config"},{anchor:"transformers.Blip2Config.from_vision_qformer_text_configs.text_config",description:`<strong>text_config</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
Dictionary of configuration options used to initialize any <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a>.`,name:"text_config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/blip_2/configuration_blip_2.py#L313",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>An instance of a configuration object</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/transformers/main/en/model_doc/blip-2#transformers.Blip2Config"
>Blip2Config</a></p>
`}}),ct=new R({props:{title:"Blip2VisionConfig",local:"transformers.Blip2VisionConfig",headingTag:"h2"}}),pt=new J({props:{name:"class transformers.Blip2VisionConfig",anchor:"transformers.Blip2VisionConfig",parameters:[{name:"hidden_size",val:" = 1408"},{name:"intermediate_size",val:" = 6144"},{name:"num_hidden_layers",val:" = 39"},{name:"num_attention_heads",val:" = 16"},{name:"image_size",val:" = 224"},{name:"patch_size",val:" = 14"},{name:"hidden_act",val:" = 'gelu'"},{name:"layer_norm_eps",val:" = 1e-06"},{name:"attention_dropout",val:" = 0.0"},{name:"initializer_range",val:" = 1e-10"},{name:"qkv_bias",val:" = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Blip2VisionConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 1408) &#x2014;
Dimensionality of the encoder layers and the pooler layer.`,name:"hidden_size"},{anchor:"transformers.Blip2VisionConfig.intermediate_size",description:`<strong>intermediate_size</strong> (<code>int</code>, <em>optional</em>, defaults to 6144) &#x2014;
Dimensionality of the &#x201C;intermediate&#x201D; (i.e., feed-forward) layer in the Transformer encoder.`,name:"intermediate_size"},{anchor:"transformers.Blip2VisionConfig.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 39) &#x2014;
Number of hidden layers in the Transformer encoder.`,name:"num_hidden_layers"},{anchor:"transformers.Blip2VisionConfig.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 16) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"num_attention_heads"},{anchor:"transformers.Blip2VisionConfig.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.Blip2VisionConfig.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, <em>optional</em>, defaults to 14) &#x2014;
The size (resolution) of each patch.`,name:"patch_size"},{anchor:"transformers.Blip2VisionConfig.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. layer_norm_eps (<code>float</code>, <em>optional</em>, defaults
to 1e-5): The epsilon used by the layer normalization layers.`,name:"hidden_act"},{anchor:"transformers.Blip2VisionConfig.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.Blip2VisionConfig.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.Blip2VisionConfig.qkv_bias",description:`<strong>qkv_bias</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to add a bias to the queries and values in the self-attention layers.`,name:"qkv_bias"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/blip_2/configuration_blip_2.py#L28"}}),Te=new N({props:{anchor:"transformers.Blip2VisionConfig.example",$$slots:{default:[lr]},$$scope:{ctx:v}}}),mt=new R({props:{title:"Blip2QFormerConfig",local:"transformers.Blip2QFormerConfig",headingTag:"h2"}}),gt=new J({props:{name:"class transformers.Blip2QFormerConfig",anchor:"transformers.Blip2QFormerConfig",parameters:[{name:"vocab_size",val:" = 30522"},{name:"hidden_size",val:" = 768"},{name:"num_hidden_layers",val:" = 12"},{name:"num_attention_heads",val:" = 12"},{name:"intermediate_size",val:" = 3072"},{name:"hidden_act",val:" = 'gelu'"},{name:"hidden_dropout_prob",val:" = 0.1"},{name:"attention_probs_dropout_prob",val:" = 0.1"},{name:"max_position_embeddings",val:" = 512"},{name:"initializer_range",val:" = 0.02"},{name:"layer_norm_eps",val:" = 1e-12"},{name:"pad_token_id",val:" = 0"},{name:"position_embedding_type",val:" = 'absolute'"},{name:"cross_attention_frequency",val:" = 2"},{name:"encoder_hidden_size",val:" = 1408"},{name:"use_qformer_text_input",val:" = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Blip2QFormerConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 30522) &#x2014;
Vocabulary size of the Q-Former model. Defines the number of different tokens that can be represented by
the <code>inputs_ids</code> passed when calling the model.`,name:"vocab_size"},{anchor:"transformers.Blip2QFormerConfig.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.Blip2QFormerConfig.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.Blip2QFormerConfig.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.Blip2QFormerConfig.intermediate_size",description:`<strong>intermediate_size</strong> (<code>int</code>, <em>optional</em>, defaults to 3072) &#x2014;
Dimensionality of the &#x201C;intermediate&#x201D; (often named feed-forward) layer in the Transformer encoder.`,name:"intermediate_size"},{anchor:"transformers.Blip2QFormerConfig.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code> or <code>Callable</code>, <em>optional</em>, defaults to <code>&quot;gelu&quot;</code>) &#x2014;
The non-linear activation function (function or string) in the encoder and pooler. If string, <code>&quot;gelu&quot;</code>,
<code>&quot;relu&quot;</code>, <code>&quot;silu&quot;</code> and <code>&quot;gelu_new&quot;</code> are supported.`,name:"hidden_act"},{anchor:"transformers.Blip2QFormerConfig.hidden_dropout_prob",description:`<strong>hidden_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.`,name:"hidden_dropout_prob"},{anchor:"transformers.Blip2QFormerConfig.attention_probs_dropout_prob",description:`<strong>attention_probs_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout ratio for the attention probabilities.`,name:"attention_probs_dropout_prob"},{anchor:"transformers.Blip2QFormerConfig.max_position_embeddings",description:`<strong>max_position_embeddings</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#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.Blip2QFormerConfig.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.Blip2QFormerConfig.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.Blip2QFormerConfig.position_embedding_type",description:`<strong>position_embedding_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;absolute&quot;</code>) &#x2014;
Type of position embedding. Choose one of <code>&quot;absolute&quot;</code>, <code>&quot;relative_key&quot;</code>, <code>&quot;relative_key_query&quot;</code>. For
positional embeddings use <code>&quot;absolute&quot;</code>. For more information on <code>&quot;relative_key&quot;</code>, please refer to
<a href="https://arxiv.org/abs/1803.02155" rel="nofollow">Self-Attention with Relative Position Representations (Shaw et al.)</a>.
For more information on <code>&quot;relative_key_query&quot;</code>, please refer to <em>Method 4</em> in <a href="https://arxiv.org/abs/2009.13658" rel="nofollow">Improve Transformer Models
with Better Relative Position Embeddings (Huang et al.)</a>.`,name:"position_embedding_type"},{anchor:"transformers.Blip2QFormerConfig.cross_attention_frequency",description:`<strong>cross_attention_frequency</strong> (<code>int</code>, <em>optional</em>, defaults to 2) &#x2014;
The frequency of adding cross-attention to the Transformer layers.`,name:"cross_attention_frequency"},{anchor:"transformers.Blip2QFormerConfig.encoder_hidden_size",description:`<strong>encoder_hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 1408) &#x2014;
The hidden size of the hidden states for cross-attention.`,name:"encoder_hidden_size"},{anchor:"transformers.Blip2QFormerConfig.use_qformer_text_input",description:`<strong>use_qformer_text_input</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use BERT-style embeddings.`,name:"use_qformer_text_input"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/blip_2/configuration_blip_2.py#L110"}}),we=new N({props:{anchor:"transformers.Blip2QFormerConfig.example",$$slots:{default:[dr]},$$scope:{ctx:v}}}),ut=new R({props:{title:"Blip2Processor",local:"transformers.Blip2Processor",headingTag:"h2"}}),ht=new J({props:{name:"class transformers.Blip2Processor",anchor:"transformers.Blip2Processor",parameters:[{name:"image_processor",val:""},{name:"tokenizer",val:""},{name:"num_query_tokens",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Blip2Processor.image_processor",description:`<strong>image_processor</strong> (<code>BlipImageProcessor</code>) &#x2014;
An instance of <a href="/docs/transformers/main/en/model_doc/blip#transformers.BlipImageProcessor">BlipImageProcessor</a>. The image processor is a required input.`,name:"image_processor"},{anchor:"transformers.Blip2Processor.tokenizer",description:"<strong>tokenizer</strong> (<code>AutoTokenizer</code>) &#x2014;\nAn instance of [&#x2018;PreTrainedTokenizer`]. The tokenizer is a required input.",name:"tokenizer"},{anchor:"transformers.Blip2Processor.num_query_tokens",description:`<strong>num_query_tokens</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Number of tokens used by the Qformer as queries, should be same as in model&#x2019;s config.`,name:"num_query_tokens"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/blip_2/processing_blip_2.py#L53"}}),ft=new J({props:{name:"batch_decode",anchor:"transformers.Blip2Processor.batch_decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/blip_2/processing_blip_2.py#L170"}}),_t=new J({props:{name:"decode",anchor:"transformers.Blip2Processor.decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/blip_2/processing_blip_2.py#L178"}}),bt=new R({props:{title:"Blip2VisionModel",local:"transformers.Blip2VisionModel",headingTag:"h2"}}),Mt=new J({props:{name:"class transformers.Blip2VisionModel",anchor:"transformers.Blip2VisionModel",parameters:[{name:"config",val:": Blip2VisionConfig"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/blip_2/modeling_blip_2.py#L712"}}),yt=new J({props:{name:"forward",anchor:"transformers.Blip2VisionModel.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"},{name:"interpolate_pos_encoding",val:": bool = False"}],parametersDescription:[{anchor:"transformers.Blip2VisionModel.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/main/en/model_doc/blip-2#transformers.Blip2Processor">Blip2Processor</a>. See <code>Blip2Processor.__call__()</code> for
details.`,name:"pixel_values"},{anchor:"transformers.Blip2VisionModel.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.Blip2VisionModel.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.Blip2VisionModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.Blip2VisionModel.forward.interpolate_pos_encoding",description:`<strong>interpolate_pos_encoding</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to interpolate the pre-trained position encodings.`,name:"interpolate_pos_encoding"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/blip_2/modeling_blip_2.py#L727",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/main/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_2.configuration_blip_2.Blip2VisionConfig'&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>) — 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>) — 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>) — 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>) — 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:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Be=new ge({props:{$$slots:{default:[cr]},$$scope:{ctx:v}}}),Tt=new R({props:{title:"Blip2QFormerModel",local:"transformers.Blip2QFormerModel",headingTag:"h2"}}),wt=new J({props:{name:"class transformers.Blip2QFormerModel",anchor:"transformers.Blip2QFormerModel",parameters:[{name:"config",val:": Blip2QFormerConfig"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/blip_2/modeling_blip_2.py#L1251"}}),vt=new J({props:{name:"forward",anchor:"transformers.Blip2QFormerModel.forward",parameters:[{name:"query_embeds",val:": FloatTensor"},{name:"query_length",val:": typing.Optional[int] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"encoder_hidden_states",val:": typing.Optional[torch.FloatTensor] = None"},{name:"encoder_attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"past_key_values",val:": typing.Optional[typing.Tuple[typing.Tuple[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"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/blip_2/modeling_blip_2.py#L1326"}}),$t=new R({props:{title:"Blip2Model",local:"transformers.Blip2Model",headingTag:"h2"}}),Bt=new J({props:{name:"class transformers.Blip2Model",anchor:"transformers.Blip2Model",parameters:[{name:"config",val:": Blip2Config"}],parametersDescription:[{anchor:"transformers.Blip2Model.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/blip-2#transformers.Blip2Config">Blip2Config</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/blip_2/modeling_blip_2.py#L1447"}}),Jt=new J({props:{name:"forward",anchor:"transformers.Blip2Model.forward",parameters:[{name:"pixel_values",val:": FloatTensor"},{name:"input_ids",val:": FloatTensor"},{name:"attention_mask",val:": typing.Optional[torch.LongTensor] = None"},{name:"decoder_input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"decoder_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"},{name:"interpolate_pos_encoding",val:": bool = False"}],parametersDescription:[{anchor:"transformers.Blip2Model.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/main/en/model_doc/blip-2#transformers.Blip2Processor">Blip2Processor</a>. See <code>Blip2Processor.__call__()</code> for
details.`,name:"pixel_values"},{anchor:"transformers.Blip2Model.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of input sequence tokens in the vocabulary of the language model. Input tokens can optionally be
provided to serve as text prompt, which the language model can continue.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/blip-2#transformers.Blip2Processor">Blip2Processor</a>. See <code>Blip2Processor.__call__()</code> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.Blip2Model.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.Blip2Model.forward.decoder_input_ids",description:`<strong>decoder_input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, target_sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of decoder input sequence tokens in the vocabulary of the language model. Only relevant in case an
encoder-decoder language model (like T5) is used.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details. <a href="../glossary#decoder-input-ids">What are decoder input IDs?</a>`,name:"decoder_input_ids"},{anchor:"transformers.Blip2Model.forward.decoder_attention_mask",description:`<strong>decoder_attention_mask</strong> (<code>torch.BoolTensor</code> of shape <code>(batch_size, target_sequence_length)</code>, <em>optional</em>) &#x2014;
Default behavior: generate a tensor that ignores pad tokens in <code>decoder_input_ids</code>. Causal mask will also
be used by default.</p>
<p>Only relevant in case an encoder-decoder language model (like T5) is used.`,name:"decoder_attention_mask"},{anchor:"transformers.Blip2Model.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.Blip2Model.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.Blip2Model.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.Blip2Model.forward.interpolate_pos_encoding",description:`<strong>interpolate_pos_encoding</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to interpolate the pre-trained position encodings.`,name:"interpolate_pos_encoding"},{anchor:"transformers.Blip2Model.forward.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/main/src/transformers/models/blip_2/modeling_blip_2.py#L1671",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <code>transformers.models.blip_2.modeling_blip_2.Blip2ForConditionalGenerationModelOutput</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_2.configuration_blip_2.Blip2VisionConfig'&gt;</code>) and inputs.</p>
<ul>
<li><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>) — Language modeling loss from the language model.</li>
<li><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.vocab_size)</code>) — Prediction scores of the language modeling head of the language model.</li>
<li><strong>vision_outputs</strong> (<code>BaseModelOutputWithPooling</code>) — Outputs of the vision encoder.</li>
<li><strong>qformer_outputs</strong> (<code>BaseModelOutputWithPoolingAndCrossAttentions</code>) — Outputs of the Q-Former (Querying Transformer).</li>
<li><strong>language_model_outputs</strong> (<code>CausalLMOutputWithPast</code> or <code>Seq2SeqLMOutput</code>) — Outputs of the language model.</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>transformers.models.blip_2.modeling_blip_2.Blip2ForConditionalGenerationModelOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Je=new ge({props:{$$slots:{default:[pr]},$$scope:{ctx:v}}}),je=new N({props:{anchor:"transformers.Blip2Model.forward.example",$$slots:{default:[mr]},$$scope:{ctx:v}}}),jt=new J({props:{name:"get_text_features",anchor:"transformers.Blip2Model.get_text_features",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"decoder_input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"decoder_attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"labels",val:": typing.Optional[torch.Tensor] = 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.Blip2Model.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. Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details. <a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.Blip2Model.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>.
<a href="../glossary#attention-mask">What are attention masks?</a></li>
</ul>`,name:"attention_mask"},{anchor:"transformers.Blip2Model.get_text_features.decoder_input_ids",description:`<strong>decoder_input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, target_sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of decoder input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#decoder-input-ids">What are decoder input IDs?</a></p>
<p>T5 uses the <code>pad_token_id</code> as the starting token for <code>decoder_input_ids</code> generation. If <code>past_key_values</code>
is used, optionally only the last <code>decoder_input_ids</code> have to be input (see <code>past_key_values</code>).</p>
<p>To know more on how to prepare <code>decoder_input_ids</code> for pretraining take a look at <a href="./t5#training">T5
Training</a>.`,name:"decoder_input_ids"},{anchor:"transformers.Blip2Model.get_text_features.decoder_attention_mask",description:`<strong>decoder_attention_mask</strong> (<code>torch.BoolTensor</code> of shape <code>(batch_size, target_sequence_length)</code>, <em>optional</em>) &#x2014;
Default behavior: generate a tensor that ignores pad tokens in <code>decoder_input_ids</code>. Causal mask will also
be used by default.`,name:"decoder_attention_mask"},{anchor:"transformers.Blip2Model.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.Blip2Model.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.Blip2Model.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/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/blip_2/modeling_blip_2.py#L1505",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>The language model outputs. If <code>return_dict=True</code>, the output is a <code>CausalLMOutputWithPast</code> that
contains the language model logits, the past key values and the hidden states if
<code>output_hidden_states=True</code>.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p>text_outputs (<code>CausalLMOutputWithPast</code>, or <code>tuple(torch.FloatTensor)</code> if <code>return_dict=False</code>)</p>
`}}),xe=new ge({props:{$$slots:{default:[gr]},$$scope:{ctx:v}}}),ke=new N({props:{anchor:"transformers.Blip2Model.get_text_features.example",$$slots:{default:[ur]},$$scope:{ctx:v}}}),xt=new J({props:{name:"get_image_features",anchor:"transformers.Blip2Model.get_image_features",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"},{name:"interpolate_pos_encoding",val:": bool = False"}],parametersDescription:[{anchor:"transformers.Blip2Model.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. Pixel values can be obtained using <a href="/docs/transformers/main/en/model_doc/blip-2#transformers.Blip2Processor">Blip2Processor</a>. See <code>Blip2Processor.__call__()</code> for
details.`,name:"pixel_values"},{anchor:"transformers.Blip2Model.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.Blip2Model.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.Blip2Model.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/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.Blip2Model.get_image_features.interpolate_pos_encoding",description:`<strong>interpolate_pos_encoding</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to interpolate the pre-trained position encodings.`,name:"interpolate_pos_encoding"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/blip_2/modeling_blip_2.py#L1564",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>The vision model outputs. If <code>return_dict=True</code>, the output is a <code>BaseModelOutputWithPooling</code> that
contains the image features, the pooled image features and the hidden states if
<code>output_hidden_states=True</code>.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p>vision_outputs (<code>BaseModelOutputWithPooling</code> or tuple of <code>torch.FloatTensor</code>)</p>
`}}),Ce=new ge({props:{$$slots:{default:[hr]},$$scope:{ctx:v}}}),Ie=new N({props:{anchor:"transformers.Blip2Model.get_image_features.example",$$slots:{default:[fr]},$$scope:{ctx:v}}}),kt=new J({props:{name:"get_qformer_features",anchor:"transformers.Blip2Model.get_qformer_features",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"},{name:"interpolate_pos_encoding",val:": bool = False"}],parametersDescription:[{anchor:"transformers.Blip2Model.get_qformer_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. Pixel values can be obtained using <a href="/docs/transformers/main/en/model_doc/blip-2#transformers.Blip2Processor">Blip2Processor</a>. See <code>Blip2Processor.__call__()</code> for
details.`,name:"pixel_values"},{anchor:"transformers.Blip2Model.get_qformer_features.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of input sequence tokens in the vocabulary of the language model. Input tokens can optionally be
provided to serve as text prompt, which the language model can continue.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/blip-2#transformers.Blip2Processor">Blip2Processor</a>. See <code>Blip2Processor.__call__()</code> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.Blip2Model.get_qformer_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.Blip2Model.get_qformer_features.decoder_input_ids",description:`<strong>decoder_input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, target_sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of decoder input sequence tokens in the vocabulary of the language model. Only relevant in case an
encoder-decoder language model (like T5) is used.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details. <a href="../glossary#decoder-input-ids">What are decoder input IDs?</a>`,name:"decoder_input_ids"},{anchor:"transformers.Blip2Model.get_qformer_features.decoder_attention_mask",description:`<strong>decoder_attention_mask</strong> (<code>torch.BoolTensor</code> of shape <code>(batch_size, target_sequence_length)</code>, <em>optional</em>) &#x2014;
Default behavior: generate a tensor that ignores pad tokens in <code>decoder_input_ids</code>. Causal mask will also
be used by default.</p>
<p>Only relevant in case an encoder-decoder language model (like T5) is used.`,name:"decoder_attention_mask"},{anchor:"transformers.Blip2Model.get_qformer_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.Blip2Model.get_qformer_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.Blip2Model.get_qformer_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/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.Blip2Model.get_qformer_features.interpolate_pos_encoding",description:`<strong>interpolate_pos_encoding</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to interpolate the pre-trained position encodings.`,name:"interpolate_pos_encoding"},{anchor:"transformers.Blip2Model.get_qformer_features.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/main/src/transformers/models/blip_2/modeling_blip_2.py#L1610",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>The vision model outputs. If <code>return_dict=True</code>, the output is a <code>BaseModelOutputWithPooling</code> that
contains the image features, the pooled image features and the hidden states if
<code>output_hidden_states=True</code>.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p>vision_outputs (<code>BaseModelOutputWithPooling</code> or tuple of <code>torch.FloatTensor</code>)</p>
`}}),Ue=new ge({props:{$$slots:{default:[_r]},$$scope:{ctx:v}}}),We=new N({props:{anchor:"transformers.Blip2Model.get_qformer_features.example",$$slots:{default:[br]},$$scope:{ctx:v}}}),Ct=new R({props:{title:"Blip2ForConditionalGeneration",local:"transformers.Blip2ForConditionalGeneration",headingTag:"h2"}}),It=new J({props:{name:"class transformers.Blip2ForConditionalGeneration",anchor:"transformers.Blip2ForConditionalGeneration",parameters:[{name:"config",val:": Blip2Config"}],parametersDescription:[{anchor:"transformers.Blip2ForConditionalGeneration.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/blip-2#transformers.Blip2Config">Blip2Config</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/blip_2/modeling_blip_2.py#L2011"}}),Ze=new ge({props:{$$slots:{default:[Mr]},$$scope:{ctx:v}}}),Ut=new J({props:{name:"forward",anchor:"transformers.Blip2ForConditionalGeneration.forward",parameters:[{name:"pixel_values",val:": FloatTensor"},{name:"input_ids",val:": FloatTensor"},{name:"attention_mask",val:": typing.Optional[torch.LongTensor] = None"},{name:"decoder_input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"decoder_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"},{name:"interpolate_pos_encoding",val:": bool = False"},{name:"use_cache",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.Blip2ForConditionalGeneration.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/main/en/model_doc/blip-2#transformers.Blip2Processor">Blip2Processor</a>. See <code>Blip2Processor.__call__()</code> for
details.`,name:"pixel_values"},{anchor:"transformers.Blip2ForConditionalGeneration.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of input sequence tokens in the vocabulary of the language model. Input tokens can optionally be
provided to serve as text prompt, which the language model can continue.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/blip-2#transformers.Blip2Processor">Blip2Processor</a>. See <code>Blip2Processor.__call__()</code> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.Blip2ForConditionalGeneration.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.Blip2ForConditionalGeneration.forward.decoder_input_ids",description:`<strong>decoder_input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, target_sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of decoder input sequence tokens in the vocabulary of the language model. Only relevant in case an
encoder-decoder language model (like T5) is used.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details. <a href="../glossary#decoder-input-ids">What are decoder input IDs?</a>`,name:"decoder_input_ids"},{anchor:"transformers.Blip2ForConditionalGeneration.forward.decoder_attention_mask",description:`<strong>decoder_attention_mask</strong> (<code>torch.BoolTensor</code> of shape <code>(batch_size, target_sequence_length)</code>, <em>optional</em>) &#x2014;
Default behavior: generate a tensor that ignores pad tokens in <code>decoder_input_ids</code>. Causal mask will also
be used by default.</p>
<p>Only relevant in case an encoder-decoder language model (like T5) is used.`,name:"decoder_attention_mask"},{anchor:"transformers.Blip2ForConditionalGeneration.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.Blip2ForConditionalGeneration.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.Blip2ForConditionalGeneration.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.Blip2ForConditionalGeneration.forward.interpolate_pos_encoding",description:`<strong>interpolate_pos_encoding</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to interpolate the pre-trained position encodings.`,name:"interpolate_pos_encoding"},{anchor:"transformers.Blip2ForConditionalGeneration.forward.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/main/src/transformers/models/blip_2/modeling_blip_2.py#L2101",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <code>transformers.models.blip_2.modeling_blip_2.Blip2ForConditionalGenerationModelOutput</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_2.configuration_blip_2.Blip2VisionConfig'&gt;</code>) and inputs.</p>
<ul>
<li><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>) — Language modeling loss from the language model.</li>
<li><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.vocab_size)</code>) — Prediction scores of the language modeling head of the language model.</li>
<li><strong>vision_outputs</strong> (<code>BaseModelOutputWithPooling</code>) — Outputs of the vision encoder.</li>
<li><strong>qformer_outputs</strong> (<code>BaseModelOutputWithPoolingAndCrossAttentions</code>) — Outputs of the Q-Former (Querying Transformer).</li>
<li><strong>language_model_outputs</strong> (<code>CausalLMOutputWithPast</code> or <code>Seq2SeqLMOutput</code>) — Outputs of the language model.</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>transformers.models.blip_2.modeling_blip_2.Blip2ForConditionalGenerationModelOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ze=new ge({props:{$$slots:{default:[yr]},$$scope:{ctx:v}}}),Fe=new N({props:{anchor:"transformers.Blip2ForConditionalGeneration.forward.example",$$slots:{default:[Tr]},$$scope:{ctx:v}}}),Pe=new N({props:{anchor:"transformers.Blip2ForConditionalGeneration.forward.example-2",$$slots:{default:[wr]},$$scope:{ctx:v}}}),Ve=new N({props:{anchor:"transformers.Blip2ForConditionalGeneration.forward.example-3",$$slots:{default:[vr]},$$scope:{ctx:v}}}),Re=new N({props:{anchor:"transformers.Blip2ForConditionalGeneration.forward.example-4",$$slots:{default:[$r]},$$scope:{ctx:v}}}),Wt=new J({props:{name:"generate",anchor:"transformers.Blip2ForConditionalGeneration.generate",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:"interpolate_pos_encoding",val:": bool = False"},{name:"**generate_kwargs",val:""}],parametersDescription:[{anchor:"transformers.Blip2ForConditionalGeneration.generate.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape (batch_size, num_channels, height, width)) &#x2014;
Input images to be processed.`,name:"pixel_values"},{anchor:"transformers.Blip2ForConditionalGeneration.generate.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape (batch_size, sequence_length), <em>optional</em>) &#x2014;
The sequence used as a prompt for the generation.`,name:"input_ids"},{anchor:"transformers.Blip2ForConditionalGeneration.generate.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.LongTensor</code> of shape (batch_size, sequence_length), <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices`,name:"attention_mask"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/blip_2/modeling_blip_2.py#L2287",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A list of strings of length batch_size * num_captions.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p>captions (list)</p>
`}}),Zt=new R({props:{title:"Blip2ForImageTextRetrieval",local:"transformers.Blip2ForImageTextRetrieval",headingTag:"h2"}}),zt=new J({props:{name:"class transformers.Blip2ForImageTextRetrieval",anchor:"transformers.Blip2ForImageTextRetrieval",parameters:[{name:"config",val:": Blip2Config"}],parametersDescription:[{anchor:"transformers.Blip2ForImageTextRetrieval.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/blip-2#transformers.Blip2Config">Blip2Config</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/blip_2/modeling_blip_2.py#L2384"}}),Ft=new J({props:{name:"forward",anchor:"transformers.Blip2ForImageTextRetrieval.forward",parameters:[{name:"pixel_values",val:": FloatTensor"},{name:"input_ids",val:": LongTensor"},{name:"attention_mask",val:": typing.Optional[torch.LongTensor] = None"},{name:"use_image_text_matching_head",val:": typing.Optional[bool] = False"},{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.Blip2ForImageTextRetrieval.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/main/en/model_doc/blip-2#transformers.Blip2Processor">Blip2Processor</a>. See <code>Blip2Processor.__call__()</code> for
details.`,name:"pixel_values"},{anchor:"transformers.Blip2ForImageTextRetrieval.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of input sequence tokens in the vocabulary of the language model. Input tokens can optionally be
provided to serve as text prompt, which the language model can continue.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/blip-2#transformers.Blip2Processor">Blip2Processor</a>. See <code>Blip2Processor.__call__()</code> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.Blip2ForImageTextRetrieval.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.Blip2ForImageTextRetrieval.forward.use_image_text_matching_head",description:`<strong>use_image_text_matching_head</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to return the Image-Text Matching or Contrastive scores.`,name:"use_image_text_matching_head"},{anchor:"transformers.Blip2ForImageTextRetrieval.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.Blip2ForImageTextRetrieval.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.Blip2ForImageTextRetrieval.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/blip_2/modeling_blip_2.py#L2424",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <code>transformers.models.blip_2.modeling_blip_2.Blip2ImageTextMatchingModelOutput</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_2.configuration_blip_2.Blip2Config'&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>) — Contrastive loss for image-text similarity.</li>
<li><strong>logits_per_image</strong> (<code>torch.FloatTensor</code> of shape <code>(image_batch_size, text_batch_size)</code>) — 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</strong> (<code>torch.FloatTensor</code> of shape <code>(text_batch_size, image_batch_size)</code>) — 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</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, output_dim</code>) — The text embeddings obtained by applying the projection layer to the pooled output.</li>
<li><strong>image_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, output_dim</code>) — The image embeddings obtained by applying the projection layer to the pooled output.</li>
<li><strong>text_model_output</strong> (<code>BaseModelOutputWithPooling</code>) — The output of the <a
  href="/docs/transformers/main/en/model_doc/blip-2#transformers.Blip2QFormerModel"
>Blip2QFormerModel</a>.</li>
<li><strong>vision_model_output</strong> (<code>BaseModelOutputWithPooling</code>) — The output of the <a
  href="/docs/transformers/main/en/model_doc/blip-2#transformers.Blip2VisionModel"
>Blip2VisionModel</a>.</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>transformers.models.blip_2.modeling_blip_2.Blip2ImageTextMatchingModelOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ge=new ge({props:{$$slots:{default:[Br]},$$scope:{ctx:v}}}),qe=new N({props:{anchor:"transformers.Blip2ForImageTextRetrieval.forward.example",$$slots:{default:[Jr]},$$scope:{ctx:v}}}),Pt=new R({props:{title:"Blip2TextModelWithProjection",local:"transformers.Blip2TextModelWithProjection",headingTag:"h2"}}),Vt=new J({props:{name:"class transformers.Blip2TextModelWithProjection",anchor:"transformers.Blip2TextModelWithProjection",parameters:[{name:"config",val:": Blip2Config"}],parametersDescription:[{anchor:"transformers.Blip2TextModelWithProjection.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/blip-2#transformers.Blip2Config">Blip2Config</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/blip_2/modeling_blip_2.py#L1805"}}),Rt=new J({props:{name:"forward",anchor:"transformers.Blip2TextModelWithProjection.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:"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.Blip2TextModelWithProjection.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. Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details. <a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.Blip2TextModelWithProjection.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>:<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.
<a href="../glossary#attention-mask">What are attention masks?</a></li>
</ul>`,name:"attention_mask"},{anchor:"transformers.Blip2TextModelWithProjection.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>.`,name:"position_ids"},{anchor:"transformers.Blip2TextModelWithProjection.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.Blip2TextModelWithProjection.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.Blip2TextModelWithProjection.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/blip_2/modeling_blip_2.py#L1834",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <code>transformers.models.blip_2.modeling_blip_2.Blip2TextModelOutput</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_2.configuration_blip_2.Blip2Config'&gt;</code>) and inputs.</p>
<ul>
<li>
<p><strong>text_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>) — The text 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>) — 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>) — 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>) — 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:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>transformers.models.blip_2.modeling_blip_2.Blip2TextModelOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Xe=new ge({props:{$$slots:{default:[jr]},$$scope:{ctx:v}}}),Qe=new N({props:{anchor:"transformers.Blip2TextModelWithProjection.forward.example",$$slots:{default:[xr]},$$scope:{ctx:v}}}),Nt=new R({props:{title:"Blip2VisionModelWithProjection",local:"transformers.Blip2VisionModelWithProjection",headingTag:"h2"}}),Gt=new J({props:{name:"class transformers.Blip2VisionModelWithProjection",anchor:"transformers.Blip2VisionModelWithProjection",parameters:[{name:"config",val:": Blip2Config"}],parametersDescription:[{anchor:"transformers.Blip2VisionModelWithProjection.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/blip-2#transformers.Blip2Config">Blip2Config</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/blip_2/modeling_blip_2.py#L1904"}}),qt=new J({props:{name:"forward",anchor:"transformers.Blip2VisionModelWithProjection.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.Blip2VisionModelWithProjection.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/main/en/model_doc/blip-2#transformers.Blip2Processor">Blip2Processor</a>. See <code>Blip2Processor.__call__()</code> for
details.`,name:"pixel_values"},{anchor:"transformers.Blip2VisionModelWithProjection.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.Blip2VisionModelWithProjection.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.Blip2VisionModelWithProjection.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.Blip2VisionModelWithProjection.forward.interpolate_pos_encoding",description:`<strong>interpolate_pos_encoding</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to interpolate the pre-trained position encodings.`,name:"interpolate_pos_encoding"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/blip_2/modeling_blip_2.py#L1931",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <code>transformers.models.blip_2.modeling_blip_2.Blip2VisionModelOutput</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_2.configuration_blip_2.Blip2Config'&gt;</code>) and inputs.</p>
<ul>
<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>) — 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>) — 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>) — 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>) — 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:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>transformers.models.blip_2.modeling_blip_2.Blip2VisionModelOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Le=new ge({props:{$$slots:{default:[kr]},$$scope:{ctx:v}}}),Ee=new N({props:{anchor:"transformers.Blip2VisionModelWithProjection.forward.example",$$slots:{default:[Cr]},$$scope:{ctx:v}}}),Xt=new rr({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/model_doc/blip-2.md"}}),{c(){t=c("meta"),g=r(),o=c("p"),d=r(),u(T.$$.fragment),n=r(),w=c("div"),w.innerHTML=Ks,Nn=r(),u(Se.$$.fragment),Gn=r(),Ye=c("p"),Ye.innerHTML=ea,qn=r(),Ae=c("p"),Ae.textContent=ta,Xn=r(),De=c("p"),De.innerHTML=na,Qn=r(),be=c("img"),Ln=r(),Oe=c("small"),Oe.innerHTML=sa,En=r(),Ke=c("p"),Ke.innerHTML=aa,Hn=r(),u(et.$$.fragment),Sn=r(),tt=c("ul"),tt.innerHTML=ra,Yn=r(),nt=c("blockquote"),nt.innerHTML=ia,An=r(),u(ot.$$.fragment),Dn=r(),st=c("p"),st.textContent=la,On=r(),at=c("ul"),at.innerHTML=da,Kn=r(),rt=c("p"),rt.textContent=ca,eo=r(),u(it.$$.fragment),to=r(),Z=c("div"),u(lt.$$.fragment),Jo=r(),Yt=c("p"),Yt.innerHTML=pa,jo=r(),At=c("p"),At.innerHTML=ma,xo=r(),u(Me.$$.fragment),ko=r(),ye=c("div"),u(dt.$$.fragment),Co=r(),Dt=c("p"),Dt.innerHTML=ga,no=r(),u(ct.$$.fragment),oo=r(),q=c("div"),u(pt.$$.fragment),Io=r(),Ot=c("p"),Ot.innerHTML=ua,Uo=r(),Kt=c("p"),Kt.innerHTML=ha,Wo=r(),u(Te.$$.fragment),so=r(),u(mt.$$.fragment),ao=r(),X=c("div"),u(gt.$$.fragment),Zo=r(),en=c("p"),en.innerHTML=fa,zo=r(),tn=c("p"),tn.innerHTML=_a,Fo=r(),u(we.$$.fragment),ro=r(),u(ut.$$.fragment),io=r(),z=c("div"),u(ht.$$.fragment),Po=r(),nn=c("p"),nn.textContent=ba,Vo=r(),on=c("p"),on.innerHTML=Ma,Ro=r(),ve=c("div"),u(ft.$$.fragment),No=r(),sn=c("p"),sn.innerHTML=ya,Go=r(),$e=c("div"),u(_t.$$.fragment),qo=r(),an=c("p"),an.innerHTML=Ta,lo=r(),u(bt.$$.fragment),co=r(),ue=c("div"),u(Mt.$$.fragment),Xo=r(),pe=c("div"),u(yt.$$.fragment),Qo=r(),rn=c("p"),rn.innerHTML=wa,Lo=r(),u(Be.$$.fragment),po=r(),u(Tt.$$.fragment),mo=r(),ne=c("div"),u(wt.$$.fragment),Eo=r(),ln=c("p"),ln.textContent=va,Ho=r(),me=c("div"),u(vt.$$.fragment),So=r(),dn=c("p"),dn.innerHTML=$a,Yo=r(),cn=c("ul"),cn.innerHTML=Ba,go=r(),u($t.$$.fragment),uo=r(),C=c("div"),u(Bt.$$.fragment),Ao=r(),pn=c("p"),pn.textContent=Ja,Do=r(),mn=c("p"),mn.innerHTML=ja,Oo=r(),gn=c("p"),gn.innerHTML=xa,Ko=r(),Y=c("div"),u(Jt.$$.fragment),es=r(),un=c("p"),un.innerHTML=ka,ts=r(),u(Je.$$.fragment),ns=r(),u(je.$$.fragment),os=r(),A=c("div"),u(jt.$$.fragment),ss=r(),hn=c("p"),hn.innerHTML=Ca,as=r(),u(xe.$$.fragment),rs=r(),u(ke.$$.fragment),is=r(),D=c("div"),u(xt.$$.fragment),ls=r(),fn=c("p"),fn.innerHTML=Ia,ds=r(),u(Ce.$$.fragment),cs=r(),u(Ie.$$.fragment),ps=r(),O=c("div"),u(kt.$$.fragment),ms=r(),_n=c("p"),_n.innerHTML=Ua,gs=r(),u(Ue.$$.fragment),us=r(),u(We.$$.fragment),ho=r(),u(Ct.$$.fragment),fo=r(),I=c("div"),u(It.$$.fragment),hs=r(),bn=c("p"),bn.textContent=Wa,fs=r(),Mn=c("p"),Mn.innerHTML=Za,_s=r(),u(Ze.$$.fragment),bs=r(),yn=c("p"),yn.innerHTML=za,Ms=r(),Tn=c("p"),Tn.innerHTML=Fa,ys=r(),j=c("div"),u(Ut.$$.fragment),Ts=r(),wn=c("p"),wn.innerHTML=Pa,ws=r(),u(ze.$$.fragment),vs=r(),vn=c("p"),vn.textContent=Va,$s=r(),$n=c("p"),$n.textContent=Ra,Bs=r(),u(Fe.$$.fragment),Js=r(),u(Pe.$$.fragment),js=r(),u(Ve.$$.fragment),xs=r(),Bn=c("p"),Bn.innerHTML=Na,ks=r(),u(Re.$$.fragment),Cs=r(),Ne=c("div"),u(Wt.$$.fragment),Is=r(),Jn=c("p"),Jn.innerHTML=Ga,_o=r(),u(Zt.$$.fragment),bo=r(),F=c("div"),u(zt.$$.fragment),Us=r(),jn=c("p"),jn.textContent=qa,Ws=r(),xn=c("p"),xn.innerHTML=Xa,Zs=r(),kn=c("p"),kn.innerHTML=Qa,zs=r(),K=c("div"),u(Ft.$$.fragment),Fs=r(),Cn=c("p"),Cn.innerHTML=La,Ps=r(),u(Ge.$$.fragment),Vs=r(),u(qe.$$.fragment),Mo=r(),u(Pt.$$.fragment),yo=r(),P=c("div"),u(Vt.$$.fragment),Rs=r(),In=c("p"),In.textContent=Ea,Ns=r(),Un=c("p"),Un.innerHTML=Ha,Gs=r(),Wn=c("p"),Wn.innerHTML=Sa,qs=r(),ee=c("div"),u(Rt.$$.fragment),Xs=r(),Zn=c("p"),Zn.innerHTML=Ya,Qs=r(),u(Xe.$$.fragment),Ls=r(),u(Qe.$$.fragment),To=r(),u(Nt.$$.fragment),wo=r(),V=c("div"),u(Gt.$$.fragment),Es=r(),zn=c("p"),zn.textContent=Aa,Hs=r(),Fn=c("p"),Fn.innerHTML=Da,Ss=r(),Pn=c("p"),Pn.innerHTML=Oa,Ys=r(),te=c("div"),u(qt.$$.fragment),As=r(),Vn=c("p"),Vn.innerHTML=Ka,Ds=r(),u(Le.$$.fragment),Os=r(),u(Ee.$$.fragment),vo=r(),u(Xt.$$.fragment),$o=r(),Rn=c("p"),this.h()},l(e){const a=ar("svelte-u9bgzb",document.head);t=p(a,"META",{name:!0,content:!0}),a.forEach(l),g=i(e),o=p(e,"P",{}),B(o).forEach(l),d=i(e),h(T.$$.fragment,e),n=i(e),w=p(e,"DIV",{class:!0,"data-svelte-h":!0}),y(w)!=="svelte-13t8s2t"&&(w.innerHTML=Ks),Nn=i(e),h(Se.$$.fragment,e),Gn=i(e),Ye=p(e,"P",{"data-svelte-h":!0}),y(Ye)!=="svelte-1tx2g06"&&(Ye.innerHTML=ea),qn=i(e),Ae=p(e,"P",{"data-svelte-h":!0}),y(Ae)!=="svelte-vfdo9a"&&(Ae.textContent=ta),Xn=i(e),De=p(e,"P",{"data-svelte-h":!0}),y(De)!=="svelte-k65nu1"&&(De.innerHTML=na),Qn=i(e),be=p(e,"IMG",{src:!0,alt:!0,width:!0}),Ln=i(e),Oe=p(e,"SMALL",{"data-svelte-h":!0}),y(Oe)!=="svelte-1f3k680"&&(Oe.innerHTML=sa),En=i(e),Ke=p(e,"P",{"data-svelte-h":!0}),y(Ke)!=="svelte-1xpociz"&&(Ke.innerHTML=aa),Hn=i(e),h(et.$$.fragment,e),Sn=i(e),tt=p(e,"UL",{"data-svelte-h":!0}),y(tt)!=="svelte-160q6p0"&&(tt.innerHTML=ra),Yn=i(e),nt=p(e,"BLOCKQUOTE",{"data-svelte-h":!0}),y(nt)!=="svelte-w0b318"&&(nt.innerHTML=ia),An=i(e),h(ot.$$.fragment,e),Dn=i(e),st=p(e,"P",{"data-svelte-h":!0}),y(st)!=="svelte-11jcle7"&&(st.textContent=la),On=i(e),at=p(e,"UL",{"data-svelte-h":!0}),y(at)!=="svelte-1tw7src"&&(at.innerHTML=da),Kn=i(e),rt=p(e,"P",{"data-svelte-h":!0}),y(rt)!=="svelte-1xesile"&&(rt.textContent=ca),eo=i(e),h(it.$$.fragment,e),to=i(e),Z=p(e,"DIV",{class:!0});var Q=B(Z);h(lt.$$.fragment,Q),Jo=i(Q),Yt=p(Q,"P",{"data-svelte-h":!0}),y(Yt)!=="svelte-19zzypg"&&(Yt.innerHTML=pa),jo=i(Q),At=p(Q,"P",{"data-svelte-h":!0}),y(At)!=="svelte-o55m63"&&(At.innerHTML=ma),xo=i(Q),h(Me.$$.fragment,Q),ko=i(Q),ye=p(Q,"DIV",{class:!0});var Qt=B(ye);h(dt.$$.fragment,Qt),Co=i(Qt),Dt=p(Qt,"P",{"data-svelte-h":!0}),y(Dt)!=="svelte-13ivq3o"&&(Dt.innerHTML=ga),Qt.forEach(l),Q.forEach(l),no=i(e),h(ct.$$.fragment,e),oo=i(e),q=p(e,"DIV",{class:!0});var oe=B(q);h(pt.$$.fragment,oe),Io=i(oe),Ot=p(oe,"P",{"data-svelte-h":!0}),y(Ot)!=="svelte-8lkgtn"&&(Ot.innerHTML=ua),Uo=i(oe),Kt=p(oe,"P",{"data-svelte-h":!0}),y(Kt)!=="svelte-o55m63"&&(Kt.innerHTML=ha),Wo=i(oe),h(Te.$$.fragment,oe),oe.forEach(l),so=i(e),h(mt.$$.fragment,e),ao=i(e),X=p(e,"DIV",{class:!0});var se=B(X);h(gt.$$.fragment,se),Zo=i(se),en=p(se,"P",{"data-svelte-h":!0}),y(en)!=="svelte-t733gv"&&(en.innerHTML=fa),zo=i(se),tn=p(se,"P",{"data-svelte-h":!0}),y(tn)!=="svelte-fju7n4"&&(tn.innerHTML=_a),Fo=i(se),h(we.$$.fragment,se),se.forEach(l),ro=i(e),h(ut.$$.fragment,e),io=i(e),z=p(e,"DIV",{class:!0});var L=B(z);h(ht.$$.fragment,L),Po=i(L),nn=p(L,"P",{"data-svelte-h":!0}),y(nn)!=="svelte-qq98xh"&&(nn.textContent=ba),Vo=i(L),on=p(L,"P",{"data-svelte-h":!0}),y(on)!=="svelte-es6nc1"&&(on.innerHTML=Ma),Ro=i(L),ve=p(L,"DIV",{class:!0});var Lt=B(ve);h(ft.$$.fragment,Lt),No=i(Lt),sn=p(Lt,"P",{"data-svelte-h":!0}),y(sn)!=="svelte-oplyi9"&&(sn.innerHTML=ya),Lt.forEach(l),Go=i(L),$e=p(L,"DIV",{class:!0});var Et=B($e);h(_t.$$.fragment,Et),qo=i(Et),an=p(Et,"P",{"data-svelte-h":!0}),y(an)!=="svelte-13jr6zv"&&(an.innerHTML=Ta),Et.forEach(l),L.forEach(l),lo=i(e),h(bt.$$.fragment,e),co=i(e),ue=p(e,"DIV",{class:!0});var Ht=B(ue);h(Mt.$$.fragment,Ht),Xo=i(Ht),pe=p(Ht,"DIV",{class:!0});var he=B(pe);h(yt.$$.fragment,he),Qo=i(he),rn=p(he,"P",{"data-svelte-h":!0}),y(rn)!=="svelte-1s0uc0f"&&(rn.innerHTML=wa),Lo=i(he),h(Be.$$.fragment,he),he.forEach(l),Ht.forEach(l),po=i(e),h(Tt.$$.fragment,e),mo=i(e),ne=p(e,"DIV",{class:!0});var fe=B(ne);h(wt.$$.fragment,fe),Eo=i(fe),ln=p(fe,"P",{"data-svelte-h":!0}),y(ln)!=="svelte-d9cja9"&&(ln.textContent=va),Ho=i(fe),me=p(fe,"DIV",{class:!0});var _e=B(me);h(vt.$$.fragment,_e),So=i(_e),dn=p(_e,"P",{"data-svelte-h":!0}),y(dn)!=="svelte-sj4g2x"&&(dn.innerHTML=$a),Yo=i(_e),cn=p(_e,"UL",{"data-svelte-h":!0}),y(cn)!=="svelte-1mo0n1o"&&(cn.innerHTML=Ba),_e.forEach(l),fe.forEach(l),go=i(e),h($t.$$.fragment,e),uo=i(e),C=p(e,"DIV",{class:!0});var U=B(C);h(Bt.$$.fragment,U),Ao=i(U),pn=p(U,"P",{"data-svelte-h":!0}),y(pn)!=="svelte-1ib14ae"&&(pn.textContent=Ja),Do=i(U),mn=p(U,"P",{"data-svelte-h":!0}),y(mn)!=="svelte-6pahdo"&&(mn.innerHTML=ja),Oo=i(U),gn=p(U,"P",{"data-svelte-h":!0}),y(gn)!=="svelte-hswkmf"&&(gn.innerHTML=xa),Ko=i(U),Y=p(U,"DIV",{class:!0});var ae=B(Y);h(Jt.$$.fragment,ae),es=i(ae),un=p(ae,"P",{"data-svelte-h":!0}),y(un)!=="svelte-ypzrz"&&(un.innerHTML=ka),ts=i(ae),h(Je.$$.fragment,ae),ns=i(ae),h(je.$$.fragment,ae),ae.forEach(l),os=i(U),A=p(U,"DIV",{class:!0});var re=B(A);h(jt.$$.fragment,re),ss=i(re),hn=p(re,"P",{"data-svelte-h":!0}),y(hn)!=="svelte-ypzrz"&&(hn.innerHTML=Ca),as=i(re),h(xe.$$.fragment,re),rs=i(re),h(ke.$$.fragment,re),re.forEach(l),is=i(U),D=p(U,"DIV",{class:!0});var ie=B(D);h(xt.$$.fragment,ie),ls=i(ie),fn=p(ie,"P",{"data-svelte-h":!0}),y(fn)!=="svelte-ypzrz"&&(fn.innerHTML=Ia),ds=i(ie),h(Ce.$$.fragment,ie),cs=i(ie),h(Ie.$$.fragment,ie),ie.forEach(l),ps=i(U),O=p(U,"DIV",{class:!0});var le=B(O);h(kt.$$.fragment,le),ms=i(le),_n=p(le,"P",{"data-svelte-h":!0}),y(_n)!=="svelte-ypzrz"&&(_n.innerHTML=Ua),gs=i(le),h(Ue.$$.fragment,le),us=i(le),h(We.$$.fragment,le),le.forEach(l),U.forEach(l),ho=i(e),h(Ct.$$.fragment,e),fo=i(e),I=p(e,"DIV",{class:!0});var W=B(I);h(It.$$.fragment,W),hs=i(W),bn=p(W,"P",{"data-svelte-h":!0}),y(bn)!=="svelte-1fsmwyj"&&(bn.textContent=Wa),fs=i(W),Mn=p(W,"P",{"data-svelte-h":!0}),y(Mn)!=="svelte-1ks26sg"&&(Mn.innerHTML=Za),_s=i(W),h(Ze.$$.fragment,W),bs=i(W),yn=p(W,"P",{"data-svelte-h":!0}),y(yn)!=="svelte-6pahdo"&&(yn.innerHTML=za),Ms=i(W),Tn=p(W,"P",{"data-svelte-h":!0}),y(Tn)!=="svelte-hswkmf"&&(Tn.innerHTML=Fa),ys=i(W),j=p(W,"DIV",{class:!0});var k=B(j);h(Ut.$$.fragment,k),Ts=i(k),wn=p(k,"P",{"data-svelte-h":!0}),y(wn)!=="svelte-1p9ou3n"&&(wn.innerHTML=Pa),ws=i(k),h(ze.$$.fragment,k),vs=i(k),vn=p(k,"P",{"data-svelte-h":!0}),y(vn)!=="svelte-kvfsh7"&&(vn.textContent=Va),$s=i(k),$n=p(k,"P",{"data-svelte-h":!0}),y($n)!=="svelte-1c4jfk4"&&($n.textContent=Ra),Bs=i(k),h(Fe.$$.fragment,k),Js=i(k),h(Pe.$$.fragment,k),js=i(k),h(Ve.$$.fragment,k),xs=i(k),Bn=p(k,"P",{"data-svelte-h":!0}),y(Bn)!=="svelte-gy1q6u"&&(Bn.innerHTML=Na),ks=i(k),h(Re.$$.fragment,k),k.forEach(l),Cs=i(W),Ne=p(W,"DIV",{class:!0});var St=B(Ne);h(Wt.$$.fragment,St),Is=i(St),Jn=p(St,"P",{"data-svelte-h":!0}),y(Jn)!=="svelte-eq620n"&&(Jn.innerHTML=Ga),St.forEach(l),W.forEach(l),_o=i(e),h(Zt.$$.fragment,e),bo=i(e),F=p(e,"DIV",{class:!0});var E=B(F);h(zt.$$.fragment,E),Us=i(E),jn=p(E,"P",{"data-svelte-h":!0}),y(jn)!=="svelte-15b9m1j"&&(jn.textContent=qa),Ws=i(E),xn=p(E,"P",{"data-svelte-h":!0}),y(xn)!=="svelte-6pahdo"&&(xn.innerHTML=Xa),Zs=i(E),kn=p(E,"P",{"data-svelte-h":!0}),y(kn)!=="svelte-hswkmf"&&(kn.innerHTML=Qa),zs=i(E),K=p(E,"DIV",{class:!0});var de=B(K);h(Ft.$$.fragment,de),Fs=i(de),Cn=p(de,"P",{"data-svelte-h":!0}),y(Cn)!=="svelte-1kapd0n"&&(Cn.innerHTML=La),Ps=i(de),h(Ge.$$.fragment,de),Vs=i(de),h(qe.$$.fragment,de),de.forEach(l),E.forEach(l),Mo=i(e),h(Pt.$$.fragment,e),yo=i(e),P=p(e,"DIV",{class:!0});var H=B(P);h(Vt.$$.fragment,H),Rs=i(H),In=p(H,"P",{"data-svelte-h":!0}),y(In)!=="svelte-15w7rwr"&&(In.textContent=Ea),Ns=i(H),Un=p(H,"P",{"data-svelte-h":!0}),y(Un)!=="svelte-6pahdo"&&(Un.innerHTML=Ha),Gs=i(H),Wn=p(H,"P",{"data-svelte-h":!0}),y(Wn)!=="svelte-hswkmf"&&(Wn.innerHTML=Sa),qs=i(H),ee=p(H,"DIV",{class:!0});var ce=B(ee);h(Rt.$$.fragment,ce),Xs=i(ce),Zn=p(ce,"P",{"data-svelte-h":!0}),y(Zn)!=="svelte-17k4pxz"&&(Zn.innerHTML=Ya),Qs=i(ce),h(Xe.$$.fragment,ce),Ls=i(ce),h(Qe.$$.fragment,ce),ce.forEach(l),H.forEach(l),To=i(e),h(Nt.$$.fragment,e),wo=i(e),V=p(e,"DIV",{class:!0});var S=B(V);h(Gt.$$.fragment,S),Es=i(S),zn=p(S,"P",{"data-svelte-h":!0}),y(zn)!=="svelte-1mz4lpc"&&(zn.textContent=Aa),Hs=i(S),Fn=p(S,"P",{"data-svelte-h":!0}),y(Fn)!=="svelte-6pahdo"&&(Fn.innerHTML=Da),Ss=i(S),Pn=p(S,"P",{"data-svelte-h":!0}),y(Pn)!=="svelte-hswkmf"&&(Pn.innerHTML=Oa),Ys=i(S),te=p(S,"DIV",{class:!0});var He=B(te);h(qt.$$.fragment,He),As=i(He),Vn=p(He,"P",{"data-svelte-h":!0}),y(Vn)!=="svelte-by1umx"&&(Vn.innerHTML=Ka),Ds=i(He),h(Le.$$.fragment,He),Os=i(He),h(Ee.$$.fragment,He),He.forEach(l),S.forEach(l),vo=i(e),h(Xt.$$.fragment,e),$o=i(e),Rn=p(e,"P",{}),B(Rn).forEach(l),this.h()},h(){$(t,"name","hf:doc:metadata"),$(t,"content",Ur),$(w,"class","flex flex-wrap space-x-1"),tr(be.src,oa="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/model_doc/blip2_architecture.jpg")||$(be,"src",oa),$(be,"alt","drawing"),$(be,"width","600"),$(ye,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(X,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(ve,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$($e,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(pe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(ue,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(me,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(ne,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(Y,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(O,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(Ne,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(K,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(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,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(te,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,a){s(document.head,t),m(e,g,a),m(e,o,a),m(e,d,a),f(T,e,a),m(e,n,a),m(e,w,a),m(e,Nn,a),f(Se,e,a),m(e,Gn,a),m(e,Ye,a),m(e,qn,a),m(e,Ae,a),m(e,Xn,a),m(e,De,a),m(e,Qn,a),m(e,be,a),m(e,Ln,a),m(e,Oe,a),m(e,En,a),m(e,Ke,a),m(e,Hn,a),f(et,e,a),m(e,Sn,a),m(e,tt,a),m(e,Yn,a),m(e,nt,a),m(e,An,a),f(ot,e,a),m(e,Dn,a),m(e,st,a),m(e,On,a),m(e,at,a),m(e,Kn,a),m(e,rt,a),m(e,eo,a),f(it,e,a),m(e,to,a),m(e,Z,a),f(lt,Z,null),s(Z,Jo),s(Z,Yt),s(Z,jo),s(Z,At),s(Z,xo),f(Me,Z,null),s(Z,ko),s(Z,ye),f(dt,ye,null),s(ye,Co),s(ye,Dt),m(e,no,a),f(ct,e,a),m(e,oo,a),m(e,q,a),f(pt,q,null),s(q,Io),s(q,Ot),s(q,Uo),s(q,Kt),s(q,Wo),f(Te,q,null),m(e,so,a),f(mt,e,a),m(e,ao,a),m(e,X,a),f(gt,X,null),s(X,Zo),s(X,en),s(X,zo),s(X,tn),s(X,Fo),f(we,X,null),m(e,ro,a),f(ut,e,a),m(e,io,a),m(e,z,a),f(ht,z,null),s(z,Po),s(z,nn),s(z,Vo),s(z,on),s(z,Ro),s(z,ve),f(ft,ve,null),s(ve,No),s(ve,sn),s(z,Go),s(z,$e),f(_t,$e,null),s($e,qo),s($e,an),m(e,lo,a),f(bt,e,a),m(e,co,a),m(e,ue,a),f(Mt,ue,null),s(ue,Xo),s(ue,pe),f(yt,pe,null),s(pe,Qo),s(pe,rn),s(pe,Lo),f(Be,pe,null),m(e,po,a),f(Tt,e,a),m(e,mo,a),m(e,ne,a),f(wt,ne,null),s(ne,Eo),s(ne,ln),s(ne,Ho),s(ne,me),f(vt,me,null),s(me,So),s(me,dn),s(me,Yo),s(me,cn),m(e,go,a),f($t,e,a),m(e,uo,a),m(e,C,a),f(Bt,C,null),s(C,Ao),s(C,pn),s(C,Do),s(C,mn),s(C,Oo),s(C,gn),s(C,Ko),s(C,Y),f(Jt,Y,null),s(Y,es),s(Y,un),s(Y,ts),f(Je,Y,null),s(Y,ns),f(je,Y,null),s(C,os),s(C,A),f(jt,A,null),s(A,ss),s(A,hn),s(A,as),f(xe,A,null),s(A,rs),f(ke,A,null),s(C,is),s(C,D),f(xt,D,null),s(D,ls),s(D,fn),s(D,ds),f(Ce,D,null),s(D,cs),f(Ie,D,null),s(C,ps),s(C,O),f(kt,O,null),s(O,ms),s(O,_n),s(O,gs),f(Ue,O,null),s(O,us),f(We,O,null),m(e,ho,a),f(Ct,e,a),m(e,fo,a),m(e,I,a),f(It,I,null),s(I,hs),s(I,bn),s(I,fs),s(I,Mn),s(I,_s),f(Ze,I,null),s(I,bs),s(I,yn),s(I,Ms),s(I,Tn),s(I,ys),s(I,j),f(Ut,j,null),s(j,Ts),s(j,wn),s(j,ws),f(ze,j,null),s(j,vs),s(j,vn),s(j,$s),s(j,$n),s(j,Bs),f(Fe,j,null),s(j,Js),f(Pe,j,null),s(j,js),f(Ve,j,null),s(j,xs),s(j,Bn),s(j,ks),f(Re,j,null),s(I,Cs),s(I,Ne),f(Wt,Ne,null),s(Ne,Is),s(Ne,Jn),m(e,_o,a),f(Zt,e,a),m(e,bo,a),m(e,F,a),f(zt,F,null),s(F,Us),s(F,jn),s(F,Ws),s(F,xn),s(F,Zs),s(F,kn),s(F,zs),s(F,K),f(Ft,K,null),s(K,Fs),s(K,Cn),s(K,Ps),f(Ge,K,null),s(K,Vs),f(qe,K,null),m(e,Mo,a),f(Pt,e,a),m(e,yo,a),m(e,P,a),f(Vt,P,null),s(P,Rs),s(P,In),s(P,Ns),s(P,Un),s(P,Gs),s(P,Wn),s(P,qs),s(P,ee),f(Rt,ee,null),s(ee,Xs),s(ee,Zn),s(ee,Qs),f(Xe,ee,null),s(ee,Ls),f(Qe,ee,null),m(e,To,a),f(Nt,e,a),m(e,wo,a),m(e,V,a),f(Gt,V,null),s(V,Es),s(V,zn),s(V,Hs),s(V,Fn),s(V,Ss),s(V,Pn),s(V,Ys),s(V,te),f(qt,te,null),s(te,As),s(te,Vn),s(te,Ds),f(Le,te,null),s(te,Os),f(Ee,te,null),m(e,vo,a),f(Xt,e,a),m(e,$o,a),m(e,Rn,a),Bo=!0},p(e,[a]){const Q={};a&2&&(Q.$$scope={dirty:a,ctx:e}),Me.$set(Q);const Qt={};a&2&&(Qt.$$scope={dirty:a,ctx:e}),Te.$set(Qt);const oe={};a&2&&(oe.$$scope={dirty:a,ctx:e}),we.$set(oe);const se={};a&2&&(se.$$scope={dirty:a,ctx:e}),Be.$set(se);const L={};a&2&&(L.$$scope={dirty:a,ctx:e}),Je.$set(L);const Lt={};a&2&&(Lt.$$scope={dirty:a,ctx:e}),je.$set(Lt);const Et={};a&2&&(Et.$$scope={dirty:a,ctx:e}),xe.$set(Et);const Ht={};a&2&&(Ht.$$scope={dirty:a,ctx:e}),ke.$set(Ht);const he={};a&2&&(he.$$scope={dirty:a,ctx:e}),Ce.$set(he);const fe={};a&2&&(fe.$$scope={dirty:a,ctx:e}),Ie.$set(fe);const _e={};a&2&&(_e.$$scope={dirty:a,ctx:e}),Ue.$set(_e);const U={};a&2&&(U.$$scope={dirty:a,ctx:e}),We.$set(U);const ae={};a&2&&(ae.$$scope={dirty:a,ctx:e}),Ze.$set(ae);const re={};a&2&&(re.$$scope={dirty:a,ctx:e}),ze.$set(re);const ie={};a&2&&(ie.$$scope={dirty:a,ctx:e}),Fe.$set(ie);const le={};a&2&&(le.$$scope={dirty:a,ctx:e}),Pe.$set(le);const W={};a&2&&(W.$$scope={dirty:a,ctx:e}),Ve.$set(W);const k={};a&2&&(k.$$scope={dirty:a,ctx:e}),Re.$set(k);const St={};a&2&&(St.$$scope={dirty:a,ctx:e}),Ge.$set(St);const E={};a&2&&(E.$$scope={dirty:a,ctx:e}),qe.$set(E);const de={};a&2&&(de.$$scope={dirty:a,ctx:e}),Xe.$set(de);const H={};a&2&&(H.$$scope={dirty:a,ctx:e}),Qe.$set(H);const ce={};a&2&&(ce.$$scope={dirty:a,ctx:e}),Le.$set(ce);const S={};a&2&&(S.$$scope={dirty:a,ctx:e}),Ee.$set(S)},i(e){Bo||(_(T.$$.fragment,e),_(Se.$$.fragment,e),_(et.$$.fragment,e),_(ot.$$.fragment,e),_(it.$$.fragment,e),_(lt.$$.fragment,e),_(Me.$$.fragment,e),_(dt.$$.fragment,e),_(ct.$$.fragment,e),_(pt.$$.fragment,e),_(Te.$$.fragment,e),_(mt.$$.fragment,e),_(gt.$$.fragment,e),_(we.$$.fragment,e),_(ut.$$.fragment,e),_(ht.$$.fragment,e),_(ft.$$.fragment,e),_(_t.$$.fragment,e),_(bt.$$.fragment,e),_(Mt.$$.fragment,e),_(yt.$$.fragment,e),_(Be.$$.fragment,e),_(Tt.$$.fragment,e),_(wt.$$.fragment,e),_(vt.$$.fragment,e),_($t.$$.fragment,e),_(Bt.$$.fragment,e),_(Jt.$$.fragment,e),_(Je.$$.fragment,e),_(je.$$.fragment,e),_(jt.$$.fragment,e),_(xe.$$.fragment,e),_(ke.$$.fragment,e),_(xt.$$.fragment,e),_(Ce.$$.fragment,e),_(Ie.$$.fragment,e),_(kt.$$.fragment,e),_(Ue.$$.fragment,e),_(We.$$.fragment,e),_(Ct.$$.fragment,e),_(It.$$.fragment,e),_(Ze.$$.fragment,e),_(Ut.$$.fragment,e),_(ze.$$.fragment,e),_(Fe.$$.fragment,e),_(Pe.$$.fragment,e),_(Ve.$$.fragment,e),_(Re.$$.fragment,e),_(Wt.$$.fragment,e),_(Zt.$$.fragment,e),_(zt.$$.fragment,e),_(Ft.$$.fragment,e),_(Ge.$$.fragment,e),_(qe.$$.fragment,e),_(Pt.$$.fragment,e),_(Vt.$$.fragment,e),_(Rt.$$.fragment,e),_(Xe.$$.fragment,e),_(Qe.$$.fragment,e),_(Nt.$$.fragment,e),_(Gt.$$.fragment,e),_(qt.$$.fragment,e),_(Le.$$.fragment,e),_(Ee.$$.fragment,e),_(Xt.$$.fragment,e),Bo=!0)},o(e){b(T.$$.fragment,e),b(Se.$$.fragment,e),b(et.$$.fragment,e),b(ot.$$.fragment,e),b(it.$$.fragment,e),b(lt.$$.fragment,e),b(Me.$$.fragment,e),b(dt.$$.fragment,e),b(ct.$$.fragment,e),b(pt.$$.fragment,e),b(Te.$$.fragment,e),b(mt.$$.fragment,e),b(gt.$$.fragment,e),b(we.$$.fragment,e),b(ut.$$.fragment,e),b(ht.$$.fragment,e),b(ft.$$.fragment,e),b(_t.$$.fragment,e),b(bt.$$.fragment,e),b(Mt.$$.fragment,e),b(yt.$$.fragment,e),b(Be.$$.fragment,e),b(Tt.$$.fragment,e),b(wt.$$.fragment,e),b(vt.$$.fragment,e),b($t.$$.fragment,e),b(Bt.$$.fragment,e),b(Jt.$$.fragment,e),b(Je.$$.fragment,e),b(je.$$.fragment,e),b(jt.$$.fragment,e),b(xe.$$.fragment,e),b(ke.$$.fragment,e),b(xt.$$.fragment,e),b(Ce.$$.fragment,e),b(Ie.$$.fragment,e),b(kt.$$.fragment,e),b(Ue.$$.fragment,e),b(We.$$.fragment,e),b(Ct.$$.fragment,e),b(It.$$.fragment,e),b(Ze.$$.fragment,e),b(Ut.$$.fragment,e),b(ze.$$.fragment,e),b(Fe.$$.fragment,e),b(Pe.$$.fragment,e),b(Ve.$$.fragment,e),b(Re.$$.fragment,e),b(Wt.$$.fragment,e),b(Zt.$$.fragment,e),b(zt.$$.fragment,e),b(Ft.$$.fragment,e),b(Ge.$$.fragment,e),b(qe.$$.fragment,e),b(Pt.$$.fragment,e),b(Vt.$$.fragment,e),b(Rt.$$.fragment,e),b(Xe.$$.fragment,e),b(Qe.$$.fragment,e),b(Nt.$$.fragment,e),b(Gt.$$.fragment,e),b(qt.$$.fragment,e),b(Le.$$.fragment,e),b(Ee.$$.fragment,e),b(Xt.$$.fragment,e),Bo=!1},d(e){e&&(l(g),l(o),l(d),l(n),l(w),l(Nn),l(Gn),l(Ye),l(qn),l(Ae),l(Xn),l(De),l(Qn),l(be),l(Ln),l(Oe),l(En),l(Ke),l(Hn),l(Sn),l(tt),l(Yn),l(nt),l(An),l(Dn),l(st),l(On),l(at),l(Kn),l(rt),l(eo),l(to),l(Z),l(no),l(oo),l(q),l(so),l(ao),l(X),l(ro),l(io),l(z),l(lo),l(co),l(ue),l(po),l(mo),l(ne),l(go),l(uo),l(C),l(ho),l(fo),l(I),l(_o),l(bo),l(F),l(Mo),l(yo),l(P),l(To),l(wo),l(V),l(vo),l($o),l(Rn)),l(t),M(T,e),M(Se,e),M(et,e),M(ot,e),M(it,e),M(lt),M(Me),M(dt),M(ct,e),M(pt),M(Te),M(mt,e),M(gt),M(we),M(ut,e),M(ht),M(ft),M(_t),M(bt,e),M(Mt),M(yt),M(Be),M(Tt,e),M(wt),M(vt),M($t,e),M(Bt),M(Jt),M(Je),M(je),M(jt),M(xe),M(ke),M(xt),M(Ce),M(Ie),M(kt),M(Ue),M(We),M(Ct,e),M(It),M(Ze),M(Ut),M(ze),M(Fe),M(Pe),M(Ve),M(Re),M(Wt),M(Zt,e),M(zt),M(Ft),M(Ge),M(qe),M(Pt,e),M(Vt),M(Rt),M(Xe),M(Qe),M(Nt,e),M(Gt),M(qt),M(Le),M(Ee),M(Xt,e)}}}const Ur='{"title":"BLIP-2","local":"blip-2","sections":[{"title":"Overview","local":"overview","sections":[],"depth":2},{"title":"Usage tips","local":"usage-tips","sections":[],"depth":2},{"title":"Resources","local":"resources","sections":[],"depth":2},{"title":"Blip2Config","local":"transformers.Blip2Config","sections":[],"depth":2},{"title":"Blip2VisionConfig","local":"transformers.Blip2VisionConfig","sections":[],"depth":2},{"title":"Blip2QFormerConfig","local":"transformers.Blip2QFormerConfig","sections":[],"depth":2},{"title":"Blip2Processor","local":"transformers.Blip2Processor","sections":[],"depth":2},{"title":"Blip2VisionModel","local":"transformers.Blip2VisionModel","sections":[],"depth":2},{"title":"Blip2QFormerModel","local":"transformers.Blip2QFormerModel","sections":[],"depth":2},{"title":"Blip2Model","local":"transformers.Blip2Model","sections":[],"depth":2},{"title":"Blip2ForConditionalGeneration","local":"transformers.Blip2ForConditionalGeneration","sections":[],"depth":2},{"title":"Blip2ForImageTextRetrieval","local":"transformers.Blip2ForImageTextRetrieval","sections":[],"depth":2},{"title":"Blip2TextModelWithProjection","local":"transformers.Blip2TextModelWithProjection","sections":[],"depth":2},{"title":"Blip2VisionModelWithProjection","local":"transformers.Blip2VisionModelWithProjection","sections":[],"depth":2}],"depth":1}';function Wr(v){return nr(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Gr extends or{constructor(t){super(),sr(this,t,Wr,Ir,er,{})}}export{Gr as component};
