import{s as dr,f as cr,o as pr,n as x}from"../chunks/scheduler.9bc65507.js";import{S as mr,i as hr,g as a,s as l,u as f,A as gr,h as r,f as o,c as i,j as T,v as _,y as g,k as h,o as n,a as m,w as b,d as v,t as y,x as M}from"../chunks/index.78c82d43.js";import{T as Nt}from"../chunks/Tip.87d55b76.js";import{D as C}from"../chunks/Docstring.4e7352e2.js";import{C as Y}from"../chunks/CodeBlock.73e038be.js";import{I as L}from"../chunks/IconCopyLink.bedaa44d.js";import{E as H}from"../chunks/ExampleCodeBlock.872b014d.js";function ur(B){let t,u="Example:",d,p,w;return p=new Y({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=a("p"),t.textContent=u,d=l(),f(p.$$.fragment)},l(s){t=r(s,"P",{"data-svelte-h":!0}),g(t)!=="svelte-11lpom8"&&(t.textContent=u),d=i(s),_(p.$$.fragment,s)},m(s,$){m(s,t,$),m(s,d,$),b(p,s,$),w=!0},p:x,i(s){w||(v(p.$$.fragment,s),w=!0)},o(s){y(p.$$.fragment,s),w=!1},d(s){s&&(o(t),o(d)),M(p,s)}}}function fr(B){let t,u="Example:",d,p,w;return p=new Y({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=a("p"),t.textContent=u,d=l(),f(p.$$.fragment)},l(s){t=r(s,"P",{"data-svelte-h":!0}),g(t)!=="svelte-11lpom8"&&(t.textContent=u),d=i(s),_(p.$$.fragment,s)},m(s,$){m(s,t,$),m(s,d,$),b(p,s,$),w=!0},p:x,i(s){w||(v(p.$$.fragment,s),w=!0)},o(s){y(p.$$.fragment,s),w=!1},d(s){s&&(o(t),o(d)),M(p,s)}}}function _r(B){let t,u="Examples:",d,p,w;return p=new Y({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=a("p"),t.textContent=u,d=l(),f(p.$$.fragment)},l(s){t=r(s,"P",{"data-svelte-h":!0}),g(t)!=="svelte-kvfsh7"&&(t.textContent=u),d=i(s),_(p.$$.fragment,s)},m(s,$){m(s,t,$),m(s,d,$),b(p,s,$),w=!0},p:x,i(s){w||(v(p.$$.fragment,s),w=!0)},o(s){y(p.$$.fragment,s),w=!1},d(s){s&&(o(t),o(d)),M(p,s)}}}function br(B){let t,u=`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=a("p"),t.innerHTML=u},l(d){t=r(d,"P",{"data-svelte-h":!0}),g(t)!=="svelte-fincs2"&&(t.innerHTML=u)},m(d,p){m(d,t,p)},p:x,d(d){d&&o(t)}}}function vr(B){let t,u=`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=a("p"),t.innerHTML=u},l(d){t=r(d,"P",{"data-svelte-h":!0}),g(t)!=="svelte-fincs2"&&(t.innerHTML=u)},m(d,p){m(d,t,p)},p:x,d(d){d&&o(t)}}}function yr(B){let t,u="Examples:",d,p,w;return p=new Y({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=a("p"),t.textContent=u,d=l(),f(p.$$.fragment)},l(s){t=r(s,"P",{"data-svelte-h":!0}),g(t)!=="svelte-kvfsh7"&&(t.textContent=u),d=i(s),_(p.$$.fragment,s)},m(s,$){m(s,t,$),m(s,d,$),b(p,s,$),w=!0},p:x,i(s){w||(v(p.$$.fragment,s),w=!0)},o(s){y(p.$$.fragment,s),w=!1},d(s){s&&(o(t),o(d)),M(p,s)}}}function Mr(B){let t,u=`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=a("p"),t.innerHTML=u},l(d){t=r(d,"P",{"data-svelte-h":!0}),g(t)!=="svelte-fincs2"&&(t.innerHTML=u)},m(d,p){m(d,t,p)},p:x,d(d){d&&o(t)}}}function wr(B){let t,u="Examples:",d,p,w;return p=new Y({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUyQyUyMEJsaXAyTW9kZWwlMEElMEFkZXZpY2UlMjAlM0QlMjAlMjJjdWRhJTIyJTIwaWYlMjB0b3JjaC5jdWRhLmlzX2F2YWlsYWJsZSgpJTIwZWxzZSUyMCUyMmNwdSUyMiUwQSUwQW1vZGVsJTIwJTNEJTIwQmxpcDJNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyU2FsZXNmb3JjZSUyRmJsaXAyLW9wdC0yLjdiJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2KSUwQSUwQW1vZGVsLnRvKGRldmljZSklMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJTYWxlc2ZvcmNlJTJGYmxpcDItb3B0LTIuN2IlMjIpJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCU1QiUyMmElMjBwaG90byUyMG9mJTIwYSUyMGNhdCUyMiUyQyUyMCUyMmElMjBwaG90byUyMG9mJTIwYSUyMGRvZyUyMiU1RCUyQyUyMHBhZGRpbmclM0RUcnVlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMikudG8oZGV2aWNlKSUwQXRleHRfZmVhdHVyZXMlMjAlM0QlMjBtb2RlbC5nZXRfdGV4dF9mZWF0dXJlcygqKmlucHV0cyk=",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>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 = 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>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>, <span class="hljs-string">&quot;a photo of a dog&quot;</span>], padding=<span class="hljs-literal">True</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).to(device)
<span class="hljs-meta">&gt;&gt;&gt; </span>text_features = model.get_text_features(**inputs)`,wrap:!1}}),{c(){t=a("p"),t.textContent=u,d=l(),f(p.$$.fragment)},l(s){t=r(s,"P",{"data-svelte-h":!0}),g(t)!=="svelte-kvfsh7"&&(t.textContent=u),d=i(s),_(p.$$.fragment,s)},m(s,$){m(s,t,$),m(s,d,$),b(p,s,$),w=!0},p:x,i(s){w||(v(p.$$.fragment,s),w=!0)},o(s){y(p.$$.fragment,s),w=!1},d(s){s&&(o(t),o(d)),M(p,s)}}}function Tr(B){let t,u=`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=a("p"),t.innerHTML=u},l(d){t=r(d,"P",{"data-svelte-h":!0}),g(t)!=="svelte-fincs2"&&(t.innerHTML=u)},m(d,p){m(d,t,p)},p:x,d(d){d&&o(t)}}}function $r(B){let t,u="Examples:",d,p,w;return p=new Y({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEFpbXBvcnQlMjByZXF1ZXN0cyUwQWZyb20lMjB0cmFuc2Zvcm1lcnMlMjBpbXBvcnQlMjBBdXRvUHJvY2Vzc29yJTJDJTIwQmxpcDJNb2RlbCUwQSUwQWRldmljZSUyMCUzRCUyMCUyMmN1ZGElMjIlMjBpZiUyMHRvcmNoLmN1ZGEuaXNfYXZhaWxhYmxlKCklMjBlbHNlJTIwJTIyY3B1JTIyJTBBJTBBbW9kZWwlMjAlM0QlMjBCbGlwMk1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJTYWxlc2ZvcmNlJTJGYmxpcDItb3B0LTIuN2IlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYpJTBBJTBBbW9kZWwudG8oZGV2aWNlKSUwQXByb2Nlc3NvciUyMCUzRCUyMEF1dG9Qcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMlNhbGVzZm9yY2UlMkZibGlwMi1vcHQtMi43YiUyMiklMEF1cmwlMjAlM0QlMjAlMjJodHRwJTNBJTJGJTJGaW1hZ2VzLmNvY29kYXRhc2V0Lm9yZyUyRnZhbDIwMTclMkYwMDAwMDAwMzk3NjkuanBnJTIyJTBBaW1hZ2UlMjAlM0QlMjBJbWFnZS5vcGVuKHJlcXVlc3RzLmdldCh1cmwlMkMlMjBzdHJlYW0lM0RUcnVlKS5yYXcpJTBBaW5wdXRzJTIwJTNEJTIwcHJvY2Vzc29yKGltYWdlcyUzRGltYWdlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMikudG8oZGV2aWNlJTJDJTIwdG9yY2guZmxvYXQxNiklMEFpbWFnZV9vdXRwdXRzJTIwJTNEJTIwbW9kZWwuZ2V0X2ltYWdlX2ZlYXR1cmVzKCoqaW5wdXRzKQ==",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>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 = 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>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>).to(device, torch.float16)
<span class="hljs-meta">&gt;&gt;&gt; </span>image_outputs = model.get_image_features(**inputs)`,wrap:!1}}),{c(){t=a("p"),t.textContent=u,d=l(),f(p.$$.fragment)},l(s){t=r(s,"P",{"data-svelte-h":!0}),g(t)!=="svelte-kvfsh7"&&(t.textContent=u),d=i(s),_(p.$$.fragment,s)},m(s,$){m(s,t,$),m(s,d,$),b(p,s,$),w=!0},p:x,i(s){w||(v(p.$$.fragment,s),w=!0)},o(s){y(p.$$.fragment,s),w=!1},d(s){s&&(o(t),o(d)),M(p,s)}}}function Br(B){let t,u=`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=a("p"),t.innerHTML=u},l(d){t=r(d,"P",{"data-svelte-h":!0}),g(t)!=="svelte-fincs2"&&(t.innerHTML=u)},m(d,p){m(d,t,p)},p:x,d(d){d&&o(t)}}}function Jr(B){let t,u="Examples:",d,p,w;return p=new Y({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEFpbXBvcnQlMjByZXF1ZXN0cyUwQWZyb20lMjB0cmFuc2Zvcm1lcnMlMjBpbXBvcnQlMjBCbGlwMlByb2Nlc3NvciUyQyUyMEJsaXAyTW9kZWwlMEElMEFkZXZpY2UlMjAlM0QlMjAlMjJjdWRhJTIyJTIwaWYlMjB0b3JjaC5jdWRhLmlzX2F2YWlsYWJsZSgpJTIwZWxzZSUyMCUyMmNwdSUyMiUwQSUwQXByb2Nlc3NvciUyMCUzRCUyMEJsaXAyUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJTYWxlc2ZvcmNlJTJGYmxpcDItb3B0LTIuN2IlMjIpJTBBbW9kZWwlMjAlM0QlMjBCbGlwMk1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJTYWxlc2ZvcmNlJTJGYmxpcDItb3B0LTIuN2IlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYpJTBBbW9kZWwudG8oZGV2aWNlKSUwQXVybCUyMCUzRCUyMCUyMmh0dHAlM0ElMkYlMkZpbWFnZXMuY29jb2RhdGFzZXQub3JnJTJGdmFsMjAxNyUyRjAwMDAwMDAzOTc2OS5qcGclMjIlMEFpbWFnZSUyMCUzRCUyMEltYWdlLm9wZW4ocmVxdWVzdHMuZ2V0KHVybCUyQyUyMHN0cmVhbSUzRFRydWUpLnJhdyklMEFpbnB1dHMlMjAlM0QlMjBwcm9jZXNzb3IoaW1hZ2VzJTNEaW1hZ2UlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKS50byhkZXZpY2UlMkMlMjB0b3JjaC5mbG9hdDE2KSUwQXFmb3JtZXJfb3V0cHV0cyUyMCUzRCUyMG1vZGVsLmdldF9xZm9ybWVyX2ZlYXR1cmVzKCoqaW5wdXRzKQ==",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>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>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>qformer_outputs = model.get_qformer_features(**inputs)`,wrap:!1}}),{c(){t=a("p"),t.textContent=u,d=l(),f(p.$$.fragment)},l(s){t=r(s,"P",{"data-svelte-h":!0}),g(t)!=="svelte-kvfsh7"&&(t.textContent=u),d=i(s),_(p.$$.fragment,s)},m(s,$){m(s,t,$),m(s,d,$),b(p,s,$),w=!0},p:x,i(s){w||(v(p.$$.fragment,s),w=!0)},o(s){y(p.$$.fragment,s),w=!1},d(s){s&&(o(t),o(d)),M(p,s)}}}function jr(B){let t,u="Note that Flan-T5 checkpoints cannot be cast to float16. They are pre-trained using bfloat16.";return{c(){t=a("p"),t.textContent=u},l(d){t=r(d,"P",{"data-svelte-h":!0}),g(t)!=="svelte-1cxmmi2"&&(t.textContent=u)},m(d,p){m(d,t,p)},p:x,d(d){d&&o(t)}}}function kr(B){let t,u=`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=a("p"),t.innerHTML=u},l(d){t=r(d,"P",{"data-svelte-h":!0}),g(t)!=="svelte-fincs2"&&(t.innerHTML=u)},m(d,p){m(d,t,p)},p:x,d(d){d&&o(t)}}}function Cr(B){let t,u="Image captioning (without providing a text prompt):",d,p,w;return p=new Y({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQmxpcDJQcm9jZXNzb3IlMkMlMjBCbGlwMkZvckNvbmRpdGlvbmFsR2VuZXJhdGlvbiUwQWltcG9ydCUyMHRvcmNoJTBBJTBBZGV2aWNlJTIwJTNEJTIwJTIyY3VkYSUyMiUyMGlmJTIwdG9yY2guY3VkYS5pc19hdmFpbGFibGUoKSUyMGVsc2UlMjAlMjJjcHUlMjIlMEElMEFwcm9jZXNzb3IlMjAlM0QlMjBCbGlwMlByb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyU2FsZXNmb3JjZSUyRmJsaXAyLW9wdC0yLjdiJTIyKSUwQW1vZGVsJTIwJTNEJTIwQmxpcDJGb3JDb25kaXRpb25hbEdlbmVyYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMlNhbGVzZm9yY2UlMkZibGlwMi1vcHQtMi43YiUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUwQSklMEFtb2RlbC50byhkZXZpY2UpJTBBdXJsJTIwJTNEJTIwJTIyaHR0cCUzQSUyRiUyRmltYWdlcy5jb2NvZGF0YXNldC5vcmclMkZ2YWwyMDE3JTJGMDAwMDAwMDM5NzY5LmpwZyUyMiUwQWltYWdlJTIwJTNEJTIwSW1hZ2Uub3BlbihyZXF1ZXN0cy5nZXQodXJsJTJDJTIwc3RyZWFtJTNEVHJ1ZSkucmF3KSUwQSUwQWlucHV0cyUyMCUzRCUyMHByb2Nlc3NvcihpbWFnZXMlM0RpbWFnZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpLnRvKGRldmljZSUyQyUyMHRvcmNoLmZsb2F0MTYpJTBBJTBBZ2VuZXJhdGVkX2lkcyUyMCUzRCUyMG1vZGVsLmdlbmVyYXRlKCoqaW5wdXRzKSUwQWdlbmVyYXRlZF90ZXh0JTIwJTNEJTIwcHJvY2Vzc29yLmJhdGNoX2RlY29kZShnZW5lcmF0ZWRfaWRzJTJDJTIwc2tpcF9zcGVjaWFsX3Rva2VucyUzRFRydWUpJTVCMCU1RC5zdHJpcCgpJTBBcHJpbnQoZ2VuZXJhdGVkX3RleHQp",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>, 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>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=a("p"),t.textContent=u,d=l(),f(p.$$.fragment)},l(s){t=r(s,"P",{"data-svelte-h":!0}),g(t)!=="svelte-1xz2grm"&&(t.textContent=u),d=i(s),_(p.$$.fragment,s)},m(s,$){m(s,t,$),m(s,d,$),b(p,s,$),w=!0},p:x,i(s){w||(v(p.$$.fragment,s),w=!0)},o(s){y(p.$$.fragment,s),w=!1},d(s){s&&(o(t),o(d)),M(p,s)}}}function xr(B){let t,u="Visual question answering (prompt = question):",d,p,w;return p=new Y({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQmxpcDJQcm9jZXNzb3IlMkMlMjBCbGlwMkZvckNvbmRpdGlvbmFsR2VuZXJhdGlvbiUwQWltcG9ydCUyMHRvcmNoJTBBJTBBZGV2aWNlJTIwJTNEJTIwJTIyY3VkYSUyMiUyMGlmJTIwdG9yY2guY3VkYS5pc19hdmFpbGFibGUoKSUyMGVsc2UlMjAlMjJjcHUlMjIlMEElMEFwcm9jZXNzb3IlMjAlM0QlMjBCbGlwMlByb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyU2FsZXNmb3JjZSUyRmJsaXAyLW9wdC0yLjdiJTIyKSUwQW1vZGVsJTIwJTNEJTIwQmxpcDJGb3JDb25kaXRpb25hbEdlbmVyYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMlNhbGVzZm9yY2UlMkZibGlwMi1vcHQtMi43YiUyMiUyQyUyMGxvYWRfaW5fOGJpdCUzRFRydWUlMkMlMjBkZXZpY2VfbWFwJTNEJTdCJTIyJTIyJTNBJTIwMCU3RCUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUwQSklMjAlMjAlMjMlMjBkb2N0ZXN0JTNBJTIwJTJCSUdOT1JFX1JFU1VMVCUwQSUwQXVybCUyMCUzRCUyMCUyMmh0dHAlM0ElMkYlMkZpbWFnZXMuY29jb2RhdGFzZXQub3JnJTJGdmFsMjAxNyUyRjAwMDAwMDAzOTc2OS5qcGclMjIlMEFpbWFnZSUyMCUzRCUyMEltYWdlLm9wZW4ocmVxdWVzdHMuZ2V0KHVybCUyQyUyMHN0cmVhbSUzRFRydWUpLnJhdyklMEElMEFwcm9tcHQlMjAlM0QlMjAlMjJRdWVzdGlvbiUzQSUyMGhvdyUyMG1hbnklMjBjYXRzJTIwYXJlJTIwdGhlcmUlM0YlMjBBbnN3ZXIlM0ElMjIlMEFpbnB1dHMlMjAlM0QlMjBwcm9jZXNzb3IoaW1hZ2VzJTNEaW1hZ2UlMkMlMjB0ZXh0JTNEcHJvbXB0JTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMikudG8oZGV2aWNlJTNEJTIyY3VkYSUyMiUyQyUyMGR0eXBlJTNEdG9yY2guZmxvYXQxNiklMEElMEFnZW5lcmF0ZWRfaWRzJTIwJTNEJTIwbW9kZWwuZ2VuZXJhdGUoKippbnB1dHMpJTBBZ2VuZXJhdGVkX3RleHQlMjAlM0QlMjBwcm9jZXNzb3IuYmF0Y2hfZGVjb2RlKGdlbmVyYXRlZF9pZHMlMkMlMjBza2lwX3NwZWNpYWxfdG9rZW5zJTNEVHJ1ZSklNUIwJTVELnN0cmlwKCklMEFwcmludChnZW5lcmF0ZWRfdGV4dCk=",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)

<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=a("p"),t.textContent=u,d=l(),f(p.$$.fragment)},l(s){t=r(s,"P",{"data-svelte-h":!0}),g(t)!=="svelte-dkukz2"&&(t.textContent=u),d=i(s),_(p.$$.fragment,s)},m(s,$){m(s,t,$),m(s,d,$),b(p,s,$),w=!0},p:x,i(s){w||(v(p.$$.fragment,s),w=!0)},o(s){y(p.$$.fragment,s),w=!1},d(s){s&&(o(t),o(d)),M(p,s)}}}function Ur(B){let t,u;return t=new Y({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQmxpcDJQcm9jZXNzb3IlMkMlMjBCbGlwMkZvckNvbmRpdGlvbmFsR2VuZXJhdGlvbiUwQWltcG9ydCUyMHRvcmNoJTBBJTBBcHJvY2Vzc29yJTIwJTNEJTIwQmxpcDJQcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMlNhbGVzZm9yY2UlMkZibGlwMi1mbGFuLXQ1LXhsJTIyKSUwQW1vZGVsJTIwJTNEJTIwQmxpcDJGb3JDb25kaXRpb25hbEdlbmVyYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMlNhbGVzZm9yY2UlMkZibGlwMi1mbGFuLXQ1LXhsJTIyJTJDJTIwbG9hZF9pbl84Yml0JTNEVHJ1ZSUyQyUyMGRldmljZV9tYXAlM0QlN0IlMjIlMjIlM0ElMjAwJTdEJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5iZmxvYXQxNiUwQSklMjAlMjAlMjMlMjBkb2N0ZXN0JTNBJTIwJTJCSUdOT1JFX1JFU1VMVCUwQSUwQXVybCUyMCUzRCUyMCUyMmh0dHAlM0ElMkYlMkZpbWFnZXMuY29jb2RhdGFzZXQub3JnJTJGdmFsMjAxNyUyRjAwMDAwMDAzOTc2OS5qcGclMjIlMEFpbWFnZSUyMCUzRCUyMEltYWdlLm9wZW4ocmVxdWVzdHMuZ2V0KHVybCUyQyUyMHN0cmVhbSUzRFRydWUpLnJhdyklMEElMEFwcm9tcHQlMjAlM0QlMjAlMjJRdWVzdGlvbiUzQSUyMGhvdyUyMG1hbnklMjBjYXRzJTIwYXJlJTIwdGhlcmUlM0YlMjBBbnN3ZXIlM0ElMjIlMEFpbnB1dHMlMjAlM0QlMjBwcm9jZXNzb3IoaW1hZ2VzJTNEaW1hZ2UlMkMlMjB0ZXh0JTNEcHJvbXB0JTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMikudG8oZGV2aWNlJTNEJTIyY3VkYSUyMiUyQyUyMGR0eXBlJTNEdG9yY2guYmZsb2F0MTYpJTBBJTBBZ2VuZXJhdGVkX2lkcyUyMCUzRCUyMG1vZGVsLmdlbmVyYXRlKCoqaW5wdXRzKSUwQWdlbmVyYXRlZF90ZXh0JTIwJTNEJTIwcHJvY2Vzc29yLmJhdGNoX2RlY29kZShnZW5lcmF0ZWRfaWRzJTJDJTIwc2tpcF9zcGVjaWFsX3Rva2VucyUzRFRydWUpJTVCMCU1RC5zdHJpcCgpJTBBcHJpbnQoZ2VuZXJhdGVkX3RleHQp",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>processor = Blip2Processor.from_pretrained(<span class="hljs-string">&quot;Salesforce/blip2-flan-t5-xl&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-flan-t5-xl&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>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=<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(){f(t.$$.fragment)},l(d){_(t.$$.fragment,d)},m(d,p){b(t,d,p),u=!0},p:x,i(d){u||(v(t.$$.fragment,d),u=!0)},o(d){y(t.$$.fragment,d),u=!1},d(d){M(t,d)}}}function Zr(B){let t,u,d,p,w,s,$,Xe,Gn,Gt,Ks="BLIP-2",Ao,A,le,Co,Re,Vn,Vt,ea="Overview",Do,Se,ta=`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.`,Oo,He,oa="The abstract from the paper is the following:",Ko,Ye,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>",en,Ae,sa="Tips:",tn,De,aa='<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/v4.34.0/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>',on,ie,ra,nn,Oe,la='BLIP-2 architecture. Taken from the <a href="https://arxiv.org/abs/2301.12597">original paper.</a>',sn,Ke,ia=`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>.`,an,D,de,xo,et,qn,qt,da="Resources",rn,tt,ca="A list of official Hugging Face and community (indicated by 🌎) resources to help you get started with BLIP-2.",ln,ot,pa='<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>',dn,nt,ma="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.",cn,O,ce,Uo,st,Pn,Pt,ha="Blip2Config",pn,z,at,Qn,Qt,ga=`<a href="/docs/transformers/v4.34.0/en/model_doc/blip-2#transformers.Blip2Config">Blip2Config</a> is the configuration class to store the configuration of a <a href="/docs/transformers/v4.34.0/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.`,En,Et,ua=`Configuration objects inherit from <a href="/docs/transformers/v4.34.0/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/v4.34.0/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,Ln,pe,Xn,me,rt,Rn,Lt,fa=`Instantiate a <a href="/docs/transformers/v4.34.0/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.`,mn,K,he,Zo,lt,Sn,Xt,_a="Blip2VisionConfig",hn,F,it,Hn,Rt,ba=`This is the configuration class to store the configuration of a <a href="/docs/transformers/v4.34.0/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.`,Yn,St,va=`Configuration objects inherit from <a href="/docs/transformers/v4.34.0/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/v4.34.0/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,An,ge,gn,ee,ue,Io,dt,Dn,Ht,ya="Blip2QFormerConfig",un,N,ct,On,Yt,Ma=`This is the configuration class to store the configuration of a <a href="/docs/transformers/v4.34.0/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/v4.34.0/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/v4.34.0/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,Kn,At,wa='Note that <a href="/docs/transformers/v4.34.0/en/model_doc/blip-2#transformers.Blip2QFormerModel">Blip2QFormerModel</a> is very similar to <a href="/docs/transformers/v4.34.0/en/model_doc/bert#transformers.BertLMHeadModel">BertLMHeadModel</a> with interleaved cross-attention.',es,fe,fn,te,_e,zo,pt,ts,Dt,Ta="Blip2Processor",_n,W,mt,os,Ot,$a="Constructs a BLIP-2 processor which wraps a BLIP image processor and an OPT/T5 tokenizer into a single processor.",ns,Kt,Ba=`<a href="/docs/transformers/v4.34.0/en/model_doc/blip#transformers.BlipProcessor">BlipProcessor</a> offers all the functionalities of <a href="/docs/transformers/v4.34.0/en/model_doc/blip#transformers.BlipImageProcessor">BlipImageProcessor</a> and <a href="/docs/transformers/v4.34.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See the docstring
of <code>__call__()</code> and <a href="/docs/transformers/v4.34.0/en/model_doc/blip#transformers.BlipProcessor.decode">decode()</a> for more information.`,ss,be,ht,as,eo,Ja=`This method forwards all its arguments to PreTrainedTokenizer’s <a href="/docs/transformers/v4.34.0/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.batch_decode">batch_decode()</a>. Please
refer to the docstring of this method for more information.`,rs,ve,gt,ls,to,ja=`This method forwards all its arguments to PreTrainedTokenizer’s <a href="/docs/transformers/v4.34.0/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.decode">decode()</a>. Please refer
to the docstring of this method for more information.`,bn,oe,ye,Wo,ut,is,oo,ka="Blip2VisionModel",vn,ne,ft,ds,X,_t,cs,no,Ca='The <a href="/docs/transformers/v4.34.0/en/model_doc/blip-2#transformers.Blip2VisionModel">Blip2VisionModel</a> forward method, overrides the <code>__call__</code> special method.',ps,Me,yn,se,we,Fo,bt,ms,so,xa="Blip2QFormerModel",Mn,E,vt,hs,ao,Ua="Querying Transformer (Q-Former), used in BLIP-2.",gs,R,yt,us,ro,Za=`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>:`,fs,lo,Ia=`<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>`,wn,ae,Te,No,Mt,_s,io,za="Blip2Model",Tn,J,wt,bs,co,Wa=`BLIP-2 Model for generating text and image features. The model consists of a vision encoder, Querying Transformer
(Q-Former) and a language model.`,vs,po,Fa=`This model inherits from <a href="/docs/transformers/v4.34.0/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.)`,ys,mo,Na=`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.`,Ms,V,Tt,ws,ho,Ga='The <a href="/docs/transformers/v4.34.0/en/model_doc/blip-2#transformers.Blip2Model">Blip2Model</a> forward method, overrides the <code>__call__</code> special method.',Ts,$e,$s,Be,Bs,q,$t,Js,go,Va='The <a href="/docs/transformers/v4.34.0/en/model_doc/blip-2#transformers.Blip2Model">Blip2Model</a> forward method, overrides the <code>__call__</code> special method.',js,Je,ks,je,Cs,P,Bt,xs,uo,qa='The <a href="/docs/transformers/v4.34.0/en/model_doc/blip-2#transformers.Blip2Model">Blip2Model</a> forward method, overrides the <code>__call__</code> special method.',Us,ke,Zs,Ce,Is,Q,Jt,zs,fo,Pa='The <a href="/docs/transformers/v4.34.0/en/model_doc/blip-2#transformers.Blip2Model">Blip2Model</a> forward method, overrides the <code>__call__</code> special method.',Ws,xe,Fs,Ue,$n,re,Ze,Go,jt,Ns,_o,Qa="Blip2ForConditionalGeneration",Bn,j,kt,Gs,bo,Ea=`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.`,Vs,vo,La=`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.`,qs,Ie,Ps,yo,Xa=`This model inherits from <a href="/docs/transformers/v4.34.0/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.)`,Qs,Mo,Ra=`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.`,Es,k,Ct,Ls,wo,Sa='The <a href="/docs/transformers/v4.34.0/en/model_doc/blip-2#transformers.Blip2ForConditionalGeneration">Blip2ForConditionalGeneration</a> forward method, overrides the <code>__call__</code> special method.',Xs,ze,Rs,To,Ha="Examples:",Ss,We,Hs,Fe,Ys,$o,Ya=`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.`,As,Ne,Ds,Ge,xt,Os,Bo,Aa="Overrides <code>generate</code> function to be able to use the model as a conditional generator.",Jn,Vo,jn;return Xe=new L({}),Re=new L({}),et=new L({}),st=new L({}),at=new C({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:"**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/v4.34.0/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/v4.34.0/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/v4.34.0/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.kwargs",description:`<strong>kwargs</strong> (<em>optional</em>) &#x2014;
Dictionary of keyword arguments.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/v4.34.0/src/transformers/models/blip_2/configuration_blip_2.py#L250"}}),pe=new H({props:{anchor:"transformers.Blip2Config.example",$$slots:{default:[ur]},$$scope:{ctx:B}}}),rt=new C({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:": PretrainedConfig"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.34.0/src/transformers/models/blip_2/configuration_blip_2.py#L334",returnDescription:`
<p>An instance of a configuration object</p>
`,returnType:`
<p><a
  href="/docs/transformers/v4.34.0/en/model_doc/blip-2#transformers.Blip2Config"
>Blip2Config</a></p>
`}}),lt=new L({}),it=new C({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/v4.34.0/src/transformers/models/blip_2/configuration_blip_2.py#L33"}}),ge=new H({props:{anchor:"transformers.Blip2VisionConfig.example",$$slots:{default:[fr]},$$scope:{ctx:B}}}),dt=new L({}),ct=new C({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:"**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"}],source:"https://github.com/huggingface/transformers/blob/v4.34.0/src/transformers/models/blip_2/configuration_blip_2.py#L132"}}),fe=new H({props:{anchor:"transformers.Blip2QFormerConfig.example",$$slots:{default:[_r]},$$scope:{ctx:B}}}),pt=new L({}),mt=new C({props:{name:"class transformers.Blip2Processor",anchor:"transformers.Blip2Processor",parameters:[{name:"image_processor",val:""},{name:"tokenizer",val:""}],parametersDescription:[{anchor:"transformers.Blip2Processor.image_processor",description:`<strong>image_processor</strong> (<code>BlipImageProcessor</code>) &#x2014;
An instance of <a href="/docs/transformers/v4.34.0/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"}],source:"https://github.com/huggingface/transformers/blob/v4.34.0/src/transformers/models/blip_2/processing_blip_2.py#L27"}}),ht=new C({props:{name:"batch_decode",anchor:"transformers.Blip2Processor.batch_decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.34.0/src/transformers/models/blip_2/processing_blip_2.py#L134"}}),gt=new C({props:{name:"decode",anchor:"transformers.Blip2Processor.decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.34.0/src/transformers/models/blip_2/processing_blip_2.py#L142"}}),ut=new L({}),ft=new C({props:{name:"class transformers.Blip2VisionModel",anchor:"transformers.Blip2VisionModel",parameters:[{name:"config",val:": Blip2VisionConfig"}],source:"https://github.com/huggingface/transformers/blob/v4.34.0/src/transformers/models/blip_2/modeling_blip_2.py#L511"}}),_t=new C({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"}],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/v4.34.0/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/v4.34.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.34.0/src/transformers/models/blip_2/modeling_blip_2.py#L526",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.34.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<code>&lt;class 'transformers.models.blip_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:`
<p><a
  href="/docs/transformers/v4.34.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Me=new Nt({props:{$$slots:{default:[br]},$$scope:{ctx:B}}}),bt=new L({}),vt=new C({props:{name:"class transformers.Blip2QFormerModel",anchor:"transformers.Blip2QFormerModel",parameters:[{name:"config",val:": Blip2QFormerConfig"}],source:"https://github.com/huggingface/transformers/blob/v4.34.0/src/transformers/models/blip_2/modeling_blip_2.py#L1006"}}),yt=new C({props:{name:"forward",anchor:"transformers.Blip2QFormerModel.forward",parameters:[{name:"query_embeds",val:": FloatTensor"},{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/v4.34.0/src/transformers/models/blip_2/modeling_blip_2.py#L1081"}}),Mt=new L({}),wt=new C({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/v4.34.0/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/v4.34.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.34.0/src/transformers/models/blip_2/modeling_blip_2.py#L1202"}}),Tt=new C({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"}],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/v4.34.0/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/v4.34.0/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/v4.34.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.34.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.34.0/en/model_doc/vits#transformers.VitsTokenizer.__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/v4.34.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.34.0/src/transformers/models/blip_2/modeling_blip_2.py#L1425",returnDescription:`
<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:`
<p><code>transformers.models.blip_2.modeling_blip_2.Blip2ForConditionalGenerationModelOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),$e=new Nt({props:{$$slots:{default:[vr]},$$scope:{ctx:B}}}),Be=new H({props:{anchor:"transformers.Blip2Model.forward.example",$$slots:{default:[yr]},$$scope:{ctx:B}}}),$t=new C({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/v4.34.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.34.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.34.0/en/model_doc/vits#transformers.VitsTokenizer.__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/v4.34.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.34.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.34.0/en/model_doc/vits#transformers.VitsTokenizer.__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/v4.34.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.34.0/src/transformers/models/blip_2/modeling_blip_2.py#L1252",returnDescription:`
<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:`
<p>text_outputs (<code>CausalLMOutputWithPast</code>, or <code>tuple(torch.FloatTensor)</code> if <code>return_dict=False</code>)</p>
`}}),Je=new Nt({props:{$$slots:{default:[Mr]},$$scope:{ctx:B}}}),je=new H({props:{anchor:"transformers.Blip2Model.get_text_features.example",$$slots:{default:[wr]},$$scope:{ctx:B}}}),Bt=new C({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"}],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/v4.34.0/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/v4.34.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.34.0/src/transformers/models/blip_2/modeling_blip_2.py#L1315",returnDescription:`
<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:`
<p>vision_outputs (<code>BaseModelOutputWithPooling</code> or tuple of <code>torch.FloatTensor</code>)</p>
`}}),ke=new Nt({props:{$$slots:{default:[Tr]},$$scope:{ctx:B}}}),Ce=new H({props:{anchor:"transformers.Blip2Model.get_image_features.example",$$slots:{default:[$r]},$$scope:{ctx:B}}}),Jt=new C({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"}],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/v4.34.0/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/v4.34.0/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/v4.34.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.34.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.34.0/en/model_doc/vits#transformers.VitsTokenizer.__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/v4.34.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.34.0/src/transformers/models/blip_2/modeling_blip_2.py#L1363",returnDescription:`
<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:`
<p>vision_outputs (<code>BaseModelOutputWithPooling</code> or tuple of <code>torch.FloatTensor</code>)</p>
`}}),xe=new Nt({props:{$$slots:{default:[Br]},$$scope:{ctx:B}}}),Ue=new H({props:{anchor:"transformers.Blip2Model.get_qformer_features.example",$$slots:{default:[Jr]},$$scope:{ctx:B}}}),jt=new L({}),kt=new C({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/v4.34.0/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/v4.34.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.34.0/src/transformers/models/blip_2/modeling_blip_2.py#L1568"}}),Ie=new Nt({props:{$$slots:{default:[jr]},$$scope:{ctx:B}}}),Ct=new C({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"}],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/v4.34.0/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/v4.34.0/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/v4.34.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.34.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.34.0/en/model_doc/vits#transformers.VitsTokenizer.__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/v4.34.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.34.0/src/transformers/models/blip_2/modeling_blip_2.py#L1638",returnDescription:`
<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:`
<p><code>transformers.models.blip_2.modeling_blip_2.Blip2ForConditionalGenerationModelOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ze=new Nt({props:{$$slots:{default:[kr]},$$scope:{ctx:B}}}),We=new H({props:{anchor:"transformers.Blip2ForConditionalGeneration.forward.example",$$slots:{default:[Cr]},$$scope:{ctx:B}}}),Fe=new H({props:{anchor:"transformers.Blip2ForConditionalGeneration.forward.example-2",$$slots:{default:[xr]},$$scope:{ctx:B}}}),Ne=new H({props:{anchor:"transformers.Blip2ForConditionalGeneration.forward.example-3",$$slots:{default:[Ur]},$$scope:{ctx:B}}}),xt=new C({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:"**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/v4.34.0/src/transformers/models/blip_2/modeling_blip_2.py#L1823",returnDescription:`
<p>A list of strings of length batch_size * num_captions.</p>
`,returnType:`
<p>captions (list)</p>
`}}),{c(){t=a("meta"),u=l(),d=a("p"),p=l(),w=a("h1"),s=a("a"),$=a("span"),f(Xe.$$.fragment),Gn=l(),Gt=a("span"),Gt.textContent=Ks,Ao=l(),A=a("h2"),le=a("a"),Co=a("span"),f(Re.$$.fragment),Vn=l(),Vt=a("span"),Vt.textContent=ea,Do=l(),Se=a("p"),Se.innerHTML=ta,Oo=l(),He=a("p"),He.textContent=oa,Ko=l(),Ye=a("p"),Ye.innerHTML=na,en=l(),Ae=a("p"),Ae.textContent=sa,tn=l(),De=a("ul"),De.innerHTML=aa,on=l(),ie=a("img"),nn=l(),Oe=a("small"),Oe.innerHTML=la,sn=l(),Ke=a("p"),Ke.innerHTML=ia,an=l(),D=a("h2"),de=a("a"),xo=a("span"),f(et.$$.fragment),qn=l(),qt=a("span"),qt.textContent=da,rn=l(),tt=a("p"),tt.textContent=ca,ln=l(),ot=a("ul"),ot.innerHTML=pa,dn=l(),nt=a("p"),nt.textContent=ma,cn=l(),O=a("h2"),ce=a("a"),Uo=a("span"),f(st.$$.fragment),Pn=l(),Pt=a("span"),Pt.textContent=ha,pn=l(),z=a("div"),f(at.$$.fragment),Qn=l(),Qt=a("p"),Qt.innerHTML=ga,En=l(),Et=a("p"),Et.innerHTML=ua,Ln=l(),f(pe.$$.fragment),Xn=l(),me=a("div"),f(rt.$$.fragment),Rn=l(),Lt=a("p"),Lt.innerHTML=fa,mn=l(),K=a("h2"),he=a("a"),Zo=a("span"),f(lt.$$.fragment),Sn=l(),Xt=a("span"),Xt.textContent=_a,hn=l(),F=a("div"),f(it.$$.fragment),Hn=l(),Rt=a("p"),Rt.innerHTML=ba,Yn=l(),St=a("p"),St.innerHTML=va,An=l(),f(ge.$$.fragment),gn=l(),ee=a("h2"),ue=a("a"),Io=a("span"),f(dt.$$.fragment),Dn=l(),Ht=a("span"),Ht.textContent=ya,un=l(),N=a("div"),f(ct.$$.fragment),On=l(),Yt=a("p"),Yt.innerHTML=Ma,Kn=l(),At=a("p"),At.innerHTML=wa,es=l(),f(fe.$$.fragment),fn=l(),te=a("h2"),_e=a("a"),zo=a("span"),f(pt.$$.fragment),ts=l(),Dt=a("span"),Dt.textContent=Ta,_n=l(),W=a("div"),f(mt.$$.fragment),os=l(),Ot=a("p"),Ot.textContent=$a,ns=l(),Kt=a("p"),Kt.innerHTML=Ba,ss=l(),be=a("div"),f(ht.$$.fragment),as=l(),eo=a("p"),eo.innerHTML=Ja,rs=l(),ve=a("div"),f(gt.$$.fragment),ls=l(),to=a("p"),to.innerHTML=ja,bn=l(),oe=a("h2"),ye=a("a"),Wo=a("span"),f(ut.$$.fragment),is=l(),oo=a("span"),oo.textContent=ka,vn=l(),ne=a("div"),f(ft.$$.fragment),ds=l(),X=a("div"),f(_t.$$.fragment),cs=l(),no=a("p"),no.innerHTML=Ca,ps=l(),f(Me.$$.fragment),yn=l(),se=a("h2"),we=a("a"),Fo=a("span"),f(bt.$$.fragment),ms=l(),so=a("span"),so.textContent=xa,Mn=l(),E=a("div"),f(vt.$$.fragment),hs=l(),ao=a("p"),ao.textContent=Ua,gs=l(),R=a("div"),f(yt.$$.fragment),us=l(),ro=a("p"),ro.innerHTML=Za,fs=l(),lo=a("ul"),lo.innerHTML=Ia,wn=l(),ae=a("h2"),Te=a("a"),No=a("span"),f(Mt.$$.fragment),_s=l(),io=a("span"),io.textContent=za,Tn=l(),J=a("div"),f(wt.$$.fragment),bs=l(),co=a("p"),co.textContent=Wa,vs=l(),po=a("p"),po.innerHTML=Fa,ys=l(),mo=a("p"),mo.innerHTML=Na,Ms=l(),V=a("div"),f(Tt.$$.fragment),ws=l(),ho=a("p"),ho.innerHTML=Ga,Ts=l(),f($e.$$.fragment),$s=l(),f(Be.$$.fragment),Bs=l(),q=a("div"),f($t.$$.fragment),Js=l(),go=a("p"),go.innerHTML=Va,js=l(),f(Je.$$.fragment),ks=l(),f(je.$$.fragment),Cs=l(),P=a("div"),f(Bt.$$.fragment),xs=l(),uo=a("p"),uo.innerHTML=qa,Us=l(),f(ke.$$.fragment),Zs=l(),f(Ce.$$.fragment),Is=l(),Q=a("div"),f(Jt.$$.fragment),zs=l(),fo=a("p"),fo.innerHTML=Pa,Ws=l(),f(xe.$$.fragment),Fs=l(),f(Ue.$$.fragment),$n=l(),re=a("h2"),Ze=a("a"),Go=a("span"),f(jt.$$.fragment),Ns=l(),_o=a("span"),_o.textContent=Qa,Bn=l(),j=a("div"),f(kt.$$.fragment),Gs=l(),bo=a("p"),bo.textContent=Ea,Vs=l(),vo=a("p"),vo.innerHTML=La,qs=l(),f(Ie.$$.fragment),Ps=l(),yo=a("p"),yo.innerHTML=Xa,Qs=l(),Mo=a("p"),Mo.innerHTML=Ra,Es=l(),k=a("div"),f(Ct.$$.fragment),Ls=l(),wo=a("p"),wo.innerHTML=Sa,Xs=l(),f(ze.$$.fragment),Rs=l(),To=a("p"),To.textContent=Ha,Ss=l(),f(We.$$.fragment),Hs=l(),f(Fe.$$.fragment),Ys=l(),$o=a("p"),$o.innerHTML=Ya,As=l(),f(Ne.$$.fragment),Ds=l(),Ge=a("div"),f(xt.$$.fragment),Os=l(),Bo=a("p"),Bo.innerHTML=Aa,Jn=l(),Vo=a("p"),this.h()},l(e){const c=gr("svelte-1phssyn",document.head);t=r(c,"META",{name:!0,content:!0}),c.forEach(o),u=i(e),d=r(e,"P",{}),T(d).forEach(o),p=i(e),w=r(e,"H1",{class:!0});var Ut=T(w);s=r(Ut,"A",{id:!0,class:!0,href:!0});var qo=T(s);$=r(qo,"SPAN",{});var Po=T($);_(Xe.$$.fragment,Po),Po.forEach(o),qo.forEach(o),Gn=i(Ut),Gt=r(Ut,"SPAN",{"data-svelte-h":!0}),g(Gt)!=="svelte-1ng884h"&&(Gt.textContent=Ks),Ut.forEach(o),Ao=i(e),A=r(e,"H2",{class:!0});var Zt=T(A);le=r(Zt,"A",{id:!0,class:!0,href:!0});var Qo=T(le);Co=r(Qo,"SPAN",{});var Eo=T(Co);_(Re.$$.fragment,Eo),Eo.forEach(o),Qo.forEach(o),Vn=i(Zt),Vt=r(Zt,"SPAN",{"data-svelte-h":!0}),g(Vt)!=="svelte-1jsw1pg"&&(Vt.textContent=ea),Zt.forEach(o),Do=i(e),Se=r(e,"P",{"data-svelte-h":!0}),g(Se)!=="svelte-1tx2g06"&&(Se.innerHTML=ta),Oo=i(e),He=r(e,"P",{"data-svelte-h":!0}),g(He)!=="svelte-vfdo9a"&&(He.textContent=oa),Ko=i(e),Ye=r(e,"P",{"data-svelte-h":!0}),g(Ye)!=="svelte-k65nu1"&&(Ye.innerHTML=na),en=i(e),Ae=r(e,"P",{"data-svelte-h":!0}),g(Ae)!=="svelte-axv494"&&(Ae.textContent=sa),tn=i(e),De=r(e,"UL",{"data-svelte-h":!0}),g(De)!=="svelte-1b3kt34"&&(De.innerHTML=aa),on=i(e),ie=r(e,"IMG",{src:!0,alt:!0,width:!0}),nn=i(e),Oe=r(e,"SMALL",{"data-svelte-h":!0}),g(Oe)!=="svelte-1f3k680"&&(Oe.innerHTML=la),sn=i(e),Ke=r(e,"P",{"data-svelte-h":!0}),g(Ke)!=="svelte-1xpociz"&&(Ke.innerHTML=ia),an=i(e),D=r(e,"H2",{class:!0});var It=T(D);de=r(It,"A",{id:!0,class:!0,href:!0});var Lo=T(de);xo=r(Lo,"SPAN",{});var Xo=T(xo);_(et.$$.fragment,Xo),Xo.forEach(o),Lo.forEach(o),qn=i(It),qt=r(It,"SPAN",{"data-svelte-h":!0}),g(qt)!=="svelte-w4zzv6"&&(qt.textContent=da),It.forEach(o),rn=i(e),tt=r(e,"P",{"data-svelte-h":!0}),g(tt)!=="svelte-11jcle7"&&(tt.textContent=ca),ln=i(e),ot=r(e,"UL",{"data-svelte-h":!0}),g(ot)!=="svelte-1tw7src"&&(ot.innerHTML=pa),dn=i(e),nt=r(e,"P",{"data-svelte-h":!0}),g(nt)!=="svelte-1xesile"&&(nt.textContent=ma),cn=i(e),O=r(e,"H2",{class:!0});var zt=T(O);ce=r(zt,"A",{id:!0,class:!0,href:!0});var Ro=T(ce);Uo=r(Ro,"SPAN",{});var So=T(Uo);_(st.$$.fragment,So),So.forEach(o),Ro.forEach(o),Pn=i(zt),Pt=r(zt,"SPAN",{"data-svelte-h":!0}),g(Pt)!=="svelte-isgiwe"&&(Pt.textContent=ha),zt.forEach(o),pn=i(e),z=r(e,"DIV",{class:!0});var G=T(z);_(at.$$.fragment,G),Qn=i(G),Qt=r(G,"P",{"data-svelte-h":!0}),g(Qt)!=="svelte-1gegatm"&&(Qt.innerHTML=ga),En=i(G),Et=r(G,"P",{"data-svelte-h":!0}),g(Et)!=="svelte-10kqkkl"&&(Et.innerHTML=ua),Ln=i(G),_(pe.$$.fragment,G),Xn=i(G),me=r(G,"DIV",{class:!0});var Wt=T(me);_(rt.$$.fragment,Wt),Rn=i(Wt),Lt=r(Wt,"P",{"data-svelte-h":!0}),g(Lt)!=="svelte-1jb4qgw"&&(Lt.innerHTML=fa),Wt.forEach(o),G.forEach(o),mn=i(e),K=r(e,"H2",{class:!0});var Ft=T(K);he=r(Ft,"A",{id:!0,class:!0,href:!0});var Ho=T(he);Zo=r(Ho,"SPAN",{});var Yo=T(Zo);_(lt.$$.fragment,Yo),Yo.forEach(o),Ho.forEach(o),Sn=i(Ft),Xt=r(Ft,"SPAN",{"data-svelte-h":!0}),g(Xt)!=="svelte-17ofdky"&&(Xt.textContent=_a),Ft.forEach(o),hn=i(e),F=r(e,"DIV",{class:!0});var Ve=T(F);_(it.$$.fragment,Ve),Hn=i(Ve),Rt=r(Ve,"P",{"data-svelte-h":!0}),g(Rt)!=="svelte-21r55b"&&(Rt.innerHTML=ba),Yn=i(Ve),St=r(Ve,"P",{"data-svelte-h":!0}),g(St)!=="svelte-10kqkkl"&&(St.innerHTML=va),An=i(Ve),_(ge.$$.fragment,Ve),Ve.forEach(o),gn=i(e),ee=r(e,"H2",{class:!0});var kn=T(ee);ue=r(kn,"A",{id:!0,class:!0,href:!0});var Da=T(ue);Io=r(Da,"SPAN",{});var Oa=T(Io);_(dt.$$.fragment,Oa),Oa.forEach(o),Da.forEach(o),Dn=i(kn),Ht=r(kn,"SPAN",{"data-svelte-h":!0}),g(Ht)!=="svelte-xx3d22"&&(Ht.textContent=ya),kn.forEach(o),un=i(e),N=r(e,"DIV",{class:!0});var qe=T(N);_(ct.$$.fragment,qe),On=i(qe),Yt=r(qe,"P",{"data-svelte-h":!0}),g(Yt)!=="svelte-53j64l"&&(Yt.innerHTML=Ma),Kn=i(qe),At=r(qe,"P",{"data-svelte-h":!0}),g(At)!=="svelte-oxn14q"&&(At.innerHTML=wa),es=i(qe),_(fe.$$.fragment,qe),qe.forEach(o),fn=i(e),te=r(e,"H2",{class:!0});var Cn=T(te);_e=r(Cn,"A",{id:!0,class:!0,href:!0});var Ka=T(_e);zo=r(Ka,"SPAN",{});var er=T(zo);_(pt.$$.fragment,er),er.forEach(o),Ka.forEach(o),ts=i(Cn),Dt=r(Cn,"SPAN",{"data-svelte-h":!0}),g(Dt)!=="svelte-zr8ioy"&&(Dt.textContent=Ta),Cn.forEach(o),_n=i(e),W=r(e,"DIV",{class:!0});var S=T(W);_(mt.$$.fragment,S),os=i(S),Ot=r(S,"P",{"data-svelte-h":!0}),g(Ot)!=="svelte-qq98xh"&&(Ot.textContent=$a),ns=i(S),Kt=r(S,"P",{"data-svelte-h":!0}),g(Kt)!=="svelte-14igift"&&(Kt.innerHTML=Ba),ss=i(S),be=r(S,"DIV",{class:!0});var xn=T(be);_(ht.$$.fragment,xn),as=i(xn),eo=r(xn,"P",{"data-svelte-h":!0}),g(eo)!=="svelte-14y56zg"&&(eo.innerHTML=Ja),xn.forEach(o),rs=i(S),ve=r(S,"DIV",{class:!0});var Un=T(ve);_(gt.$$.fragment,Un),ls=i(Un),to=r(Un,"P",{"data-svelte-h":!0}),g(to)!=="svelte-130gfym"&&(to.innerHTML=ja),Un.forEach(o),S.forEach(o),bn=i(e),oe=r(e,"H2",{class:!0});var Zn=T(oe);ye=r(Zn,"A",{id:!0,class:!0,href:!0});var tr=T(ye);Wo=r(tr,"SPAN",{});var or=T(Wo);_(ut.$$.fragment,or),or.forEach(o),tr.forEach(o),is=i(Zn),oo=r(Zn,"SPAN",{"data-svelte-h":!0}),g(oo)!=="svelte-1fko665"&&(oo.textContent=ka),Zn.forEach(o),vn=i(e),ne=r(e,"DIV",{class:!0});var In=T(ne);_(ft.$$.fragment,In),ds=i(In),X=r(In,"DIV",{class:!0});var Jo=T(X);_(_t.$$.fragment,Jo),cs=i(Jo),no=r(Jo,"P",{"data-svelte-h":!0}),g(no)!=="svelte-1071rbt"&&(no.innerHTML=Ca),ps=i(Jo),_(Me.$$.fragment,Jo),Jo.forEach(o),In.forEach(o),yn=i(e),se=r(e,"H2",{class:!0});var zn=T(se);we=r(zn,"A",{id:!0,class:!0,href:!0});var nr=T(we);Fo=r(nr,"SPAN",{});var sr=T(Fo);_(bt.$$.fragment,sr),sr.forEach(o),nr.forEach(o),ms=i(zn),so=r(zn,"SPAN",{"data-svelte-h":!0}),g(so)!=="svelte-mfd6uz"&&(so.textContent=xa),zn.forEach(o),Mn=i(e),E=r(e,"DIV",{class:!0});var jo=T(E);_(vt.$$.fragment,jo),hs=i(jo),ao=r(jo,"P",{"data-svelte-h":!0}),g(ao)!=="svelte-d9cja9"&&(ao.textContent=Ua),gs=i(jo),R=r(jo,"DIV",{class:!0});var ko=T(R);_(yt.$$.fragment,ko),us=i(ko),ro=r(ko,"P",{"data-svelte-h":!0}),g(ro)!=="svelte-sj4g2x"&&(ro.innerHTML=Za),fs=i(ko),lo=r(ko,"UL",{"data-svelte-h":!0}),g(lo)!=="svelte-1mo0n1o"&&(lo.innerHTML=Ia),ko.forEach(o),jo.forEach(o),wn=i(e),ae=r(e,"H2",{class:!0});var Wn=T(ae);Te=r(Wn,"A",{id:!0,class:!0,href:!0});var ar=T(Te);No=r(ar,"SPAN",{});var rr=T(No);_(Mt.$$.fragment,rr),rr.forEach(o),ar.forEach(o),_s=i(Wn),io=r(Wn,"SPAN",{"data-svelte-h":!0}),g(io)!=="svelte-enx4h1"&&(io.textContent=za),Wn.forEach(o),Tn=i(e),J=r(e,"DIV",{class:!0});var U=T(J);_(wt.$$.fragment,U),bs=i(U),co=r(U,"P",{"data-svelte-h":!0}),g(co)!=="svelte-1ib14ae"&&(co.textContent=Wa),vs=i(U),po=r(U,"P",{"data-svelte-h":!0}),g(po)!=="svelte-hmtw9k"&&(po.innerHTML=Fa),ys=i(U),mo=r(U,"P",{"data-svelte-h":!0}),g(mo)!=="svelte-hswkmf"&&(mo.innerHTML=Na),Ms=i(U),V=r(U,"DIV",{class:!0});var Pe=T(V);_(Tt.$$.fragment,Pe),ws=i(Pe),ho=r(Pe,"P",{"data-svelte-h":!0}),g(ho)!=="svelte-6gzi95"&&(ho.innerHTML=Ga),Ts=i(Pe),_($e.$$.fragment,Pe),$s=i(Pe),_(Be.$$.fragment,Pe),Pe.forEach(o),Bs=i(U),q=r(U,"DIV",{class:!0});var Qe=T(q);_($t.$$.fragment,Qe),Js=i(Qe),go=r(Qe,"P",{"data-svelte-h":!0}),g(go)!=="svelte-6gzi95"&&(go.innerHTML=Va),js=i(Qe),_(Je.$$.fragment,Qe),ks=i(Qe),_(je.$$.fragment,Qe),Qe.forEach(o),Cs=i(U),P=r(U,"DIV",{class:!0});var Ee=T(P);_(Bt.$$.fragment,Ee),xs=i(Ee),uo=r(Ee,"P",{"data-svelte-h":!0}),g(uo)!=="svelte-6gzi95"&&(uo.innerHTML=qa),Us=i(Ee),_(ke.$$.fragment,Ee),Zs=i(Ee),_(Ce.$$.fragment,Ee),Ee.forEach(o),Is=i(U),Q=r(U,"DIV",{class:!0});var Le=T(Q);_(Jt.$$.fragment,Le),zs=i(Le),fo=r(Le,"P",{"data-svelte-h":!0}),g(fo)!=="svelte-6gzi95"&&(fo.innerHTML=Pa),Ws=i(Le),_(xe.$$.fragment,Le),Fs=i(Le),_(Ue.$$.fragment,Le),Le.forEach(o),U.forEach(o),$n=i(e),re=r(e,"H2",{class:!0});var Fn=T(re);Ze=r(Fn,"A",{id:!0,class:!0,href:!0});var lr=T(Ze);Go=r(lr,"SPAN",{});var ir=T(Go);_(jt.$$.fragment,ir),ir.forEach(o),lr.forEach(o),Ns=i(Fn),_o=r(Fn,"SPAN",{"data-svelte-h":!0}),g(_o)!=="svelte-1bxkavn"&&(_o.textContent=Qa),Fn.forEach(o),Bn=i(e),j=r(e,"DIV",{class:!0});var Z=T(j);_(kt.$$.fragment,Z),Gs=i(Z),bo=r(Z,"P",{"data-svelte-h":!0}),g(bo)!=="svelte-1fsmwyj"&&(bo.textContent=Ea),Vs=i(Z),vo=r(Z,"P",{"data-svelte-h":!0}),g(vo)!=="svelte-1ks26sg"&&(vo.innerHTML=La),qs=i(Z),_(Ie.$$.fragment,Z),Ps=i(Z),yo=r(Z,"P",{"data-svelte-h":!0}),g(yo)!=="svelte-hmtw9k"&&(yo.innerHTML=Xa),Qs=i(Z),Mo=r(Z,"P",{"data-svelte-h":!0}),g(Mo)!=="svelte-hswkmf"&&(Mo.innerHTML=Ra),Es=i(Z),k=r(Z,"DIV",{class:!0});var I=T(k);_(Ct.$$.fragment,I),Ls=i(I),wo=r(I,"P",{"data-svelte-h":!0}),g(wo)!=="svelte-19ikdp"&&(wo.innerHTML=Sa),Xs=i(I),_(ze.$$.fragment,I),Rs=i(I),To=r(I,"P",{"data-svelte-h":!0}),g(To)!=="svelte-kvfsh7"&&(To.textContent=Ha),Ss=i(I),_(We.$$.fragment,I),Hs=i(I),_(Fe.$$.fragment,I),Ys=i(I),$o=r(I,"P",{"data-svelte-h":!0}),g($o)!=="svelte-gy1q6u"&&($o.innerHTML=Ya),As=i(I),_(Ne.$$.fragment,I),I.forEach(o),Ds=i(Z),Ge=r(Z,"DIV",{class:!0});var Nn=T(Ge);_(xt.$$.fragment,Nn),Os=i(Nn),Bo=r(Nn,"P",{"data-svelte-h":!0}),g(Bo)!=="svelte-eq620n"&&(Bo.innerHTML=Aa),Nn.forEach(o),Z.forEach(o),Jn=i(e),Vo=r(e,"P",{}),T(Vo).forEach(o),this.h()},h(){h(t,"name","hf:doc:metadata"),h(t,"content",JSON.stringify(Ir)),h(s,"id","blip2"),h(s,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(s,"href","#blip2"),h(w,"class","relative group"),h(le,"id","overview"),h(le,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(le,"href","#overview"),h(A,"class","relative group"),cr(ie.src,ra="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/model_doc/blip2_architecture.jpg")||h(ie,"src",ra),h(ie,"alt","drawing"),h(ie,"width","600"),h(de,"id","resources"),h(de,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(de,"href","#resources"),h(D,"class","relative group"),h(ce,"id","transformers.Blip2Config"),h(ce,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(ce,"href","#transformers.Blip2Config"),h(O,"class","relative group"),h(me,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(he,"id","transformers.Blip2VisionConfig"),h(he,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(he,"href","#transformers.Blip2VisionConfig"),h(K,"class","relative group"),h(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(ue,"id","transformers.Blip2QFormerConfig"),h(ue,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(ue,"href","#transformers.Blip2QFormerConfig"),h(ee,"class","relative group"),h(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(_e,"id","transformers.Blip2Processor"),h(_e,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(_e,"href","#transformers.Blip2Processor"),h(te,"class","relative group"),h(be,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(ve,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(ye,"id","transformers.Blip2VisionModel"),h(ye,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(ye,"href","#transformers.Blip2VisionModel"),h(oe,"class","relative group"),h(X,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(ne,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(we,"id","transformers.Blip2QFormerModel"),h(we,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(we,"href","#transformers.Blip2QFormerModel"),h(se,"class","relative group"),h(R,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(E,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Te,"id","transformers.Blip2Model"),h(Te,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(Te,"href","#transformers.Blip2Model"),h(ae,"class","relative group"),h(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Ze,"id","transformers.Blip2ForConditionalGeneration"),h(Ze,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(Ze,"href","#transformers.Blip2ForConditionalGeneration"),h(re,"class","relative group"),h(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Ge,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(j,"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,c){n(document.head,t),m(e,u,c),m(e,d,c),m(e,p,c),m(e,w,c),n(w,s),n(s,$),b(Xe,$,null),n(w,Gn),n(w,Gt),m(e,Ao,c),m(e,A,c),n(A,le),n(le,Co),b(Re,Co,null),n(A,Vn),n(A,Vt),m(e,Do,c),m(e,Se,c),m(e,Oo,c),m(e,He,c),m(e,Ko,c),m(e,Ye,c),m(e,en,c),m(e,Ae,c),m(e,tn,c),m(e,De,c),m(e,on,c),m(e,ie,c),m(e,nn,c),m(e,Oe,c),m(e,sn,c),m(e,Ke,c),m(e,an,c),m(e,D,c),n(D,de),n(de,xo),b(et,xo,null),n(D,qn),n(D,qt),m(e,rn,c),m(e,tt,c),m(e,ln,c),m(e,ot,c),m(e,dn,c),m(e,nt,c),m(e,cn,c),m(e,O,c),n(O,ce),n(ce,Uo),b(st,Uo,null),n(O,Pn),n(O,Pt),m(e,pn,c),m(e,z,c),b(at,z,null),n(z,Qn),n(z,Qt),n(z,En),n(z,Et),n(z,Ln),b(pe,z,null),n(z,Xn),n(z,me),b(rt,me,null),n(me,Rn),n(me,Lt),m(e,mn,c),m(e,K,c),n(K,he),n(he,Zo),b(lt,Zo,null),n(K,Sn),n(K,Xt),m(e,hn,c),m(e,F,c),b(it,F,null),n(F,Hn),n(F,Rt),n(F,Yn),n(F,St),n(F,An),b(ge,F,null),m(e,gn,c),m(e,ee,c),n(ee,ue),n(ue,Io),b(dt,Io,null),n(ee,Dn),n(ee,Ht),m(e,un,c),m(e,N,c),b(ct,N,null),n(N,On),n(N,Yt),n(N,Kn),n(N,At),n(N,es),b(fe,N,null),m(e,fn,c),m(e,te,c),n(te,_e),n(_e,zo),b(pt,zo,null),n(te,ts),n(te,Dt),m(e,_n,c),m(e,W,c),b(mt,W,null),n(W,os),n(W,Ot),n(W,ns),n(W,Kt),n(W,ss),n(W,be),b(ht,be,null),n(be,as),n(be,eo),n(W,rs),n(W,ve),b(gt,ve,null),n(ve,ls),n(ve,to),m(e,bn,c),m(e,oe,c),n(oe,ye),n(ye,Wo),b(ut,Wo,null),n(oe,is),n(oe,oo),m(e,vn,c),m(e,ne,c),b(ft,ne,null),n(ne,ds),n(ne,X),b(_t,X,null),n(X,cs),n(X,no),n(X,ps),b(Me,X,null),m(e,yn,c),m(e,se,c),n(se,we),n(we,Fo),b(bt,Fo,null),n(se,ms),n(se,so),m(e,Mn,c),m(e,E,c),b(vt,E,null),n(E,hs),n(E,ao),n(E,gs),n(E,R),b(yt,R,null),n(R,us),n(R,ro),n(R,fs),n(R,lo),m(e,wn,c),m(e,ae,c),n(ae,Te),n(Te,No),b(Mt,No,null),n(ae,_s),n(ae,io),m(e,Tn,c),m(e,J,c),b(wt,J,null),n(J,bs),n(J,co),n(J,vs),n(J,po),n(J,ys),n(J,mo),n(J,Ms),n(J,V),b(Tt,V,null),n(V,ws),n(V,ho),n(V,Ts),b($e,V,null),n(V,$s),b(Be,V,null),n(J,Bs),n(J,q),b($t,q,null),n(q,Js),n(q,go),n(q,js),b(Je,q,null),n(q,ks),b(je,q,null),n(J,Cs),n(J,P),b(Bt,P,null),n(P,xs),n(P,uo),n(P,Us),b(ke,P,null),n(P,Zs),b(Ce,P,null),n(J,Is),n(J,Q),b(Jt,Q,null),n(Q,zs),n(Q,fo),n(Q,Ws),b(xe,Q,null),n(Q,Fs),b(Ue,Q,null),m(e,$n,c),m(e,re,c),n(re,Ze),n(Ze,Go),b(jt,Go,null),n(re,Ns),n(re,_o),m(e,Bn,c),m(e,j,c),b(kt,j,null),n(j,Gs),n(j,bo),n(j,Vs),n(j,vo),n(j,qs),b(Ie,j,null),n(j,Ps),n(j,yo),n(j,Qs),n(j,Mo),n(j,Es),n(j,k),b(Ct,k,null),n(k,Ls),n(k,wo),n(k,Xs),b(ze,k,null),n(k,Rs),n(k,To),n(k,Ss),b(We,k,null),n(k,Hs),b(Fe,k,null),n(k,Ys),n(k,$o),n(k,As),b(Ne,k,null),n(j,Ds),n(j,Ge),b(xt,Ge,null),n(Ge,Os),n(Ge,Bo),m(e,Jn,c),m(e,Vo,c),jn=!0},p(e,[c]){const Ut={};c&2&&(Ut.$$scope={dirty:c,ctx:e}),pe.$set(Ut);const qo={};c&2&&(qo.$$scope={dirty:c,ctx:e}),ge.$set(qo);const Po={};c&2&&(Po.$$scope={dirty:c,ctx:e}),fe.$set(Po);const Zt={};c&2&&(Zt.$$scope={dirty:c,ctx:e}),Me.$set(Zt);const Qo={};c&2&&(Qo.$$scope={dirty:c,ctx:e}),$e.$set(Qo);const Eo={};c&2&&(Eo.$$scope={dirty:c,ctx:e}),Be.$set(Eo);const It={};c&2&&(It.$$scope={dirty:c,ctx:e}),Je.$set(It);const Lo={};c&2&&(Lo.$$scope={dirty:c,ctx:e}),je.$set(Lo);const Xo={};c&2&&(Xo.$$scope={dirty:c,ctx:e}),ke.$set(Xo);const zt={};c&2&&(zt.$$scope={dirty:c,ctx:e}),Ce.$set(zt);const Ro={};c&2&&(Ro.$$scope={dirty:c,ctx:e}),xe.$set(Ro);const So={};c&2&&(So.$$scope={dirty:c,ctx:e}),Ue.$set(So);const G={};c&2&&(G.$$scope={dirty:c,ctx:e}),Ie.$set(G);const Wt={};c&2&&(Wt.$$scope={dirty:c,ctx:e}),ze.$set(Wt);const Ft={};c&2&&(Ft.$$scope={dirty:c,ctx:e}),We.$set(Ft);const Ho={};c&2&&(Ho.$$scope={dirty:c,ctx:e}),Fe.$set(Ho);const Yo={};c&2&&(Yo.$$scope={dirty:c,ctx:e}),Ne.$set(Yo)},i(e){jn||(v(Xe.$$.fragment,e),v(Re.$$.fragment,e),v(et.$$.fragment,e),v(st.$$.fragment,e),v(at.$$.fragment,e),v(pe.$$.fragment,e),v(rt.$$.fragment,e),v(lt.$$.fragment,e),v(it.$$.fragment,e),v(ge.$$.fragment,e),v(dt.$$.fragment,e),v(ct.$$.fragment,e),v(fe.$$.fragment,e),v(pt.$$.fragment,e),v(mt.$$.fragment,e),v(ht.$$.fragment,e),v(gt.$$.fragment,e),v(ut.$$.fragment,e),v(ft.$$.fragment,e),v(_t.$$.fragment,e),v(Me.$$.fragment,e),v(bt.$$.fragment,e),v(vt.$$.fragment,e),v(yt.$$.fragment,e),v(Mt.$$.fragment,e),v(wt.$$.fragment,e),v(Tt.$$.fragment,e),v($e.$$.fragment,e),v(Be.$$.fragment,e),v($t.$$.fragment,e),v(Je.$$.fragment,e),v(je.$$.fragment,e),v(Bt.$$.fragment,e),v(ke.$$.fragment,e),v(Ce.$$.fragment,e),v(Jt.$$.fragment,e),v(xe.$$.fragment,e),v(Ue.$$.fragment,e),v(jt.$$.fragment,e),v(kt.$$.fragment,e),v(Ie.$$.fragment,e),v(Ct.$$.fragment,e),v(ze.$$.fragment,e),v(We.$$.fragment,e),v(Fe.$$.fragment,e),v(Ne.$$.fragment,e),v(xt.$$.fragment,e),jn=!0)},o(e){y(Xe.$$.fragment,e),y(Re.$$.fragment,e),y(et.$$.fragment,e),y(st.$$.fragment,e),y(at.$$.fragment,e),y(pe.$$.fragment,e),y(rt.$$.fragment,e),y(lt.$$.fragment,e),y(it.$$.fragment,e),y(ge.$$.fragment,e),y(dt.$$.fragment,e),y(ct.$$.fragment,e),y(fe.$$.fragment,e),y(pt.$$.fragment,e),y(mt.$$.fragment,e),y(ht.$$.fragment,e),y(gt.$$.fragment,e),y(ut.$$.fragment,e),y(ft.$$.fragment,e),y(_t.$$.fragment,e),y(Me.$$.fragment,e),y(bt.$$.fragment,e),y(vt.$$.fragment,e),y(yt.$$.fragment,e),y(Mt.$$.fragment,e),y(wt.$$.fragment,e),y(Tt.$$.fragment,e),y($e.$$.fragment,e),y(Be.$$.fragment,e),y($t.$$.fragment,e),y(Je.$$.fragment,e),y(je.$$.fragment,e),y(Bt.$$.fragment,e),y(ke.$$.fragment,e),y(Ce.$$.fragment,e),y(Jt.$$.fragment,e),y(xe.$$.fragment,e),y(Ue.$$.fragment,e),y(jt.$$.fragment,e),y(kt.$$.fragment,e),y(Ie.$$.fragment,e),y(Ct.$$.fragment,e),y(ze.$$.fragment,e),y(We.$$.fragment,e),y(Fe.$$.fragment,e),y(Ne.$$.fragment,e),y(xt.$$.fragment,e),jn=!1},d(e){e&&(o(u),o(d),o(p),o(w),o(Ao),o(A),o(Do),o(Se),o(Oo),o(He),o(Ko),o(Ye),o(en),o(Ae),o(tn),o(De),o(on),o(ie),o(nn),o(Oe),o(sn),o(Ke),o(an),o(D),o(rn),o(tt),o(ln),o(ot),o(dn),o(nt),o(cn),o(O),o(pn),o(z),o(mn),o(K),o(hn),o(F),o(gn),o(ee),o(un),o(N),o(fn),o(te),o(_n),o(W),o(bn),o(oe),o(vn),o(ne),o(yn),o(se),o(Mn),o(E),o(wn),o(ae),o(Tn),o(J),o($n),o(re),o(Bn),o(j),o(Jn),o(Vo)),o(t),M(Xe),M(Re),M(et),M(st),M(at),M(pe),M(rt),M(lt),M(it),M(ge),M(dt),M(ct),M(fe),M(pt),M(mt),M(ht),M(gt),M(ut),M(ft),M(_t),M(Me),M(bt),M(vt),M(yt),M(Mt),M(wt),M(Tt),M($e),M(Be),M($t),M(Je),M(je),M(Bt),M(ke),M(Ce),M(Jt),M(xe),M(Ue),M(jt),M(kt),M(Ie),M(Ct),M(ze),M(We),M(Fe),M(Ne),M(xt)}}}const Ir={local:"blip2",sections:[{local:"overview",title:"Overview"},{local:"resources",title:"Resources"},{local:"transformers.Blip2Config",title:"Blip2Config"},{local:"transformers.Blip2VisionConfig",title:"Blip2VisionConfig"},{local:"transformers.Blip2QFormerConfig",title:"Blip2QFormerConfig"},{local:"transformers.Blip2Processor",title:"Blip2Processor"},{local:"transformers.Blip2VisionModel",title:"Blip2VisionModel"},{local:"transformers.Blip2QFormerModel",title:"Blip2QFormerModel"},{local:"transformers.Blip2Model",title:"Blip2Model"},{local:"transformers.Blip2ForConditionalGeneration",title:"Blip2ForConditionalGeneration"}],title:"BLIP-2"};function zr(B){return pr(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Qr extends mr{constructor(t){super(),hr(this,t,zr,Zr,dr,{})}}export{Qr as component};
